Skip to content
This repository has been archived by the owner on Jul 16, 2018. It is now read-only.

Commit

Permalink
Show build status
Browse files Browse the repository at this point in the history
  • Loading branch information
princeofpensia committed Jan 30, 2017
1 parent f39d2ee commit 936f2a9
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.x1unix.avi"
minSdkVersion 14
targetSdkVersion 24
versionCode 20170128
versionName "1.6.1"
versionCode 20170130
versionName "1.7.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/com/x1unix/avi/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
Expand Down Expand Up @@ -36,12 +37,16 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
private String propAllowUnstable;
private SharedPreferences preferences;

private Resources res;

private final String APP_URL = "http://avi-app.x1unix.com";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

res = getResources();

propIsAdEnabledKey = getResources().getString(R.string.avi_prop_no_ads);
propIsAutoupdateKey = getResources().getString(R.string.avi_prop_autocheck_updates);
propUpdateNow = getResources().getString(R.string.prop_btn_update_now);
Expand All @@ -53,7 +58,16 @@ protected void onCreate(Bundle savedInstanceState) {

addPreferencesFromResource(R.xml.pref_main);

((Preference) findPreference("avi_app_version")).setSummary(BuildConfig.VERSION_NAME);
boolean isPreview = res.getBoolean(R.bool.isPreviewVersion);
String currentVersion = BuildConfig.VERSION_NAME;

if (isPreview) {
currentVersion += " - " + res.getString(R.string.preview_version);
}

((Preference) findPreference("avi_app_version")).setSummary(currentVersion);
((Preference) findPreference("avi_app_build")).setSummary(String.valueOf(BuildConfig.VERSION_CODE));

registerPropsEventHandlers();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ public void onClick(View v) {

initProgressBar();
initWebView();

if (!updatePkg.isStable()) {
final String betaTitle = res.getString(R.string.app_name) +
" (" + res.getString(R.string.preview_version) + ")";

((TextView) findViewById(R.id.avi_update_title)).setText(betaTitle);
}
}

private void setDownloadProgress(int progress) {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@
<string name="failed_to_download_update">Не удалось загрузить обновление:\n</string>
<string name="no_permissions">Нету прав чтения/записи для папки загрузки</string>
<string name="install">Установить</string>
<string name="preview_version">Предварительная сборка</string>
<string name="build_number">Номер сборки</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@
<string name="failed_to_download_update">Не вдалося завантажити оновлення:\n</string>
<string name="no_permissions">Нема прав читання / запису для папки завантаження</string>
<string name="install">Встановити</string>
<string name="preview_version">Попередня збірка</string>
<string name="build_number">Номер Збірки</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/props.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<resources>
<bool name="isTablet">false</bool>
<integer name="colsCount">1</integer>
<bool name="isPreviewVersion">true</bool>

</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
<string name="failed_to_download_update">Failed to download update:\n</string>
<string name="no_permissions">No permissions to read/write for download directory</string>
<string name="install">Install</string>
<string name="preview_version">Preview version</string>
<string name="build_number">Build Number</string>

<string name="avi_app_author" translatable="false">\@x1unix, 2017</string>

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml-v14/pref_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
android:title="@string/pref_app_version"
android:summary="">
</Preference>
<Preference
android:key="avi_app_build"
android:title="@string/build_number"
android:summary="">
</Preference>
<Preference
android:key="avi_author"
android:title="@string/pref_app_author"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/pref_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
android:title="@string/pref_app_version"
android:summary="">
</Preference>
<Preference
android:key="avi_app_build"
android:title="@string/build_number"
android:summary="">
</Preference>
<Preference
android:key="avi_author"
android:title="@string/pref_app_author"
Expand Down

0 comments on commit 936f2a9

Please sign in to comment.