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

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

2
.gitignore vendored

@ -6,7 +6,7 @@ gen
local.properties
antbuild
astrid/bin
astrid/ecbuild
actionbarsherlock/library/bin
astrid/src-combined
release
dev

@ -1,30 +0,0 @@
#Android generated
bin
library/bin
gen
#Eclipse
.project
.classpath
.settings
#IntelliJ IDEA
.idea
*.iml
*.ipr
*.iws
#Maven
target
release.properties
pom.xml.*
website/_site
#Ant
build.xml
local.properties
proguard.cfg
#OSX
.DS_Store

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="api" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<loadproperties srcFile="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
unless="sdk.dir"
/>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: custom -->
<target name="javadoc">
<javadoc access="public" author="true" classpath="." destdir="doc"
doctitle="Astrid API Project" nodeprecated="false"
nodeprecatedlist="false" noindex="false" nonavbar="false"
notree="false" source="1.6" splitindex="true"
use="true" version="true">
<sourcefiles>
<fileset dir="." includes="src/**/*" />
</sourcefiles>
<classpath>
<fileset dir="${sdk.dir}/platforms/${target}" includes="android.jar" />
</classpath>
</javadoc>
</target>
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

@ -0,0 +1,40 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

@ -14,6 +14,7 @@ import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.widget.ArrayAdapter;
import com.timsu.astrid.R;
@ -70,6 +71,47 @@ public class ActFmCameraModule {
.show().setOwnerActivity(activity);
}
public static void showPictureLauncher(final Fragment fragment, final ClearImageCallback clearImageOption) {
ArrayList<String> options = new ArrayList<String>();
options.add(fragment.getString(R.string.actfm_picture_camera));
options.add(fragment.getString(R.string.actfm_picture_gallery));
if (clearImageOption != null) {
options.add(fragment.getString(R.string.actfm_picture_clear));
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(fragment.getActivity(),
android.R.layout.simple_spinner_dropdown_item, options.toArray(new String[options.size()]));
DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
@SuppressWarnings("nls")
@Override
public void onClick(DialogInterface d, int which) {
if(which == 0) {
lastTempFile = getTempFile(fragment.getActivity());
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (lastTempFile != null) {
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(lastTempFile));
}
fragment.startActivityForResult(intent, REQUEST_CODE_CAMERA);
} else if (which == 1) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
fragment.startActivityForResult(Intent.createChooser(intent,
fragment.getString(R.string.actfm_TVA_tag_picture)), REQUEST_CODE_PICTURE);
} else {
if (clearImageOption != null)
clearImageOption.clearImage();
}
}
};
// show a menu of available options
new AlertDialog.Builder(fragment.getActivity())
.setAdapter(adapter, listener)
.show().setOwnerActivity(fragment.getActivity());
}
@SuppressWarnings("nls")
private static File getTempFile(Activity activity) {
try {

@ -125,7 +125,7 @@ public class TagUpdatesActivity extends ListActivity {
@Override
public void clearImage() {
picture = null;
pictureButton.setImageResource(R.drawable.icn_camera);
pictureButton.setImageResource(R.drawable.camera_button);
}
};
pictureButton = (ImageButton) findViewById(R.id.picture);
@ -246,7 +246,7 @@ public class TagUpdatesActivity extends ListActivity {
}.start();
addCommentField.setText(""); //$NON-NLS-1$
picture = null;
pictureButton.setImageResource(R.drawable.icn_camera);
pictureButton.setImageResource(R.drawable.camera_button);
refreshUpdatesList();
StatisticsService.reportEvent(StatisticsConstants.ACTFM_TAG_COMMENT);

@ -5,19 +5,23 @@ import greendroid.widget.AsyncImageView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.support.v4.app.Fragment;
import android.text.Editable;
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;
@ -25,6 +29,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
@ -37,6 +42,9 @@ import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmCameraModule;
import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback;
import com.todoroo.astrid.actfm.ActFmCameraModule.ClearImageCallback;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.core.PluginServices;
@ -50,9 +58,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.utility.Flags;
public class EditNoteActivity extends LinearLayout {
public class EditNoteActivity extends LinearLayout implements TimerStoppedListener {
@ -71,7 +80,13 @@ public class EditNoteActivity extends LinearLayout {
private TextView loadingText;
private final View commentsBar;
private final View parentView;
private View timerView;
private View commentButton;
private int commentItems = 10;
private ImageButton pictureButton;
private Bitmap picture = null;
private final Fragment fragment;
private final List<UpdatesChangedListener> listeners = new LinkedList<UpdatesChangedListener>();
public interface UpdatesChangedListener {
@ -79,8 +94,11 @@ public class EditNoteActivity extends LinearLayout {
public void commentAdded();
}
public EditNoteActivity(Context context, View parent, long t) {
super(context);
public EditNoteActivity(Fragment fragment, View parent, long t) {
super(fragment.getActivity());
Log.d("EditnoteActivity", "Contructor being called");
this.fragment = fragment;
DependencyInjectionService.getInstance().inject(this);
setOrientation(VERTICAL);
@ -88,7 +106,6 @@ public class EditNoteActivity extends LinearLayout {
commentsBar = parent.findViewById(R.id.updatesFooter);
parentView = parent;
loadViewForTaskID(t);
}
@ -124,7 +141,10 @@ public class EditNoteActivity extends LinearLayout {
// --- UI preparation
private void setUpInterface() {
final View commentButton = commentsBar.findViewById(R.id.commentButton);
timerView = commentsBar.findViewById(R.id.timer_container);
commentButton = commentsBar.findViewById(R.id.commentButton);
commentField = (EditText) commentsBar.findViewById(R.id.commentField);
commentField.setOnEditorActionListener(new OnEditorActionListener() {
@Override
@ -140,6 +160,7 @@ public class EditNoteActivity extends LinearLayout {
@Override
public void afterTextChanged(Editable s) {
commentButton.setVisibility((s.length() > 0) ? View.VISIBLE : View.GONE);
timerView.setVisibility((s.length() > 0) ? View.GONE : View.VISIBLE);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -150,6 +171,21 @@ public class EditNoteActivity extends LinearLayout {
//
}
});
commentField.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
timerView.setVisibility(View.GONE);
commentButton.setVisibility(View.VISIBLE);
}
else {
timerView.setVisibility(View.VISIBLE);
commentButton.setVisibility(View.GONE);
}
}
});
commentButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -157,6 +193,24 @@ public class EditNoteActivity extends LinearLayout {
}
});
final ClearImageCallback clearImage = new ClearImageCallback() {
@Override
public void clearImage() {
Log.e("Errrr EditNOtes activity", "Picture clear image called");
picture = null;
pictureButton.setImageResource(R.drawable.camera_button);
}
};
pictureButton = (ImageButton) commentsBar.findViewById(R.id.picture);
pictureButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (picture != null)
ActFmCameraModule.showPictureLauncher(fragment, clearImage);
else
ActFmCameraModule.showPictureLauncher(fragment, null);
}
});
if(!TextUtils.isEmpty(task.getValue(Task.NOTES))) {
TextView notes = new TextView(getContext());
notes.setLinkTextColor(Color.rgb(100, 160, 255));
@ -168,6 +222,11 @@ public class EditNoteActivity extends LinearLayout {
//TODO add loading text back in
// loadingText = (TextView) findViewById(R.id.loading);
loadingText = new TextView(getContext());
for (UpdatesChangedListener l : listeners) {
l.updatesChanged();
}
}
private void setUpListAdapter() {
@ -244,9 +303,6 @@ public class EditNoteActivity extends LinearLayout {
}
for (UpdatesChangedListener l : listeners) {
l.updatesChanged();
}
}
@ -288,24 +344,17 @@ public class EditNoteActivity extends LinearLayout {
DateUtils.FORMAT_ABBREV_RELATIVE);
date.setText(dateString);
}
}
/*
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if(menu.size() > 0)
return true;
MenuItem item;
if(actFmPreferenceService.isLoggedIn()) {
item = menu.add(Menu.NONE, MENU_REFRESH_ID, Menu.NONE,
R.string.ENA_refresh_comments);
item.setIcon(R.drawable.ic_menu_refresh);
// picture
final AsyncImageView commentPictureView = (AsyncImageView)view.findViewById(R.id.comment_picture); {
if(TextUtils.isEmpty(item.commentPicture))
commentPictureView.setVisibility(View.GONE);
else {
commentPictureView.setVisibility(View.VISIBLE);
commentPictureView.setUrl(item.commentPicture);
}
}
return true;
}*/
// --- events
}
public void refreshData(boolean manual, SyncResultCallback existingCallback) {
final SyncResultCallback callback;
@ -349,18 +398,40 @@ public class EditNoteActivity extends LinearLayout {
}
private void addComment() {
addComment(commentField.getText().toString(), "task_comment"); //$NON-NLS-1$
}
private void addComment(String message, String actionCode) {
Update update = new Update();
update.setValue(Update.MESSAGE, commentField.getText().toString());
update.setValue(Update.ACTION_CODE, "task_comment"); //$NON-NLS-1$
update.setValue(Update.MESSAGE, message);
update.setValue(Update.ACTION_CODE, actionCode);
update.setValue(Update.USER_ID, 0L);
update.setValue(Update.TASK, task.getValue(Task.REMOTE_ID));
update.setValue(Update.CREATION_DATE, DateUtilities.now());
Flags.checkAndClear(Flags.ACTFM_SUPPRESS_SYNC);
Log.d("Add comment", "The picture is: " + picture);
if (picture != 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;
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;
pictureButton.setImageResource(R.drawable.camera_button);
StatisticsService.reportEvent(StatisticsConstants.ACTFM_TASK_COMMENT);
for (UpdatesChangedListener l : listeners) {
@ -371,43 +442,21 @@ public class EditNoteActivity extends LinearLayout {
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) {
finish();
}
};
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
// handle my own menus
switch (item.getItemId()) {
case MENU_REFRESH_ID: {
refreshData(true, null);
return true;
}
default: return false;
}
}*/
// --- adapter
private static class NoteOrUpdate {
private final String picture;
private final String title;
private final String body;
private final String commentPicture;
private final long createdAt;
public NoteOrUpdate(String picture, String title, String body,
public NoteOrUpdate(String picture, String title, String body, String commentPicture,
long createdAt) {
super();
this.picture = picture;
this.title = title;
this.body = body;
this.commentPicture = commentPicture;
this.createdAt = createdAt;
}
@ -418,6 +467,7 @@ public class EditNoteActivity extends LinearLayout {
return new NoteOrUpdate(m.getValue(NoteMetadata.THUMBNAIL),
m.getValue(NoteMetadata.TITLE),
m.getValue(NoteMetadata.BODY),
m.getValue(NoteMetadata.COMMENTPICTURE),
m.getValue(Metadata.CREATION_DATE));
}
@ -431,10 +481,12 @@ public class EditNoteActivity extends LinearLayout {
description = message;
else if(!TextUtils.isEmpty(message))
description += " " + message;
String commentPicture = u.getValue(Update.PICTURE);
return new NoteOrUpdate(user.optString("picture"),
user.optString("name", ""),
description,
commentPicture,
u.getValue(Update.CREATION_DATE));
}
@ -452,4 +504,40 @@ public class EditNoteActivity extends LinearLayout {
if (listeners.contains(listener))
listeners.remove(listener);
}
@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$
}
@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$
}
/*
* Callback from edittask 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);
}
};
return (ActFmCameraModule.activityResult((Activity)getContext(), requestCode, resultCode, data, callback));
//Handled
}
}

@ -23,10 +23,14 @@ public class NoteMetadata {
/** note thumbnail URL */
public static final StringProperty THUMBNAIL = Metadata.VALUE3;
/** note external id (use for your own purposes) */
public static final StringProperty COMMENTPICTURE = Metadata.VALUE6;
/** note external provider (use for your own purposes) */
public static final StringProperty EXT_PROVIDER = Metadata.VALUE4;
/** note external id (use for your own purposes) */
public static final StringProperty EXT_ID = Metadata.VALUE5;
}

@ -1,13 +1,14 @@
package com.todoroo.astrid.timers;
import java.util.LinkedList;
import java.util.List;
import android.app.Activity;
import android.os.SystemClock;
import android.text.format.DateUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DateUtilities;
@ -18,20 +19,21 @@ public class TimerActionControlSet extends TaskEditControlSet {
private final Button timerButton;
private final Chronometer chronometer;
private final TextView timerLabel;
private final View timerContainer;
private boolean timerActive;
private final Activity activity;
private Task task;
private TimerStoppedListener listener;
private final List<TimerStoppedListener> listeners = new LinkedList<TimerStoppedListener>();
public TimerActionControlSet(Activity activity, View parent) {
super(activity, -1);
this.activity = activity;
timerButton = (Button) parent.findViewById(R.id.timer_button);
timerButton.setOnClickListener(timerListener);
chronometer = (Chronometer) parent.findViewById(R.id.timer);
timerLabel = (TextView) parent.findViewById(R.id.timer_label);
timerContainer = (View) parent.findViewById(R.id.timer_container);
timerContainer.setOnClickListener(timerListener);
chronometer = new Chronometer(activity);
}
@Override
@ -58,11 +60,14 @@ public class TimerActionControlSet extends TaskEditControlSet {
public void onClick(View v) {
if (timerActive) {
TimerPlugin.updateTimer(activity, task, false);
if (listener != null)
for(TimerStoppedListener listener : listeners)
listener.timerStopped(task);
chronometer.stop();
} else {
TimerPlugin.updateTimer(activity, task, true);
for(TimerStoppedListener listener : listeners)
listener.timerStarted(task);
chronometer.start();
}
timerActive = !timerActive;
@ -86,23 +91,26 @@ public class TimerActionControlSet extends TaskEditControlSet {
long elapsed = task.getValue(Task.ELAPSED_SECONDS) * 1000L;
if (timerActive) {
chronometer.setVisibility(View.VISIBLE);
timerLabel.setVisibility(View.GONE);
elapsed += DateUtilities.now() - task.getValue(Task.TIMER_START);
chronometer.setBase(SystemClock.elapsedRealtime() - elapsed);
chronometer.start();
} else {
chronometer.setVisibility(View.GONE);
timerLabel.setVisibility(View.VISIBLE);
timerLabel.setText(DateUtils.formatElapsedTime(elapsed / 1000L));
chronometer.stop();
}
}
public interface TimerStoppedListener {
public void timerStopped(Task task);
public void timerStarted(Task task);
}
public void addListener(TimerStoppedListener listener) {
this.listeners.add(listener);
}
public void setListener(TimerStoppedListener listener) {
this.listener = listener;
public void removeListener(TimerStoppedListener listener) {
if (listeners.contains(listener))
listeners.remove(listener);
}
}

@ -87,4 +87,9 @@ public class TimerControlSet extends PopupControlSet implements TimerStoppedList
elapsed.readFromTask(task);
}
@Override
public void timerStarted(Task task) {
return;
}
}

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:state_enabled="true"
android:state_focused="false" android:drawable="@drawable/camera_button_gray" />
<item android:state_pressed="true" android:state_enabled="true"
android:drawable="@drawable/camera_button_red" />
<item android:state_pressed="false" android:state_enabled="true"
android:state_focused="true" android:drawable="@drawable/camera_button_red" />
</selector>

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

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:color="#f28118"
android:width="1dip" />
<gradient
android:startColor="#eeeeee"
android:endColor="#ffffff"
android:angle="270"
android:height="20dp" />
<size android:width="40dip"
android:height="40dip"/>
</shape>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#eeeeee"
android:endColor="#ffffff"
android:angle="270"
android:height="20dp" />
<stroke
android:color="#bbbbbf"
android:width="1dip" />
<size android:width="40dip"
android:height="40dip"/>
</shape>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

@ -51,40 +51,5 @@
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:visibility="gone">
<Button
android:id="@+id/timer_button"
android:layout_width="25dip"
android:layout_height="25dip"
android:layout_weight="1"/>
<Chronometer
android:id="@+id/timer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_horizontal"
android:visibility="visible"
android:textColor="@color/task_edit_details"
android:textSize="10sp" />
<TextView
android:id="@+id/timer_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center_horizontal"
android:textColor="@color/task_edit_details"
android:textSize="10sp"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -1,91 +1,100 @@
<?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"
style="@style/Content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
style="@style/Header"
android:layout_width="fill_parent"
android:layout_width="fill_parent"
android:layout_height="43dip"
android:layout_weight="1"
android:orientation="horizontal">
android:orientation="horizontal" >
<!-- List Label -->
<TextView android:id="@+id/listLabel"
<TextView
android:id="@+id/listLabel"
style="@style/TextAppearance.TLA_Header"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100"
android:gravity="center"
android:singleLine="true"
android:ellipsize="start"
style="@style/TextAppearance.TLA_Header"/>
android:gravity="center"
android:singleLine="true" />
</LinearLayout>
<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" />
<ListView
android:layout_width="fill_parent"
android:layout_height="5dip"
android:layout_weight="1"
android:visibility="gone" />
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100"/>
android:layout_height="fill_parent"
android:layout_weight="100" />
<!-- Footer -->
<LinearLayout
android:id="@+id/updatesFooter"
android:layout_width="fill_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="47dip"
android:layout_weight="1"
android:background="@drawable/footer_background"
android:padding="3dip"
android:orientation="horizontal">
android:minHeight="47dip"
android:orientation="horizontal"
android:padding="3dip" >
<!-- Voice Add Button -->
<ImageButton android:id="@+id/picture"
<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="#00000000"
android:paddingBottom="2dip"
android:paddingLeft="7dip"
android:paddingRight="7dip"
android:paddingBottom="2dip"
android:layout_weight="1"
android:background="@drawable/footer_button"
android:src="@drawable/icn_camera"
android:scaleType="fitCenter"/>
android:scaleType="centerInside"
android:src="@drawable/camera_button" />
<!-- Quick Add Task -->
<EditText android:id="@+id/commentField"
<EditText
android:id="@+id/commentField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dip"
android:layout_marginRight="1dip"
android:layout_marginLeft="1dip"
android:paddingLeft="10dip"
android:layout_weight="100"
android:background="@drawable/footer_edittext"
android:hint="@string/TVA_add_comment"
android:textSize="16sp"
android:autoText="true"
android:capitalize="sentences"/>
android:background="@drawable/footer_comment_edittext"
android:capitalize="sentences"
android:hint="@string/TVA_add_comment"
android:textSize="16sp" />
<!-- Extended Add Button -->
<ImageButton android:id="@+id/commentButton"
<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:src="@drawable/ic_footer_add"
android:scaleType="center"/>
android:scaleType="center"
android:src="@drawable/ic_footer_add" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -19,14 +19,28 @@
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_marginLeft="10dip"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:scaleType="fitCenter"
android:visibility="gone" />
android:visibility="gone" >
</greendroid.widget.AsyncImageView>
</LinearLayout>
<LinearLayout
android:id="@+id/task_row"

@ -26,31 +26,9 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="3dip"
android:gravity="center_vertical"
android:background="@drawable/task_edit_background"
android:orientation="horizontal"
android:orientation="vertical"
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">
<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"/>
<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"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
@ -117,14 +95,13 @@
<LinearLayout
android:id="@+id/updatesFooter"
android:layout_width="fill_parent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="47dip"
android:layout_weight="1"
android:padding="3dip"
android:layout_marginBottom="5dip"
android:background="#fff"
android:minHeight="47dip"
android:orientation="horizontal"
style="@style/Content">
android:padding="3dip" >
<!-- Voice Add Button -->
@ -133,40 +110,62 @@
android:layout_width="39dip"
android:layout_height="39dip"
android:layout_gravity="top"
android:layout_marginLeft="5dip"
android:layout_marginRight="3dip"
android:layout_weight="1"
android:background="?attr/asCameraButtonImg"
android:scaleType="fitCenter"/>
android:paddingBottom="2dip"
android:paddingLeft="7dip"
android:paddingRight="7dip"
android:scaleType="centerInside"
android:background="#00000000"
android:src="@drawable/camera_button" />
<!-- Quick Add Task -->
<EditText
android:id="@+id/commentField"
android:layout_width="wrap_content"
android:layout_height="39dip"
android:layout_marginRight="8dip"
android:layout_marginLeft="5dip"
android:layout_height="wrap_content"
android:layout_marginRight="1dip"
android:layout_marginLeft="1dip"
android:paddingLeft="10dip"
android:layout_weight="100"
android:paddingLeft="5dip"
android:background="@drawable/edit_title_background"
android:textSize="16sp"
android:autoText="true"
android:textColor="@android:color/black"
android:background="@drawable/footer_comment_edittext"
android:capitalize="sentences"
android:hint="@string/TVA_add_comment"
android:capitalize="sentences"/>
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:id="@+id/timer_button"
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
android:id="@+id/commentButton"
android:layout_width="39dip"
android:layout_height="39dip"
android:layout_width="35dip"
android:layout_height="35dip"
android:layout_gravity="top"
android:layout_marginRight="5dip"
android:layout_marginRight="3dip"
android:layout_weight="1"
android:background="?attr/asAddButtonImg"
android:scaleType="center"/>
android:background="@drawable/footer_button"
android:scaleType="center"
android:visibility="gone"
android:src="@drawable/ic_footer_add" />
</LinearLayout>
</LinearLayout>

@ -47,6 +47,17 @@
android:paddingLeft="50dip"
android:textSize="14sp" />
<!-- picture -->
<greendroid.widget.AsyncImageView android:id="@+id/comment_picture"
android:layout_width="100dip"
android:layout_height="100dip"
android:layout_below="@id/description"
android:paddingTop="5dip"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:scaleType="fitCenter"
android:visibility="gone" />
<!-- activity date -->
<TextView android:id="@+id/date"
android:layout_width="75dip"

@ -22,4 +22,14 @@
<!-- Title for TEA -->
<string name="TEA_timer_controls">Timer Controls</string>
<!-- Edit Notes: create comment for when timer is started -->
<string name="TEA_timer_comment_started">started this task:</string>
<!-- Edit Notes: create comment for when timer is stopped -->
<string name="TEA_timer_comment_stopped">stopped doing this task:</string>
<!-- Edit Notes: comment to notify how long was spent on task -->
<string name="TEA_timer_comment_spent">Time spent:</string>
</resources>

@ -136,6 +136,16 @@ public final class TaskEditActivity extends Fragment implements
*/
private static final String TASK_IN_PROGRESS = "task_in_progress"; //$NON-NLS-1$
/**
* Task remote id (during orientation change)
*/
private static final String TASK_REMOTE_ID = "task_remote_id"; //$NON-NLS-1$
/**
* Task remote id (during orientation change)
*/
private static final String MORE_EXPANDED = "more_expanded"; //$NON-NLS-1$
/**
* Tab to start on
*/
@ -204,6 +214,7 @@ public final class TaskEditActivity extends Fragment implements
private EditNotesControlSet notesControlSet = null;
private HideUntilControlSet hideUntilControls = null;
private TagsControlSet tagsControlSet = null;
private TimerActionControlSet timerAction;
private EditText title;
private TaskEditMoreControls moreControls;
private EditNoteActivity editNotes;
@ -241,6 +252,7 @@ public final class TaskEditActivity extends Fragment implements
private long remoteId = 0;
private boolean moreExpanded = false;
/*
* ======================================================================
* ======================================================= initialization
@ -285,6 +297,13 @@ public final class TaskEditActivity extends Fragment implements
if (task != null) {
model = task;
}
if (savedInstanceState.containsKey(TASK_REMOTE_ID)) {
remoteId = savedInstanceState.getLong(TASK_REMOTE_ID);
}
if (savedInstanceState.containsKey(MORE_EXPANDED)) {
moreExpanded = savedInstanceState.getBoolean(MORE_EXPANDED);
}
}
getActivity().setResult(Activity.RESULT_OK);
@ -348,15 +367,27 @@ public final class TaskEditActivity extends Fragment implements
View more_section = (View) getView().findViewById(R.id.more_header);
View commentsBar = (View) getView().findViewById(R.id.updatesFooter);
if (remoteId > 0) {
long idParam = getActivity().getIntent().getLongExtra(TOKEN_ID,
-1L);
if (remoteId > 0 && idParam > -1L) {
if (editNotes == null) {
editNotes = new EditNoteActivity(this, getView(),
idParam);
editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
editNotes.addListener(this);
if (timerAction != null) {
timerAction.addListener(editNotes);
}
}
else {
editNotes.loadViewForTaskID(idParam);
}
if (mAdapter == null) {
mAdapter = new TaskEditViewPager(getActivity());
mAdapter.parent = this;
long idParam = getActivity().getIntent().getLongExtra(TOKEN_ID,
-1L);
editNotes = new EditNoteActivity(getActivity(), getView(),
editNotes = new EditNoteActivity(this, getView(),
idParam);
editNotes.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
@ -386,8 +417,16 @@ public final class TaskEditActivity extends Fragment implements
} else {
if (moreControls.getParent() != null && moreControls.getParent() != more_section) {
((ViewGroup) moreControls.getParent()).removeView(moreControls);
if (moreControls.getParent() != null) {
if (moreControls.getParent() == more_section) {
setPagerHeightForPosition(TAB_VIEW_MORE);
}
else {
((ViewGroup) moreControls.getParent()).removeView(moreControls);
}
}
if (moreExpanded){
autoExpandMore();
}
more_section.setVisibility(View.VISIBLE);
more_tab.setVisibility(View.GONE);
@ -423,8 +462,8 @@ public final class TaskEditActivity extends Fragment implements
controls.add(editTitle);
titleControls.addView(editTitle.getDisplayView(), 0, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1.0f));
TimerActionControlSet timerAction = new TimerActionControlSet(
getActivity(), editTitle.getView());
timerAction = new TimerActionControlSet(
getActivity(), getView());
controls.add(timerAction);
controls.add(peopleControlSet = new EditPeopleControlSet(getActivity(),
@ -499,7 +538,7 @@ public final class TaskEditActivity extends Fragment implements
R.layout.control_set_timers,
R.layout.control_set_default_display,
R.string.TEA_timer_controls);
timerAction.setListener(timerControl);
timerAction.addListener(timerControl);
controls.add(timerControl);
controlSetMap.put(getString(R.string.TEA_ctrl_timer_pref), timerControl);
@ -592,11 +631,7 @@ public final class TaskEditActivity extends Fragment implements
public void onClick(View v) {
fadeIn.setDuration(300);
fadeOut.setDuration(300);
LinearLayout moreHeader = (LinearLayout) getView().findViewById(
R.id.more_header);
moreHeader.removeAllViews();
moreHeader.addView(moreControls);
moreHeader.setOnClickListener(null);
autoExpandMore();
}
};
// set up save, cancel, and delete buttons
@ -609,6 +644,15 @@ public final class TaskEditActivity extends Fragment implements
}
private void autoExpandMore() {
moreExpanded = true;
LinearLayout moreHeader = (LinearLayout) getView().findViewById(
R.id.more_header);
moreHeader.removeAllViews();
moreHeader.addView(moreControls);
moreHeader.setOnClickListener(null);
}
private void constructWhenDialog(View whenDialogView) {
int theme = ThemeService.getEditDialogTheme();
whenDialog = new Dialog(getActivity(), theme);
@ -750,6 +794,8 @@ public final class TaskEditActivity extends Fragment implements
/** Convenience method to populate fields after setting model to null */
public void repopulateFromScratch(Intent intent) {
model = null;
remoteId = 0;
moreExpanded = false;
populateFields(intent);
}
@ -1005,13 +1051,17 @@ public final class TaskEditActivity extends Fragment implements
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
if(actFmPreferenceService.isLoggedIn() && remoteId > 0) {
item = menu.add(Menu.NONE, MENU_COMMENTS_REFRESH_ID, Menu.NONE,
}
@Override
public void onPrepareOptionsMenu (Menu menu) {
if(actFmPreferenceService.isLoggedIn() && remoteId > 0 && menu.findItem(MENU_COMMENTS_REFRESH_ID) == null) {
MenuItem item = menu.add(Menu.NONE, MENU_COMMENTS_REFRESH_ID, Menu.NONE,
R.string.ENA_refresh_comments);
item.setIcon(R.drawable.ic_menu_refresh);
}
super.onPrepareOptionsMenu(menu);
}
@Override
public void onPause() {
super.onPause();
@ -1035,6 +1085,10 @@ public final class TaskEditActivity extends Fragment implements
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d("Activity !!!", "Called on camera for request code: " + requestCode + "EditNOtes: " + editNotes.toString());
if (editNotes.activityResult(requestCode, resultCode, data)) {
return;
}
if (requestCode == REQUEST_VOICE_RECOG
&& resultCode == Activity.RESULT_OK) {
// handle the result of voice recognition, put it into the
@ -1060,6 +1114,8 @@ public final class TaskEditActivity extends Fragment implements
// stick our task into the outState
outState.putParcelable(TASK_IN_PROGRESS, model);
outState.putLong(TASK_REMOTE_ID, remoteId);
outState.putBoolean(MORE_EXPANDED, moreExpanded);
}
@Override

@ -249,6 +249,7 @@ 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.completeBox = (CheckBox)view.findViewById(R.id.completeBox);
viewHolder.dueDate = (TextView)view.findViewById(R.id.dueDate);
viewHolder.details1 = (TextView)view.findViewById(R.id.details1);
@ -302,6 +303,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
public TextView nameView;
public CheckBox completeBox;
public AsyncImageView picture;
public View pictureContainer;
public TextView dueDate;
public TextView details1, details2;
public LinearLayout taskRow;
@ -366,8 +368,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);
} else {
pictureView.setVisibility(View.VISIBLE);
viewHolder.pictureContainer.setVisibility(View.VISIBLE);
pictureView.setUrl(null);
try {
JSONObject user = new JSONObject(task.getValue(Task.USER));

Loading…
Cancel
Save