Removed custom toolbar hide

pull/215/head
M66B 6 months ago
parent f1f53f2d5d
commit 978e5d0d5e

@ -102,20 +102,6 @@ public class FragmentBase extends Fragment {
return null; return null;
} }
protected boolean isActionBarShown() {
FragmentActivity activity = getActivity();
if (activity instanceof ActivityBase)
return ((ActivityBase) activity).isActionBarShown();
else
return false;
}
protected void showActionBar(boolean show) {
FragmentActivity activity = getActivity();
if (activity instanceof ActivityBase)
((ActivityBase) activity).showActionBar(show);
}
protected void setCount(String count) { protected void setCount(String count) {
this.count = count; this.count = count;
updateSubtitle(); updateSubtitle();

@ -121,7 +121,6 @@ public class FragmentFolders extends FragmentBase {
private boolean primary; private boolean primary;
private boolean show_hidden = false; private boolean show_hidden = false;
private boolean show_flagged = false; private boolean show_flagged = false;
private boolean hide_toolbar = false;
private String searching = null; private String searching = null;
private AdapterFolder adapter; private AdapterFolder adapter;
@ -154,7 +153,6 @@ public class FragmentFolders extends FragmentBase {
compact = prefs.getBoolean("compact_folders", true); compact = prefs.getBoolean("compact_folders", true);
show_hidden = false; // prefs.getBoolean("hidden_folders", false); show_hidden = false; // prefs.getBoolean("hidden_folders", false);
show_flagged = prefs.getBoolean("flagged_folders", false); show_flagged = prefs.getBoolean("flagged_folders", false);
hide_toolbar = prefs.getBoolean("hide_toolbar", !BuildConfig.PLAY_STORE_RELEASE);
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
ViewModelSelected selectedModel = ViewModelSelected selectedModel =
@ -217,22 +215,7 @@ public class FragmentFolders extends FragmentBase {
}); });
rvFolder.setHasFixedSize(false); rvFolder.setHasFixedSize(false);
LinearLayoutManager llm = new LinearLayoutManager(getContext()) { LinearLayoutManager llm = new LinearLayoutManager(getContext());
@Override
public void onLayoutCompleted(RecyclerView.State state) {
super.onLayoutCompleted(state);
if (!isActionBarShown())
try {
int range = computeVerticalScrollRange(state);
int extend = computeVerticalScrollExtent(state);
boolean canScrollVertical = (range > extend);
if (!canScrollVertical) // anymore
showActionBar(true);
} catch (Throwable ex) {
Log.e(ex);
}
}
};
rvFolder.setLayoutManager(llm); rvFolder.setLayoutManager(llm);
if (!cards && dividers) { if (!cards && dividers) {
@ -323,27 +306,6 @@ public class FragmentFolders extends FragmentBase {
rvFolder.addItemDecoration(categoryDecorator); rvFolder.addItemDecoration(categoryDecorator);
} }
rvFolder.addOnScrollListener(new RecyclerView.OnScrollListener() {
private boolean show = true;
@Override
public void onScrolled(@NonNull RecyclerView rv, int dx, int dy) {
if (hide_toolbar && dy != 0)
try {
show = (dy < 0 || rv.computeVerticalScrollOffset() == 0);
} catch (Throwable ex) {
Log.e(ex);
show = true;
}
}
@Override
public void onScrollStateChanged(@NonNull RecyclerView rv, int newState) {
if (hide_toolbar && newState != RecyclerView.SCROLL_STATE_DRAGGING)
showActionBar(show);
}
});
adapter = new AdapterFolder(this, account, unified, primary, compact, show_hidden, show_flagged, null); adapter = new AdapterFolder(this, account, unified, primary, compact, show_hidden, show_flagged, null);
rvFolder.setAdapter(adapter); rvFolder.setAdapter(adapter);

@ -332,7 +332,6 @@ public class FragmentMessages extends FragmentBase
private int searchIndex = 0; private int searchIndex = 0;
private TextView searchView = null; private TextView searchView = null;
private boolean hide_toolbar;
private boolean cards; private boolean cards;
private boolean dividers; private boolean dividers;
private boolean category; private boolean category;
@ -404,7 +403,6 @@ public class FragmentMessages extends FragmentBase
final private LongSparseArray<TupleAccountSwipes> accountSwipes = new LongSparseArray<>(); final private LongSparseArray<TupleAccountSwipes> accountSwipes = new LongSparseArray<>();
private NumberFormat NF = NumberFormat.getNumberInstance(); private NumberFormat NF = NumberFormat.getNumberInstance();
private final ObjectHolder<Boolean> showToolbar = new ObjectHolder<>(true);
private static final ExecutorService executor = private static final ExecutorService executor =
Helper.getBackgroundExecutor(1, "more"); Helper.getBackgroundExecutor(1, "more");
@ -486,7 +484,6 @@ public class FragmentMessages extends FragmentBase
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
hide_toolbar = prefs.getBoolean("hide_toolbar", !BuildConfig.PLAY_STORE_RELEASE);
cards = prefs.getBoolean("cards", true); cards = prefs.getBoolean("cards", true);
dividers = prefs.getBoolean("dividers", true); dividers = prefs.getBoolean("dividers", true);
category = prefs.getBoolean("group_category", false); category = prefs.getBoolean("group_category", false);
@ -823,21 +820,6 @@ public class FragmentMessages extends FragmentBase
} }
} }
@Override
public void onLayoutCompleted(RecyclerView.State state) {
super.onLayoutCompleted(state);
if (!isActionBarShown())
try {
int range = computeVerticalScrollRange(state);
int extend = computeVerticalScrollExtent(state);
boolean canScrollVertical = (range > extend);
if (!canScrollVertical) // anymore
showActionBar(true);
} catch (Throwable ex) {
Log.e(ex);
}
}
@Override @Override
public void onItemsAdded(@NonNull RecyclerView recyclerView, int positionStart, int itemCount) { public void onItemsAdded(@NonNull RecyclerView recyclerView, int positionStart, int itemCount) {
iProperties.layoutChanged(); iProperties.layoutChanged();
@ -1235,20 +1217,6 @@ public class FragmentMessages extends FragmentBase
updateExpanded(); updateExpanded();
} }
} }
if (hide_toolbar && dy != 0)
try {
showToolbar.value = (dy < 0 || rv.computeVerticalScrollOffset() == 0);
} catch (Throwable ex) {
Log.e(ex);
showToolbar.value = true;
}
}
@Override
public void onScrollStateChanged(@NonNull RecyclerView rv, int newState) {
if (hide_toolbar && newState != RecyclerView.SCROLL_STATE_DRAGGING)
showActionBar(showToolbar.value);
} }
}); });
@ -1312,8 +1280,6 @@ public class FragmentMessages extends FragmentBase
ibUp.setOnClickListener(new View.OnClickListener() { ibUp.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
showToolbar.value = true;
showActionBar(true);
scrollToVisibleItem(llm, false); scrollToVisibleItem(llm, false);
} }
}); });

