Added fragment-version of TaskEditActivity, callbacks not ready yet.

pull/14/head
Arne Jans 13 years ago
parent e9913eac56
commit 1d60b42138

@ -135,7 +135,7 @@
android:resource="@xml/filter_list_searchable" />
</activity>
<!-- Activity that creates or edits tasks -->
<activity android:name="com.todoroo.astrid.activity.TaskEditActivity"
<activity android:name="com.todoroo.astrid.activity.TaskEditWrapperActivity"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

@ -12,6 +12,7 @@ import com.timsu.astrid.R;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.activity.TaskEditActivity;
import com.todoroo.astrid.activity.TaskEditWrapperActivity;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.TaskAction;
import com.todoroo.astrid.api.TaskDecoration;
@ -54,7 +55,7 @@ public class EditPeopleExposer extends BroadcastReceiver {
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_TASK_ID, taskId);
context.sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
} else if(ACTION.equals(intent.getAction())) {
Intent launchIntent = new Intent(context, TaskEditActivity.class);
Intent launchIntent = new Intent(context, TaskEditWrapperActivity.class);
launchIntent.putExtra(TaskEditActivity.TOKEN_ID, taskId);
launchIntent.putExtra(TaskEditActivity.TOKEN_TAB, TaskEditActivity.TAB_SHARE);
launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.FilterListActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/filterlist_fragment"
android:layout_weight="33">
<!-- Preview: layout=@layout/filter_list_activity -->
</fragment>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.TaskListActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tasklist_fragment"
android:layout_weight="33">
<!-- Preview: layout=@layout/task_list_activity -->
</fragment>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.TaskEditActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/taskedit_fragment"
android:layout_weight="33">
<!-- Preview: layout=@layout/task_edit_activity -->
</fragment>
</LinearLayout>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.FilterListActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/filterlist_fragment">
</fragment>

@ -0,0 +1,523 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:astrid="http://schemas.android.com/apk/res/com.timsu.astrid"
android:id="@+id/taskEditParent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/Content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="@color/task_edit_selected" />
<!-- ======================================================= tab: basic == -->
<ScrollView
android:id="@+id/tab_basic"
android:layout_above="@id/edit_footer"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:padding="4dip"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- title -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_title_label"
style="@style/TextAppearance.GEN_EditLabel" />
<com.todoroo.astrid.ui.ErrorCatchingEditText
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/TEA_title_hint"
android:autoText="true"
android:text=""
android:capitalize="sentences"
android:freezesText="true"/>
<!-- importance -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_importance_label"
style="@style/TextAppearance.GEN_EditLabel" />
<LinearLayout
android:id="@+id/importance_container"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</LinearLayout>
<!-- urgency -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_urgency_label"
style="@style/TextAppearance.GEN_EditLabel" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/urgency_date"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/gl_date" />
<Button
android:id="@+id/urgency_time"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/gl_time" />
</LinearLayout>
<!-- add-ons -->
<LinearLayout
android:id="@+id/addons_urgency"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<!-- tags -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_tags_label"
style="@style/TextAppearance.GEN_EditLabel" />
<LinearLayout
android:id="@+id/tags_container"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/tags_dropdown"
android:paddingBottom="5dip"
android:entries="@array/TEA_loading"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<!-- notes -->
<TextView
android:id="@+id/notes_label"
android:paddingTop="5dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_note_label"
style="@style/TextAppearance.GEN_EditLabel" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- Voice Add Note Button -->
<ImageButton
android:id="@+id/voiceAddNoteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/tango_microphone"
android:scaleType="fitCenter"
android:visibility="gone" />
<EditText
android:id="@+id/notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="100"
android:scrollbars="vertical"
android:gravity="top"
android:hint="@string/TEA_notes_hint"
android:autoText="true"
android:capitalize="sentences"
android:singleLine="false"
android:freezesText="true" />
</LinearLayout>
<!-- buttons -->
<LinearLayout android:id="@+id/edit_footer"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="48dip"
android:layout_marginTop="7dip"
android:layout_alignParentBottom="true"
android:padding="5dip"
android:background="@drawable/footer_background"
android:baselineAligned="false">
<Button
android:id="@+id/save"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="5dip"
android:background="@drawable/footer_greenbtn"
android:text="@string/DLG_save"
android:textStyle="bold"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
<Button
android:id="@+id/discard"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="5dip"
android:background="@drawable/footer_redbtn"
android:text="@android:string/cancel"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<!-- ===================================================== tab: sharing == -->
<ScrollView
android:id="@+id/tab_share"
android:layout_above="@id/edit_footer"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:padding="4dip"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_EPA_assign_label" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/assigned_spinner"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:hint="@string/actfm_person_hint" />
<com.todoroo.astrid.ui.ContactsAutoComplete
android:id="@+id/assigned_custom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:visibility="gone"
android:hint="@string/actfm_person_hint" />
<ImageButton
android:id="@+id/assigned_clear"
style="?android:attr/buttonStyleInset"
android:src="@android:drawable/ic_delete"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginTop="2dip"
android:layout_marginRight="2dip"
android:layout_marginBottom="2dip"
android:visibility="gone"
android:gravity="center_vertical" />
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
style="@style/TextAppearance.GEN_EditLabel"
android:text="@string/actfm_EPA_share_with" />
<com.todoroo.astrid.ui.PeopleContainer
android:id="@+id/share_container"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/share_additional"
android:orientation="vertical"
android:padding="5dip"
android:visibility="gone"
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" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:text="@string/actfm_EPA_message_text" />
<EditText
android:id="@+id/message"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:text="@string/actfm_EPA_message_body"
android:autoText="true"
android:capitalize="sentences"
android:singleLine="false" />
<TextView
android:id="@+id/tag_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="5dip"
android:visibility="gone"
android:text="@string/actfm_EPA_tag_label" />
<EditText
android:id="@+id/tag_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:hint="@string/actfm_EPA_tag_hint" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="@android:drawable/divider_horizontal_dark" />
</LinearLayout>
<LinearLayout
android:id="@+id/collaborators"
android:orientation="vertical"
android:padding="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<CheckBox
style="@style/TextAppearance.GEN_EditLabel"
android:id="@+id/checkbox_facebook"
android:text="@string/actfm_EPA_facebook"
android:paddingLeft="45dip"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<CheckBox
style="@style/TextAppearance.GEN_EditLabel"
android:id="@+id/checkbox_twitter"
android:text="@string/actfm_EPA_twitter"
android:paddingLeft="45dip"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_margin="15dip"
android:background="@android:drawable/divider_horizontal_dark" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="15dip"
android:text="@string/actfm_EPA_intro"
android:gravity="center"
android:textColor="#ee9900" />
<LinearLayout android:id="@+id/edit_footer2"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="48dip"
android:layout_marginTop="7dip"
android:layout_alignParentBottom="true"
android:padding="5dip"
android:background="@drawable/footer_background"
android:baselineAligned="false">
<Button
android:id="@+id/save2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="5dip"
android:background="@drawable/footer_greenbtn"
android:text="@string/DLG_save"
android:textStyle="bold"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
<Button
android:id="@+id/discard2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="5dip"
android:background="@drawable/footer_redbtn"
android:text="@android:string/cancel"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<!-- ====================================================== tab: alarms == -->
<ScrollView
android:id="@+id/tab_alarms"
android:layout_above="@id/edit_footer"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:padding="4dip"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- reminders -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_reminder_label"
style="@style/TextAppearance.GEN_EditLabel" />
<CheckBox
style="@style/TextAppearance.GEN_EditLabel"
android:id="@+id/reminder_due"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:button="@drawable/btn_check_small"
android:text="@string/TEA_reminder_due" />
<CheckBox
style="@style/TextAppearance.GEN_EditLabel"
android:id="@+id/reminder_overdue"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:button="@drawable/btn_check_small"
android:text="@string/TEA_reminder_overdue" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<CheckBox
style="@style/TextAppearance.GEN_EditLabel"
android:id="@+id/reminder_random"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:button="@drawable/btn_check_small"
android:text="@string/TEA_reminder_random" />
<Spinner
android:id="@+id/reminder_random_interval"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- reminder mode -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_reminder_alarm_label"
style="@style/TextAppearance.GEN_EditLabel" />
<Spinner
android:id="@+id/reminder_alarm"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<!-- add-ons -->
<LinearLayout
android:id="@+id/addons_alarms"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<LinearLayout android:id="@+id/edit_footer3"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="48dip"
android:layout_marginTop="7dip"
android:layout_alignParentBottom="true"
android:padding="5dip"
android:background="@drawable/footer_background"
android:baselineAligned="false">
<Button
android:id="@+id/save3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="5dip"
android:background="@drawable/footer_greenbtn"
android:text="@string/DLG_save"
android:textStyle="bold"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
<Button
android:id="@+id/discard3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="5dip"
android:background="@drawable/footer_redbtn"
android:text="@android:string/cancel"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<!-- ======================================================= tab: more == -->
<ScrollView
android:id="@+id/tab_more"
android:layout_above="@id/edit_footer"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:padding="4dip"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- hide until -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/TEA_hideUntil_label"
style="@style/TextAppearance.GEN_EditLabel" />
<Spinner
android:id="@+id/hideUntil"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<!-- add-ons -->
<LinearLayout
android:id="@+id/addons_more"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/addons_empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="100"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="20dip"
android:src="@drawable/icon_pp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/TEA_addons_text"
android:padding="10dip"
android:gravity="center"
style="@style/TextAppearance.TLA_NoItems" />
<Button
android:id="@+id/addons_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="@string/TEA_addons_button" />
</LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/edit_footer4"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="48dip"
android:layout_marginTop="7dip"
android:layout_alignParentBottom="true"
android:padding="5dip"
android:background="@drawable/footer_background"
android:baselineAligned="false">
<Button
android:id="@+id/save4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="5dip"
android:background="@drawable/footer_greenbtn"
android:text="@string/DLG_save"
android:textStyle="bold"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
<Button
android:id="@+id/discard4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="5dip"
android:background="@drawable/footer_redbtn"
android:text="@android:string/cancel"
style="@style/TextAppearance.TEA_action"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.TaskEditActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/taskedit_fragment">
</fragment>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.TaskListActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tasklist_fragment">
</fragment>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.FilterListActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/filterlist_fragment">
</fragment>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.TaskEditActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/taskedit_fragment">
</fragment>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.TaskListActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tasklist_fragment">
</fragment>

@ -8,7 +8,6 @@
<!-- Header -->
<LinearLayout
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="43dip"
android:layout_weight="1"

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="com.todoroo.astrid.activity.TaskEditActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/taskedit_fragment">
</fragment>

@ -10,7 +10,6 @@
<!-- Header -->
<LinearLayout
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="43dip"
android:layout_weight="1"

@ -228,5 +228,11 @@
<item name="android:textSize">14sp</item>
<item name="android:textColor">@android:color/black</item>
</style>
<!-- ====================================================== Actionbar == -->
<style name="customActionBarStyle" parent="@style/Theme.Sherlock">
<item name="android:background">@drawable/actionbar_background</item>
</style>
</resources>

@ -27,7 +27,10 @@ import com.todoroo.astrid.service.StatisticsService;
*
*/
public class AstridWrapperActivity extends FragmentActivity
implements FilterListActivity.OnFilterItemClickedListener, TaskListActivity.OnTaskListItemClickedListener {
implements FilterListActivity.OnFilterItemClickedListener,
TaskListActivity.OnTaskListItemClickedListener,
TaskEditActivity.OnTaskEditDetailsClickedListener {
/** This flag shows if the landscape-multipane layouts are active.
* If a multipane-layout with two fragments is active, the callbacks implemented here
* should not start a new activity, but update the target-fragment directly instead.
@ -108,6 +111,10 @@ public class AstridWrapperActivity extends FragmentActivity
@Override
public void onTaskListItemClicked(int category, int position) {
}
@Override
public void onTaskEditDetailsClicked(int category, int position) {
// TODO Auto-generated method stub
}

@ -148,7 +148,7 @@ public class FilterListActivity extends ExpandableListFragment {
mListener = (OnFilterItemClickedListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnItemClickedListener"); //$NON-NLS-1$
+ " must implement OnFilterItemClickedListener"); //$NON-NLS-1$
}
}
@ -177,7 +177,6 @@ public class FilterListActivity extends ExpandableListFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getActivity().setDefaultKeyMode(Activity.DEFAULT_KEYS_SEARCH_LOCAL);
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
@ -323,11 +322,11 @@ public class FilterListActivity extends ExpandableListFragment {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
if (mDualFragments)
{
setSelectedChild(groupPosition, childPosition, false);
// if (mDualFragments)
// {
// setSelectedChild(groupPosition, childPosition, false);
// setItemChecked((int) getSelectedPosition(), true);
}
// }
FilterListItem item = (FilterListItem) adapter.getChild(groupPosition,
childPosition);
return mListener.onFilterItemClicked(item);

@ -1,460 +0,0 @@
package com.todoroo.astrid.activity;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Fragment;
import android.app.PendingIntent.CanceledException;
import android.app.SearchManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast;
import com.timsu.astrid.R;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.sql.Functions;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.adapter.FilterAdapter;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterCategory;
import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.api.FilterWithCustomIntent;
import com.todoroo.astrid.api.IntentFilter;
import com.todoroo.astrid.core.SearchFilter;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.StartupService;
import com.todoroo.astrid.service.StatisticsService;
import com.todoroo.astrid.service.ThemeService;
public class FilterListFragment extends ExpandableListFragment {
// --- menu codes
private static final int MENU_SEARCH_ID = R.string.FLA_menu_search;
private static final int MENU_HELP_ID = R.string.FLA_menu_help;
private static final int CONTEXT_MENU_SHORTCUT = R.string.FLA_context_shortcut;
private static final int CONTEXT_MENU_INTENT = Menu.FIRST + 3;
private static final int REQUEST_CUSTOM_INTENT = 1;
// --- instance variables
@Autowired
protected ExceptionService exceptionService;
FilterAdapter adapter = null;
private boolean mDualPane;
/* ======================================================================
* ======================================================= initialization
* ====================================================================== */
public FilterListFragment() {
DependencyInjectionService.getInstance().inject(this);
}
/** Called when loading up the activity */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Tell the framework to try to keep this fragment around
// during a configuration change.
setRetainInstance(true);
new StartupService().onStartupApplication(getActivity());
}
/* (non-Javadoc)
* @see com.todoroo.astrid.fragment.ExpandableListFragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate(R.layout.filter_list_activity, container, false);
ThemeService.applyTheme(parent);
return parent;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getActivity().setDefaultKeyMode(Activity.DEFAULT_KEYS_SEARCH_LOCAL);
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
onContentChanged();
onNewIntent(getActivity().getIntent());
Fragment tasklistFrame = getFragmentManager().findFragmentById(R.id.tasklist_fragment);
mDualPane = (tasklistFrame != null) && tasklistFrame.isInLayout();
if (mDualPane) {
// In dual-pane mode, the list view highlights the selected item.
getExpandableListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
// dithering
getActivity().getWindow().setFormat(PixelFormat.RGBA_8888);
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
}
/**
* Called when receiving a new intent. Intents this class handles:
* <ul>
* <li>ACTION_SEARCH - displays a search bar
* <li>ACTION_ADD_LIST - adds new lists to the merge adapter
* </ul>
*/
public void onNewIntent(Intent intent) {
final String intentAction = intent.getAction();
if (Intent.ACTION_SEARCH.equals(intentAction)) {
String query = intent.getStringExtra(SearchManager.QUERY).trim();
Filter filter = new Filter(null, getString(R.string.FLA_search_filter, query),
new QueryTemplate().where(Functions.upper(Task.TITLE).like("%" + //$NON-NLS-1$
query.toUpperCase() + "%")), //$NON-NLS-1$
null);
intent = new Intent(getActivity(), TaskListActivity.class);
intent.putExtra(TaskListFragment.TOKEN_FILTER, filter);
startActivity(intent);
} else {
setUpList();
}
}
/**
* Create options menu (displayed when user presses menu key)
*
* @return true if menu should be displayed
*/
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
MenuItem item;
item = menu.add(Menu.NONE, MENU_SEARCH_ID, Menu.NONE,
R.string.FLA_menu_search);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
item.setIcon(android.R.drawable.ic_menu_search);
item = menu.add(Menu.NONE, MENU_HELP_ID, 1,
R.string.FLA_menu_help);
item.setIcon(android.R.drawable.ic_menu_help);
}
/* ======================================================================
* ============================================================ lifecycle
* ====================================================================== */
@Override
public void onStart() {
super.onStart();
StatisticsService.sessionStart(getActivity());
}
@Override
public void onStop() {
super.onStop();
StatisticsService.sessionStop(getActivity());
}
@Override
public void onResume() {
super.onResume();
if(adapter != null)
adapter.registerRecevier();
}
@Override
public void onPause() {
super.onPause();
if(adapter != null)
adapter.unregisterRecevier();
}
/* ======================================================================
* ===================================================== populating lists
* ====================================================================== */
/** Sets up the coach list adapter */
protected void setUpList() {
adapter = new FilterAdapter(getActivity(), getExpandableListView(),
R.layout.filter_adapter_row, false);
setListAdapter(adapter);
registerForContextMenu(getExpandableListView());
}
/* ======================================================================
* ============================================================== actions
* ====================================================================== */
/**
* Handles items being clicked. Return true if item is handled.
*/
protected boolean onItemClicked(FilterListItem item) {
if(item instanceof Filter) {
Filter filter = (Filter)item;
Intent intent = new Intent(getActivity(), TaskListActivity.class);
intent.putExtra(TaskListFragment.TOKEN_FILTER, filter);
if(filter instanceof FilterWithCustomIntent) {
FilterWithCustomIntent customFilter = ((FilterWithCustomIntent)filter);
intent.setComponent(customFilter.customTaskList);
if(customFilter.customExtras != null)
intent.getExtras().putAll(customFilter.customExtras);
}
// choose whether we have to start a new activity (usually for portrait mode),
// or just update the tasklist-fragment (usually in landscape)
TaskListFragment tasklist = (TaskListFragment) getFragmentManager()
.findFragmentById(R.id.tasklist_fragment);
if (tasklist == null || !tasklist.isInLayout() ||
(intent.getComponent() != null && !("com.todoroo.astrid.activity.TaskListActivity".equals(intent.getComponent().getClassName())))) {
startActivity(intent);
if (getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE)
AndroidUtilities.callApiMethod(5, getActivity(), "overridePendingTransition", //$NON-NLS-1$
new Class<?>[] { Integer.TYPE, Integer.TYPE }, 0, 0);
else
AndroidUtilities.callApiMethod(5, getActivity(), "overridePendingTransition", //$NON-NLS-1$
new Class<?>[] { Integer.TYPE, Integer.TYPE },
R.anim.slide_left_in, R.anim.slide_left_out);
} else {
tasklist.onNewIntent(intent);
}
return true;
} else if(item instanceof SearchFilter) {
getActivity().onSearchRequested();
} else if(item instanceof IntentFilter) {
try {
((IntentFilter)item).intent.send();
} catch (CanceledException e) {
// ignore
}
}
return false;
}
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
FilterListItem item = (FilterListItem) adapter.getChild(groupPosition,
childPosition);
return onItemClicked(item);
}
@Override
public void onGroupExpand(int groupPosition) {
FilterListItem item = (FilterListItem) adapter.getGroup(groupPosition);
onItemClicked(item);
if(item instanceof FilterCategory)
adapter.saveExpansionSetting((FilterCategory) item, true);
}
@Override
public void onGroupCollapse(int groupPosition) {
FilterListItem item = (FilterListItem) adapter.getGroup(groupPosition);
onItemClicked(item);
if(item instanceof FilterCategory)
adapter.saveExpansionSetting((FilterCategory) item, false);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
FilterListItem item;
if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
int childPos = ExpandableListView.getPackedPositionChild(info.packedPosition);
item = (FilterListItem) adapter.getChild(groupPos, childPos);
} else if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
item = (FilterListItem) adapter.getGroup(groupPos);
} else {
return;
}
MenuItem menuItem;
if(item instanceof Filter) {
Filter filter = (Filter) item;
menuItem = menu.add(0, CONTEXT_MENU_SHORTCUT, 0, R.string.FLA_context_shortcut);
menuItem.setIntent(ShortcutActivity.createIntent(filter));
}
for(int i = 0; i < item.contextMenuLabels.length; i++) {
if(item.contextMenuIntents.length <= i)
break;
menuItem = menu.add(0, CONTEXT_MENU_INTENT, 0, item.contextMenuLabels[i]);
menuItem.setIntent(item.contextMenuIntents[i]);
}
if(menu.size() > 0)
menu.setHeaderTitle(item.listingTitle);
}
/**
* Creates a shortcut on the user's home screen
*
* @param shortcutIntent
* @param label
*/
private void createShortcut(Filter filter, Intent shortcutIntent, String label) {
if(label.length() == 0)
return;
Bitmap emblem = filter.listingIcon;
if(emblem == null)
emblem = ((BitmapDrawable) getResources().getDrawable(
R.drawable.filter_tags1)).getBitmap();
// create icon by superimposing astrid w/ icon
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
Bitmap bitmap = ((BitmapDrawable) getResources().getDrawable(
R.drawable.icon_blank)).getBitmap();
bitmap = bitmap.copy(bitmap.getConfig(), true);
Canvas canvas = new Canvas(bitmap);
int dimension = 22;
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$
getActivity().sendBroadcast(createShortcutIntent);
Toast.makeText(getActivity(),
getString(R.string.FLA_toast_onCreateShortcut, label), Toast.LENGTH_LONG).show();
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
// handle my own menus
switch (item.getItemId()) {
case MENU_SEARCH_ID: {
getActivity().onSearchRequested();
return true;
}
case MENU_HELP_ID: {
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://weloveastrid.com/help-user-guide-astrid-v3/filters/")); //$NON-NLS-1$
startActivity(intent);
return true;
}
case CONTEXT_MENU_SHORTCUT: {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo)item.getMenuInfo();
final Intent shortcutIntent = item.getIntent();
FilterListItem filter = ((FilterAdapter.ViewHolder)info.targetView.getTag()).item;
if(filter instanceof Filter)
showCreateShortcutDialog(shortcutIntent, (Filter)filter);
return true;
}
case CONTEXT_MENU_INTENT: {
Intent intent = item.getIntent();
startActivityForResult(intent, REQUEST_CUSTOM_INTENT);
return true;
}
default: {
TaskListFragment tasklist = (TaskListFragment) getFragmentManager()
.findFragmentById(R.id.tasklist_fragment);
if (tasklist != null && tasklist.isInLayout())
return tasklist.onOptionsItemSelected(item);
}
}
return false;
}
private void showCreateShortcutDialog(final Intent shortcutIntent,
final Filter filter) {
FrameLayout frameLayout = new FrameLayout(getActivity());
frameLayout.setPadding(10, 0, 10, 0);
final EditText editText = new EditText(getActivity());
if(filter.listingTitle == null)
filter.listingTitle = ""; //$NON-NLS-1$
editText.setText(filter.listingTitle.
replaceAll("\\(\\d+\\)$", "").trim()); //$NON-NLS-1$ //$NON-NLS-2$
frameLayout.addView(editText, new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT));
final Runnable createShortcut = new Runnable() {
@Override
public void run() {
String label = editText.getText().toString();
createShortcut(filter, shortcutIntent, label);
}
};
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId == EditorInfo.IME_NULL) {
createShortcut.run();
return true;
}
return false;
}
});
new AlertDialog.Builder(getActivity())
.setTitle(R.string.FLA_shortcut_dialog_title)
.setMessage(R.string.FLA_shortcut_dialog)
.setView(frameLayout)
.setIcon(android.R.drawable.ic_dialog_info)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
createShortcut.run();
}
})
.setNegativeButton(android.R.string.cancel, null)
.show();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode != Activity.RESULT_CANCELED)
adapter.clear();
// will get lists automatically
super.onActivityResult(requestCode, resultCode, data);
}
}

