New ui for task edit activity

pull/14/head
Andrew Shaw 13 years ago
parent 537beaa062
commit 267d7d16f4

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="javax/xml/validation/|javax/xml/transform/dom/|javax/xml/parsers/|org/jaxp/transform/dom/|org/jaxp/transform/sax/|org/jaxp/transform/stax/|org/jaxp/transform/stream/|org/jaxp/stream/events/|org/jaxp/stream/util/|org/jaxp/parsers/|org/jaxp/stream/|org/jaxp/validation/" kind="src" path="src"/>
<classpathentry kind="src" path="abs_src"/>
<classpathentry kind="src" path="src-legacy"/>
<classpathentry kind="src" path="common-src"/>
<classpathentry excluding="com/todoroo/astrid/rmilk/EditOperationExposer.java|com/todoroo/astrid/rmilk/MilkEditActivity.java|com/todoroo/astrid/actfm/TaskFields.java|com/todoroo/astrid/actfm/ShowProjectExposer.java|com/todoroo/astrid/actfm/ProjectDetailExposer.java|com/todoroo/astrid/actfm/ProjectListActivity.java" kind="src" path="plugin-src"/>

@ -36,11 +36,4 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<linkedResources>
<link>
<name>abs_src</name>
<type>2</type>
<locationURI>PARENT_LOC/astrid/actionbarsherlock/library/src</locationURI>
</link>
</linkedResources>
</projectDescription>

@ -481,8 +481,6 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity android:name="com.todoroo.astrid.notes.EditNoteActivity"
android:theme="@style/Theme_Dialog"/>
<!-- <receiver android:name="com.todoroo.astrid.notes.EditNoteExposer">
<intent-filter>
<action android:name="com.todoroo.astrid.REQUEST_ACTIONS" />

Binary file not shown.

@ -112,9 +112,12 @@ public class EditPeopleControlSet extends PopupControlSet {
super(activity, viewLayout, displayViewLayout, title);
DependencyInjectionService.getInstance().inject(this);
this.loginRequestCode = loginRequestCode;
displayText.setText(activity.getString(R.string.TEA_control_who));
sharedWithRow = LayoutInflater.from(activity).inflate(R.layout.control_set_collaborators_display, null);
sharedWithRow = LayoutInflater.from(activity).inflate(R.layout.control_set_default_display, null);
sharedWithView = LayoutInflater.from(activity).inflate(R.layout.control_set_collaborators, null);
TextView sharedRowDisplayText = (TextView)sharedWithRow.findViewById(R.id.display_row_title);
sharedRowDisplayText.setText(activity.getString(R.string.actfm_EPA_collaborators_header));
sharedWithDialog = new Dialog(activity, ThemeService.getEditDialogTheme());
sharedWithDialog.setTitle(R.string.actfm_EPA_collaborators_header);
@ -139,7 +142,7 @@ public class EditPeopleControlSet extends PopupControlSet {
assignedList.setItemsCanFocus(false);
assignedClear = getView().findViewById(R.id.assigned_clear);
assignedDisplay = (TextView) getDisplayView().findViewById(R.id.assigned_display);
assignedDisplay = (TextView) getDisplayView().findViewById(R.id.display_row_edit);
sharedWithContainer = (PeopleContainer) getSharedWithView().findViewById(R.id.share_container);
cbFacebook = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_facebook);
cbTwitter = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_twitter);

@ -227,4 +227,4 @@ public class GCalControlSet extends PopupControlSet {
}
};
}
}
}

