mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
replace mute for one year with option to mute forever (#814)
This commit is contained in:
@@ -132,7 +132,7 @@
|
||||
<item>@string/mute_for_two_hours</item>
|
||||
<item>@string/mute_for_one_day</item>
|
||||
<item>@string/mute_for_seven_days</item>
|
||||
<item>@string/mute_for_one_year</item>
|
||||
<item>@string/mute_forever</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
<string name="mute_for_two_hours">Mute for 2 hours</string>
|
||||
<string name="mute_for_one_day">Mute for 1 day</string>
|
||||
<string name="mute_for_seven_days">Mute for 7 days</string>
|
||||
<string name="mute_for_one_year">Mute for 1 year</string>
|
||||
<string name="mute_forever">Mute forever</string>
|
||||
|
||||
<string name="share_location_once">once</string>
|
||||
<string name="share_location_for_5_minutes">for 5 minutes</string>
|
||||
|
||||
@@ -25,22 +25,19 @@ public class MuteDialog extends AlertDialog {
|
||||
public static void show(final Context context, final @NonNull MuteSelectionListener listener) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.menu_mute);
|
||||
builder.setItems(R.array.mute_durations, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, final int which) {
|
||||
final long muteUntil;
|
||||
builder.setItems(R.array.mute_durations, (dialog, which) -> {
|
||||
final long muteUntil;
|
||||
|
||||
switch (which) {
|
||||
case 0: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
|
||||
case 1: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(2); break;
|
||||
case 2: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1); break;
|
||||
case 3: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(7); break;
|
||||
case 4: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(365); break;
|
||||
default: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
|
||||
}
|
||||
|
||||
listener.onMuted(muteUntil);
|
||||
switch (which) {
|
||||
case 0: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
|
||||
case 1: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(2); break;
|
||||
case 2: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1); break;
|
||||
case 3: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(7); break;
|
||||
case 4: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(36500); break;
|
||||
default: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
|
||||
}
|
||||
|
||||
listener.onMuted(muteUntil);
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
||||
Reference in New Issue
Block a user