poll notifications 1/3

add polls to notification settings
This commit is contained in:
Kasun 2019-05-04 16:28:58 +05:30
parent 16c2936d5a
commit 3b96fb9bb7
4 changed files with 55 additions and 2 deletions

View File

@ -105,6 +105,7 @@ public class SettingsNotificationsFragment extends Fragment {
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 notif_poll = sharedpreferences.getBoolean(Helper.SET_NOTIF_POLL, true);
boolean notif_wifi = sharedpreferences.getBoolean(Helper.SET_WIFI_ONLY, false);
boolean notif_silent = sharedpreferences.getBoolean(Helper.SET_NOTIF_SILENT, false);
@ -120,6 +121,7 @@ public class SettingsNotificationsFragment extends Fragment {
final CheckBox set_notif_follow_ask = rootView.findViewById(R.id.set_notif_follow_ask);
final CheckBox set_notif_follow_mention = rootView.findViewById(R.id.set_notif_follow_mention);
final CheckBox set_notif_follow_share = rootView.findViewById(R.id.set_notif_follow_share);
final CheckBox set_notif_follow_poll = rootView.findViewById(R.id.set_notif_follow_poll);
final CheckBox set_notif_hometimeline = rootView.findViewById(R.id.set_notif_hometimeline);
@ -134,6 +136,7 @@ public class SettingsNotificationsFragment extends Fragment {
final Button sound_fav = rootView.findViewById(R.id.sound_fav);
final Button sound_follow = rootView.findViewById(R.id.sound_follow);
final Button sound_mention = rootView.findViewById(R.id.sound_mention);
final Button sound_poll = rootView.findViewById(R.id.sound_poll);
final Button sound_backup = rootView.findViewById(R.id.sound_backup);
final Button sound_media = rootView.findViewById(R.id.sound_media);
Button set_notif_sound = rootView.findViewById(R.id.set_notif_sound);
@ -184,6 +187,16 @@ public class SettingsNotificationsFragment extends Fragment {
}
});
sound_poll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
intent.putExtra(Settings.EXTRA_CHANNEL_ID, "channel_poll");
startActivity(intent);
}
});
sound_backup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -332,6 +345,7 @@ public class SettingsNotificationsFragment extends Fragment {
set_notif_follow_ask.setChecked(notif_ask);
set_notif_follow_mention.setChecked(notif_mention);
set_notif_follow_share.setChecked(notif_share);
set_notif_follow_poll.setChecked(notif_poll);
set_notif_hometimeline.setChecked(notif_hometimeline);
switchCompatWIFI.setChecked(notif_wifi);
@ -385,6 +399,14 @@ public class SettingsNotificationsFragment extends Fragment {
editor.apply();
}
});
set_notif_follow_poll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_NOTIF_POLL, set_notif_follow_poll.isChecked());
editor.apply();
}
});
switchCompatWIFI.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

View File

@ -356,6 +356,7 @@ public class Helper {
public static final String SET_NOTIF_ASK = "set_notif_follow_ask";
public static final String SET_NOTIF_MENTION = "set_notif_follow_mention";
public static final String SET_NOTIF_SHARE = "set_notif_follow_share";
public static final String SET_NOTIF_POLL = "set_notif_follow_poll";
public static final String SET_NOTIF_FOLLOW_FILTER = "set_notif_follow_filter";
public static final String SET_NOTIF_ADD_FILTER = "set_notif_follow_add_filter";
public static final String SET_NOTIF_MENTION_FILTER = "set_notif_follow_mention_filter";

View File

@ -165,11 +165,11 @@
android:orientation="horizontal"
>
<Button
android:id="@+id/sound_backup"
android:id="@+id/sound_poll"
android:gravity="center"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:tint="@android:color/white"
android:text="@string/channel_notif_backup"
android:text="@string/channel_notif_poll"
android:maxLines="1"
android:layout_width="0dp"
android:layout_weight="1"
@ -185,6 +185,27 @@
android:layout_weight="1"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/sound_backup"
android:gravity="center"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:tint="@android:color/white"
android:text="@string/channel_notif_backup"
android:maxLines="1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<Button
android:visibility="invisible"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<!-- NOTIFICATIONS SETTINGS -->
@ -251,6 +272,13 @@
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_notif_follow_share"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_notif_follow_poll"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_notif_follow_poll"
android:layout_height="wrap_content" />
<!-- END NOTIFICATIONS SETTINGS -->
<!-- NOTIFICATION CONTENT NEW -->

View File

@ -326,6 +326,7 @@
<string name="set_notif_follow_share">Notify when someone boosts your status</string>
<string name="set_notif_follow_add">Notify when someone favourites your status</string>
<string name="set_notif_follow_mention">Notify when someone mentions you</string>
<string name="set_notif_follow_poll">Notify when a poll ended</string>
<string name="set_share_validation">Show confirmation dialog before boosting</string>
<string name="set_share_validation_fav">Show confirmation dialog before adding to favourites</string>
<string name="set_wifi_only">Notify in WIFI only</string>
@ -648,6 +649,7 @@
<string name="channel_notif_boost">New Boost</string>
<string name="channel_notif_fav">New Favourite</string>
<string name="channel_notif_mention">New Mention</string>
<string name="channel_notif_poll">Poll Ended</string>
<string name="channel_notif_toot">New Toot</string>
<string name="channel_notif_backup">Toots Backup</string>
<string name="channel_notif_media">Media Download</string>