@ -2,8 +2,6 @@ package com.todoroo.astrid.activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;
import android.widget.ListView;
import com.timsu.astrid.R;
import com.todoroo.astrid.service.ThemeService;
@ -24,7 +22,6 @@ public class FilterListWrapperActivity extends AstridWrapperActivity {
if (frag != null)
{
mMultipleFragments = true;
((ListFragment) frag).getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
}
}

@ -30,7 +30,7 @@ public final class ShareLinkActivity extends TaskListActivity {
Task task = quickAddTask(subject, false);
task.setValue(Task.NOTES, callerIntent.getStringExtra(Intent.EXTRA_TEXT));
taskService.save(task);
Intent intent = new Intent(getActivity(), TaskEditActivity.class);
Intent intent = new Intent(getActivity(), TaskEditWrapperActivity.class);
intent.putExtra(TaskEditActivity.TOKEN_ID, task.getId());
startActivityForResult(intent, ACTIVITY_EDIT_TASK);
}

@ -35,16 +35,19 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.support.v4.app.Fragment;
import android.support.v4.app.SupportActivity;
import android.support.v4.view.Menu;
import android.support.v4.view.MenuItem;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
@ -104,7 +107,7 @@ import com.todoroo.astrid.voice.VoiceInputAssistant;
* @author timsu
*
*/
public final class TaskEditActivity extends Activity {
public final class TaskEditActivity extends Fragment {
// --- bundle tokens
@ -135,15 +138,15 @@ public final class TaskEditActivity extends Activity {
// --- menu codes
private static final int MENU_SAVE_ID = Menu.FIRST;
private static final int MENU_DISCARD_ID = Menu.FIRST + 1;
private static final int MENU_DELETE_ID = Menu.FIRST + 2;
private static final int MENU_SAVE_ID = R.string.TEA_menu_save;
private static final int MENU_DISCARD_ID = R.string.TEA_menu_discard;
private static final int MENU_DELETE_ID = R.string.TEA_menu_delete;
// --- result codes
public static final int RESULT_CODE_SAVED = RESULT_FIRST_USER;
public static final int RESULT_CODE_DISCARDED = RESULT_FIRST_USER + 1;
public static final int RESULT_CODE_DELETED = RESULT_FIRST_USER + 2;
public static final int RESULT_CODE_SAVED = Activity.RESULT_FIRST_USER;
public static final int RESULT_CODE_DISCARDED = Activity.RESULT_FIRST_USER + 1;
public static final int RESULT_CODE_DELETED = Activity.RESULT_FIRST_USER + 2;
public static final String TAB_BASIC = "basic"; //$NON-NLS-1$
@ -211,24 +214,48 @@ public final class TaskEditActivity extends Activity {
private boolean overrideFinishAnim;
// --- fragment handling variables
OnTaskEditDetailsClickedListener mListener;
private boolean mDualFragments = false;
/* ======================================================================
* ======================================================= initialization
* ====================================================================== */
/** Container Activity must implement this interface and we ensure
* that it does during the onAttach() callback
*/
public interface OnTaskEditDetailsClickedListener {
public void onTaskEditDetailsClicked(int category, int position);
}
@Override
public void onAttach(SupportActivity activity) {
super.onAttach(activity);
// Check that the container activity has implemented the callback interface
try {
mListener = (OnTaskEditDetailsClickedListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnTaskEditDetailsClickedListener"); //$NON-NLS-1$
}
}
public TaskEditActivity() {
DependencyInjectionService.getInstance().inject(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new StartupService().onStartupApplication(this);
// Tell the framework to try to keep this fragment around
// during a configuration change.
setRetainInstance(true);
setUpUIComponents();
overrideFinishAnim = getActivity().getIntent().getBooleanExtra(OVERRIDE_FINISH_ANIM, true);
overrideFinishAnim = getIntent().getBooleanExtra(OVERRIDE_FINISH_ANIM, true);
new StartupService().onStartupApplication(getActivity());
// if we were editing a task already, restore it
if(savedInstanceState != null && savedInstanceState.containsKey(TASK_IN_PROGRESS)) {
@ -238,81 +265,107 @@ public final class TaskEditActivity extends Activity {
}
}
setResult(RESULT_OK);
getActivity().setResult(Activity.RESULT_OK);
}
/* ======================================================================
* ==================================================== UI initialization
* ====================================================================== */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.task_edit_activity_new,
container, false);
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// We have a menu item to show in action bar.
setHasOptionsMenu(true);
getSupportActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Fragment tasklistFrame = getFragmentManager().findFragmentById(R.id.tasklist_fragment);
mDualFragments = (tasklistFrame != null) && tasklistFrame.isInLayout();
setUpUIComponents();
// disable keyboard until user requests it
AndroidUtilities.suppressVirtualKeyboard(title);
}
/** Initialize UI components */
private void setUpUIComponents() {
setContentView(R.layout.task_edit_activity_new);
scrollView = (ScrollView) findViewById(R.id.edit_scroll);
scrollView = (ScrollView) getView().findViewById(R.id.edit_scroll);
LinearLayout basicControls = (LinearLayout) findViewById(R.id.basic_controls);
LinearLayout whenDialogView = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.task_edit_when_controls, null);
LinearLayout basicControls = (LinearLayout) getView().findViewById(R.id.basic_controls);
LinearLayout whenDialogView = (LinearLayout) LayoutInflater.from(getActivity()).inflate(R.layout.task_edit_when_controls, null);
LinearLayout whenControls = (LinearLayout) whenDialogView.findViewById(R.id.when_controls);
LinearLayout whenHeader = (LinearLayout) findViewById(R.id.when_header);
LinearLayout moreControls = (LinearLayout) findViewById(R.id.more_controls);
LinearLayout whenHeader = (LinearLayout) getView().findViewById(R.id.when_header);
LinearLayout moreControls = (LinearLayout) getView().findViewById(R.id.more_controls);
constructWhenDialog(whenDialogView);
HashMap<String, TaskEditControlSet> controlSetMap = new HashMap<String, TaskEditControlSet>();
// populate control set
EditTitleControlSet editTitle = new EditTitleControlSet(this, R.layout.control_set_title, Task.TITLE, R.id.title);
EditTitleControlSet editTitle = new EditTitleControlSet(getActivity(), R.layout.control_set_title, Task.TITLE, R.id.title);
title = (EditText) editTitle.getView().findViewById(R.id.title);
controls.add(editTitle);
//basicControls.addView(editTitle.getDisplayView());
controlSetMap.put(getString(R.string.TEA_control_title), editTitle);
TimerActionControlSet timerAction = new TimerActionControlSet(this, editTitle.getView());
TimerActionControlSet timerAction = new TimerActionControlSet(getActivity(), editTitle.getView());
controls.add(timerAction);
controls.add(peopleControlSet = new EditPeopleControlSet(TaskEditActivity.this, R.layout.control_set_assigned, R.layout.control_set_assigned_display, R.string.actfm_EPA_assign_label, REQUEST_LOG_IN));
controls.add(peopleControlSet = new EditPeopleControlSet(getActivity(), R.layout.control_set_assigned, R.layout.control_set_assigned_display, R.string.actfm_EPA_assign_label, REQUEST_LOG_IN));
//basicControls.addView(peopleControlSet.getDisplayView());
controlSetMap.put(getString(R.string.TEA_control_who), peopleControlSet);
DeadlineControlSet deadlineControl = new DeadlineControlSet(TaskEditActivity.this, R.layout.control_set_deadline, R.layout.control_set_deadline_display, whenHeader, R.id.aux_date, R.id.when_shortcut_container, R.id.when_label, R.id.when_image);
DeadlineControlSet deadlineControl = new DeadlineControlSet(getActivity(), R.layout.control_set_deadline, R.layout.control_set_deadline_display, whenHeader, R.id.aux_date, R.id.when_shortcut_container, R.id.when_label, R.id.when_image);
controls.add(deadlineControl);
whenControls.addView(deadlineControl.getDisplayView());
RepeatControlSet repeatControls = new RepeatControlSet(TaskEditActivity.this, R.layout.control_set_repeat, R.layout.control_set_repeat_display, R.string.repeat_enabled);
RepeatControlSet repeatControls = new RepeatControlSet(getActivity(), R.layout.control_set_repeat, R.layout.control_set_repeat_display, R.string.repeat_enabled);
controls.add(repeatControls);
whenControls.addView(repeatControls.getDisplayView());
GCalControlSet gcalControl = new GCalControlSet(TaskEditActivity.this, R.layout.control_set_gcal, R.layout.control_set_gcal_display, R.string.gcal_TEA_addToCalendar_label);
GCalControlSet gcalControl = new GCalControlSet(getActivity(), R.layout.control_set_gcal, R.layout.control_set_gcal_display, R.string.gcal_TEA_addToCalendar_label);
controls.add(gcalControl);
whenControls.addView(gcalControl.getDisplayView());
hideUntilControls = new HideUntilControlSet(TaskEditActivity.this, R.layout.control_set_hide, R.layout.control_set_hide_display, R.string.hide_until_prompt);
hideUntilControls = new HideUntilControlSet(getActivity(), R.layout.control_set_hide, R.layout.control_set_hide_display, R.string.hide_until_prompt);
controls.add(hideUntilControls);
whenControls.addView(hideUntilControls.getDisplayView());
ImportanceControlSet importanceControl = new ImportanceControlSet(TaskEditActivity.this, R.layout.control_set_importance);
ImportanceControlSet importanceControl = new ImportanceControlSet(getActivity(), R.layout.control_set_importance);
controls.add(importanceControl);
importanceControl.addListener(editTitle);
//moreControls.addView(importanceControl.getDisplayView());
controlSetMap.put(getString(R.string.TEA_control_importance), importanceControl);
TagsControlSet tagsControl = new TagsControlSet(TaskEditActivity.this, R.layout.control_set_tags, R.layout.control_set_tags_display, R.string.TEA_tags_label);
TagsControlSet tagsControl = new TagsControlSet(getActivity(), R.layout.control_set_tags, R.layout.control_set_tags_display, R.string.TEA_tags_label);
controls.add(tagsControl);
//moreControls.addView(tagsControl.getDisplayView());
controlSetMap.put(getString(R.string.TEA_control_lists), tagsControl);
notesControlSet = new EditNotesControlSet(TaskEditActivity.this, R.layout.control_set_notes, R.layout.control_set_notes_display);
notesControlSet = new EditNotesControlSet(getActivity(), R.layout.control_set_notes, R.layout.control_set_notes_display);
notesEditText = (EditText) notesControlSet.getView().findViewById(R.id.notes);
controls.add(notesControlSet);
//moreControls.addView(notesControlSet.getDisplayView());
controlSetMap.put(getString(R.string.TEA_control_notes), notesControlSet);
ReminderControlSet reminderControl = new ReminderControlSet(TaskEditActivity.this, R.layout.control_set_reminders, R.layout.control_set_reminders_display);
ReminderControlSet reminderControl = new ReminderControlSet(getActivity(), R.layout.control_set_reminders, R.layout.control_set_reminders_display);
controls.add(reminderControl);
//moreControls.addView(reminderControl.getDisplayView());
controlSetMap.put(getString(R.string.TEA_control_reminders), reminderControl);
TimerControlSet timerControl = new TimerControlSet(TaskEditActivity.this, R.layout.control_set_timers, R.layout.control_set_timers_extras_display, R.string.TEA_timer_controls);
TimerControlSet timerControl = new TimerControlSet(getActivity(), R.layout.control_set_timers, R.layout.control_set_timers_extras_display, R.string.TEA_timer_controls);
timerAction.setListener(timerControl);
controls.add(timerControl);
//moreControls.addView(timerControl.getDisplayView());
@ -322,7 +375,7 @@ public final class TaskEditActivity extends Activity {
try {
if(ProducteevUtilities.INSTANCE.isLoggedIn()) {
ProducteevControlSet producteevControl = new ProducteevControlSet(TaskEditActivity.this, R.layout.control_set_producteev, R.layout.control_set_producteev_display, R.string.producteev_TEA_control_set_display);
ProducteevControlSet producteevControl = new ProducteevControlSet(getActivity(), R.layout.control_set_producteev, R.layout.control_set_producteev_display, R.string.producteev_TEA_control_set_display);
controls.add(producteevControl);
basicControls.addView(producteevControl.getDisplayView());
notesEditText.setHint(R.string.producteev_TEA_notes);
@ -334,7 +387,7 @@ public final class TaskEditActivity extends Activity {
try {
if(OpencrxCoreUtils.INSTANCE.isLoggedIn()) {
OpencrxControlSet ocrxControl = new OpencrxControlSet(TaskEditActivity.this, R.layout.control_set_opencrx, R.layout.control_set_opencrx_display, R.string.opencrx_TEA_opencrx_title);
OpencrxControlSet ocrxControl = new OpencrxControlSet(getActivity(), R.layout.control_set_opencrx, R.layout.control_set_opencrx_display, R.string.opencrx_TEA_opencrx_title);
controls.add(ocrxControl);
basicControls.addView(ocrxControl.getDisplayView());
notesEditText.setHint(R.string.opencrx_TEA_notes);
@ -344,7 +397,6 @@ public final class TaskEditActivity extends Activity {
Log.e("astrid-error", "loading-control-set", e); //$NON-NLS-1$ //$NON-NLS-2$
}
String[] itemOrder;
String orderPreference = Preferences.getStringValue(BeastModePreferenceActivity.BEAST_MODE_ORDER_PREF);
if (orderPreference != null)
@ -353,7 +405,7 @@ public final class TaskEditActivity extends Activity {
itemOrder = getResources().getStringArray(R.array.TEA_control_sets);
String moreSectionTrigger = getString(R.string.TEA_control_more_section);
String whenViewDescriptor = getString(R.string.TEA_control_when);
View whenView = findViewById(R.id.when_container);
View whenView = getView().findViewById(R.id.when_container);
String shareViewDescriptor = getString(R.string.TEA_control_share);
LinearLayout section = basicControls;
for (int i = 0; i < itemOrder.length; i++) {
@ -373,7 +425,7 @@ public final class TaskEditActivity extends Activity {
}
}
if (moreControls.getChildCount() == 0)
findViewById(R.id.more_header).setVisibility(View.GONE);
getView().findViewById(R.id.more_header).setVisibility(View.GONE);
@ -401,14 +453,14 @@ public final class TaskEditActivity extends Activity {
}
};
final View.OnClickListener mExpandMoreListener = new View.OnClickListener() {
final Animation fadeIn = AnimationUtils.loadAnimation(TaskEditActivity.this, android.R.anim.fade_in);
final Animation fadeOut = AnimationUtils.loadAnimation(TaskEditActivity.this, android.R.anim.fade_out);
final Animation fadeIn = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
final Animation fadeOut = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
@Override
public void onClick(View v) {
fadeIn.setDuration(300);
fadeOut.setDuration(300);
View moreView = findViewById(R.id.more_controls);
View moreHeader = findViewById(R.id.more_header);
View moreView = getView().findViewById(R.id.more_controls);
View moreHeader = getView().findViewById(R.id.more_header);
if (moreView.getVisibility() == View.GONE) {
moreView.setVisibility(View.VISIBLE);
moreView.startAnimation(fadeIn);
@ -420,12 +472,12 @@ public final class TaskEditActivity extends Activity {
// set up save, cancel, and delete buttons
try {
Button saveButtonGeneral = (Button) findViewById(R.id.save);
Button saveButtonGeneral = (Button) getView().findViewById(R.id.save);
saveButtonGeneral.setOnClickListener(mSaveListener);
Button saveButton2 = (Button) findViewById(R.id.save2);
Button saveButton3 = (Button) findViewById(R.id.save3);
Button saveButton4 = (Button) findViewById(R.id.save4);
Button saveButton2 = (Button) getView().findViewById(R.id.save2);
Button saveButton3 = (Button) getView().findViewById(R.id.save3);
Button saveButton4 = (Button) getView().findViewById(R.id.save4);
if (saveButton2 != null) {
saveButton2.setOnClickListener(mSaveListener);
}
@ -437,12 +489,12 @@ public final class TaskEditActivity extends Activity {
}
Button discardButtonGeneral = (Button) findViewById(R.id.discard);
Button discardButtonGeneral = (Button) getView().findViewById(R.id.discard);
discardButtonGeneral.setOnClickListener(mDiscardListener);
Button discardButton2 = (Button) findViewById(R.id.discard2);
Button discardButton3 = (Button) findViewById(R.id.discard3);
Button discardButton4 = (Button) findViewById(R.id.discard4);
Button discardButton2 = (Button) getView().findViewById(R.id.discard2);
Button discardButton3 = (Button) getView().findViewById(R.id.discard3);
Button discardButton4 = (Button) getView().findViewById(R.id.discard4);
if (discardButton2 != null) {
discardButton2.setOnClickListener(mDiscardListener);
}
@ -453,14 +505,14 @@ public final class TaskEditActivity extends Activity {
discardButton4.setOnClickListener(mDiscardListener);
}
findViewById(R.id.when_header).setOnClickListener(mExpandWhenListener);
getView().findViewById(R.id.when_header).setOnClickListener(mExpandWhenListener);
findViewById(R.id.more_header).setOnClickListener(mExpandMoreListener);
getView().findViewById(R.id.more_header).setOnClickListener(mExpandMoreListener);
findViewById(R.id.activity).setOnClickListener(new View.OnClickListener() {
getView().findViewById(R.id.activity).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent launchIntent = new Intent(TaskEditActivity.this, EditNoteActivity.class);
Intent launchIntent = new Intent(getActivity(), EditNoteActivity.class);
launchIntent.putExtra(EditNoteActivity.EXTRA_TASK_ID, model.getId());
startActivity(launchIntent);
}
@ -473,10 +525,10 @@ public final class TaskEditActivity extends Activity {
private void constructWhenDialog(View whenDialogView) {
int theme = ThemeService.getTheme();
if (theme == R.style.Theme || theme == R.style.Theme_Transparent) {
whenDialog = new Dialog(this, R.style.Theme_TEA_Dialog);//R.style.Theme_WhenDialog
whenDialog = new Dialog(getActivity(), R.style.Theme_TEA_Dialog);//R.style.Theme_WhenDialog
//whenDialogView.setBackgroundColor(getResources().getColor(android.R.color.black));
} else {
whenDialog = new Dialog(this, R.style.Theme_TEA_Dialog); //R.style.Theme_White_WhenDialog
whenDialog = new Dialog(getActivity(), R.style.Theme_TEA_Dialog); //R.style.Theme_White_WhenDialog
//whenDialogView.setBackgroundColor(getResources().getColor(android.R.color.white));
}
@ -484,12 +536,12 @@ public final class TaskEditActivity extends Activity {
dismissDialogButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DialogUtilities.dismissDialog(TaskEditActivity.this, whenDialog);
DialogUtilities.dismissDialog(getActivity(), whenDialog);
}
});
DisplayMetrics metrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
whenDialog.setTitle(R.string.TEA_when_dialog_title);
whenDialog.addContentView(whenDialogView, new LayoutParams(metrics.widthPixels - (int)(30 * metrics.density), LayoutParams.WRAP_CONTENT));
}
@ -508,7 +560,7 @@ public final class TaskEditActivity extends Activity {
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(R.id.voiceAddNoteButton);
voiceAddNoteButton.setVisibility(View.VISIBLE);
int prompt = R.string.voice_edit_note_prompt;
voiceNoteAssistant = new VoiceInputAssistant(TaskEditActivity.this, voiceAddNoteButton,
voiceNoteAssistant = new VoiceInputAssistant(getActivity(), voiceAddNoteButton,
notesEditText, REQUEST_VOICE_RECOG);
voiceNoteAssistant.setAppend(true);
voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
@ -546,7 +598,7 @@ public final class TaskEditActivity extends Activity {
public void run() {
AndroidUtilities.sleepDeep(500L);
runOnUiThread(new Runnable() {
getActivity().runOnUiThread(new Runnable() {
public void run() {
onUiThread();
}
@ -607,13 +659,13 @@ public final class TaskEditActivity extends Activity {
if(model == null) {
exceptionService.reportError("task-edit-no-task",
new NullPointerException("model"));
finish();
getActivity().finish();
return;
}
if (!isNewTask) {
if (actFmPreferenceService.isLoggedIn()) {
findViewById(R.id.activityContainer).setVisibility(View.VISIBLE);
getView().findViewById(R.id.activityContainer).setVisibility(View.VISIBLE);
}
}
@ -622,10 +674,10 @@ public final class TaskEditActivity extends Activity {
}
/** Populate UI component values from the model */
private void populateFields() {
loadItem(getIntent());
public void populateFields(Intent intent) {
loadItem(intent);
TextView titleText = (TextView) findViewById(R.id.taskLabel);
TextView titleText = (TextView) getView().findViewById(R.id.taskLabel);
if(isNewTask)
titleText.setText(R.string.TEA_view_titleNew);
else
@ -637,6 +689,11 @@ public final class TaskEditActivity extends Activity {
}
}
/** Populate UI component values from the model */
private void populateFields() {
populateFields(getActivity().getIntent());
}
/** Save task model from values in UI components */
private void save(boolean onPause) {
if(title.getText().length() > 0)
@ -662,22 +719,21 @@ public final class TaskEditActivity extends Activity {
if (!onPause) { // Saving during on pause could cause a double finish
shouldSaveState = false;
finish();
getActivity().finish();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
save(false);
return true;
}
return super.onKeyDown(keyCode, event);
return false;
}
@Override
public void finish() {
super.finish();
public void onDetach() {
super.onDetach();
// abandon editing and delete the newly created task if
// no title was entered
@ -710,13 +766,13 @@ public final class TaskEditActivity extends Activity {
RemoteViews view = extras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
// add a separator
View separator = new View(TaskEditActivity.this);
View separator = new View(getActivity());
separator.setPadding(5, 5, 5, 5);
separator.setBackgroundResource(android.R.drawable.divider_horizontal_dark);
LinearLayout dest = (LinearLayout)findViewById(R.id.addons_more);
LinearLayout dest = (LinearLayout)getView().findViewById(R.id.addons_more);
dest.addView(separator);
view.apply(TaskEditActivity.this, dest);
view.apply(getActivity(), dest);
} catch (Exception e) {
exceptionService.reportError("receive-detail-" + //$NON-NLS-1$
@ -747,7 +803,7 @@ public final class TaskEditActivity extends Activity {
if (due != 0) {
stringResource = R.string.TEA_onTaskSave_due;
CharSequence formattedDate =
DateUtilities.getRelativeDay(this, due);
DateUtilities.getRelativeDay(getActivity(), due);
toastMessage = getString(stringResource, formattedDate);
} else {
toastMessage = getString(R.string.TEA_onTaskSave_notDue);
@ -766,20 +822,20 @@ public final class TaskEditActivity extends Activity {
}
showCancelToast();
setResult(RESULT_CANCELED);
finish();
getActivity().setResult(Activity.RESULT_CANCELED);
getActivity().finish();
}
/**
* Show toast for task edit canceling
*/
private void showCancelToast() {
Toast.makeText(this, R.string.TEA_onTaskCancel,
Toast.makeText(getActivity(), R.string.TEA_onTaskCancel,
Toast.LENGTH_SHORT).show();
}
protected void deleteButtonClick() {
new AlertDialog.Builder(this)
new AlertDialog.Builder(getActivity())
.setTitle(R.string.DLG_confirm_title)
.setMessage(R.string.DLG_delete_this_task_question)
.setIcon(android.R.drawable.ic_dialog_alert)
@ -789,8 +845,8 @@ public final class TaskEditActivity extends Activity {
taskService.delete(model);
shouldSaveState = false;
showDeleteToast();
setResult(RESULT_CANCELED);
finish();
getActivity().setResult(Activity.RESULT_CANCELED);
getActivity().finish();
}
})
.setNegativeButton(android.R.string.cancel, null)
@ -801,12 +857,12 @@ public final class TaskEditActivity extends Activity {
* Show toast for task edit deleting
*/
private void showDeleteToast() {
Toast.makeText(this, R.string.TEA_onTaskDelete,
Toast.makeText(getActivity(), R.string.TEA_onTaskDelete,
Toast.LENGTH_SHORT).show();
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case MENU_SAVE_ID:
saveButtonClick();
@ -819,12 +875,12 @@ public final class TaskEditActivity extends Activity {
return true;
}
return super.onMenuItemSelected(featureId, item);
return super.onOptionsItemSelected(item);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
MenuItem item;
item = menu.add(Menu.NONE, MENU_SAVE_ID, 0, R.string.TEA_menu_save);
@ -835,32 +891,30 @@ public final class TaskEditActivity extends Activity {
item = menu.add(Menu.NONE, MENU_DELETE_ID, 0, R.string.TEA_menu_delete);
item.setIcon(android.R.drawable.ic_menu_delete);
return true;
}
@Override
protected void onPause() {
public void onPause() {
super.onPause();
StatisticsService.sessionPause();
unregisterReceiver(controlReceiver);
getActivity().unregisterReceiver(controlReceiver);
if(shouldSaveState)
save(true);
}
@Override
protected void onResume() {
public void onResume() {
super.onResume();
StatisticsService.sessionStart(this);
registerReceiver(controlReceiver,
StatisticsService.sessionStart(getActivity());
getActivity().registerReceiver(controlReceiver,
new IntentFilter(AstridApiConstants.BROADCAST_SEND_EDIT_CONTROLS));
populateFields();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == REQUEST_VOICE_RECOG && resultCode == RESULT_OK) {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == REQUEST_VOICE_RECOG && resultCode == Activity.RESULT_OK) {
// handle the result of voice recognition, put it into the appropiate textfield
voiceNoteAssistant.handleActivityResult(requestCode, resultCode, data);
@ -876,7 +930,7 @@ public final class TaskEditActivity extends Activity {
}
@Override
protected void onSaveInstanceState(Bundle outState) {
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// stick our task into the outState
@ -884,19 +938,14 @@ public final class TaskEditActivity extends Activity {
}
@Override
protected void onRestoreInstanceState(Bundle inState) {
super.onRestoreInstanceState(inState);
}
@Override
protected void onStart() {
public void onStart() {
super.onStart();
}
@Override
protected void onStop() {
public void onStop() {
super.onStop();
StatisticsService.sessionStop(this);
StatisticsService.sessionStop(getActivity());
}
/* ======================================================================

@ -0,0 +1,36 @@
package com.todoroo.astrid.activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.KeyEvent;
import com.timsu.astrid.R;
import com.todoroo.astrid.service.ThemeService;
public class TaskEditWrapperActivity extends AstridWrapperActivity {
/**
* @see android.app.Activity#onCreate(Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.task_edit_wrapper_activity);
Fragment frag = (Fragment) getSupportFragmentManager()
.findFragmentById(R.id.taskedit_fragment);
if (frag != null)
{
mMultipleFragments = true;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
TaskEditActivity frag = (TaskEditActivity) getSupportFragmentManager()
.findFragmentById(R.id.taskedit_fragment);
if (frag != null && frag.isInLayout())
return frag.onKeyDown(keyCode, event);
return super.onKeyDown(keyCode, event);
}
}

@ -28,6 +28,7 @@ import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;
import android.support.v4.app.SupportActivity;
import android.support.v4.view.Menu;
@ -203,7 +204,7 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
// --- fragment handling variables
OnTaskListItemClickedListener mListener;
private final boolean mDualFragments = false;
private boolean mDualFragments = false;
/* ======================================================================
* ======================================================= initialization
@ -228,7 +229,7 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
mListener = (OnTaskListItemClickedListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnItemSelectedListener"); //$NON-NLS-1$
+ " must implement OnTaskListItemClickedListener"); //$NON-NLS-1$
}
}
@ -284,15 +285,14 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
setUpUiComponents();
onNewIntent(getActivity().getIntent());
// FIXME move this code into the TaskListWrapperActivity
// Fragment filterFrame = getFragmentManager().findFragmentById(R.id.filterlist_fragment);
// mDualPane = (filterFrame != null) &amp;&amp; filterFrame.isInLayout();
//
// if (mDualPane) {
// // In dual-pane mode, the list view highlights the selected item.
// getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
// }
// end of FIXME
Fragment filterlistFrame = getFragmentManager().findFragmentById(R.id.filterlist_fragment);
mDualFragments = (filterlistFrame != null) && filterlistFrame.isInLayout();
if (mDualFragments) {
// In dual-pane mode, the list view highlights the selected item.
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
getListView().setItemsCanFocus(false);
}
if(Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1) > -1)
upgradeService.showChangeLog(getActivity(), Preferences.getInt(AstridPreferences.P_UPGRADE_FROM, -1));
@ -392,10 +392,12 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
addSyncRefreshMenuItem(menu);
item = menu.add(Menu.NONE, MENU_LISTS_ID, Menu.NONE,
R.string.tag_TLA_menu);
item.setIcon(R.drawable.ic_menu_lists);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
if (!mDualFragments) {
item = menu.add(Menu.NONE, MENU_LISTS_ID, Menu.NONE,
R.string.tag_TLA_menu);
item.setIcon(R.drawable.ic_menu_lists);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
if(!Constants.MARKET_DISABLED) {
item = menu.add(Menu.NONE, MENU_ADDONS_ID, Menu.NONE,
@ -556,13 +558,13 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
// Subclasses can override these to customize extras in quickadd intent
protected Intent getOnClickQuickAddIntent(Task t) {
Intent intent = new Intent(getActivity(), TaskEditActivity.class);
Intent intent = new Intent(getActivity(), TaskEditWrapperActivity.class);
intent.putExtra(TaskEditActivity.TOKEN_ID, t.getId());
return intent;
}
protected Intent getOnLongClickQuickAddIntent(Task t) {
Intent intent = new Intent(getActivity(), TaskEditActivity.class);
Intent intent = new Intent(getActivity(), TaskEditWrapperActivity.class);
intent.putExtra(TaskEditActivity.TOKEN_ID, t.getId());
return intent;
}
@ -1262,7 +1264,7 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
case CONTEXT_MENU_EDIT_TASK_ID: {
itemId = item.getGroupId();
intent = new Intent(getActivity(), TaskEditActivity.class);
intent = new Intent(getActivity(), TaskEditWrapperActivity.class);
intent.putExtra(TaskEditActivity.TOKEN_ID, itemId);
startActivityForResult(intent, ACTIVITY_EDIT_TASK);
transitionForTaskEdit();
@ -1285,7 +1287,7 @@ public class TaskListActivity extends ListFragment implements OnScrollListener,
GCalHelper.createTaskEventIfEnabled(clone);
taskService.save(clone);
intent = new Intent(getActivity(), TaskEditActivity.class);
intent = new Intent(getActivity(), TaskEditWrapperActivity.class);
intent.putExtra(TaskEditActivity.TOKEN_ID, clone.getId());
startActivityForResult(intent, ACTIVITY_EDIT_TASK);
transitionForTaskEdit();

@ -2,7 +2,6 @@ package com.todoroo.astrid.activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.widget.ListView;
import com.timsu.astrid.R;
import com.todoroo.astrid.service.ThemeService;
@ -19,10 +18,9 @@ public class TaskListWrapperActivity extends AstridWrapperActivity {
Fragment frag = (Fragment) getSupportFragmentManager()
.findFragmentById(R.id.filterlist_fragment);
if (frag != null)
if (frag != null && frag.isInLayout())
{
mMultipleFragments = true;
((ExpandableListFragment) frag).getExpandableListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
}
}

@ -69,6 +69,7 @@ import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Pair;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.TaskEditActivity;
import com.todoroo.astrid.activity.TaskEditWrapperActivity;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.api.TaskAction;
@ -914,7 +915,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
mBar = null;
if(position == 0) {
Intent intent = new Intent(fragment.getActivity(), TaskEditActivity.class);
Intent intent = new Intent(fragment.getActivity(), TaskEditWrapperActivity.class);
intent.putExtra(TaskEditActivity.TOKEN_ID, taskId);
fragment.startActivityForResult(intent, TaskListActivity.ACTIVITY_EDIT_TASK);
AndroidUtilities.callApiMethod(5, fragment, "overridePendingTransition",
@ -976,7 +977,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
if (actions.size() > 0)
mBar.show(v);
else {
Intent intent = new Intent(fragment.getActivity(), TaskEditActivity.class);
Intent intent = new Intent(fragment.getActivity(), TaskEditWrapperActivity.class);
intent.putExtra(TaskEditActivity.TOKEN_ID, taskId);
fragment.getActivity().startActivityForResult(intent, TaskListActivity.ACTIVITY_EDIT_TASK);
AndroidUtilities.callApiMethod(5, fragment, "overridePendingTransition",
@ -1005,7 +1006,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
if (taskId != -1) {
Collection<TaskAction> actions = taskActionManager.get(taskId);
if (actions != null && actions.size() == 0) {
Intent editIntent = new Intent(fragment.getActivity(), TaskEditActivity.class);
Intent editIntent = new Intent(fragment.getActivity(), TaskEditWrapperActivity.class);
editIntent.putExtra(TaskEditActivity.TOKEN_ID, taskId);
fragment.getActivity().startActivityForResult(editIntent, TaskListActivity.ACTIVITY_EDIT_TASK);
AndroidUtilities.callApiMethod(5, fragment, "overridePendingTransition",

@ -27,6 +27,7 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.TaskEditActivity;
import com.todoroo.astrid.activity.TaskEditWrapperActivity;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.activity.TaskListWrapperActivity;
import com.todoroo.astrid.api.Filter;
@ -229,7 +230,7 @@ public class TasksWidget extends AppWidgetProvider {
views.setOnClickPendingIntent(R.id.taskbody, pListIntent);
Intent editIntent = new Intent(context, TaskEditActivity.class);
Intent editIntent = new Intent(context, TaskEditWrapperActivity.class);
editIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
editIntent.putExtra(TaskEditActivity.OVERRIDE_FINISH_ANIM, false);
if(filter != null && filter.valuesForNewTasks != null) {

Loading…
Cancel
Save