Implemented password-based login and sign up to Astrid.com

pull/14/head
Tim Su 14 years ago
parent 38dc0e12cf
commit 9ca8eb87f7

@ -426,12 +426,7 @@
android:theme="@style/Theme" /> android:theme="@style/Theme" />
<activity android:name="com.todoroo.astrid.actfm.EditPeopleActivity" <activity android:name="com.todoroo.astrid.actfm.EditPeopleActivity"
android:windowSoftInputMode="stateHidden" android:windowSoftInputMode="stateHidden"
android:theme="@style/Theme"> android:theme="@style/Theme" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.todoroo.astrid.actfm.EditPeopleExposer"> <receiver android:name="com.todoroo.astrid.actfm.EditPeopleExposer">
<intent-filter> <intent-filter>
<action android:name="com.todoroo.astrid.REQUEST_ACTIONS" /> <action android:name="com.todoroo.astrid.REQUEST_ACTIONS" />

@ -27,6 +27,8 @@ import com.facebook.android.Facebook.DialogListener;
public class LoginButton extends Button { public class LoginButton extends Button {
public static final int REQUEST_CODE_FACEBOOK = 21421;
private Facebook mFb; private Facebook mFb;
private AuthListener mListener; private AuthListener mListener;
private String[] mPermissions; private String[] mPermissions;
@ -61,7 +63,7 @@ public class LoginButton extends Button {
private final class ButtonOnClickListener implements OnClickListener { private final class ButtonOnClickListener implements OnClickListener {
public void onClick(View arg0) { public void onClick(View arg0) {
mFb.authorize(mActivity, mPermissions, mFb.authorize(mActivity, mPermissions, REQUEST_CODE_FACEBOOK,
new LoginDialogListener()); new LoginDialogListener());
} }
} }

@ -23,16 +23,24 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.method.PasswordTransformationMethod;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.facebook.android.AsyncFacebookRunner; import com.facebook.android.AsyncFacebookRunner;
@ -42,6 +50,8 @@ import com.facebook.android.Facebook;
import com.facebook.android.FacebookError; import com.facebook.android.FacebookError;
import com.facebook.android.LoginButton; import com.facebook.android.LoginButton;
import com.facebook.android.Util; import com.facebook.android.Util;
import com.google.android.googlelogin.GoogleLoginServiceConstants;
import com.google.android.googlelogin.GoogleLoginServiceHelper;
import com.timsu.astrid.C2DMReceiver; import com.timsu.astrid.C2DMReceiver;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
@ -51,6 +61,7 @@ import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmInvoker; import com.todoroo.astrid.actfm.sync.ActFmInvoker;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.gtasks.auth.ModernAuthManager;
import com.todoroo.astrid.service.AstridDependencyInjector; import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.service.TaskService;
@ -75,6 +86,8 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
// --- ui initialization // --- ui initialization
private static final int REQUEST_CODE_GOOGLE = 1;
static { static {
AstridDependencyInjector.initialize(); AstridDependencyInjector.initialize();
} }
@ -92,8 +105,8 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ContextManager.setContext(this); ContextManager.setContext(this);
setContentView(R.layout.sharing_login_activity); setContentView(R.layout.actfm_login_activity);
setTitle(R.string.sharing_SLA_title); setTitle(R.string.actfm_ALA_title);
noSync = getIntent().getBooleanExtra(EXTRA_DO_NOT_SYNC, false); noSync = getIntent().getBooleanExtra(EXTRA_DO_NOT_SYNC, false);
@ -108,34 +121,101 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
"publish_stream" "publish_stream"
}); });
findViewById(R.id.pw_signup).setOnClickListener(signUpListener);
findViewById(R.id.pw_login).setOnClickListener(loginListener);
getWindow().setFormat(PixelFormat.RGBA_8888); getWindow().setFormat(PixelFormat.RGBA_8888);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
setResult(RESULT_CANCELED); setResult(RESULT_CANCELED);
} }
// --- facebook handler // --- event handler
@SuppressWarnings("nls") private final OnClickListener signUpListener = new OnClickListener() {
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, public void onClick(View arg0) {
Intent data) { LinearLayout body = new LinearLayout(ActFmLoginActivity.this);
String error = data.getStringExtra("error"); body.setOrientation(LinearLayout.VERTICAL);
if (error == null) { body.setPadding(10, 0, 10, 0);
error = data.getStringExtra("error_type");
final EditText name = addEditField(body, R.string.actfm_ALA_name_label);
final EditText email = addEditField(body, R.string.actfm_ALA_email_label);
getCredentials(new OnGetCredentials() {
@Override
public void getCredentials(String[] accounts) {
if(accounts != null && accounts.length > 0)
email.setText(accounts[0]);
}
});
final EditText password = addEditField(body, R.string.actfm_ALA_password_label);
password.setTransformationMethod(new PasswordTransformationMethod());
new AlertDialog.Builder(ActFmLoginActivity.this)
.setTitle(R.string.actfm_ALA_signup_title)
.setView(body)
.setIcon(R.drawable.icon_32)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
authenticate(email.getText().toString(), name.getText().toString(),
ActFmInvoker.PROVIDER_PASSWORD, password.getText().toString());
}
})
.setNegativeButton(android.R.string.cancel, null)
.show().setOwnerActivity(ActFmLoginActivity.this);
} }
String token = data.getStringExtra("access_token"); };
if(error != null) {
onFBAuthFail(error); private final OnClickListener loginListener = new OnClickListener() {
} else if(token == null) { @Override
onFBAuthFail("Something went wrong! Please try again."); public void onClick(View arg0) {
} else { LinearLayout body = new LinearLayout(ActFmLoginActivity.this);
facebook.setAccessToken(token); body.setOrientation(LinearLayout.VERTICAL);
onFBAuthSucceed(); body.setPadding(10, 0, 10, 0);
final EditText email = addEditField(body, R.string.actfm_ALA_username_email_label);
getCredentials(new OnGetCredentials() {
@Override
public void getCredentials(String[] accounts) {
if(accounts != null && accounts.length > 0)
email.setText(accounts[0]);
}
});
final EditText password = addEditField(body, R.string.actfm_ALA_password_label);
password.setTransformationMethod(new PasswordTransformationMethod());
new AlertDialog.Builder(ActFmLoginActivity.this)
.setTitle(R.string.actfm_ALA_login_title)
.setView(body)
.setIcon(R.drawable.icon_32)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
authenticate(email.getText().toString(), null,
ActFmInvoker.PROVIDER_PASSWORD, password.getText().toString());
}
})
.setNegativeButton(android.R.string.cancel, null)
.show().setOwnerActivity(ActFmLoginActivity.this);
} }
errors.setVisibility(View.GONE); };
private EditText addEditField(LinearLayout body, int hint) {
TextView label = new TextView(ActFmLoginActivity.this);
label.setText(hint);
body.addView(label);
EditText field = new EditText(ActFmLoginActivity.this);
field.setHint(hint);
body.addView(field);
return field;
} }
// --- facebook handler
public void onFBAuthSucceed() { public void onFBAuthSucceed() {
createUserAccountFB(); createUserAccountFB();
} }
@ -150,9 +230,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
// do nothing // do nothing
} }
// --- astrid social handler private ProgressDialog progressDialog;
ProgressDialog progressDialog;
/** /**
* Create user account via FB * Create user account via FB
@ -165,7 +243,6 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
private class SLARequestListener implements RequestListener { private class SLARequestListener implements RequestListener {
@SuppressWarnings("nls")
@Override @Override
public void onComplete(String response, Object state) { public void onComplete(String response, Object state) {
JSONObject json; JSONObject json;
@ -174,49 +251,15 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
String name = json.getString("name"); //$NON-NLS-1$ String name = json.getString("name"); //$NON-NLS-1$
String email = json.getString("email"); //$NON-NLS-1$ String email = json.getString("email"); //$NON-NLS-1$
JSONObject result = actFmInvoker.authenticate(email, name, ActFmInvoker.PROVIDER_FACEBOOK, authenticate(email, name, ActFmInvoker.PROVIDER_FACEBOOK,
facebook.getAccessToken()); facebook.getAccessToken());
} catch (FacebookError e) {
String token = actFmInvoker.getToken(); handleError(e);
actFmPreferenceService.setToken(token); } catch (JSONException e) {
if(Preferences.getStringValue(R.string.actfm_APr_interval_key) == null)
Preferences.setStringFromInteger(R.string.actfm_APr_interval_key, 3600);
Preferences.setLong(ActFmPreferenceService.PREF_USER_ID,
result.optLong("id"));
Preferences.setString(ActFmPreferenceService.PREF_NAME, result.optString("name"));
Preferences.setString(ActFmPreferenceService.PREF_EMAIL, result.optString("email"));
Preferences.setString(ActFmPreferenceService.PREF_PICTURE, result.optString("picture"));
C2DMReceiver.register();
progressDialog.dismiss();
setResult(RESULT_OK);
finish();
if(!noSync) {
synchronize();
}
} catch (Throwable e) {
handleError(e); handleError(e);
} }
} }
private void handleError(final Throwable e) {
progressDialog.dismiss();
Log.e("astrid-sharing", "error-doing-sla", e); //$NON-NLS-1$ //$NON-NLS-2$
runOnUiThread(new Runnable() {
@Override
public void run() {
errors.setText(e.toString());
errors.setVisibility(View.VISIBLE);
}
});
}
@Override @Override
public void onFacebookError(FacebookError e, Object state) { public void onFacebookError(FacebookError e, Object state) {
handleError(e); handleError(e);
@ -241,9 +284,100 @@ public class ActFmLoginActivity extends Activity implements AuthListener {
} }
// --- utilities
@SuppressWarnings("nls")
public void authenticate(String email, String name, String provider, String secret) {
if(progressDialog == null)
progressDialog = DialogUtilities.progressDialog(this, getString(R.string.DLG_please_wait));
try {
JSONObject result = actFmInvoker.authenticate(email, name, provider, secret);
String token = actFmInvoker.getToken();
actFmPreferenceService.setToken(token);
if(Preferences.getStringValue(R.string.actfm_APr_interval_key) == null)
Preferences.setStringFromInteger(R.string.actfm_APr_interval_key, 3600);
Preferences.setLong(ActFmPreferenceService.PREF_USER_ID,
result.optLong("id"));
Preferences.setString(ActFmPreferenceService.PREF_NAME, result.optString("name"));
Preferences.setString(ActFmPreferenceService.PREF_EMAIL, result.optString("email"));
Preferences.setString(ActFmPreferenceService.PREF_PICTURE, result.optString("picture"));
C2DMReceiver.register();
setResult(RESULT_OK);
finish();
if(!noSync)
synchronize();
} catch (IOException e) {
handleError(e);
} finally {
DialogUtilities.dismissDialog(this, progressDialog);
}
}
private void handleError(final Throwable e) {
DialogUtilities.dismissDialog(this, progressDialog);
Log.e("astrid-sharing", "error-doing-sla", e); //$NON-NLS-1$ //$NON-NLS-2$
runOnUiThread(new Runnable() {
@Override
public void run() {
errors.setText(e.getMessage());
errors.setVisibility(View.VISIBLE);
}
});
}
public void synchronize() { public void synchronize() {
startService(new Intent(null, null, startService(new Intent(null, null,
this, ActFmBackgroundService.class)); this, ActFmBackgroundService.class));
} }
// --- google account manager
@SuppressWarnings("nls")
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if(requestCode == REQUEST_CODE_GOOGLE){
String accounts[] = data.getExtras().getStringArray(GoogleLoginServiceConstants.ACCOUNTS_KEY);
credentialsListener.getCredentials(accounts);
} else if(requestCode == LoginButton.REQUEST_CODE_FACEBOOK) {
if(data == null)
return;
String error = data.getStringExtra("error");
if (error == null) {
error = data.getStringExtra("error_type");
}
String token = data.getStringExtra("access_token");
if(error != null) {
onFBAuthFail(error);
} else if(token == null) {
onFBAuthFail("Something went wrong! Please try again.");
} else {
facebook.setAccessToken(token);
onFBAuthSucceed();
}
errors.setVisibility(View.GONE);
}
}
public interface OnGetCredentials {
public void getCredentials(String[] accounts);
}
private OnGetCredentials credentialsListener;
public void getCredentials(OnGetCredentials onGetCredentials) {
credentialsListener = onGetCredentials;
if(Integer.parseInt(Build.VERSION.SDK) >= 7)
credentialsListener.getCredentials(ModernAuthManager.getAccounts(this));
else
GoogleLoginServiceHelper.getAccount(this, REQUEST_CODE_GOOGLE, false);
}
} }

@ -1,52 +0,0 @@
/**
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.actfm;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.api.AstridApiConstants;
/**
* Exposes Task Detail for notes
*
* @author Tim Su <tim@todoroo.com>
*
*/
public class TagDataDetailExposer extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
long taskId = intent.getLongExtra(AstridApiConstants.EXTRAS_TASK_ID, -1);
if(taskId == -1)
return;
String taskDetail = getTaskDetails(taskId);
if(taskDetail == null)
return;
// transmit
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_SEND_DETAILS);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, taskDetail);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_ADDON,
ActFmPreferenceService.IDENTIFIER);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, taskId);
context.sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
}
public String getTaskDetails(long id) {
/*Task task = PluginServices.getTaskService().fetchById(id, Task.PROJECT_ID);
if(task == null)
return null;
TagData tagData = PluginServices.getTagDataService().fetchById(task.getValue(Task.PROJECT_ID), TagData.TITLE);
if(tagData == null)*/
return null;
// return "<img src='silk_group'/> " + tagData.getValue(TagData.TITLE); //$NON-NLS-1$
}
}

