diff --git a/app/src/main/java/net/harimurti/tv/MainActivity.java b/app/src/main/java/net/harimurti/tv/MainActivity.java
index ade747b..8c4ea0f 100644
--- a/app/src/main/java/net/harimurti/tv/MainActivity.java
+++ b/app/src/main/java/net/harimurti/tv/MainActivity.java
@@ -147,7 +147,8 @@ public void afterTextChanged(Editable s) {
}
// get contributors
- if (preferences.getLastVersionCode() != BuildConfig.VERSION_CODE) {
+ if (preferences.getLastVersionCode() != BuildConfig.VERSION_CODE || !preferences.isShowLessContributors()) {
+ preferences.setLastVersionCode(BuildConfig.VERSION_CODE);
getContributors();
}
@@ -187,7 +188,6 @@ private void checkNewRelease() {
}
private void getContributors() {
- if (preferences.getLastVersionCode() == BuildConfig.VERSION_CODE) return;
StringRequest stringRequest = new StringRequest(Request.Method.GET,
getString(R.string.gh_contributors),
response -> {
@@ -195,10 +195,12 @@ private void getContributors() {
GithubUser[] users = new Gson().fromJson(response, GithubUser[].class);
StringBuilder message = new StringBuilder(getString(R.string.message_thanks_to));
for (GithubUser user : users) {
- message.append(getString(R.string.message_user_icon)).append(user.login)
- .append(" (").append(user.contributions).append(")");
+ message.append(user.login).append(", ");
+ }
+ if (preferences.getTotalContributors() < users.length && 0 < users.length) {
+ preferences.setTotalContributors(users.length);
+ showAlertContributors(message.substring(0, message.length() - 2));
}
- showAlertContributors(message.toString());
} catch (Exception e) { Log.e("Volley", "Could not get contributors!", e); }
}, null);
volley.getCache().clear();
@@ -265,7 +267,7 @@ private void showAlertLocalError() {
.setMessage(R.string.local_playlist_read_error)
.setCancelable(false)
.setPositiveButton(R.string.dialog_retry, (dialog, id) -> updatePlaylist())
- .setNegativeButton("Use Default", (dialog, id) -> {
+ .setNegativeButton(getString(R.string.dialog_default), (dialog, id) -> {
preferences.setUseCustomPlaylist(false);
swCustomPlaylist.setChecked(false);
layoutCustom.setVisibility(View.GONE);
@@ -303,10 +305,13 @@ private void showAlertContributors(String message) {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(R.string.alert_title_contributors)
.setMessage(message)
- .setPositiveButton(android.R.string.ok, (dialog, id) -> preferences.setLastVersionCode(BuildConfig.VERSION_CODE))
+ .setNeutralButton(R.string.dialog_telegram, (dialog, id) -> openWebsite(getString(R.string.telegram_group)))
.setNegativeButton(R.string.dialog_website, (dialog, id) -> openWebsite(getString(R.string.website)))
- .setNeutralButton(R.string.dialog_join_group, (dialog, id) -> openWebsite(getString(R.string.dialog_join_group)));
- alert.create().show();
+ .setPositiveButton(preferences.isShowLessContributors() ? R.string.dialog_close : R.string.dialog_show_less,
+ (dialog, id) -> preferences.setShowLessContributors());
+ AlertDialog dialog = alert.create();
+ dialog.show();
+ new Handler(Looper.getMainLooper()).postDelayed(dialog::dismiss, 10000);
}
private void openWebsite(String link) {
diff --git a/app/src/main/java/net/harimurti/tv/extra/Preferences.java b/app/src/main/java/net/harimurti/tv/extra/Preferences.java
index 82c30ff..2cbd3e9 100644
--- a/app/src/main/java/net/harimurti/tv/extra/Preferences.java
+++ b/app/src/main/java/net/harimurti/tv/extra/Preferences.java
@@ -15,6 +15,8 @@ public class Preferences {
private static final String USE_CUSTOM_PLAYLIST = "USE_CUSTOM_PLAYLIST";
private static final String PLAYLIST_EXTERNAL = "PLAYLIST_EXTERNAL";
private static final String LAST_VERSIONCODE = "LAST_VERSIONCODE";
+ private static final String TOTAL_CONTRIBUTORS = "TOTAL_CONTRIBUTORS";
+ private static final String SHOW_LESS_CONTRIBUTORS = "SHOW_LESS_CONTRIBUTORS";
private final SharedPreferences preferences;
private SharedPreferences.Editor editor;
@@ -103,10 +105,31 @@ public String getPlaylistExternal() {
public void setLastVersionCode(int value) {
editor = preferences.edit();
editor.putInt(LAST_VERSIONCODE, value);
+ editor.putInt(TOTAL_CONTRIBUTORS, 0);
editor.apply();
}
public int getLastVersionCode() {
return preferences.getInt(LAST_VERSIONCODE, 0);
}
+
+ public void setShowLessContributors() {
+ editor = preferences.edit();
+ editor.putBoolean(SHOW_LESS_CONTRIBUTORS, true);
+ editor.apply();
+ }
+
+ public boolean isShowLessContributors() {
+ return preferences.getBoolean(SHOW_LESS_CONTRIBUTORS, false);
+ }
+
+ public void setTotalContributors(int value) {
+ editor = preferences.edit();
+ editor.putInt(TOTAL_CONTRIBUTORS, value);
+ editor.apply();
+ }
+
+ public int getTotalContributors() {
+ return preferences.getInt(TOTAL_CONTRIBUTORS, 0);
+ }
}
diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml
index e258b0c..d9352cf 100644
--- a/app/src/main/res/values-in/strings.xml
+++ b/app/src/main/res/values-in/strings.xml
@@ -32,8 +32,9 @@
Penyumbang
- Gabung Grup
- Terimakasih kepada :
+ Kurangi Penampilan
+ Tutup
+ Terima kasih banyak kepada semua orang yang terlibat dalam proyek ini!\n\nTerutama orang-orang ini di github :\n
Pengaturan
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fb18fbb..9bb1d0e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -44,9 +44,10 @@
Contributors
Website
- Join Group
- Thanks to :
- \n👤
+ Telegram
+ Show Less
+ Close
+ Many thanks to everyone involved in this project!\n\nEspecially these guys on github :\n
Settings