Hide the timer shortcut button by default

pull/14/head
Sam Bosley 12 years ago
parent 52d6adf56a
commit e81a5ad734

@ -49,6 +49,7 @@ import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmCameraModule; import com.todoroo.astrid.actfm.ActFmCameraModule;
import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback; import com.todoroo.astrid.actfm.ActFmCameraModule.CameraResultCallback;
import com.todoroo.astrid.actfm.ActFmCameraModule.ClearImageCallback; import com.todoroo.astrid.actfm.ActFmCameraModule.ClearImageCallback;
@ -214,6 +215,48 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
timerView = commentsBar.findViewById(R.id.timer_container); timerView = commentsBar.findViewById(R.id.timer_container);
commentButton = commentsBar.findViewById(R.id.commentButton); commentButton = commentsBar.findViewById(R.id.commentButton);
commentField = (EditText) commentsBar.findViewById(R.id.commentField); commentField = (EditText) commentsBar.findViewById(R.id.commentField);
boolean showTimerShortcut = Preferences.getBoolean(R.string.p_show_timer_shortcut, false);
if (showTimerShortcut) {
commentField.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
commentButton.setVisibility((s.length() > 0 || pendingCommentPicture != null) ? View.VISIBLE
: View.GONE);
timerView.setVisibility((s.length() > 0 || pendingCommentPicture != null) ? View.GONE
: View.VISIBLE);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
//
}
});
commentField.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
timerView.setVisibility(View.GONE);
commentButton.setVisibility(View.VISIBLE);
}
else {
timerView.setVisibility(View.VISIBLE);
commentButton.setVisibility(View.GONE);
}
}
});
} else {
timerView.setVisibility(View.GONE);
commentButton.setVisibility(View.VISIBLE);
}
commentField.setOnEditorActionListener(new OnEditorActionListener() { commentField.setOnEditorActionListener(new OnEditorActionListener() {
@Override @Override
public boolean onEditorAction(TextView view, int actionId, KeyEvent event) { public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
@ -224,39 +267,6 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
return false; return false;
} }
}); });
commentField.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
commentButton.setVisibility((s.length() > 0 || pendingCommentPicture != null) ? View.VISIBLE
: View.GONE);
timerView.setVisibility((s.length() > 0 || pendingCommentPicture != null) ? View.GONE
: View.VISIBLE);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
//
}
});
commentField.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
timerView.setVisibility(View.GONE);
commentButton.setVisibility(View.VISIBLE);
}
else {
timerView.setVisibility(View.VISIBLE);
commentButton.setVisibility(View.GONE);
}
}
});
commentButton.setOnClickListener(new OnClickListener() { commentButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

@ -283,6 +283,8 @@
<string name="p_hide_plus_button">p_hide_plus_button</string> <string name="p_hide_plus_button">p_hide_plus_button</string>
<string name="p_show_timer_shortcut">p_show_timer_shortcut</string>
<!-- Configurations --> <!-- Configurations -->
<string name="p_configurations">p_configurations</string> <string name="p_configurations">p_configurations</string>
<string name="p_config_default">p_config_default</string> <string name="p_config_default">p_config_default</string>

@ -687,6 +687,8 @@
<string name="EPr_use_date_shortcuts">Use date shortcuts</string> <string name="EPr_use_date_shortcuts">Use date shortcuts</string>
<string name="EPr_show_timer_shortcut">Show timer shortcut</string>
<!-- slide 35h --> <!-- slide 35h -->
<string name="EPr_beastMode_desc">Customize the layout of the task edit screen</string> <string name="EPr_beastMode_desc">Customize the layout of the task edit screen</string>
<!-- slide 35j --> <!-- slide 35j -->

@ -91,6 +91,11 @@
android:key="@string/p_time_increment" android:key="@string/p_time_increment"
android:title="@string/EPr_time_increment" android:title="@string/EPr_time_increment"
android:defaultValue="true"/> android:defaultValue="true"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_show_timer_shortcut"
android:title="@string/EPr_show_timer_shortcut"
android:defaultValue="false"/>
</PreferenceScreen> </PreferenceScreen>

Loading…
Cancel
Save