From e5128b9ccb5492df55a7cf0578710542ae04b8e9 Mon Sep 17 00:00:00 2001 From: Jakob Nixdorf Date: Wed, 9 Aug 2017 10:45:30 +0200 Subject: [PATCH] Add a Translate button to About --- .../flocke/andotp/AboutActivity.java | 23 ++++++----- .../main/res/drawable/ic_translate_gray.xml | 9 ++++ app/src/main/res/layout/content_about.xml | 41 +++++++++++++++++++ app/src/main/res/values/strings_about.xml | 2 + 4 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 app/src/main/res/drawable/ic_translate_gray.xml diff --git a/app/src/main/java/org/shadowice/flocke/andotp/AboutActivity.java b/app/src/main/java/org/shadowice/flocke/andotp/AboutActivity.java index bf5d0b69..5dbdd53e 100644 --- a/app/src/main/java/org/shadowice/flocke/andotp/AboutActivity.java +++ b/app/src/main/java/org/shadowice/flocke/andotp/AboutActivity.java @@ -49,10 +49,12 @@ public class AboutActivity extends BaseActivity { private static final String AUTHOR2_APP = AUTHOR2_GITHUB + "/otp-authenticator"; private static final String BUGREPORT_URI = GITHUB_URI + "/issues"; + private static final String TRANSLATE_URI = "https://crowdin.com/project/andotp"; int[] imageResources = { R.id.aboutImgVersion, R.id.aboutImgLicense, R.id.aboutImgChangelog, R.id.aboutImgSource, - R.id.aboutImgOpenSource, R.id.aboutImgAuthor1, R.id.aboutImgAuthor2, R.id.aboutImgBugs + R.id.aboutImgOpenSource, R.id.aboutImgAuthor1, R.id.aboutImgAuthor2, R.id.aboutImgBugs, + R.id.aboutImgTranslate }; @Override @@ -87,30 +89,27 @@ public class AboutActivity extends BaseActivity { version.setText(versionName); LinearLayout license = (LinearLayout) v.findViewById(R.id.about_layout_license); + LinearLayout changelog = (LinearLayout) v.findViewById(R.id.about_layout_changelog); + LinearLayout source = (LinearLayout) v.findViewById(R.id.about_layout_source); + LinearLayout licenses = (LinearLayout) v.findViewById(R.id.about_layout_licenses); license.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openURI(MIT_URI); } }); - - LinearLayout changelog = (LinearLayout) v.findViewById(R.id.about_layout_changelog); changelog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openURI(CHANGELOG_URI); } }); - - LinearLayout source = (LinearLayout) v.findViewById(R.id.about_layout_source); source.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openURI(GITHUB_URI); } }); - - LinearLayout licenses = (LinearLayout) v.findViewById(R.id.about_layout_licenses); licenses.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -120,7 +119,6 @@ public class AboutActivity extends BaseActivity { TextView author1GitHub = (TextView) v.findViewById(R.id.about_author1_github); TextView author1Paypal = (TextView) v.findViewById(R.id.about_author1_paypal); - author1GitHub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -136,14 +134,12 @@ public class AboutActivity extends BaseActivity { TextView author2GitHub = (TextView) v.findViewById(R.id.about_author2_github); TextView author2App = (TextView) v.findViewById(R.id.about_author2_app); - author2GitHub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openURI(AUTHOR2_GITHUB); } }); - author2App.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -152,12 +148,19 @@ public class AboutActivity extends BaseActivity { }); LinearLayout bugReport = (LinearLayout) v.findViewById(R.id.about_layout_bugs); + LinearLayout translate = (LinearLayout) v.findViewById(R.id.about_layout_translate); bugReport.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openURI(BUGREPORT_URI); } }); + translate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + openURI(TRANSLATE_URI); + } + }); } // Go back to the main activity diff --git a/app/src/main/res/drawable/ic_translate_gray.xml b/app/src/main/res/drawable/ic_translate_gray.xml new file mode 100644 index 00000000..22c74ae8 --- /dev/null +++ b/app/src/main/res/drawable/ic_translate_gray.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/content_about.xml b/app/src/main/res/layout/content_about.xml index e677439b..42e3a085 100644 --- a/app/src/main/res/layout/content_about.xml +++ b/app/src/main/res/layout/content_about.xml @@ -461,6 +461,47 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings_about.xml b/app/src/main/res/values/strings_about.xml index 90d80d7c..3fef21fd 100644 --- a/app/src/main/res/values/strings_about.xml +++ b/app/src/main/res/values/strings_about.xml @@ -30,6 +30,8 @@ Support development Report Bugs + Translate Report bugs or request new features + Help to translate andOTP to your language \ No newline at end of file