Tag description UI and backend

pull/14/head
Amy Tang 13 years ago
parent c132cb6eea
commit a0c6528e24

@ -110,6 +110,10 @@ public final class TagData extends RemoteModel {
public static final IntegerProperty TASK_COUNT = new IntegerProperty( public static final IntegerProperty TASK_COUNT = new IntegerProperty(
TABLE, "taskCount"); TABLE, "taskCount");
/** Tag Desription */
public static final StringProperty TAG_DESCRIPTION = new StringProperty(
TABLE, "tagDescription");
/** List of all properties for this model */ /** List of all properties for this model */
public static final Property<?>[] PROPERTIES = generateProperties(TagData.class); public static final Property<?>[] PROPERTIES = generateProperties(TagData.class);
@ -146,6 +150,7 @@ public final class TagData extends RemoteModel {
defaultValues.put(LAST_ACTIVITY_DATE.name, 0); defaultValues.put(LAST_ACTIVITY_DATE.name, 0);
defaultValues.put(IS_UNREAD.name, 0); defaultValues.put(IS_UNREAD.name, 0);
defaultValues.put(TASK_COUNT.name, 0); defaultValues.put(TASK_COUNT.name, 0);
defaultValues.put(TAG_DESCRIPTION.name, "");
} }
@Override @Override

@ -61,6 +61,7 @@ public class TagSettingsActivity extends Activity {
private PeopleContainer tagMembers; private PeopleContainer tagMembers;
private AsyncImageView picture; private AsyncImageView picture;
private EditText tagName; private EditText tagName;
private EditText tagDescription;
private CheckBox isSilent; private CheckBox isSilent;
boolean isNewTag = false; boolean isNewTag = false;
@ -111,6 +112,7 @@ public class TagSettingsActivity extends Activity {
protected void setUpSettingsPage() { protected void setUpSettingsPage() {
tagMembers = (PeopleContainer) findViewById(R.id.members_container); tagMembers = (PeopleContainer) findViewById(R.id.members_container);
tagName = (EditText) findViewById(R.id.tag_name); tagName = (EditText) findViewById(R.id.tag_name);
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 = (CheckBox) findViewById(R.id.tag_silenced);
isSilent.setChecked(tagData.getFlag(TagData.FLAGS, TagData.FLAG_SILENT)); isSilent.setChecked(tagData.getFlag(TagData.FLAGS, TagData.FLAG_SILENT));
@ -172,6 +174,10 @@ public class TagSettingsActivity extends Activity {
} }
} }
} }
//handles description part
String newDesc = tagDescription.getText().toString();
tagData.setValue(TagData.TAG_DESCRIPTION, newDesc);
JSONArray members = tagMembers.toJSONArray(); JSONArray members = tagMembers.toJSONArray();
@ -213,6 +219,8 @@ public class TagSettingsActivity extends Activity {
return; return;
} }
refreshSettingsPage(); refreshSettingsPage();
finish(); finish();
} }
@ -263,6 +271,9 @@ public class TagSettingsActivity extends Activity {
String peopleJson = tagData.getValue(TagData.MEMBERS); String peopleJson = tagData.getValue(TagData.MEMBERS);
updateMembers(peopleJson); updateMembers(peopleJson);
tagDescription.setText(tagData.getValue(TagData.TAG_DESCRIPTION));
} }
@SuppressWarnings("nls") @SuppressWarnings("nls")

@ -471,6 +471,10 @@ public final class ActFmSyncService {
params.add("deleted_at"); params.add(tagData.getValue(TagData.DELETION_DATE)); params.add("deleted_at"); params.add(tagData.getValue(TagData.DELETION_DATE));
} }
if(values.containsKey(TagData.TAG_DESCRIPTION.name)) {
params.add("description"); params.add(tagData.getValue(TagData.TAG_DESCRIPTION));
}
if(values.containsKey(TagData.MEMBERS.name)) { if(values.containsKey(TagData.MEMBERS.name)) {
params.add("members"); params.add("members");
try { try {
@ -996,6 +1000,9 @@ public final class ActFmSyncService {
if(json.has("emergent")) if(json.has("emergent"))
model.setFlag(TagData.FLAGS, TagData.FLAG_EMERGENT,json.getBoolean("emergent")); model.setFlag(TagData.FLAGS, TagData.FLAG_EMERGENT,json.getBoolean("emergent"));
if(json.has("description"))
model.setValue(TagData.TAG_DESCRIPTION,json.getString("description"));
if(json.has("members")) { if(json.has("members")) {
JSONArray members = json.getJSONArray("members"); JSONArray members = json.getJSONArray("members");
model.setValue(TagData.MEMBERS, members.toString()); model.setValue(TagData.MEMBERS, members.toString());

@ -93,6 +93,45 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:paddingBottom="5dip">
<TextView android:id="@+id/list_icon"
android:drawableBottom="@drawable/icon_blank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:paddingRight="10dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_TVA_list_icon_label" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dip"
android:paddingLeft="10dip"
android:layout_gravity="right">
<TextView
android:id="@+id/description_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_description_label" />
<EditText
android:id="@+id/tag_description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/description_label"
android:layout_marginTop="10dip" />
</RelativeLayout>
</LinearLayout>
<!-- Footer --> <!-- Footer -->
<LinearLayout <LinearLayout

@ -12,7 +12,6 @@
android:orientation="vertical"> android:orientation="vertical">
<!-- No Tasks label --> <!-- No Tasks label -->
<TextView android:id="@android:id/empty" <TextView android:id="@android:id/empty"
android:drawableTop="@drawable/icon" android:drawableTop="@drawable/icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"

@ -91,6 +91,12 @@
<!-- Tag Settings: silence notifications label --> <!-- Tag Settings: silence notifications label -->
<string name="actfm_TVA_silence_label">Silence Notifications</string> <string name="actfm_TVA_silence_label">Silence Notifications</string>
<!-- Tag Settings: list icon label -->
<string name="actfm_TVA_list_icon_label">List Icon:</string>
<!-- Tag Settings: list description label -->
<string name="actfm_TVA_tag_description_label">Description:</string>
<!-- ============================================ edit people dialog == --> <!-- ============================================ edit people dialog == -->
<!-- task sharing dialog: intro --> <!-- task sharing dialog: intro -->

@ -37,7 +37,7 @@ public class Database extends AbstractDatabase {
* Database version number. This variable must be updated when database * Database version number. This variable must be updated when database
* tables are updated, as it determines whether a database needs updating. * tables are updated, as it determines whether a database needs updating.
*/ */
public static final int VERSION = 17; public static final int VERSION = 18;
/** /**
* Database name (must be unique) * Database name (must be unique)
@ -226,6 +226,12 @@ public class Database extends AbstractDatabase {
} catch (SQLiteException e) { } catch (SQLiteException e) {
Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e); Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e);
} }
case 17: try {
database.execSQL("ALTER TABLE " + TagData.TABLE.name + " ADD " +
TagData.TAG_DESCRIPTION.accept(visitor, null));
} catch (SQLiteException e) {
Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e);
}
return true; return true;
} }

Loading…
Cancel
Save