diff options
Diffstat (limited to 'org.fox.ttrss/src/main')
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/PreferencesActivity.java | 38 | ||||
-rw-r--r-- | org.fox.ttrss/src/main/res/values/strings.xml | 3 | ||||
-rw-r--r-- | org.fox.ttrss/src/main/res/xml/preferences.xml | 6 |
3 files changed, 34 insertions, 13 deletions
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 @@ <string name="headline_display_mode_default">Default</string> <string name="headline_display_mode_no_images">No images</string> <string name="headline_display_mode_compact">Compact</string> - <string name="version">Version: %1$s (%2$d)</string> + <string name="prefs_version">Version: %1$s (%2$d)</string> + <string name="prefs_build_timestamp">Build timestamp: %1$s</string> <string name="crash_dialog_text">Unfortunately, Tiny Tiny RSS has stopped. Submit crash report to tt-rss.org?</string> </resources> 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 @@ <Preference android:key="version" android:enabled="false" - android:title="@string/version" /> + android:title="@string/prefs_version" /> + <Preference + android:key="build_timestamp" + android:enabled="false" + android:title="@string/prefs_build_timestamp" /> </PreferenceScreen> |