Permalink
Browse files

bug 3 part 2 fix: app crashes if yut confess during loading + line 52…

… workaround
  • Loading branch information...
voidcode committed Dec 3, 2011
1 parent 86c7aa8 commit 87967a3654643ab08b1000e8f158c0cacee2541c
View
@@ -16,23 +16,27 @@
<activity
android:theme="@android:style/Theme.NoTitleBar"
android:label="@string/app_name"
- android:name=".MainActivity">
+ android:name=".MainActivity"
+ android:configChanges="orientation">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:theme="@android:style/Theme.NoTitleBar"
- android:name=".ShareActivity">
+ android:name=".ShareActivity"
+ android:configChanges="orientation">
</activity>
<activity
android:theme="@android:style/Theme.NoTitleBar"
- android:name=".SettingsActivity">
+ android:name=".SettingsActivity"
+ android:configChanges="orientation">
</activity>
<activity
android:theme="@android:style/Theme.NoTitleBar"
- android:name=".SetupInternetActivity">
+ android:name=".SetupInternetActivity"
+ android:configChanges="orientation">
</activity>
<receiver android:name=".WidgetActivity" android:label="Diaspora-Webclient">
<intent-filter>
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
@@ -11,7 +11,7 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.graphics.Color;
+import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
@@ -99,7 +99,14 @@ public void onClick(DialogInterface dialog, int whichButton) {
});
alert.show();
}
- public void startDiasporaBrowser(String uri)
+ //Screen orientation crashes app fix
+ //http://jamesgiang.wordpress.com/2010/06/05/screen-orientation-crashes-my-app/
+ @Override
+ public void onConfigurationChanged(Configuration newConfig)
+ {
+ super.onConfigurationChanged(newConfig);
+ }
+ public void startDiasporaBrowser(String uri)
{
mWeb = (WebView) findViewById(R.id.webView_main);
@@ -143,27 +150,6 @@ public boolean shouldOverrideUrlLoading(WebView view, String url)
}
// when finish loading page
public void onPageFinished(WebView view, String url) {
-
- // add text-translate to all posts.
- // mWeb.loadUrl("javascript:" +
- //get all p tags
- // "var p=document.getElementsByTagName('info');" +
- // "function googleSectionalElementInit() {"+
- // "new google.translate.SectionalElement({"+
- // "sectionalNodeClassName: 'p',"+
- // "controlNodeClassName: 'goog-trans-control',"+
- // "background: '#ffffff'"+
- // "}, 'google_sectional_element');}"+
-
-//<script src="//translate.google.com/translate_a/element.js?cb=googleSectionalElementInit&ug=section&hl=da"></script>"+
-
-
-
- //lool: add ids to p tags
- // "var i=0; for (i=0;i<=p.length;i++){ p.item(i).id='tttID'+i; p.item(i).innerHTML += p.item(i).innerHTML +' Translate'; } ");
-
-
- //"var i=0; for (i=0;i<=info.length;i++){ p.item(i).id='tttID'+i; }");
if(mProgress.isShowing()) {
mProgress.dismiss();
}
@@ -202,7 +188,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.mainmenu_settings:
this.finish();
startActivity(new Intent(this, SettingsActivity.class));
- //startActivityForResult(new Intent(this, SettingsActivity.class), 100);
return true;
case R.id.mainmenu_exit:
this.finish();
@@ -6,7 +6,9 @@
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.os.Bundle;
+import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@@ -38,12 +40,13 @@ public void onCreate(Bundle savedInstanceState) {
//Fill listview with pods
fillListview();
}
+ //Screen orientation crashes app fix
+ //http://jamesgiang.wordpress.com/2010/06/05/screen-orientation-crashes-my-app/
@Override
- public void onPause()
+ public void onConfigurationChanged(Configuration newConfig)
{
- super.onPause();
- this.finish();
- }
+ super.onConfigurationChanged(newConfig);
+ }
public void fillListview()
{
lvPods = (ListView) findViewById(R.id.listView_poduptime);
@@ -55,6 +58,20 @@ public void onItemClick(AdapterView<?> a, View v, int position, long id) {
}
});
}
+ // Handle the Back button in WebView, to back in history.
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent msg){
+ if((keyCode == KeyEvent.KEYCODE_BACK))
+ {
+ this.finish();
+ startActivity(new Intent(this, MainActivity.class));
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
public void Onclick_SaveSettings(View v) throws IOException
{
//get userinput
@@ -67,9 +84,7 @@ public void Onclick_SaveSettings(View v) throws IOException
editor.putString("currentpod", new_currentpod);
editor.commit();
this.finish();
- // to reload webview with the new pod
startActivity(new Intent(this, MainActivity.class));
-
Toast.makeText(getApplicationContext(), "Pod: "+new_currentpod, Toast.LENGTH_LONG).show();
}
}
@@ -1,6 +1,7 @@
package com.voidcode.diasporawebclient;
import android.app.Activity;
+import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
@@ -14,5 +15,11 @@ public void onclick_button_close(View v)
{
this.finish();
}
-
+ //Screen orientation crashes app fix
+ //http://jamesgiang.wordpress.com/2010/06/05/screen-orientation-crashes-my-app/
+ @Override
+ public void onConfigurationChanged(Configuration newConfig)
+ {
+ super.onConfigurationChanged(newConfig);
+ }
}
@@ -1,5 +1,6 @@
package com.voidcode.diasporawebclient;
+import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
@@ -23,4 +24,11 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.setupinternet);
}
}
+ //Screen orientation crashes app fix
+ //http://jamesgiang.wordpress.com/2010/06/05/screen-orientation-crashes-my-app/
+ @Override
+ public void onConfigurationChanged(Configuration newConfig)
+ {
+ super.onConfigurationChanged(newConfig);
+ }
}

0 comments on commit 87967a3

Please sign in to comment.