Prepares frontend for notification date range #370
This commit is contained in:
parent
09c432414f
commit
a37bed8009
|
@ -57,7 +57,7 @@ public class SettingsNotificationsFragment extends Fragment {
|
||||||
private int style;
|
private int style;
|
||||||
private static final int ACTIVITY_CHOOSE_SOUND = 412;
|
private static final int ACTIVITY_CHOOSE_SOUND = 412;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int count1 = 0;
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
@ -209,6 +209,48 @@ public class SettingsNotificationsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
final Spinner action_notification = rootView.findViewById(R.id.action_notification);
|
||||||
|
ArrayAdapter<CharSequence> adapterAction = ArrayAdapter.createFromResource(getContext(),
|
||||||
|
R.array.action_notification, android.R.layout.simple_spinner_item);
|
||||||
|
action_notification.setAdapter(adapterAction);
|
||||||
|
int positionNotificationAntion;
|
||||||
|
switch (sharedpreferences.getInt(Helper.SET_NOTIFICATION_ACTION, Helper.ACTION_ACTIVE)){
|
||||||
|
case Helper.ACTION_ACTIVE:
|
||||||
|
positionNotificationAntion = 0;
|
||||||
|
break;
|
||||||
|
case Helper.ACTION_SILENT:
|
||||||
|
positionNotificationAntion = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
positionNotificationAntion = 0;
|
||||||
|
}
|
||||||
|
action_notification.setSelection(positionNotificationAntion);
|
||||||
|
action_notification.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
if( count1 > 0 ) {
|
||||||
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
editor.putInt(Helper.SET_NOTIFICATION_ACTION, Helper.ACTION_ACTIVE);
|
||||||
|
editor.apply();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
editor.putInt(Helper.SET_NOTIFICATION_ACTION, Helper.ACTION_SILENT);
|
||||||
|
editor.apply();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count1++;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
set_notif_follow.setChecked(notif_follow);
|
set_notif_follow.setChecked(notif_follow);
|
||||||
set_notif_follow_add.setChecked(notif_add);
|
set_notif_follow_add.setChecked(notif_add);
|
||||||
set_notif_follow_ask.setChecked(notif_ask);
|
set_notif_follow_ask.setChecked(notif_ask);
|
||||||
|
|
|
@ -283,6 +283,7 @@ public class Helper {
|
||||||
public static final String SET_OLD_DIRECT_TIMELINE = "sset_old_direct_timeline";
|
public static final String SET_OLD_DIRECT_TIMELINE = "sset_old_direct_timeline";
|
||||||
public static final String SET_BATTERY_PROFILE = "set_battery_profile";
|
public static final String SET_BATTERY_PROFILE = "set_battery_profile";
|
||||||
public static final String SET_DEFAULT_LOCALE_NEW = "set_default_locale_new";
|
public static final String SET_DEFAULT_LOCALE_NEW = "set_default_locale_new";
|
||||||
|
public static final String SET_NOTIFICATION_ACTION = "set_notification_action";
|
||||||
public static final int S_512KO = 1;
|
public static final int S_512KO = 1;
|
||||||
public static final int S_1MO = 2;
|
public static final int S_1MO = 2;
|
||||||
public static final int S_2MO = 3;
|
public static final int S_2MO = 3;
|
||||||
|
@ -290,6 +291,8 @@ public class Helper {
|
||||||
public static final int ATTACHMENT_WIFI = 2;
|
public static final int ATTACHMENT_WIFI = 2;
|
||||||
public static final int ATTACHMENT_ASK = 3;
|
public static final int ATTACHMENT_ASK = 3;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static final int BATTERY_PROFILE_NORMAL = 1;
|
public static final int BATTERY_PROFILE_NORMAL = 1;
|
||||||
public static final int BATTERY_PROFILE_MEDIUM = 2;
|
public static final int BATTERY_PROFILE_MEDIUM = 2;
|
||||||
public static final int BATTERY_PROFILE_LOW = 3;
|
public static final int BATTERY_PROFILE_LOW = 3;
|
||||||
|
@ -304,6 +307,9 @@ public class Helper {
|
||||||
public static final int TRANS_DEEPL = 1;
|
public static final int TRANS_DEEPL = 1;
|
||||||
public static final int TRANS_NONE = 2;
|
public static final int TRANS_NONE = 2;
|
||||||
|
|
||||||
|
public static final int ACTION_SILENT = 0;
|
||||||
|
public static final int ACTION_ACTIVE = 1;
|
||||||
|
|
||||||
public static final String SET_TRANS_FORCED = "set_trans_forced";
|
public static final String SET_TRANS_FORCED = "set_trans_forced";
|
||||||
public static final String SET_NOTIFY = "set_notify";
|
public static final String SET_NOTIFY = "set_notify";
|
||||||
public static final String SET_NOTIF_FOLLOW = "set_notif_follow";
|
public static final String SET_NOTIF_FOLLOW = "set_notif_follow";
|
||||||
|
|
|
@ -166,6 +166,11 @@
|
||||||
android:id="@+id/settings_time_to"
|
android:id="@+id/settings_time_to"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/action_notification"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:entries="@array/action_notification"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!-- MORE OPTIONS SETTINGS -->
|
<!-- MORE OPTIONS SETTINGS -->
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -132,6 +132,11 @@
|
||||||
<item>Block this domain?</item>
|
<item>Block this domain?</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="action_notification">
|
||||||
|
<item>Notify</item>
|
||||||
|
<item>Silent</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="more_action_owner_confirm">
|
<string-array name="more_action_owner_confirm">
|
||||||
<item>Remove this toot?</item>
|
<item>Remove this toot?</item>
|
||||||
<item>Delete & re-draft this toot?</item>
|
<item>Delete & re-draft this toot?</item>
|
||||||
|
|
Loading…
Reference in New Issue