@ -143,7 +143,7 @@ public class FragmentOptions extends FragmentBase {
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", "tabular_unread_bg", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", "tabular_unread_bg",
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size", "portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",
"column_width", "column_width",
"hide_toolbar", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"indentation", "date", "date_week", "date_fixed", "date_bold", "date_time", "threading", "threading_unread", "indentation", "date", "date_week", "date_fixed", "date_bold", "date_time", "threading", "threading_unread",
"show_filtered", "show_filtered",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide", "highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",

@ -92,7 +92,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private SwitchCompat swOpenPane; private SwitchCompat swOpenPane;
private TextView tvColumnWidth; private TextView tvColumnWidth;
private SeekBar sbColumnWidth; private SeekBar sbColumnWidth;
private SwitchCompat swHideToolbar;
private SwitchCompat swNavOptions; private SwitchCompat swNavOptions;
private SwitchCompat swNavCategories; private SwitchCompat swNavCategories;
private SwitchCompat swNavLastSync; private SwitchCompat swNavLastSync;
@ -213,7 +212,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
"date", "date_week", "date_fixed", "date_bold", "date_time", "group_category", "date", "date_week", "date_fixed", "date_bold", "date_time", "group_category",
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", "tabular_unread_bg", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", "tabular_unread_bg",
"portrait2", "portrait2c", "landscape", "close_pane", "open_pane", "column_width", "portrait2", "portrait2c", "landscape", "close_pane", "open_pane", "column_width",
"hide_toolbar", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed", "nav_options", "nav_categories", "nav_last_sync", "nav_count", "nav_unseen_drafts", "nav_count_pinned", "show_unexposed",
"threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color", "threading", "threading_unread", "indentation", "seekbar", "actionbar", "actionbar_swap", "actionbar_color",
"highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide", "highlight_unread", "highlight_color", "color_stripe", "color_stripe_wide",
"avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "generated_icons", "identicons", "avatars", "bimi", "gravatars", "libravatars", "favicons", "favicons_partial", "favicons_manifest", "generated_icons", "identicons",
@ -270,7 +269,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
swOpenPane = view.findViewById(R.id.swOpenPane); swOpenPane = view.findViewById(R.id.swOpenPane);
tvColumnWidth = view.findViewById(R.id.tvColumnWidth); tvColumnWidth = view.findViewById(R.id.tvColumnWidth);
sbColumnWidth = view.findViewById(R.id.sbColumnWidth); sbColumnWidth = view.findViewById(R.id.sbColumnWidth);
swHideToolbar = view.findViewById(R.id.swHideToolbar);
swNavOptions = view.findViewById(R.id.swNavOptions); swNavOptions = view.findViewById(R.id.swNavOptions);
swNavCategories = view.findViewById(R.id.swNavCategories); swNavCategories = view.findViewById(R.id.swNavCategories);
swNavLastSync = view.findViewById(R.id.swNavLastSync); swNavLastSync = view.findViewById(R.id.swNavLastSync);
@ -637,13 +635,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
} }
}); });
swHideToolbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("hide_toolbar", checked).apply();
}
});
swNavOptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swNavOptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -1564,7 +1555,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
tvColumnWidth.setText(getString(R.string.title_advanced_column_width, NF.format(column_width))); tvColumnWidth.setText(getString(R.string.title_advanced_column_width, NF.format(column_width)));
sbColumnWidth.setProgress(column_width); sbColumnWidth.setProgress(column_width);
swHideToolbar.setChecked(prefs.getBoolean("hide_toolbar", !BuildConfig.PLAY_STORE_RELEASE));
swNavOptions.setChecked(prefs.getBoolean("nav_options", true)); swNavOptions.setChecked(prefs.getBoolean("nav_options", true));
swNavCategories.setChecked(prefs.getBoolean("nav_categories", false)); swNavCategories.setChecked(prefs.getBoolean("nav_categories", false));
swNavLastSync.setChecked(prefs.getBoolean("nav_last_sync", true)); swNavLastSync.setChecked(prefs.getBoolean("nav_last_sync", true));

