diff --git a/astrid/src/main/java/com/faizmalkani/floatingactionbutton/FloatingActionButton.java b/astrid/src/main/java/com/faizmalkani/floatingactionbutton/FloatingActionButton.java new file mode 100644 index 000000000..43f935553 --- /dev/null +++ b/astrid/src/main/java/com/faizmalkani/floatingactionbutton/FloatingActionButton.java @@ -0,0 +1,99 @@ +package com.faizmalkani.floatingactionbutton; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Point; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.util.AttributeSet; +import android.view.Display; +import android.view.MotionEvent; +import android.view.View; +import android.view.WindowManager; + +import org.tasks.R; + +public class FloatingActionButton extends View { + + private final Paint mButtonPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Paint mDrawablePaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private Bitmap mBitmap; + private int mColor; + + public FloatingActionButton(Context context) { + this(context, null); + } + + public FloatingActionButton(Context context, AttributeSet attributeSet) { + this(context, attributeSet, 0); + } + + public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + + TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.FloatingActionButton); + mColor = a.getColor(R.styleable.FloatingActionButton_tint, Color.WHITE); + mButtonPaint.setStyle(Paint.Style.FILL); + mButtonPaint.setColor(mColor); + float radius, dx, dy; + radius = a.getFloat(R.styleable.FloatingActionButton_shadowRadius, 10.0f); + dx = a.getFloat(R.styleable.FloatingActionButton_shadowDx, 0.0f); + dy = a.getFloat(R.styleable.FloatingActionButton_shadowDy, 3.5f); + int color = a.getInteger(R.styleable.FloatingActionButton_shadowColor, Color.argb(100, 0, 0, 0)); + mButtonPaint.setShadowLayer(radius, dx, dy, color); + + Drawable drawable = a.getDrawable(R.styleable.FloatingActionButton_drawable); + if (null != drawable) { + mBitmap = ((BitmapDrawable) drawable).getBitmap(); + } + setWillNotDraw(false); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + setLayerType(View.LAYER_TYPE_SOFTWARE, null); + } + } + + public static int darkenColor(int color) { + float[] hsv = new float[3]; + Color.colorToHSV(color, hsv); + hsv[2] *= 0.8f; + return Color.HSVToColor(hsv); + } + + public void setColor(int color) { + mColor = color; + mButtonPaint.setColor(mColor); + invalidate(); + } + + public void setDrawable(Drawable drawable) { + mBitmap = ((BitmapDrawable) drawable).getBitmap(); + invalidate(); + } + + @Override + protected void onDraw(Canvas canvas) { + canvas.drawCircle(getWidth() / 2, getHeight() / 2, (float) (getWidth() / 2.6), mButtonPaint); + if (null != mBitmap) { + canvas.drawBitmap(mBitmap, (getWidth() - mBitmap.getWidth()) / 2, + (getHeight() - mBitmap.getHeight()) / 2, mDrawablePaint); + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + int color; + if (event.getAction() == MotionEvent.ACTION_UP) { + color = mColor; + } else { + color = darkenColor(mColor); + } + mButtonPaint.setColor(color); + invalidate(); + return super.onTouchEvent(event); + } +} \ No newline at end of file diff --git a/astrid/src/main/java/com/todoroo/astrid/actfm/TagViewFragment.java b/astrid/src/main/java/com/todoroo/astrid/actfm/TagViewFragment.java index eb199af00..c1f4804f8 100644 --- a/astrid/src/main/java/com/todoroo/astrid/actfm/TagViewFragment.java +++ b/astrid/src/main/java/com/todoroo/astrid/actfm/TagViewFragment.java @@ -9,10 +9,7 @@ import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.os.Bundle; -import android.view.MotionEvent; import android.view.View; -import android.view.View.OnTouchListener; -import android.view.ViewGroup; import android.widget.TextView; import com.todoroo.andlib.utility.DateUtilities; @@ -62,17 +59,6 @@ public class TagViewFragment extends TaskListFragment { super.onActivityCreated(savedInstanceState); getListView().setOnKeyListener(null); - - // allow for text field entry, needed for android bug #2516 - OnTouchListener onTouch = new OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - v.requestFocusFromTouch(); - return false; - } - }; - - getView().findViewById(R.id.quickAddText).setOnTouchListener(onTouch); } // --- data loading diff --git a/astrid/src/main/java/com/todoroo/astrid/activity/AstridActivity.java b/astrid/src/main/java/com/todoroo/astrid/activity/AstridActivity.java index 513b703be..284950e90 100644 --- a/astrid/src/main/java/com/todoroo/astrid/activity/AstridActivity.java +++ b/astrid/src/main/java/com/todoroo/astrid/activity/AstridActivity.java @@ -9,19 +9,14 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.speech.SpeechRecognizer; -import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.View; import android.view.WindowManager.BadTokenException; -import android.widget.EditText; -import android.widget.Toast; import com.todoroo.andlib.data.Property; import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.utility.AndroidUtilities; -import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.FilterListItem; @@ -33,10 +28,6 @@ import com.todoroo.astrid.service.StartupService; import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.subtasks.SubtasksHelper; import com.todoroo.astrid.ui.DateChangedAlerts; -import com.todoroo.astrid.ui.QuickAddBar; -import com.todoroo.astrid.utility.Flags; -import com.todoroo.astrid.voice.RecognizerApi.RecognizerApiListener; -import com.todoroo.astrid.voice.VoiceRecognizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -260,13 +251,6 @@ public class AstridActivity extends InjectingActionBarActivity super.onActivityResult(requestCode, resultCode, data); } - /** - * @return LAYOUT_SINGLE or LAYOUT_DOUBLE - */ - public int getFragmentLayout() { - return fragmentLayout; - } - private class RepeatConfirmationReceiver extends BroadcastReceiver { private final Property[] REPEAT_RESCHEDULED_PROPERTIES = new Property[] { diff --git a/astrid/src/main/java/com/todoroo/astrid/activity/EditPreferences.java b/astrid/src/main/java/com/todoroo/astrid/activity/EditPreferences.java index 2336a88c0..dc12170af 100644 --- a/astrid/src/main/java/com/todoroo/astrid/activity/EditPreferences.java +++ b/astrid/src/main/java/com/todoroo/astrid/activity/EditPreferences.java @@ -5,14 +5,11 @@ */ package com.todoroo.astrid.activity; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.os.Bundle; -import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceClickListener; @@ -24,7 +21,6 @@ import android.text.TextUtils; import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.utility.AndroidUtilities; -import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.data.TaskAttachment; import com.todoroo.astrid.files.FileExplore; @@ -33,12 +29,9 @@ import com.todoroo.astrid.gtasks.GtasksPreferences; import com.todoroo.astrid.helper.MetadataHelper; import com.todoroo.astrid.service.MarketStrategy.AmazonMarketStrategy; import com.todoroo.astrid.service.StartupService; -import com.todoroo.astrid.service.TaskService; import com.todoroo.astrid.utility.Constants; import com.todoroo.astrid.utility.TodorooPreferenceActivity; -import com.todoroo.astrid.voice.VoiceInputAssistant; import com.todoroo.astrid.voice.VoiceOutputAssistant; -import com.todoroo.astrid.voice.VoiceRecognizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,13 +66,10 @@ public class EditPreferences extends TodorooPreferenceActivity { // --- instance variables @Inject StartupService startupService; - @Inject TaskService taskService; @Inject Preferences preferences; @Inject CalendarAlarmScheduler calendarAlarmScheduler; @Inject VoiceOutputAssistant voiceOutputAssistant; - private VoiceInputAssistant voiceInputAssistant; - private class SetResultOnPreferenceChangeListener implements OnPreferenceChangeListener { private final int resultCode; public SetResultOnPreferenceChangeListener(int resultCode) { @@ -106,7 +96,6 @@ public class EditPreferences extends TodorooPreferenceActivity { ContextManager.setContext(this); PreferenceScreen screen = getPreferenceScreen(); - voiceInputAssistant = new VoiceInputAssistant(this); addPluginPreferences(screen); @@ -359,8 +348,6 @@ public class EditPreferences extends TodorooPreferenceActivity { findPreference(getString(R.string.p_fontSize)).setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED)); - findPreference(getString(R.string.p_hide_plus_button)).setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED)); - findPreference(getString(R.string.p_use_dark_theme_widget)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { diff --git a/astrid/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java b/astrid/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java index 92186898c..1bdcf91fa 100755 --- a/astrid/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/astrid/src/main/java/com/todoroo/astrid/activity/TaskEditFragment.java @@ -147,7 +147,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { // --- request codes private static final int REQUEST_VOICE_RECOG = 10; - public static final int REQUEST_CODE_CONTACT = 20; public static final int REQUEST_CODE_RECORD = 30; public static final int REQUEST_CODE_ATTACH_FILE = 40; public static final int REQUEST_CODE_BEAST_MODE = 50; diff --git a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java index 46f14be0c..9078a2c8b 100644 --- a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListActivity.java @@ -513,17 +513,6 @@ public class TaskListActivity extends AstridActivity implements OnPageChangeList } } - public void hideKeyboard() { - TaskListFragment tlf = getTaskListFragment(); - if (tlf == null) - return; - InputMethodManager imm = (InputMethodManager)getSystemService( - Context.INPUT_METHOD_SERVICE); - QuickAddBar qab = tlf.quickAddBar; - if (qab != null) - imm.hideSoftInputFromWindow(qab.getQuickAddBox().getWindowToken(), 0); - } - @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { diff --git a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java index 4d8a21c04..a9bb05206 100644 --- a/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java +++ b/astrid/src/main/java/com/todoroo/astrid/activity/TaskListFragment.java @@ -25,17 +25,16 @@ import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; -import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnKeyListener; -import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; +import com.faizmalkani.floatingactionbutton.FloatingActionButton; import com.todoroo.andlib.data.Property; import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.sql.Criterion; @@ -151,7 +150,7 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel protected Filter filter; protected int sortFlags; protected int sortSort; - protected QuickAddBar quickAddBar; + protected QuickAddBar quickAddBar = new QuickAddBar(); private Timer backgroundTimer; protected Bundle extras; @@ -281,6 +280,14 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel Bundle savedInstanceState) { ViewGroup parent = (ViewGroup) getActivity().getLayoutInflater().inflate( R.layout.task_list_activity, container, false); + FloatingActionButton fab = (FloatingActionButton) parent.findViewById(R.id.fab); + fab.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + Task task = quickAddBar.quickAddTask("", true); + + } + }); View body = getListBody(parent); listView = (SwipeRefreshLayout) body.findViewById(R.id.swipe_layout); emptyView = (SwipeRefreshLayout) body.findViewById(R.id.swipe_layout_empty); @@ -309,7 +316,7 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel syncActionHelper = new SyncActionHelper(gtasksPreferenceService, syncService, getActivity(), preferences); setUpUiComponents(); initializeData(); - setupQuickAddBar(); + quickAddBar.initialize(injector, (TaskListActivity) getActivity(), this); Fragment filterlistFrame = getFragmentManager().findFragmentById( NavigationDrawerFragment.FRAGMENT_NAVIGATION_DRAWER); @@ -453,27 +460,6 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel sortFlags = SortHelper.setManualSort(sortFlags, isDraggable()); } - protected void setupQuickAddBar() { - quickAddBar = (QuickAddBar) getView().findViewById(R.id.taskListFooter); - quickAddBar.initialize(injector, (TaskListActivity) getActivity(), this, mListener); - - // set listener for astrid icon - emptyView.findViewById(R.id.empty_text).setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - quickAddBar.performButtonClick(); - } - }); - - getListView().setOnTouchListener(new OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - quickAddBar.clearFocus(); - return false; - } - }); - } - public void transitionForTaskEdit() { AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out); @@ -645,10 +631,6 @@ public class TaskListFragment extends InjectingListFragment implements OnSortSel @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { - if(quickAddBar.onActivityResult(requestCode, resultCode, data)) { - return; - } - if (requestCode == ACTIVITY_SETTINGS) { if (resultCode == EditPreferences.RESULT_CODE_THEME_CHANGED || resultCode == EditPreferences.RESULT_CODE_PERFORMANCE_PREF_CHANGED) { getActivity().finish(); diff --git a/astrid/src/main/java/com/todoroo/astrid/reminders/NotificationFragment.java b/astrid/src/main/java/com/todoroo/astrid/reminders/NotificationFragment.java index 3d7528695..f268b5c81 100644 --- a/astrid/src/main/java/com/todoroo/astrid/reminders/NotificationFragment.java +++ b/astrid/src/main/java/com/todoroo/astrid/reminders/NotificationFragment.java @@ -45,9 +45,6 @@ public class NotificationFragment extends TaskListFragment { * Set up the UI for this activity */ private void displayNotificationPopup() { - // hide quick add - getView().findViewById(R.id.taskListFooter).setVisibility(View.GONE); - String title = extras.getString(Notifications.EXTRAS_TEXT); long taskId = extras.getLong(TOKEN_ID); new ReminderDialog(preferences, taskService, (AstridActivity) getActivity(), taskId, title).show(); diff --git a/astrid/src/main/java/com/todoroo/astrid/ui/QuickAddBar.java b/astrid/src/main/java/com/todoroo/astrid/ui/QuickAddBar.java index 1e7bf4670..c3220ced7 100644 --- a/astrid/src/main/java/com/todoroo/astrid/ui/QuickAddBar.java +++ b/astrid/src/main/java/com/todoroo/astrid/ui/QuickAddBar.java @@ -5,35 +5,14 @@ */ package com.todoroo.astrid.ui; -import android.content.Context; -import android.content.Intent; -import android.text.Editable; import android.text.TextUtils; -import android.text.TextWatcher; -import android.util.AttributeSet; -import android.view.Gravity; -import android.view.KeyEvent; -import android.view.LayoutInflater; -import android.view.View; -import android.view.inputmethod.EditorInfo; -import android.widget.EditText; -import android.widget.ImageButton; -import android.widget.LinearLayout; -import android.widget.TextView; -import android.widget.TextView.OnEditorActionListener; import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.astrid.activity.AstridActivity; -import com.todoroo.astrid.activity.TaskEditFragment; import com.todoroo.astrid.activity.TaskListActivity; import com.todoroo.astrid.activity.TaskListFragment; -import com.todoroo.astrid.activity.TaskListFragment.OnTaskListItemClickedListener; -import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.data.TagData; import com.todoroo.astrid.data.Task; -import com.todoroo.astrid.gcal.GCalControlSet; -import com.todoroo.astrid.gcal.GCalHelper; -import com.todoroo.astrid.repeats.RepeatControlSet; import com.todoroo.astrid.service.TaskCreator; import com.todoroo.astrid.service.TaskService; @@ -53,150 +32,23 @@ import javax.inject.Inject; * @author Tim Su * */ -public class QuickAddBar extends LinearLayout { +public class QuickAddBar { private static final Logger log = LoggerFactory.getLogger(QuickAddBar.class); - private ImageButton quickAddButton; - private EditText quickAddBox; - private LinearLayout quickAddControls; - private View quickAddControlsContainer; - - private DeadlineControlSet deadlineControl; - private RepeatControlSet repeatControl; - private GCalControlSet gcalControl; - @Inject TaskService taskService; @Inject TaskCreator taskCreator; - @Inject GCalHelper gcalHelper; @Inject ActivityPreferences preferences; @Inject DateChangedAlerts dateChangedAlerts; private TaskListActivity activity; private TaskListFragment fragment; - public QuickAddBar(Context context) { - super(context); - } - - public QuickAddBar(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public QuickAddBar(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - public void initialize(Injector injector, TaskListActivity myActivity, TaskListFragment myFragment, - final OnTaskListItemClickedListener mListener) { - + public void initialize(Injector injector, TaskListActivity myActivity, TaskListFragment myFragment) { injector.inject(this); // TODO: get rid of this - activity = myActivity; fragment = myFragment; - - LayoutInflater.from(activity).inflate(R.layout.quick_add_bar, this); - - quickAddControls = (LinearLayout) findViewById(R.id.taskListQuickaddControls); - quickAddControlsContainer = findViewById(R.id.taskListQuickaddControlsContainer); - - // set listener for pressing enter in quick-add box - quickAddBox = (EditText) findViewById(R.id.quickAddText); - quickAddBox.setOnEditorActionListener(new OnEditorActionListener() { - /** - * When user presses enter, quick-add the task - */ - @Override - public boolean onEditorAction(TextView view, int actionId, - KeyEvent event) { - if (actionId == EditorInfo.IME_NULL - && !TextUtils.isEmpty(quickAddBox.getText().toString().trim())) { - quickAddTask(quickAddBox.getText().toString(), true); - return true; - } - return false; - } - }); - - quickAddBox.addTextChangedListener(new TextWatcher() { - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - final boolean controlsVisible = !TextUtils.isEmpty(s) && quickAddBox.hasFocus(); - final boolean showControls = preferences.getBoolean(R.string.p_show_quickadd_controls, true); - - final boolean plusVisible = !TextUtils.isEmpty(s); - final boolean hidePlus = preferences.getBoolean(R.string.p_hide_plus_button, false); - quickAddControlsContainer.postDelayed(new Runnable() { - @Override - public void run() { - quickAddButton.setVisibility((plusVisible || !hidePlus) ? View.VISIBLE : View.GONE); - quickAddControlsContainer.setVisibility((showControls && controlsVisible) ? View.VISIBLE : View.GONE); - } - }, 10); - } - - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) {/**/} - - @Override - public void afterTextChanged(Editable s) {/**/} - }); - - int fontSize = preferences.getIntegerFromString(R.string.p_fontSize, 18); - quickAddBox.setTextSize(Math.min(fontSize, 22)); - - quickAddButton = ((ImageButton) findViewById( - R.id.quickAddButton)); - quickAddButton.setVisibility(preferences.getBoolean(R.string.p_hide_plus_button, false) ? View.GONE : View.VISIBLE); - - // set listener for quick add button - quickAddButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - Task task = quickAddTask(quickAddBox.getText().toString(), true); - if (task != null && task.getTitle().length() == 0) { - mListener.onTaskListItemClicked(task.getId()); - } - } - }); - - // set listener for extended addbutton - quickAddButton.setOnLongClickListener(new OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - Task task = quickAddTask(quickAddBox.getText().toString(), - false); - if (task == null) { - return true; - } - - mListener.onTaskListItemClicked(task.getId()); - return true; - } - }); - - setUpQuickAddControlSets(); - } - - private void setUpQuickAddControlSets() { - - repeatControl = new RepeatControlSet(preferences, activity); - - gcalControl = new GCalControlSet(preferences, gcalHelper, activity); - - deadlineControl = new DeadlineControlSet(preferences, activity, - R.layout.control_set_default_display, null, - repeatControl.getDisplayView(), gcalControl.getDisplayView()); - deadlineControl.setIsQuickadd(); - resetControlSets(); - - LayoutParams lp = new LinearLayout.LayoutParams( - LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 1.0f); - View deadlineDisplay = deadlineControl.getDisplayView(); - quickAddControls.addView(deadlineDisplay, 0, lp); - TextView tv = (TextView) deadlineDisplay.findViewById(R.id.display_row_edit); - tv.setGravity(Gravity.LEFT); } private void resetControlSets() { @@ -207,10 +59,6 @@ public class QuickAddBar extends LinearLayout { tagsTransitory.add(tagData.getName()); empty.putTransitory(TaskService.TRANS_TAGS, tagsTransitory); } - repeatControl.readFromTask(empty); - gcalControl.readFromTask(empty); - gcalControl.resetCalendarSelector(); - deadlineControl.readFromTask(empty); } // --- quick add task logic @@ -236,25 +84,12 @@ public class QuickAddBar extends LinearLayout { task.setTitle(title); // need this for calendar } - if (repeatControl.isRecurrenceSet()) { - repeatControl.writeToModel(task); - } - if (deadlineControl.isDeadlineSet()) { - task.clearValue(Task.HIDE_UNTIL); - deadlineControl.writeToModel(task); - TaskDao.createDefaultHideUntil(preferences, task); - } - gcalControl.writeToModel(task); - taskService.createWithValues(task, fragment.getFilter().valuesForNewTasks, title); resetControlSets(); taskCreator.addToCalendar(task, title); - TextView quickAdd = (TextView) findViewById(R.id.quickAddText); - quickAdd.setText(""); //$NON-NLS-1$ - if (selectNewTask) { fragment.loadTaskListContent(); fragment.selectCustomId(task.getId()); @@ -263,6 +98,7 @@ public class QuickAddBar extends LinearLayout { } else if (!TextUtils.isEmpty(task.getRecurrence())) { showAlertForRepeatingTask(activity, task); } + activity.onTaskListItemClicked(task.getId()); } fragment.onTaskCreated(task); @@ -281,28 +117,4 @@ public class QuickAddBar extends LinearLayout { private void showAlertForRepeatingTask(AstridActivity activity, Task task) { dateChangedAlerts.showRepeatChangedDialog(activity, task); } - - // --- instance methods - - public EditText getQuickAddBox() { - return quickAddBox; - } - - @Override - public void clearFocus() { - super.clearFocus(); - quickAddBox.clearFocus(); - } - - public void performButtonClick() { - quickAddButton.performClick(); - } - - public boolean onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == TaskEditFragment.REQUEST_CODE_CONTACT) { - return true; - } - - return false; - } } diff --git a/astrid/src/main/java/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java b/astrid/src/main/java/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java index 925b07f33..b99c9ceb7 100644 --- a/astrid/src/main/java/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java +++ b/astrid/src/main/java/com/todoroo/astrid/utility/AstridDefaultPreferenceSpec.java @@ -48,14 +48,10 @@ public class AstridDefaultPreferenceSpec { setPreference(prefs, editor, r, R.string.p_use_dark_theme, false); - setPreference(prefs, editor, r, R.string.p_show_quickadd_controls, true); - setPreference(prefs, editor, r, R.string.p_show_task_edit_comments, true); setPreference(prefs, editor, r, R.string.p_use_date_shortcuts, false); - setPreference(prefs, editor, r, R.string.p_hide_plus_button, true); - setPreference(prefs, editor, r, R.string.p_rmd_quietStart_old, 22); // enable quiet hours by default setIntIfUnset(prefs, editor, r, R.string.p_rmd_quietStart, r.getInteger(R.integer.default_quiet_hours_start)); diff --git a/astrid/src/main/java/com/todoroo/astrid/widget/WidgetUpdateService.java b/astrid/src/main/java/com/todoroo/astrid/widget/WidgetUpdateService.java index 84a83b06b..c26bc531c 100644 --- a/astrid/src/main/java/com/todoroo/astrid/widget/WidgetUpdateService.java +++ b/astrid/src/main/java/com/todoroo/astrid/widget/WidgetUpdateService.java @@ -195,11 +195,11 @@ public class WidgetUpdateService extends InjectingService { if (preferences.isDarkWidgetTheme()) { layout = R.layout.widget_initialized_dark; titleColor = r.getColor(R.color.widget_text_color_dark); - buttonDrawable = R.drawable.ic_action_new_light; + buttonDrawable = R.drawable.ic_action_add_light; } else { layout = R.layout.widget_initialized; titleColor = r.getColor(R.color.widget_text_color_light); - buttonDrawable = R.drawable.ic_action_new; + buttonDrawable = R.drawable.ic_action_add; } views = new RemoteViews(packageName, layout); diff --git a/astrid/src/main/java/org/tasks/ui/NavigationDrawerFragment.java b/astrid/src/main/java/org/tasks/ui/NavigationDrawerFragment.java index a3129de68..d77a42585 100644 --- a/astrid/src/main/java/org/tasks/ui/NavigationDrawerFragment.java +++ b/astrid/src/main/java/org/tasks/ui/NavigationDrawerFragment.java @@ -263,7 +263,6 @@ public class NavigationDrawerFragment extends InjectingFragment { @Override public boolean onOptionsItemSelected(MenuItem item) { if (mDrawerToggle.onOptionsItemSelected(item)) { - ((TaskListActivity) getActivity()).hideKeyboard(); return true; } diff --git a/astrid/src/main/res/drawable-hdpi/ic_action_add.png b/astrid/src/main/res/drawable-hdpi/ic_action_add.png new file mode 100644 index 000000000..e43120b68 Binary files /dev/null and b/astrid/src/main/res/drawable-hdpi/ic_action_add.png differ diff --git a/astrid/src/main/res/drawable-hdpi/ic_action_add_light.png b/astrid/src/main/res/drawable-hdpi/ic_action_add_light.png new file mode 100644 index 000000000..fd4c54c13 Binary files /dev/null and b/astrid/src/main/res/drawable-hdpi/ic_action_add_light.png differ diff --git a/astrid/src/main/res/drawable-hdpi/ic_action_new.png b/astrid/src/main/res/drawable-hdpi/ic_action_new.png deleted file mode 100644 index 3bd2fa00f..000000000 Binary files a/astrid/src/main/res/drawable-hdpi/ic_action_new.png and /dev/null differ diff --git a/astrid/src/main/res/drawable-hdpi/ic_action_new_light.png b/astrid/src/main/res/drawable-hdpi/ic_action_new_light.png deleted file mode 100644 index d866d6160..000000000 Binary files a/astrid/src/main/res/drawable-hdpi/ic_action_new_light.png and /dev/null differ diff --git a/astrid/src/main/res/drawable-xhdpi/ic_action_add.png b/astrid/src/main/res/drawable-xhdpi/ic_action_add.png new file mode 100644 index 000000000..122ad5d9a Binary files /dev/null and b/astrid/src/main/res/drawable-xhdpi/ic_action_add.png differ diff --git a/astrid/src/main/res/drawable-xhdpi/ic_action_add_light.png b/astrid/src/main/res/drawable-xhdpi/ic_action_add_light.png new file mode 100644 index 000000000..b1badb1fe Binary files /dev/null and b/astrid/src/main/res/drawable-xhdpi/ic_action_add_light.png differ diff --git a/astrid/src/main/res/drawable-xhdpi/ic_action_new.png b/astrid/src/main/res/drawable-xhdpi/ic_action_new.png deleted file mode 100644 index 6038beee9..000000000 Binary files a/astrid/src/main/res/drawable-xhdpi/ic_action_new.png and /dev/null differ diff --git a/astrid/src/main/res/drawable-xhdpi/ic_action_new_light.png b/astrid/src/main/res/drawable-xhdpi/ic_action_new_light.png deleted file mode 100644 index dde2141f2..000000000 Binary files a/astrid/src/main/res/drawable-xhdpi/ic_action_new_light.png and /dev/null differ diff --git a/astrid/src/main/res/drawable-xxhdpi/ic_action_add.png b/astrid/src/main/res/drawable-xxhdpi/ic_action_add.png new file mode 100644 index 000000000..5de98fa83 Binary files /dev/null and b/astrid/src/main/res/drawable-xxhdpi/ic_action_add.png differ diff --git a/astrid/src/main/res/drawable-xxhdpi/ic_action_add_light.png b/astrid/src/main/res/drawable-xxhdpi/ic_action_add_light.png new file mode 100644 index 000000000..7b126f7bd Binary files /dev/null and b/astrid/src/main/res/drawable-xxhdpi/ic_action_add_light.png differ diff --git a/astrid/src/main/res/drawable-xxhdpi/ic_action_new.png b/astrid/src/main/res/drawable-xxhdpi/ic_action_new.png deleted file mode 100644 index c0cd3d94d..000000000 Binary files a/astrid/src/main/res/drawable-xxhdpi/ic_action_new.png and /dev/null differ diff --git a/astrid/src/main/res/drawable-xxhdpi/ic_action_new_light.png b/astrid/src/main/res/drawable-xxhdpi/ic_action_new_light.png deleted file mode 100644 index c42c2bfb5..000000000 Binary files a/astrid/src/main/res/drawable-xxhdpi/ic_action_new_light.png and /dev/null differ diff --git a/astrid/src/main/res/drawable/ic_action_add.png b/astrid/src/main/res/drawable/ic_action_add.png new file mode 100644 index 000000000..f7b44eb23 Binary files /dev/null and b/astrid/src/main/res/drawable/ic_action_add.png differ diff --git a/astrid/src/main/res/drawable/ic_action_add_light.png b/astrid/src/main/res/drawable/ic_action_add_light.png new file mode 100644 index 000000000..b10609263 Binary files /dev/null and b/astrid/src/main/res/drawable/ic_action_add_light.png differ diff --git a/astrid/src/main/res/drawable/ic_action_new.png b/astrid/src/main/res/drawable/ic_action_new.png deleted file mode 100644 index ca185e47b..000000000 Binary files a/astrid/src/main/res/drawable/ic_action_new.png and /dev/null differ diff --git a/astrid/src/main/res/drawable/ic_action_new_light.png b/astrid/src/main/res/drawable/ic_action_new_light.png deleted file mode 100644 index f17e7980e..000000000 Binary files a/astrid/src/main/res/drawable/ic_action_new_light.png and /dev/null differ diff --git a/astrid/src/main/res/layout/quick_add_bar.xml b/astrid/src/main/res/layout/quick_add_bar.xml deleted file mode 100644 index dcf84d7a2..000000000 --- a/astrid/src/main/res/layout/quick_add_bar.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/astrid/src/main/res/layout/scrollable_widget_dark.xml b/astrid/src/main/res/layout/scrollable_widget_dark.xml index 6817bc67a..4eda394ff 100644 --- a/astrid/src/main/res/layout/scrollable_widget_dark.xml +++ b/astrid/src/main/res/layout/scrollable_widget_dark.xml @@ -41,7 +41,7 @@ android:layout_height="39dip" android:layout_gravity="right|center_vertical" android:background="@android:color/transparent" - android:src="@drawable/ic_action_new_light" + android:src="@drawable/ic_action_add_light" android:scaleType="fitCenter"/> diff --git a/astrid/src/main/res/layout/scrollable_widget_light.xml b/astrid/src/main/res/layout/scrollable_widget_light.xml index c0c179f81..c996a563d 100644 --- a/astrid/src/main/res/layout/scrollable_widget_light.xml +++ b/astrid/src/main/res/layout/scrollable_widget_light.xml @@ -41,7 +41,7 @@ android:layout_height="39dip" android:layout_gravity="right|center_vertical" android:background="@android:color/transparent" - android:src="@drawable/ic_action_new" + android:src="@drawable/ic_action_add" android:scaleType="fitCenter"/> diff --git a/astrid/src/main/res/layout/task_edit_activity.xml b/astrid/src/main/res/layout/task_edit_activity.xml index 57f73aa25..32117e292 100644 --- a/astrid/src/main/res/layout/task_edit_activity.xml +++ b/astrid/src/main/res/layout/task_edit_activity.xml @@ -151,7 +151,7 @@ android:layout_marginLeft="3dip" android:layout_weight="1" android:background="@android:color/transparent" - android:src="?attr/ic_action_new" + android:src="?attr/ic_action_add" android:scaleType="center" android:visibility="gone" /> diff --git a/astrid/src/main/res/layout/task_list_activity.xml b/astrid/src/main/res/layout/task_list_activity.xml index c56d2d500..3b9b85b48 100644 --- a/astrid/src/main/res/layout/task_list_activity.xml +++ b/astrid/src/main/res/layout/task_list_activity.xml @@ -1,27 +1,30 @@ - - - - + - - - - - + + + + diff --git a/astrid/src/main/res/layout/task_list_body_standard.xml b/astrid/src/main/res/layout/task_list_body_standard.xml index 55954d663..d01dea625 100644 --- a/astrid/src/main/res/layout/task_list_body_standard.xml +++ b/astrid/src/main/res/layout/task_list_body_standard.xml @@ -12,7 +12,9 @@ android:id="@android:id/list" style="@style/ListView" android:layout_width="fill_parent" - android:layout_height="fill_parent" /> + android:layout_height="fill_parent" + android:paddingBottom="104dp" + android:clipToPadding="false"/> diff --git a/astrid/src/main/res/layout/task_list_body_subtasks.xml b/astrid/src/main/res/layout/task_list_body_subtasks.xml index 9e19b7fef..804f6c0c4 100644 --- a/astrid/src/main/res/layout/task_list_body_subtasks.xml +++ b/astrid/src/main/res/layout/task_list_body_subtasks.xml @@ -13,7 +13,9 @@ style="@style/ListView" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:drawSelectorOnTop="false" /> + android:drawSelectorOnTop="false" + android:paddingBottom="104dp" + android:clipToPadding="false" /> diff --git a/astrid/src/main/res/layout/widget_initialized.xml b/astrid/src/main/res/layout/widget_initialized.xml index 7320e2c63..c64f435c9 100644 --- a/astrid/src/main/res/layout/widget_initialized.xml +++ b/astrid/src/main/res/layout/widget_initialized.xml @@ -41,7 +41,7 @@ android:layout_height="39dip" android:layout_gravity="right|center_vertical" android:background="@android:color/transparent" - android:src="@drawable/ic_action_new" + android:src="@drawable/ic_action_add" android:scaleType="fitCenter"/> diff --git a/astrid/src/main/res/layout/widget_initialized_dark.xml b/astrid/src/main/res/layout/widget_initialized_dark.xml index 131ed0d02..7b66362b4 100644 --- a/astrid/src/main/res/layout/widget_initialized_dark.xml +++ b/astrid/src/main/res/layout/widget_initialized_dark.xml @@ -41,7 +41,7 @@ android:layout_height="39dip" android:layout_gravity="right|center_vertical" android:background="@android:color/transparent" - android:src="@drawable/ic_action_new" + android:src="@drawable/ic_action_add" android:scaleType="fitCenter"/> diff --git a/astrid/src/main/res/layout/widget_loading.xml b/astrid/src/main/res/layout/widget_loading.xml index 5c0918ea2..a0acf8389 100644 --- a/astrid/src/main/res/layout/widget_loading.xml +++ b/astrid/src/main/res/layout/widget_loading.xml @@ -39,7 +39,7 @@ android:layout_height="39dip" android:layout_gravity="right|center_vertical" android:background="@android:color/transparent" - android:src="@drawable/ic_action_new" + android:src="@drawable/ic_action_add" android:scaleType="fitCenter"/> diff --git a/astrid/src/main/res/values/attrs.xml b/astrid/src/main/res/values/attrs.xml index 3bed067ee..378b4afed 100644 --- a/astrid/src/main/res/values/attrs.xml +++ b/astrid/src/main/res/values/attrs.xml @@ -21,15 +21,14 @@ - + - @@ -52,4 +51,12 @@ + + + + + + + + diff --git a/astrid/src/main/res/values/keys.xml b/astrid/src/main/res/values/keys.xml index 9f18d7c2c..941f229da 100644 --- a/astrid/src/main/res/values/keys.xml +++ b/astrid/src/main/res/values/keys.xml @@ -60,9 +60,6 @@ p_calendar_reminder - - p_list_view - p_filters_to_show p_show_my_tasks_f @@ -70,9 +67,6 @@ p_show_recently_modified_f p_show_no_list_f - - p_show_quickadd_controls - p_show_task_edit_comments @@ -135,8 +129,6 @@ p_use_date_shortcuts - p_hide_plus_button - p_show_timer_shortcut diff --git a/astrid/src/main/res/values/strings-core.xml b/astrid/src/main/res/values/strings-core.xml index e57d6a8c2..2838fbfd0 100644 --- a/astrid/src/main/res/values/strings-core.xml +++ b/astrid/src/main/res/values/strings-core.xml @@ -66,9 +66,6 @@ Custom - - Add a task - Notifications are muted. You won\'t be able to hear Tasks! @@ -475,12 +472,6 @@ First two lines of task title will be shown - - Advanced quickadd controls - - - Hide plus button - List view diff --git a/astrid/src/main/res/values/styles.xml b/astrid/src/main/res/values/styles.xml index 9d7f6d89d..db790df7e 100644 --- a/astrid/src/main/res/values/styles.xml +++ b/astrid/src/main/res/values/styles.xml @@ -24,16 +24,15 @@ @drawable/task_edit_background @color/blue_theme_color #000000 - ?attr/asAbBackgroundColor @drawable/filter_selected_icon @drawable/task_row_bg_dark + @drawable/ic_action_add_light @drawable/ic_action_new_attachment_light @drawable/ic_action_discard_light @drawable/ic_action_save_light @drawable/ic_action_cancel_light @drawable/ic_action_camera_light @drawable/ic_action_mic_light - @drawable/ic_action_new_light @drawable/ic_action_search_light @drawable/ic_drawer_light @color/blue_theme_color @@ -84,13 +83,13 @@ @drawable/task_row_bg_white @color/dark_blue_theme_color #e9e9e9 + @drawable/ic_action_add @drawable/ic_action_new_attachment @drawable/ic_action_discard @drawable/ic_action_save @drawable/ic_action_cancel @drawable/ic_action_camera @drawable/ic_action_mic - @drawable/ic_action_new @drawable/ic_action_search @drawable/ic_drawer @color/task_edit_selected diff --git a/astrid/src/main/res/xml/preferences.xml b/astrid/src/main/res/xml/preferences.xml index b3c67a2c7..ca7a911c3 100644 --- a/astrid/src/main/res/xml/preferences.xml +++ b/astrid/src/main/res/xml/preferences.xml @@ -66,38 +66,26 @@ - - - - - - - - - - - + + + + + - +