Prepares settings

This commit is contained in:
tom79 2019-09-11 16:12:00 +02:00
parent 088dcd1889
commit da0e9d5a09
5 changed files with 30 additions and 14 deletions

View File

@ -1654,7 +1654,6 @@ public abstract class BaseMainActivity extends BaseActivity
public void onDestroy() {
super.onDestroy();
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);
WeakReference<Context> contextReference = new WeakReference<>(getApplicationContext());
if (clearCacheExit) {
@ -1676,8 +1675,6 @@ public abstract class BaseMainActivity extends BaseActivity
}
});
}
if (!backgroundProcess)
sendBroadcast(new Intent(getApplicationContext(), StopLiveNotificationReceiver.class));
if (hidde_menu != null)
LocalBroadcastManager.getInstance(getApplicationContext()).unregisterReceiver(hidde_menu);
if (update_topbar != null)

View File

@ -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 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 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 menuMenu = new SlideMenuItem(ContentSettingsFragment.type.MENU, R.drawable.ic_menu_menu);
list.add(menuItemClose);
list.add(menuItemTimeline);
list.add(menuItemNotification);
list.add(menuItemInterface);
list.add(menuItemBattery);
list.add(menuItemEdit);
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
list.add(menuMenu);

View File

@ -1165,6 +1165,18 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
if( Helper.liveNotifType(context) == Helper.NOTIF_NONE){
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.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
@ -1191,6 +1203,17 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable
editor.apply();
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++;
}

View File

@ -544,20 +544,17 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
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
android:id="@+id/set_live_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="@+id/set_live_type_indication"
android:textColor="@color/mastodonC2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<LinearLayout
android:id="@+id/live_notif_per_account"

View File

@ -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="live_delayed">Live notifications delayed</string>
<string name="no_live_notif">No live notifications</string>
<string name="no_live_indication">Notifications will be fetched every 15 minutes.</string>
</resources>