Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

… workaround
  • Loading branch information...
commit 87967a3654643ab08b1000e8f158c0cacee2541c 1 parent 86c7aa8
Terkel Sørensen authored
12 AndroidManifest.xml
View
@@ -16,7 +16,8 @@
<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" />
@@ -24,15 +25,18 @@
</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>
BIN  bin/classes.dex
View
Binary file not shown
BIN  bin/classes/com/voidcode/diasporawebclient/MainActivity$3.class
View
Binary file not shown
BIN  bin/classes/com/voidcode/diasporawebclient/MainActivity.class
View
Binary file not shown
BIN  bin/classes/com/voidcode/diasporawebclient/SettingsActivity$1.class
View
Binary file not shown
BIN  bin/classes/com/voidcode/diasporawebclient/SettingsActivity.class
View
Binary file not shown
BIN  bin/classes/com/voidcode/diasporawebclient/SetupInternetActivity.class
View
Binary file not shown
BIN  bin/classes/com/voidcode/diasporawebclient/ShareActivity.class
View
Binary file not shown
BIN  bin/diasporawebclient.apk
View
Binary file not shown
BIN  bin/resources.ap_
View
Binary file not shown
BIN  proment/comment_on_a_post.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  proment/findtag.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  proment/home_stream.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  proment/logo512x512.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  proment/settings.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  proment/widget.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  proment/widget.psd
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 src/com/voidcode/diasporawebclient/MainActivity.java
View
@@ -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();
27 src/com/voidcode/diasporawebclient/SettingsActivity.java
View
@@ -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();
}
}
9 src/com/voidcode/diasporawebclient/SetupInternetActivity.java
View
@@ -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);
+ }
}
8 src/com/voidcode/diasporawebclient/ShareActivity.java
View
@@ -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);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.