Merge pull request #137 from sbosley/120217_sb_minor_fixes

Minor fixes
pull/14/head
Tim Su 13 years ago
commit b1ca277692

@ -269,9 +269,15 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
body.setOrientation(LinearLayout.VERTICAL); body.setOrientation(LinearLayout.VERTICAL);
body.setPadding(10, 0, 10, 0); body.setPadding(10, 0, 10, 0);
final EditText name = addEditField(body, final EditText firstNameField = addEditField(body,
R.string.actfm_ALA_name_label); R.string.actfm_ALA_firstname_label);
name.setInputType(InputType.TYPE_CLASS_TEXT | firstNameField.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PERSON_NAME |
InputType.TYPE_TEXT_FLAG_CAP_WORDS);
final EditText lastNameField = addEditField(body,
R.string.actfm_ALA_lastname_label);
lastNameField.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PERSON_NAME | InputType.TYPE_TEXT_VARIATION_PERSON_NAME |
InputType.TYPE_TEXT_FLAG_CAP_WORDS); InputType.TYPE_TEXT_FLAG_CAP_WORDS);
@ -282,7 +288,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
@Override @Override
public void onClick(View v) { public void onClick(View v) {
isNew.set(!isNew.get()); isNew.set(!isNew.get());
int nameIndex = body.indexOfChild(name); int nameIndex = body.indexOfChild(lastNameField);
int visibility = isNew.get() ? View.VISIBLE : View.GONE; int visibility = isNew.get() ? View.VISIBLE : View.GONE;
int passwordVisibility = isNew.get() ? View.GONE : View.VISIBLE; int passwordVisibility = isNew.get() ? View.GONE : View.VISIBLE;
toggleNew.setText(isNew.get() ? R.string.actfm_ALA_pw_returning toggleNew.setText(isNew.get() ? R.string.actfm_ALA_pw_returning
@ -290,6 +296,8 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
dialog.get().setTitle( dialog.get().setTitle(
isNew.get() ? R.string.actfm_ALA_signup_title isNew.get() ? R.string.actfm_ALA_signup_title
: R.string.actfm_ALA_login_title); : R.string.actfm_ALA_login_title);
body.getChildAt(nameIndex - 3).setVisibility(visibility);
body.getChildAt(nameIndex - 2).setVisibility(visibility);
body.getChildAt(nameIndex - 1).setVisibility(visibility); body.getChildAt(nameIndex - 1).setVisibility(visibility);
body.getChildAt(nameIndex).setVisibility(visibility); body.getChildAt(nameIndex).setVisibility(visibility);
@ -331,11 +339,14 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
android.R.string.ok, new DialogInterface.OnClickListener() { android.R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dlg, int which) { public void onClick(DialogInterface dlg, int which) {
String nameString = isNew.get() ? name.getText().toString() String firstName = isNew.get() ? firstNameField.getText().toString()
: null; : null;
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, name, email, password); String lastName = isNew.get() ? lastNameField.getText().toString()
: null;
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, firstNameField, lastNameField, email, password);
authenticate(email.getText().toString(), authenticate(email.getText().toString(),
nameString, ActFmInvoker.PROVIDER_PASSWORD, firstName, lastName, ActFmInvoker.PROVIDER_PASSWORD,
password.getText().toString()); password.getText().toString());
if (isNew.get()) if (isNew.get())
@ -346,7 +357,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dlg, int which) { public void onClick(DialogInterface dlg, int which) {
AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, name, email, password); AndroidUtilities.hideSoftInputForViews(ActFmLoginActivity.this, firstNameField, lastNameField, email, password);
} }
}).show()); }).show());
@ -427,10 +438,11 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
JSONObject json; JSONObject json;
try { try {
json = Util.parseJson(response); json = Util.parseJson(response);
String name = json.getString("name"); //$NON-NLS-1$ String firstName = json.getString("first_name"); //$NON-NLS-1$
String lastName = json.getString("last_name");
String email = json.getString("email"); //$NON-NLS-1$ String email = json.getString("email"); //$NON-NLS-1$
authenticate(email, name, ActFmInvoker.PROVIDER_FACEBOOK, authenticate(email, firstName, lastName, ActFmInvoker.PROVIDER_FACEBOOK,
facebook.getAccessToken()); facebook.getAccessToken());
StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_FB); StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_FB);
} catch (FacebookError e) { } catch (FacebookError e) {
@ -467,7 +479,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
// --- utilities // --- utilities
@SuppressWarnings("nls") @SuppressWarnings("nls")
public void authenticate(final String email, final String name, final String provider, public void authenticate(final String email, final String firstName, final String lastName, final String provider,
final String secret) { final String secret) {
if (progressDialog == null) if (progressDialog == null)
progressDialog = DialogUtilities.progressDialog(this, progressDialog = DialogUtilities.progressDialog(this,
@ -477,7 +489,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
@Override @Override
public void run() { public void run() {
try { try {
final JSONObject result = actFmInvoker.authenticate(email, name, final JSONObject result = actFmInvoker.authenticate(email, firstName, lastName,
provider, secret); provider, secret);
final String token = actFmInvoker.getToken(); final String token = actFmInvoker.getToken();
@ -591,7 +603,7 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener
} else if (requestCode == REQUEST_CODE_GOOGLE) { } else if (requestCode == REQUEST_CODE_GOOGLE) {
String email= data.getStringExtra(ActFmGoogleAuthActivity.RESULT_EMAIL); String email= data.getStringExtra(ActFmGoogleAuthActivity.RESULT_EMAIL);
String token = data.getStringExtra(ActFmGoogleAuthActivity.RESULT_TOKEN); String token = data.getStringExtra(ActFmGoogleAuthActivity.RESULT_TOKEN);
authenticate(email, email, "google", token); authenticate(email, email, "", "google", token);
} }
} }

@ -21,7 +21,6 @@ import android.graphics.Color;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -59,6 +58,7 @@ import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.TagService; import com.todoroo.astrid.tags.TagService;
import com.todoroo.astrid.ui.PeopleContainer; import com.todoroo.astrid.ui.PeopleContainer;
import com.todoroo.astrid.ui.PeopleContainer.OnAddNewPersonListener; import com.todoroo.astrid.ui.PeopleContainer.OnAddNewPersonListener;
import com.todoroo.astrid.ui.PeopleContainer.ParseSharedException;
import com.todoroo.astrid.ui.PopupControlSet; import com.todoroo.astrid.ui.PopupControlSet;
public class EditPeopleControlSet extends PopupControlSet { public class EditPeopleControlSet extends PopupControlSet {
@ -570,9 +570,6 @@ public class EditPeopleControlSet extends PopupControlSet {
selected = 0;*/ selected = 0;*/
return true; return true;
} }
else {
Log.d("Edit People control set", "Does not equal task rabbit");
}
userJson = item.user; userJson = item.user;
} }
} }
@ -626,7 +623,12 @@ public class EditPeopleControlSet extends PopupControlSet {
} }
} }
JSONObject sharedWith = parseSharedWithAndTags(); JSONObject sharedWith = sharedWithContainer.parseSharedWithAndTags(activity, false);
if(cbFacebook.isChecked())
sharedWith.put("fb", true);
if(cbTwitter.isChecked())
sharedWith.put("tw", true);
dirty = dirty || sharedWith.has("p"); dirty = dirty || sharedWith.has("p");
if(dirty && !actFmPreferenceService.isLoggedIn()) { if(dirty && !actFmPreferenceService.isLoggedIn()) {
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@ -690,46 +692,6 @@ public class EditPeopleControlSet extends PopupControlSet {
Toast.makeText(activity, saveToast, length).show(); Toast.makeText(activity, saveToast, length).show();
} }
private class ParseSharedException extends Exception {
private static final long serialVersionUID = -4135848250086302970L;
public TextView view;
public String message;
public ParseSharedException(TextView view, String message) {
this.view = view;
this.message = message;
}
}
@SuppressWarnings("nls")
private JSONObject parseSharedWithAndTags() throws
JSONException, ParseSharedException {
JSONObject sharedWith = new JSONObject();
if(cbFacebook.isChecked())
sharedWith.put("fb", true);
if(cbTwitter.isChecked())
sharedWith.put("tw", true);
JSONArray peopleList = new JSONArray();
for(int i = 0; i < sharedWithContainer.getChildCount(); i++) {
TextView textView = sharedWithContainer.getTextView(i);
textView.setTextAppearance(activity, android.R.style.TextAppearance_Medium_Inverse);
String text = textView.getText().toString();
if(text.length() == 0)
continue;
if(text.indexOf('@') == -1)
throw new ParseSharedException(textView,
activity.getString(R.string.actfm_EPA_invalid_email, text));
peopleList.put(text);
}
if(peopleList.length() > 0)
sharedWith.put("p", peopleList);
return sharedWith;
}
@SuppressWarnings("nls") @SuppressWarnings("nls")
protected Object[] buildSharingArgs(JSONArray emails) throws JSONException { protected Object[] buildSharingArgs(JSONArray emails) throws JSONException {
ArrayList<Object> values = new ArrayList<Object>(); ArrayList<Object> values = new ArrayList<Object>();

@ -13,6 +13,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.ActionBar; import android.support.v4.app.ActionBar;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
@ -31,6 +32,7 @@ import android.widget.Toast;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
@ -48,6 +50,7 @@ import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.TagFilterExposer; import com.todoroo.astrid.tags.TagFilterExposer;
import com.todoroo.astrid.tags.TagService; import com.todoroo.astrid.tags.TagService;
import com.todoroo.astrid.ui.PeopleContainer; import com.todoroo.astrid.ui.PeopleContainer;
import com.todoroo.astrid.ui.PeopleContainer.ParseSharedException;
import com.todoroo.astrid.utility.Flags; import com.todoroo.astrid.utility.Flags;
import com.todoroo.astrid.welcome.HelpInfoPopover; import com.todoroo.astrid.welcome.HelpInfoPopover;
@ -71,6 +74,8 @@ public class TagSettingsActivity extends FragmentActivity {
@Autowired ActFmPreferenceService actFmPreferenceService; @Autowired ActFmPreferenceService actFmPreferenceService;
@Autowired ExceptionService exceptionService;
private PeopleContainer tagMembers; private PeopleContainer tagMembers;
private AsyncImageView picture; private AsyncImageView picture;
private EditText tagName; private EditText tagName;
@ -227,7 +232,22 @@ public class TagSettingsActivity extends FragmentActivity {
tagData.setValue(TagData.TAG_DESCRIPTION, newDesc); tagData.setValue(TagData.TAG_DESCRIPTION, newDesc);
JSONArray members = tagMembers.toJSONArray(); JSONArray members;
try {
members = tagMembers.parseSharedWithAndTags(this, true).optJSONArray("p");
} catch (JSONException e) {
exceptionService.displayAndReportError(this, "save-people", e);
return;
} catch (ParseSharedException e) {
if(e.view != null) {
e.view.setTextColor(Color.RED);
e.view.requestFocus();
}
DialogUtilities.okDialog(this, e.message, null);
return;
}
if (members == null)
members = new JSONArray();
if(members.length() > 0 && !actFmPreferenceService.isLoggedIn()) { if(members.length() > 0 && !actFmPreferenceService.isLoggedIn()) {
if(newName.length() > 0 && oldName.length() == 0) { if(newName.length() > 0 && oldName.length() == 0) {

@ -1,5 +1,6 @@
package com.todoroo.astrid.actfm; package com.todoroo.astrid.actfm;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
@ -36,6 +37,7 @@ import com.todoroo.astrid.actfm.ActFmCameraModule.ClearImageCallback;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService; import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.activity.AstridActivity; import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.adapter.UpdateAdapter; import com.todoroo.astrid.adapter.UpdateAdapter;
import com.todoroo.astrid.dao.UpdateDao; import com.todoroo.astrid.dao.UpdateDao;
import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.TagData;
@ -198,9 +200,16 @@ public class TagUpdatesFragment extends ListFragment {
cursor.requery(); cursor.requery();
getActivity().startManagingCursor(cursor); getActivity().startManagingCursor(cursor);
} }
if (getActivity() instanceof TagUpdatesActivity)
setLastViewed();
}
if(tagData != null && tagData.getValue(Task.REMOTE_ID) <= 0) { public void setLastViewed() {
if(tagData != null && tagData.getValue(Task.REMOTE_ID) > 0) {
Preferences.setLong(UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), DateUtilities.now()); Preferences.setLong(UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), DateUtilities.now());
Activity activity = getActivity();
if (activity instanceof TaskListActivity)
((TaskListActivity) activity).setCommentsCount(0);
} }
} }

@ -172,8 +172,9 @@ public class TagViewFragment extends TaskListFragment {
dataLoaded = true; dataLoaded = true;
} }
String tag = getActivity().getIntent().getStringExtra(EXTRA_TAG_NAME); TaskListActivity activity = (TaskListActivity) getActivity();
long remoteId = getActivity().getIntent().getLongExtra(EXTRA_TAG_REMOTE_ID, 0); String tag = activity.getIntent().getStringExtra(EXTRA_TAG_NAME);
long remoteId = activity.getIntent().getLongExtra(EXTRA_TAG_REMOTE_ID, 0);
if(tag == null && remoteId == 0) if(tag == null && remoteId == 0)
return; return;
@ -198,17 +199,10 @@ public class TagViewFragment extends TaskListFragment {
super.onNewIntent(intent); super.onNewIntent(intent);
// if (intent.getBooleanExtra(TOKEN_START_ACTIVITY, false)) { if (activity.getIntent().getBooleanExtra(TOKEN_START_ACTIVITY, false)) {
// getView().findViewById(R.id.activity).postDelayed(new Runnable() { activity.getIntent().removeExtra(TOKEN_START_ACTIVITY);
// @Override activity.showComments();
// public void run() { }
// Intent i = new Intent(getActivity(), TagUpdatesActivity.class);
// i.putExtra(EXTRA_TAG_DATA, tagData);
// startActivity(i);
// AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out);
// }
// }, 500);
// }
} }
@Override @Override
@ -230,6 +224,10 @@ public class TagViewFragment extends TaskListFragment {
tagDataService.save(tagData); tagDataService.save(tagData);
} }
updateCommentCount();
}
private void updateCommentCount() {
if (tagData != null) { if (tagData != null) {
long lastViewedComments = Preferences.getLong(TagUpdatesFragment.UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), 0); long lastViewedComments = Preferences.getLong(TagUpdatesFragment.UPDATES_LAST_VIEWED + tagData.getValue(TagData.REMOTE_ID), 0);
int unreadCount = 0; int unreadCount = 0;
@ -441,6 +439,7 @@ public class TagViewFragment extends TaskListFragment {
getActivity().registerReceiver(notifyReceiver, intentFilter); getActivity().registerReceiver(notifyReceiver, intentFilter);
showListSettingsPopover(); showListSettingsPopover();
updateCommentCount();
} }
@Override @Override

@ -34,7 +34,7 @@ public class ActFmInvoker {
public static final String PROVIDER_GOOGLE= "google"; public static final String PROVIDER_GOOGLE= "google";
public static final String PROVIDER_PASSWORD = "password"; public static final String PROVIDER_PASSWORD = "password";
private static final int API_VERSION = 5; private static final int API_VERSION = 6;
@Autowired private RestClient restClient; @Autowired private RestClient restClient;
@ -68,12 +68,13 @@ public class ActFmInvoker {
/** /**
* Authentication user with Act.fm server, returning a token * Authentication user with Act.fm server, returning a token
*/ */
public JSONObject authenticate(String email, String name, String provider, public JSONObject authenticate(String email, String firstName, String lastName, String provider,
String secret) throws ActFmServiceException, IOException { String secret) throws ActFmServiceException, IOException {
JSONObject result = invoke( JSONObject result = invoke(
"user_signin", "user_signin",
"email", email, "email", email,
"name", name, "first_name", firstName,
"last_name", lastName,
"provider", provider, "provider", provider,
"secret", secret); "secret", secret);
try { try {

@ -296,15 +296,26 @@ public final class ActFmSyncService {
* Synchronize with server when data changes * Synchronize with server when data changes
*/ */
public void pushTaskOnSave(Task task, ContentValues values) { public void pushTaskOnSave(Task task, ContentValues values) {
Task taskForRemote = taskService.fetchById(task.getId(), Task.REMOTE_ID, Task.CREATION_DATE);
long remoteId; long remoteId;
if(task.containsValue(Task.REMOTE_ID)) { if(task.containsValue(Task.REMOTE_ID)) {
remoteId = task.getValue(Task.REMOTE_ID); remoteId = task.getValue(Task.REMOTE_ID);
} else { } else {
Task taskForRemote = taskService.fetchById(task.getId(), Task.REMOTE_ID);
if(taskForRemote == null) if(taskForRemote == null)
return; return;
remoteId = taskForRemote.getValue(Task.REMOTE_ID); remoteId = taskForRemote.getValue(Task.REMOTE_ID);
} }
long creationDate;
if (task.containsValue(Task.CREATION_DATE)) {
creationDate = task.getValue(Task.CREATION_DATE);
} else {
if (taskForRemote == null)
return;
creationDate = taskForRemote.getValue(Task.CREATION_DATE);
}
boolean newlyCreated = remoteId == 0; boolean newlyCreated = remoteId == 0;
ArrayList<Object> params = new ArrayList<Object>(); ArrayList<Object> params = new ArrayList<Object>();
@ -402,6 +413,8 @@ public final class ActFmSyncService {
if(params.size() == 0 || !checkForToken()) if(params.size() == 0 || !checkForToken())
return; return;
params.add("created_at"); params.add(creationDate);
if(!newlyCreated) { if(!newlyCreated) {
params.add("id"); params.add(remoteId); params.add("id"); params.add(remoteId);
} else if(!values.containsKey(Task.TITLE.name)) { } else if(!values.containsKey(Task.TITLE.name)) {

@ -36,6 +36,7 @@ import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.StatisticsConstants; import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService; import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.TaskService;
import com.todoroo.astrid.ui.NumberPicker; import com.todoroo.astrid.ui.NumberPicker;
import com.todoroo.astrid.ui.NumberPickerDialog; import com.todoroo.astrid.ui.NumberPickerDialog;
import com.todoroo.astrid.ui.NumberPickerDialog.OnNumberPickedListener; import com.todoroo.astrid.ui.NumberPickerDialog.OnNumberPickedListener;
@ -324,6 +325,9 @@ public class RepeatControlSet extends PopupControlSet {
result = rrule.toIcal(); result = rrule.toIcal();
} }
if (!result.equals(task.getValue(Task.RECURRENCE)))
task.putTransitory(TaskService.TRANS_REPEAT_CHANGED, true);
task.setValue(Task.RECURRENCE, result); task.setValue(Task.RECURRENCE, result);
switch(type.getSelectedItemPosition()) { switch(type.getSelectedItemPosition()) {

@ -32,9 +32,9 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:background="@android:drawable/list_selector_background" android:background="@android:drawable/list_selector_background"
android:paddingTop="1dip" android:layout_marginTop="6dip"
android:paddingLeft="5dip" android:layout_marginBottom="6dip"
android:paddingBottom="1dip"> android:paddingLeft="5dip">
<com.todoroo.astrid.ui.CheckableImageView <com.todoroo.astrid.ui.CheckableImageView

@ -19,7 +19,9 @@
android:id="@+id/rowBody" android:id="@+id/rowBody"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="57dip"> android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:minHeight="45dip">
<ImageView <ImageView
android:id="@+id/pictureBorder" android:id="@+id/pictureBorder"

@ -221,6 +221,12 @@
<!-- share login: Name --> <!-- share login: Name -->
<string name="actfm_ALA_name_label">Name</string> <string name="actfm_ALA_name_label">Name</string>
<!-- share login: Name -->
<string name="actfm_ALA_firstname_label">First Name</string>
<!-- share login: Name -->
<string name="actfm_ALA_lastname_label">Last Name</string>
<!-- share login: Email --> <!-- share login: Email -->
<string name="actfm_ALA_email_label">Email</string> <string name="actfm_ALA_email_label">Email</string>

@ -163,6 +163,13 @@
<string name="TLA_quickadd_confirm_hide_helpers">Don\'t display future confirmations</string> <string name="TLA_quickadd_confirm_hide_helpers">Don\'t display future confirmations</string>
<!-- Title for alert on new repeating task. %s-> task title -->
<string name="TLA_repeat_scheduled_title">New repeating task %s</string>
<!-- Speech bubble for when a new repeating task scheduled. %s->repeat interval -->
<string name="TLA_repeat_scheduled_speech_bubble">I\'ll remind you about this %s.</string>
<string-array name="TLA_priority_strings"> <string-array name="TLA_priority_strings">
<item>highest priority</item> <item>highest priority</item>
<item>high priority</item> <item>high priority</item>

@ -19,6 +19,7 @@ import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.astrid.adapter.TaskAdapter; import com.todoroo.astrid.adapter.TaskAdapter;
import com.todoroo.astrid.core.SortHelper; import com.todoroo.astrid.core.SortHelper;
import com.todoroo.astrid.data.Task; import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.SyncActionHelper;
/** /**
* Activity for working with draggable task lists, like Google Tasks lists * Activity for working with draggable task lists, like Google Tasks lists
@ -83,6 +84,7 @@ public class DraggableTaskListFragment extends TaskListFragment {
getListView().setOnScrollListener(this); getListView().setOnScrollListener(this);
registerForContextMenu(getListView()); registerForContextMenu(getListView());
syncActionHelper = new SyncActionHelper(getActivity());
loadTaskListContent(false); loadTaskListContent(false);
getTouchListView().setOnTouchListener(new OnTouchListener() { getTouchListView().setOnTouchListener(new OnTouchListener() {

@ -89,6 +89,7 @@ import com.todoroo.astrid.tags.TagsControlSet;
import com.todoroo.astrid.taskrabbit.TaskRabbitControlSet; import com.todoroo.astrid.taskrabbit.TaskRabbitControlSet;
import com.todoroo.astrid.timers.TimerActionControlSet; import com.todoroo.astrid.timers.TimerActionControlSet;
import com.todoroo.astrid.timers.TimerControlSet; import com.todoroo.astrid.timers.TimerControlSet;
import com.todoroo.astrid.ui.DateChangedAlerts;
import com.todoroo.astrid.ui.DeadlineControlSet; import com.todoroo.astrid.ui.DeadlineControlSet;
import com.todoroo.astrid.ui.EditNotesControlSet; import com.todoroo.astrid.ui.EditNotesControlSet;
import com.todoroo.astrid.ui.EditTitleControlSet; import com.todoroo.astrid.ui.EditTitleControlSet;
@ -168,6 +169,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
public static final String TOKEN_ASSIGNED_TO = "task_assigned_to"; //$NON-NLS-1$ public static final String TOKEN_ASSIGNED_TO = "task_assigned_to"; //$NON-NLS-1$
public static final String TOKEN_TAGS_CHANGED = "tags_changed"; //$NON-NLS-1$ public static final String TOKEN_TAGS_CHANGED = "tags_changed"; //$NON-NLS-1$
public static final String TOKEN_NEW_REPEATING_TASK = "new_repeating"; //$NON-NLS-1$
// --- services // --- services
@ -812,16 +814,21 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
taskService.save(model); taskService.save(model);
if (!onPause && !cancelFinish) { if (!onPause && !cancelFinish) {
boolean setActivityResult = (getActivity() instanceof TaskEditActivity); boolean taskEditActivity = (getActivity() instanceof TaskEditActivity);
boolean isAssignedToMe = peopleControlSet.isAssignedToMe(); boolean isAssignedToMe = peopleControlSet.isAssignedToMe();
boolean showRepeatAlert = model.getTransitory(TaskService.TRANS_REPEAT_CHANGED) != null
&& !TextUtils.isEmpty(model.getValue(Task.RECURRENCE));
String assignedTo = peopleControlSet.getAssignedToString(); String assignedTo = peopleControlSet.getAssignedToString();
if (setActivityResult) { if (taskEditActivity) {
Intent data = new Intent(); Intent data = new Intent();
if (!isAssignedToMe) { if (!isAssignedToMe) {
data.putExtra(TOKEN_TASK_WAS_ASSIGNED, true); data.putExtra(TOKEN_TASK_WAS_ASSIGNED, true);
data.putExtra(TOKEN_ASSIGNED_TO, data.putExtra(TOKEN_ASSIGNED_TO,
assignedTo); assignedTo);
} }
if (showRepeatAlert) {
data.putExtra(TOKEN_NEW_REPEATING_TASK, model);
}
data.putExtra(TOKEN_TAGS_CHANGED, tagsChanged); data.putExtra(TOKEN_TAGS_CHANGED, tagsChanged);
getActivity().setResult(Activity.RESULT_OK, data); getActivity().setResult(Activity.RESULT_OK, data);
@ -831,6 +838,9 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
TaskListActivity tla = (TaskListActivity) getActivity(); TaskListActivity tla = (TaskListActivity) getActivity();
if (!isAssignedToMe) if (!isAssignedToMe)
tla.switchToAssignedFilter(assignedTo); tla.switchToAssignedFilter(assignedTo);
else if (showRepeatAlert)
DateChangedAlerts.showRepeatChangedDialog(tla, model);
if (tagsChanged) if (tagsChanged)
tla.tagsChanged(); tla.tagsChanged();
tla.refreshTaskList(); tla.refreshTaskList();

@ -33,9 +33,11 @@ import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.core.CustomFilterExposer; import com.todoroo.astrid.core.CustomFilterExposer;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.reminders.NotificationFragment; import com.todoroo.astrid.reminders.NotificationFragment;
import com.todoroo.astrid.service.ThemeService; import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.TagFilterExposer; import com.todoroo.astrid.tags.TagFilterExposer;
import com.todoroo.astrid.ui.DateChangedAlerts;
import com.todoroo.astrid.ui.FragmentPopover; import com.todoroo.astrid.ui.FragmentPopover;
import com.todoroo.astrid.ui.MainMenuPopover; import com.todoroo.astrid.ui.MainMenuPopover;
import com.todoroo.astrid.ui.MainMenuPopover.MainMenuListener; import com.todoroo.astrid.ui.MainMenuPopover.MainMenuListener;
@ -84,6 +86,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
if (frag != null) { if (frag != null) {
setupPopoverWithFragment(commentsPopover, frag, null); setupPopoverWithFragment(commentsPopover, frag, null);
commentsPopover.show(listsNav); commentsPopover.show(listsNav);
frag.setLastViewed();
} }
} else { } else {
// In this case we should be in LAYOUT_SINGLE--delegate to the task list fragment // In this case we should be in LAYOUT_SINGLE--delegate to the task list fragment
@ -341,6 +344,10 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
commentsButton.setBackgroundResource(tv.data); commentsButton.setBackgroundResource(tv.data);
} }
public void showComments() {
commentsButton.performClick();
}
@Override @Override
public void onBackPressed() { public void onBackPressed() {
// manage task edit visibility // manage task edit visibility
@ -389,6 +396,9 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
if (data.getBooleanExtra(TaskEditFragment.TOKEN_TASK_WAS_ASSIGNED, false)) { if (data.getBooleanExtra(TaskEditFragment.TOKEN_TASK_WAS_ASSIGNED, false)) {
String assignedTo = data.getStringExtra(TaskEditFragment.TOKEN_ASSIGNED_TO); String assignedTo = data.getStringExtra(TaskEditFragment.TOKEN_ASSIGNED_TO);
switchToAssignedFilter(assignedTo); switchToAssignedFilter(assignedTo);
} else if (data.getParcelableExtra(TaskEditFragment.TOKEN_NEW_REPEATING_TASK) != null) {
Task repeating = data.getParcelableExtra(TaskEditFragment.TOKEN_NEW_REPEATING_TASK);
DateChangedAlerts.showRepeatChangedDialog(this, repeating);
} }
if (data.getBooleanExtra(TaskEditFragment.TOKEN_TAGS_CHANGED, false)) if (data.getBooleanExtra(TaskEditFragment.TOKEN_TAGS_CHANGED, false))
tagsChanged(true); tagsChanged(true);

@ -213,7 +213,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
displayMetrics = new DisplayMetrics(); displayMetrics = new DisplayMetrics();
fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
this.minRowHeight = (int) (57 * displayMetrics.density); this.minRowHeight = (int) (4 * displayMetrics.density);
startDetailThread(); startDetailThread();
startTaskActionsThread(); startTaskActionsThread();

@ -44,6 +44,8 @@ public class TaskService {
public static final String TRANS_QUICK_ADD_MARKUP = "markup"; //$NON-NLS-1$ public static final String TRANS_QUICK_ADD_MARKUP = "markup"; //$NON-NLS-1$
public static final String TRANS_REPEAT_CHANGED = "repeat_changed"; //$NON-NLS-1$
@Autowired @Autowired
private TaskDao taskDao; private TaskDao taskDao;

@ -53,9 +53,9 @@ public class DateChangedAlerts {
d.setContentView(R.layout.astrid_reminder_view); d.setContentView(R.layout.astrid_reminder_view);
Button okButton = (Button) d.findViewById(R.id.reminder_complete); Button okButton = (Button) d.findViewById(R.id.reminder_complete);
okButton.setText(R.string.DLG_ok);
d.findViewById(R.id.reminder_snooze).setVisibility(View.GONE); d.findViewById(R.id.reminder_snooze).setVisibility(View.GONE);
okButton.setText(R.string.DLG_ok);
((TextView) d.findViewById(R.id.reminder_title)).setText(activity.getString(R.string.TLA_quickadd_confirm_title, originalText)); ((TextView) d.findViewById(R.id.reminder_title)).setText(activity.getString(R.string.TLA_quickadd_confirm_title, originalText));
Spanned speechBubbleText = constructSpeechBubbleTextForQuickAdd(activity, task); Spanned speechBubbleText = constructSpeechBubbleTextForQuickAdd(activity, task);
@ -77,6 +77,31 @@ public class DateChangedAlerts {
d.show(); d.show();
} }
public static void showRepeatChangedDialog(final AstridActivity activity, Task task) {
if (!Preferences.getBoolean(PREF_SHOW_HELPERS, true))
return;
final Dialog d = new Dialog(activity, R.style.ReminderDialog);
d.setContentView(R.layout.astrid_reminder_view);
Button okButton = (Button) d.findViewById(R.id.reminder_complete);
okButton.setText(R.string.DLG_ok);
d.findViewById(R.id.reminder_snooze).setVisibility(View.GONE);
d.findViewById(R.id.reminder_edit).setVisibility(View.GONE);
((TextView) d.findViewById(R.id.reminder_title)).setText(activity.getString(R.string.TLA_repeat_scheduled_title, task.getValue(Task.TITLE)));
String speechBubbleText = constructSpeechBubbleTextForRepeat(activity, task);
((TextView) d.findViewById(R.id.reminder_message)).setText(speechBubbleText);
setupOkAndDismissButtons(d);
setupHideCheckbox(d);
d.setOwnerActivity(activity);
d.show();
}
public static final Property<?>[] REPEAT_RESCHEDULED_PROPERTIES = public static final Property<?>[] REPEAT_RESCHEDULED_PROPERTIES =
new Property<?>[] { new Property<?>[] {
@ -190,6 +215,11 @@ public class DateChangedAlerts {
return Html.fromHtml(fullString); return Html.fromHtml(fullString);
} }
private static String constructSpeechBubbleTextForRepeat(Context context, Task task) {
String recurrence = getRecurrenceString(context, task);
return context.getString(R.string.TLA_repeat_scheduled_speech_bubble, recurrence);
}
@SuppressWarnings("nls") @SuppressWarnings("nls")
private static String getRelativeDateAndTimeString(Context context, long date) { private static String getRelativeDateAndTimeString(Context context, long date) {
String dueString = date > 0 ? DateUtilities.getRelativeDay(context, date, false) : ""; String dueString = date > 0 ? DateUtilities.getRelativeDay(context, date, false) : "";

@ -4,6 +4,7 @@ import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.text.Editable; import android.text.Editable;
@ -170,6 +171,48 @@ public class PeopleContainer extends LinearLayout {
return people; return people;
} }
@SuppressWarnings("nls")
public JSONObject parseSharedWithAndTags(Activity activity, boolean peopleAsJSON) throws
JSONException, ParseSharedException {
JSONObject sharedWith = new JSONObject();
JSONArray peopleList = new JSONArray();
for(int i = 0; i < getChildCount(); i++) {
TextView textView = getTextView(i);
textView.setTextAppearance(activity, android.R.style.TextAppearance_Medium_Inverse);
String text = textView.getText().toString();
if(text.length() == 0)
continue;
if(text.indexOf('@') == -1)
throw new ParseSharedException(textView,
activity.getString(R.string.actfm_EPA_invalid_email, text));
if (peopleAsJSON) {
JSONObject person = PeopleContainer.createUserJson(textView);
if (person != null)
peopleList.put(person);
} else {
peopleList.put(text);
}
}
if(peopleList.length() > 0)
sharedWith.put("p", peopleList);
return sharedWith;
}
public static class ParseSharedException extends Exception {
private static final long serialVersionUID = -4135848250086302970L;
public TextView view;
public String message;
public ParseSharedException(TextView view, String message) {
this.view = view;
this.message = message;
}
}
/** /**
* Add people from JSON Array * Add people from JSON Array
* @param people * @param people

@ -287,6 +287,8 @@ public class QuickAddBar extends LinearLayout {
Uri calendarUri = GCalHelper.createTaskEvent(task, Uri calendarUri = GCalHelper.createTaskEvent(task,
activity.getContentResolver(), new ContentValues()); activity.getContentResolver(), new ContentValues());
task.setValue(Task.CALENDAR_URI, calendarUri.toString()); task.setValue(Task.CALENDAR_URI, calendarUri.toString());
Flags.set(Flags.ACTFM_SUPPRESS_SYNC);
Flags.set(Flags.GTASKS_SUPPRESS_SYNC);
taskService.save(task); taskService.save(task);
} }
@ -301,6 +303,8 @@ public class QuickAddBar extends LinearLayout {
fragment.selectCustomId(task.getId()); fragment.selectCustomId(task.getId());
if (task.getTransitory(TaskService.TRANS_QUICK_ADD_MARKUP) != null) { if (task.getTransitory(TaskService.TRANS_QUICK_ADD_MARKUP) != null) {
showAlertForMarkupTask((AstridActivity) activity, task, title); showAlertForMarkupTask((AstridActivity) activity, task, title);
} else if (!TextUtils.isEmpty(task.getValue(Task.RECURRENCE))) {
showAlertForRepeatingTask((AstridActivity) activity, task);
} }
} }
@ -317,6 +321,10 @@ public class QuickAddBar extends LinearLayout {
DateChangedAlerts.showQuickAddMarkupDialog(activity, task, originalText); DateChangedAlerts.showQuickAddMarkupDialog(activity, task, originalText);
} }
private static void showAlertForRepeatingTask(AstridActivity activity, Task task) {
DateChangedAlerts.showRepeatChangedDialog(activity, task);
}
// --- instance methods // --- instance methods
public EditText getQuickAddBox() { public EditText getQuickAddBox() {

Loading…
Cancel
Save