Add a button in about to install mozc

Julien LepillerSat Jun 06 18:23:10+0200 2020

61d8d17

Add a button in about to install mozc

app/src/main/java/eu/lepiller/nani/AboutActivity.java

1616
1717
        Button sources_button = findViewById(R.id.sources_button);
1818
        Button report_button = findViewById(R.id.report_button);
19+
        Button mozc_button = findViewById(R.id.mozc_button);
1920
2021
        sources_button.setOnClickListener(new View.OnClickListener() {
2122
            @Override

3233
                startActivity(browserIntent);
3334
            }
3435
        });
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+
        });
3548
    }
3649
}

app/src/main/res/layout/activity_about.xml

8484
            android:text="@string/about_recommend"
8585
            app:lineHeight="22dp" />
8686
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+
8798
        <TextView
8899
            android:id="@+id/textView2"
89100
            android:layout_width="wrap_content"

app/src/main/res/values-fr/strings.xml

8383
    </string>
8484
    <string name="report">Rapporter un bogue</string>
8585
    <string name="view_source">Voir les sources</string>
86+
    <string name="install_mozc">Installer mozc</string>
8687
    <string name="license">Licence</string>
8788
    <string name="license_text">Nani? est un logiciel libre ; vous pouvez le redistribuer ou le
8889
        modifier suivant les termes de la GNU General Public License telle que publi??e par la

app/src/main/res/values/strings.xml

8383
    </string>
8484
    <string name="report">Report a bug</string>
8585
    <string name="view_source">View sources</string>
86+
    <string name="install_mozc">Install mozc</string>
8687
    <string name="license">License</string>
8788
    <string name="license_text">Nani? is free software: you can redistribute it and/or modify
8889
        it under the terms of the GNU General Public License as