@ -586,17 +586,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swHideToolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_hide_toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaptionNavigation"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swNavOptions" android:id="@+id/swNavOptions"
android:layout_width="0dp" android:layout_width="0dp"
@ -605,7 +594,7 @@
android:text="@string/title_advanced_nav_options" android:text="@string/title_advanced_nav_options"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swHideToolbar" app:layout_constraintTop_toBottomOf="@id/tvCaptionNavigation"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat

@ -572,7 +572,6 @@
<string name="title_advanced_close_pane">Collapse row or column when closing a conversation</string> <string name="title_advanced_close_pane">Collapse row or column when closing a conversation</string>
<string name="title_advanced_open_pane">Start with two rows or two columns</string> <string name="title_advanced_open_pane">Start with two rows or two columns</string>
<string name="title_advanced_column_width">Message column width / row height: %1$s %%</string> <string name="title_advanced_column_width">Message column width / row height: %1$s %%</string>
<string name="title_advanced_hide_toolbar">Hide top toolbar when scrolling messages</string>
<string name="title_advanced_nav_options">Show navigation menu options</string> <string name="title_advanced_nav_options">Show navigation menu options</string>
<string name="title_advanced_nav_categories">Show account categories in the navigation menu</string> <string name="title_advanced_nav_categories">Show account categories in the navigation menu</string>
<string name="title_advanced_nav_pin">Pin navigation menu</string> <string name="title_advanced_nav_pin">Pin navigation menu</string>

Loading…
Cancel
Save