@ -1,229 +0,0 @@
/**
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.actfm;
import java.util.concurrent.atomic.AtomicReference;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.adapter.TagDataAdapter;
import com.todoroo.astrid.dao.TagDataDao.TagDataCriteria;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.TagDataService;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.ThemeService;
/**
* Activity that displays a user's task lists and allows users
* to filter their task list.
*
* @author Tim Su <tim@todoroo.com>
*
*/
public class TagDataListActivity extends ListActivity implements OnItemClickListener {
// --- constants
private static final int REQUEST_LOG_IN = 1;
private static final int REQUEST_SHOW_GOAL = 2;
private static final int MENU_REFRESH_ID = Menu.FIRST + 0;
// --- instance variables
@Autowired ExceptionService exceptionService;
@Autowired TagDataService tagDataService;
@Autowired ActFmPreferenceService actFmPreferenceService;
@Autowired ActFmSyncService actFmSyncService;
protected TagDataAdapter adapter = null;
protected AtomicReference<String> queryTemplate = new AtomicReference<String>();
/* ======================================================================
* ======================================================= initialization
* ====================================================================== */
static {
AstridDependencyInjector.initialize();
}
/** Called when loading up the activity */
@Override
protected void onCreate(Bundle savedInstanceState) {
DependencyInjectionService.getInstance().inject(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.tagData_list_activity);
ThemeService.applyTheme(this);
if(!actFmPreferenceService.isLoggedIn()) {
Intent login = new Intent(this, ActFmLoginActivity.class);
login.putExtra(ActFmLoginActivity.EXTRA_DO_NOT_SYNC, true);
startActivityForResult(login, REQUEST_LOG_IN);
}
initializeUIComponents();
setUpList();
refreshList(false);
}
@SuppressWarnings("nls")
private void initializeUIComponents() {
((ImageButton) findViewById(R.id.extendedAddButton)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
DialogUtilities.okDialog(TagDataListActivity.this, "unsupported", null);
}
});
((ImageButton) findViewById(R.id.extendedAddButton)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
DialogUtilities.okDialog(TagDataListActivity.this, "unsupported", null);
}
});
((ImageView) findViewById(R.id.goals)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(TagDataListActivity.this, TaskListActivity.class);
startActivity(intent);
finish();
}
});
}
/**
* Create options menu (displayed when user presses menu key)
*
* @return true if menu should be displayed
*/
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if(menu.size() > 0)
return true;
MenuItem item;
item = menu.add(Menu.NONE, MENU_REFRESH_ID, Menu.NONE,
R.string.PLA_menu_refresh);
item.setIcon(R.drawable.ic_menu_refresh);
return true;
}
/* ======================================================================
* ============================================================ lifecycle
* ====================================================================== */
@Override
protected void onStart() {
super.onStart();
StatisticsService.sessionStart(this);
StatisticsService.reportEvent("goal-list"); //$NON-NLS-1$
}
@Override
protected void onStop() {
super.onStop();
StatisticsService.sessionStop(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == REQUEST_LOG_IN) {
if(resultCode == RESULT_CANCELED)
finish();
else
refreshList(true);
} else
super.onActivityResult(requestCode, resultCode, data);
}
/* ======================================================================
* ====================================================== populating list
* ====================================================================== */
/** Sets up the coach list adapter */
protected void setUpList() {
queryTemplate.set(new QueryTemplate().where(TagDataCriteria.isTeam()).toString());
TodorooCursor<TagData> currentCursor = tagDataService.fetchFiltered(queryTemplate.get(),
null, TagData.PROPERTIES);
startManagingCursor(currentCursor);
adapter = new TagDataAdapter(this, R.layout.tagData_adapter_row,
currentCursor, queryTemplate, false, null);
setListAdapter(adapter);
getListView().setOnItemClickListener(this);
}
/** refresh the list with latest data from the web */
private void refreshList(boolean manual) {
actFmSyncService.fetchTagDataDashboard(manual, new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Cursor cursor = adapter.getCursor();
cursor.requery();
startManagingCursor(cursor);
}
});
}
});
}
/* ======================================================================
* ============================================================== actions
* ====================================================================== */
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
Intent intent = new Intent(this, TagDataViewActivity.class);
intent.putExtra(TagDataViewActivity.EXTRA_PROJECT_ID, id);
startActivityForResult(intent, REQUEST_SHOW_GOAL);
}
@Override
public boolean onMenuItemSelected(int featureId, final MenuItem item) {
// handle my own menus
switch (item.getItemId()) {
case MENU_REFRESH_ID: {
refreshList(true);
return true;
}
}
return false;
}
}

