Prepares settings
This commit is contained in:
parent
088dcd1889
commit
da0e9d5a09
|
@ -1654,7 +1654,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
boolean backgroundProcess = sharedpreferences.getBoolean(Helper.SET_KEEP_BACKGROUND_PROCESS, true);
|
|
||||||
boolean clearCacheExit = sharedpreferences.getBoolean(Helper.SET_CLEAR_CACHE_EXIT, false);
|
boolean clearCacheExit = sharedpreferences.getBoolean(Helper.SET_CLEAR_CACHE_EXIT, false);
|
||||||
WeakReference<Context> contextReference = new WeakReference<>(getApplicationContext());
|
WeakReference<Context> contextReference = new WeakReference<>(getApplicationContext());
|
||||||
if (clearCacheExit) {
|
if (clearCacheExit) {
|
||||||
|
@ -1676,8 +1675,6 @@ public abstract class BaseMainActivity extends BaseActivity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!backgroundProcess)
|
|
||||||
sendBroadcast(new Intent(getApplicationContext(), StopLiveNotificationReceiver.class));
|
|
||||||
if (hidde_menu != null)
|
if (hidde_menu != null)
|
||||||
LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(hidde_menu);
|
LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(hidde_menu);
|
||||||
if (update_topbar != null)
|
if (update_topbar != null)
|
||||||
|
|
|
@ -183,14 +183,12 @@ public class SettingsActivity extends BaseActivity implements ViewAnimator.ViewA
|
||||||
SlideMenuItem menuItemAdmin = new SlideMenuItem(ContentSettingsFragment.type.ADMIN, R.drawable.ic_security_admin_menu);
|
SlideMenuItem menuItemAdmin = new SlideMenuItem(ContentSettingsFragment.type.ADMIN, R.drawable.ic_security_admin_menu);
|
||||||
SlideMenuItem menuItemInterface = new SlideMenuItem(ContentSettingsFragment.type.INTERFACE, R.drawable.ic_tablet_menu);
|
SlideMenuItem menuItemInterface = new SlideMenuItem(ContentSettingsFragment.type.INTERFACE, R.drawable.ic_tablet_menu);
|
||||||
SlideMenuItem menuItemEdit = new SlideMenuItem(ContentSettingsFragment.type.COMPOSE, R.drawable.ic_edit_black_menu);
|
SlideMenuItem menuItemEdit = new SlideMenuItem(ContentSettingsFragment.type.COMPOSE, R.drawable.ic_edit_black_menu);
|
||||||
SlideMenuItem menuItemBattery = new SlideMenuItem(ContentSettingsFragment.type.BATTERY, R.drawable.ic_battery_alert_menu);
|
|
||||||
SlideMenuItem menuLanguage = new SlideMenuItem(ContentSettingsFragment.type.LANGUAGE, R.drawable.ic_translate_menu);
|
SlideMenuItem menuLanguage = new SlideMenuItem(ContentSettingsFragment.type.LANGUAGE, R.drawable.ic_translate_menu);
|
||||||
SlideMenuItem menuMenu = new SlideMenuItem(ContentSettingsFragment.type.MENU, R.drawable.ic_menu_menu);
|
SlideMenuItem menuMenu = new SlideMenuItem(ContentSettingsFragment.type.MENU, R.drawable.ic_menu_menu);
|
||||||
list.add(menuItemClose);
|
list.add(menuItemClose);
|
||||||
list.add(menuItemTimeline);
|
list.add(menuItemTimeline);
|
||||||
list.add(menuItemNotification);
|
list.add(menuItemNotification);
|
||||||
list.add(menuItemInterface);
|
list.add(menuItemInterface);
|
||||||
list.add(menuItemBattery);
|
|
||||||
list.add(menuItemEdit);
|
list.add(menuItemEdit);
|
||||||
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||||
list.add(menuMenu);
|
list.add(menuMenu);
|
||||||
|
|
|
@ -1165,6 +1165,18 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
||||||
if( Helper.liveNotifType(context) == Helper.NOTIF_NONE){
|
if( Helper.liveNotifType(context) == Helper.NOTIF_NONE){
|
||||||
live_notif_per_account.setVisibility(View.GONE);
|
live_notif_per_account.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
TextView set_live_type_indication = rootView.findViewById(R.id.set_live_type_indication);
|
||||||
|
switch (Helper.liveNotifType(context)){
|
||||||
|
case Helper.NOTIF_LIVE:
|
||||||
|
set_live_type_indication.setText(R.string.live_notif_indication);
|
||||||
|
break;
|
||||||
|
case Helper.NOTIF_DELAYED:
|
||||||
|
set_live_type_indication.setText(R.string.set_live_type_indication);
|
||||||
|
break;
|
||||||
|
case Helper.NOTIF_NONE:
|
||||||
|
set_live_type_indication.setText(R.string.no_live_indication);
|
||||||
|
break;
|
||||||
|
}
|
||||||
set_live_type.setSelection(Helper.liveNotifType(context));
|
set_live_type.setSelection(Helper.liveNotifType(context));
|
||||||
set_live_type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
set_live_type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1191,6 +1203,17 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
|
||||||
editor.apply();
|
editor.apply();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
switch (Helper.liveNotifType(context)){
|
||||||
|
case Helper.NOTIF_LIVE:
|
||||||
|
set_live_type_indication.setText(R.string.live_notif_indication);
|
||||||
|
break;
|
||||||
|
case Helper.NOTIF_DELAYED:
|
||||||
|
set_live_type_indication.setText(R.string.set_live_type_indication);
|
||||||
|
break;
|
||||||
|
case Helper.NOTIF_NONE:
|
||||||
|
set_live_type_indication.setText(R.string.no_live_indication);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
count2++;
|
count2++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,20 +544,17 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/set_live_type_title" />
|
|
||||||
|
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/set_live_type"
|
android:id="@+id/set_live_type"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/set_live_type_indication"
|
||||||
|
android:textColor="@color/mastodonC2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/live_notif_per_account"
|
android:id="@+id/live_notif_per_account"
|
||||||
|
|
|
@ -1212,4 +1212,5 @@
|
||||||
<string name="set_live_type_indication">Notifications will be delayed every 30 seconds. That will allow to drain less battery.</string>
|
<string name="set_live_type_indication">Notifications will be delayed every 30 seconds. That will allow to drain less battery.</string>
|
||||||
<string name="live_delayed">Live notifications delayed</string>
|
<string name="live_delayed">Live notifications delayed</string>
|
||||||
<string name="no_live_notif">No live notifications</string>
|
<string name="no_live_notif">No live notifications</string>
|
||||||
|
<string name="no_live_indication">Notifications will be fetched every 15 minutes.</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue