Task timer should add to your activity stream

pull/14/head
Andrew Shaw 13 years ago
parent 2c9e4126bc
commit 554690d3bb

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

@ -24,7 +24,7 @@ public class NoteMetadata {
public static final StringProperty THUMBNAIL = Metadata.VALUE3; public static final StringProperty THUMBNAIL = Metadata.VALUE3;
/** note external id (use for your own purposes) */ /** 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) */ /** note external provider (use for your own purposes) */
public static final StringProperty EXT_PROVIDER = Metadata.VALUE4; public static final StringProperty EXT_PROVIDER = Metadata.VALUE4;

@ -7,8 +7,8 @@ import android.app.Activity;
import android.os.SystemClock; import android.os.SystemClock;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Chronometer; import android.widget.Chronometer;
import android.widget.ImageButton;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
@ -17,21 +17,18 @@ import com.todoroo.astrid.helper.TaskEditControlSet;
public class TimerActionControlSet extends TaskEditControlSet { public class TimerActionControlSet extends TaskEditControlSet {
private final Button timerButton; private final ImageButton timerButton;
private final Chronometer chronometer; private final Chronometer chronometer;
private final View timerContainer;
private boolean timerActive; private boolean timerActive;
private final Activity activity; private final Activity activity;
private Task task; 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) { public TimerActionControlSet(Activity activity, View parent) {
super(activity, -1); super(activity, -1);
this.activity = activity; this.activity = activity;
timerButton = (Button) parent.findViewById(R.id.timer_button); timerButton = (ImageButton) parent.findViewById(R.id.timer_button);
timerButton.setOnClickListener(timerListener);
timerContainer = (View) parent.findViewById(R.id.timer_container);
timerContainer.setOnClickListener(timerListener);
chronometer = new Chronometer(activity); chronometer = new Chronometer(activity);
} }
@ -59,14 +56,14 @@ public class TimerActionControlSet extends TaskEditControlSet {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (timerActive) { if (timerActive) {
TimerPlugin.updateTimer(activity, task, false); // TimerPlugin.updateTimer(activity, task, false);
for(TimerStoppedListener listener : listeners) for(TimerActionListener listener : listeners)
listener.timerStopped(task); listener.timerStopped(task);
chronometer.stop(); chronometer.stop();
} else { } else {
TimerPlugin.updateTimer(activity, task, true); // TimerPlugin.updateTimer(activity, task, true);
for(TimerStoppedListener listener : listeners) for(TimerActionListener listener : listeners)
listener.timerStarted(task); listener.timerStarted(task);
chronometer.start(); chronometer.start();
} }
@ -100,16 +97,16 @@ public class TimerActionControlSet extends TaskEditControlSet {
} }
} }
public interface TimerStoppedListener { public interface TimerActionListener {
public void timerStopped(Task task); public void timerStopped(Task task);
public void timerStarted(Task task); public void timerStarted(Task task);
} }
public void addListener(TimerStoppedListener listener) { public void addListener(TimerActionListener listener) {
this.listeners.add(listener); this.listeners.add(listener);
} }
public void removeListener(TimerStoppedListener listener) { public void removeListener(TimerActionListener listener) {
if (listeners.contains(listener)) if (listeners.contains(listener))
listeners.remove(listener); listeners.remove(listener);
} }

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

@ -39,9 +39,9 @@
android:id="@+id/completeBox" android:id="@+id/completeBox"
android:layout_width="45dip" android:layout_width="45dip"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginLeft="10dip" android:layout_marginLeft="12dip" />
android:button="@drawable/btn_check" />
<!-- assignee photo --> <!-- assignee photo -->

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

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

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

Loading…
Cancel
Save