Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
okcaptain committed Mar 16, 2024
2 parents 6527b35 + 16fcb13 commit c53fab0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.fongmi.android.tv"
minSdk 21
targetSdk 28
versionCode 230
versionName "0315"
versionCode 231
versionName "2.3.1"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class HomeActivity extends BaseActivity implements CustomTitleView.Listen
private View mOldView;
private boolean confirm;
private Clock mClock;
private View mFocus;

private Site getHome() {
return VodConfig.get().getHome();
Expand Down Expand Up @@ -197,6 +198,7 @@ public void homeContent() {
String title = getHome().getName();
mBinding.title.setText(title.isEmpty() ? ResUtil.getString(R.string.app_name) : title);
if (getHome().getKey().isEmpty()) return;
mFocus = getCurrentFocus();
getHomeFragment().mBinding.progressLayout.showProgress();
mViewModel.homeContent();
}
Expand All @@ -211,7 +213,7 @@ public void setTypes(Result result) {
mPageAdapter.notifyDataSetChanged();
getHomeFragment().addVideo(result);
getHomeFragment().mBinding.progressLayout.showContent();
setFocus();
App.post(() -> setFocus(), 200);
}

private void setPager() {
Expand Down Expand Up @@ -319,7 +321,8 @@ public void success() {
@Override
public void error(String msg) {
if (TextUtils.isEmpty(msg) && AppDatabase.getBackup().exists()) onRestore();
getHomeFragment().mBinding.progressLayout.showContent();
else if (getHomeFragment().init) getHomeFragment().mBinding.progressLayout.showContent();
else App.post(() -> getHomeFragment().mBinding.progressLayout.showContent(), 1000);
mResult = Result.empty();
Notify.show(msg);
}
Expand Down Expand Up @@ -465,8 +468,8 @@ public void setLoading(boolean loading) {

private void setFocus() {
setLoading(false);
App.post(() -> mBinding.title.setFocusable(true), 500);
if (!mBinding.title.hasFocus()) {
if (!mBinding.title.isFocusable()) App.post(() -> mBinding.title.setFocusable(true), 500);
if (mFocus != mBinding.title) {
if (Setting.getHomeUI() == 0) getHomeFragment().mBinding.recycler.requestFocus();
else mBinding.recycler.requestFocus();
}
Expand Down Expand Up @@ -511,11 +514,11 @@ protected boolean handleBack() {

@Override
protected void onBackPress() {
if (mBinding.recycler.getSelectedPosition() != 0) {
if (isVisible(mBinding.recycler) && mBinding.recycler.getSelectedPosition() != 0) {
mBinding.recycler.scrollToPosition(0);
} else if (mPageAdapter != null && getHomeFragment().mBinding.progressLayout.isProgress()) {
} else if (mPageAdapter != null && getHomeFragment().init && getHomeFragment().mBinding.progressLayout.isProgress()) {
getHomeFragment().mBinding.progressLayout.showContent();
} else if (mPageAdapter != null && getHomeFragment().mPresenter != null && getHomeFragment().mPresenter.isDelete()) {
} else if (mPageAdapter != null && getHomeFragment().init && getHomeFragment().mPresenter != null && getHomeFragment().mPresenter.isDelete()) {
getHomeFragment().setHistoryDelete(false);
} else if (getHomeFragment().canBack()) {
getHomeFragment().goBack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class HomeFragment extends BaseFragment implements VodPresenter.OnClickLi
private ArrayObjectAdapter mHistoryAdapter;
public HistoryPresenter mPresenter;
private ArrayObjectAdapter mAdapter;
public boolean init;
private int homeUI;
private String button;

Expand All @@ -75,6 +76,7 @@ protected void initView() {
setRecyclerView();
setAdapter();
initEvent();
init = true;
}

@Override
Expand Down

0 comments on commit c53fab0

Please sign in to comment.