@ -1,57 +0,0 @@
package com.todoroo.astrid.actfm;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.TaskAction;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.TagData;
public class ShowTagDataExposer extends BroadcastReceiver {
private static final String FILTER_ACTION = "com.todoroo.astrid.SHOW_PROJECT"; //$NON-NLS-1$
@Override
public void onReceive(Context context, Intent intent) {
ContextManager.setContext(context);
long taskId = intent.getLongExtra(AstridApiConstants.EXTRAS_TASK_ID, -1);
if(taskId == -1)
return;
TagData tagData = PluginServices.getTagDataService().getTagData(taskId,
TagData.ID, TagData.TITLE);
if(tagData == null)
return;
if(AstridApiConstants.BROADCAST_REQUEST_ACTIONS.equals(intent.getAction())) {
final String label = tagData.getValue(TagData.TITLE);
final Drawable drawable = context.getResources().getDrawable(R.drawable.tango_users);
Intent newIntent = new Intent(FILTER_ACTION);
newIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, taskId);
Bitmap icon = ((BitmapDrawable)drawable).getBitmap();
TaskAction action = new TaskAction(label,
PendingIntent.getBroadcast(context, (int)taskId, newIntent, 0), icon);
// transmit
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_SEND_ACTIONS);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_ADDON, ActFmPreferenceService.IDENTIFIER);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, action);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, taskId);
context.sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
} else if(FILTER_ACTION.equals(intent.getAction())) {
Intent launchIntent = new Intent(context, TagDataViewActivity.class);
launchIntent.putExtra(TagDataViewActivity.EXTRA_PROJECT_ID, tagData.getId());
ContextManager.getContext().startActivity(launchIntent);
}
}
}

