Merge remote-tracking branch 'origin/20120221_as_tag_settings' into 4.0

pull/14/head
Tim Su 13 years ago
commit 2a8ad3cdd4

@ -1,7 +1,5 @@
package com.todoroo.astrid.actfm;
import greendroid.widget.AsyncImageView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -50,6 +48,7 @@ import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.helper.AsyncImageView;
import com.todoroo.astrid.service.AstridDependencyInjector;
import com.todoroo.astrid.service.MetadataService;
import com.todoroo.astrid.service.TagDataService;
@ -167,7 +166,7 @@ public class EditPeopleControlSet extends PopupControlSet {
cbFacebook = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_facebook);
cbTwitter = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_twitter);
sharedWithContainer.addPerson(""); //$NON-NLS-1$
sharedWithContainer.addPerson("", ""); //$NON-NLS-1$
setUpListeners();
}
@ -206,7 +205,7 @@ public class EditPeopleControlSet extends PopupControlSet {
if(people != null) {
for(int i = 0; i < people.length(); i++) {
String person = people.getString(i);
TextView textView = sharedWithContainer.addPerson(person);
TextView textView = sharedWithContainer.addPerson(person, "");
textView.setEnabled(false);
sharedPeople.add(PeopleContainer.createUserJson(textView));
}
@ -681,7 +680,7 @@ public class EditPeopleControlSet extends PopupControlSet {
private void makePrivateTask() {
sharedWithContainer.removeAllViews();
sharedWithContainer.addPerson(""); //$NON-NLS-1$
sharedWithContainer.addPerson("", ""); //$NON-NLS-1$
assignToMe();
}

@ -1,12 +1,9 @@
package com.todoroo.astrid.actfm;
import greendroid.widget.AsyncImageView;
import java.io.IOException;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.Context;
@ -24,8 +21,10 @@ import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@ -34,6 +33,7 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback;
@ -41,8 +41,12 @@ import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.activity.FilterListFragment;
import com.todoroo.astrid.activity.ShortcutActivity;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.helper.AsyncImageView;
import com.todoroo.astrid.helper.ImageDiskCache;
import com.todoroo.astrid.service.StatisticsConstants;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.TagDataService;
@ -82,12 +86,14 @@ public class TagSettingsActivity extends FragmentActivity {
private EditText tagDescription;
private CheckBox isSilent;
private Bitmap setBitmap;
private final ImageDiskCache imageCache;
private boolean isNewTag = false;
private boolean isDialog;
public TagSettingsActivity() {
DependencyInjectionService.getInstance().inject(this);
imageCache = ImageDiskCache.getInstance();
}
@Override
@ -170,13 +176,25 @@ public class TagSettingsActivity extends FragmentActivity {
isSilent = (CheckBox) findViewById(R.id.tag_silenced);
isSilent.setChecked(tagData.getFlag(TagData.FLAGS, TagData.FLAG_SILENT));
Button leaveListButton = (Button) findViewById(R.id.leave_list);
leaveListButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showDeleteDialog(tagData);
}
});
if (isNewTag) {
leaveListButton.setVisibility(View.GONE);
}
else if (tagData.getValue(TagData.MEMBER_COUNT) > 0) {
leaveListButton.setText(getString(R.string.tag_leave_button));
}
if(actFmPreferenceService.isLoggedIn()) {
picture.setVisibility(View.VISIBLE);
picture.setDefaultImageResource(TagService.getDefaultImageIDForTag(tagData.getValue(TagData.NAME)));
findViewById(R.id.picture_label).setVisibility(View.VISIBLE);
findViewById(R.id.listSettingsMore).setVisibility(View.VISIBLE);
findViewById(R.id.tag_silenced_container).setVisibility(View.VISIBLE);
}
picture.setDefaultImageResource(TagService.getDefaultImageIDForTag(tagData.getValue(TagData.NAME)));
picture.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
@ -187,12 +205,13 @@ public class TagSettingsActivity extends FragmentActivity {
if (isNewTag) {
findViewById(R.id.create_shortcut_container).setVisibility(View.GONE);
} else {
findViewById(R.id.create_shortcut).setOnClickListener(new OnClickListener() {
findViewById(R.id.create_shortcut_container).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (filter == null) {
filter = TagFilterExposer.filterFromTagData(TagSettingsActivity.this, tagData);
}
filter.listingIcon = picture.getImageBitmap();
FilterListFragment.showCreateShortcutDialog(TagSettingsActivity.this, ShortcutActivity.createIntent(filter), filter);
}
});
@ -268,14 +287,14 @@ public class TagSettingsActivity extends FragmentActivity {
public void onClick(DialogInterface d, int which) {
tagMembers.removeAllViews();
tagMembers.addPerson(""); //$NON-NLS-1$
tagMembers.addPerson("", ""); //$NON-NLS-1$
}
};
DialogUtilities.okCancelCustomDialog(TagSettingsActivity.this, getString(R.string.actfm_EPA_login_button),
getString(R.string.actfm_TVA_login_to_share), R.string.actfm_EPA_login_button,
R.string.actfm_EPA_dont_share_button, android.R.drawable.ic_dialog_alert,
okListener, cancelListener);
Toast.makeText(this, R.string.tag_list_saved, Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.tag_list_saved, Toast.LENGTH_LONG).show();
return;
@ -317,6 +336,7 @@ public class TagSettingsActivity extends FragmentActivity {
actFmSyncService.pushTagDataOnSave(tagData, tagData.getMergedValues());
if(setBitmap != null && tagData.getValue(TagData.REMOTE_ID) > 0)
uploadTagPicture(setBitmap);
runOnUiThread(loadTag);
}
}).start();
@ -334,6 +354,18 @@ public class TagSettingsActivity extends FragmentActivity {
finish();
}
private void saveTagPictureLocally(Bitmap bitmap) {
if (bitmap == null) return;
try {
String tagPicture = ImageDiskCache.getPictureHash(tagData);
imageCache.put(tagPicture, bitmap);
tagData.setValue(TagData.PICTURE, tagPicture);
}
catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void finish() {
finishWithAnimation(!isDialog);
@ -356,30 +388,19 @@ public class TagSettingsActivity extends FragmentActivity {
if (isNewTag) {
titleView.setText(getString(R.string.tag_new_list));
} else {
titleView.setText(getString(R.string.tag_settings_title, tagData.getValue(TagData.NAME)));
titleView.setText(getString(R.string.tag_settings_title));
}
} else {
if (isNewTag) {
setTitle(getString(R.string.tag_new_list));
} else {
setTitle(getString(R.string.tag_settings_title, tagData.getValue(TagData.NAME)));
setTitle(getString(R.string.tag_settings_title));
}
}
picture.setUrl(tagData.getValue(TagData.PICTURE));
TextView ownerLabel = (TextView) findViewById(R.id.tag_owner);
try {
if(tagData.getFlag(TagData.FLAGS, TagData.FLAG_EMERGENT)) {
ownerLabel.setText(String.format("<%s>", getString(R.string.actfm_TVA_tag_owner_none)));
} else if(tagData.getValue(TagData.USER_ID) == 0) {
ownerLabel.setText(Preferences.getStringValue(ActFmPreferenceService.PREF_NAME));
} else {
JSONObject owner = new JSONObject(tagData.getValue(TagData.USER));
ownerLabel.setText(owner.getString("name"));
}
} catch (JSONException e) {
Log.e("tag-view-activity", "json error refresh owner", e);
ownerLabel.setText("<error>");
if (!isNewTag) {
ImageView shortcut = (ImageView) findViewById(R.id.create_shortcut);
shortcut.setImageBitmap(FilterListFragment.superImposeListIcon(this, picture.getImageBitmap(), tagData.getValue(TagData.NAME)));
}
String peopleJson = tagData.getValue(TagData.MEMBERS);
@ -401,7 +422,7 @@ public class TagSettingsActivity extends FragmentActivity {
}
}
tagMembers.addPerson(""); //$NON-NLS-1$
tagMembers.addPerson("", ""); //$NON-NLS-1$
}
private void uploadTagPicture(final Bitmap bitmap) {
@ -410,6 +431,10 @@ public class TagSettingsActivity extends FragmentActivity {
public void run() {
try {
String url = actFmSyncService.setTagPicture(tagData.getValue(TagData.REMOTE_ID), bitmap);
if (TextUtils.isEmpty(url)) return;
if (imageCache.contains(tagData.getValue(TagData.PICTURE))) {
imageCache.move(tagData.getValue(TagData.PICTURE), url);
}
tagData.setValue(TagData.PICTURE, url);
Flags.set(Flags.ACTFM_SUPPRESS_SYNC);
tagDataService.save(tagData);
@ -438,6 +463,7 @@ public class TagSettingsActivity extends FragmentActivity {
setBitmap = bitmap;
if(tagData.getValue(TagData.REMOTE_ID) > 0)
uploadTagPicture(bitmap);
saveTagPictureLocally(bitmap);
}
};
if (ActFmCameraModule.activityResult(this, requestCode, resultCode, data, callback)) {
@ -481,6 +507,38 @@ public class TagSettingsActivity extends FragmentActivity {
protected void showDeleteDialog(TagData tagData) {
int string;
if (tagData != null && tagData.getValue(TagData.MEMBER_COUNT) > 0)
string = R.string.DLG_leave_this_shared_tag_question;
else
string = R.string.DLG_delete_this_tag_question;
DialogUtilities.okCancelDialog(this, getString(string, tagData.getValue(TagData.NAME)), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
deleteTag();
}
}, null );
}
protected boolean deleteTag() {
tagDataService.delete(tagData.getId());
if(tagData != null) {
tagData.setValue(TagData.DELETION_DATE, DateUtilities.now());
PluginServices.getTagDataService().save(tagData);
}
Intent tagDeleted = new Intent(AstridApiConstants.BROADCAST_EVENT_TAG_DELETED);
tagDeleted.putExtra(TagViewFragment.EXTRA_TAG_NAME, tagData.getValue(TagData.NAME));
tagDeleted.putExtra(TagFilterExposer.TAG_SQL, TagFilterExposer.SHOW_ACTIVE_TASKS);
this.finish();
sendBroadcast(tagDeleted);
return true;
}

@ -1,6 +1,6 @@
package com.todoroo.astrid.actfm;
import greendroid.widget.AsyncImageView;
import com.todoroo.astrid.helper.AsyncImageView;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
@ -348,6 +348,7 @@ public class TagUpdatesFragment extends ListFragment {
update.setValue(Update.TAGS, "," + tagData.getValue(TagData.REMOTE_ID) + ",");
update.setValue(Update.TAGS_LOCAL, "," + tagData.getId() + ",");
update.setValue(Update.CREATION_DATE, DateUtilities.now());
update.setValue(Update.TARGET_NAME, tagData.getValue(TagData.NAME));
if (picture != null) {
update.setValue(Update.PICTURE, Update.PICTURE_LOADING);
try {

@ -1,6 +1,6 @@
package com.todoroo.astrid.actfm;
import greendroid.widget.AsyncImageView;
import com.todoroo.astrid.helper.AsyncImageView;
import org.json.JSONArray;
import org.json.JSONException;

@ -1,8 +1,5 @@
package com.todoroo.astrid.notes;
import greendroid.widget.AsyncImageView;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -58,6 +55,7 @@ import com.todoroo.astrid.dao.UpdateDao;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.Update;
import com.todoroo.astrid.helper.AsyncImageView;
import com.todoroo.astrid.helper.ImageDiskCache;
import com.todoroo.astrid.helper.ProgressBarSyncResultCallback;
import com.todoroo.astrid.service.MetadataService;
@ -367,16 +365,7 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
commentPictureView.setVisibility(View.GONE);
else {
commentPictureView.setVisibility(View.VISIBLE);
if(imageCache.contains(item.commentPicture)) {
try {
commentPictureView.setDefaultImageBitmap(imageCache.get(item.commentPicture));
} catch (IOException e) {
e.printStackTrace();
}
}
else {
commentPictureView.setUrl(item.commentPicture);
}
commentPictureView.setUrl(item.commentPicture);
}
}
}
@ -428,9 +417,6 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
}
private String getPictureHashForUpdate(Update u) {
return String.format("%s%s", u.getValue(Update.TASK), u.getValue(Update.CREATION_DATE)); //$NON-NLS-1$
}
private void addComment(String message, String actionCode, boolean usePicture) {
// Allow for users to just add picture
if (TextUtils.isEmpty(message) && usePicture) {
@ -444,11 +430,12 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
update.setValue(Update.TASK, task.getValue(Task.REMOTE_ID));
update.setValue(Update.TASK_LOCAL, task.getId());
update.setValue(Update.CREATION_DATE, DateUtilities.now());
update.setValue(Update.TARGET_NAME, task.getValue(Task.TITLE));
if (usePicture && pendingCommentPicture != null) {
update.setValue(Update.PICTURE, Update.PICTURE_LOADING);
try {
String updateString = getPictureHashForUpdate(update);
String updateString = ImageDiskCache.getPictureHash(update);
imageCache.put(updateString, pendingCommentPicture);
update.setValue(Update.PICTURE, updateString);
}

@ -59,6 +59,7 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE
private static final String TAG = "tag"; //$NON-NLS-1$
public static final String TAG_SQL = "tagSql"; //$NON-NLS-1$
public static final String SHOW_ACTIVE_TASKS = "show_main_task_view"; //$NON-NLS-1$
@Autowired TagDataService tagDataService;
@Autowired GtasksPreferenceService gtasksPreferenceService;

@ -138,6 +138,18 @@ public final class TagService {
Field.field("mtags." + TAG.name).eqCaseInsensitive(tag)))).where(criterion);
}
/**
* Return SQL selector query for getting tasks with a given tagData
*
* @param tagData
* @return
*/
public static QueryTemplate queryTemplate(Criterion criterion, TagData tagData) {
return new QueryTemplate().join(Join.inner(Metadata.TABLE,
Task.ID.eq(Metadata.TASK))).where(tagEqIgnoreCase(tagData.getValue(TagData.NAME), criterion));
}
}
public static Criterion memberOfTagData(long tagDataRemoteId) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

@ -5,7 +5,7 @@
android:layout_height="fill_parent"
android:paddingLeft="8dip">
<greendroid.widget.AsyncImageView android:id="@+id/person_image"
<com.todoroo.astrid.helper.AsyncImageView android:id="@+id/person_image"
android:layout_width="40dip"
android:layout_height="44dip"
android:gravity="center"

@ -10,7 +10,7 @@
android:orientation="horizontal">
<!-- picture thumbnail -->
<greendroid.widget.AsyncImageView android:id="@+id/icon"
<com.todoroo.astrid.helper.AsyncImageView android:id="@+id/icon"
android:layout_width="40dip"
android:layout_height="44dip"
android:gravity="center"

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
<!--
Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -14,24 +15,51 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<com.todoroo.astrid.ui.ContactsAutoComplete
android:id="@+id/text1"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:textColor="@android:color/black"
android:hint="@string/actfm_person_hint" />
<ImageButton android:id="@+id/button1"
android:background="@drawable/btn_dismiss"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center"
android:layout_margin="4dip"
/>
</LinearLayout>
android:orientation="horizontal" >
<com.todoroo.astrid.helper.AsyncImageView
android:id="@+id/icon"
android:layout_width="31dip"
android:layout_height="35dip"
android:layout_margin="5dip"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:gravity="center"
android:scaleType="fitCenter" />
<com.todoroo.astrid.ui.ContactsAutoComplete
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dip"
android:layout_weight="1"
android:background="#00000000"
android:hint="@string/actfm_person_hint"
style="@style/TextAppearance"
android:textCursorDrawable="@null"
android:textSize="15sp" />
<ImageButton
android:id="@+id/button1"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center"
android:layout_margin="4dip"
android:background="@drawable/btn_dismiss" />
</LinearLayout>
<View
android:id="@+id/divider"
style="@style/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1dip" />
</LinearLayout>

@ -21,7 +21,7 @@
android:visibility="gone"/>
<!-- filter url image icon -->
<greendroid.widget.AsyncImageView android:id="@+id/url_image"
<com.todoroo.astrid.helper.AsyncImageView android:id="@+id/url_image"
android:layout_width="30dip"
android:layout_height="48dip"
android:layout_alignParentLeft="true"

@ -1,221 +1,229 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- settings tab -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:id="@+id/settings"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/Content">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dip"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dip">
<TextView
android:id="@+id/tag_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="10dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_TVA_tag_label" />
<LinearLayout
android:id="@+id/save_and_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/tag_label"
android:layout_alignParentRight="true"
android:orientation="horizontal"
android:gravity="right"
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:layout_marginRight="10dip"
android:background="@android:color/transparent"
android:src="@android:drawable/ic_menu_save"/>
</LinearLayout>
<EditText
android:id="@+id/tag_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tag_label"
android:layout_marginTop="10dip" />
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="@android:drawable/divider_horizontal_dark" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:paddingBottom="5dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_TVA_members_label" />
<com.todoroo.astrid.ui.PeopleContainer
android:id="@+id/members_container"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="@android:drawable/divider_horizontal_dark" />
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<TextView
android:id="@+id/picture_label"
android:layout_weight="100" >
<ScrollView
android:id="@+id/settings"
style="@style/Content_EditScroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100"
android:padding="10dip"
android:paddingTop="0dip" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/save_and_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:orientation="horizontal"
android:visibility="gone" >
<ImageButton
android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dip"
android:visibility="gone"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_TVA_list_icon_label"/>
<greendroid.widget.AsyncImageView
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:layout_marginRight="10dip"
android:background="@android:color/transparent"
android:src="@android:drawable/ic_menu_save" />
</LinearLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dip"
android:paddingTop="5dip" >
<!-- picture -->
<com.todoroo.astrid.helper.AsyncImageView
android:id="@+id/picture"
android:layout_width="80dip"
android:layout_height="80dip"
android:layout_alignParentLeft="true"
android:scaleType="centerInside"
android:paddingRight="10dip"
android:visibility="gone"
android:layout_below="@id/picture_label"
astrid:defaultSrc="@android:drawable/ic_menu_gallery" />
<TextView
android:id="@+id/description_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@id/picture"
android:layout_marginTop="10dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_TVA_tag_description_label" />
<EditText
android:id="@+id/tag_description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/picture"
android:layout_below="@id/description_label"
android:layout_marginTop="10dip"
android:hint="@string/actfm_TVA_tag_description_hint" />
<View
android:id="@+id/divider"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_marginTop="25dip"
android:layout_below="@id/tag_description"
style="@style/TEA_Separator" />
<!-- Footer -->
<LinearLayout
android:id="@+id/listSettingsMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/divider"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_TVA_tag_owner_label" />
<TextView
android:id="@+id/tag_owner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:textSize="20sp"/>
<CheckBox
android:id="@+id/tag_silenced"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:paddingLeft="45dip"
style="@style/TextAppearance"
android:text="@string/actfm_TVA_silence_label" />
</LinearLayout>
<LinearLayout
android:id="@+id/create_shortcut_container"
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
astrid:defaultSrc="@android:drawable/ic_menu_gallery"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tag_label"
style="@style/TextAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dip"
android:layout_toRightOf="@id/picture"
android:text="@string/actfm_TVA_tag_label" />
<LinearLayout
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tag_label"
android:layout_marginLeft="10dip"
android:layout_marginTop="14dip"
android:layout_toRightOf="@id/picture"
android:padding="10dip"
android:paddingBottom="14dip" >
<EditText
android:id="@+id/tag_name"
style="@style/TextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:hint="@string/actfm_TVA_tag_description_hint"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
<TextView
style="@style/TextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:paddingBottom="5dip"
android:text="@string/actfm_TVA_members_label" />
<com.todoroo.astrid.ui.PeopleContainer
android:id="@+id/members_container"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<TextView
android:id="@+id/description_label"
style="@style/TextAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:text="@string/actfm_TVA_tag_description_label" />
<LinearLayout
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tag_label"
android:layout_marginTop="5dip"
android:padding="10dip"
android:paddingBottom="14dip" >
<EditText
android:id="@+id/tag_description"
style="@style/TextAppearance"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:hint="@string/actfm_TVA_tag_description_hint"
android:textCursorDrawable="@null"
android:textSize="15sp" />
</LinearLayout>
<!-- Footer -->
<TextView
android:id="@+id/settings_label"
style="@style/TextAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:text="@string/actfm_TVA_tag_settings_label" />
<LinearLayout
style="@style/EditRow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/tag_silenced_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/divider"
android:layout_alignParentRight="true"
android:gravity="right"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/FLA_shortcut_dialog_title" />
<ImageButton
android:id="@+id/create_shortcut"
android:layout_width="75dip"
android:maxWidth="50dip"
android:layout_height="50dip"
android:maxHeight="50dip"
android:background="@android:color/transparent"
android:src="@android:drawable/ic_media_ff"
android:scaleType="fitCenter"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
android:orientation="horizontal"
android:padding="5dip" >
<TextView
style="@style/TextAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dip"
android:paddingLeft="5dip"
android:text="@string/actfm_TVA_silence_label" />
<CheckBox
android:id="@+id/tag_silenced"
style="@style/TextAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingRight="5dip" />
</RelativeLayout>
<View
android:id="@+id/divider"
style="@style/TEA_Separator"
android:layout_width="fill_parent"
android:layout_height="1dip" />
<RelativeLayout
android:id="@+id/create_shortcut_container"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip" >
<TextView
style="@style/TextAppearance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dip"
android:paddingLeft="5dip"
android:text="@string/FLA_shortcut_dialog_title" />
<ImageButton
android:id="@+id/create_shortcut"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_alignParentRight="true"
android:background="@android:color/transparent"
android:scaleType="fitCenter"
android:src="@drawable/icn_list_shortcut" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="@+id/leave_list"
style="@style/DeleteTag"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:layout_marginTop="15dip"
android:text="@string/tag_delete_button" />
</LinearLayout>
</ScrollView>
</LinearLayout>

@ -105,4 +105,4 @@
android:scaleType="center" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -18,7 +18,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal" >
<greendroid.widget.AsyncImageView
<com.todoroo.astrid.helper.AsyncImageView
android:id="@+id/tag_picture"
android:layout_width="80dip"
android:layout_height="80dip"

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- See the file "LICENSE" for the full license governing this code. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="57dip"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:gravity="center_vertical"
android:orientation="horizontal">
<View
android:id="@+id/importance_legacy"
android:layout_width="4dip"
android:layout_height="fill_parent"
android:visibility="gone" />
<!-- indent -->
<View android:id="@+id/indent"
android:layout_width="0dip"
android:layout_height="fill_parent"/>
<!-- grabber -->
<ImageView android:id="@+id/grabber"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="@drawable/grabber"/>
<RelativeLayout android:id="@+id/rowBody"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:drawable/list_selector_background"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:paddingLeft="5dip">
<com.todoroo.astrid.ui.CheckableImageView
android:id="@+id/completeBox"
android:layout_width="45dip"
android:layout_height="wrap_content"
android:minHeight="30dip"
android:scaleType="center"
android:layout_alignParentTop="true"
android:layout_marginLeft="2dip"
android:button="@drawable/btn_check" />
<!-- assignee photo -->
<com.todoroo.astrid.helper.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" />
<LinearLayout
android:id="@+id/task_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/completeBox"
android:layout_centerVertical="true"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingLeft="5dip" >
<!-- task name -->
<TextView
android:id="@+id/title"
style="@style/TextAppearance.TAd_ItemTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="100"
android:gravity="center_vertical"
android:maxLines="2" />
<!-- due date -->
<LinearLayout
android:id="@+id/taskActionContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="40dip"
android:layout_marginRight="4dip"
android:orientation="vertical"
android:gravity="right|center_vertical">
<TextView
android:id="@+id/dueDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="4dip"
android:gravity="center_vertical|right" />
<ImageView
android:id="@+id/taskActionIcon"
android:layout_width="20dip"
android:layout_height="20dip"
android:scaleType="fitCenter"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
<!-- details line 1 -->
<TextView android:id="@+id/details1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_row"
android:layout_alignParentLeft="true"
android:layout_marginTop="-1dip"
style="@style/TextAppearance.TAd_ItemDetails"
android:visibility="gone" />
<!-- details line 2 -->
<TextView android:id="@+id/details2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/details1"
android:layout_alignParentLeft="true"
style="@style/TextAppearance.TAd_ItemDetails"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>

@ -33,7 +33,7 @@
android:scaleType="center"
android:visibility="gone" >
</ImageView>
<greendroid.widget.AsyncImageView
<com.todoroo.astrid.helper.AsyncImageView
android:id="@+id/picture"
android:layout_width="45dip"
android:layout_height="45dip"
@ -42,8 +42,7 @@
android:layout_centerVertical="true"
astrid:defaultSrc="@drawable/icn_default_person_image"
android:scaleType="fitCenter"
android:visibility="gone" >
</greendroid.widget.AsyncImageView>
android:visibility="gone" />
<com.todoroo.astrid.ui.CheckableImageView
android:id="@+id/completeBox"

@ -16,7 +16,7 @@
android:paddingRight="6dip">
<!-- picture -->
<greendroid.widget.AsyncImageView android:id="@+id/picture"
<com.todoroo.astrid.helper.AsyncImageView android:id="@+id/picture"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_alignParentTop="true"
@ -52,7 +52,7 @@
<!-- picture -->
<greendroid.widget.AsyncImageView android:id="@+id/comment_picture"
<com.todoroo.astrid.helper.AsyncImageView android:id="@+id/comment_picture"
android:layout_width="100dip"
android:layout_height="100dip"
android:layout_below="@id/date"
@ -66,7 +66,7 @@
</RelativeLayout>
<!-- picture -->
<greendroid.widget.AsyncImageView
<com.todoroo.astrid.helper.AsyncImageView
android:id="@+id/comment_picture"
android:layout_width="50dip"
android:layout_height="50dip"

@ -7,7 +7,7 @@
android:background="@android:drawable/list_selector_background">
<!-- imageview -->
<greendroid.widget.AsyncImageView android:id="@+id/image"
<com.todoroo.astrid.helper.AsyncImageView android:id="@+id/image"
android:layout_width="70dip"
android:layout_height="100dip"
android:layout_marginLeft="5dip"

@ -7,7 +7,7 @@
android:background="@android:drawable/list_selector_background">
<!-- imageview -->
<greendroid.widget.AsyncImageView android:id="@+id/image"
<com.todoroo.astrid.helper.AsyncImageView android:id="@+id/image"
android:layout_width="100dip"
android:layout_height="100dip"
android:layout_marginLeft="5dip"

@ -80,7 +80,7 @@
<string name="actfm_TVA_menu_refresh">Refresh</string>
<!-- Tag Settings: tag name label -->
<string name="actfm_TVA_tag_label">List Name:</string>
<string name="actfm_TVA_tag_label">List</string>
<!-- Tag Settings: tag owner label -->
<string name="actfm_TVA_tag_owner_label">List Creator:</string>
@ -89,7 +89,7 @@
<string name="actfm_TVA_tag_owner_none">none</string>
<!-- Tag Settings: list collaborators label -->
<string name="actfm_TVA_members_label">Shared With:</string>
<string name="actfm_TVA_members_label">Shared With</string>
<!-- Tag Settings: tag picture -->
<string name="actfm_TVA_tag_picture">List Picture</string>
@ -101,10 +101,16 @@
<string name="actfm_TVA_list_icon_label">List Icon:</string>
<!-- Tag Settings: list description label -->
<string name="actfm_TVA_tag_description_label">Description:</string>
<string name="actfm_TVA_tag_description_label">Description</string>
<!-- Tag Settings: list settings label -->
<string name="actfm_TVA_tag_settings_label">Settings</string>
<!-- Tag Settings: list description hint -->
<string name="actfm_TVA_tag_description_hint">List description</string>
<string name="actfm_TVA_tag_description_hint">Type a description here</string>
<!-- Tag Settings: list name hint -->
<string name="actfm_TVA_tag_name_hint">Enter list name</string>
<!-- Tag settings: login prompt from share-->
<string name="actfm_TVA_login_to_share">You need to be logged in to Astrid.com to share lists! Please log in or make this a private list.</string>

@ -275,7 +275,7 @@
<string name="FLA_menu_help">Help</string>
<!-- Create Shortcut Dialog Title -->
<string name="FLA_shortcut_dialog_title">Create Shortcut</string>
<string name="FLA_shortcut_dialog_title">Create Desktop Shortcut</string>
<!-- Create Shortcut Dialog (asks to name shortcut) -->
<string name="FLA_shortcut_dialog">Name of shortcut:</string>

@ -102,9 +102,15 @@
can simply delete the new combined list!</string>
<!-- Header for tag settings -->
<string name="tag_settings_title">Settings: %s</string>
<string name="tag_settings_title">List Settings</string>
<!-- Header for tag activity -->
<string name="tag_updates_title">Activity: %s</string>
<!-- Delete button for tag settings -->
<string name="tag_delete_button">Delete List</string>
<!-- Leave button for tag settings -->
<string name="tag_leave_button">Leave This List</string>
</resources>

@ -156,6 +156,11 @@
<item name="android:windowTitleStyle">@style/DialogTitle</item>
<item name="android:windowTitleBackgroundStyle">@style/DialogTitle</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="asEditBackground">#101010</item>
<item name="asEditRowBackground">@drawable/task_edit_background</item>
<item name="asThemeTextColor">@color/blue_theme_color</item>
</style>
<style name="Theme.Dialog.White">
@ -171,6 +176,10 @@
<item name="abBackground">@android:color/white</item>
<item name="abDisplayOptions">useLogo|showHome|showTitle</item>
<item name="abLogo">@drawable/icon_48</item>
<item name="asEditBackground">#dddddd</item>
<item name="asEditRowBackground">@drawable/task_edit_background_transparent_white</item>
<item name="asThemeTextColor">@color/blue_theme_color</item>
</style>
<!--================================================== General == -->
@ -375,6 +384,14 @@
<item name="android:textColor">?attr/asFilterHeaderColor</item>
</style>
<!-- ========================================================= Tag Settings == -->
<style name="DeleteTag" >
<item name="android:textColor">@android:color/white</item>
<item name="android:textStyle">bold</item>
<item name="android:background">#d90000</item>
</style>
<!-- ========================================================= Widget == -->
<style name="TextAppearance.Widget">

@ -365,10 +365,24 @@ public class FilterListFragment extends ListFragment {
if(label.length() == 0)
return;
Bitmap emblem = filter.listingIcon;
Bitmap bitmap = superImposeListIcon(activity, filter.listingIcon, filter.listingTitle);
Intent createShortcutIntent = new Intent();
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
createShortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); //$NON-NLS-1$
activity.sendBroadcast(createShortcutIntent);
Toast.makeText(activity,
activity.getString(R.string.FLA_toast_onCreateShortcut, label), Toast.LENGTH_LONG).show();
}
public static Bitmap superImposeListIcon(Activity activity, Bitmap listingIcon, String listingTitle) {
Bitmap emblem = listingIcon;
if(emblem == null)
emblem = ((BitmapDrawable) activity.getResources().getDrawable(
TagService.getDefaultImageIDForTag(filter.listingTitle))).getBitmap();
TagService.getDefaultImageIDForTag(listingTitle))).getBitmap();
// create icon by superimposing astrid w/ icon
DisplayMetrics metrics = new DisplayMetrics();
@ -381,16 +395,7 @@ public class FilterListFragment extends ListFragment {
canvas.drawBitmap(emblem, new Rect(0, 0, emblem.getWidth(), emblem.getHeight()),
new Rect(bitmap.getWidth() - dimension, bitmap.getHeight() - dimension,
bitmap.getWidth(), bitmap.getHeight()), null);
Intent createShortcutIntent = new Intent();
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, label);
createShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
createShortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); //$NON-NLS-1$
activity.sendBroadcast(createShortcutIntent);
Toast.makeText(activity,
activity.getString(R.string.FLA_toast_onCreateShortcut, label), Toast.LENGTH_LONG).show();
return bitmap;
}
@Override

