Tag settings redesign

pull/14/head
Andrew Shaw 14 years ago
parent db1bc35877
commit ada52d90e1

@ -167,7 +167,7 @@ public class EditPeopleControlSet extends PopupControlSet {
cbFacebook = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_facebook); cbFacebook = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_facebook);
cbTwitter = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_twitter); cbTwitter = (CheckBox) getSharedWithView().findViewById(R.id.checkbox_twitter);
sharedWithContainer.addPerson(""); //$NON-NLS-1$ sharedWithContainer.addPerson("", ""); //$NON-NLS-1$
setUpListeners(); setUpListeners();
} }
@ -206,7 +206,7 @@ public class EditPeopleControlSet extends PopupControlSet {
if(people != null) { if(people != null) {
for(int i = 0; i < people.length(); i++) { for(int i = 0; i < people.length(); i++) {
String person = people.getString(i); String person = people.getString(i);
TextView textView = sharedWithContainer.addPerson(person); TextView textView = sharedWithContainer.addPerson(person, "");
textView.setEnabled(false); textView.setEnabled(false);
sharedPeople.add(PeopleContainer.createUserJson(textView)); sharedPeople.add(PeopleContainer.createUserJson(textView));
} }
@ -681,7 +681,7 @@ public class EditPeopleControlSet extends PopupControlSet {
private void makePrivateTask() { private void makePrivateTask() {
sharedWithContainer.removeAllViews(); sharedWithContainer.removeAllViews();
sharedWithContainer.addPerson(""); //$NON-NLS-1$ sharedWithContainer.addPerson("", ""); //$NON-NLS-1$
assignToMe(); assignToMe();
} }

@ -6,7 +6,6 @@ import java.io.IOException;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -24,10 +23,10 @@ import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
@ -80,7 +79,7 @@ public class TagSettingsActivity extends FragmentActivity {
private AsyncImageView picture; private AsyncImageView picture;
private EditText tagName; private EditText tagName;
private EditText tagDescription; private EditText tagDescription;
private CheckBox isSilent; private ToggleButton isSilent;
private Bitmap setBitmap; private Bitmap setBitmap;
private boolean isNewTag = false; private boolean isNewTag = false;
@ -167,15 +166,14 @@ public class TagSettingsActivity extends FragmentActivity {
tagName = (EditText) findViewById(R.id.tag_name); tagName = (EditText) findViewById(R.id.tag_name);
tagDescription = (EditText) findViewById(R.id.tag_description); tagDescription = (EditText) findViewById(R.id.tag_description);
picture = (AsyncImageView) findViewById(R.id.picture); picture = (AsyncImageView) findViewById(R.id.picture);
isSilent = (CheckBox) findViewById(R.id.tag_silenced); isSilent = (ToggleButton) findViewById(R.id.tag_silenced);
isSilent.setChecked(tagData.getFlag(TagData.FLAGS, TagData.FLAG_SILENT)); isSilent.setChecked(tagData.getFlag(TagData.FLAGS, TagData.FLAG_SILENT));
if(actFmPreferenceService.isLoggedIn()) { if(actFmPreferenceService.isLoggedIn()) {
picture.setVisibility(View.VISIBLE); picture.setVisibility(View.VISIBLE);
picture.setDefaultImageResource(TagService.getDefaultImageIDForTag(tagData.getValue(TagData.NAME))); findViewById(R.id.tag_silenced_container).setVisibility(View.VISIBLE);
findViewById(R.id.picture_label).setVisibility(View.VISIBLE);
findViewById(R.id.listSettingsMore).setVisibility(View.VISIBLE);
} }
picture.setDefaultImageResource(TagService.getDefaultImageIDForTag(tagData.getValue(TagData.NAME)));
picture.setOnClickListener(new OnClickListener() { picture.setOnClickListener(new OnClickListener() {
@Override @Override
@ -268,7 +266,7 @@ public class TagSettingsActivity extends FragmentActivity {
public void onClick(DialogInterface d, int which) { public void onClick(DialogInterface d, int which) {
tagMembers.removeAllViews(); tagMembers.removeAllViews();
tagMembers.addPerson(""); //$NON-NLS-1$ tagMembers.addPerson("", ""); //$NON-NLS-1$
} }
}; };
DialogUtilities.okCancelCustomDialog(TagSettingsActivity.this, getString(R.string.actfm_EPA_login_button), DialogUtilities.okCancelCustomDialog(TagSettingsActivity.this, getString(R.string.actfm_EPA_login_button),
@ -367,21 +365,6 @@ public class TagSettingsActivity extends FragmentActivity {
} }
picture.setUrl(tagData.getValue(TagData.PICTURE)); 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>");
}
String peopleJson = tagData.getValue(TagData.MEMBERS); String peopleJson = tagData.getValue(TagData.MEMBERS);
updateMembers(peopleJson); updateMembers(peopleJson);
@ -401,7 +384,7 @@ public class TagSettingsActivity extends FragmentActivity {
} }
} }
tagMembers.addPerson(""); //$NON-NLS-1$ tagMembers.addPerson("", ""); //$NON-NLS-1$
} }
private void uploadTagPicture(final Bitmap bitmap) { private void uploadTagPicture(final Bitmap bitmap) {

@ -26,9 +26,9 @@ import com.todoroo.andlib.utility.Preferences;
public class ActFmInvoker { public class ActFmInvoker {
/** NOTE: these values are development values & will not work on production */ /** NOTE: these values are development values & will not work on production */
private static final String URL = "//10.0.2.2:3000/api/"; private static final String URL = "//astrid.com/api/";
private static final String APP_ID = "a4732a32859dbcd3e684331acd36432c"; private static final String APP_ID = "bf6170638298af8ed9a8c79995b1fc0f";
private static final String APP_SECRET = "e389bfc82a0d932332f9a8bd8203735f"; private static final String APP_SECRET = "d15d25c63323bddcaa48928dccac1207";
public static final String PROVIDER_FACEBOOK = "facebook"; public static final String PROVIDER_FACEBOOK = "facebook";
public static final String PROVIDER_GOOGLE= "google"; public static final String PROVIDER_GOOGLE= "google";

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -14,24 +15,49 @@
limitations under the License. limitations under the License.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <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_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical" >
<com.todoroo.astrid.ui.ContactsAutoComplete <LinearLayout
android:id="@+id/text1"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:orientation="horizontal" >
android:layout_gravity="center_vertical"
android:textColor="@android:color/black" <greendroid.widget.AsyncImageView
android:hint="@string/actfm_person_hint" /> android:id="@+id/icon"
android:layout_width="31dip"
<ImageButton android:id="@+id/button1" android:layout_height="35dip"
android:background="@drawable/btn_dismiss" astrid:defaultSrc="@drawable/icn_default_person_image"
android:layout_width="32dip" android:gravity="center"
android:layout_height="32dip" android:layout_margin="5dip"
android:layout_gravity="center" android:scaleType="fitCenter" />
android:layout_margin="4dip"
/> <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_weight="1"
android:layout_marginLeft="5dip"
android:background="#00000000"
android:hint="@string/actfm_person_hint"
android:textColor="@android:color/black" />
<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> </LinearLayout>

@ -1,221 +1,199 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- settings tab --> <!-- settings tab -->
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid" xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:id="@+id/settings" android:id="@+id/settings"
android:orientation="vertical" style="@style/Content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
style="@style/Content"> android:orientation="vertical" >
<ScrollView
<ScrollView style="@style/Content_EditScroll"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="100"> android:layout_weight="100" >
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:padding="5dip" android:orientation="vertical"
android:orientation="vertical"> android:padding="5dip"
android:paddingTop="0dip" >
<RelativeLayout
android:layout_width="fill_parent" <LinearLayout
android:layout_height="wrap_content" android:id="@+id/save_and_cancel"
android:paddingBottom="10dip"> android:layout_width="fill_parent"
android:layout_height="wrap_content"
<TextView android:gravity="right"
android:id="@+id/tag_label" android:orientation="horizontal"
android:layout_width="wrap_content" android:visibility="gone" >
android:layout_height="wrap_content"
android:layout_alignParentTop="true" <ImageButton
android:layout_marginTop="10dip" android:id="@+id/cancel"
style="@style/TextAppearance.GEN_EditLabel" android:layout_width="wrap_content"
android:text="@string/actfm_TVA_tag_label" /> android:layout_height="wrap_content"
<LinearLayout android:layout_marginRight="10dip"
android:id="@+id/save_and_cancel" android:background="@android:color/transparent"
android:layout_width="fill_parent" android:src="@android:drawable/ic_menu_close_clear_cancel" />
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 <ImageButton
android:id="@+id/picture_label" android:id="@+id/save"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_marginRight="10dip"
android:layout_marginTop="10dip" android:background="@android:color/transparent"
android:visibility="gone" android:src="@android:drawable/ic_menu_save" />
style="@style/TextAppearance.GEN_EditLabel" </LinearLayout>
android:text="@string/actfm_TVA_list_icon_label"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dip" >
<!-- picture -->
<greendroid.widget.AsyncImageView <greendroid.widget.AsyncImageView
android:id="@+id/picture" android:id="@+id/picture"
android:layout_width="80dip" android:layout_width="80dip"
android:layout_height="80dip" android:layout_height="80dip"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:scaleType="centerInside" android:layout_alignParentTop="true"
astrid:defaultSrc="@android:drawable/ic_menu_gallery"
android:paddingRight="10dip" android:paddingRight="10dip"
android:visibility="gone" android:scaleType="centerInside" />
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_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> <TextView
android:id="@+id/tag_label"
style="@style/TextAppearance"
</LinearLayout> android:layout_width="wrap_content"
android:layout_height="wrap_content"
</ScrollView> android:layout_alignParentTop="true"
android:layout_marginTop="2dip"
android:layout_toRightOf="@id/picture"
android:text="@string/actfm_TVA_tag_label" />
<EditText
android:id="@+id/tag_name"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tag_label"
android:layout_marginTop="10dip"
android:layout_toRightOf="@id/picture"
android:padding="10dip"
android:paddingBottom="14dip" />
</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" />
<EditText
android:id="@+id/tag_description"
style="@style/EditRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:hint="@string/actfm_TVA_tag_description_hint"
android:padding="8dip"
android:paddingBottom="12dip" />
<!-- 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: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:text="@string/actfm_TVA_silence_label" />
<ToggleButton
android:id="@+id/tag_silenced"
style="@style/TextAppearance"
android:layout_width="wrap_content"
android:layout_height="35dip"
android:background="#00000000"
android:layout_alignParentRight="true" />
</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: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="@android:drawable/ic_media_ff" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout> </LinearLayout>

@ -80,7 +80,7 @@
<string name="actfm_TVA_menu_refresh">Refresh</string> <string name="actfm_TVA_menu_refresh">Refresh</string>
<!-- Tag Settings: tag name label --> <!-- 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 --> <!-- Tag Settings: tag owner label -->
<string name="actfm_TVA_tag_owner_label">List Creator:</string> <string name="actfm_TVA_tag_owner_label">List Creator:</string>
@ -89,7 +89,7 @@
<string name="actfm_TVA_tag_owner_none">none</string> <string name="actfm_TVA_tag_owner_none">none</string>
<!-- Tag Settings: list collaborators label --> <!-- 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 --> <!-- Tag Settings: tag picture -->
<string name="actfm_TVA_tag_picture">List Picture</string> <string name="actfm_TVA_tag_picture">List Picture</string>
@ -101,10 +101,13 @@
<string name="actfm_TVA_list_icon_label">List Icon:</string> <string name="actfm_TVA_list_icon_label">List Icon:</string>
<!-- Tag Settings: list description label --> <!-- 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 --> <!-- 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: login prompt from share--> <!-- 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> <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>

@ -273,7 +273,7 @@
<string name="FLA_menu_help">Help</string> <string name="FLA_menu_help">Help</string>
<!-- Create Shortcut Dialog Title --> <!-- 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) --> <!-- Create Shortcut Dialog (asks to name shortcut) -->
<string name="FLA_shortcut_dialog">Name of shortcut:</string> <string name="FLA_shortcut_dialog">Name of shortcut:</string>

@ -1,5 +1,7 @@
package com.todoroo.astrid.ui; package com.todoroo.astrid.ui;
import greendroid.widget.AsyncImageView;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -55,7 +57,7 @@ public class PeopleContainer extends LinearLayout {
// --- methods // --- methods
/** Adds a tag to the tag field */ /** 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); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// check if already exists // check if already exists
@ -81,6 +83,10 @@ public class PeopleContainer extends LinearLayout {
textView.setHint(R.string.actfm_person_or_tag_hint); textView.setHint(R.string.actfm_person_or_tag_hint);
} }
final AsyncImageView imageView = (AsyncImageView)tagItem.
findViewById(R.id.icon);
imageView.setUrl(image);
textView.addTextChangedListener(new TextWatcher() { textView.addTextChangedListener(new TextWatcher() {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
@ -95,7 +101,7 @@ public class PeopleContainer extends LinearLayout {
public void onTextChanged(CharSequence s, int start, int before, public void onTextChanged(CharSequence s, int start, int before,
int count) { int count) {
if(count > 0 && getLastTextView() == textView) { if(count > 0 && getLastTextView() == textView) {
addPerson(""); //$NON-NLS-1$ addPerson("", ""); //$NON-NLS-1$
} }
if(onAddNewPerson != null) if(onAddNewPerson != null)
@ -109,7 +115,7 @@ public class PeopleContainer extends LinearLayout {
if(actionId != EditorInfo.IME_NULL) if(actionId != EditorInfo.IME_NULL)
return false; return false;
if(getLastTextView().getText().length() != 0) { if(getLastTextView().getText().length() != 0) {
addPerson(""); //$NON-NLS-1$ addPerson("", ""); //$NON-NLS-1$
} }
return true; return true;
} }
@ -222,13 +228,13 @@ public class PeopleContainer extends LinearLayout {
for(int i = 0; i < people.length(); i++) { for(int i = 0; i < people.length(); i++) {
JSONObject person = people.getJSONObject(i); JSONObject person = people.getJSONObject(i);
TextView textView = null; TextView textView = null;
String imageURL = person.optString("picture", "");
if(person.has("id") && person.getLong("id") == ActFmPreferenceService.userId()) 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"))) 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"))) 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) { if(textView != null) {
textView.setTag(person); textView.setTag(person);

Loading…
Cancel
Save