-
-
Notifications
You must be signed in to change notification settings - Fork 849
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from xuexiangjys/dev/1.2.1
Dev/1.2.1
- Loading branch information
Showing
76 changed files
with
3,685 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
app/src/main/java/com/xuexiang/xuidemo/activity/MaterialDesignThemeActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2023 xuexiangjys([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.xuexiang.xuidemo.activity; | ||
|
||
import com.xuexiang.xuidemo.R; | ||
import com.xuexiang.xuidemo.base.BaseActivity; | ||
|
||
/** | ||
* 使用Theme.MaterialComponents作为主题的Activity | ||
* | ||
* @author xuexiang | ||
* @since 5/14/23 10:30 PM | ||
*/ | ||
public class MaterialDesignThemeActivity extends BaseActivity { | ||
|
||
@Override | ||
protected void initAppTheme() { | ||
setTheme(R.style.MaterialDesignTheme); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
.../xuexiang/xuidemo/fragment/components/refresh/sample/preload/AbstractNewListFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (C) 2023 xuexiangjys([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.xuexiang.xuidemo.fragment.components.refresh.sample.preload; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import com.scwang.smartrefresh.layout.SmartRefreshLayout; | ||
import com.scwang.smartrefresh.layout.api.RefreshLayout; | ||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener; | ||
import com.xuexiang.xui.adapter.recyclerview.BaseRecyclerAdapter; | ||
import com.xuexiang.xui.utils.WidgetUtils; | ||
import com.xuexiang.xuidemo.DemoDataProvider; | ||
import com.xuexiang.xuidemo.R; | ||
import com.xuexiang.xuidemo.adapter.entity.NewInfo; | ||
import com.xuexiang.xuidemo.base.BaseFragment; | ||
|
||
import butterknife.BindView; | ||
|
||
/** | ||
* @author xuexiang | ||
* @since 6/21/23 1:29 AM | ||
*/ | ||
public abstract class AbstractNewListFragment extends BaseFragment { | ||
|
||
@BindView(R.id.recyclerView) | ||
RecyclerView recyclerView; | ||
@BindView(R.id.refreshLayout) | ||
SmartRefreshLayout refreshLayout; | ||
|
||
private BaseRecyclerAdapter<NewInfo> mAdapter; | ||
|
||
@Override | ||
protected int getLayoutId() { | ||
return R.layout.fragment_refresh_load_more_recyclerview; | ||
} | ||
|
||
@Override | ||
protected void initViews() { | ||
WidgetUtils.initRecyclerView(recyclerView); | ||
recyclerView.setAdapter(mAdapter = createAdapter()); | ||
} | ||
|
||
protected abstract BaseRecyclerAdapter<NewInfo> createAdapter(); | ||
|
||
@Override | ||
protected void initListeners() { | ||
refreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() { | ||
@Override | ||
public void onRefresh(@NonNull RefreshLayout refreshLayout) { | ||
refreshLayout.getLayout().postDelayed(() -> { | ||
mAdapter.refresh(DemoDataProvider.getRefreshDemoNewInfos()); | ||
refreshLayout.finishRefresh(); | ||
}, 1000); | ||
|
||
} | ||
|
||
@Override | ||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) { | ||
refreshLayout.getLayout().postDelayed(() -> { | ||
mAdapter.loadMore(DemoDataProvider.getRefreshDemoNewInfos()); | ||
refreshLayout.finishLoadMore(); | ||
}, 1000); | ||
|
||
} | ||
}); | ||
refreshLayout.autoRefresh(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...om/xuexiang/xuidemo/fragment/components/refresh/sample/preload/AfterOptimizeFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (C) 2023 xuexiangjys([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.xuexiang.xuidemo.fragment.components.refresh.sample.preload; | ||
|
||
import com.xuexiang.xpage.annotation.Page; | ||
import com.xuexiang.xui.adapter.recyclerview.BaseRecyclerAdapter; | ||
import com.xuexiang.xuidemo.adapter.entity.NewInfo; | ||
import com.xuexiang.xuidemo.fragment.components.refresh.sample.preload.adapter.OptimizeListAdapter; | ||
|
||
/** | ||
* @author xuexiang | ||
* @since 6/21/23 12:47 AM | ||
*/ | ||
@Page(name = "ViewHolder加载优化后") | ||
public class AfterOptimizeFragment extends AbstractNewListFragment { | ||
|
||
@Override | ||
protected BaseRecyclerAdapter<NewInfo> createAdapter() { | ||
return new OptimizeListAdapter(recyclerView); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...m/xuexiang/xuidemo/fragment/components/refresh/sample/preload/BeforeOptimizeFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (C) 2023 xuexiangjys([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.xuexiang.xuidemo.fragment.components.refresh.sample.preload; | ||
|
||
import com.xuexiang.xpage.annotation.Page; | ||
import com.xuexiang.xui.adapter.recyclerview.BaseRecyclerAdapter; | ||
import com.xuexiang.xuidemo.adapter.entity.NewInfo; | ||
import com.xuexiang.xuidemo.fragment.components.refresh.sample.preload.adapter.MockLongTimeLoadListAdapter; | ||
|
||
/** | ||
* @author xuexiang | ||
* @since 6/21/23 12:46 AM | ||
*/ | ||
@Page(name = "ViewHolder加载优化前") | ||
public class BeforeOptimizeFragment extends AbstractNewListFragment { | ||
|
||
@Override | ||
protected BaseRecyclerAdapter<NewInfo> createAdapter() { | ||
return new MockLongTimeLoadListAdapter(); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...uexiang/xuidemo/fragment/components/refresh/sample/preload/PreloadViewHolderFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C) 2023 xuexiangjys([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.xuexiang.xuidemo.fragment.components.refresh.sample.preload; | ||
|
||
import com.xuexiang.xpage.annotation.Page; | ||
import com.xuexiang.xuidemo.base.ComponentContainerFragment; | ||
|
||
/** | ||
* @author xuexiang | ||
* @since 6/20/23 12:33 AM | ||
*/ | ||
@Page(name = "ViewHolder异步预加载优化") | ||
public class PreloadViewHolderFragment extends ComponentContainerFragment { | ||
|
||
@Override | ||
protected Class[] getPagesClasses() { | ||
return new Class[]{ | ||
BeforeOptimizeFragment.class, | ||
AfterOptimizeFragment.class | ||
}; | ||
} | ||
} |
Oops, something went wrong.