diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java index 09a514f4..a9859d42 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java @@ -1,11 +1,17 @@ package org.fox.ttrss; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Bundle; -import android.preference.Preference; import android.preference.PreferenceActivity; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Locale; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + public class PreferencesActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceState) { @@ -13,29 +19,39 @@ public class PreferencesActivity extends PreferenceActivity { addPreferencesFromResource(R.xml.preferences); - boolean compatMode = android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB; - - if (compatMode) { - findPreference("webview_hardware_accel").setEnabled(false); - } - if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { findPreference("enable_condensed_fonts").setEnabled(false); } - Preference versionPref = (Preference)findPreference("version"); - String version = null; + String version = "?"; int versionCode = -1; + String buildTimestamp = "N/A"; + try { - PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); + PackageInfo packageInfo = getPackageManager(). + getPackageInfo(getPackageName(), 0); version = packageInfo.versionName; versionCode = packageInfo.versionCode; + ApplicationInfo appInfo = getPackageManager(). + getApplicationInfo(getPackageName(), 0); + + ZipFile zf = new ZipFile(appInfo.sourceDir); + ZipEntry ze = zf.getEntry("classes.dex"); + long time = ze.getTime(); + + buildTimestamp = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss", + Locale.getDefault()).format(time); + } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } - versionPref.setTitle(getString(R.string.version, version, versionCode)); + + findPreference("version").setTitle(getString(R.string.prefs_version, version, versionCode)); + findPreference("build_timestamp").setTitle(getString(R.string.prefs_build_timestamp, buildTimestamp)); } } diff --git a/org.fox.ttrss/src/main/res/values/strings.xml b/org.fox.ttrss/src/main/res/values/strings.xml index c5439d90..5ebedeb3 100644 --- a/org.fox.ttrss/src/main/res/values/strings.xml +++ b/org.fox.ttrss/src/main/res/values/strings.xml @@ -263,6 +263,7 @@ Default No images Compact - Version: %1$s (%2$d) + Version: %1$s (%2$d) + Build timestamp: %1$s Unfortunately, Tiny Tiny RSS has stopped. Submit crash report to tt-rss.org? diff --git a/org.fox.ttrss/src/main/res/xml/preferences.xml b/org.fox.ttrss/src/main/res/xml/preferences.xml index dc9216f9..290a08e2 100644 --- a/org.fox.ttrss/src/main/res/xml/preferences.xml +++ b/org.fox.ttrss/src/main/res/xml/preferences.xml @@ -192,6 +192,10 @@ + android:title="@string/prefs_version" /> +