Merge remote-tracking branch 'upstream/120125_as_edit_screen' into 4.0

pull/14/head
Sam Bosley 13 years ago
commit bb146e3105

@ -21,7 +21,6 @@ import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.format.DateUtils;
import android.text.util.Linkify;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
@ -58,10 +57,10 @@ import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.SyncV2Service.SyncResultCallback;
import com.todoroo.astrid.timers.TimerActionControlSet.TimerStoppedListener;
import com.todoroo.astrid.timers.TimerActionControlSet.TimerActionListener;
import com.todoroo.astrid.utility.Flags;
public class EditNoteActivity extends LinearLayout implements TimerStoppedListener {
public class EditNoteActivity extends LinearLayout implements TimerActionListener {
@ -84,7 +83,7 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
private View commentButton;
private int commentItems = 10;
private ImageButton pictureButton;
private Bitmap picture = null;
private Bitmap pendingCommentPicture = null;
private final Fragment fragment;
private final List<UpdatesChangedListener> listeners = new LinkedList<UpdatesChangedListener>();
@ -97,7 +96,6 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
public EditNoteActivity(Fragment fragment, View parent, long t) {
super(fragment.getActivity());
Log.d("EditnoteActivity", "Contructor being called");
this.fragment = fragment;
DependencyInjectionService.getInstance().inject(this);
@ -196,8 +194,7 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
final ClearImageCallback clearImage = new ClearImageCallback() {
@Override
public void clearImage() {
Log.e("Errrr EditNOtes activity", "Picture clear image called");
picture = null;
pendingCommentPicture = null;
pictureButton.setImageResource(R.drawable.camera_button);
}
};
@ -205,7 +202,7 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
pictureButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (picture != null)
if (pendingCommentPicture != null)
ActFmCameraModule.showPictureLauncher(fragment, clearImage);
else
ActFmCameraModule.showPictureLauncher(fragment, null);
@ -224,9 +221,6 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
loadingText = new TextView(getContext());
for (UpdatesChangedListener l : listeners) {
l.updatesChanged();
}
}
private void setUpListAdapter() {
@ -277,7 +271,6 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
this.addView(notesView);
}
if ( items.size() > commentItems) {
Button loadMore = new Button(getContext());
loadMore.setText(R.string.TEA_load_more);
@ -303,6 +296,9 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
}
for (UpdatesChangedListener l : listeners) {
l.updatesChanged();
}
}
@ -347,7 +343,7 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
// picture
final AsyncImageView commentPictureView = (AsyncImageView)view.findViewById(R.id.comment_picture); {
if(TextUtils.isEmpty(item.commentPicture))
if(TextUtils.isEmpty(item.commentPicture) || item.commentPicture.equals("null")) //$NON-NLS-1$
commentPictureView.setVisibility(View.GONE);
else {
commentPictureView.setVisibility(View.VISIBLE);
@ -398,11 +394,11 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
}
private void addComment() {
addComment(commentField.getText().toString(), "task_comment"); //$NON-NLS-1$
addComment(commentField.getText().toString(), "task_comment", true); //$NON-NLS-1$
}
private void addComment(String message, String actionCode) {
private void addComment(String message, String actionCode, boolean usePicture) {
Update update = new Update();
update.setValue(Update.MESSAGE, message);
update.setValue(Update.ACTION_CODE, actionCode);
@ -410,30 +406,28 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
update.setValue(Update.TASK, task.getValue(Task.REMOTE_ID));
update.setValue(Update.CREATION_DATE, DateUtilities.now());
Log.d("Add comment", "The picture is: " + picture);
if (picture != null) {
if (usePicture && pendingCommentPicture != null) {
update.setValue(Update.PICTURE, Update.PICTURE_LOADING);
}
Flags.set(Flags.ACTFM_SUPPRESS_SYNC);
updateDao.createNew(update);
final long updateId = update.getId();
final Bitmap tempPicture = picture;
final Bitmap tempPicture = usePicture ? pendingCommentPicture : null;
new Thread() {
@Override
public void run() {
actFmSyncService.pushUpdate(updateId, tempPicture);
Log.d("Run thread", "The picture is: " + picture);
}
}.start();
commentField.setText(""); //$NON-NLS-1$
setUpListAdapter();
picture = null;
pendingCommentPicture = usePicture ? null : pendingCommentPicture;
pictureButton.setImageResource(R.drawable.camera_button);
StatisticsService.reportEvent(StatisticsConstants.ACTFM_TASK_COMMENT);
setUpListAdapter();
for (UpdatesChangedListener l : listeners) {
l.commentAdded();
}
@ -463,11 +457,13 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
public static NoteOrUpdate fromMetadata(Metadata m) {
if(!m.containsNonNullValue(NoteMetadata.THUMBNAIL))
m.setValue(NoteMetadata.THUMBNAIL, ""); //$NON-NLS-1$
if(!m.containsNonNullValue(NoteMetadata.COMMENT_PICTURE))
m.setValue(NoteMetadata.COMMENT_PICTURE, ""); //$NON-NLS-1$
return new NoteOrUpdate(m.getValue(NoteMetadata.THUMBNAIL),
m.getValue(NoteMetadata.TITLE),
m.getValue(NoteMetadata.BODY),
m.getValue(NoteMetadata.COMMENTPICTURE),
m.getValue(NoteMetadata.COMMENT_PICTURE),
m.getValue(Metadata.CREATION_DATE));
}
@ -479,8 +475,10 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
String message = u.getValue(Update.MESSAGE);
if(u.getValue(Update.ACTION_CODE).equals("task_comment"))
description = message;
else if(!TextUtils.isEmpty(message))
else if(!TextUtils.isEmpty(message) && !TextUtils.isEmpty(description))
description += " " + message;
else
description = message;
String commentPicture = u.getValue(Update.PICTURE);
return new NoteOrUpdate(user.optString("picture"),
@ -506,33 +504,34 @@ public class EditNoteActivity extends LinearLayout implements TimerStoppedListen
}
@Override
public void timerStarted(Task task) {
// TODO Auto-generated method stub
addComment(getContext().getString(R.string.TEA_timer_comment_started) + " " + DateUtilities.getTimeString(getContext(), new Date()), "task_started"); //$NON-NLS-1$
public void timerStarted(Task t) {
addComment(String.format("%s %s", //$NON-NLS-1$
getContext().getString(R.string.TEA_timer_comment_started),
DateUtilities.getTimeString(getContext(), new Date())),
"task_started", //$NON-NLS-1$
false);
}
@Override
public void timerStopped(Task task) {
// TODO Auto-generated method stub
String elapsedTime = DateUtils.formatElapsedTime(task.getValue(Task.ELAPSED_SECONDS));
addComment(getContext().getString(R.string.TEA_timer_comment_stopped) + " " +
DateUtilities.getTimeString(getContext(), new Date()) + "\n" + getContext().getString(R.string.TEA_timer_comment_spent) + " " + elapsedTime, "task_stopped"); //$NON-NLS-1$
public void timerStopped(Task t) {
String elapsedTime = DateUtils.formatElapsedTime(t.getValue(Task.ELAPSED_SECONDS));
addComment(String.format("%s %s\n%s %s", //$NON-NLS-1$
getContext().getString(R.string.TEA_timer_comment_stopped),
DateUtilities.getTimeString(getContext(), new Date()),
getContext().getString(R.string.TEA_timer_comment_spent),
elapsedTime), "task_stopped", false); //$NON-NLS-1$
}
/*
* Callback from edittask when picture is added
* Call back from edit task when picture is added
*/
public boolean activityResult(int requestCode, int resultCode, Intent data) {
Log.d("Activity result", "Called on camera for request code: " + requestCode);
CameraResultCallback callback = new CameraResultCallback() {
@Override
public void handleCameraResult(Bitmap bitmap) {
picture = bitmap;
pictureButton.setImageBitmap(picture);
Log.d("Picture", "Picture = " + picture);
pendingCommentPicture = bitmap;
pictureButton.setImageBitmap(pendingCommentPicture);
}
};

@ -24,7 +24,7 @@ public class NoteMetadata {
public static final StringProperty THUMBNAIL = Metadata.VALUE3;
/** note external id (use for your own purposes) */
public static final StringProperty COMMENTPICTURE = Metadata.VALUE6;
public static final StringProperty COMMENT_PICTURE = Metadata.VALUE6;
/** note external provider (use for your own purposes) */
public static final StringProperty EXT_PROVIDER = Metadata.VALUE4;

@ -7,8 +7,9 @@ import android.app.Activity;
import android.os.SystemClock;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DateUtilities;
@ -17,23 +18,19 @@ import com.todoroo.astrid.helper.TaskEditControlSet;
public class TimerActionControlSet extends TaskEditControlSet {
private final Button timerButton;
private final ImageView timerButton;
private final Chronometer chronometer;
private final View timerContainer;
private final LinearLayout timerContainer;
private boolean timerActive;
private final Activity activity;
private Task task;
private final List<TimerStoppedListener> listeners = new LinkedList<TimerStoppedListener>();
private final List<TimerActionListener> listeners = new LinkedList<TimerActionListener>();
public TimerActionControlSet(Activity activity, View parent) {
super(activity, -1);
this.activity = activity;
timerButton = (Button) parent.findViewById(R.id.timer_button);
timerContainer = (View) parent.findViewById(R.id.timer_container);
timerContainer = (LinearLayout) parent.findViewById(R.id.timer_container);
timerButton = (ImageView) parent.findViewById(R.id.timer_button);
timerContainer.setOnClickListener(timerListener);
chronometer = new Chronometer(activity);
chronometer = (Chronometer) parent.findViewById(R.id.timer);
}
@Override
@ -59,14 +56,14 @@ public class TimerActionControlSet extends TaskEditControlSet {
@Override
public void onClick(View v) {
if (timerActive) {
TimerPlugin.updateTimer(activity, task, false);
// TimerPlugin.updateTimer(activity, task, false);
for(TimerStoppedListener listener : listeners)
for(TimerActionListener listener : listeners)
listener.timerStopped(task);
chronometer.stop();
} else {
TimerPlugin.updateTimer(activity, task, true);
for(TimerStoppedListener listener : listeners)
// TimerPlugin.updateTimer(activity, task, true);
for(TimerActionListener listener : listeners)
listener.timerStarted(task);
chronometer.start();
}
@ -80,12 +77,9 @@ public class TimerActionControlSet extends TaskEditControlSet {
if(timerActive) {
drawable = R.drawable.icn_timer_stop;
} else {
if (task.getValue(Task.ELAPSED_SECONDS) == 0)
drawable = R.drawable.icn_edit_timer;
else
drawable = R.drawable.icn_timer_start;
drawable = R.drawable.icn_edit_timer;
}
timerButton.setBackgroundResource(drawable);
timerButton.setImageResource(drawable);
long elapsed = task.getValue(Task.ELAPSED_SECONDS) * 1000L;
@ -100,16 +94,16 @@ public class TimerActionControlSet extends TaskEditControlSet {
}
}
public interface TimerStoppedListener {
public interface TimerActionListener {
public void timerStopped(Task task);
public void timerStarted(Task task);
}
public void addListener(TimerStoppedListener listener) {
public void addListener(TimerActionListener listener) {
this.listeners.add(listener);
}
public void removeListener(TimerStoppedListener listener) {
public void removeListener(TimerActionListener listener) {
if (listeners.contains(listener))
listeners.remove(listener);
}

@ -7,7 +7,7 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.TaskEditControlSet;
import com.todoroo.astrid.timers.TimerActionControlSet.TimerStoppedListener;
import com.todoroo.astrid.timers.TimerActionControlSet.TimerActionListener;
import com.todoroo.astrid.ui.PopupControlSet;
import com.todoroo.astrid.ui.TimeDurationControlSet;
@ -17,7 +17,7 @@ import com.todoroo.astrid.ui.TimeDurationControlSet;
* @author Tim Su <tim@todoroo.com>
*
*/
public class TimerControlSet extends PopupControlSet implements TimerStoppedListener {
public class TimerControlSet extends PopupControlSet implements TimerActionListener {
TaskEditControlSet estimated, elapsed;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

@ -1,55 +1,33 @@
<?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"
android:layout_weight="100">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:paddingRight="0dip"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
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"
<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">
<com.todoroo.astrid.ui.ErrorCatchingEditText
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100"
android:hint="@string/TEA_title_hint"
android:autoText="true"
android:paddingTop="10dip"
android:paddingLeft="10dip"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:text=""
android:background="@android:color/transparent"
android:capitalize="sentences"
android:freezesText="true"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:button="@drawable/btn_check" />
<com.todoroo.astrid.ui.ErrorCatchingEditText
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100"
android:autoText="true"
android:background="@drawable/edit_title_background"
android:capitalize="sentences"
android:freezesText="true"
android:hint="@string/TEA_title_hint"
android:inputType="textMultiLine"
android:paddingLeft="5dip"
android:paddingTop="3dip"
android:scrollbars="vertical"
android:text=""
android:textColor="@android:color/black" />
</LinearLayout>

@ -6,50 +6,56 @@
android:id="@+id/rowBody"
android:layout_width="fill_parent"
android:layout_height="70dip"
android:paddingBottom="4dip" >
android:minHeight="70dip"
android:layout_marginTop="20dip"
android:paddingBottom="20dip" >
<!-- completion check-box -->
<CheckBox
android:id="@+id/completeBox"
android:layout_width="45dip"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dip"
android:button="@drawable/btn_check" />
<!-- assignee photo -->
<LinearLayout
android:id="@+id/pictureContainer"
android:layout_width="58dip"
android:layout_height="54dip"
android:layout_marginLeft="5dip"
android:layout_marginTop="10dip"
android:padding="7dip"
android:paddingTop="9dip"
android:background="#111111"
>
<greendroid.widget.AsyncImageView
android:id="@+id/picture"
android:layout_width="35dip"
android:layout_height="35dip"
android:layout_width="47dip"
android:layout_height="45dip"
android:layout_centerVertical="true"
android:padding="2dip"
android:layout_marginLeft="5dip"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:scaleType="fitCenter"
android:visibility="gone" >
</greendroid.widget.AsyncImageView>
</LinearLayout>
<ImageView
android:id="@+id/pictureBorder"
android:layout_width="47dip"
android:layout_height="47dip"
android:layout_marginLeft="5dip"
android:layout_centerVertical="true"
android:background="@drawable/icn_default_person_image"
android:scaleType="center"
android:visibility="gone" >
</ImageView>
<CheckBox
android:id="@+id/completeBox"
android:layout_width="45dip"
android:layout_marginLeft="13dip"
android:layout_height="fill_parent"
android:minHeight="40dip"
android:scaleType="center"
android:layout_centerVertical="true" />
<!-- assignee photo -->
<LinearLayout
android:id="@+id/task_row"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignTop="@id/completeBox"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/completeBox"
android:orientation="horizontal"
android:paddingLeft="5dip" >
android:paddingLeft="2dip" >
<!-- task name -->
@ -57,7 +63,7 @@
android:id="@+id/title"
style="@style/TextAppearance.TAd_ItemTitle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100"
android:gravity="center_vertical"
android:maxLines="2" />

@ -9,10 +9,10 @@
<ScrollView
android:id="@+id/edit_scroll"
style="@style/Content_EditScroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100"
style="@style/Content_EditScroll" >
android:layout_weight="100" >
<LinearLayout
android:layout_width="fill_parent"
@ -22,52 +22,54 @@
<LinearLayout
android:id="@+id/title_controls"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="3dip"
android:gravity="center_vertical"
style="@style/EditRow"
android:orientation="horizontal"
android:paddingRight="6dip" >
<LinearLayout
android:id="@+id/save_and_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
android:visibility="gone" >
<ImageButton
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:background="@android:color/transparent"
android:src="@android:drawable/ic_menu_close_clear_cancel"/>
android:src="@android:drawable/ic_menu_close_clear_cancel" />
<ImageButton
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:src="@android:drawable/ic_menu_save"/>
android:src="@android:drawable/ic_menu_save" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/basic_controls"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="3dip"
android:layout_marginTop="10dip"
style="@style/EditRow"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:id="@+id/more_header"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
style="@style/EditRow"
android:visibility="gone" >
-
@ -79,19 +81,18 @@
android:gravity="center"
android:text="@string/TEA_more"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/more_container"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="3dip"
android:layout_marginBottom="0dip"
style="@style/EditRow"
android:orientation="vertical"
android:visibility="gone">
android:visibility="gone" >
<com.viewpagerindicator.TabPageIndicator
android:id="@+id/indicator"
android:layout_width="fill_parent"
@ -109,7 +110,6 @@
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
@ -118,10 +118,10 @@
<LinearLayout
android:id="@+id/updatesFooter"
style="@style/Content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/Content"
android:minHeight="47dip"
android:orientation="horizontal"
android:padding="3dip" >
@ -135,11 +135,11 @@
android:layout_gravity="top"
android:layout_marginRight="3dip"
android:layout_weight="1"
android:background="#00000000"
android:paddingBottom="2dip"
android:paddingLeft="7dip"
android:paddingRight="7dip"
android:scaleType="centerInside"
android:background="#00000000"
android:src="@drawable/camera_button" />
<!-- Quick Add Task -->
@ -148,47 +148,58 @@
android:id="@+id/commentField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="1dip"
android:layout_marginLeft="1dip"
android:paddingLeft="10dip"
android:layout_marginRight="1dip"
android:layout_weight="100"
android:autoText="true"
android:background="@drawable/footer_comment_edittext"
android:capitalize="sentences"
android:hint="@string/TVA_add_comment"
android:paddingLeft="10dip"
android:textSize="16sp" />
<!-- Extended Add Button -->
<LinearLayout
android:id="@+id/timer_container"
android:layout_width="35dip"
android:layout_height="35dip"
android:layout_marginLeft="3dip"
android:orientation="vertical"
android:layout_weight="1">
<Button
android:layout_width="39dip"
android:layout_height="39dip"
android:layout_marginLeft="2dip"
android:layout_weight="1"
android:orientation="vertical" >
<ImageView
android:id="@+id/timer_button"
android:layout_width="30dip"
android:layout_width="fill_parent"
android:layout_height="25dip"
android:layout_marginTop="7dip"
android:scaleType="fitCenter"
android:layout_weight="1"
android:background="#00000000"
android:gravity="center_vertical|center_horizontal"
android:paddingRight="5dip"
android:paddingLeft="5dip"
android:scaleType="centerInside" />
<Chronometer
android:id="@+id/timer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:layout_weight="1"/>
android:textColor="@color/task_edit_details"
android:textSize="10sp"
android:visibility="visible" />
</LinearLayout>
<ImageButton
android:id="@+id/commentButton"
android:layout_width="35dip"
android:layout_height="35dip"
android:layout_width="39dip"
android:layout_height="39dip"
android:layout_gravity="top"
android:layout_marginRight="3dip"
android:layout_marginLeft="3dip"
android:layout_weight="1"
android:background="@drawable/footer_button"
android:background="?attr/asAddButtonImg"
android:scaleType="center"
android:visibility="gone"
android:src="@drawable/ic_footer_add" />
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -56,6 +56,7 @@
android:paddingTop="5dip"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:scaleType="fitCenter"
android:layout_marginLeft="50dip"
android:visibility="gone" />
<!-- activity date -->

@ -266,6 +266,9 @@
<!-- show task details (corresponds to showing repeat and tag details in the task adapter) -->
<string name="p_default_showdetails_key">p_show_details</string>
<!-- show full task title (corresponds to showing full task title in task adapter) -->
<string name="p_default_showfulltitle_key">p_show_full_title</string>
<!-- show task decorations (corresponds to showing notes icon in the task adapter) -->
<string name="p_default_showdecorations_key">p_show_decorations</string>

@ -34,6 +34,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.speech.RecognizerIntent;
import android.support.v4.app.Fragment;
import android.support.v4.app.SupportActivity;
@ -212,6 +213,16 @@ public final class TaskEditActivity extends Fragment implements
private TaskEditViewPager mAdapter;
private TabPageIndicator mIndicator;
private final Runnable refreshActivity = new Runnable()
{
@Override
public void run()
{
//Change state here
setPagerHeightForPosition(TAB_VIEW_UPDATES);
}
};
private final List<TaskEditControlSet> controls = Collections.synchronizedList(new ArrayList<TaskEditControlSet>());
// --- other instance variables
@ -367,7 +378,7 @@ public final class TaskEditActivity extends Fragment implements
editNotes.addListener(this);
if (timerAction != null) {
timerAction.addListener(editNotes);
timerAction.addListener(editNotes);
}
}
else {
@ -377,11 +388,6 @@ public final class TaskEditActivity extends Fragment implements
mAdapter = new TaskEditViewPager(getActivity());
mAdapter.parent = this;
editNotes = new EditNoteActivity(this, getView(),
idParam);
editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
mPager = (ViewPager) getView().findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
@ -393,7 +399,9 @@ public final class TaskEditActivity extends Fragment implements
if (editNotes.numberOfComments() == 0) {
setCurrentTab(TAB_VIEW_MORE);
} else {
setPagerHeightForPosition(TAB_VIEW_UPDATES);
Handler refreshHandler = new Handler();
refreshHandler.postDelayed(refreshActivity, 1000);
}
editNotes.addListener(this);
}
@ -1155,6 +1163,7 @@ public final class TaskEditActivity extends Fragment implements
private void setPagerHeightForPosition(int position) {
int height = 0;
View view = (position == TAB_VIEW_MORE) ? moreControls : editNotes;
if (view == null || mPager == null) return;
int desiredWidth = MeasureSpec.makeMeasureSpec(view.getWidth(),
MeasureSpec.AT_MOST);

@ -54,6 +54,7 @@ import android.view.animation.ScaleAnimation;
import android.widget.CheckBox;
import android.widget.CursorAdapter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
@ -129,6 +130,14 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
R.drawable.importance_check_4, //task_indicator_3,
};
public static int[] IMPORTANCE_RESOURCES_LARGE = new int[] {
R.drawable.check_box_large_1, //task_indicator_0,
R.drawable.check_box_large_2, //task_indicator_1,
R.drawable.check_box_large_3, //task_indicator_2,
R.drawable.check_box_large_4, //task_indicator_3,
};
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,
@ -250,13 +259,21 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
viewHolder.rowBody = (ViewGroup)view.findViewById(R.id.rowBody);
viewHolder.nameView = (TextView)view.findViewById(R.id.title);
viewHolder.picture = (AsyncImageView)view.findViewById(R.id.picture);
viewHolder.pictureContainer = (View) view.findViewById(R.id.pictureContainer);
viewHolder.pictureBorder = (ImageView)view.findViewById(R.id.pictureBorder);
viewHolder.completeBox = (CheckBox)view.findViewById(R.id.completeBox);
viewHolder.dueDate = (TextView)view.findViewById(R.id.dueDate);
viewHolder.details1 = (TextView)view.findViewById(R.id.details1);
viewHolder.details2 = (TextView)view.findViewById(R.id.details2);
viewHolder.taskRow = (LinearLayout)view.findViewById(R.id.task_row);
if (Preferences.getBoolean(R.string.p_default_showfulltitle_key, false)) {
viewHolder.nameView.setMaxLines(Integer.MAX_VALUE);
LayoutParams containerParams = view.getLayoutParams();
containerParams.height = LayoutParams.WRAP_CONTENT;
view.setLayoutParams(containerParams);
}
view.setTag(viewHolder);
for(int i = 0; i < view.getChildCount(); i++)
view.getChildAt(i).setTag(viewHolder);
@ -304,7 +321,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
public TextView nameView;
public CheckBox completeBox;
public AsyncImageView picture;
public View pictureContainer;
public ImageView pictureBorder;
public TextView dueDate;
public TextView details1, details2;
public LinearLayout taskRow;
@ -321,6 +338,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
// name
final TextView nameView = viewHolder.nameView; {
String nameValue = task.getValue(Task.TITLE);
long hiddenUntil = task.getValue(Task.HIDE_UNTIL);
if(task.getValue(Task.DELETION_DATE) > 0)
nameValue = r.getString(R.string.TAd_deletedFormat, nameValue);
@ -369,10 +387,10 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
final AsyncImageView pictureView = viewHolder.picture; {
if(task.getValue(Task.USER_ID) == 0) {
pictureView.setVisibility(View.GONE);
viewHolder.pictureContainer.setVisibility(View.GONE);
viewHolder.pictureBorder.setVisibility(View.GONE);
} else {
pictureView.setVisibility(View.VISIBLE);
viewHolder.pictureContainer.setVisibility(View.VISIBLE);
viewHolder.pictureBorder.setVisibility(View.VISIBLE);
pictureView.setUrl(null);
try {
JSONObject user = new JSONObject(task.getValue(Task.USER));
@ -390,13 +408,12 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
value = IMPORTANCE_RESOURCES.length - 1;
if (!TextUtils.isEmpty(task.getValue(Task.RECURRENCE))) {
checkBoxView.setButtonDrawable(IMPORTANCE_REPEAT_RESOURCES[value]);
pictureView.setBackgroundResource(IMPORTANCE_REPEAT_RESOURCES[value]);
} else {
checkBoxView.setButtonDrawable(IMPORTANCE_RESOURCES[value]);
pictureView.setBackgroundResource(IMPORTANCE_RESOURCES[value]);
}
if (pictureView.getVisibility() == View.VISIBLE) {
checkBoxView.setVisibility(View.INVISIBLE);
viewHolder.pictureBorder.setBackgroundResource(IMPORTANCE_RESOURCES_LARGE[value]);
} else {
checkBoxView.setVisibility(View.VISIBLE);
}

Loading…
Cancel
Save