Update appcompat
This commit is contained in:
15 files changed
+68
-30
No files matched your search
@@ -64,8 +64,7 @@ public class AboutFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setTitle(R.string.settings_about);
|
||||
public int getFragmentTitle() {
|
||||
return R.string.settings_about;
|
||||
}
|
||||
}
|
||||
@@ -298,8 +298,7 @@ public class AdvancedFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setTitle(R.string.settings_advanced);
|
||||
public int getFragmentTitle() {
|
||||
return R.string.settings_advanced;
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,18 @@ import androidx.fragment.app.Fragment;
|
||||
import com.hippo.ehviewer.ui.SettingsActivity;
|
||||
|
||||
public class BaseFragment extends Fragment {
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
setTitle(getFragmentTitle());
|
||||
}
|
||||
|
||||
public void setTitle(@StringRes int string) {
|
||||
@StringRes
|
||||
public int getFragmentTitle() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void setTitle(@StringRes int string) {
|
||||
requireActivity().setTitle(string);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,17 @@ import com.takisoft.preferencex.PreferenceFragmentCompat;
|
||||
|
||||
public class BasePreferenceFragment extends PreferenceFragmentCompat
|
||||
implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
setTitle(getFragmentTitle());
|
||||
}
|
||||
|
||||
@StringRes
|
||||
public int getFragmentTitle() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
return false;
|
||||
@@ -26,7 +37,7 @@ public class BasePreferenceFragment extends PreferenceFragmentCompat
|
||||
|
||||
}
|
||||
|
||||
public void setTitle(@StringRes int string) {
|
||||
private void setTitle(@StringRes int string) {
|
||||
requireActivity().setTitle(string);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,8 +148,7 @@ public class DownloadFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setTitle(R.string.settings_download);
|
||||
public int getFragmentTitle() {
|
||||
return R.string.settings_download;
|
||||
}
|
||||
}
|
||||
@@ -89,8 +89,7 @@ public class EhFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setTitle(R.string.settings_eh);
|
||||
public int getFragmentTitle() {
|
||||
return R.string.settings_eh;
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,6 @@ public class FilterFragment extends BaseFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_filter, container, false);
|
||||
setTitle(R.string.filter);
|
||||
|
||||
mFilterList = new FilterList();
|
||||
|
||||
@@ -450,4 +449,8 @@ public class FilterFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragmentTitle() {
|
||||
return R.string.filter;
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,6 @@ public class HostsFragment extends BaseFragment
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_hosts, container, false);
|
||||
setTitle(R.string.hosts);
|
||||
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mViewTransition = new ViewTransition(recyclerView, tip);
|
||||
@@ -272,4 +271,8 @@ public class HostsFragment extends BaseFragment
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragmentTitle() {
|
||||
return R.string.hosts;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ public class MyTagsFragment extends BaseFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_webview, container, false);
|
||||
setTitle(R.string.my_tags);
|
||||
webView = view.findViewById(R.id.webview);
|
||||
webView.setBackgroundColor(AttrResources.getAttrColor(requireActivity(), android.R.attr.colorBackground));
|
||||
webView.getSettings().setBuiltInZoomControls(true);
|
||||
@@ -90,4 +89,9 @@ public class MyTagsFragment extends BaseFragment {
|
||||
progress.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragmentTitle() {
|
||||
return R.string.my_tags;
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,8 @@ public class PrivacyFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setTitle(R.string.settings_privacy);
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Preference patternProtection = findPreference(KEY_PATTERN_PROTECTION);
|
||||
patternProtection.setSummary(TextUtils.isEmpty(Settings.getSecurity()) ?
|
||||
R.string.settings_privacy_pattern_protection_not_set :
|
||||
@@ -45,4 +44,9 @@ public class PrivacyFragment extends BasePreferenceFragment {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragmentTitle() {
|
||||
return R.string.settings_privacy;
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,7 @@ public class ReadFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setTitle(R.string.settings_read);
|
||||
public int getFragmentTitle() {
|
||||
return R.string.settings_read;
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ public class SetSecurityFragment extends BaseFragment implements View.OnClickLis
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_set_security, container, false);
|
||||
setTitle(R.string.set_pattern_protection);
|
||||
|
||||
mPatternView = (LockPatternView) ViewUtils.$$(view, R.id.pattern_view);
|
||||
mCancel = ViewUtils.$$(view, R.id.cancel);
|
||||
@@ -80,4 +79,9 @@ public class SetSecurityFragment extends BaseFragment implements View.OnClickLis
|
||||
requireActivity().onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragmentTitle() {
|
||||
return R.string.set_pattern_protection;
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,7 @@ public class SettingsFragment extends BasePreferenceFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setTitle(R.string.settings);
|
||||
public int getFragmentTitle() {
|
||||
return R.string.settings;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,6 @@ public class UConfigFragment extends BaseFragment {
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_webview, container, false);
|
||||
setTitle(R.string.u_config);
|
||||
webView = view.findViewById(R.id.webview);
|
||||
webView.setBackgroundColor(AttrResources.getAttrColor(requireActivity(), android.R.attr.colorBackground));
|
||||
webView.getSettings().setBuiltInZoomControls(true);
|
||||
@@ -167,4 +166,9 @@ public class UConfigFragment extends BaseFragment {
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFragmentTitle() {
|
||||
return R.string.u_config;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user