Add a button in about to install mozc
app/src/main/java/eu/lepiller/nani/AboutActivity.java
16 | 16 | ||
17 | 17 | Button sources_button = findViewById(R.id.sources_button); | |
18 | 18 | Button report_button = findViewById(R.id.report_button); | |
19 | + | Button mozc_button = findViewById(R.id.mozc_button); | |
19 | 20 | ||
20 | 21 | sources_button.setOnClickListener(new View.OnClickListener() { | |
21 | 22 | @Override | |
… | |||
32 | 33 | startActivity(browserIntent); | |
33 | 34 | } | |
34 | 35 | }); | |
36 | + | ||
37 | + | mozc_button.setOnClickListener(new View.OnClickListener() { | |
38 | + | @Override | |
39 | + | public void onClick(View v) { | |
40 | + | String appPackageName = "org.mozc.android.inputmethod.japanese"; | |
41 | + | try { | |
42 | + | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); | |
43 | + | } catch (android.content.ActivityNotFoundException anfe) { | |
44 | + | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName))); | |
45 | + | } | |
46 | + | } | |
47 | + | }); | |
35 | 48 | } | |
36 | 49 | } |
app/src/main/res/layout/activity_about.xml
84 | 84 | android:text="@string/about_recommend" | |
85 | 85 | app:lineHeight="22dp" /> | |
86 | 86 | ||
87 | + | <Button | |
88 | + | android:layout_width="wrap_content" | |
89 | + | android:layout_height="wrap_content" | |
90 | + | android:layout_gravity="center_horizontal" | |
91 | + | android:text="@string/install_mozc" | |
92 | + | android:id="@+id/mozc_button" | |
93 | + | android:padding="8dp" | |
94 | + | android:layout_marginTop="8dp" | |
95 | + | android:background="@color/colorPrimaryDark" | |
96 | + | android:textColor="@color/colorGrey" /> | |
97 | + | ||
87 | 98 | <TextView | |
88 | 99 | android:id="@+id/textView2" | |
89 | 100 | android:layout_width="wrap_content" |
app/src/main/res/values-fr/strings.xml
83 | 83 | </string> | |
84 | 84 | <string name="report">Rapporter un bogue</string> | |
85 | 85 | <string name="view_source">Voir les sources</string> | |
86 | + | <string name="install_mozc">Installer mozc</string> | |
86 | 87 | <string name="license">Licence</string> | |
87 | 88 | <string name="license_text">Nani? est un logiciel libre ; vous pouvez le redistribuer ou le | |
88 | 89 | modifier suivant les termes de la GNU General Public License telle que publi??e par la |
app/src/main/res/values/strings.xml
83 | 83 | </string> | |
84 | 84 | <string name="report">Report a bug</string> | |
85 | 85 | <string name="view_source">View sources</string> | |
86 | + | <string name="install_mozc">Install mozc</string> | |
86 | 87 | <string name="license">License</string> | |
87 | 88 | <string name="license_text">Nani? is free software: you can redistribute it and/or modify | |
88 | 89 | it under the terms of the GNU General Public License as |