From 01c36fa45eda2a067fc1e66016dc73065edf438b Mon Sep 17 00:00:00 2001 From: Pleclown Date: Sat, 19 Nov 2022 19:56:31 +0100 Subject: [PATCH] Adding a 12 hour option for polls --- .../android/fragments/ComposeFragment.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 58748aba99..d69c02426d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -1214,18 +1214,20 @@ private void showPollDurationMenu(){ menu.getMenu().add(0, 2, 0, getResources().getQuantityString(R.plurals.x_minutes, 30, 30)); menu.getMenu().add(0, 3, 0, getResources().getQuantityString(R.plurals.x_hours, 1, 1)); menu.getMenu().add(0, 4, 0, getResources().getQuantityString(R.plurals.x_hours, 6, 6)); - menu.getMenu().add(0, 5, 0, getResources().getQuantityString(R.plurals.x_days, 1, 1)); - menu.getMenu().add(0, 6, 0, getResources().getQuantityString(R.plurals.x_days, 3, 3)); - menu.getMenu().add(0, 7, 0, getResources().getQuantityString(R.plurals.x_days, 7, 7)); + menu.getMenu().add(0, 5, 0, getResources().getQuantityString(R.plurals.x_hours, 12, 12)); + menu.getMenu().add(0, 6, 0, getResources().getQuantityString(R.plurals.x_days, 1, 1)); + menu.getMenu().add(0, 7, 0, getResources().getQuantityString(R.plurals.x_days, 3, 3)); + menu.getMenu().add(0, 8, 0, getResources().getQuantityString(R.plurals.x_days, 7, 7)); menu.setOnMenuItemClickListener(item->{ pollDuration=switch(item.getItemId()){ case 1 -> 5*60; case 2 -> 30*60; case 3 -> 3600; case 4 -> 6*3600; - case 5 -> 24*3600; - case 6 -> 3*24*3600; - case 7 -> 7*24*3600; + case 5 -> 12*3600; + case 6 -> 24*3600; + case 7 -> 3*24*3600; + case 8 -> 7*24*3600; default -> throw new IllegalStateException("Unexpected value: "+item.getItemId()); }; pollDurationView.setText(getString(R.string.compose_poll_duration, pollDurationStr=item.getTitle().toString()));