diff options
| author | Menny Even Danan <menny@evendanan.net> | 2020-03-18 15:49:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-18 15:49:21 +0000 |
| commit | 5bc94bab938bd90f9cc4e7c6f1cbc58f38504367 (patch) | |
| tree | fb69bd2fa87c32e68127fa7ec530da53ed277b5b /ime | |
| parent | 7c0d6624dee54b6bf2c8c599eb433131ee2b8894 (diff) | |
| parent | 9383685244800b03c30d52183fa20188c5a4acb9 (diff) | |
| download | AnySoftKeyboard-5bc94bab938bd90f9cc4e7c6f1cbc58f38504367.tar.gz AnySoftKeyboard-5bc94bab938bd90f9cc4e7c6f1cbc58f38504367.tar.bz2 | |
Merge pull request #2145 from menny/deploy-settings-fix
covid localized web-site support
Diffstat (limited to 'ime')
3 files changed, 13 insertions, 7 deletions
diff --git a/ime/app/src/main/java/com/anysoftkeyboard/saywhat/Notices.java b/ime/app/src/main/java/com/anysoftkeyboard/saywhat/Notices.java index 9bd670639..c6fc7b092 100644 --- a/ime/app/src/main/java/com/anysoftkeyboard/saywhat/Notices.java +++ b/ime/app/src/main/java/com/anysoftkeyboard/saywhat/Notices.java @@ -16,8 +16,8 @@ import java.util.Collections; import java.util.List; public class Notices { - public static List<PublicNotice> create() { - return Collections.singletonList(new CoronaVirusDetails()); + public static List<PublicNotice> create(Context context) { + return Collections.singletonList(new CoronaVirusDetails(context)); } private static class CoronaVirusDetails implements OnKey, OnVisible { @@ -25,9 +25,14 @@ public class Notices { static final char[] CORONAVIRUS = "coronavirus".toCharArray(); // two days static final long MIN_TIME_BETWEEN_SHOWING = 2 * 24 * 60 * 60 * 1000; + + private final KeyboardViewContainerView.StripActionProvider mVirusInfo; private int mWaitingForIndex = 0; private long mLastTimeInfoWasShown = -MIN_TIME_BETWEEN_SHOWING; - private KeyboardViewContainerView.StripActionProvider mVirusInfo = new CovidInfo(); + + private CoronaVirusDetails(Context context) { + mVirusInfo = new CovidInfo(context); + } @Override public void onKey(PublicNotices ime, int primaryCode, Keyboard.Key key) { @@ -82,12 +87,11 @@ public class Notices { () -> mRootView.findViewById(R.id.covid_info_text).setVisibility(View.GONE); private final Intent mCoronaVirusInfoWebPage; - private CovidInfo() { + private CovidInfo(Context context) { mCoronaVirusInfoWebPage = new Intent( Intent.ACTION_VIEW, - Uri.parse( - "https://www.who.int/emergencies/diseases/novel-coronavirus-2019/advice-for-public")); + Uri.parse(context.getString(R.string.codvid_info_url))); mCoronaVirusInfoWebPage.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } diff --git a/ime/app/src/main/java/com/anysoftkeyboard/saywhat/PublicNotices.java b/ime/app/src/main/java/com/anysoftkeyboard/saywhat/PublicNotices.java index 1387e3212..7a9238684 100644 --- a/ime/app/src/main/java/com/anysoftkeyboard/saywhat/PublicNotices.java +++ b/ime/app/src/main/java/com/anysoftkeyboard/saywhat/PublicNotices.java @@ -23,7 +23,7 @@ public abstract class PublicNotices extends AnySoftKeyboard { protected List<PublicNotice> generatePublicNotices() { List<PublicNotice> all = new ArrayList<>(EasterEggs.create()); - all.addAll(Notices.create()); + all.addAll(Notices.create(getApplicationContext())); return all; } diff --git a/ime/app/src/main/res/values/strings.xml b/ime/app/src/main/res/values/strings.xml index 8070ac26b..32629ede5 100644 --- a/ime/app/src/main/res/values/strings.xml +++ b/ime/app/src/main/res/values/strings.xml @@ -909,4 +909,6 @@ <string name="app_share_text">Let me recommend the open-source, privacy-focus, free, highly customizable, multi-language Android keyboard app AnySoftKeyboard.\nGet it from:\nPlay Store: https://play.google.com/store/apps/details?id=com.menny.android.anysoftkeyboard\nF-Droid: https://f-droid.org/en/packages/com.menny.android.anysoftkeyboard/</string> <string name="covid_19_click_for_info">Keep safe! Click for info on CoronaVirus.</string> <string name="click_me_for_easter_egg_info">click me for a surprise</string> + <!-- this URL should be localized - it should point to a web-site with information in the locale language. --> + <string name="codvid_info_url">https://www.who.int/emergencies/diseases/novel-coronavirus-2019/advice-for-public</string> </resources> |
