[Android] Allow CompatErrorActivity to show runtime errors

Edward Wang git at videolan.org
Mon Aug 13 02:33:52 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Aug 12 20:33:26 2012 -0400| [203034012369aaf59bd89d7b4634cdc36fd87ab4] | committer: Edward Wang

Allow CompatErrorActivity to show runtime errors

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=203034012369aaf59bd89d7b4634cdc36fd87ab4
---

 vlc-android/res/layout/not_compatible.xml            |   12 +++++++++++-
 vlc-android/res/values/strings.xml                   |    4 +++-
 .../org/videolan/vlc/gui/CompatErrorActivity.java    |   18 +++++++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/layout/not_compatible.xml b/vlc-android/res/layout/not_compatible.xml
index 4a89dd9..087fc8b 100644
--- a/vlc-android/res/layout/not_compatible.xml
+++ b/vlc-android/res/layout/not_compatible.xml
@@ -19,13 +19,23 @@
 	        android:src="@drawable/cone" />
 
 	    <TextView
-	        android:id="@+id/errormsg"
+	        android:id="@+id/message"
 	        android:layout_width="wrap_content"
 	        android:layout_height="wrap_content"
 	        android:layout_gravity="center_horizontal"
 	        android:text="@string/error_not_compatible"
 	        android:textColor="#FF0000"
 	        android:textSize="20dp" />
+
+	    <TextView
+	        android:id="@+id/errormsg"
+	        android:layout_marginTop="26dp"
+	        android:layout_width="wrap_content"
+	        android:layout_height="wrap_content"
+	        android:layout_gravity="center_horizontal"
+	        android:text="@string/error_message_is"
+	        android:textColor="#FF0000"
+	        android:textSize="20dp" />
 	</LinearLayout>
 
 </ScrollView>
\ No newline at end of file
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 93088cc..cbfa677 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -94,7 +94,9 @@
     <string name="open_mrl_dialog_title">Open network stream</string>
     <string name="open_mrl_dialog_msg">Enter network MRL: e.g. http://, mms:// or rtsp://</string>
     <string name="media_library">Media library</string>
-    <string name="error_not_compatible">Sorry, but your device is currently not supported by this version of VLC for Android™.\n\nThe error message is (please mention this when debugging):\n</string>
+    <string name="error_not_compatible">Sorry, your device is currently not supported by this version of VLC for Android™.</string>
+    <string name="error_problem">Sorry, VLC for Android had a problem loading and had to close.</string>
+    <string name="error_message_is">The error message is (please mention this when debugging):\n</string>
     <string name="playback_speed">Playback speed</string>
     <string name="time_0" translatable="false">0:00</string>
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/CompatErrorActivity.java b/vlc-android/src/org/videolan/vlc/gui/CompatErrorActivity.java
index 250eaf4..334b4d6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/CompatErrorActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/CompatErrorActivity.java
@@ -24,12 +24,28 @@ import android.widget.TextView;
 public class CompatErrorActivity extends Activity {
     public final static String TAG = "VLC/CompatErrorActivity";
 
+    /**
+     * Simple friendly activity to tell the user something's wrong.
+     *
+     * Intent parameters (all optional):
+     * runtimeError (bool) - Set to true if you want to show a runtime error
+     *                       (defaults to a compatibility error)
+     * message (string) - the more detailed problem
+     */
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         setContentView(R.layout.not_compatible);
 
+        String errorMsg = Util.getErrorMsg();
+        if(getIntent().getBooleanExtra("runtimeError", false))
+            if(getIntent().getStringExtra("message") != null) {
+                errorMsg = getIntent().getStringExtra("message");
+                TextView tvo = (TextView)findViewById(R.id.message);
+                tvo.setText(R.string.error_problem);
+            }
+
         TextView tv = (TextView)findViewById(R.id.errormsg);
-        tv.setText(getResources().getString(R.string.error_not_compatible) + "\n" + Util.getErrorMsg());
+        tv.setText(getResources().getString(R.string.error_message_is) + "\n" + errorMsg);
 
         super.onCreate(savedInstanceState);
 



More information about the Android mailing list