mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-06-25 06:30:10 +03:00
parent
7baab31549
commit
89355894fc
3 changed files with 27 additions and 6 deletions
|
@ -355,6 +355,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
};
|
||||
private NetworkStateReceiver networkStateReceiver;
|
||||
|
||||
SharedPreferences sharedpreferences;
|
||||
|
||||
public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
//Fetch some db values to initialize data
|
||||
|
@ -1111,7 +1113,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
|
||||
sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
|
||||
if (!Helper.isLoggedIn(BaseMainActivity.this)) {
|
||||
//It is not, the user is redirected to the login page
|
||||
Intent myIntent = new Intent(BaseMainActivity.this, LoginActivity.class);
|
||||
|
@ -1593,8 +1595,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
fetchRecentAccounts(BaseMainActivity.this, headerMainBinding);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (!sharedpreferences.getBoolean(getString(R.string.SET_AUTO_HIDE_COMPOSE), true) && !getFloatingVisibility())
|
||||
manageFloatingButton(true);
|
||||
}
|
||||
|
||||
private void manageTopBarScrolling(Toolbar toolbar) {
|
||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final boolean topBarScrolling = !sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_TOPBAR_SCROLLING), false);
|
||||
|
||||
final AppBarLayout.LayoutParams toolbarLayoutParams = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
|
||||
|
@ -2017,10 +2025,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
}
|
||||
|
||||
public void manageFloatingButton(boolean display) {
|
||||
if (display) {
|
||||
binding.compose.show();
|
||||
} else {
|
||||
binding.compose.hide();
|
||||
if (sharedpreferences.getBoolean(getString(R.string.SET_AUTO_HIDE_COMPOSE), true)) {
|
||||
if (display) {
|
||||
binding.compose.show();
|
||||
} else {
|
||||
binding.compose.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1132,6 +1132,7 @@
|
|||
<string name="SET_UNFOLLOW_VALIDATION" translatable="false">SET_UNFOLLOW_VALIDATION</string>
|
||||
<string name="SET_USE_SINGLE_TOPBAR" translatable="false">SET_USE_SINGLE_TOPBAR</string>
|
||||
<string name="SET_DISABLE_TOPBAR_SCROLLING" translatable="false">SET_DISABLE_TOPBAR_SCROLLING</string>
|
||||
<string name="SET_AUTO_HIDE_COMPOSE" translatable="false">SET_AUTO_HIDE_COMPOSE</string>
|
||||
<string name="SET_DISPLAY_COUNTERS" translatable="false">SET_DISPLAY_COUNTERS</string>
|
||||
<string name="SET_DISPLAY_COMPACT_ACTION_BUTTON" translatable="false">SET_DISPLAY_COMPACT_ACTION_BUTTON</string>
|
||||
|
||||
|
@ -1810,6 +1811,8 @@
|
|||
<string name="push_distributors">Push distributor</string>
|
||||
<string name="set_single_topbar_title">Single action bar</string>
|
||||
<string name="set_disable_topbar_scrolling_title">Disable top bar scrolling</string>
|
||||
<string name="set_audo_hide_compose_title">Auto hide compose button</string>
|
||||
<string name="set_audo_hide_compose_summary">Automatically hide compose button when scrolling up on a timeline</string>
|
||||
<string name="set_single_topbar">When enabled, the app will only have a single bar for timelines</string>
|
||||
<string name="set_timelines_in_a_list_title">Timelines in a list</string>
|
||||
<string name="set_timelines_in_a_list">When enabled, all pinned timelines will be displayed in a drop-down menu</string>
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
app:singleLineTitle="false"
|
||||
app:title="@string/set_disable_topbar_scrolling_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:summary="@string/set_audo_hide_compose_summary"
|
||||
app:defaultValue="true"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/SET_AUTO_HIDE_COMPOSE"
|
||||
app:singleLineTitle="false"
|
||||
app:title="@string/set_audo_hide_compose_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:iconSpaceReserved="false"
|
||||
|
|
Loading…
Reference in a new issue