mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-06-26 07:00: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;
|
private NetworkStateReceiver networkStateReceiver;
|
||||||
|
|
||||||
|
SharedPreferences sharedpreferences;
|
||||||
|
|
||||||
public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
|
public static void fetchRecentAccounts(Activity activity, NavHeaderMainBinding headerMainBinding) {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
//Fetch some db values to initialize data
|
//Fetch some db values to initialize data
|
||||||
|
@ -1111,7 +1113,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
|
sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
|
||||||
if (!Helper.isLoggedIn(BaseMainActivity.this)) {
|
if (!Helper.isLoggedIn(BaseMainActivity.this)) {
|
||||||
//It is not, the user is redirected to the login page
|
//It is not, the user is redirected to the login page
|
||||||
Intent myIntent = new Intent(BaseMainActivity.this, LoginActivity.class);
|
Intent myIntent = new Intent(BaseMainActivity.this, LoginActivity.class);
|
||||||
|
@ -1593,8 +1595,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
fetchRecentAccounts(BaseMainActivity.this, headerMainBinding);
|
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) {
|
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 boolean topBarScrolling = !sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_TOPBAR_SCROLLING), false);
|
||||||
|
|
||||||
final AppBarLayout.LayoutParams toolbarLayoutParams = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
|
final AppBarLayout.LayoutParams toolbarLayoutParams = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
|
||||||
|
@ -2017,12 +2025,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manageFloatingButton(boolean display) {
|
public void manageFloatingButton(boolean display) {
|
||||||
|
if (sharedpreferences.getBoolean(getString(R.string.SET_AUTO_HIDE_COMPOSE), true)) {
|
||||||
if (display) {
|
if (display) {
|
||||||
binding.compose.show();
|
binding.compose.show();
|
||||||
} else {
|
} else {
|
||||||
binding.compose.hide();
|
binding.compose.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSupportNavigateUp() {
|
public boolean onSupportNavigateUp() {
|
||||||
|
|
|
@ -1132,6 +1132,7 @@
|
||||||
<string name="SET_UNFOLLOW_VALIDATION" translatable="false">SET_UNFOLLOW_VALIDATION</string>
|
<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_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_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_COUNTERS" translatable="false">SET_DISPLAY_COUNTERS</string>
|
||||||
<string name="SET_DISPLAY_COMPACT_ACTION_BUTTON" translatable="false">SET_DISPLAY_COMPACT_ACTION_BUTTON</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="push_distributors">Push distributor</string>
|
||||||
<string name="set_single_topbar_title">Single action bar</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_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_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_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>
|
<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:singleLineTitle="false"
|
||||||
app:title="@string/set_disable_topbar_scrolling_title" />
|
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
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
|
|
Loading…
Reference in a new issue