@ -1,35 +0,0 @@
package com.todoroo.astrid.actfm;
import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.astrid.data.Metadata;
/**
* Metadata entry for a task shared with astrid.com
*
* @author Tim Su <tim@todoroo.com>
*
*/
public class TaskFields {
/** metadata key */
public static final String METADATA_KEY = "actfm"; //$NON-NLS-1$
/** remote id*/
public static final LongProperty REMOTE_ID = new LongProperty(Metadata.TABLE, Metadata.VALUE2.name);
/** goal id */
public static final LongProperty GOAL_ID = new LongProperty(Metadata.TABLE, Metadata.VALUE2.name);
/** user id */
public static final LongProperty USER_ID = new LongProperty(Metadata.TABLE, Metadata.VALUE3.name);
/** user */
public static final StringProperty USER = Metadata.VALUE4;
/** comment count */
public static final IntegerProperty COMMENT_COUNT = new IntegerProperty(Metadata.TABLE,
Metadata.VALUE4.name);
}

@ -30,6 +30,7 @@ public class ActFmInvoker {
public static final String PROVIDER_FACEBOOK = "facebook"; public static final String PROVIDER_FACEBOOK = "facebook";
public static final String PROVIDER_GOOGLE= "google"; public static final String PROVIDER_GOOGLE= "google";
public static final String PROVIDER_PASSWORD = "password";
@Autowired private RestClient restClient; @Autowired private RestClient restClient;

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/sharing_button_normal" />
<item android:state_pressed="true" android:state_focused="false" android:drawable="@drawable/sharing_button_pressed" />
<item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/sharing_button_focused" />
<item android:state_pressed="true" android:state_focused="true" android:drawable="@drawable/sharing_button_pressed" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

@ -6,7 +6,7 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="4px" android:paddingLeft="4px"
android:paddingRight="4px" android:paddingRight="4px"
android:background="@drawable/sharing_gradient"> android:background="@drawable/astrid_com_gradient">
<TextView <TextView
android:id="@+id/intro" android:id="@+id/intro"
@ -18,7 +18,7 @@
android:textSize="16sp" android:textSize="16sp"
android:paddingTop="20dip" android:paddingTop="20dip"
android:textColor="#ffffff" android:textColor="#ffffff"
android:text="@string/sharing_SLA_body" /> android:text="@string/actfm_ALA_body" />
<TextView <TextView
android:id="@+id/error" android:id="@+id/error"
@ -27,7 +27,7 @@
android:layout_below="@id/intro" android:layout_below="@id/intro"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:gravity="center" android:gravity="center"
android:paddingTop="10dip" android:paddingTop="5dip"
android:textColor="#ff0000" android:textColor="#ff0000"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" /> android:textStyle="bold" />
@ -40,7 +40,8 @@
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:paddingLeft="20dip" android:paddingLeft="20dip"
android:paddingRight="20dip" android:paddingRight="20dip"
android:src="@drawable/sharing_logo" /> android:layout_marginBottom="95dip"
android:src="@drawable/astrid_com_logo" />
<TextView <TextView
android:id="@+id/notice" android:id="@+id/notice"
@ -49,21 +50,46 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:gravity="center" android:gravity="center"
android:paddingTop="30dip" android:layout_marginBottom="20dip"
android:paddingBottom="30dip" android:textSize="12sp"
android:textSize="14sp"
android:textColor="#cccccc" android:textColor="#cccccc"
android:text="@string/sharing_SLA_notice" /> android:text="@string/actfm_ALA_notice" />
<Button
android:id="@+id/pw_signup"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_above="@id/notice"
android:layout_alignParentLeft="true"
android:layout_marginBottom="15dip"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:textSize="16sp"
android:text="@string/actfm_ALA_pw_signup" />
<Button
android:id="@+id/pw_login"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_above="@id/pw_signup"
android:layout_alignParentLeft="true"
android:layout_marginBottom="3dip"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:textSize="16sp"
android:text="@string/actfm_ALA_pw_login" />
<com.facebook.android.LoginButton <com.facebook.android.LoginButton
android:id="@+id/fb_login" android:id="@+id/fb_login"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="50dip" android:layout_height="45dip"
android:layout_above="@id/notice" android:layout_above="@id/pw_login"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_marginBottom="3dip"
android:paddingLeft="20dip" android:paddingLeft="20dip"
android:paddingRight="20dip" android:paddingRight="20dip"
android:textSize="18sp" android:textSize="16sp"
android:text="@string/sharing_SLA_login" /> android:drawableLeft="@drawable/facebook"
android:text="@string/actfm_ALA_fb_login" />
</RelativeLayout> </RelativeLayout>

@ -120,18 +120,41 @@
<!-- ========================================= sharing login activity == --> <!-- ========================================= sharing login activity == -->
<!-- share login: Title --> <!-- share login: Title -->
<string name="sharing_SLA_title">Welcome to Astrid.com!</string> <string name="actfm_ALA_title">Welcome to Astrid.com!</string>
<!-- share login: Sharing Description --> <!-- share login: Sharing Description -->
<string name="sharing_SLA_body">Astrid.com lets you access your tasks online, <string name="actfm_ALA_body">Astrid.com lets you access your tasks online,
and share &amp; delegate with others. Perfect for personal use, friends &amp; family, share, and delegate with others. Perfect for personal use, friends, family, and coworkers!</string>
or your work groups!</string>
<!-- share login: Sharing Login Prompt --> <!-- share login: Sharing Login FB Prompt -->
<string name="sharing_SLA_login">Sign in using Facebook</string> <string name="actfm_ALA_fb_login">Login with Facebook</string>
<!-- share login: Sharing Login Password Prompt -->
<string name="actfm_ALA_pw_login">Login</string>
<!-- share login: Sharing Sign Up Prompt -->
<string name="actfm_ALA_pw_signup">Sign Up</string>
<!-- share login: Name -->
<string name="actfm_ALA_name_label">Name</string>
<!-- share login: Email -->
<string name="actfm_ALA_email_label">Email</string>
<!-- share login: Username / Email -->
<string name="actfm_ALA_username_email_label">Username / Email</string>
<!-- share login: Password -->
<string name="actfm_ALA_password_label">Password</string>
<!-- share login: Sign Up Title -->
<string name="actfm_ALA_signup_title">Create New Account</string>
<!-- share login: Login Title -->
<string name="actfm_ALA_login_title">Login to Astrid.com</string>
<!-- share login: Sharing notice --> <!-- share login: Sharing notice -->
<string name="sharing_SLA_notice">We won\'t post messages or send <string name="actfm_ALA_notice">We promise not to post messages or send
e-mails without your permission.</string> e-mails without your permission.</string>
<!-- ================================================ Synchronization == --> <!-- ================================================ Synchronization == -->

Loading…
Cancel
Save