Move add to calendar to task edit screen

pull/253/head
Alex Baker 11 years ago
parent 7c86c75307
commit 12aa141b84

@ -359,10 +359,10 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
controlSetMap.put(getString(R.string.TEA_ctrl_lists_pref), tagsControlSet);
RepeatControlSet repeatControls = new RepeatControlSet(preferences, getActivity());
controlSetMap.put(getString(R.string.TEA_ctrl_repeat_pref), repeatControls);
GCalControlSet gcalControl = new GCalControlSet(preferences, gcalHelper, getActivity());
controlSetMap.put(getString(R.string.TEA_ctrl_repeat_pref), repeatControls);
controlSetMap.put(getString(R.string.TEA_ctrl_gcal), gcalControl);
// The deadline control set contains the repeat controls and the
// calendar controls.
@ -370,10 +370,10 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
// deadline control, because
// otherwise the correct date may not be written to the calendar event.
// Order matters!
DeadlineControlSet deadlineControl = new DeadlineControlSet(
preferences, getActivity(), R.layout.control_set_deadline, gcalControl.getDisplayView());
DeadlineControlSet deadlineControl = new DeadlineControlSet(preferences, getActivity(), R.layout.control_set_deadline);
controlSetMap.put(getString(R.string.TEA_ctrl_when_pref), deadlineControl);
controls.add(repeatControls);
repeatControls.addListener(editTitle);
controls.add(deadlineControl);
controls.add(gcalControl);

