Fixed the loginpage and actfmaloginactivity for landscape

pull/14/head
Arne Jans 13 years ago
parent 75ad7c4e78
commit 45635f22ec

@ -168,6 +168,26 @@ public class DialogUtilities {
});
}
/** Run runnable with progress dialog */
public static ProgressDialog runWithProgressDialog(final Activity activity, final Runnable runnable) {
final ProgressDialog progressdiag = progressDialog(activity, activity.getString(R.string.DLG_wait));
new Thread(new Runnable() {
@Override
public void run() {
try {
runnable.run();
} catch (Exception e) {
DialogUtilities.okDialog(activity,
activity.getString(R.string.DLG_error, e.toString()), null);
} finally {
DialogUtilities.dismissDialog(activity, progressdiag);
}
}
}).start();
return progressdiag;
}
/**
* Displays a progress dialog. Must be run on the UI thread
* @param context

@ -301,8 +301,7 @@
<!-- actfm -->
<activity android:name="com.todoroo.astrid.actfm.ActFmLoginActivity"
android:configChanges="keyboardHidden"
android:screenOrientation="portrait"/>
android:configChanges="keyboardHidden"/>
<activity android:name="com.todoroo.astrid.actfm.OAuthLoginActivity" />
<activity android:name="com.todoroo.astrid.actfm.ActFmPreferences"
android:theme="@android:style/Theme"

@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicReference;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
@ -40,6 +39,7 @@ import android.content.res.Configuration;
import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.InputType;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
@ -84,7 +84,7 @@ import com.todoroo.astrid.service.TaskService;
* @author arne.jans
*
*/
public class ActFmLoginActivity extends Activity implements AuthListener {
public class ActFmLoginActivity extends FragmentActivity implements AuthListener {
public static final String APP_ID = "183862944961271"; //$NON-NLS-1$
@ -138,6 +138,8 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
setContentView(getContentViewResource());
setTitle(getTitleResource());
getSupportActionBar().hide();
rand = new Random(DateUtilities.now());
noSync = getIntent().getBooleanExtra(EXTRA_DO_NOT_SYNC, false);

@ -21,9 +21,10 @@ package com.todoroo.astrid.actfm;
import java.io.IOException;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -32,6 +33,7 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.RestClient;
import com.todoroo.andlib.utility.DialogUtilities;
/**
* This activity displays a <code>WebView</code> that allows users to log in to the
@ -41,7 +43,7 @@ import com.todoroo.andlib.service.RestClient;
* @author timsu
*
*/
public class OAuthLoginActivity extends Activity {
public class OAuthLoginActivity extends FragmentActivity {
/**
* URL to display
@ -55,6 +57,8 @@ public class OAuthLoginActivity extends Activity {
@Autowired RestClient restClient;
ProgressDialog pd;
// --- ui initialization
@SuppressWarnings("nls")
@ -65,7 +69,7 @@ public class OAuthLoginActivity extends Activity {
DependencyInjectionService.getInstance().inject(this);
setContentView(R.layout.oauth_login_activity);
setTitle(R.string.actfm_ALA_login_title);
getSupportActionBar().setTitle(R.string.actfm_OLA_prompt);
final String urlParam = getIntent().getStringExtra(URL_TOKEN);
@ -73,12 +77,14 @@ public class OAuthLoginActivity extends Activity {
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSavePassword(false);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setSupportZoom(true);
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, final String url) {
super.onPageFinished(view, url);
pd.dismiss();
new Thread() {
@Override
public void run() {
@ -105,7 +111,7 @@ public class OAuthLoginActivity extends Activity {
}
});
pd = DialogUtilities.progressDialog(this, getString(R.string.DLG_wait));
webView.loadUrl(urlParam);
}

@ -102,7 +102,7 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
runWithDialog(new Runnable() {
pd = DialogUtilities.runWithProgressDialog(OldTaskPreferences.this, new Runnable() {
@Override
public void run() {
TodorooCursor<Task> cursor = taskService.query(Query.select(Task.ID, Task.CALENDAR_URI).where(
@ -141,7 +141,7 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
runWithDialog(new Runnable() {
pd = DialogUtilities.runWithProgressDialog(OldTaskPreferences.this, new Runnable() {
@Override
public void run() {
TodorooCursor<Task> cursor = taskService.query(Query.select(Task.ID, Task.TITLE, Task.CALENDAR_URI).where(
@ -177,7 +177,7 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
runWithDialog(new Runnable() {
pd = DialogUtilities.runWithProgressDialog(OldTaskPreferences.this, new Runnable() {
@Override
public void run() {
int deletedEventCount = 0;
@ -218,7 +218,7 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
runWithDialog(new Runnable() {
pd = DialogUtilities.runWithProgressDialog(OldTaskPreferences.this, new Runnable() {
@Override
public void run() {
int deletedEventCount = 0;
@ -250,24 +250,6 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
}, null);
}
/** Run runnable with progress dialog */
protected void runWithDialog(final Runnable runnable) {
pd = DialogUtilities.progressDialog(this, getString(R.string.DLG_please_wait));
new Thread(new Runnable() {
@Override
public void run() {
try {
runnable.run();
} catch (Exception e) {
DialogUtilities.okDialog(OldTaskPreferences.this,
getString(R.string.DLG_error, e.toString()), null);
} finally {
DialogUtilities.dismissDialog(OldTaskPreferences.this, pd);
}
}
}).start();
}
protected void showResult(int resourceText, int result) {
DialogUtilities.okDialog(this, getString(resourceText, result), null);
}

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="4dip"
android:paddingRight="4dip"
android:background="@drawable/astrid_com_gradient"
android:orientation="vertical" >
<TextView
android:id="@+id/intro"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentLeft="true"
android:textSize="16sp"
android:paddingTop="20dip"
android:textColor="#ffffff"
android:text="@string/actfm_ALA_body" />
<TextView
android:id="@+id/error"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#ff0000"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="50"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="110dip"
android:scaleType="fitCenter"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:paddingBottom="10dip"
android:src="@drawable/astrid_com_logo"
android:layout_gravity="center"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/LinearLayout1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="50"
android:paddingTop="5dip" >
<TextView
android:id="@+id/spacer"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_weight="0.5" />
<Button
android:id="@+id/gg_login"
android:layout_width="match_parent"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:drawableLeft="@drawable/google"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:text="@string/actfm_ALA_gg_login"
android:textSize="12sp"
android:layout_gravity="center_horizontal" />
<com.facebook.android.LoginButton
android:id="@+id/fb_login"
android:layout_width="match_parent"
android:layout_height="45dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:drawableLeft="@drawable/facebook"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:text="@string/actfm_ALA_fb_login"
android:textSize="12sp"
android:layout_gravity="center_horizontal" />
<Button
android:id="@+id/pw_login"
android:layout_width="match_parent"
android:layout_height="45dp"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:drawableLeft="@drawable/notif_astrid"
android:textSize="12sp"
android:text="@string/welcome_login_pw"
android:layout_gravity="center_horizontal" />
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/notice"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:gravity="center"
android:text="@string/actfm_ALA_notice"
android:textColor="#cccccc"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -4,15 +4,8 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/actfm_OLA_prompt"/>
<WebView android:id="@+id/browser"
android:layout_weight="100"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_height="fill_parent"/>
</LinearLayout>

Loading…
Cancel
Save