Clean up BaseScene
This commit is contained in:
20 files changed
+254
-304
No files matched your search
@@ -477,26 +477,15 @@ public final class MainActivity extends StageActivity
|
||||
public void onSceneViewCreated(SceneFragment scene, Bundle savedInstanceState) {
|
||||
super.onSceneViewCreated(scene, savedInstanceState);
|
||||
|
||||
if (scene instanceof BaseScene && mRightDrawer != null && mDrawerLayout != null) {
|
||||
BaseScene baseScene = (BaseScene) scene;
|
||||
mRightDrawer.removeAllViews();
|
||||
View drawerView = baseScene.createDrawerView(
|
||||
baseScene.getLayoutInflater2(), mRightDrawer, savedInstanceState);
|
||||
if (drawerView != null) {
|
||||
mRightDrawer.addView(drawerView);
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
|
||||
} else {
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT);
|
||||
}
|
||||
}
|
||||
createDrawerView(scene);
|
||||
}
|
||||
|
||||
public void recreateDrawerView(SceneFragment scene) {
|
||||
public void createDrawerView(SceneFragment scene) {
|
||||
if (scene instanceof BaseScene && mRightDrawer != null && mDrawerLayout != null) {
|
||||
BaseScene baseScene = (BaseScene) scene;
|
||||
mRightDrawer.removeAllViews();
|
||||
View drawerView = baseScene.createDrawerView(
|
||||
baseScene.getLayoutInflater2(), mRightDrawer, null);
|
||||
baseScene.getLayoutInflater(), mRightDrawer, null);
|
||||
if (drawerView != null) {
|
||||
mRightDrawer.addView(drawerView);
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.hippo.ehviewer.Analytics;
|
||||
@@ -47,8 +48,8 @@ public class AnalyticsScene extends SolidScene implements View.OnClickListener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_analytics, container, false);
|
||||
|
||||
mReject = ViewUtils.$$(view, R.id.reject);
|
||||
@@ -74,8 +75,8 @@ public class AnalyticsScene extends SolidScene implements View.OnClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -90,7 +91,7 @@ public class AnalyticsScene extends SolidScene implements View.OnClickListener {
|
||||
Settings.putAskAnalytics(false);
|
||||
|
||||
// Start new scene and finish it self
|
||||
if (null != activity) {
|
||||
if (activity != null) {
|
||||
startSceneForCheckStep(CHECK_STEP_ANALYTICS, getArguments());
|
||||
}
|
||||
finish();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
@@ -24,7 +25,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -34,7 +34,6 @@ import androidx.annotation.IdRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
@@ -54,8 +53,6 @@ public abstract class BaseScene extends SceneFragment {
|
||||
public static final String KEY_DRAWER_VIEW_STATE =
|
||||
"com.hippo.ehviewer.ui.scene.BaseScene:DRAWER_VIEW_STATE";
|
||||
|
||||
private Context mThemeContext;
|
||||
|
||||
@Nullable
|
||||
private View drawerView;
|
||||
@Nullable
|
||||
@@ -89,15 +86,6 @@ public abstract class BaseScene extends SceneFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public int getDrawerLockMode(int edgeGravity) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof MainActivity) {
|
||||
return ((MainActivity) activity).getDrawerLockMode(edgeGravity);
|
||||
} else {
|
||||
return DrawerLayout.LOCK_MODE_UNLOCKED;
|
||||
}
|
||||
}
|
||||
|
||||
public void openDrawer(int drawerGravity) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof MainActivity) {
|
||||
@@ -153,6 +141,10 @@ public abstract class BaseScene extends SceneFragment {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean needWhiteStatusBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getNavCheckedItem() {
|
||||
return 0;
|
||||
}
|
||||
@@ -168,7 +160,10 @@ public abstract class BaseScene extends SceneFragment {
|
||||
}
|
||||
|
||||
public void recreateDrawerView() {
|
||||
((MainActivity) requireActivity()).recreateDrawerView(this);
|
||||
MainActivity activity = getMainActivity();
|
||||
if (activity != null) {
|
||||
activity.createDrawerView(this);
|
||||
}
|
||||
}
|
||||
|
||||
public final View createDrawerView(LayoutInflater inflater,
|
||||
@@ -223,19 +218,7 @@ public abstract class BaseScene extends SceneFragment {
|
||||
public void onDestroyDrawerView() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public final View onCreateView(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return onCreateView2(LayoutInflater.from(getContext2()), container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
@@ -252,26 +235,13 @@ public abstract class BaseScene extends SceneFragment {
|
||||
|
||||
// Hide soft ime
|
||||
AppHelper.hideSoftInput(getActivity());
|
||||
setWhiteStatusBar(true);
|
||||
}
|
||||
|
||||
public void createThemeContext(@StyleRes int style) {
|
||||
mThemeContext = new ContextThemeWrapper(getContext(), style);
|
||||
}
|
||||
|
||||
public void destroyThemeContext() {
|
||||
mThemeContext = null;
|
||||
setWhiteStatusBar(needWhiteStatusBar());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Context getContext2() {
|
||||
return null != mThemeContext ? mThemeContext : super.getContext();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Resources getResources2() {
|
||||
Context context = getContext2();
|
||||
if (null != context) {
|
||||
public Resources getResourcesOrNull() {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
return context.getResources();
|
||||
} else {
|
||||
return null;
|
||||
@@ -279,7 +249,7 @@ public abstract class BaseScene extends SceneFragment {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MainActivity getActivity2() {
|
||||
public MainActivity getMainActivity() {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof MainActivity) {
|
||||
return (MainActivity) activity;
|
||||
@@ -288,11 +258,6 @@ public abstract class BaseScene extends SceneFragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public LayoutInflater getLayoutInflater2() {
|
||||
return LayoutInflater.from(getContext2());
|
||||
}
|
||||
|
||||
public void hideSoftInput() {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (null != activity) {
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
@@ -106,8 +107,8 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_cookie_sign_in, container, false);
|
||||
mIpbMemberIdLayout = (TextInputLayout) ViewUtils.$$(view, R.id.ipb_member_id_layout);
|
||||
mIpbMemberId = mIpbMemberIdLayout.getEditText();
|
||||
@@ -129,7 +130,7 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
mFromClipboard.setOnClickListener(this);
|
||||
|
||||
// Try to get old version cookie info
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences("eh_info", 0);
|
||||
String ipbMemberId = sharedPreferences.getString("ipb_member_id", null);
|
||||
@@ -192,7 +193,7 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
}
|
||||
|
||||
public void enter() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context || null == mIpbMemberIdLayout || null == mIpbPassHashLayout ||
|
||||
null == mIgneousLayout || null == mIpbMemberId || null == mIpbPassHash ||
|
||||
null == mIgneous) {
|
||||
@@ -235,7 +236,7 @@ public class CookieSignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
}
|
||||
|
||||
private void storeCookie(String id, String hash, String igneous) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
private void initLabels() {
|
||||
final Context context = getContext2();
|
||||
final Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mDownloadManager = EhApplication.getDownloadManager(context);
|
||||
mDownloadManager.addDownloadInfoListener(this);
|
||||
@@ -251,7 +251,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
DownloadManager manager = mDownloadManager;
|
||||
if (null == manager) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null != context) {
|
||||
manager = EhApplication.getDownloadManager(context);
|
||||
}
|
||||
@@ -325,8 +325,8 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateViewWithToolbar(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_download, container, false);
|
||||
|
||||
View content = ViewUtils.$$(view, R.id.content);
|
||||
@@ -336,7 +336,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mViewTransition = new ViewTransition(content, tip);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(content);
|
||||
Resources resources = context.getResources();
|
||||
|
||||
@@ -413,7 +413,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
private void guideDownloadThumb() {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity || !Settings.getGuideDownloadThumb() || null == mLayoutManager || null == mRecyclerView) {
|
||||
guideDownloadLabels();
|
||||
return;
|
||||
@@ -445,7 +445,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
private void guideDownloadLabels() {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity || !Settings.getGuideDownloadLabels()) {
|
||||
return;
|
||||
}
|
||||
@@ -477,7 +477,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
updateTitle();
|
||||
setNavigationIcon(new DrawerArrowDrawable(getContext2(), Color.WHITE));
|
||||
setNavigationIcon(new DrawerArrowDrawable(getContext(), Color.WHITE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -512,7 +512,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
// Skip when in choice mode
|
||||
Activity activity = getActivity2();
|
||||
Activity activity = getMainActivity();
|
||||
if (null == activity || null == mRecyclerView || mRecyclerView.isInCustomChoice()) {
|
||||
return false;
|
||||
}
|
||||
@@ -594,7 +594,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.drawer_list_rv, container, false);
|
||||
|
||||
final Context context = getContext2();
|
||||
final Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||
@@ -694,7 +694,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
public boolean onItemClick(int position) {
|
||||
Activity activity = getActivity2();
|
||||
Activity activity = getMainActivity();
|
||||
EasyRecyclerView recyclerView = mRecyclerView;
|
||||
if (null == activity || null == recyclerView) {
|
||||
return false;
|
||||
@@ -743,8 +743,8 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void onClickSecondaryFab(FabLayout view, FloatingActionButton fab, int position) {
|
||||
Context context = getContext2();
|
||||
Activity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
Activity activity = getMainActivity();
|
||||
EasyRecyclerView recyclerView = mRecyclerView;
|
||||
if (null == context || null == activity || null == recyclerView) {
|
||||
return;
|
||||
@@ -906,17 +906,17 @@ public class DownloadsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
private void bindForState(DownloadHolder holder, DownloadInfo info) {
|
||||
Resources resources = getResources2();
|
||||
if (null == resources) {
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info.state) {
|
||||
case DownloadInfo.STATE_NONE:
|
||||
bindState(holder, info, resources.getString(R.string.download_state_none));
|
||||
bindState(holder, info, context.getString(R.string.download_state_none));
|
||||
break;
|
||||
case DownloadInfo.STATE_WAIT:
|
||||
bindState(holder, info, resources.getString(R.string.download_state_wait));
|
||||
bindState(holder, info, context.getString(R.string.download_state_wait));
|
||||
break;
|
||||
case DownloadInfo.STATE_DOWNLOAD:
|
||||
bindProgress(holder, info);
|
||||
@@ -924,14 +924,14 @@ public class DownloadsScene extends ToolbarScene
|
||||
case DownloadInfo.STATE_FAILED:
|
||||
String text;
|
||||
if (info.legacy <= 0) {
|
||||
text = resources.getString(R.string.download_state_failed);
|
||||
text = context.getString(R.string.download_state_failed);
|
||||
} else {
|
||||
text = resources.getString(R.string.download_state_failed_2, info.legacy);
|
||||
text = context.getString(R.string.download_state_failed_2, info.legacy);
|
||||
}
|
||||
bindState(holder, info, text);
|
||||
break;
|
||||
case DownloadInfo.STATE_FINISH:
|
||||
bindState(holder, info, resources.getString(R.string.download_state_finish));
|
||||
bindState(holder, info, context.getString(R.string.download_state_finish));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1018,7 +1018,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull DownloadLabelHolder holder, int position) {
|
||||
if (mLabels != null) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
String label = mLabels.get(position);
|
||||
if (mDownloadManager == null) {
|
||||
if (context != null) {
|
||||
@@ -1117,7 +1117,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void onMoveItem(int fromPosition, int toPosition) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context || fromPosition == toPosition || toPosition == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -1242,7 +1242,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// Cancel check mode
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -1300,8 +1300,8 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Context context = getContext2();
|
||||
Activity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
Activity activity = getMainActivity();
|
||||
EasyRecyclerView recyclerView = mRecyclerView;
|
||||
if (null == context || null == activity || null == recyclerView || recyclerView.isInCustomChoice()) {
|
||||
return;
|
||||
@@ -1343,7 +1343,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
private final int mListThumbHeight;
|
||||
|
||||
public DownloadAdapter() {
|
||||
mInflater = getLayoutInflater2();
|
||||
mInflater = getLayoutInflater();
|
||||
AssertUtils.assertNotNull(mInflater);
|
||||
|
||||
View calculator = mInflater.inflate(R.layout.item_gallery_list_thumb_height, null);
|
||||
@@ -1521,7 +1521,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -1561,7 +1561,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ import com.hippo.ehviewer.ui.annotation.WholeLifeCircle;
|
||||
import com.hippo.ehviewer.widget.EhDrawerLayout;
|
||||
import com.hippo.ehviewer.widget.GalleryInfoContentHelper;
|
||||
import com.hippo.ehviewer.widget.SearchBar;
|
||||
import com.hippo.refreshlayout.RefreshLayout;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.SceneFragment;
|
||||
import com.hippo.util.AppHelper;
|
||||
@@ -182,7 +181,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mClient = EhApplication.getEhClient(context);
|
||||
mFavCatArray = Settings.getFavCat();
|
||||
@@ -242,20 +241,19 @@ public class FavoritesScene extends BaseScene implements
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_favorites, container, false);
|
||||
ContentLayout contentLayout = view.findViewById(R.id.content_layout);
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
AssertUtils.assertNotNull(activity);
|
||||
mDrawerLayout = (EhDrawerLayout) ViewUtils.$$(activity, R.id.draw_view);
|
||||
mRecyclerView = contentLayout.getRecyclerView();
|
||||
FastScroller fastScroller = contentLayout.getFastScroller();
|
||||
RefreshLayout refreshLayout = contentLayout.getRefreshLayout();
|
||||
mSearchBar = (SearchBar) ViewUtils.$$(view, R.id.search_bar);
|
||||
mFabLayout = (FabLayout) ViewUtils.$$(view, R.id.fab_layout);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
int paddingTopSB = resources.getDimensionPixelOffset(R.dimen.gallery_padding_top_search_bar);
|
||||
@@ -267,12 +265,8 @@ public class FavoritesScene extends BaseScene implements
|
||||
contentLayout.setFitPaddingTop(paddingTopSB);
|
||||
|
||||
mAdapter = new FavoritesAdapter(inflater, resources, mRecyclerView, Settings.getListMode());
|
||||
//mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, !AttrResources.getAttrBoolean(context, R.attr.isLightTheme), new ColorDrawable(Color.TRANSPARENT)));
|
||||
//mRecyclerView.setDrawSelectorOnTop(true);
|
||||
mRecyclerView.setClipToPadding(false);
|
||||
mRecyclerView.setClipChildren(false);
|
||||
//mRecyclerView.setOnItemClickListener(this);
|
||||
//mRecyclerView.setOnItemLongClickListener(this);
|
||||
mRecyclerView.setChoiceMode(EasyRecyclerView.CHOICE_MODE_MULTIPLE_CUSTOM);
|
||||
mRecyclerView.setCustomCheckedListener(this);
|
||||
|
||||
@@ -314,7 +308,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
}
|
||||
|
||||
private void guideCollections() {
|
||||
Activity activity = getActivity2();
|
||||
Activity activity = getMainActivity();
|
||||
if (null == activity || !Settings.getGuideCollections()) {
|
||||
return;
|
||||
}
|
||||
@@ -345,7 +339,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
// keyword of mUrlBuilder, fav cat of mUrlBuilder, mFavCatArray.
|
||||
// They changed, call it
|
||||
private void updateSearchBar() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context || null == mUrlBuilder || null == mSearchBar || null == mFavCatArray) {
|
||||
return;
|
||||
}
|
||||
@@ -417,7 +411,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
public View onCreateDrawerView(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.drawer_list_rv, container, false);
|
||||
final Context context = getContext2();
|
||||
final Context context = getContext();
|
||||
Toolbar toolbar = (Toolbar) ViewUtils.$$(view, R.id.toolbar);
|
||||
|
||||
AssertUtils.assertNotNull(context);
|
||||
@@ -683,7 +677,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
}
|
||||
|
||||
private void showGoToDialog() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context || null == mHelper) {
|
||||
return;
|
||||
}
|
||||
@@ -724,7 +718,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
@Override
|
||||
@Implemented(FabLayout.OnClickFabListener.class)
|
||||
public void onClickSecondaryFab(FabLayout view, FloatingActionButton fab, int position) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context || null == mRecyclerView || null == mHelper) {
|
||||
return;
|
||||
}
|
||||
@@ -760,9 +754,9 @@ public class FavoritesScene extends BaseScene implements
|
||||
|
||||
switch (position) {
|
||||
case 3: { // Download
|
||||
Activity activity = getActivity2();
|
||||
Activity activity = getMainActivity();
|
||||
if (activity != null) {
|
||||
CommonOperations.startDownload(getActivity2(), mModifyGiList, false);
|
||||
CommonOperations.startDownload(getMainActivity(), mModifyGiList, false);
|
||||
}
|
||||
mModifyGiList.clear();
|
||||
if (mRecyclerView != null && mRecyclerView.isInCustomChoice()) {
|
||||
@@ -1216,7 +1210,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
|
||||
@Override
|
||||
protected void getPageData(final int taskId, int type, int page) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity || null == mUrlBuilder || null == mClient) {
|
||||
return;
|
||||
}
|
||||
@@ -1291,7 +1285,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
|
||||
@Override
|
||||
protected Context getContext() {
|
||||
return FavoritesScene.this.getContext2();
|
||||
return FavoritesScene.this.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -183,8 +183,8 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateViewWithToolbar(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_gallery_comments, container, false);
|
||||
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
@@ -289,8 +289,8 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
private void voteComment(long id, int vote) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity) {
|
||||
return;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
private void showCommentDialog(int position) {
|
||||
final Context context = getContext2();
|
||||
final Context context = getContext();
|
||||
if (context == null || mCommentList == null || mCommentList.comments == null || position >= mCommentList.comments.length || position < 0) {
|
||||
return;
|
||||
}
|
||||
@@ -410,7 +410,7 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
}
|
||||
|
||||
public boolean onItemClick(EasyRecyclerView parent, View view, int position) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity) {
|
||||
return false;
|
||||
}
|
||||
@@ -592,8 +592,8 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity || null == mEditText) {
|
||||
return;
|
||||
}
|
||||
@@ -931,7 +931,7 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public CommentAdapter() {
|
||||
mInflater = getLayoutInflater2();
|
||||
mInflater = getLayoutInflater();
|
||||
AssertUtils.assertNotNull(mInflater);
|
||||
}
|
||||
|
||||
@@ -952,7 +952,7 @@ public final class GalleryCommentsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CommentHolder holder, int position) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (context == null || mCommentList == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -479,12 +479,12 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
// Get download state
|
||||
long gid = getGid();
|
||||
if (gid != -1) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mDownloadState = EhApplication.getDownloadManager(context).getDownloadState(gid);
|
||||
} else {
|
||||
@@ -499,7 +499,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mTip = (TextView) ViewUtils.$$(main, R.id.tip);
|
||||
mViewTransition = new ViewTransition(mainView, progressView, mTip);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
View actionsScrollView = ViewUtils.$$(view, R.id.actions_scroll_view);
|
||||
@@ -629,16 +629,15 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setWhiteStatusBar(false);
|
||||
public boolean needWhiteStatusBar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
EhApplication.getDownloadManager(context).removeDownloadInfoListener(this);
|
||||
|
||||
@@ -698,7 +697,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private boolean prepareData() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
if (mGalleryDetail != null) {
|
||||
@@ -727,8 +726,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private boolean request() {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
String url = getGalleryDetailUrl(false);
|
||||
if (null == context || null == activity || null == url) {
|
||||
return false;
|
||||
@@ -773,7 +772,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
int w = mColorBg.getWidth();
|
||||
int h = mColorBg.getHeight();
|
||||
if (ViewCompat.isAttachedToWindow(mColorBg) && w != 0 && h != 0) {
|
||||
Resources resources = getContext2().getResources();
|
||||
Resources resources = getContext().getResources();
|
||||
int keylineMargin = resources.getDimensionPixelSize(R.dimen.keyline_margin);
|
||||
int thumbWidth = resources.getDimensionPixelSize(R.dimen.gallery_detail_thumb_width);
|
||||
int thumbHeight = resources.getDimensionPixelSize(R.dimen.gallery_detail_thumb_height);
|
||||
@@ -831,7 +830,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
if ((oldState == STATE_INIT || oldState == STATE_FAILED || oldState == STATE_REFRESH) &&
|
||||
(state == STATE_NORMAL || state == STATE_REFRESH_HEADER) && AttrResources.getAttrBoolean(getContext2(), R.attr.isLightTheme)) {
|
||||
(state == STATE_NORMAL || state == STATE_REFRESH_HEADER) && AttrResources.getAttrBoolean(getContext(), R.attr.isLightTheme)) {
|
||||
if (!createCircularReveal()) {
|
||||
SimpleHandler.getInstance().post(this::createCircularReveal);
|
||||
}
|
||||
@@ -891,8 +890,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
return;
|
||||
}
|
||||
|
||||
Resources resources = getResources2();
|
||||
AssertUtils.assertNotNull(resources);
|
||||
Resources resources = getResources();
|
||||
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gd.gid), gd.thumb);
|
||||
mTitle.setText(EhUtils.getSuitableTitle(gd));
|
||||
@@ -924,10 +922,9 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void bindTags(GalleryTagGroup[] tagGroups) {
|
||||
Context context = getContext2();
|
||||
LayoutInflater inflater = getLayoutInflater2();
|
||||
Resources resources = getResources2();
|
||||
if (null == context || null == inflater || null == resources || null == mTags || null == mNoTags) {
|
||||
Context context = getContext();
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
if (null == context || null == inflater || null == mTags || null == mNoTags) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -984,8 +981,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void bindComments(GalleryComment[] comments) {
|
||||
Context context = getContext2();
|
||||
LayoutInflater inflater = getLayoutInflater2();
|
||||
Context context = getContext();
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
if (null == context || null == inflater || null == mComments || null == mCommentsText) {
|
||||
return;
|
||||
}
|
||||
@@ -1021,8 +1018,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void bindPreviews(GalleryDetail gd) {
|
||||
LayoutInflater inflater = getLayoutInflater2();
|
||||
Resources resources = getResources2();
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
Resources resources = getResourcesOrNull();
|
||||
if (null == inflater || null == resources || null == mGridLayout || null == mPreviewText) {
|
||||
return;
|
||||
}
|
||||
@@ -1075,7 +1072,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
PopupMenu popup = new PopupMenu(context, mOtherActions, Gravity.TOP);
|
||||
mPopupMenu = popup;
|
||||
@@ -1084,7 +1081,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_open_in_other_app) {
|
||||
String url = getGalleryDetailUrl(false);
|
||||
Activity activity = getActivity2();
|
||||
Activity activity = getMainActivity();
|
||||
if (null != url && null != activity) {
|
||||
UrlOpener.openUrl(activity, url, false);
|
||||
}
|
||||
@@ -1140,7 +1137,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void showCoverGalleryList() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -1174,8 +1171,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity) {
|
||||
return;
|
||||
}
|
||||
@@ -1371,7 +1368,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void showFilterUploaderDialog() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
String uploader = getUploader();
|
||||
if (context == null || uploader == null) {
|
||||
return;
|
||||
@@ -1394,7 +1391,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void showFilterTagDialog(String tag) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
@@ -1416,7 +1413,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void showTagDialog(final String tag) {
|
||||
final Context context = getContext2();
|
||||
final Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -1462,8 +1459,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void voteTag(String tag, int vote) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity) {
|
||||
return;
|
||||
}
|
||||
@@ -1478,7 +1475,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity) {
|
||||
return false;
|
||||
}
|
||||
@@ -1583,7 +1580,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private void updateDownloadState() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
long gid = getGid();
|
||||
if (null == context || -1L == gid) {
|
||||
return;
|
||||
@@ -1644,7 +1641,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
private void onGetGalleryDetailFailure(Exception e) {
|
||||
e.printStackTrace();
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null != context && null != mTip) {
|
||||
String error = ExceptionUtils.getReadableString(e);
|
||||
mTip.setText(error);
|
||||
@@ -1930,7 +1927,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mListView = (ListView) ViewUtils.$$(dialog, R.id.list_view);
|
||||
mListView.setOnItemClickListener(this);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
if (mArchiveList == null) {
|
||||
mErrorText.setVisibility(View.GONE);
|
||||
@@ -1969,8 +1966,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null != context && null != activity && null != mArchiveList && position < mArchiveList.length) {
|
||||
String res = mArchiveList[position].first;
|
||||
EhRequest request = new EhRequest();
|
||||
@@ -2011,7 +2008,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
mRequest = null;
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null != context && null != mProgressView && null != mErrorText && null != mListView) {
|
||||
mProgressView.setVisibility(View.GONE);
|
||||
mErrorText.setVisibility(View.VISIBLE);
|
||||
@@ -2047,7 +2044,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mListView = (ListView) ViewUtils.$$(dialog, R.id.list_view);
|
||||
mListView.setOnItemClickListener(this);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
if (mTorrentList == null) {
|
||||
mErrorText.setVisibility(View.GONE);
|
||||
@@ -2086,7 +2083,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null != context && null != mTorrentList && position < mTorrentList.length) {
|
||||
String url = mTorrentList[position].first;
|
||||
String name = mTorrentList[position].second;
|
||||
@@ -2138,7 +2135,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
mRequest = null;
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null != context && null != mProgressView && null != mErrorText && null != mListView) {
|
||||
mProgressView.setVisibility(View.GONE);
|
||||
mErrorText.setVisibility(View.VISIBLE);
|
||||
@@ -2178,8 +2175,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity || which != DialogInterface.BUTTON_POSITIVE ||
|
||||
null == mGalleryDetail || null == mRatingBar) {
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.hippo.ehviewer.ui.scene;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -89,51 +88,49 @@ public final class GalleryInfoScene extends ToolbarScene {
|
||||
return;
|
||||
}
|
||||
|
||||
Resources resources = getResources2();
|
||||
AssertUtils.assertNotNull(resources);
|
||||
mKeys.add(resources.getString(R.string.header_key));
|
||||
mValues.add(resources.getString(R.string.header_value));
|
||||
mKeys.add(resources.getString(R.string.key_gid));
|
||||
mKeys.add(getString(R.string.header_key));
|
||||
mValues.add(getString(R.string.header_value));
|
||||
mKeys.add(getString(R.string.key_gid));
|
||||
mValues.add(Long.toString(gd.gid));
|
||||
mKeys.add(resources.getString(R.string.key_token));
|
||||
mKeys.add(getString(R.string.key_token));
|
||||
mValues.add(gd.token);
|
||||
mKeys.add(resources.getString(R.string.key_url));
|
||||
mKeys.add(getString(R.string.key_url));
|
||||
mValues.add(EhUrl.getGalleryDetailUrl(gd.gid, gd.token));
|
||||
mKeys.add(resources.getString(R.string.key_title));
|
||||
mKeys.add(getString(R.string.key_title));
|
||||
mValues.add(gd.title);
|
||||
mKeys.add(resources.getString(R.string.key_title_jpn));
|
||||
mKeys.add(getString(R.string.key_title_jpn));
|
||||
mValues.add(gd.titleJpn);
|
||||
mKeys.add(resources.getString(R.string.key_thumb));
|
||||
mKeys.add(getString(R.string.key_thumb));
|
||||
mValues.add(gd.thumb);
|
||||
mKeys.add(resources.getString(R.string.key_category));
|
||||
mKeys.add(getString(R.string.key_category));
|
||||
mValues.add(EhUtils.getCategory(gd.category));
|
||||
mKeys.add(resources.getString(R.string.key_uploader));
|
||||
mKeys.add(getString(R.string.key_uploader));
|
||||
mValues.add(gd.uploader);
|
||||
mKeys.add(resources.getString(R.string.key_posted));
|
||||
mKeys.add(getString(R.string.key_posted));
|
||||
mValues.add(gd.posted);
|
||||
mKeys.add(resources.getString(R.string.key_parent));
|
||||
mKeys.add(getString(R.string.key_parent));
|
||||
mValues.add(gd.parent);
|
||||
mKeys.add(resources.getString(R.string.key_visible));
|
||||
mKeys.add(getString(R.string.key_visible));
|
||||
mValues.add(gd.visible);
|
||||
mKeys.add(resources.getString(R.string.key_language));
|
||||
mKeys.add(getString(R.string.key_language));
|
||||
mValues.add(gd.language);
|
||||
mKeys.add(resources.getString(R.string.key_pages));
|
||||
mKeys.add(getString(R.string.key_pages));
|
||||
mValues.add(Integer.toString(gd.pages));
|
||||
mKeys.add(resources.getString(R.string.key_size));
|
||||
mKeys.add(getString(R.string.key_size));
|
||||
mValues.add(gd.size);
|
||||
mKeys.add(resources.getString(R.string.key_favorite_count));
|
||||
mKeys.add(getString(R.string.key_favorite_count));
|
||||
mValues.add(Integer.toString(gd.favoriteCount));
|
||||
mKeys.add(resources.getString(R.string.key_favorited));
|
||||
mKeys.add(getString(R.string.key_favorited));
|
||||
mValues.add(Boolean.toString(gd.isFavorited));
|
||||
mKeys.add(resources.getString(R.string.key_rating_count));
|
||||
mKeys.add(getString(R.string.key_rating_count));
|
||||
mValues.add(Integer.toString(gd.ratingCount));
|
||||
mKeys.add(resources.getString(R.string.key_rating));
|
||||
mKeys.add(getString(R.string.key_rating));
|
||||
mValues.add(Float.toString(gd.rating));
|
||||
mKeys.add(resources.getString(R.string.key_torrents));
|
||||
mKeys.add(getString(R.string.key_torrents));
|
||||
mValues.add(Integer.toString(gd.torrentCount));
|
||||
mKeys.add(resources.getString(R.string.key_torrent_url));
|
||||
mKeys.add(getString(R.string.key_torrent_url));
|
||||
mValues.add(gd.torrentUrl);
|
||||
mKeys.add(resources.getString(R.string.favorite_name));
|
||||
mKeys.add(getString(R.string.favorite_name));
|
||||
mValues.add(gd.favoriteName);
|
||||
}
|
||||
|
||||
@@ -149,18 +146,18 @@ public final class GalleryInfoScene extends ToolbarScene {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putStringArrayList(KEY_KEYS, mKeys);
|
||||
outState.putStringArrayList(KEY_VALUES, mValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateViewWithToolbar(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_gallery_info, container, false);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
|
||||
@@ -198,7 +195,7 @@ public final class GalleryInfoScene extends ToolbarScene {
|
||||
}
|
||||
|
||||
public boolean onItemClick(int position) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null != context && 0 != position && null != mValues) {
|
||||
if (position == INDEX_PARENT) {
|
||||
UrlOpener.openUrl(context, mValues.get(position), true);
|
||||
@@ -245,7 +242,7 @@ public final class GalleryInfoScene extends ToolbarScene {
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public InfoAdapter() {
|
||||
mInflater = getLayoutInflater2();
|
||||
mInflater = getLayoutInflater();
|
||||
AssertUtils.assertNotNull(mInflater);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ public final class GalleryListScene extends BaseScene
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mClient = EhApplication.getEhClient(context);
|
||||
mDownloadManager = EhApplication.getDownloadManager(context);
|
||||
@@ -482,7 +482,7 @@ public final class GalleryListScene extends BaseScene
|
||||
// Update search bar title, drawer checked item
|
||||
private void onUpdateUrlBuilder() {
|
||||
ListUrlBuilder builder = mUrlBuilder;
|
||||
Resources resources = getResources2();
|
||||
Resources resources = getResourcesOrNull();
|
||||
if (resources == null || builder == null || mSearchLayout == null) {
|
||||
return;
|
||||
}
|
||||
@@ -541,11 +541,11 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_gallery_list, container, false);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
|
||||
@@ -627,7 +627,7 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
|
||||
private void guideQuickSearch() {
|
||||
Activity activity = getActivity2();
|
||||
Activity activity = getMainActivity();
|
||||
if (null == activity || !Settings.getGuideQuickSearch()) {
|
||||
return;
|
||||
}
|
||||
@@ -690,7 +690,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
private void showQuickSearchTipDialog(final QsDrawerAdapter adapter,
|
||||
final EasyRecyclerView recyclerView, final TextView tip) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -708,7 +708,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
private void showAddQuickSearchDialog(final QsDrawerAdapter adapter,
|
||||
final EasyRecyclerView recyclerView, final TextView tip) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
final ListUrlBuilder urlBuilder = mUrlBuilder;
|
||||
if (null == context || null == urlBuilder) {
|
||||
return;
|
||||
@@ -775,7 +775,7 @@ public final class GalleryListScene extends BaseScene
|
||||
Toolbar toolbar = (Toolbar) ViewUtils.$$(view, R.id.toolbar);
|
||||
final TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
RecyclerViewDragDropManager dragDropManager = new RecyclerViewDragDropManager();
|
||||
@@ -914,7 +914,7 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
|
||||
private void showGoToDialog() {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context || null == mHelper) {
|
||||
return;
|
||||
}
|
||||
@@ -993,8 +993,8 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
|
||||
public boolean onItemLongClick(View view, int position) {
|
||||
final Context context = getContext2();
|
||||
final MainActivity activity = getActivity2();
|
||||
final Context context = getContext();
|
||||
final MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity || null == mHelper) {
|
||||
return false;
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ public final class GalleryListScene extends BaseScene
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// Cancel check mode
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -1472,7 +1472,7 @@ public final class GalleryListScene extends BaseScene
|
||||
private void onGetGalleryListSuccess(GalleryListParser.Result result, int taskId) {
|
||||
if (mHelper != null && mSearchBarMover != null &&
|
||||
mHelper.isCurrentTask(taskId)) {
|
||||
String emptyString = getResources2().getString(mUrlBuilder.getMode() == ListUrlBuilder.MODE_SUBSCRIPTION && result.noWatchedTags
|
||||
String emptyString = getString(mUrlBuilder.getMode() == ListUrlBuilder.MODE_SUBSCRIPTION && result.noWatchedTags
|
||||
? R.string.gallery_list_empty_hit_subscription
|
||||
: R.string.gallery_list_empty_hit);
|
||||
mHelper.setEmptyString(emptyString);
|
||||
@@ -1832,7 +1832,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
@Override
|
||||
protected void getPageData(int taskId, int type, int page) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity || null == mClient || null == mUrlBuilder) {
|
||||
return;
|
||||
}
|
||||
@@ -1860,7 +1860,7 @@ public final class GalleryListScene extends BaseScene
|
||||
|
||||
@Override
|
||||
protected Context getContext() {
|
||||
return GalleryListScene.this.getContext2();
|
||||
return GalleryListScene.this.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -91,7 +91,7 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
mClient = EhApplication.getEhClient(context);
|
||||
if (savedInstanceState == null) {
|
||||
@@ -131,14 +131,14 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateViewWithToolbar(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
ContentLayout contentLayout = (ContentLayout) inflater.inflate(
|
||||
R.layout.scene_gallery_previews, container, false);
|
||||
contentLayout.hideFastScroll();
|
||||
mRecyclerView = contentLayout.getRecyclerView();
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
|
||||
@@ -197,7 +197,7 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return false;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
}
|
||||
|
||||
public boolean onItemClick(int position) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null != context && null != mHelper && null != mGalleryInfo) {
|
||||
GalleryPreview p = mHelper.getDataAtEx(position);
|
||||
if (p != null) {
|
||||
@@ -315,7 +315,7 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public GalleryPreviewAdapter() {
|
||||
mInflater = getLayoutInflater2();
|
||||
mInflater = getLayoutInflater();
|
||||
AssertUtils.assertNotNull(mInflater);
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
|
||||
@Override
|
||||
protected void getPageData(final int taskId, int type, int page) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity || null == mClient || null == mGalleryInfo) {
|
||||
onGetException(taskId, new EhException(getString(R.string.error_cannot_find_gallery)));
|
||||
return;
|
||||
@@ -365,7 +365,7 @@ public class GalleryPreviewsScene extends ToolbarScene {
|
||||
|
||||
@Override
|
||||
protected Context getContext() {
|
||||
return GalleryPreviewsScene.this.getContext2();
|
||||
return GalleryPreviewsScene.this.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -120,7 +120,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
assert context != null;
|
||||
mDownloadManager = EhApplication.getDownloadManager(context);
|
||||
mDownloadManager = EhApplication.getDownloadManager(context);
|
||||
@@ -183,8 +183,8 @@ public class HistoryScene extends ToolbarScene {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateViewWithToolbar(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_history, container, false);
|
||||
View content = ViewUtils.$$(view, R.id.content);
|
||||
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(content, R.id.recycler_view);
|
||||
@@ -192,7 +192,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mViewTransition = new ViewTransition(content, tip);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
Resources resources = context.getResources();
|
||||
|
||||
@@ -246,7 +246,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setTitle(R.string.history);
|
||||
setNavigationIcon(new DrawerArrowDrawable(getContext2(), Color.WHITE));
|
||||
setNavigationIcon(new DrawerArrowDrawable(getContext(), Color.WHITE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -301,7 +301,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
}
|
||||
|
||||
private void showClearAllDialog() {
|
||||
new MaterialAlertDialogBuilder(getContext2())
|
||||
new MaterialAlertDialogBuilder(getContext())
|
||||
.setMessage(R.string.clear_all_history)
|
||||
.setPositiveButton(R.string.clear_all, (dialog, which) -> {
|
||||
if (DialogInterface.BUTTON_POSITIVE != which || null == mAdapter) {
|
||||
@@ -318,7 +318,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
// Skip when in choice mode
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return false;
|
||||
}
|
||||
@@ -351,8 +351,8 @@ public class HistoryScene extends ToolbarScene {
|
||||
}
|
||||
|
||||
public boolean onItemLongClick(int position) {
|
||||
final Context context = getContext2();
|
||||
final MainActivity activity = getActivity2();
|
||||
final Context context = getContext();
|
||||
final MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity || null == mLazyList) {
|
||||
return false;
|
||||
}
|
||||
@@ -465,7 +465,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// Cancel check mode
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -575,7 +575,7 @@ public class HistoryScene extends ToolbarScene {
|
||||
private final int mListThumbHeight;
|
||||
|
||||
public HistoryAdapter() {
|
||||
mInflater = getLayoutInflater2();
|
||||
mInflater = getLayoutInflater();
|
||||
|
||||
View calculator = mInflater.inflate(R.layout.item_gallery_list_thumb_height, null);
|
||||
ViewUtils.measureView(calculator, 1024, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
@@ -83,8 +83,8 @@ public final class ProgressScene extends BaseScene implements View.OnClickListen
|
||||
}
|
||||
|
||||
private boolean doJobs() {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity) {
|
||||
return false;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public final class ProgressScene extends BaseScene implements View.OnClickListen
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(KEY_VALID, mValid);
|
||||
outState.putString(KEY_ERROR, mError);
|
||||
@@ -157,13 +157,13 @@ public final class ProgressScene extends BaseScene implements View.OnClickListen
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_progress, container, false);
|
||||
View progress = ViewUtils.$$(view, R.id.progress);
|
||||
mTip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
Drawable drawable = DrawableManager.getVectorDrawable(context, R.drawable.big_sad_pandroid);
|
||||
@@ -217,7 +217,7 @@ public final class ProgressScene extends BaseScene implements View.OnClickListen
|
||||
private void onGetGalleryTokenFailure(Exception e) {
|
||||
mValid = false;
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
|
||||
if (null != context && null != mViewTransition && null != mTip) {
|
||||
// Show tip
|
||||
|
||||
@@ -103,7 +103,7 @@ public class SecurityScene extends SolidScene implements
|
||||
}
|
||||
|
||||
private void startBiometricPrompt() {
|
||||
if (Settings.getEnableFingerprint() && BiometricManager.from(requireContext()).canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS) {
|
||||
if (Settings.getEnableFingerprint() && BiometricManager.from(requireContext()).canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK) == BiometricManager.BIOMETRIC_SUCCESS) {
|
||||
BiometricPrompt biometricPrompt = new BiometricPrompt(this, Executors.newSingleThreadExecutor(), new BiometricPrompt.AuthenticationCallback() {
|
||||
@Override
|
||||
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
|
||||
@@ -140,15 +140,15 @@ public class SecurityScene extends SolidScene implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(KEY_RETRY_TIMES, mRetryTimes);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_security, container, false);
|
||||
view.setOnClickListener(v -> startBiometricPrompt());
|
||||
|
||||
@@ -178,7 +178,7 @@ public class SecurityScene extends SolidScene implements
|
||||
|
||||
@Override
|
||||
public void onPatternDetected(List<LockPatternView.Cell> pattern) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity || null == mPatternView) {
|
||||
return;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class SecurityScene extends SolidScene implements
|
||||
@Override
|
||||
public void onShake(int count) {
|
||||
if (count == 10) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
@@ -44,8 +45,8 @@ public class SelectSiteScene extends SolidScene implements View.OnClickListener
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_select_site, container, false);
|
||||
|
||||
mButtonGroup = (MaterialButtonToggleGroup) ViewUtils.$$(view, R.id.button_group);
|
||||
@@ -71,29 +72,25 @@ public class SelectSiteScene extends SolidScene implements View.OnClickListener
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity || null == mButtonGroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (v == mOk) {
|
||||
int id = mButtonGroup.getCheckedButtonId();
|
||||
switch (id) {
|
||||
case R.id.site_e:
|
||||
Settings.putSelectSite(false);
|
||||
Settings.putGallerySite(EhUrl.SITE_E);
|
||||
startSceneForCheckStep(CHECK_STEP_SELECT_SITE, getArguments());
|
||||
finish();
|
||||
break;
|
||||
case R.id.site_ex:
|
||||
Settings.putSelectSite(false);
|
||||
Settings.putGallerySite(EhUrl.SITE_EX);
|
||||
startSceneForCheckStep(CHECK_STEP_SELECT_SITE, getArguments());
|
||||
finish();
|
||||
break;
|
||||
default:
|
||||
showTip(R.string.no_select, LENGTH_SHORT);
|
||||
break;
|
||||
if (id == R.id.site_e) {
|
||||
Settings.putSelectSite(false);
|
||||
Settings.putGallerySite(EhUrl.SITE_E);
|
||||
startSceneForCheckStep(CHECK_STEP_SELECT_SITE, getArguments());
|
||||
finish();
|
||||
} else if (id == R.id.site_ex) {
|
||||
Settings.putSelectSite(false);
|
||||
Settings.putGallerySite(EhUrl.SITE_EX);
|
||||
startSceneForCheckStep(CHECK_STEP_SELECT_SITE, getArguments());
|
||||
finish();
|
||||
} else {
|
||||
showTip(R.string.no_select, LENGTH_SHORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
@@ -107,15 +108,15 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(KEY_REQUEST_ID, mRequestId);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_login, container, false);
|
||||
|
||||
View loginForm = ViewUtils.$$(view, R.id.login_form);
|
||||
@@ -144,7 +145,7 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
mSignInViaCookies.setOnClickListener(this);
|
||||
mSkipSigningIn.setOnClickListener(this);
|
||||
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
EhApplication application = (EhApplication) context.getApplicationContext();
|
||||
if (application.containGlobalStuff(mRequestId)) {
|
||||
@@ -214,7 +215,7 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == activity) {
|
||||
return;
|
||||
}
|
||||
@@ -251,8 +252,8 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
return;
|
||||
}
|
||||
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity || null == mUsername || null == mPassword || null == mUsernameLayout ||
|
||||
null == mPasswordLayout) {
|
||||
return;
|
||||
@@ -294,8 +295,8 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
}
|
||||
|
||||
private void getProfile() {
|
||||
Context context = getContext2();
|
||||
MainActivity activity = getActivity2();
|
||||
Context context = getContext();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null == context || null == activity) {
|
||||
return;
|
||||
}
|
||||
@@ -314,7 +315,7 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
|
||||
private void redirectTo() {
|
||||
Settings.putNeedSignIn(false);
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null != activity) {
|
||||
startSceneForCheckStep(CHECK_STEP_SIGN_IN, getArguments());
|
||||
}
|
||||
@@ -322,7 +323,7 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
}
|
||||
|
||||
private void whetherToSkip(Exception e) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
@@ -335,7 +336,7 @@ public final class SignInScene extends SolidScene implements EditText.OnEditorAc
|
||||
}
|
||||
|
||||
public void onSignInEnd(Exception e) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (null == context) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SolidScene extends BaseScene {
|
||||
break;
|
||||
}
|
||||
case CHECK_STEP_ANALYTICS:
|
||||
if (EhUtils.needSignedIn(getContext2())) {
|
||||
if (EhUtils.needSignedIn(getContext())) {
|
||||
startScene(new Announcer(SignInScene.class).setArgs(args), true);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@@ -40,20 +41,20 @@ public abstract class ToolbarScene extends BaseScene {
|
||||
private CharSequence mTempTitle;
|
||||
|
||||
@Nullable
|
||||
public View onCreateView3(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateViewWithToolbar(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public final View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public final View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_toolbar, container, false);
|
||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||
FrameLayout contentPanel = view.findViewById(R.id.content_panel);
|
||||
|
||||
View contentView = onCreateView3(inflater, contentPanel, savedInstanceState);
|
||||
View contentView = onCreateViewWithToolbar(inflater, contentPanel, savedInstanceState);
|
||||
if (contentView == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -86,9 +87,14 @@ public abstract class ToolbarScene extends BaseScene {
|
||||
}
|
||||
mToolbar.setNavigationOnClickListener(v -> onNavigationClick());
|
||||
}
|
||||
setWhiteStatusBar(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needWhiteStatusBar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public int getMenuResId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
@@ -44,8 +45,8 @@ public final class WarningScene extends SolidScene implements View.OnClickListen
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView2(LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_warning, container, false);
|
||||
|
||||
mReject = ViewUtils.$$(view, R.id.reject);
|
||||
@@ -74,7 +75,7 @@ public final class WarningScene extends SolidScene implements View.OnClickListen
|
||||
Settings.putShowWarning(false);
|
||||
|
||||
// Start new scene and finish it self
|
||||
MainActivity activity = getActivity2();
|
||||
MainActivity activity = getMainActivity();
|
||||
if (null != activity) {
|
||||
startSceneForCheckStep(CHECK_STEP_WARNING, getArguments());
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.webkit.CookieManager;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
@@ -58,9 +59,9 @@ public class WebViewSignInScene extends SolidScene {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
public View onCreateView2(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
Context context = getContext2();
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
Context context = getContext();
|
||||
AssertUtils.assertNotNull(context);
|
||||
|
||||
EhUtils.signOut(context);
|
||||
@@ -117,7 +118,7 @@ public class WebViewSignInScene extends SolidScene {
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
Context context = getContext2();
|
||||
Context context = getContext();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user