Don't show astrid in reminder dialog when that preference is turned off

pull/14/head
Sam Bosley 13 years ago
parent 19c26c1539
commit 4477ca55ca

@ -6,12 +6,14 @@ import android.app.Dialog;
import android.app.TimePickerDialog.OnTimeSetListener; import android.app.TimePickerDialog.OnTimeSetListener;
import android.content.Intent; import android.content.Intent;
import android.view.View; import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.TimePicker; import android.widget.TimePicker;
import android.widget.Toast; import android.widget.Toast;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.AstridActivity; import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.core.PluginServices;
@ -28,7 +30,7 @@ import com.todoroo.astrid.service.StatisticsService;
public class ReminderDialog extends Dialog { public class ReminderDialog extends Dialog {
public ReminderDialog(final AstridActivity activity, final long taskId, public ReminderDialog(final AstridActivity activity, final long taskId,
final String title) { String title) {
super(activity, R.style.ReminderDialog); super(activity, R.style.ReminderDialog);
final SnoozeCallback dialogSnooze = new SnoozeCallback() { final SnoozeCallback dialogSnooze = new SnoozeCallback() {
@Override @Override
@ -52,7 +54,17 @@ public class ReminderDialog extends Dialog {
dialogSnooze.snoozeForTime(alarmTime.getTime()); dialogSnooze.snoozeForTime(alarmTime.getTime());
} }
}; };
if (Preferences.getBoolean(R.string.p_rmd_nagging, true)) {
setContentView(R.layout.astrid_reminder_view); setContentView(R.layout.astrid_reminder_view);
((TextView) findViewById(R.id.reminder_message)).setText(
Notifications.getRandomReminder(activity.getResources().getStringArray(R.array.reminder_responses)));
} else {
setContentView(R.layout.astrid_reminder_view_portrait);
title = activity.getString(R.string.rmd_NoA_dlg_title) + " " + title; //$NON-NLS-1$
removeSpeechBubble();
}
// set up listeners // set up listeners
findViewById(R.id.dismiss).setOnClickListener(new View.OnClickListener() { findViewById(R.id.dismiss).setOnClickListener(new View.OnClickListener() {
@ -92,10 +104,13 @@ public class ReminderDialog extends Dialog {
}); });
((TextView) findViewById(R.id.reminder_title)).setText(title); ((TextView) findViewById(R.id.reminder_title)).setText(title);
((TextView) findViewById(R.id.reminder_message)).setText(
Notifications.getRandomReminder(activity.getResources().getStringArray(R.array.reminder_responses)));
setOwnerActivity(activity); setOwnerActivity(activity);
} }
private void removeSpeechBubble() {
LinearLayout container = (LinearLayout) findViewById(R.id.speech_bubble_container);
container.setVisibility(View.GONE);
}
} }

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/reminder_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="5dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="20dip"
android:layout_marginLeft="5dip">
<TextView
android:id="@+id/reminder_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="@android:color/white"
android:layout_weight="1"/>
<ImageView
android:id="@+id/dismiss"
android:layout_width="25dip"
android:layout_height="25dip"
android:scaleType="fitCenter"
android:src="@android:drawable/ic_menu_close_clear_cancel"/>
</LinearLayout>
<include layout="@layout/astrid_speech_bubble"/>
<CheckBox
android:id="@+id/reminders_should_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginBottom="10dip"
android:text="@string/TLA_quickadd_confirm_hide_helpers"
android:visibility="gone"/>
<Button
android:id="@+id/reminder_edit"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="10dip"
android:textColor="@android:color/white"
android:textSize="20sp"
android:text="@string/TAd_actionEditTask"
android:background="#707070"/>
<Button
android:id="@+id/reminder_snooze"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="10dip"
android:textColor="@android:color/white"
android:textSize="20sp"
android:text="@string/rmd_NoA_snooze"
android:background="#707070"/>
<Button
android:id="@+id/reminder_complete"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="10dip"
android:textColor="@android:color/white"
android:textSize="20sp"
android:text="@string/rmd_NoA_done"
android:background="?attr/asThemeTextColor"/>
</LinearLayout>

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<merge> <merge>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/speech_bubble_container"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"

@ -57,6 +57,9 @@
<!-- Reminder: Completed Toast --> <!-- Reminder: Completed Toast -->
<string name="rmd_NoA_completed_toast">Congratulations on finishing!</string> <string name="rmd_NoA_completed_toast">Congratulations on finishing!</string>
<!-- Prefix for reminder dialog title -->
<string name="rmd_NoA_dlg_title">Reminder:</string>
<!-- ============================================= reminder preferences == --> <!-- ============================================= reminder preferences == -->
<!-- Reminder Preference Screen Title --> <!-- Reminder Preference Screen Title -->

Loading…
Cancel
Save