@ -5,28 +5,28 @@ import greendroid.widget.AsyncImageView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import org.json.JSONObject;
import android.app.ListActivity;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.format.DateUtils;
import android.text.util.Linkify;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
@ -52,10 +52,11 @@ import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.SyncV2Service.SyncResultCallback;
import com.todoroo.astrid.utility.Flags;
public class EditNoteActivity extends ListActivity {
public class EditNoteActivity extends LinearLayout {
public static final String EXTRA_TASK_ID = "task"; //$NON-NLS-1$
private static final int MENU_REFRESH_ID = Menu.FIRST;
private static final String LAST_FETCH_KEY = "task-fetch-"; //$NON-NLS-1$
private Task task;
@ -66,34 +67,40 @@ public class EditNoteActivity extends ListActivity {
@Autowired UpdateDao updateDao;
private final ArrayList<NoteOrUpdate> items = new ArrayList<NoteOrUpdate>();
private NoteAdapter adapter;
private EditText commentField;
private TextView loadingText;
private final View commentsBar;
private final View parentView;
private int commentItems = 10;
private final List<UpdatesChangedListener> listeners = new LinkedList<UpdatesChangedListener>();
public interface UpdatesChangedListener {
public void updatesChanged();
}
public EditNoteActivity(Context context, View parent, long t) {
super(context);
@Override
protected void onCreate(Bundle savedInstanceState) {
DependencyInjectionService.getInstance().inject(this);
super.onCreate(savedInstanceState);
setTheme(R.style.Theme_Dialog);
setContentView(R.layout.edit_note_activity);
setOrientation(VERTICAL);
commentsBar = parent.findViewById(R.id.updatesFooter);
parentView = parent;
findViewById(R.id.dismiss_comments).setOnClickListener(dismissCommentsListener);
loadViewForTaskID(t);
}
public void loadViewForTaskID(long t){
long taskId = getIntent().getLongExtra(EXTRA_TASK_ID, -1);
task = PluginServices.getTaskService().fetchById(taskId, Task.NOTES, Task.ID, Task.REMOTE_ID, Task.TITLE);
task = PluginServices.getTaskService().fetchById(t, Task.NOTES, Task.ID, Task.REMOTE_ID, Task.TITLE);
if(task == null) {
finish();
return;
}
setTitle(task.getValue(Task.TITLE));
setUpInterface();
setUpListAdapter();
if(actFmPreferenceService.isLoggedIn()) {
findViewById(R.id.add_comment).setVisibility(View.VISIBLE);
if(task.getValue(Task.REMOTE_ID) == 0)
refreshData(true, null);
else {
@ -111,11 +118,13 @@ public class EditNoteActivity extends ListActivity {
}
}
// --- UI preparation
private void setUpInterface() {
final View commentButton = findViewById(R.id.commentButton);
commentField = (EditText) findViewById(R.id.commentField);
final View commentButton = commentsBar.findViewById(R.id.commentButton);
commentField = (EditText) commentsBar.findViewById(R.id.commentField);
commentField.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
@ -148,19 +157,21 @@ public class EditNoteActivity extends ListActivity {
});
if(!TextUtils.isEmpty(task.getValue(Task.NOTES))) {
TextView notes = new TextView(this);
TextView notes = new TextView(getContext());
notes.setLinkTextColor(Color.rgb(100, 160, 255));
notes.setTextSize(18);
getListView().addHeaderView(notes);
notes.setText(task.getValue(Task.NOTES));
notes.setPadding(5, 10, 5, 10);
Linkify.addLinks(notes, Linkify.ALL);
}
loadingText = (TextView) findViewById(R.id.loading);
//TODO add loading text back in
// loadingText = (TextView) findViewById(R.id.loading);
loadingText = new TextView(getContext());
}
private void setUpListAdapter() {
items.clear();
this.removeAllViews();
TodorooCursor<Metadata> notes = metadataService.query(
Query.select(Metadata.PROPERTIES).where(
MetadataCriteria.byTaskAndwithKey(task.getId(),
@ -177,7 +188,7 @@ public class EditNoteActivity extends ListActivity {
if(task.getValue(Task.REMOTE_ID) > 0) {
TodorooCursor<Update> updates = updateDao.query(Query.select(Update.PROPERTIES).where(
Update.TASK.eq(task.getValue(Task.REMOTE_ID))));
Update.TASK.eq(task.getValue(Task.REMOTE_ID))));
try {
Update update = new Update();
for(updates.moveToFirst(); !updates.isAfterLast(); updates.moveToNext()) {
@ -192,7 +203,7 @@ public class EditNoteActivity extends ListActivity {
Collections.sort(items, new Comparator<NoteOrUpdate>() {
@Override
public int compare(NoteOrUpdate a, NoteOrUpdate b) {
if(a.createdAt > b.createdAt)
if(a.createdAt < b.createdAt)
return 1;
else if (a.createdAt == b.createdAt)
return 0;
@ -200,12 +211,84 @@ public class EditNoteActivity extends ListActivity {
return -1;
}
});
adapter = new NoteAdapter(this, R.id.name, items);
setListAdapter(adapter);
getListView().setSelection(items.size() - 1);
for (int i = 0; i < Math.min(items.size(), commentItems); i++) {
View notesView = this.getUpdateNotes(items.get(i), this);
this.addView(notesView);
}
if ( items.size() > commentItems) {
Button loadMore = new Button(getContext());
loadMore.setText(R.string.TEA_load_more);
loadMore.setBackgroundColor(Color.alpha(0));
loadMore.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
commentItems += 10;
setUpListAdapter();
}
});
this.addView(loadMore);
}
else if (items.size() == 0) {
TextView noUpdates = new TextView(getContext());
noUpdates.setText(R.string.TEA_no_activity);
noUpdates.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
noUpdates.setPadding(10, 10, 10, 10);
noUpdates.setGravity(Gravity.CENTER);
noUpdates.setTextSize(20);
this.addView(noUpdates);
}
for (UpdatesChangedListener l : listeners) {
l.updatesChanged();
}
}
public View getUpdateNotes(NoteOrUpdate note, ViewGroup parent) {
View convertView = ((Activity)getContext()).getLayoutInflater().inflate(R.layout.update_adapter_row, parent, false);
bindView(convertView, note);
return convertView;
}
/** Helper method to set the contents and visibility of each field */
public synchronized void bindView(View view, NoteOrUpdate item) {
// picture
final AsyncImageView pictureView = (AsyncImageView)view.findViewById(R.id.picture); {
if(TextUtils.isEmpty(item.picture))
pictureView.setVisibility(View.GONE);
else {
pictureView.setVisibility(View.VISIBLE);
pictureView.setUrl(item.picture);
}
}
// name
final TextView nameView = (TextView)view.findViewById(R.id.title); {
nameView.setText(item.title);
}
// description
final TextView descriptionView = (TextView)view.findViewById(R.id.description); {
descriptionView.setText(item.body);
Linkify.addLinks(descriptionView, Linkify.ALL);
}
// date
final TextView date = (TextView)view.findViewById(R.id.date); {
CharSequence dateString = DateUtils.getRelativeTimeSpanString(item.createdAt,
DateUtilities.now(), DateUtils.MINUTE_IN_MILLIS,
DateUtils.FORMAT_ABBREV_RELATIVE);
date.setText(dateString);
}
}
/*
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if(menu.size() > 0)
@ -219,7 +302,7 @@ public class EditNoteActivity extends ListActivity {
}
return true;
}
}*/
// --- events
@ -229,14 +312,14 @@ public class EditNoteActivity extends ListActivity {
callback = existingCallback;
else {
callback = new ProgressBarSyncResultCallback(
this, R.id.progressBar, new Runnable() {
@Override
public void run() {
setUpListAdapter();
loadingText.setText(R.string.ENA_no_comments);
loadingText.setVisibility(items.size() == 0 ? View.VISIBLE : View.GONE);
}
});
((Activity)getContext()), (ProgressBar)parentView.findViewById(R.id.progressBar), R.id.progressBar, new Runnable() {
@Override
public void run() {
setUpListAdapter();
loadingText.setText(R.string.ENA_no_comments);
loadingText.setVisibility(items.size() == 0 ? View.VISIBLE : View.GONE);
}
});
callback.started();
callback.incrementMax(100);
@ -280,6 +363,11 @@ public class EditNoteActivity extends ListActivity {
StatisticsService.reportEvent(StatisticsConstants.ACTFM_TASK_COMMENT);
}
public int numberOfComments() {
return items.size();
}
//TODO figure out what to do with menu
/*
private final OnClickListener dismissCommentsListener = new OnClickListener() {
@Override
public void onClick(View v) {
@ -299,7 +387,7 @@ public class EditNoteActivity extends ListActivity {
default: return false;
}
}
}*/
// --- adapter
@ -351,51 +439,12 @@ public class EditNoteActivity extends ListActivity {
}
}
private class NoteAdapter extends ArrayAdapter<NoteOrUpdate> {
public NoteAdapter(Context context, int textViewResourceId, List<NoteOrUpdate> list) {
super(context, textViewResourceId, list);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.update_adapter_row, parent, false);
}
bindView(convertView, items.get(position));
return convertView;
}
/** Helper method to set the contents and visibility of each field */
public synchronized void bindView(View view, NoteOrUpdate item) {
// picture
final AsyncImageView pictureView = (AsyncImageView)view.findViewById(R.id.picture); {
if(TextUtils.isEmpty(item.picture))
pictureView.setVisibility(View.GONE);
else {
pictureView.setVisibility(View.VISIBLE);
pictureView.setUrl(item.picture);
}
}
// name
final TextView nameView = (TextView)view.findViewById(R.id.title); {
nameView.setText(item.title);
}
// description
final TextView descriptionView = (TextView)view.findViewById(R.id.description); {
descriptionView.setText(item.body);
Linkify.addLinks(descriptionView, Linkify.ALL);
}
public void addListener(UpdatesChangedListener listener) {
listeners.add(listener);
}
// date
final TextView date = (TextView)view.findViewById(R.id.date); {
CharSequence dateString = DateUtils.getRelativeTimeSpanString(item.createdAt,
DateUtilities.now(), DateUtils.MINUTE_IN_MILLIS,
DateUtils.FORMAT_ABBREV_RELATIVE);
date.setText(dateString);
}
}
public void removeListener(UpdatesChangedListener listener) {
if (listeners.contains(listener))
listeners.remove(listener);
}
}

@ -65,6 +65,7 @@ public class ProducteevControlSet extends PopupControlSet {
DependencyInjectionService.getInstance().inject(this);
this.activity = activity;
this.displayText.setText(activity.getString(R.string.producteev_TEA_control_set_display));
//view = LayoutInflater.from(activity).inflate(R.layout.producteev_control, parent, true);

@ -4,6 +4,8 @@ import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import android.app.Activity;
import android.app.Dialog;
@ -70,6 +72,13 @@ public class RepeatControlSet extends PopupControlSet {
private final CompoundButton[] daysOfWeek = new CompoundButton[7];
private Task model;
private final List<RepeatChangedListener> listeners = new LinkedList<RepeatChangedListener>();
public interface RepeatChangedListener {
public void RepeatChanged(boolean repeat);
}
@Autowired
ExceptionService exceptionService;
@ -82,7 +91,6 @@ public class RepeatControlSet extends PopupControlSet {
DependencyInjectionService.getInstance().inject(this);
this.activity = activity;
value = (Button) getView().findViewById(R.id.repeatValue);
interval = (Spinner) getView().findViewById(R.id.repeatInterval);
type = (Spinner) getView().findViewById(R.id.repeatType);
@ -167,6 +175,16 @@ public class RepeatControlSet extends PopupControlSet {
}
public void addListener(RepeatChangedListener listener) {
listeners.add(listener);
}
public void removeListener(RepeatChangedListener listener) {
if (listeners.contains(listener))
listeners.remove(listener);
}
@SuppressWarnings("nls")
@Override
public void readFromTask(Task task) {
@ -306,7 +324,7 @@ public class RepeatControlSet extends PopupControlSet {
@Override
protected void refreshDisplayView() {
TextView repeatDisplay = (TextView) getDisplayView().findViewById(R.id.repeat_display);
TextView repeatDisplay = (TextView) getDisplayView().findViewById(R.id.display_row_edit);
if (doRepeat) {
repeatDisplay.setText(R.string.repeat_enabled);
} else {
@ -322,6 +340,10 @@ public class RepeatControlSet extends PopupControlSet {
public void onClick(DialogInterface d, int which) {
doRepeat = true;
okListener.onClick(d, which);
for (RepeatChangedListener l : listeners) {
l.RepeatChanged(doRepeat);
}
}
};
final Dialog d = super.buildDialog(title, doRepeatButton, cancelListener);
@ -332,9 +354,14 @@ public class RepeatControlSet extends PopupControlSet {
doRepeat = false;
refreshDisplayView();
DialogUtilities.dismissDialog(activity, d);
for (RepeatChangedListener l : listeners) {
l.RepeatChanged(doRepeat);
}
}
};
getView().findViewById(R.id.edit_dont_repeat).setOnClickListener(dontRepeatButton);
return d;
}
}

@ -70,7 +70,8 @@ public final class TagsControlSet extends PopupControlSet {
this.newTags = (LinearLayout) getView().findViewById(R.id.newTags);
tagsDisplay = (TextView) getDisplayView().findViewById(R.id.tags_display);
tagsDisplay = (TextView) getDisplayView().findViewById(R.id.display_row_edit);
this.displayText.setText(activity.getString(R.string.TEA_tags_label));
}
private Tag[] getTagArray() {

@ -24,6 +24,7 @@ public class TimerControlSet extends PopupControlSet implements TimerStoppedList
public TimerControlSet(final Activity activity, int viewLayout, int displayViewLayout, int title) {
super(activity, viewLayout, displayViewLayout, title);
this.displayText.setText(activity.getString(R.string.TEA_timer_controls));
estimated = new TimeDurationTaskEditControlSet(activity, getView(), Task.ESTIMATED_SECONDS,
R.id.estimatedDuration, 0, R.string.DLG_hour_minutes
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -0,0 +1,34 @@
<?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">
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/custom_tab_indicator_unselected_pressed" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/custom_tab_indicator_selected" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/custom_tab_indicator_unselected_focused" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/custom_tab_indicator_selected" />
<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/custom_tab_indicator_unselected" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/custom_tab_indicator_selected" />
<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/custom_tab_indicator_unselected" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/custom_tab_indicator_selected" />
</selector>

@ -1,15 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="#ffffff"/>
<gradient
android:startColor="#eeeeee"
android:endColor="#ffffff"
android:angle="270"
android:height="20dp" />
<stroke
android:color="@android:color/darker_gray"
android:color="#bbbbbf"
android:width="1dip" />
<corners
android:radius="4dp"/>
<!-- android:topRightRadius="4dp"
android:bottomLeftRadius="4dp" />-->
<size android:width="40dip"
android:height="40dip"/>
<size android:width="45dip"
android:height="45dip"/>
</shape>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/importance_1" />
<corners
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp" />
</shape>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/importance_2" />
<corners
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp" />
</shape>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/importance_3" />
<corners
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp" />
</shape>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/importance_4" />
<corners
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp" />
</shape>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/importance_5" />
<corners
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp" />
</shape>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/importance_6" />
<corners
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp" />
</shape>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Bottom 2dp Shadow -->
<item>
<shape android:shape="rectangle" >
<gradient
android:endColor="#eeeeee"
android:startColor="#d8d8d8" />
<corners android:radius="4dp" />
</shape>
</item>
<item android:bottom="2dp" android:right="1dp">
<shape android:shape="rectangle" >
<solid android:color="#ffffff" />
<corners android:radius="4dp" />
</shape>
</item>
</layer-list>

@ -45,8 +45,8 @@
/>
</LinearLayout>
<View
android:id="@+id/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/collaborators_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_share"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/actfm_EPA_collaborators_header"
style="@style/TextAppearance.GEN_EditLabel" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:maxLines="2"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/repeat_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_when"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/TEA_when_header_label"
style="@style/TextAppearance.GEN_EditLabel.DLG_EditLabel" />
<TextView
android:id="@+id/deadline_display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -3,37 +3,36 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Assigned to -->
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/display_row_body"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_who"/>
<TextView
android:id="@+id/display_row_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_EPA_assign_label" />
style="@style/TextAppearance.GEN_EditLabel" />
<TextView
android:id="@+id/assigned_display"
android:id="@+id/display_row_edit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|right"
android:gravity="right"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
<View
android:id="@+id/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/hide_until_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_hide"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/TEA_hideUntil_label"
style="@style/TextAppearance.GEN_EditLabel.DLG_EditLabel" />
<TextView
android:id="@+id/hide_until_display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:maxLines="2"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -12,12 +12,11 @@
android:paddingBottom="5dip"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:layout_height="50dip">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_priority"/>
<TextView
android:id="@+id/importance_label"
android:id="@+id/display_row_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_importance_label"
@ -29,9 +28,9 @@
</LinearLayout>
<View
android:id="@+id/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -1,40 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/notes_body"
android:layout_width="fill_parent"
android:minHeight="50dip"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_notes"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/TEA_note_label"
style="@style/TextAppearance.GEN_EditLabel" />
<com.todoroo.astrid.ui.TextViewWithMeasureListener
android:id="@+id/notes_display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- tags -->
<LinearLayout
android:id="@+id/notes_body"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="50dip"
android:orientation="horizontal"
android:paddingLeft="10dip"
android:paddingRight="10dip" >
<TextView
android:id="@+id/display_row_title"
style="@style/TextAppearance.GEN_EditLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/TEA_note_label" />
<com.todoroo.astrid.ui.TextViewWithMeasureListener
android:id="@+id/notes_display"
style="@style/TextAppearance.EditRowDisplay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:paddingLeft="10dip" />
</LinearLayout>
<View
android:id="@+id/TEA_Separator"
style="@style/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1px" />
</LinearLayout>

@ -10,6 +10,8 @@
android:id="@+id/opencrx_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
@ -19,9 +21,9 @@
style="@style/TextAppearance.GEN_EditLabel" />
</LinearLayout>
<View
android:id="@+id/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/producteev_display_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/producteev_TEA_control_set_display"
style="@style/TextAppearance.GEN_EditLabel" />
<TextView
android:id="@+id/producteev_display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:maxLines="2"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/reminders_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_reminders"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/TEA_reminders_group_label"
style="@style/TextAppearance.GEN_EditLabel" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:maxLines="2"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -15,7 +15,7 @@
style="@style/EditRowImage"
android:src="@drawable/icn_edit_repeats"/>
<TextView
android:id="@+id/repeat_display"
android:id="@+id/display_row_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/tags_display_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_lists"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/TEA_tags_label"
style="@style/TextAppearance.GEN_EditLabel" />
<TextView
android:id="@+id/tags_display"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:maxLines="2"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- tags -->
<LinearLayout
android:id="@+id/reminders_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical">
<ImageView
style="@style/EditRowImage"
android:src="@drawable/icn_edit_timer"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:text="@string/TEA_timer_controls"
style="@style/TextAppearance.GEN_EditLabel" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:maxLines="2"
android:paddingLeft="10dip"
style="@style/TextAppearance.EditRowDisplay" />
<include layout="@layout/task_edit_arrow"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -9,23 +9,31 @@
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:layout_marginBottom="14dip"
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip"
android:gravity="center_vertical">
<RelativeLayout android:id="@+id/rowBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<!-- completion check-box -->
<CheckBox android:id="@+id/completeBox"
android:layout_width="45dip"
android:layout_height="45dip"
android:layout_marginTop="4dip"
android:layout_marginLeft="3dip"
android:layout_gravity="top"
android:button="@drawable/btn_check"/>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100"
android:background="@drawable/edit_title_background">
<ImageView
android:id="@+id/importance"
android:paddingTop="1dip"
android:paddingBottom="1dip"
android:layout_marginLeft="1dip"
android:layout_width="4dip"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<com.todoroo.astrid.ui.ErrorCatchingEditText
android:id="@+id/title"
android:layout_width="fill_parent"
@ -33,9 +41,8 @@
android:layout_weight="100"
android:hint="@string/TEA_title_hint"
android:autoText="true"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:paddingLeft="5dip"
android:paddingTop="10dip"
android:paddingLeft="10dip"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:text=""
@ -43,13 +50,17 @@
android:capitalize="sentences"
android:freezesText="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="40dip"
android:layout_height="35dip"
android:layout_marginLeft="5dip"
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_weight="1">
android:layout_weight="1"
android:visibility="gone">
<Button
android:id="@+id/timer_button"
android:layout_width="25dip"
@ -76,10 +87,4 @@
</LinearLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>

@ -48,9 +48,9 @@
</LinearLayout>
<View
android:id="@+id/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>
</ScrollView>

@ -1,78 +0,0 @@
<?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:orientation="vertical"
android:background="@drawable/background_gradient">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="fill_parent"
android:layout_height="5dip"
style="@android:style/Widget.ProgressBar.Horizontal"
android:visibility="gone"
android:layout_weight="1" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100">
<TextView
android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100"
android:gravity="center"
android:visibility="gone"
android:text="@string/DLG_loading"
android:textSize="20sp" />
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100" />
</FrameLayout>
<!-- Footer -->
<LinearLayout
android:id="@+id/add_comment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone"
android:orientation="horizontal">
<!-- Add Button -->
<ImageButton android:id="@+id/commentButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="gone"
android:src="@drawable/tango_chat"
android:scaleType="fitCenter"/>
<!-- Comment Field -->
<EditText android:id="@+id/commentField"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="100"
android:hint="@string/TVA_add_comment"
android:singleLine="true"
android:autoText="true"
android:capitalize="sentences"/>
</LinearLayout>
<Button android:id="@+id/dismiss_comments"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_weight="1"
android:gravity="center"
android:text="@string/DLG_dismiss" />
</LinearLayout>

@ -84,4 +84,4 @@
android:layout_marginLeft="5dip"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>

@ -1,67 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:id="@+id/taskEditParent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/Content">
<ScrollView
android:id="@+id/edit_scroll"
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/Content">
<LinearLayout
android:orientation="vertical"
android:padding="10dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/basic_controls"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/more_header"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_gravity="center_vertical"
android:gravity="center"
style="@style/TextAppearance.EditRowDisplay"
android:textStyle="bold"
android:text="@string/TEA_more"/>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
style="@style/TEA_Separator" />
</LinearLayout>
<LinearLayout
android:id="@+id/more_controls"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:id="@+id/taskEditParent"
style="@style/Content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/edit_scroll"
style="@style/Content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100"
android:background="#f7f3f7" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="600dip"
android:orientation="vertical"
android:padding="10dip" >
<LinearLayout
android:id="@+id/title_controls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="3dip"
android:background="@drawable/task_edit_background"
android:orientation="vertical"
android:paddingRight="6dip" >
</LinearLayout>
<LinearLayout
android:id="@+id/basic_controls"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="3dip"
android:layout_marginTop="10dip"
android:background="@drawable/task_edit_background"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:id="@+id/more_header"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/task_edit_background"
android:visibility="gone" >
-
<TextView
style="@style/TextAppearance.EditRowDisplay"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_gravity="center_vertical"
android:gravity="center"
android:text="@string/TEA_more"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/more_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="3dip"
android:layout_marginBottom="0dip"
android:background="@drawable/task_edit_background"
android:orientation="vertical"
android:visibility="gone">
<com.viewpagerindicator.TabPageIndicator
android:id="@+id/indicator"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/progressBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="0dip"
android:layout_height="1dip"
android:layout_weight="1"
android:visibility="gone" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<!-- Footer -->
<LinearLayout
android:id="@+id/updatesFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/footer_background"
android:minHeight="47dip"
android:orientation="horizontal"
android:padding="3dip" >
<!-- Voice Add Button -->
<ImageButton
android:id="@+id/picture"
android:layout_width="39dip"
android:layout_height="39dip"
android:layout_gravity="top"
android:layout_marginRight="3dip"
android:layout_weight="1"
android:background="@drawable/footer_button"
android:paddingBottom="2dip"
android:paddingLeft="7dip"
android:paddingRight="7dip"
android:scaleType="fitCenter"
android:src="@drawable/icn_camera" />
<!-- Quick Add Task -->
<EditText
android:id="@+id/commentField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:layout_weight="100"
android:autoText="true"
android:background="@drawable/footer_edittext"
android:capitalize="sentences"
android:hint="@string/TVA_add_comment"
android:textSize="16sp" />
<!-- Extended Add Button -->
<ImageButton
android:id="@+id/commentButton"
android:layout_width="wrap_content"
android:layout_height="39dip"
android:layout_gravity="top"
android:layout_marginRight="3dip"
android:layout_weight="1"
android:background="@drawable/footer_button"
android:scaleType="center"
android:src="@drawable/ic_footer_add" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/more_controls"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/task_edit_background"
android:padding="5dip"
android:layout_margin="3dip"
android:layout_marginTop="10dip" >
</LinearLayout>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<com.todoroo.astrid.ui.TaskEditMoreControls xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/more_controls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</com.todoroo.astrid.ui.TaskEditMoreControls>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<View
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="1dp"
style="@style/TEA_Separator" />

@ -73,5 +73,12 @@
android:visibility="gone"
astrid:defaultSrc="@android:drawable/ic_menu_gallery"
android:scaleType="fitCenter"/>
<View
android:id="@+id/TEA_Separator"
style="@style/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1px" />
</LinearLayout>

@ -24,7 +24,7 @@
<color name="task_edit_selected">#438cb6</color>
<color name="task_edit_details">#0b78a5</color>
<color name="task_edit_details">#c60f1a</color>
<color name="task_edit_deadline_gray">#888888</color>
<color name="red_text_color">#d00000</color>

@ -349,7 +349,18 @@
<!-- placeholder string for info about translators (i.e. YOU!) -->
<string name="about_translators"></string>
<string-array name="TEA_control_sets">
<string-array name="TEA_control_sets_beast">
<item >@string/TEA_control_who</item>
<item >@string/TEA_control_when</item>
<item >@string/TEA_control_more_section</item>
<item >@string/TEA_control_importance</item>
<item >@string/TEA_control_lists</item>
<item >@string/TEA_control_notes</item>
<item >@string/TEA_control_reminders</item>
<item >@string/TEA_control_timer</item>
<item >@string/TEA_control_share</item>
</string-array><string-array name="TEA_control_sets">
<item>@string/TEA_control_title</item>
<item>@string/TEA_control_who</item>
<item>@string/TEA_control_when</item>
@ -375,7 +386,7 @@
<string name="TEA_ctrl_share_pref">TEA_ctrl_share_pref</string>
<string-array name="TEA_control_sets_prefs">
<item>@string/TEA_ctrl_title_pref</item>
<item>@string/TEA_ctrl_who_pref</item>
<item>@string/TEA_ctrl_when_pref</item>
<item>@string/TEA_ctrl_more_pref</item>
@ -387,4 +398,5 @@
<item>@string/TEA_ctrl_share_pref</item>
</string-array>
</resources>

@ -378,6 +378,12 @@
<!-- More row -->
<string name="TEA_more">More</string>
<!-- Text when no activity to show -->
<string name="TEA_no_activity">No Activity to Show.</string>
<!-- Text to load more activity -->
<string name="TEA_load_more">Load more...</string>
<!-- When controls dialog -->
<string name="TEA_when_dialog_title">When is this due?</string>

@ -24,6 +24,8 @@
<item name="abDisplayOptions">useLogo|showHome|showTitle</item>
<item name="abLogo">@drawable/icon_48</item>
<item name="asAbTextColor">@android:color/darker_gray</item>
<item name="vpiTabPageIndicatorStyle">@style/CustomTabPageIndicator</item>
<item name="vpiTabTextStyle">@style/CustomTabPageIndicator.Text</item>
</style>
<style name="Theme.Transparent" parent="@style/Theme">
@ -152,7 +154,7 @@
<!-- generic style for labels above edit boxes -->
<style name="TextAppearance.GEN_EditLabel">
<item name="android:textSize">14sp</item>
<item name="android:textSize">15sp</item>
<item name="android:textStyle">bold</item>
</style>
@ -308,6 +310,9 @@
<item name="android:textSize">14sp</item>
<item name="android:textColor">@android:color/black</item>
</style>
<!-- ========================================================= ViewPager == -->
<style name="CustomCirclePageIndicator">
<item name="fillColor">#333333</item>
<item name="strokeColor">#333333</item>
@ -316,4 +321,16 @@
<item name="centered">true</item>
<item name="android:background">#333333</item>
</style>
<style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:background">@drawable/custom_tab_indicator</item>
</style>
<style name="CustomTabPageIndicator.Text" parent="Widget.TabPageIndicator.Text">
<item name="android:textColor">#FF555555</item>
<item name="android:textSize">15sp</item>
<item name="android:textStyle">bold</item>
<item name="android:layout_marginLeft">5dip</item>
<item name="android:layout_marginRight">5dip</item>
</style>
</resources>

@ -52,7 +52,8 @@ public class BeastModePreferenceActivity extends ListActivity {
ArrayList<String> defaults = new ArrayList<String>();
String[] defaultOrder = context.getResources().getStringArray(R.array.TEA_control_sets);
for (String s : defaultOrder) {
for (int i = 1; i < defaultOrder.length; i++) {
String s = defaultOrder[i];
if (s.contains(BEAST_MODE_MORE_ITEM_SPECIAL_CHAR)) {
String[] split = s.split(BEAST_MODE_MORE_ITEM_SPECIAL_CHAR);
for (String component : split) {
@ -68,6 +69,7 @@ public class BeastModePreferenceActivity extends ListActivity {
ArrayList<String> setOrder = new ArrayList<String>();
String[] setOrderArray = setPref.split(BEAST_MODE_PREF_ITEM_SEPARATOR);
for (String s : setOrderArray) {
setOrder.add(s);
}
@ -118,7 +120,10 @@ public class BeastModePreferenceActivity extends ListActivity {
items = new ArrayList<String>();
for (String s : itemsArray) {
if (!s.equals(getResources().getString(R.string.TEA_control_title))){
items.add(s);
}
}
adapter = new ArrayAdapter<String>(this, R.layout.preference_draggable_row, R.id.text, items) {

@ -39,21 +39,26 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.SupportActivity;
import android.support.v4.view.Menu;
import android.support.v4.view.MenuItem;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.timsu.astrid.R;
@ -94,17 +99,20 @@ import com.todoroo.astrid.ui.EditTitleControlSet;
import com.todoroo.astrid.ui.HideUntilControlSet;
import com.todoroo.astrid.ui.ImportanceControlSet;
import com.todoroo.astrid.ui.ReminderControlSet;
import com.todoroo.astrid.ui.TaskEditMoreControls;
import com.todoroo.astrid.voice.VoiceInputAssistant;
import com.viewpagerindicator.TabPageIndicator;
/**
* This activity is responsible for creating new tasks and editing existing
* ones. It saves a task when it is paused (screen rotated, back button
* pressed) as long as the task has a title.
* ones. It saves a task when it is paused (screen rotated, back button pressed)
* as long as the task has a title.
*
* @author timsu
*
*/
public final class TaskEditActivity extends Fragment {
public final class TaskEditActivity extends Fragment implements
ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
public static final String TAG_TASKEDIT_FRAGMENT = "taskedit_fragment";
@ -164,6 +172,9 @@ public final class TaskEditActivity extends Fragment {
// --- services
public static final int TAB_VIEW_UPDATES = 0;
public static final int TAB_VIEW_MORE = 1;
@Autowired
private ExceptionService exceptionService;
@ -182,7 +193,7 @@ public final class TaskEditActivity extends Fragment {
@Autowired
private ActFmPreferenceService actFmPreferenceService;
// --- UI components
// --- UI components
private ImageButton voiceAddNoteButton;
@ -191,23 +202,27 @@ public final class TaskEditActivity extends Fragment {
private HideUntilControlSet hideUntilControls = null;
private TagsControlSet tagsControlSet = null;
private EditText title;
private TaskEditMoreControls moreControls;
private EditNoteActivity editNotes;
private ViewPager mPager;
private TaskEditViewPager mAdapter;
private TabPageIndicator mIndicator;
private final List<TaskEditControlSet> controls =
Collections.synchronizedList(new ArrayList<TaskEditControlSet>());
private final List<TaskEditControlSet> controls = Collections.synchronizedList(new ArrayList<TaskEditControlSet>());
// --- other instance variables
// --- other instance variables
/** true if editing started with a new task */
boolean isNewTask = false;
/** task model */
Task model = null;
/** task model */
Task model = null;
/** whether task should be saved when this activity exits */
private boolean shouldSaveState = true;
/** whether task should be saved when this activity exits */
private boolean shouldSaveState = true;
/** edit control receiver */
private final ControlReceiver controlReceiver = new ControlReceiver();
/** edit control receiver */
private final ControlReceiver controlReceiver = new ControlReceiver();
/** voice assistant for notes-creation */
private VoiceInputAssistant voiceNoteAssistant;
@ -220,24 +235,30 @@ public final class TaskEditActivity extends Fragment {
// --- fragment handling variables
OnTaskEditDetailsClickedListener mListener;
private boolean mDualFragments = false;
/* ======================================================================
private long remoteId = 0;
/*
* ======================================================================
* ======================================================= initialization
* ====================================================================== */
* ======================================================================
*/
/** Container Activity must implement this interface and we ensure
* that it does during the onAttach() callback
/**
* Container Activity must implement this interface and we ensure that it
* does during the onAttach() callback
*/
public interface OnTaskEditDetailsClickedListener {
public void onTaskEditDetailsClicked(int category, int position);
}
@Override
public void onAttach(SupportActivity activity) {
super.onAttach(activity);
// Check that the container activity has implemented the callback interface
// Check that the container activity has implemented the callback
// interface
try {
mListener = (OnTaskEditDetailsClickedListener) activity;
} catch (ClassCastException e) {
@ -250,34 +271,37 @@ public final class TaskEditActivity extends Fragment {
DependencyInjectionService.getInstance().inject(this);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new StartupService().onStartupApplication(getActivity());
new StartupService().onStartupApplication(getActivity());
// if we were editing a task already, restore it
if(savedInstanceState != null && savedInstanceState.containsKey(TASK_IN_PROGRESS)) {
Task task = savedInstanceState.getParcelable(TASK_IN_PROGRESS);
if(task != null) {
model = task;
}
}
// if we were editing a task already, restore it
if (savedInstanceState != null
&& savedInstanceState.containsKey(TASK_IN_PROGRESS)) {
Task task = savedInstanceState.getParcelable(TASK_IN_PROGRESS);
if (task != null) {
model = task;
}
}
getActivity().setResult(Activity.RESULT_OK);
getActivity().setResult(Activity.RESULT_OK);
}
/* ======================================================================
/*
* ======================================================================
* ==================================================== UI initialization
* ====================================================================== */
* ======================================================================
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.task_edit_activity,
container, false);
View v = inflater.inflate(R.layout.task_edit_activity, container, false);
return v;
}
@ -287,26 +311,89 @@ public final class TaskEditActivity extends Fragment {
super.onActivityCreated(savedInstanceState);
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
getSupportActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(
true);
Fragment tasklistFrame = getFragmentManager().findFragmentByTag(TaskListActivity.TAG_TASKLIST_FRAGMENT);
Fragment tasklistFrame = getFragmentManager().findFragmentByTag(
TaskListActivity.TAG_TASKLIST_FRAGMENT);
mDualFragments = (tasklistFrame != null) && tasklistFrame.isInLayout();
setUpUIComponents();
adjustInfoPopovers();
overrideFinishAnim = getActivity().getIntent().getBooleanExtra(OVERRIDE_FINISH_ANIM, true);
overrideFinishAnim = getActivity().getIntent().getBooleanExtra(
OVERRIDE_FINISH_ANIM, true);
// disable keyboard until user requests it
AndroidUtilities.suppressVirtualKeyboard(title);
}
private void loadMoreContainer() {
View more_tab = (View) getView().findViewById(R.id.more_container);
View more_container = (View) getView().findViewById(R.id.more_header);
View commentsBar = (View) getView().findViewById(R.id.updatesFooter);
if (moreControls.getParent() != null) {
((ViewGroup) moreControls.getParent()).removeView(moreControls);
}
if (remoteId > 0) {
if (mAdapter == null) {
mAdapter = new TaskEditViewPager(getActivity());
mAdapter.parent = this;
mPager = (ViewPager) getView().findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mIndicator = (TabPageIndicator) getView().findViewById(
R.id.indicator);
mIndicator.setViewPager(mPager);
mIndicator.setOnPageChangeListener(this);
long idParam = getActivity().getIntent().getLongExtra(TOKEN_ID,
-1L);
editNotes = new EditNoteActivity(getActivity(), getView(),
idParam);
editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
if (editNotes.numberOfComments() == 0) {
setCurrentTab(TAB_VIEW_MORE);
} else {
setPagerHeightForPosition(TAB_VIEW_UPDATES);
}
editNotes.addListener(this);
}
commentsBar.setVisibility(View.VISIBLE);
more_tab.setVisibility(View.VISIBLE);
more_container.setVisibility(View.GONE);
} else {
more_container.setVisibility(View.VISIBLE);
more_tab.setVisibility(View.GONE);
commentsBar.setVisibility(View.GONE);
}
}
private void setCurrentTab(int position) {
mIndicator.setCurrentItem(position);
mPager.setCurrentItem(position);
}
/** Initialize UI components */
private void setUpUIComponents() {
LinearLayout basicControls = (LinearLayout) getView().findViewById(R.id.basic_controls);
LinearLayout whenDialogView = (LinearLayout) LayoutInflater.from(getActivity()).inflate(
R.layout.task_edit_when_controls, null);
LinearLayout moreControls = (LinearLayout) getView().findViewById(R.id.more_controls);
LinearLayout basicControls = (LinearLayout) getView().findViewById(
R.id.basic_controls);
LinearLayout titleControls = (LinearLayout) getView().findViewById(
R.id.title_controls);
LinearLayout whenDialogView = (LinearLayout) LayoutInflater.from(
getActivity()).inflate(R.layout.task_edit_when_controls, null);
moreControls = (TaskEditMoreControls) LayoutInflater.from(getActivity()).inflate(
R.layout.task_edit_more_controls, null);
constructWhenDialog(whenDialogView);
@ -317,43 +404,44 @@ public final class TaskEditActivity extends Fragment {
R.layout.control_set_title, Task.TITLE, R.id.title);
title = (EditText) editTitle.getView().findViewById(R.id.title);
controls.add(editTitle);
controlSetMap.put(getString(R.string.TEA_ctrl_title_pref), editTitle);
titleControls.addView(editTitle.getDisplayView());
TimerActionControlSet timerAction = new TimerActionControlSet(getActivity(),
editTitle.getView());
TimerActionControlSet timerAction = new TimerActionControlSet(
getActivity(), editTitle.getView());
controls.add(timerAction);
controls.add(peopleControlSet = new EditPeopleControlSet(
getActivity(), R.layout.control_set_assigned,
R.layout.control_set_assigned_display,
controls.add(peopleControlSet = new EditPeopleControlSet(getActivity(),
R.layout.control_set_assigned,
R.layout.control_set_default_display,
R.string.actfm_EPA_assign_label, REQUEST_LOG_IN));
controlSetMap.put(getString(R.string.TEA_ctrl_who_pref),
peopleControlSet);
RepeatControlSet repeatControls = new RepeatControlSet(
getActivity(), R.layout.control_set_repeat,
RepeatControlSet repeatControls = new RepeatControlSet(getActivity(),
R.layout.control_set_repeat,
R.layout.control_set_repeat_display, R.string.repeat_enabled);
GCalControlSet gcalControl = new GCalControlSet(getActivity(),
R.layout.control_set_gcal, R.layout.control_set_gcal_display,
R.string.gcal_TEA_addToCalendar_label);
//The deadline control set contains the repeat controls and the calendar controls.
//NOTE: we add the gcalControl and repeatControl to the list AFTER the deadline control, because
//otherwise the correct date may not be written to the calendar event. Order matters!
// The deadline control set contains the repeat controls and the
// calendar controls.
// NOTE: we add the gcalControl and repeatControl to the list AFTER the
// deadline control, because
// otherwise the correct date may not be written to the calendar event.
// Order matters!
DeadlineControlSet deadlineControl = new DeadlineControlSet(
getActivity(), R.layout.control_set_deadline,
R.layout.control_set_deadline_display, repeatControls.getDisplayView(), gcalControl.getDisplayView());
R.layout.control_set_default_display,
repeatControls.getDisplayView(), gcalControl.getDisplayView());
controlSetMap.put(getString(R.string.TEA_ctrl_when_pref),
deadlineControl);
controls.add(deadlineControl);
controlSetMap.put(getString(R.string.TEA_ctrl_when_pref), deadlineControl);
controls.add(repeatControls);
repeatControls.addListener(editTitle);
controls.add(gcalControl);
hideUntilControls = new HideUntilControlSet(getActivity(),
R.layout.control_set_hide, R.layout.control_set_hide_display,
R.string.hide_until_prompt);
controls.add(hideUntilControls);
ImportanceControlSet importanceControl = new ImportanceControlSet(
getActivity(), R.layout.control_set_importance);
controls.add(importanceControl);
@ -362,8 +450,8 @@ public final class TaskEditActivity extends Fragment {
importanceControl);
tagsControlSet = new TagsControlSet(getActivity(),
R.layout.control_set_tags, R.layout.control_set_tags_display,
R.string.TEA_tags_label);
R.layout.control_set_tags,
R.layout.control_set_default_display, R.string.TEA_tags_label);
controls.add(tagsControlSet);
controlSetMap.put(getString(R.string.TEA_ctrl_lists_pref),
tagsControlSet);
@ -378,28 +466,32 @@ public final class TaskEditActivity extends Fragment {
ReminderControlSet reminderControl = new ReminderControlSet(
getActivity(), R.layout.control_set_reminders,
R.layout.control_set_reminders_display);
R.layout.control_set_default_display);
controls.add(reminderControl);
controlSetMap.put(getString(R.string.TEA_ctrl_reminders_pref),
reminderControl);
hideUntilControls = new HideUntilControlSet(getActivity(),
R.layout.control_set_hide, R.layout.control_set_hide_display,
R.layout.control_set_hide,
R.layout.control_set_default_display,
R.string.hide_until_prompt);
controls.add(hideUntilControls);
reminderControl.addViewToBody(hideUntilControls.getDisplayView());
TimerControlSet timerControl = new TimerControlSet(
getActivity(), R.layout.control_set_timers,
R.layout.control_set_timers_extras_display,
TimerControlSet timerControl = new TimerControlSet(getActivity(),
R.layout.control_set_timers,
R.layout.control_set_default_display,
R.string.TEA_timer_controls);
timerAction.setListener(timerControl);
controls.add(timerControl);
controlSetMap.put(getString(R.string.TEA_ctrl_timer_pref), timerControl);
try {
if(ProducteevUtilities.INSTANCE.isLoggedIn()) {
ProducteevControlSet producteevControl = new ProducteevControlSet(getActivity(), R.layout.control_set_producteev, R.layout.control_set_producteev_display, R.string.producteev_TEA_control_set_display);
if (ProducteevUtilities.INSTANCE.isLoggedIn()) {
ProducteevControlSet producteevControl = new ProducteevControlSet(
getActivity(), R.layout.control_set_producteev,
R.layout.control_set_default_display,
R.string.producteev_TEA_control_set_display);
controls.add(producteevControl);
basicControls.addView(producteevControl.getDisplayView());
notesEditText.setHint(R.string.producteev_TEA_notes);
@ -409,8 +501,11 @@ public final class TaskEditActivity extends Fragment {
}
try {
if(OpencrxCoreUtils.INSTANCE.isLoggedIn()) {
OpencrxControlSet ocrxControl = new OpencrxControlSet(getActivity(), R.layout.control_set_opencrx, R.layout.control_set_opencrx_display, R.string.opencrx_TEA_opencrx_title);
if (OpencrxCoreUtils.INSTANCE.isLoggedIn()) {
OpencrxControlSet ocrxControl = new OpencrxControlSet(
getActivity(), R.layout.control_set_opencrx,
R.layout.control_set_opencrx_display,
R.string.opencrx_TEA_opencrx_title);
controls.add(ocrxControl);
basicControls.addView(ocrxControl.getDisplayView());
notesEditText.setHint(R.string.opencrx_TEA_notes);
@ -424,57 +519,77 @@ public final class TaskEditActivity extends Fragment {
if (orderPreference != null)
itemOrder = orderPreference.split(BeastModePreferenceActivity.BEAST_MODE_PREF_ITEM_SEPARATOR);
else
itemOrder = getResources().getStringArray(R.array.TEA_control_sets_prefs);
itemOrder = getResources().getStringArray(
R.array.TEA_control_sets_prefs);
String moreSectionTrigger = getString(R.string.TEA_ctrl_more_pref);
String shareViewDescriptor = getString(R.string.TEA_ctrl_share_pref);
String titleViewDescriptor = getString(R.string.TEA_ctrl_title_pref);
LinearLayout section = basicControls;
int controlWidth = basicControls.getLayoutParams().width;
for (int i = 0; i < itemOrder.length; i++) {
String item = itemOrder[i];
if (item.equals(moreSectionTrigger)) {
section = moreControls;
} else {
View control_set = null;
TaskEditControlSet curr = controlSetMap.get(item);
if (item.equals(shareViewDescriptor))
section.addView(peopleControlSet.getSharedWithRow());
if (item.equals(titleViewDescriptor))
control_set = curr.getDisplayView();
else if (item.equals(shareViewDescriptor))
control_set = peopleControlSet.getSharedWithRow();
else if (curr != null)
section.addView(curr.getDisplayView());
control_set = (LinearLayout) curr.getDisplayView();
if (control_set != null) {
if ((i + 1 >= itemOrder.length || itemOrder[i + 1].equals(moreSectionTrigger))) {
removeTeaSeparator(control_set);
}
section.addView(control_set);
}
}
}
if (moreControls.getChildCount() == 0)
getView().findViewById(R.id.more_header).setVisibility(View.GONE);
// Load task data in background
new TaskEditBackgroundLoader().start();
}
private void removeTeaSeparator(View view) {
View teaSeparator = view.findViewById(R.id.TEA_Separator);
if (teaSeparator != null) {
teaSeparator.setVisibility(View.GONE);
}
}
/** Set up button listeners */
private void setUpListeners() {
final View.OnClickListener mExpandMoreListener = new View.OnClickListener() {
final Animation fadeIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
final Animation fadeOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
final Animation fadeIn = AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_in);
final Animation fadeOut = AnimationUtils.loadAnimation(
getActivity(), android.R.anim.fade_out);
@Override
public void onClick(View v) {
fadeIn.setDuration(300);
fadeOut.setDuration(300);
View moreView = getView().findViewById(R.id.more_controls);
View moreHeader = getView().findViewById(R.id.more_header);
if (moreView.getVisibility() == View.GONE) {
moreView.setVisibility(View.VISIBLE);
moreView.startAnimation(fadeIn);
moreHeader.setVisibility(View.GONE);
moreHeader.startAnimation(fadeOut);
}
LinearLayout moreHeader = (LinearLayout) getView().findViewById(
R.id.more_header);
moreHeader.removeAllViews();
moreHeader.addView(moreControls);
moreHeader.setOnClickListener(null);
}
};
// set up save, cancel, and delete buttons
try {
getView().findViewById(R.id.more_header).setOnClickListener(mExpandMoreListener);
getView().findViewById(R.id.more_header).setOnClickListener(
mExpandMoreListener);
} catch (Exception e) {
// error loading the proper activity
}
}
private void constructWhenDialog(View whenDialogView) {
@ -492,7 +607,9 @@ public final class TaskEditActivity extends Fragment {
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
whenDialog.setTitle(R.string.TEA_when_dialog_title);
whenDialog.addContentView(whenDialogView, new LayoutParams(metrics.widthPixels - (int)(30 * metrics.density), LayoutParams.WRAP_CONTENT));
whenDialog.addContentView(whenDialogView, new LayoutParams(
metrics.widthPixels - (int) (30 * metrics.density),
LayoutParams.WRAP_CONTENT));
}
/**
@ -505,36 +622,25 @@ public final class TaskEditActivity extends Fragment {
public void onUiThread() {
// prepare and set listener for voice-button
if(addOnService.hasPowerPack()) {
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(R.id.voiceAddNoteButton);
if (addOnService.hasPowerPack()) {
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(
R.id.voiceAddNoteButton);
voiceAddNoteButton.setVisibility(View.VISIBLE);
int prompt = R.string.voice_edit_note_prompt;
voiceNoteAssistant = new VoiceInputAssistant(getActivity(), voiceAddNoteButton,
notesEditText, REQUEST_VOICE_RECOG);
voiceNoteAssistant = new VoiceInputAssistant(getActivity(),
voiceAddNoteButton, notesEditText, REQUEST_VOICE_RECOG);
voiceNoteAssistant.setAppend(true);
voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voiceNoteAssistant.configureMicrophoneButton(prompt);
}
// re-read all
synchronized(controls) {
for(TaskEditControlSet controlSet : controls)
synchronized (controls) {
for (TaskEditControlSet controlSet : controls)
controlSet.readFromTask(model);
if (isNewTask) {
hideUntilControls.setDefaults();
}
autoExpand();
}
}
private void autoExpand() {
LinearLayout moreControls = (LinearLayout) getView().findViewById(R.id.more_controls);
LinearLayout moreHeader = (LinearLayout) getView().findViewById(R.id.more_header);
if (notesControlSet.hasNotes() && notesControlSet.getDisplayView().getParent() == moreControls) {
moreHeader.performClick();
} else if (tagsControlSet.hasLists() && tagsControlSet.getDisplayView().getParent() == moreControls) {
moreHeader.performClick();
}
}
@ -543,7 +649,7 @@ public final class TaskEditActivity extends Fragment {
AndroidUtilities.sleepDeep(500L);
Activity activity = getActivity();
if(activity == null)
if (activity == null)
return;
activity.runOnUiThread(new Runnable() {
@ -557,17 +663,20 @@ public final class TaskEditActivity extends Fragment {
}
}
/* ======================================================================
/*
* ======================================================================
* =============================================== model reading / saving
* ====================================================================== */
* ======================================================================
*/
/**
* Loads action item from the given intent
*
* @param intent
*/
@SuppressWarnings("nls")
protected void loadItem(Intent intent) {
if(model != null) {
if (model != null) {
// came from bundle
isNewTask = (model.getValue(Task.TITLE).length() == 0);
return;
@ -576,26 +685,30 @@ public final class TaskEditActivity extends Fragment {
long idParam = intent.getLongExtra(TOKEN_ID, -1L);
database.openForReading();
if(idParam > -1L) {
if (idParam > -1L) {
model = taskService.fetchById(idParam, Task.PROPERTIES);
if (model != null)
model.clearValue(Task.REMOTE_ID); // Having this can screw up autosync
if (model != null) {
remoteId = model.getValue(Task.REMOTE_ID);
model.clearValue(Task.REMOTE_ID); // Having this can screw up
// autosync
}
}
// not found by id or was never passed an id
if(model == null) {
if (model == null) {
String valuesAsString = intent.getStringExtra(TOKEN_VALUES);
ContentValues values = null;
try {
if(valuesAsString != null)
if (valuesAsString != null)
values = AndroidUtilities.contentValuesFromSerializedString(valuesAsString);
} catch (Exception e) {
// oops, can't serialize
}
model = TaskListActivity.createWithValues(values, null, taskService, metadataService);
model = TaskListActivity.createWithValues(values, null,
taskService, metadataService);
}
if(model.getValue(Task.TITLE).length() == 0) {
if (model.getValue(Task.TITLE).length() == 0) {
StatisticsService.reportEvent(StatisticsConstants.CREATE_TASK);
isNewTask = true;
@ -605,7 +718,7 @@ public final class TaskEditActivity extends Fragment {
StatisticsService.reportEvent(StatisticsConstants.EDIT_TASK);
}
if(model == null) {
if (model == null) {
exceptionService.reportError("task-edit-no-task",
new NullPointerException("model"));
getActivity().onBackPressed();
@ -614,6 +727,7 @@ public final class TaskEditActivity extends Fragment {
// clear notification
Notifications.cancelNotifications(model.getId());
}
/** Convenience method to populate fields after setting model to null */
@ -626,10 +740,13 @@ public final class TaskEditActivity extends Fragment {
public void populateFields(Intent intent) {
loadItem(intent);
synchronized(controls) {
for(TaskEditControlSet controlSet : controls)
synchronized (controls) {
for (TaskEditControlSet controlSet : controls)
controlSet.readFromTask(model);
}
loadMoreContainer();
}
/** Populate UI component values from the model */
@ -639,38 +756,37 @@ public final class TaskEditActivity extends Fragment {
/** Save task model from values in UI components */
public void save(boolean onPause) {
if(title == null)
if (title == null)
return;
if(title.getText().length() > 0)
if (title.getText().length() > 0)
model.setValue(Task.DELETION_DATE, 0L);
if(title.getText().length() == 0)
if (title.getText().length() == 0)
return;
StringBuilder toast = new StringBuilder();
synchronized(controls) {
for(TaskEditControlSet controlSet : controls) {
synchronized (controls) {
for (TaskEditControlSet controlSet : controls) {
String toastText = controlSet.writeToModel(model);
if(toastText != null)
if (toastText != null)
toast.append('\n').append(toastText);
}
}
String processedToast = addDueTimeToToast(toast.toString());
boolean cancelFinish = !onPause && peopleControlSet != null &&
!peopleControlSet.saveSharingSettings(processedToast);
boolean cancelFinish = !onPause && peopleControlSet != null
&& !peopleControlSet.saveSharingSettings(processedToast);
model.putTransitory("task-edit-save", true); //$NON-NLS-1$
taskService.save(model);
if (!onPause && !cancelFinish) {
if (!peopleControlSet.isAssignedToMe()) {
Intent data = new Intent();
data.putExtra(TOKEN_TASK_WAS_ASSIGNED, true);
data.putExtra(TOKEN_ASSIGNED_TO, peopleControlSet.getAssignedToString());
data.putExtra(TOKEN_ASSIGNED_TO,
peopleControlSet.getAssignedToString());
getActivity().setResult(Activity.RESULT_OK, data);
}
@ -697,17 +813,20 @@ public final class TaskEditActivity extends Fragment {
// abandon editing and delete the newly created task if
// no title was entered
if (overrideFinishAnim) {
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_right_in, R.anim.slide_right_out);
AndroidUtilities.callOverridePendingTransition(getActivity(),
R.anim.slide_right_in, R.anim.slide_right_out);
}
if(title.getText().length() == 0 && isNewTask && model.isSaved()) {
if (title.getText().length() == 0 && isNewTask && model.isSaved()) {
taskService.delete(model);
}
}
/* ======================================================================
/*
* ======================================================================
* ================================================ edit control handling
* ====================================================================== */
* ======================================================================
*/
/**
* Receiver which receives intents to add items to the filter list
@ -726,14 +845,17 @@ public final class TaskEditActivity extends Fragment {
} catch (Exception e) {
exceptionService.reportError("receive-detail-" + //$NON-NLS-1$
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON), e);
intent.getStringExtra(AstridApiConstants.EXTRAS_ADDON),
e);
}
}
}
/* ======================================================================
/*
* ======================================================================
* ======================================================= event handlers
* ====================================================================== */
* ======================================================================
*/
protected void saveButtonClick() {
save(false);
@ -743,6 +865,7 @@ public final class TaskEditActivity extends Fragment {
* Displays a Toast reporting that the selected task has been saved and, if
* it has a due date, that is due in 'x' amount of time, to 1 time-unit of
* precision
*
* @param additionalMessage
*/
private String addDueTimeToToast(String additionalMessage) {
@ -752,8 +875,8 @@ public final class TaskEditActivity extends Fragment {
String toastMessage;
if (due != 0) {
stringResource = R.string.TEA_onTaskSave_due;
CharSequence formattedDate =
DateUtilities.getRelativeDay(getActivity(), due);
CharSequence formattedDate = DateUtilities.getRelativeDay(
getActivity(), due);
toastMessage = getString(stringResource, formattedDate);
} else {
toastMessage = getString(R.string.TEA_onTaskSave_notDue);
@ -766,8 +889,9 @@ public final class TaskEditActivity extends Fragment {
shouldSaveState = false;
// abandon editing in this case
if(title.getText().length() == 0 || TextUtils.isEmpty(model.getValue(Task.TITLE))) {
if(isNewTask)
if (title.getText().length() == 0
|| TextUtils.isEmpty(model.getValue(Task.TITLE))) {
if (isNewTask)
taskService.delete(model);
}
@ -784,22 +908,19 @@ public final class TaskEditActivity extends Fragment {
}
protected void deleteButtonClick() {
new AlertDialog.Builder(getActivity())
.setTitle(R.string.DLG_confirm_title)
.setMessage(R.string.DLG_delete_this_task_question)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
taskService.delete(model);
shouldSaveState = false;
showDeleteToast();
getActivity().setResult(Activity.RESULT_CANCELED);
getActivity().onBackPressed();
}
})
.setNegativeButton(android.R.string.cancel, null)
.show();
new AlertDialog.Builder(getActivity()).setTitle(
R.string.DLG_confirm_title).setMessage(
R.string.DLG_delete_this_task_question).setIcon(
android.R.drawable.ic_dialog_alert).setPositiveButton(
android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
taskService.delete(model);
shouldSaveState = false;
showDeleteToast();
getActivity().setResult(Activity.RESULT_CANCELED);
getActivity().onBackPressed();
}
}).setNegativeButton(android.R.string.cancel, null).show();
}
/**
@ -818,7 +939,7 @@ public final class TaskEditActivity extends Fragment {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
switch (item.getItemId()) {
case MENU_SAVE_ID:
saveButtonClick();
return true;
@ -828,9 +949,6 @@ public final class TaskEditActivity extends Fragment {
case MENU_DELETE_ID:
deleteButtonClick();
return true;
case MENU_COMMENTS_ID:
commentsButtonClick();
return true;
case android.R.id.home:
if (title.getText().length() == 0)
discardButtonClick();
@ -847,7 +965,8 @@ public final class TaskEditActivity extends Fragment {
super.onCreateOptionsMenu(menu, inflater);
MenuItem item;
item = menu.add(Menu.NONE, MENU_DISCARD_ID, 0, R.string.TEA_menu_discard);
item = menu.add(Menu.NONE, MENU_DISCARD_ID, 0,
R.string.TEA_menu_discard);
item.setIcon(android.R.drawable.ic_menu_close_clear_cancel);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
@ -859,11 +978,6 @@ public final class TaskEditActivity extends Fragment {
item.setIcon(android.R.drawable.ic_menu_delete);
if (((AstridWrapperActivity) getActivity()).isMultipleFragments())
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
item = menu.add(Menu.NONE, MENU_COMMENTS_ID, 0, R.string.TEA_menu_comments);
item.setIcon(R.drawable.icn_cmmt_off);
if (((AstridWrapperActivity) getActivity()).isMultipleFragments())
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
@Override
@ -872,7 +986,7 @@ public final class TaskEditActivity extends Fragment {
StatisticsService.sessionPause();
getActivity().unregisterReceiver(controlReceiver);
if(shouldSaveState)
if (shouldSaveState)
save(true);
}
@ -880,18 +994,24 @@ public final class TaskEditActivity extends Fragment {
public void onResume() {
super.onResume();
StatisticsService.sessionStart(getActivity());
getActivity().registerReceiver(controlReceiver,
new IntentFilter(AstridApiConstants.BROADCAST_SEND_EDIT_CONTROLS));
getActivity().registerReceiver(
controlReceiver,
new IntentFilter(
AstridApiConstants.BROADCAST_SEND_EDIT_CONTROLS));
populateFields();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == REQUEST_VOICE_RECOG && resultCode == Activity.RESULT_OK) {
// handle the result of voice recognition, put it into the appropiate textfield
voiceNoteAssistant.handleActivityResult(requestCode, resultCode, data);
// write the voicenote into the model, or it will be deleted by onResume.populateFields
if (requestCode == REQUEST_VOICE_RECOG
&& resultCode == Activity.RESULT_OK) {
// handle the result of voice recognition, put it into the
// appropiate textfield
voiceNoteAssistant.handleActivityResult(requestCode, resultCode,
data);
// write the voicenote into the model, or it will be deleted by
// onResume.populateFields
// (due to the activity-change)
notesControlSet.writeToModel(model);
}
@ -927,8 +1047,106 @@ public final class TaskEditActivity extends Fragment {
Preferences.setBoolean(R.string.p_showed_lists_help, false);
}
/* ======================================================================
/*
* ======================================================================
* ========================================== UI component helper classes
* ====================================================================== */
* ======================================================================
*/
/**
* Returns the correct view for TaskEditViewPager
*
* @param position
* in the horizontal scroll view
*/
public View getPageView(int position) {
if (position == 1) {
moreControls.setLayoutParams(mPager.getLayoutParams());
setViewHeightBasedOnChildren(moreControls);
// setPagerHeightForView(editNotes, moreControls);
return moreControls;
} else if (position == 0) {
// setPagerHeightForView(editNotes, moreControls);
return editNotes;
} else {
TextView text = new TextView(getActivity());
text.setGravity(Gravity.CENTER);
text.setText("Activity");
text.setTextSize(20 * getResources().getDisplayMetrics().density);
text.setPadding(20, 20, 20, 20);
LinearLayout layout = new LinearLayout(getActivity());
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
layout.setGravity(Gravity.CENTER);
layout.addView(text);
return layout;
}
}
private void setPagerHeightForPosition(int position) {
int height = 0;
View view = (position == TAB_VIEW_MORE) ? moreControls : editNotes;
int desiredWidth = MeasureSpec.makeMeasureSpec(view.getWidth(),
MeasureSpec.AT_MOST);
view.measure(desiredWidth, MeasureSpec.UNSPECIFIED);
height = Math.max(view.getMeasuredHeight(), height);
LayoutParams pagerParams = mPager.getLayoutParams();
if (position == 0 && height < pagerParams.height)
return;
if (height > 0 && height != pagerParams.height) {
pagerParams.height = height;
mPager.setLayoutParams(pagerParams);
}
}
public static void setViewHeightBasedOnChildren(LinearLayout view) {
int totalHeight = 0;
int desiredWidth = MeasureSpec.makeMeasureSpec(view.getWidth(),
MeasureSpec.AT_MOST);
for (int i = 0; i < view.getChildCount(); i++) {
View listItem = view.getChildAt(i);
listItem.measure(desiredWidth, MeasureSpec.UNSPECIFIED);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = view.getLayoutParams();
params.height = totalHeight;
view.setLayoutParams(params);
view.requestLayout();
}
// Tab Page listener when page/tab changes
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
return;
}
@Override
public void onPageSelected(int position) {
this.setPagerHeightForPosition(position);
}
@Override
public void onPageScrollStateChanged(int state) {
return;
}
// EditNoteActivity Lisener when there are new updates/comments
@Override
public void updatesChanged() {
setCurrentTab(TAB_VIEW_UPDATES);
this.setPagerHeightForPosition(TAB_VIEW_UPDATES);
}
}

@ -0,0 +1,61 @@
package com.todoroo.astrid.activity;
import android.content.Context;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import com.viewpagerindicator.TitleProvider;
public class TaskEditViewPager extends PagerAdapter implements TitleProvider {
private static String[] titles = new String[] { "Activity", "More" };
private final Context context;
public TaskEditActivity parent;
public TaskEditViewPager(Context context) {
this.context = context;
}
@Override
public int getCount() {
return titles.length;
}
@Override
public Object instantiateItem(View pager, int position) {
View pageView = parent.getPageView(position);
((ViewPager) pager).addView(pageView, 0);
return pageView;
}
@Override
public void destroyItem(View pager, int position, Object view) {
((ViewPager) pager).removeView((View) view);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view.equals(object);
}
@Override
public String getTitle(int position) {
return titles[position];
}
@Override
public void finishUpdate(View view) {
System.err.println("UpdateView");
}
@Override
public Parcelable saveState() {
return null;
}
}

@ -0,0 +1,56 @@
package com.todoroo.astrid.activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
public final class TestFragment extends Fragment {
private static final String KEY_CONTENT = "TestFragment:Content";
public static TestFragment newInstance(String content) {
TestFragment fragment = new TestFragment();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 20; i++) {
builder.append(content).append(" ");
}
builder.deleteCharAt(builder.length() - 1);
fragment.mContent = builder.toString();
return fragment;
}
private String mContent = "???";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
mContent = savedInstanceState.getString(KEY_CONTENT);
}
TextView text = new TextView(getActivity());
text.setGravity(Gravity.CENTER);
text.setText(mContent);
text.setTextSize(20 * getResources().getDisplayMetrics().density);
text.setPadding(20, 20, 20, 20);
LinearLayout layout = new LinearLayout(getActivity());
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
layout.setGravity(Gravity.CENTER);
layout.addView(text);
return layout;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(KEY_CONTENT, mContent);
}
}

@ -121,14 +121,14 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
Task.USER
};
private static int[] IMPORTANCE_RESOURCES = new int[] {
public static int[] IMPORTANCE_RESOURCES = new int[] {
R.drawable.importance_check_1, //task_indicator_0,
R.drawable.importance_check_2, //task_indicator_1,
R.drawable.importance_check_3, //task_indicator_2,
R.drawable.importance_check_4, //task_indicator_3,
};
private static int[] IMPORTANCE_REPEAT_RESOURCES = new int[] {
public static int[] IMPORTANCE_REPEAT_RESOURCES = new int[] {
R.drawable.importance_check_repeat_1, //task_indicator_0,
R.drawable.importance_check_repeat_2, //task_indicator_1,
R.drawable.importance_check_repeat_3, //task_indicator_2,
@ -382,14 +382,18 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
final CheckBox checkBoxView = viewHolder.completeBox; {
int value = task.getValue(Task.IMPORTANCE);
if(value < IMPORTANCE_RESOURCES.length)
if (!TextUtils.isEmpty(task.getValue(Task.RECURRENCE))) {
{
if (!TextUtils.isEmpty(task.getValue(Task.RECURRENCE)))
{
checkBoxView.setButtonDrawable(IMPORTANCE_REPEAT_RESOURCES[value]);
pictureView.setBackgroundResource(IMPORTANCE_REPEAT_RESOURCES[value]);
}
else {
else
{
checkBoxView.setButtonDrawable(IMPORTANCE_RESOURCES[value]);
pictureView.setBackgroundResource(IMPORTANCE_RESOURCES[value]);
}
}
else
{
checkBoxView.setBackgroundResource(R.drawable.btn_check);
@ -397,7 +401,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
if (pictureView.getVisibility() == View.VISIBLE){
checkBoxView.setVisibility(View.INVISIBLE);
}
else {
else
{
checkBoxView.setVisibility(View.VISIBLE);
}
}

@ -29,6 +29,16 @@ public class ProgressBarSyncResultCallback extends SyncResultCallbackAdapter {
progressBar.setProgress(0);
progressBar.setMax(0);
}
public ProgressBarSyncResultCallback(Activity activity, ProgressBar pBar,
int progressBarId, Runnable onFinished) {
this.progressBar = pBar;
this.activity = activity;
this.onFinished = onFinished;
progressBar.setProgress(0);
progressBar.setMax(0);
}
@Override
public void finished() {
@ -112,4 +122,4 @@ public class ProgressBarSyncResultCallback extends SyncResultCallbackAdapter {
});
}
}
}
}

@ -22,6 +22,7 @@ public class DeadlineControlSet extends PopupControlSet {
dateAndTimePicker = (DateAndTimePicker) getView().findViewById(R.id.date_and_time);
LinearLayout extras = (LinearLayout) getView().findViewById(R.id.datetime_extras);
this.displayText.setText(activity.getString(R.string.TEA_when_header_label));
for (View v : extraViews) {
LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1.0f);
extras.addView(v, lp);
@ -41,7 +42,7 @@ public class DeadlineControlSet extends PopupControlSet {
@Override
protected void refreshDisplayView() {
TextView dateDisplay = (TextView) getDisplayView().findViewById(R.id.deadline_display);
TextView dateDisplay = (TextView) getDisplayView().findViewById(R.id.display_row_edit);
String toDisplay = dateAndTimePicker.getDisplayString(activity);
dateDisplay.setText(toDisplay);
}

@ -87,10 +87,10 @@ public class EditNotesControlSet extends PopupControlSet {
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
if (hasNotes() && notesPreview.getLineCount() > 2) {
notesBody.setGravity(Gravity.TOP);
notesBody.setPadding(0, (int) (metrics.density * 8), 0, (int) (metrics.density * 8));
notesBody.setPadding( notesBody.getPaddingLeft(), (int) (metrics.density * 8), notesBody.getPaddingRight(), (int) (metrics.density * 8));
} else {
notesBody.setGravity(Gravity.CENTER_VERTICAL);
notesBody.setPadding(0, 0, 0, 0);
notesBody.setPadding( notesBody.getPaddingLeft(), 0, notesBody.getPaddingRight(), 0);
}
}

@ -1,11 +1,20 @@
package com.todoroo.astrid.ui;
import android.app.Activity;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.TaskEditControlSet;
import com.todoroo.astrid.service.TaskService;
/**
* Control set for mapping a Property to an EditText
@ -15,21 +24,47 @@ import com.todoroo.astrid.helper.TaskEditControlSet;
public class EditTextControlSet extends TaskEditControlSet {
private final EditText editText;
private final StringProperty property;
protected Task model;
protected CheckBox completeBox;
@Autowired
private TaskService taskService;
public EditTextControlSet(Activity activity, int layout, StringProperty property, int editText) {
super(activity, layout);
this.property = property;
this.editText = (EditText) getView().findViewById(editText);
this.completeBox = (CheckBox) getView().findViewById(R.id.completeBox);
DependencyInjectionService.getInstance().inject(this);
}
@Override
public void readFromTask(Task task) {
model = task;
editText.setTextKeepState(task.getValue(property));
completeBox.setChecked(task.isCompleted());
completeBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
ScaleAnimation scaleAnimation = new ScaleAnimation(1.6f, 1.0f, 1.6f, 1.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(100);
// set check box to actual action item state
completeBox.startAnimation(scaleAnimation);
}
});
}
@Override
public String writeToModel(Task task) {
task.setValue(property, editText.getText().toString());
boolean newState = completeBox.isChecked();
if (newState != task.isCompleted()) {
taskService.setComplete(task, newState);
}
return null;
}
}

@ -1,28 +1,64 @@
package com.todoroo.astrid.ui;
import android.app.Activity;
import android.widget.ImageView;
import android.text.TextUtils;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.astrid.adapter.TaskAdapter;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.repeats.RepeatControlSet.RepeatChangedListener;
import com.todoroo.astrid.ui.ImportanceControlSet.ImportanceChangedListener;
public class EditTitleControlSet extends EditTextControlSet implements ImportanceChangedListener {
public class EditTitleControlSet extends EditTextControlSet implements ImportanceChangedListener, RepeatChangedListener {
ImageView importance;
private static int[] IMPORTANCE_DRAWABLES = { R.drawable.importance_title_1, R.drawable.importance_title_2, R.drawable.importance_title_3,
R.drawable.importance_title_4, R.drawable.importance_title_5, R.drawable.importance_title_6 };
private boolean isRepeating;
private int importanceValue;
public EditTitleControlSet(Activity activity, int layout, StringProperty property, int editText) {
super(activity, layout, property, editText);
importance = (ImageView) getView().findViewById(R.id.importance);
}
@Override
public void importanceChanged(int i, int color) {
if(importance != null)
importance.setImageResource(IMPORTANCE_DRAWABLES[i]);
importanceValue = i;
updateCompleteBox();
}
@Override
public void RepeatChanged(boolean repeat) {
isRepeating = repeat;
updateCompleteBox();
}
@Override
public void readFromTask(Task task) {
super.readFromTask(task);
isRepeating = !TextUtils.isEmpty(task.getValue(Task.RECURRENCE));
importanceValue = model.getValue(Task.IMPORTANCE);
}
public void updateCompleteBox() {
if(importanceValue < TaskAdapter.IMPORTANCE_RESOURCES.length)
{
if (isRepeating)
{
completeBox.setButtonDrawable(TaskAdapter.IMPORTANCE_REPEAT_RESOURCES[importanceValue]);
}
else
{
completeBox.setButtonDrawable(TaskAdapter.IMPORTANCE_RESOURCES[importanceValue]);
}
}
else
{
completeBox.setBackgroundResource(R.drawable.btn_check);
}
}
}

@ -43,6 +43,7 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect
this.spinner = (Spinner) getView().findViewById(R.id.hideUntil);
this.spinner.setOnItemSelectedListener(this);
this.spinner.setPromptId(title);
this.displayText.setText(activity.getString(R.string.TEA_hideUntil_label));
ViewGroup parent = (ViewGroup) getView().getParent();
parent.removeView(getView());
((LinearLayout) getDisplayView()).addView(getView()); // hack to make listeners work
@ -192,7 +193,7 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect
@Override
protected void refreshDisplayView() {
HideUntilValue value = adapter.getItem(spinner.getSelectedItemPosition());
TextView auxDisplay = (TextView) getDisplayView().findViewById(R.id.hide_until_display);
TextView auxDisplay = (TextView) getDisplayView().findViewById(R.id.display_row_edit);
auxDisplay.setText(value.toString());
}

@ -92,7 +92,7 @@ public class ImportanceControlSet extends TaskEditControlSet {
}
if (usedWidth > width * 2 /3 ) {
getView().findViewById(R.id.importance_label).setVisibility(View.GONE);
getView().findViewById(R.id.display_row_edit).setVisibility(View.GONE);
}
}

@ -0,0 +1,47 @@
package com.todoroo.astrid.ui;
import android.content.Context;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
public class NestedListView extends ListView {
private static final int MAXIMUM_LIST_ITEMS_VIEWABLE = 2;
public NestedListView(Context context) {
super(context);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int newHeight = 0;
final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
if (heightMode != MeasureSpec.EXACTLY) {
ListAdapter listAdapter = getAdapter();
if (listAdapter != null && !listAdapter.isEmpty()) {
int listPosition = 0;
for (listPosition = 0; listPosition < listAdapter.getCount()
&& listPosition < MAXIMUM_LIST_ITEMS_VIEWABLE; listPosition++) {
View listItem = listAdapter.getView(listPosition, null,
this);
listItem.measure(widthMeasureSpec, heightMeasureSpec);
newHeight += listItem.getMeasuredHeight();
}
newHeight += getDividerHeight() * listPosition;
}
if ((heightMode == MeasureSpec.AT_MOST) && (newHeight > heightSize)) {
if (newHeight > heightSize) {
newHeight = heightSize;
}
}
} else {
newHeight = getMeasuredHeight();
}
setMeasuredDimension(getMeasuredWidth(), newHeight);
}
}

@ -11,6 +11,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.AndroidUtilities;
@ -23,13 +24,21 @@ public abstract class PopupControlSet extends TaskEditControlSet {
protected final View displayView;
protected final Activity activity;
protected final Dialog dialog;
protected final TextView displayText;
public PopupControlSet(Activity activity, int viewLayout, int displayViewLayout, final int title) {
super(activity, viewLayout);
if (displayViewLayout != -1)
if (displayViewLayout != -1){
this.displayView = LayoutInflater.from(activity).inflate(displayViewLayout, null);
else
displayText = (TextView) displayView.findViewById(R.id.display_row_title);
if (displayText != null) {
displayText.setMaxLines(2);
}
}
else {
this.displayView = null;
this.displayText = null;
}
final DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@Override

@ -37,6 +37,7 @@ public class ReminderControlSet extends PopupControlSet {
remindersBody = (LinearLayout) getView().findViewById(R.id.reminders_body);
remindersBody.addView(alarmControl.getView());
displayText.setText(activity.getString(R.string.TEA_reminders_group_label));
String[] list = new String[] {
activity.getString(R.string.TEA_reminder_mode_once),
activity.getString(R.string.TEA_reminder_mode_five),

@ -0,0 +1,35 @@
package com.todoroo.astrid.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
public class TaskEditMoreControls extends LinearLayout {
public TaskEditMoreControls(Context context) {
super(context);
}
public TaskEditMoreControls(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setViewHeightBasedOnChildren(LayoutParams params) {
int totalHeight = 0;
int desiredWidth = MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST);
for (int i = 0; i < getChildCount(); i++) {
View listItem = getChildAt(i);
listItem.measure(desiredWidth, MeasureSpec.UNSPECIFIED);
totalHeight += listItem.getMeasuredHeight();
}
params.height = totalHeight;
setLayoutParams(params);
requestLayout();
}
}

@ -8,6 +8,5 @@
android:id="@android:id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
style="?attr/vpiTabTextStyle" />
android:gravity="center" />
</view>

@ -130,7 +130,6 @@ public class TabPageIndicator extends HorizontalScrollView implements PageIndica
tabView.init(this, text, index);
tabView.setFocusable(true);
tabView.setOnClickListener(mTabClickListener);
mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, LayoutParams.FILL_PARENT, 1));
}

Loading…
Cancel
Save