Tweak task edit UI

* fix action mode overlay
* fix issue with selecting title text
* action_done on comment field
* hide keyboard on option item selected
* remove spell checking on title and comment field
pull/253/head 4.7.1
Alex Baker 10 years ago
parent b45aafce1d
commit e82de847fd

@ -5,8 +5,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.tasks"
android:versionName="4.7.0"
android:versionCode="336">
android:versionName="4.7.1"
android:versionCode="337">
<!-- widgets, alarms, and services will break if Astrid is installed on SD card -->
<!-- android:installLocation="internalOnly"> -->

@ -188,6 +188,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@InjectView(R.id.timer_container) LinearLayout timerShortcut;
@InjectView(R.id.basic_controls) LinearLayout basicControls;
@InjectView(R.id.edit_scroll) ScrollView scrollView;
@InjectView(R.id.commentField) EditText commentField;
private final List<TaskEditControlSet> controls = Collections.synchronizedList(new ArrayList<TaskEditControlSet>());
@ -874,6 +875,8 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
hideKeyboard();
switch (item.getItemId()) {
case R.id.menu_save:
saveButtonClick();
@ -896,7 +899,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
} else {
saveButtonClick();
}
hideKeyboard();
return true;
}
@ -1054,8 +1056,8 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
}
private void hideKeyboard() {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(title.getWindowToken(), 0);
AndroidUtilities.hideSoftInputForViews(getActivity(), title, commentField);
title.setCursorVisible(false);
commentField.setCursorVisible(false);
}
}

@ -89,7 +89,6 @@ public class TaskListActivity extends AstridActivity implements OnPageChangeList
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationDrawer.setUp(drawerLayout);
// drawerLayout.setStatusBarBackgroundColor(getResources().getColor(android.R.color.holo_blue_bright));
initializeFragments();

@ -32,6 +32,7 @@ import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import com.todoroo.andlib.data.Callback;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.actfm.ActFmCameraModule;
import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback;
@ -170,14 +171,31 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
if (hasFocus) {
timerView.setVisibility(View.GONE);
commentButton.setVisibility(View.VISIBLE);
}
else {
} else {
timerView.setVisibility(View.VISIBLE);
commentButton.setVisibility(View.GONE);
}
}
});
}
commentField.setHorizontallyScrolling(false);
commentField.setMaxLines(Integer.MAX_VALUE);
commentField.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ENTER) {
AndroidUtilities.hideSoftInputForViews(activity, commentField);
return true;
}
return false;
}
});
commentField.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
commentField.setCursorVisible(true);
}
});
commentField.addTextChangedListener(new TextWatcher() {
@Override
@ -204,13 +222,16 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
commentField.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_NULL && commentField.getText().length() > 0) {
addComment();
return true;
if (commentField.getText().length() > 0) {
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_NULL) {
// commentField.setCursorVisible(false);
addComment();
}
}
return false;
}
});
commentButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -362,6 +383,8 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
private void addComment() {
addComment(commentField.getText().toString(), UserActivity.ACTION_TASK_COMMENT, task.getUuid(), true);
AndroidUtilities.hideSoftInputForViews(getContext(), commentField);
commentField.setCursorVisible(false);
}
private void addComment(String message, String actionCode, String uuid, boolean usePicture) {

@ -35,7 +35,7 @@
android:capitalize="sentences"
android:freezesText="true"
android:hint="@string/TEA_title_hint"
android:inputType="textCapSentences"
android:inputType="textCapSentences|textNoSuggestions"
android:scrollbars="vertical"
android:imeOptions="flagNoExtractUi|actionDone"
android:text=""

@ -91,10 +91,11 @@
android:layout_marginBottom="2dip"
android:layout_marginTop="2dip"
android:layout_weight="100"
android:inputType="textCapSentences|textNoSuggestions"
android:autoText="true"
android:background="?attr/asEditTextBackground"
android:capitalize="sentences"
android:imeOptions="flagNoExtractUi"
android:imeOptions="flagNoExtractUi|actionDone"
android:hint="@string/TVA_add_comment"
android:textColor="@color/white_text"
android:textColorHint="@color/white_text_hint"

@ -5,6 +5,9 @@
** See the file "LICENSE" for the full license governing this code.
-->
<resources>
<color name="primary">#607d8b</color>
<color name="primary_dark">#4d646f</color>
<color name="task_list_overdue">#FFFB6666</color>
<color name="task_list_done">#ff777777</color>
<color name="task_edit_deadline_gray">#888888</color>

@ -9,8 +9,8 @@
</style>
<style name="Tasks" parent="AppTheme">
<item name="colorPrimary">#607d8b</item>
<item name="colorPrimaryDark">#4d646f</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<!--<item name="colorAccent">@android:color/holo_purple</item>-->
<item name="android:windowBackground">@null</item>
@ -19,6 +19,8 @@
<item name="asSeparatorBackground">#888888</item>
<item name="asEditTextBackground">@null</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:actionModeBackground">@color/primary</item>
<!--<item name="android:statusBarColor">@android:color/transparent</item>-->
<item name="asContentBackground">@android:color/white</item>
<item name="asEditBackground">@android:color/white</item>

Loading…
Cancel
Save