Add a Translate button to About

This commit is contained in:
Jakob Nixdorf 2017-08-09 10:45:30 +02:00
parent b29dd3fa38
commit e5128b9ccb
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC
4 changed files with 65 additions and 10 deletions

View file

@ -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

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF727272"
android:pathData="M12.87,15.07l-2.54,-2.51 0.03,-0.03c1.74,-1.94 2.98,-4.17 3.71,-6.53L17,6L17,4h-7L10,2L8,2v2L1,4v1.99h11.17C11.5,7.92 10.44,9.75 9,11.35 8.07,10.32 7.3,9.19 6.69,8h-2c0.73,1.63 1.73,3.17 2.98,4.56l-5.09,5.02L4,19l5,-5 3.11,3.11 0.76,-2.04zM18.5,10h-2L12,22h2l1.12,-3h4.75L21,22h2l-4.5,-12zM15.88,17l1.62,-4.33L19.12,17h-3.24z"/>
</vector>

View file

@ -461,6 +461,47 @@
</LinearLayout>
</LinearLayout>
<!-- translate -->
<LinearLayout
android:id="@+id/about_layout_translate"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="@dimen/activity_margin_small"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical" >
<ImageView
android:id="@+id/aboutImgTranslate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginEnd="@dimen/activity_margin_large"
android:src="@drawable/ic_translate_gray" />
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_label_translate"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/about_desc_translate"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>

View file

@ -30,6 +30,8 @@
<string name="about_title_support">Support development</string>
<string name="about_label_report_bugs">Report Bugs</string>
<string name="about_label_translate">Translate</string>
<string name="about_desc_report_bugs">Report bugs or request new features</string>
<string name="about_desc_translate">Help to translate andOTP to your language</string>
</resources>