Warns about notifications
This commit is contained in:
parent
2b36a78324
commit
182087e582
|
@ -29,6 +29,8 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
|
@ -112,7 +114,7 @@ public class MainActivity extends AppCompatActivity
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
|
||||
|
||||
final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
if( theme == Helper.THEME_LIGHT){
|
||||
|
@ -335,6 +337,42 @@ public class MainActivity extends AppCompatActivity
|
|||
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
|
||||
toolbarTitle.setText(R.string.home_menu);
|
||||
}
|
||||
|
||||
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
|
||||
if(!popupShown){
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
View dialogView = inflater.inflate(R.layout.popup_quick_settings, null);
|
||||
dialogBuilder.setView(dialogView);
|
||||
|
||||
final SwitchCompat set_push_hometimeline = (SwitchCompat) dialogView.findViewById(R.id.set_push_hometimeline);
|
||||
final SwitchCompat set_push_notification = (SwitchCompat) dialogView.findViewById(R.id.set_push_notification);
|
||||
boolean notif_hometimeline = sharedpreferences.getBoolean(Helper.SET_NOTIF_HOMETIMELINE, true);
|
||||
boolean notif_follow = sharedpreferences.getBoolean(Helper.SET_NOTIF_FOLLOW, true);
|
||||
boolean notif_add = sharedpreferences.getBoolean(Helper.SET_NOTIF_ADD, true);
|
||||
boolean notif_ask = sharedpreferences.getBoolean(Helper.SET_NOTIF_ASK, true);
|
||||
boolean notif_mention = sharedpreferences.getBoolean(Helper.SET_NOTIF_MENTION, true);
|
||||
boolean notif_share = sharedpreferences.getBoolean(Helper.SET_NOTIF_SHARE, true);
|
||||
boolean notifif_notifications = !( !notif_follow && !notif_add && !notif_ask && !notif_mention && !notif_share);
|
||||
set_push_hometimeline.setChecked(notif_hometimeline);
|
||||
set_push_notification.setChecked(notifif_notifications);
|
||||
|
||||
dialogBuilder.setTitle(R.string.settings_popup_title);
|
||||
dialogBuilder.setCancelable(false);
|
||||
dialogBuilder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putBoolean(Helper.SET_NOTIF_FOLLOW, set_push_notification.isChecked());
|
||||
editor.putBoolean(Helper.SET_NOTIF_ADD, set_push_notification.isChecked());
|
||||
editor.putBoolean(Helper.SET_NOTIF_ASK, set_push_notification.isChecked());
|
||||
editor.putBoolean(Helper.SET_NOTIF_MENTION, set_push_notification.isChecked());
|
||||
editor.putBoolean(Helper.SET_NOTIF_SHARE, set_push_notification.isChecked());
|
||||
editor.putBoolean(Helper.SET_NOTIF_HOMETIMELINE, set_push_hometimeline.isChecked());
|
||||
editor.putBoolean(Helper.SET_POPUP_PUSH, true);
|
||||
editor.apply();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -310,7 +310,10 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("statusId", status.getId());
|
||||
if( status.getReblog() == null)
|
||||
b.putString("statusId", status.getId());
|
||||
else
|
||||
b.putString("statusId", status.getReblog().getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
@ -320,7 +323,10 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
public void onClick(View v) {
|
||||
Intent intent = new Intent(context, ShowConversationActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("statusId", status.getId());
|
||||
if( status.getReblog() == null)
|
||||
b.putString("statusId", status.getId());
|
||||
else
|
||||
b.putString("statusId", status.getReblog().getId());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ public class Helper {
|
|||
public static final String SET_TIME_FROM = "set_time_from";
|
||||
public static final String SET_TIME_TO = "set_time_to";
|
||||
public static final String SET_AUTO_STORE = "set_auto_store";
|
||||
public static final String SET_POPUP_PUSH = "set_popup_push";
|
||||
public static final int ATTACHMENT_ALWAYS = 1;
|
||||
public static final int ATTACHMENT_WIFI = 2;
|
||||
public static final int ATTACHMENT_ASK = 3;
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017 Thomas Schneider
|
||||
|
||||
This file is a part of Mastalab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the
|
||||
GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with Thomas Schneider; if not,
|
||||
see <http://www.gnu.org/licenses>.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/swipeContainer"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/settings_popup_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="3"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_popup_timeline"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_push_hometimeline"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:gravity="start|center_vertical"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="3"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_popup_notification"/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/set_push_notification"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:gravity="start|center_vertical"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -48,6 +48,7 @@
|
|||
<string name="next">Suivant</string>
|
||||
<string name="previous">Précédent</string>
|
||||
<string name="open_with">Ouvrir avec</string>
|
||||
<string name="validate">Valider</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="local_menu">Fil public local</string>
|
||||
|
@ -302,6 +303,15 @@
|
|||
|
||||
<string name="action_search">Recherche</string>
|
||||
|
||||
<!-- Quick settings for notifications -->
|
||||
<string name="settings_popup_title">Notifications push</string>
|
||||
<string name="settings_popup_message">
|
||||
Veuillez confirmer les notifications que vous souhaitez recevoir.
|
||||
Vous pourrez les activer ou les désactiver plus tard dans les paramètres (onglet Notifications).
|
||||
</string>
|
||||
<string name="settings_popup_timeline">Pour les pouets non lus sur la page d\'accueil</string>
|
||||
<string name="settings_popup_notification">Pour les notifications non lues ?</string>
|
||||
|
||||
<!-- CACHE -->
|
||||
<string name="cache_title">Nettoyage du cache</string>
|
||||
<string name="cache_message">Il y a %1$s de données en cache.\n\nSouhaitez-vous les supprimer ?</string>
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
<string name="next">Next</string>
|
||||
<string name="previous">Previous</string>
|
||||
<string name="open_with">Open with</string>
|
||||
<string name="validate">Validate</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Local timeline</string>
|
||||
|
@ -307,6 +308,14 @@
|
|||
|
||||
<string name="action_search">Search</string>
|
||||
|
||||
<!-- Quick settings for notifications -->
|
||||
<string name="settings_popup_title">Push notifications</string>
|
||||
<string name="settings_popup_message">
|
||||
Please, confirm push notifications that you want to receive.
|
||||
You can enable or disable these notifications later in settings (Notifications tab).
|
||||
</string>
|
||||
<string name="settings_popup_timeline">For unread toots in home time-line?</string>
|
||||
<string name="settings_popup_notification">For unread notifications?</string>
|
||||
<!-- CACHE -->
|
||||
<string name="cache_title">Clear cache</string>
|
||||
<string name="cache_message">There are %1$s data in cache.\n\nWould you like to delete them?</string>
|
||||
|
|
Loading…
Reference in New Issue