@ -113,33 +113,33 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
};
/**
* @see android.app.Activity#onCreate(Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this);
super.onCreate(savedInstanceState);
if (shouldUseThreePane(this))
setContentView(R.layout.task_list_wrapper_activity_3pane);
else
setContentView(R.layout.task_list_wrapper_activity);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.header_nav_views);
listsNav = actionBar.getCustomView().findViewById(R.id.lists_nav);
listsNavDisclosure = (ImageView) actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow);
lists = (TextView) actionBar.getCustomView().findViewById(R.id.list_title);
mainMenu = (ImageView) actionBar.getCustomView().findViewById(R.id.main_menu);
commentsButton = (Button) actionBar.getCustomView().findViewById(R.id.comments);
initializeFragments(actionBar);
createMainMenuPopover();
mainMenu.setOnClickListener(mainMenuClickListener);
commentsButton.setOnClickListener(commentsButtonClickListener);
* @see android.app.Activity#onCreate(Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this);
super.onCreate(savedInstanceState);
if (shouldUseThreePane(this))
setContentView(R.layout.task_list_wrapper_activity_3pane);
else
setContentView(R.layout.task_list_wrapper_activity);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionBar.setCustomView(R.layout.header_nav_views);
listsNav = actionBar.getCustomView().findViewById(R.id.lists_nav);
listsNavDisclosure = (ImageView) actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow);
lists = (TextView) actionBar.getCustomView().findViewById(R.id.list_title);
mainMenu = (ImageView) actionBar.getCustomView().findViewById(R.id.main_menu);
commentsButton = (Button) actionBar.getCustomView().findViewById(R.id.comments);
initializeFragments(actionBar);
createMainMenuPopover();
mainMenu.setOnClickListener(mainMenuClickListener);
commentsButton.setOnClickListener(commentsButtonClickListener);
Filter savedFilter = getIntent().getParcelableExtra(TaskListFragment.TOKEN_FILTER);
@ -151,50 +151,50 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
if (savedFilter != null)
setListsTitle(savedFilter.title);
}
}
/**
*
* @param actionBar
*/
/**
*
* @param actionBar
*/
protected void initializeFragments(ActionBar actionBar) {
View filterFragment = findViewById(R.id.filterlist_fragment_container);
View editFragment = findViewById(R.id.taskedit_fragment_container);
if (filterFragment != null) {
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow).setVisibility(View.GONE);
listsNav.setOnClickListener(null);
if(editFragment != null && editFragment.getVisibility() == View.INVISIBLE) {
fragmentLayout = LAYOUT_TRIPLE;
actionBar.getCustomView().findViewById(R.id.comments).setVisibility(View.GONE);
} else {
fragmentLayout = LAYOUT_DOUBLE;
createEditPopover();
createCommentsPopover();
}
setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT,
R.id.filterlist_fragment_container, FilterListFragment.class);
} else {
fragmentLayout = LAYOUT_SINGLE;
actionBar.setDisplayHomeAsUpEnabled(true);
listsNav.setOnClickListener(popupMenuClickListener);
createListsPopover();
setupPopoverWithFilterList((FilterListFragment) setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, 0, FilterListFragment.class));
}
if (filterFragment != null) {
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.getCustomView().findViewById(R.id.list_disclosure_arrow).setVisibility(View.GONE);
listsNav.setOnClickListener(null);
if(editFragment != null && editFragment.getVisibility() == View.INVISIBLE) {
fragmentLayout = LAYOUT_TRIPLE;
actionBar.getCustomView().findViewById(R.id.comments).setVisibility(View.GONE);
} else {
fragmentLayout = LAYOUT_DOUBLE;
createEditPopover();
createCommentsPopover();
}
setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT,
R.id.filterlist_fragment_container, FilterListFragment.class);
} else {
fragmentLayout = LAYOUT_SINGLE;
actionBar.setDisplayHomeAsUpEnabled(true);
listsNav.setOnClickListener(popupMenuClickListener);
createListsPopover();
setupPopoverWithFilterList((FilterListFragment) setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, 0, FilterListFragment.class));
}
}
private void createListsPopover() {
listsPopover = new FragmentPopover(this, R.layout.list_dropdown_popover);
listsPopover = new FragmentPopover(this, R.layout.list_dropdown_popover);
listsPopover.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss() {
setListsDropdownSelected(false);
}
});
}
}
private void createEditPopover() {
editPopover = new FragmentPopover(this, R.layout.taskedit_popover);
@ -250,40 +250,40 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
}
}
public void setupPopoverWithFilterList(FilterListFragment fla) {
setupPopoverWithFragment(listsPopover, fla, null);
}
public void setupPopoverWithFilterList(FilterListFragment fla) {
setupPopoverWithFragment(listsPopover, fla, null);
}
@Override
@Override
public void onTaskListItemClicked(long taskId) {
super.onTaskListItemClicked(taskId);
if (fragmentLayout == LAYOUT_DOUBLE && getTaskEditFragment() != null) {
DisplayMetrics metrics = getResources().getDisplayMetrics();
setupPopoverWithFragment(editPopover, getTaskEditFragment(), new LayoutParams((int) (400 * metrics.density), (int) (600 * metrics.density)));
editPopover.show(listsNav);
}
}
@Override
public boolean onFilterItemClicked(FilterListItem item) {
if (listsPopover != null)
listsPopover.dismiss();
setCommentsCount(0);
return super.onFilterItemClicked(item);
}
private void setListsDropdownSelected(boolean selected) {
int oldTextColor = lists.getTextColors().getDefaultColor();
int textStyle = (selected ? R.style.TextAppearance_ActionBar_ListsHeader_Selected :
R.style.TextAppearance_ActionBar_ListsHeader);
TypedValue listDisclosure = new TypedValue();
getTheme().resolveAttribute(R.attr.asListsDisclosure, listDisclosure, false);
lists.setTextAppearance(this, textStyle);
listsNav.setBackgroundColor(selected ? oldTextColor : android.R.color.transparent);
listsNavDisclosure.setSelected(selected);
}
super.onTaskListItemClicked(taskId);
if (fragmentLayout == LAYOUT_DOUBLE && getTaskEditFragment() != null) {
DisplayMetrics metrics = getResources().getDisplayMetrics();
setupPopoverWithFragment(editPopover, getTaskEditFragment(), new LayoutParams((int) (400 * metrics.density), (int) (600 * metrics.density)));
editPopover.show(listsNav);
}
}
@Override
public boolean onFilterItemClicked(FilterListItem item) {
if (listsPopover != null)
listsPopover.dismiss();
setCommentsCount(0);
return super.onFilterItemClicked(item);
}
private void setListsDropdownSelected(boolean selected) {
int oldTextColor = lists.getTextColors().getDefaultColor();
int textStyle = (selected ? R.style.TextAppearance_ActionBar_ListsHeader_Selected :
R.style.TextAppearance_ActionBar_ListsHeader);
TypedValue listDisclosure = new TypedValue();
getTheme().resolveAttribute(R.attr.asListsDisclosure, listDisclosure, false);
lists.setTextAppearance(this, textStyle);
listsNav.setBackgroundColor(selected ? oldTextColor : android.R.color.transparent);
listsNavDisclosure.setSelected(selected);
}
@Override
protected void onPostResume() {
@ -330,7 +330,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
}
public void setSelectedItem(Filter item) {
lists.setText(item.title);
lists.setText(item.title);
}
public void setCommentsCount(int count) {
@ -352,7 +352,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
@Override
public void onBackPressed() {
// manage task edit visibility
// manage task edit visibility
View taskeditFragmentContainer = findViewById(R.id.taskedit_fragment_container);
if(taskeditFragmentContainer != null && taskeditFragmentContainer.getVisibility() == View.VISIBLE) {
if(fragmentLayout == LAYOUT_DOUBLE) {
@ -488,7 +488,11 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
String deletedTag = intent.getStringExtra(TagViewFragment.EXTRA_TAG_NAME);
String deletedTagSql = intent.getStringExtra(TagFilterExposer.TAG_SQL);
FilterListFragment fl = getFilterListFragment();
if (fl != null) {
if (deletedTagSql.equals(TagFilterExposer.SHOW_ACTIVE_TASKS)) {
fl.switchToActiveTasks();
fl.clear(); // Should auto refresh
}
else if (fl != null) {
Filter currentlyShowing = getIntent().getParcelableExtra(TaskListFragment.TOKEN_FILTER);
if (currentlyShowing != null) {
boolean titlesMatch = currentlyShowing.title != null && currentlyShowing.title.equals(deletedTag);

@ -3,7 +3,7 @@
*/
package com.todoroo.astrid.adapter;
import greendroid.widget.AsyncImageView;
import com.todoroo.astrid.helper.AsyncImageView;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;

@ -1,6 +1,6 @@
package com.todoroo.astrid.adapter;
import greendroid.widget.AsyncImageView;
import com.todoroo.astrid.helper.AsyncImageView;
import java.util.Collection;
import java.util.Collections;

@ -1,6 +1,6 @@
package com.todoroo.astrid.adapter;
import greendroid.widget.AsyncImageView;
import com.todoroo.astrid.helper.AsyncImageView;
import java.io.IOException;
@ -56,10 +56,10 @@ public class UpdateAdapter extends CursorAdapter {
private static final String UPDATE_FRIENDS = "friends"; //$NON-NLS-1$
private static final String UPDATE_REQUEST_FRIENDSHIP = "request_friendship"; //$NON-NLS-1$
private static final String UPDATE_CONFIRMED_FRIENDSHIP = "confirmed_friendship"; //$NON-NLS-1$
private static final String UPDATE_TASK_CREATED = "task_created";
private static final String UPDATE_TASK_COMPLETED = "task_completed";
private static final String UPDATE_TASK_UNCOMPLETED = "task_uncompleted";
private static final String UPDATE_TASK_TAGGED = "task_tagged";
private static final String UPDATE_TASK_CREATED = "task_created"; //$NON-NLS-1$
private static final String UPDATE_TASK_COMPLETED = "task_completed"; //$NON-NLS-1$
private static final String UPDATE_TASK_UNCOMPLETED = "task_uncompleted"; //$NON-NLS-1$
private static final String UPDATE_TASK_TAGGED = "task_tagged"; //$NON-NLS-1$
private static final String UPDATE_TASK_ASSIGNED = "task_assigned";
private static final String UPDATE_TASK_COMMENT = "task_comment";
private static final String UPDATE_TAG_COMMENT = "tag_comment";
@ -261,16 +261,14 @@ public class UpdateAdapter extends CursorAdapter {
commentResource = R.string.update_string_task_assigned;
}
else if (actionCode.equals(UPDATE_TASK_COMMENT)) {
if (fromView.equals(FROM_TASK_VIEW))
if (fromView.equals(FROM_TASK_VIEW) || TextUtils.isEmpty(targetName))
commentResource = R.string.update_string_default_comment;
else
commentResource = R.string.update_string_task_comment;
}
else if (actionCode.equals(UPDATE_TAG_COMMENT)) {
if (fromView.equals(FROM_TAG_VIEW))
if (fromView.equals(FROM_TAG_VIEW) || TextUtils.isEmpty(targetName))
commentResource = R.string.update_string_default_comment;
else
commentResource = R.string.update_string_tag_comment;

@ -0,0 +1,67 @@
package com.todoroo.astrid.helper;
import java.io.IOException;
import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.util.AttributeSet;
/*
* Subclass of greendroid.widget.AsyncImageView, so that we can cache the image locally when user is offline
* IMPORTANT: cannot load a cached image by setting the url in an xml file. --ImageDiskCache object is created after object is loaded from xml
*/
public class AsyncImageView extends greendroid.widget.AsyncImageView {
private final ImageDiskCache imageDiskCache;
private Bitmap cacheImage;
private String cacheURL = ""; //$NON-NLS-1$
public AsyncImageView(Context context) {
super(context);
imageDiskCache = ImageDiskCache.getInstance();
}
public AsyncImageView(Context context, AttributeSet set) {
super(context, set);
imageDiskCache = ImageDiskCache.getInstance();
}
public AsyncImageView(Context context, AttributeSet set, int defStyle) {
super(context, set, defStyle);
imageDiskCache = ImageDiskCache.getInstance();
}
@Override
public void setUrl(String url) {
if (cacheImage != null && cacheURL.equals(url) && !TextUtils.isEmpty(url)) {
setImageBitmap(cacheImage);
return;
}
else if(imageDiskCache != null && imageDiskCache.contains(url)) {
try {
cacheImage = imageDiskCache.get(url);
setImageBitmap(cacheImage);
cacheURL = url;
return;
} catch (IOException e) {
//
}
}
super.setUrl(url);
}
public Bitmap getImageBitmap() {
setDrawingCacheEnabled(true);
// this is the important code :)
// Without it the view will have a dimension of 0,0 and the bitmap will be null
measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
buildDrawingCache(true);
Bitmap b = Bitmap.createBitmap(getDrawingCache());
setDrawingCacheEnabled(false); // clear drawing cache
return b;
}
}

@ -19,14 +19,20 @@ package com.todoroo.astrid.helper;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Update;
/**
* <p>
@ -46,18 +52,19 @@ import com.todoroo.andlib.service.ContextManager;
*/
@SuppressWarnings("nls")
public class ImageDiskCache extends DiskCache<String, Bitmap> {
private static final String TAG = ImageDiskCache.class.getSimpleName();
private static final String TAG = ImageDiskCache.class.getSimpleName();
public static final String CACHED_IDENTIFIER = "cached::";
static final boolean DEBUG = false;
static final boolean DEBUG = false;
private long mIDCounter = 0;
private long mIDCounter = 0;
private static ImageDiskCache mInstance;
private static ImageDiskCache mInstance;
private final CompressFormat mCompressFormat;
private final int mQuality;
private final CompressFormat mCompressFormat;
private final int mQuality;
public static ImageDiskCache getInstance() {
if (mInstance == null) {
@ -66,109 +73,136 @@ public class ImageDiskCache extends DiskCache<String, Bitmap> {
return mInstance;
}
private ImageDiskCache(File file, CompressFormat format, int quality) {
super(file, null, getExtension(format));
public static ImageDiskCache getInstance(Context context) {
if (mInstance == null) {
mInstance = new ImageDiskCache(context.getCacheDir(), CompressFormat.JPEG, 85);
}
return mInstance;
}
private ImageDiskCache(File file, CompressFormat format, int quality) {
super(file, null, getExtension(format));
mCompressFormat = format;
mQuality = quality;
}
mCompressFormat = format;
mQuality = quality;
}
private static String getExtension(CompressFormat format) {
String extension;
switch (format) {
case JPEG:
extension = ".jpg";
break;
case PNG:
extension = ".png";
break;
default:
throw new IllegalArgumentException();
}
return extension;
}
/**
* If loading a number of images where you don't have a unique ID to
* represent the individual load, this can be used to generate a sequential
* ID.
*
* @return a new unique ID
*/
public synchronized long getNewID() {
return mIDCounter++;
}
@Override
protected Bitmap fromDisk(String key, InputStream in) {
if (DEBUG) {
Log.d(TAG, "disk cache hit");
}
try {
final Bitmap image = BitmapFactory.decodeStream(in);
return image;
} catch (final OutOfMemoryError oom) {
return null;
}
}
@Override
protected void toDisk(String key, Bitmap image, OutputStream out) {
if (DEBUG) {
Log.d(TAG, "cache write for key " + key);
}
if (image != null) {
if (!image.compress(mCompressFormat, mQuality, out)) {
Log.e(TAG, "error writing compressed image to disk for key "
+ key);
}
} else {
Log.e(TAG, "attempting to write null image to cache");
}
}
/**
* @param uri
* the image uri
* @return a key unique to the given uri
*/
public String getKey(Uri uri) {
return uri.toString();
}
/**
* Returns an opaque cache key representing the given uri, width and height.
*
* @param uri
* an image uri
* @param width
* the desired image max width
* @param height
* the desired image max height
* @return a cache key unique to the given parameters
*/
public String getKey(Uri uri, int width, int height) {
return uri.buildUpon()
.appendQueryParameter("width", String.valueOf(width))
.appendQueryParameter("height", String.valueOf(height)).build()
.toString();
}
/**
* Cancels all the asynchronous image loads.
* Note: currently does not function properly.
*
*/
public void cancelLoads() {
// TODO actually make it possible to cancel tasks
}
String extension;
switch (format) {
case JPEG:
extension = ".jpg";
break;
case PNG:
extension = ".png";
break;
default:
throw new IllegalArgumentException();
}
return extension;
}
/**
* If loading a number of images where you don't have a unique ID to
* represent the individual load, this can be used to generate a sequential
* ID.
*
* @return a new unique ID
*/
public synchronized long getNewID() {
return mIDCounter++;
}
@Override
protected Bitmap fromDisk(String key, InputStream in) {
if (DEBUG) {
Log.d(TAG, "disk cache hit");
}
try {
final Bitmap image = BitmapFactory.decodeStream(in);
return image;
} catch (final OutOfMemoryError oom) {
return null;
}
}
@Override
protected void toDisk(String key, Bitmap image, OutputStream out) {
if (DEBUG) {
Log.d(TAG, "cache write for key " + key);
}
if (image != null) {
if (!image.compress(mCompressFormat, mQuality, out)) {
Log.e(TAG, "error writing compressed image to disk for key "
+ key);
}
} else {
Log.e(TAG, "attempting to write null image to cache");
}
}
/**
* @param uri
* the image uri
* @return a key unique to the given uri
*/
public String getKey(Uri uri) {
return uri.toString();
}
/**
* Returns an opaque cache key representing the given uri, width and height.
*
* @param uri
* an image uri
* @param width
* the desired image max width
* @param height
* the desired image max height
* @return a cache key unique to the given parameters
*/
public String getKey(Uri uri, int width, int height) {
return uri.buildUpon()
.appendQueryParameter("width", String.valueOf(width))
.appendQueryParameter("height", String.valueOf(height)).build()
.toString();
}
/**
* Cancels all the asynchronous image loads.
* Note: currently does not function properly.
*
*/
public void cancelLoads() {
// TODO actually make it possible to cancel tasks
}
@Override
public boolean contains(String key) {
return !TextUtils.isEmpty(key) && key.startsWith(CACHED_IDENTIFIER) && super.contains(key);
}
public static String getPictureHash(Update update) {
return String.format("%s%s%s", CACHED_IDENTIFIER, update.getValue(Update.TASK), update.getValue(Update.CREATION_DATE));
}
public static String getPictureHash(TagData tagData) {
long tag_date = 0;
if (tagData.containsValue(TagData.CREATION_DATE)) {
tag_date = tagData.getValue(TagData.CREATION_DATE);
}
if (tag_date == 0) {
tag_date = DateUtilities.dateToUnixtime(new Date());
}
return String.format("%s%s%s", CACHED_IDENTIFIER,tagData.getValue(TagData.NAME), tag_date);
}
}

@ -23,6 +23,7 @@ import android.widget.TextView.OnEditorActionListener;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.helper.AsyncImageView;
public class PeopleContainer extends LinearLayout {
@ -55,7 +56,7 @@ public class PeopleContainer extends LinearLayout {
// --- methods
/** Adds a tag to the tag field */
public TextView addPerson(String person) {
public TextView addPerson(String person, String image) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// check if already exists
@ -81,6 +82,35 @@ public class PeopleContainer extends LinearLayout {
textView.setHint(R.string.actfm_person_or_tag_hint);
}
final ImageButton removeButton = (ImageButton)tagItem.findViewById(R.id.button1);
removeButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TextView lastView = getLastTextView();
if(lastView == textView && textView.getText().length() == 0)
return;
if(getChildCount() > 1)
removeView(tagItem);
else {
textView.setText(""); //$NON-NLS-1$
textView.setEnabled(true);
}
}
});
final AsyncImageView imageView = (AsyncImageView)tagItem.
findViewById(R.id.icon);
imageView.setUrl(image);
if (TextUtils.isEmpty(textView.getText())) {
imageView.setDefaultImageResource(R.drawable.icn_add_contact);
removeButton.setVisibility(View.GONE);
}
else {
imageView.setDefaultImageResource(R.drawable.icn_default_person_image);
removeButton.setVisibility(View.VISIBLE);
}
textView.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
@ -95,7 +125,17 @@ public class PeopleContainer extends LinearLayout {
public void onTextChanged(CharSequence s, int start, int before,
int count) {
if(count > 0 && getLastTextView() == textView) {
addPerson(""); //$NON-NLS-1$
addPerson("", ""); //$NON-NLS-1$
}
else {
}
if (TextUtils.isEmpty(textView.getText())) {
imageView.setDefaultImageResource(R.drawable.icn_add_contact);
removeButton.setVisibility(View.GONE);
}
else {
imageView.setDefaultImageResource(R.drawable.icn_default_person_image);
removeButton.setVisibility(View.VISIBLE);
}
if(onAddNewPerson != null)
@ -109,28 +149,12 @@ public class PeopleContainer extends LinearLayout {
if(actionId != EditorInfo.IME_NULL)
return false;
if(getLastTextView().getText().length() != 0) {
addPerson(""); //$NON-NLS-1$
addPerson("", ""); //$NON-NLS-1$
}
return true;
}
});
ImageButton removeButton = (ImageButton)tagItem.findViewById(R.id.button1);
removeButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
TextView lastView = getLastTextView();
if(lastView == textView && textView.getText().length() == 0)
return;
if(getChildCount() > 1)
removeView(tagItem);
else {
textView.setText(""); //$NON-NLS-1$
textView.setEnabled(true);
}
}
});
return textView;
}
@ -222,13 +246,13 @@ public class PeopleContainer extends LinearLayout {
for(int i = 0; i < people.length(); i++) {
JSONObject person = people.getJSONObject(i);
TextView textView = null;
String imageURL = person.optString("picture", "");
if(person.has("id") && person.getLong("id") == ActFmPreferenceService.userId())
textView = addPerson(Preferences.getStringValue(ActFmPreferenceService.PREF_NAME));
textView = addPerson(Preferences.getStringValue(ActFmPreferenceService.PREF_NAME), imageURL);
else if(!TextUtils.isEmpty(person.optString("name")) && !"null".equals(person.optString("name")))
textView = addPerson(person.getString("name"));
textView = addPerson(person.getString("name"), imageURL);
else if(!TextUtils.isEmpty(person.optString("email")) && !"null".equals(person.optString("email")))
textView = addPerson(person.getString("email"));
textView = addPerson(person.getString("email"), imageURL);
if(textView != null) {
textView.setTag(person);

@ -1,6 +1,6 @@
package com.todoroo.astrid.ui;
import greendroid.widget.AsyncImageView;
import com.todoroo.astrid.helper.AsyncImageView;
import java.io.IOException;
import java.io.StringReader;

Loading…
Cancel
Save