@ -17,7 +17,6 @@ import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
@ -34,8 +33,6 @@ import org.tasks.preferences.ActivityPreferences;
import java.util.ArrayList;
import java.util.Collections;
import static org.tasks.preferences.ResourceResolver.getResource;
/**
* Control Set for managing repeats
*
@ -56,14 +53,12 @@ public class GCalControlSet extends PopupControlSet {
private final GCalHelper.CalendarResult calendars;
private boolean hasEvent = false;
private Spinner calendarSelector;
private final ImageView image;
public GCalControlSet(ActivityPreferences preferences, GCalHelper gcal, final Activity activity) {
super(preferences, activity, R.layout.control_set_gcal, R.layout.control_set_gcal_display, title);
this.gcal = gcal;
this.calendars = gcal.getCalendars();
getView(); // Hack to force initialized
image = (ImageView) getDisplayView().findViewById(R.id.display_row_icon);
}
@Override
@ -226,7 +221,6 @@ public class GCalControlSet extends PopupControlSet {
protected void refreshDisplayView() {
TextView calendar = (TextView) getDisplayView().findViewById(R.id.calendar_display_which);
calendar.setTextColor(themeColor);
image.setImageResource(getResource(activity, R.attr.tea_icn_addcal));
if (initialized) {
if (hasEvent) {
calendar.setText(R.string.gcal_TEA_has_event);
@ -234,7 +228,6 @@ public class GCalControlSet extends PopupControlSet {
calendar.setText((String)calendarSelector.getSelectedItem());
} else {
calendar.setTextColor(unsetColor);
image.setImageResource(R.drawable.tea_icn_addcal_gray);
calendar.setText(R.string.gcal_TEA_none_selected);
}
} else {
@ -245,7 +238,6 @@ public class GCalControlSet extends PopupControlSet {
calendar.setText(calendars.calendars[index]);
} else {
calendar.setTextColor(unsetColor);
image.setImageResource(R.drawable.tea_icn_addcal_gray);
calendar.setText(R.string.gcal_TEA_none_selected);
}
}

@ -27,12 +27,9 @@ import org.tasks.preferences.ActivityPreferences;
public class DeadlineControlSet extends PopupControlSet {
private DateAndTimePicker dateAndTimePicker;
private final View extraView;
public DeadlineControlSet(ActivityPreferences preferences, Activity activity, int displayViewLayout,
View extraViews) {
public DeadlineControlSet(ActivityPreferences preferences, Activity activity, int displayViewLayout) {
super(preferences, activity, R.layout.control_set_deadline_dialog, displayViewLayout, 0);
this.extraView = extraViews;
}
@Override
@ -64,12 +61,6 @@ public class DeadlineControlSet extends PopupControlSet {
@Override
protected void afterInflate() {
dateAndTimePicker = (DateAndTimePicker) getView().findViewById(R.id.date_and_time);
LinearLayout extras = (LinearLayout) getView().findViewById(R.id.datetime_extras);
if (extraView != null) {
LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1.0f);
extras.addView(extraView, lp);
}
LinearLayout body = (LinearLayout) getView().findViewById(R.id.datetime_body);
body.setGravity(Gravity.CENTER_HORIZONTAL);
Button okButton = (Button) LayoutInflater.from(activity).inflate(R.layout.control_dialog_ok, null);

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -19,7 +19,6 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/datetime_extras"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"/>

@ -1,41 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/gcal_body"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:paddingLeft="5dip"
android:gravity="center_vertical">
<ImageView android:id="@+id/display_row_icon"
android:layout_marginRight="10dip"
android:layout_width="20dip"
android:layout_height="20dip"
android:scaleType="fitCenter"/>
<TextView
android:id="@+id/calendar_display_which"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:maxLines="1"
android:ellipsize="end"
android:textColor="?attr/asThemeTextColor" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1px"
android:padding="5dip"
android:background="?android:attr/listDivider" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:src="?attr/ic_action_calendar_month"
android:contentDescription="@string/gcal_TEA_addToCalendar_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:padding="@dimen/task_edit_drawable_padding"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/calendar_display_which"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="start"
android:textColor="?attr/asThemeTextColor"
android:textSize="@dimen/task_edit_text_size"
android:paddingTop="@dimen/task_edit_padding_top_bottom"
android:paddingBottom="@dimen/task_edit_padding_top_bottom"
android:layout_marginTop="@dimen/task_edit_padding_top_bottom"
android:layout_marginBottom="@dimen/task_edit_padding_top_bottom"
android:paddingRight="@dimen/task_edit_padding_right"
android:paddingEnd="@dimen/task_edit_padding_right"/>
<include layout="@layout/task_edit_divider"/>
</LinearLayout>
</LinearLayout>

@ -57,11 +57,6 @@
android:layout_height="1px"
android:layout_marginTop="1dip"
android:background="?android:attr/listDivider" />
<LinearLayout
android:id="@+id/datetime_extras"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"/>
</LinearLayout>
</ScrollView>
</merge>

@ -47,9 +47,9 @@
<attr name="ic_action_bell" format="reference" />
<attr name="ic_action_alarm" format="reference" />
<attr name="ic_action_reload" format="reference" />
<attr name="ic_action_calendar_month" format="reference"/>
<attr name="drawer_text" format="color"/>
<attr name="importance_background_selected" format="reference"/>
<attr name="tea_icn_addcal" format="reference"/>
<attr name="asFilterRowSelected" format="reference"/>
<declare-styleable name="DateAndTimePicker">

@ -227,15 +227,17 @@
<string name="gcal_p_default">default_calendar_id</string>
<string-array name="TEA_control_sets_beast">
<item >@string/TEA_control_when</item>
<item >@string/TEA_control_importance</item>
<item >@string/TEA_control_lists</item>
<item >@string/TEA_control_notes</item>
<item >@string/TEA_control_files</item>
<item>@string/TEA_control_when</item>
<item>@string/TEA_control_repeat</item>
<item>@string/TEA_control_importance</item>
<item>@string/TEA_control_lists</item>
<item>@string/TEA_control_notes</item>
<item>@string/TEA_control_files</item>
<item>@string/TEA_hideUntil_label</item>
<item >@string/TEA_control_reminders</item>
<item >@string/TEA_control_timer</item>
<item >@string/TEA_control_hidden_section</item>
<item>@string/TEA_control_reminders</item>
<item>@string/TEA_control_timer</item>
<item>@string/TEA_control_gcal</item>
<item>@string/TEA_control_hidden_section</item>
</string-array>
<string name="p_use_dark_theme">use_dark_theme</string>
@ -255,16 +257,18 @@
<string name="TEA_ctrl_reminders_pref">TEA_ctrl_reminders_pref</string>
<string name="TEA_ctrl_timer_pref">TEA_ctrl_timer_pref</string>
<string name="TEA_ctrl_share_pref">TEA_ctrl_share_pref</string>
<string name="TEA_ctrl_gcal">TEA_ctrl_gcal</string>
<string-array name="TEA_control_sets_prefs">
<item>@string/TEA_ctrl_when_pref</item>
<item>@string/TEA_ctrl_repeat_pref</item>
<item>@string/TEA_ctrl_importance_pref</item>
<item>@string/TEA_ctrl_lists_pref</item>
<item>@string/TEA_ctrl_notes_pref</item>
<item>@string/TEA_ctrl_files_pref</item>
<item>@string/TEA_ctrl_hide_until_pref</item>
<item>@string/TEA_ctrl_reminders_pref</item>
<item>@string/TEA_ctrl_notes_pref</item>
<item>@string/TEA_ctrl_hide_until_pref</item>
<item>@string/TEA_ctrl_gcal</item>
<item>@string/TEA_ctrl_timer_pref</item>
<item>@string/TEA_ctrl_hide_section_pref</item>
</string-array>

@ -259,6 +259,8 @@
<!-- slide 9c/ 35a -->
<string name="TEA_control_when">When</string>
<string name="TEA_control_repeat">Repeat</string>
<string name="TEA_control_gcal">Calendar</string>
<!-- slide 16a/35c -->
<string name="TEA_control_importance">Priority</string>
<!-- slide 16b/35d -->

@ -24,7 +24,6 @@
<item name="ic_action_mic">@drawable/ic_action_mic</item>
<item name="ic_action_search">@drawable/ic_action_search</item>
<item name="ic_action_settings">@drawable/ic_action_gear</item>
<item name="tea_icn_addcal">@drawable/tea_icn_addcal</item>
<!-- actionbar-styling -->
<item name="homeAsUpIndicator">@drawable/ic_up</item>
@ -66,6 +65,7 @@
<item name="ic_action_bell">@drawable/ic_action_bell</item>
<item name="ic_action_alarm">@drawable/ic_action_alarm</item>
<item name="ic_action_reload">@drawable/ic_action_reload</item>
<item name="ic_action_calendar_month">@drawable/ic_action_calendar_month</item>
</style>
<style name="Tasks.Dark">
@ -95,6 +95,7 @@
<item name="ic_action_bell">@drawable/ic_action_bell_white</item>
<item name="ic_action_alarm">@drawable/ic_action_alarm_white</item>
<item name="ic_action_reload">@drawable/ic_action_reload_white</item>
<item name="ic_action_calendar_month">@drawable/ic_action_calendar_month_white</item>
<item name="asDueDateColor">#c3c3c3</item>
</style>

Loading…
Cancel
Save