Skip to content

Commit be20d23

Browse files
committed
feat: better GitHub links, attempt to force activity chooser for opening links
1 parent a16a210 commit be20d23

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ android {
4141
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
4242
vectorDrawables.useSupportLibrary = true
4343
}
44+
applicationVariants.all { variant ->
45+
variant.resValue "string", "versionName", variant.versionName
46+
}
4447
buildTypes {
4548
release {
4649
minifyEnabled false

app/src/main/java/tech/akpmakes/android/taskkeeper/SettingsActivity.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,39 +107,36 @@ public boolean onPreferenceClick(Preference preference) {
107107
findPreference("social_discord").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
108108
@Override
109109
public boolean onPreferenceClick(Preference preference) {
110-
Intent i = new Intent(Intent.ACTION_VIEW);
111-
i.setData(Uri.parse(getString(R.string.social_discord_uri)));
112-
startActivity(i);
110+
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.social_discord_uri)));
111+
startActivity(Intent.createChooser(i, null));
113112
return true;
114113
}
115114
});
116115

117116
findPreference("social_github").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
118117
@Override
119118
public boolean onPreferenceClick(Preference preference) {
120-
Intent i = new Intent(Intent.ACTION_VIEW);
121-
i.setData(Uri.parse(getString(R.string.social_github_uri)));
122-
startActivity(i);
119+
Intent i = new Intent(Intent.ACTION_VIEW,
120+
Uri.parse(getString(R.string.social_github_uri, getString(R.string.versionName))));
121+
startActivity(Intent.createChooser(i, null));
123122
return true;
124123
}
125124
});
126125

127126
findPreference("privacy_policy").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
128127
@Override
129128
public boolean onPreferenceClick(Preference preference) {
130-
Intent i = new Intent(Intent.ACTION_VIEW);
131-
i.setData(Uri.parse(getString(R.string.privacy_policy_uri)));
132-
startActivity(i);
129+
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.privacy_policy_uri)));
130+
startActivity(Intent.createChooser(i, null));
133131
return true;
134132
}
135133
});
136134

137135
findPreference("more_info").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
138136
@Override
139137
public boolean onPreferenceClick(Preference preference) {
140-
Intent i = new Intent(Intent.ACTION_VIEW);
141-
i.setData(Uri.parse(getString(R.string.more_information_uri)));
142-
startActivity(i);
138+
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.more_information_uri)));
139+
startActivity(Intent.createChooser(i, null));
143140
return true;
144141
}
145142
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<string name="social_discord_uri">https://discord.gg/9GpztdT</string>
6666
<string name="social_github_title">GitHub</string>
6767
<string name="social_github_summary">When is Open Source! Check out the code on GitHub!</string>
68-
<string name="social_github_uri">https://github.com/WhenApp/WhenApp-Android</string>
68+
<string name="social_github_uri">https://github.com/WhenApp/WhenApp-Android/tree/%1$s</string>
6969
<string name="welcome_screen_title">Welcome screen</string>
7070
<string name="rate_title">Rate When</string>
7171
<string name="rate_summary"></string>

0 commit comments

Comments
 (0)