[Android] Revert "remove dump_logcat (use log console instead)"
Edward Wang
git at videolan.org
Sat Feb 21 10:03:59 CET 2015
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Fri Feb 20 20:00:26 2015 -0800| [909cc74de2ef321fbc5e093c8e2361b58aa9aff8] | committer: Edward Wang
Revert "remove dump_logcat (use log console instead)"
This reverts commit f0ee101ba49e2810aa4017fb9ea1f273de7de283.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=909cc74de2ef321fbc5e093c8e2361b58aa9aff8
---
vlc-android/res/xml/preferences.xml | 7 ++++-
.../org/videolan/vlc/gui/PreferencesActivity.java | 32 ++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/vlc-android/res/xml/preferences.xml b/vlc-android/res/xml/preferences.xml
index 17c6310..4aec0ac 100644
--- a/vlc-android/res/xml/preferences.xml
+++ b/vlc-android/res/xml/preferences.xml
@@ -164,8 +164,13 @@
<PreferenceScreen
android:key="debug_logs"
android:title="@string/debug_logs" />
+
+ <Preference
+ android:enabled="true"
+ android:key="dump_logcat"
+ android:title="@string/dump_logcat" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>
-</PreferenceScreen>
+</PreferenceScreen>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
index c21627d..d200b74 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PreferencesActivity.java
@@ -204,6 +204,38 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
}
});
+ Preference dumpLogcatLog = findPreference("dump_logcat");
+ dumpLogcatLog.setOnPreferenceClickListener(
+ new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ Toast.makeText(PreferencesActivity.this,
+ R.string.dump_logcat_failure,
+ Toast.LENGTH_LONG).show();
+ return true;
+ }
+
+ CharSequence timestamp = DateFormat.format(
+ "yyyyMMdd_kkmmss", System.currentTimeMillis());
+ String filename = Environment.getExternalStorageDirectory().getPath() + "/vlc_logcat_" + timestamp + ".log";
+ try {
+ Logcat.writeLogcat(filename);
+ Toast.makeText(
+ PreferencesActivity.this,
+ String.format(
+ VLCApplication.getAppResources().getString(R.string.dump_logcat_success),
+ filename), Toast.LENGTH_LONG)
+ .show();
+ } catch (Exception e) {
+ Toast.makeText(PreferencesActivity.this,
+ R.string.dump_logcat_failure,
+ Toast.LENGTH_LONG).show();
+ }
+ return true;
+ }
+ });
+
// Audio output
ListPreference aoutPref = (ListPreference) findPreference("aout");
if (LibVlcUtil.isGingerbreadOrLater()) {
More information about the Android
mailing list