diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6abcdc37a..5b02abd88 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -55,7 +55,9 @@ - + @@ -70,7 +72,6 @@ android:name="app.fedilab.android.services.RestartLiveNotificationReceiver" android:exported="false"> - diff --git a/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java b/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java index 05691169f..eac171630 100644 --- a/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java +++ b/app/src/main/java/app/fedilab/android/fragments/ContentSettingsFragment.java @@ -42,7 +42,6 @@ import android.provider.Settings; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; -import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; @@ -65,39 +64,30 @@ import android.widget.Toast; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.SwitchCompat; -import androidx.core.app.NotificationCompat; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import com.google.android.material.navigation.NavigationView; import com.google.common.collect.ImmutableSet; - -import org.apache.poi.sl.usermodel.Line; import org.jetbrains.annotations.NotNull; -import org.json.JSONException; -import org.json.JSONObject; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Objects; import java.util.Set; import app.fedilab.android.R; +import app.fedilab.android.activities.LanguageActivity; import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.SettingsActivity; import app.fedilab.android.animatemenu.interfaces.ScreenShotable; import app.fedilab.android.asynctasks.DownloadTrackingDomainsAsyncTask; import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask; import app.fedilab.android.client.Entities.Account; -import app.fedilab.android.client.Entities.Status; import app.fedilab.android.filelister.FileListerDialog; import app.fedilab.android.filelister.OnFileSelectedListener; import app.fedilab.android.helper.Helper; import app.fedilab.android.services.LiveNotificationDelayedService; -import app.fedilab.android.services.LiveNotificationService; import app.fedilab.android.services.StopLiveNotificationReceiver; import app.fedilab.android.sqlite.AccountDAO; import app.fedilab.android.sqlite.Sqlite; @@ -106,10 +96,8 @@ import mabbas007.tagsedittext.TagsEditText; import static android.app.Activity.RESULT_OK; -import static android.content.Context.ACTIVITY_SERVICE; import static android.content.Context.MODE_PRIVATE; import static app.fedilab.android.fragments.ContentSettingsFragment.type.ADMIN; -import static app.fedilab.android.fragments.ContentSettingsFragment.type.BATTERY; import static app.fedilab.android.fragments.ContentSettingsFragment.type.COMPOSE; import static app.fedilab.android.fragments.ContentSettingsFragment.type.INTERFACE; import static app.fedilab.android.fragments.ContentSettingsFragment.type.NOTIFICATIONS; @@ -131,7 +119,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable NOTIFICATIONS, INTERFACE, COMPOSE, - BATTERY, LANGUAGE, MENU } @@ -250,7 +237,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable LinearLayout settings_admin = rootView.findViewById(R.id.settings_admin); LinearLayout settings_interface = rootView.findViewById(R.id.settings_interface); LinearLayout settings_compose = rootView.findViewById(R.id.settings_compose); - LinearLayout settings_battery = rootView.findViewById(R.id.settings_battery); + String title = ""; if (type == null || type.equals(TIMELINES)) { @@ -265,9 +252,6 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable } else if (type == INTERFACE) { settings_interface.setVisibility(View.VISIBLE); title = context.getString(R.string.u_interface); - } else if (type == BATTERY) { - title = context.getString(R.string.battery); - settings_battery.setVisibility(View.VISIBLE); } else if (type == COMPOSE) { settings_compose.setVisibility(View.VISIBLE); title = context.getString(R.string.compose); @@ -1130,24 +1114,32 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable } }); - boolean livenotif = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true); - final CheckBox set_live_notif = rootView.findViewById(R.id.set_live_notify); - set_live_notif.setChecked(livenotif); - set_live_notif.setOnClickListener(new View.OnClickListener() { + + boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true); + final SwitchCompat switchCompatNotify = rootView.findViewById(R.id.set_notify); + switchCompatNotify.setChecked(notify); + final LinearLayout notification_settings = rootView.findViewById(R.id.notification_settings); + if (notify) + notification_settings.setVisibility(View.VISIBLE); + else + notification_settings.setVisibility(View.GONE); + switchCompatNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override - public void onClick(View v) { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + // Save the state here SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, set_live_notif.isChecked()); - editor.putBoolean(Helper.SHOULD_CONTINUE_STREAMING, set_live_notif.isChecked()); + editor.putBoolean(Helper.SET_NOTIFY, isChecked); editor.apply(); - if (set_live_notif.isChecked()) { + if (isChecked) { + notification_settings.setVisibility(View.VISIBLE); try { Intent streamingIntent = new Intent(context, LiveNotificationDelayedService.class); context.startService(streamingIntent); } catch (Exception ignored) { ignored.printStackTrace(); } - } else { + }else { + notification_settings.setVisibility(View.GONE); context.sendBroadcast(new Intent(context, StopLiveNotificationReceiver.class)); if (Build.VERSION.SDK_INT >= 26) { NotificationManager notif = ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE)); @@ -1158,22 +1150,57 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable } } }); - final LinearLayout set_live_notify_text = rootView.findViewById(R.id.set_live_notify_text); - set_live_notify_text.setOnClickListener(v -> set_live_notif.performClick()); - boolean keep_background_process = sharedpreferences.getBoolean(Helper.SET_KEEP_BACKGROUND_PROCESS, true); - final CheckBox set_keep_background_process = rootView.findViewById(R.id.set_keep_background_process); - set_keep_background_process.setChecked(keep_background_process); - set_keep_background_process.setOnClickListener(new View.OnClickListener() { + + + + //Live notification mode + final Spinner set_live_type = rootView.findViewById(R.id.set_live_type); + String[] labels = {context.getString(R.string.live_notif), context.getString(R.string.live_delayed), context.getString(R.string.no_live_notif)}; + ArrayAdapter adapterLive = new ArrayAdapter<>(context, + android.R.layout.simple_spinner_dropdown_item,labels ); + + LinearLayout live_notif_per_account = rootView.findViewById(R.id.live_notif_per_account); + set_live_type.setAdapter(adapterLive); + if( Helper.liveNotifType(context) == Helper.NOTIF_NONE){ + live_notif_per_account.setVisibility(View.GONE); + } + set_live_type.setSelection(Helper.liveNotifType(context)); + set_live_type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override - public void onClick(View v) { - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putBoolean(Helper.SET_KEEP_BACKGROUND_PROCESS, set_keep_background_process.isChecked()); - editor.apply(); + public void onItemSelected(AdapterView parent, View view, int position, long id) { + if (count2 > 0) { + SharedPreferences.Editor editor = sharedpreferences.edit(); + switch (position) { + case Helper.NOTIF_LIVE: + editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, true); + editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false); + live_notif_per_account.setVisibility(View.VISIBLE); + editor.apply(); + break; + case Helper.NOTIF_DELAYED: + editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false); + editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, true); + live_notif_per_account.setVisibility(View.VISIBLE); + editor.apply(); + break; + case Helper.NOTIF_NONE: + editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false); + editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false); + live_notif_per_account.setVisibility(View.GONE); + editor.apply(); + break; + } + } + count2++; + } + + @Override + public void onNothingSelected(AdapterView parent) { + } }); - final LinearLayout set_keep_background_process_text = rootView.findViewById(R.id.set_keep_background_process_text); - set_keep_background_process_text.setOnClickListener(v -> set_keep_background_process.performClick()); + boolean capitalize = sharedpreferences.getBoolean(Helper.SET_CAPITALIZE, true); @@ -1708,27 +1735,7 @@ public class ContentSettingsFragment extends Fragment implements ScreenShotable }); - boolean notify = sharedpreferences.getBoolean(Helper.SET_NOTIFY, true); - final SwitchCompat switchCompatNotify = rootView.findViewById(R.id.set_notify); - switchCompatNotify.setChecked(notify); - final LinearLayout notification_settings = rootView.findViewById(R.id.notification_settings); - if (notify) - notification_settings.setVisibility(View.VISIBLE); - else - notification_settings.setVisibility(View.GONE); - switchCompatNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - // Save the state here - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putBoolean(Helper.SET_NOTIFY, isChecked); - editor.apply(); - if (isChecked) - notification_settings.setVisibility(View.VISIBLE); - else - notification_settings.setVisibility(View.GONE); - } - }); + boolean notif_follow = sharedpreferences.getBoolean(Helper.SET_NOTIF_FOLLOW, true); diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java index 92e7b1dc0..f107592ba 100644 --- a/app/src/main/java/app/fedilab/android/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/helper/Helper.java @@ -344,6 +344,7 @@ public class Helper { public static final String INSTANCE_VERSION = "instance_version"; public static final String NEWS_ACCOUNT_ID = "news_account_id"; public static final String SET_LIVE_NOTIFICATIONS = "set_live_notifications"; + public static final String SET_DELAYED_NOTIFICATIONS = "set_delayed_notifications"; public static final String SET_DISABLE_GIF = "set_disable_gif"; public static final String SET_DISABLE_ANIMATED_EMOJI = "set_disable_animated_emoji"; public static final String SET_CAPITALIZE = "set_capitalize"; @@ -358,7 +359,6 @@ public class Helper { public static final String SET_CUSTOM_SHARING_URL = "set_custom_sharing_url"; public static final String SET_NOTIF_SOUND = "set_notif_sound"; public static final String SET_ENABLE_TIME_SLOT = "set_enable_time_slot"; - public static final String SET_KEEP_BACKGROUND_PROCESS = "set_keep_background_process"; public static final String SET_CLEAR_CACHE_EXIT = "set_clear_cache_exit"; public static final String SET_DISPLAY_EMOJI = "set_display_emoji"; public static final String SET_DISPLAY_CARD = "set_display_card"; @@ -406,6 +406,10 @@ public class Helper { public static final int THEME_DARK = 2; public static final int THEME_BLACK = 3; + public static final int NOTIF_LIVE = 2; + public static final int NOTIF_DELAYED = 1; + public static final int NOTIF_NONE = 0; + public static final int LED_COLOUR = 0; public static final int TRANS_YANDEX = 0; @@ -545,6 +549,19 @@ public class Helper { } + public static int liveNotifType(Context context){ + SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + boolean live = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, false ); + boolean delayed = sharedpreferences.getBoolean(Helper.SET_DELAYED_NOTIFICATIONS, true ); + if( delayed){ + return Helper.NOTIF_DELAYED; + }else if( live ){ + return Helper.NOTIF_LIVE; + }else { + return Helper.NOTIF_NONE; + } + } + /** * Converts emojis in input to unicode * diff --git a/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java b/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java index 3abdc7bbd..ba6fbbe94 100644 --- a/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java +++ b/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java @@ -79,7 +79,6 @@ public class LiveNotificationDelayedService extends Service { public static String CHANNEL_ID = "live_notifications"; protected Account account; - boolean backgroundProcess; private NotificationChannel channel; public static int totalAccount = 0; public static int eventsCount = 0; @@ -89,13 +88,11 @@ public class LiveNotificationDelayedService extends Service { public void onCreate() { super.onCreate(); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - backgroundProcess = sharedpreferences.getBoolean(Helper.SET_KEEP_BACKGROUND_PROCESS, true); } private void startStream() { SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - backgroundProcess = sharedpreferences.getBoolean(Helper.SET_KEEP_BACKGROUND_PROCESS, true); boolean liveNotifications = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true); SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); if (liveNotifications) { @@ -129,38 +126,33 @@ public class LiveNotificationDelayedService extends Service { if (intent == null || intent.getBooleanExtra("stop", false)) { stopSelf(); } - if (backgroundProcess) { - if (Build.VERSION.SDK_INT >= 26) { - channel = new NotificationChannel(CHANNEL_ID, - "Live notifications", - NotificationManager.IMPORTANCE_DEFAULT); + if (Build.VERSION.SDK_INT >= 26) { + channel = new NotificationChannel(CHANNEL_ID, + "Live notifications", + NotificationManager.IMPORTANCE_DEFAULT); - ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); - SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); - List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); - totalAccount = 0; - for (Account account : accountStreams) { - if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) { - final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); - if (allowStream) { - totalAccount++; - } + ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); + SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); + List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); + totalAccount = 0; + for (Account account : accountStreams) { + if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) { + final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); + if (allowStream) { + totalAccount++; } } - android.app.Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID) - .setContentTitle(getString(R.string.top_notification)) - .setSmallIcon(R.drawable.fedilab_notification_icon) - .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); - - startForeground(1, notification); } - startStream(); - return START_STICKY; - } else { - startStream(); - return START_NOT_STICKY; + android.app.Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID) + .setContentTitle(getString(R.string.top_notification)) + .setSmallIcon(R.drawable.fedilab_notification_icon) + .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); + + startForeground(1, notification); } + startStream(); + return START_STICKY; } @@ -173,9 +165,7 @@ public class LiveNotificationDelayedService extends Service { @Override public void onTaskRemoved(Intent rootIntent) { super.onTaskRemoved(rootIntent); - if (backgroundProcess) { - restart(); - } + restart(); } private void restart() { diff --git a/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java b/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java index c67b209b4..ffac498ab 100644 --- a/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java +++ b/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java @@ -95,7 +95,6 @@ public class LiveNotificationService extends Service implements NetworkStateRece public static String CHANNEL_ID = "live_notifications"; protected Account account; - boolean backgroundProcess; private static HashMap threads = new HashMap<>(); private static HashMap lastNotification = new HashMap<>(); private NetworkStateReceiver networkStateReceiver; @@ -111,13 +110,11 @@ public class LiveNotificationService extends Service implements NetworkStateRece networkStateReceiver.addListener(this); registerReceiver(networkStateReceiver, new IntentFilter(android.net.ConnectivityManager.CONNECTIVITY_ACTION)); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - backgroundProcess = sharedpreferences.getBoolean(Helper.SET_KEEP_BACKGROUND_PROCESS, true); } private void startStream() { SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - backgroundProcess = sharedpreferences.getBoolean(Helper.SET_KEEP_BACKGROUND_PROCESS, true); boolean liveNotifications = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true); SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); if (liveNotifications) { @@ -138,37 +135,33 @@ public class LiveNotificationService extends Service implements NetworkStateRece if (intent == null || intent.getBooleanExtra("stop", false)) { stopSelf(); } - if (backgroundProcess) { - if (Build.VERSION.SDK_INT >= 26) { - channel = new NotificationChannel(CHANNEL_ID, - "Live notifications", - NotificationManager.IMPORTANCE_DEFAULT); + if (Build.VERSION.SDK_INT >= 26) { + channel = new NotificationChannel(CHANNEL_ID, + "Live notifications", + NotificationManager.IMPORTANCE_DEFAULT); - ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); - SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); - List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); - totalAccount = 0; - for (Account account : accountStreams) { - if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) { - final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); - if (allowStream) { - totalAccount++; - } + ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); + SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); + List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); + totalAccount = 0; + for (Account account : accountStreams) { + if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) { + final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); + if (allowStream) { + totalAccount++; } } - - android.app.Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID) - .setContentTitle(getString(R.string.top_notification)) - .setSmallIcon(R.drawable.fedilab_notification_icon) - .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); - - startForeground(1, notification); } - return START_STICKY; - } else { - return START_NOT_STICKY; + + android.app.Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID) + .setContentTitle(getString(R.string.top_notification)) + .setSmallIcon(R.drawable.fedilab_notification_icon) + .setContentText(getString(R.string.top_notification_message, String.valueOf(totalAccount), String.valueOf(eventsCount))).build(); + + startForeground(1, notification); } + return START_STICKY; } @Override @@ -188,9 +181,7 @@ public class LiveNotificationService extends Service implements NetworkStateRece @Override public void onTaskRemoved(Intent rootIntent) { super.onTaskRemoved(rootIntent); - if (backgroundProcess) { - restart(); - } + restart(); } private void restart() { diff --git a/app/src/main/java/app/fedilab/android/services/RestartLiveNotificationReceiver.java b/app/src/main/java/app/fedilab/android/services/RestartLiveNotificationReceiver.java index cf3618015..7a4513517 100644 --- a/app/src/main/java/app/fedilab/android/services/RestartLiveNotificationReceiver.java +++ b/app/src/main/java/app/fedilab/android/services/RestartLiveNotificationReceiver.java @@ -35,7 +35,14 @@ public class RestartLiveNotificationReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); boolean liveNotifications = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true); - if (liveNotifications) { + boolean delayedNotifications = sharedpreferences.getBoolean(Helper.SET_DELAYED_NOTIFICATIONS, true); + if (delayedNotifications) { + Intent streamingServiceIntent = new Intent(context.getApplicationContext(), LiveNotificationDelayedService.class); + try { + context.startService(streamingServiceIntent); + } catch (Exception ignored) { + } + }else if (liveNotifications) { Intent streamingServiceIntent = new Intent(context.getApplicationContext(), LiveNotificationService.class); try { context.startService(streamingServiceIntent); diff --git a/app/src/main/res/layout/fragment_settings_reveal.xml b/app/src/main/res/layout/fragment_settings_reveal.xml index c5b27bce5..db7a973c9 100644 --- a/app/src/main/res/layout/fragment_settings_reveal.xml +++ b/app/src/main/res/layout/fragment_settings_reveal.xml @@ -537,7 +537,30 @@ android:layout_height="wrap_content" /> + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Comment Peertube instance Display private messages timeline - Keep background process when app is closed Be the first to leave a comment on this video with the top right button! %s views Duration: %s @@ -1209,4 +1208,8 @@ Enter your custom host or leave blank for using invidio.us Hide Fedilab notification bar For hiding the remaining notification in the status bar, click on the eye icon button then uncheck: \"Display in status bar\" + Enable delayed notifications + Notifications will be delayed every 30 seconds. That will allow to drain less battery. + Live notifications delayed + No live notifications \ No newline at end of file