Bug fixes

* LED color picker icons
* Dialog accent
* File picker rotation issues
* Calendar picker rotation and theme issues
* Set title to "" instead of null
pull/437/head
Alex Baker 8 years ago
parent 71c00e804e
commit c22ac41417

@ -8,6 +8,8 @@ import org.tasks.calendars.AndroidCalendar;
import org.tasks.injection.ActivityComponent; import org.tasks.injection.ActivityComponent;
import org.tasks.injection.InjectingAppCompatActivity; import org.tasks.injection.InjectingAppCompatActivity;
import static org.tasks.activities.CalendarSelectionDialog.newCalendarSelectionDialog;
public class CalendarSelectionActivity extends InjectingAppCompatActivity implements CalendarSelectionDialog.CalendarSelectionHandler { public class CalendarSelectionActivity extends InjectingAppCompatActivity implements CalendarSelectionDialog.CalendarSelectionHandler {
private static final String FRAG_TAG_CALENDAR_PREFERENCE_SELECTION = "frag_tag_calendar_preference_selection"; private static final String FRAG_TAG_CALENDAR_PREFERENCE_SELECTION = "frag_tag_calendar_preference_selection";
@ -22,10 +24,7 @@ public class CalendarSelectionActivity extends InjectingAppCompatActivity implem
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentManager fragmentManager = getSupportFragmentManager();
CalendarSelectionDialog fragmentByTag = (CalendarSelectionDialog) fragmentManager.findFragmentByTag(FRAG_TAG_CALENDAR_PREFERENCE_SELECTION); CalendarSelectionDialog fragmentByTag = (CalendarSelectionDialog) fragmentManager.findFragmentByTag(FRAG_TAG_CALENDAR_PREFERENCE_SELECTION);
if (fragmentByTag == null) { if (fragmentByTag == null) {
fragmentByTag = new CalendarSelectionDialog(); fragmentByTag = newCalendarSelectionDialog(getIntent().getBooleanExtra(EXTRA_SHOW_NONE, false));
if (getIntent().getBooleanExtra(EXTRA_SHOW_NONE, false)) {
fragmentByTag.enableNone();
}
fragmentByTag.show(fragmentManager, FRAG_TAG_CALENDAR_PREFERENCE_SELECTION); fragmentByTag.show(fragmentManager, FRAG_TAG_CALENDAR_PREFERENCE_SELECTION);
} }
fragmentByTag.setCalendarSelectionHandler(this); fragmentByTag.setCalendarSelectionHandler(this);

@ -21,6 +21,7 @@ import org.tasks.injection.InjectingDialogFragment;
import org.tasks.preferences.FragmentPermissionRequestor; import org.tasks.preferences.FragmentPermissionRequestor;
import org.tasks.preferences.PermissionChecker; import org.tasks.preferences.PermissionChecker;
import org.tasks.preferences.PermissionRequestor; import org.tasks.preferences.PermissionRequestor;
import org.tasks.themes.Theme;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -32,17 +33,26 @@ import static org.tasks.PermissionUtil.verifyPermissions;
public class CalendarSelectionDialog extends InjectingDialogFragment { public class CalendarSelectionDialog extends InjectingDialogFragment {
public static CalendarSelectionDialog newCalendarSelectionDialog(boolean enableNone) {
CalendarSelectionDialog dialog = new CalendarSelectionDialog();
dialog.enableNone = enableNone;
return dialog;
}
public interface CalendarSelectionHandler { public interface CalendarSelectionHandler {
void selectedCalendar(AndroidCalendar calendar); void selectedCalendar(AndroidCalendar calendar);
void cancel(); void cancel();
} }
private static final String EXTRA_NONE_ENABLED = "extra_none_enabled";
@Inject DialogBuilder dialogBuilder; @Inject DialogBuilder dialogBuilder;
@Inject CalendarProvider calendarProvider; @Inject CalendarProvider calendarProvider;
@Inject @ForActivity Context context; @Inject @ForActivity Context context;
@Inject FragmentPermissionRequestor fragmentPermissionRequestor; @Inject FragmentPermissionRequestor fragmentPermissionRequestor;
@Inject PermissionChecker permissionChecker; @Inject PermissionChecker permissionChecker;
@Inject Theme theme;
private CalendarSelectionHandler handler; private CalendarSelectionHandler handler;
private boolean enableNone; private boolean enableNone;
private ArrayAdapter<String> adapter; private ArrayAdapter<String> adapter;
@ -54,9 +64,12 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
if (savedInstanceState == null) { if (savedInstanceState == null) {
fragmentPermissionRequestor.requestCalendarPermissions(); fragmentPermissionRequestor.requestCalendarPermissions();
} else {
enableNone = savedInstanceState.getBoolean(EXTRA_NONE_ENABLED);
} }
adapter = new ArrayAdapter<>(context, R.layout.simple_list_item_single_choice_themed, calendarNames); theme.applyToContext(getActivity());
adapter = new ArrayAdapter<>(getActivity(), R.layout.simple_list_item_single_choice_themed, calendarNames);
AlertDialogBuilder builder = dialogBuilder.newDialog() AlertDialogBuilder builder = dialogBuilder.newDialog()
.setAdapter(adapter, new DialogInterface.OnClickListener() { .setAdapter(adapter, new DialogInterface.OnClickListener() {
@ -98,7 +111,7 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
} }
})); }));
if (calendarNames.isEmpty()) { if (calendarNames.isEmpty()) {
Toast.makeText(context, R.string.no_calendars_found, Toast.LENGTH_LONG).show(); Toast.makeText(getActivity(), R.string.no_calendars_found, Toast.LENGTH_LONG).show();
handler.cancel(); handler.cancel();
} else { } else {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
@ -106,6 +119,13 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
} }
} }
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(EXTRA_NONE_ENABLED, enableNone);
}
@Override @Override
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
super.onCancel(dialog); super.onCancel(dialog);
@ -129,10 +149,6 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
component.inject(this); component.inject(this);
} }
public void enableNone() {
enableNone = true;
}
public void setCalendarSelectionHandler(CalendarSelectionHandler handler) { public void setCalendarSelectionHandler(CalendarSelectionHandler handler) {
this.handler = handler; this.handler = handler;
} }

@ -73,7 +73,7 @@ public class ColorPickerDialog extends InjectingDialogFragment {
TextView textView = (TextView) (convertView == null TextView textView = (TextView) (convertView == null
? inflater.inflate(R.layout.color_selection_row, parent, false) ? inflater.inflate(R.layout.color_selection_row, parent, false)
: convertView); : convertView);
Drawable original = context.getResources().getDrawable(preferences.hasPurchase(R.string.p_purchased_themes) || position < 2 Drawable original = context.getResources().getDrawable(preferences.hasPurchase(R.string.p_purchased_themes) || position < getNumFree()
? R.drawable.ic_lens_black_24dp ? R.drawable.ic_lens_black_24dp
: R.drawable.ic_vpn_key_black_24dp); : R.drawable.ic_vpn_key_black_24dp);
Drawable wrapped = DrawableCompat.wrap(original.mutate()); Drawable wrapped = DrawableCompat.wrap(original.mutate());

@ -39,7 +39,7 @@ public class NativeDatePickerDialog extends InjectingNativeDialogFragment implem
if (initial != null) { if (initial != null) {
datePickerDialog.updateDate(initial.getYear(), initial.getMonthOfYear() - 1, initial.getDayOfMonth()); datePickerDialog.updateDate(initial.getYear(), initial.getMonthOfYear() - 1, initial.getDayOfMonth());
} }
datePickerDialog.setTitle(null); datePickerDialog.setTitle("");
return datePickerDialog; return datePickerDialog;
} }

@ -49,7 +49,7 @@ public class NativeTimePickerDialog extends InjectingNativeDialogFragment implem
if (initial != null) { if (initial != null) {
timePickerDialog.updateTime(initial.getHourOfDay(), initial.getMinuteOfHour()); timePickerDialog.updateTime(initial.getHourOfDay(), initial.getMinuteOfHour());
} }
timePickerDialog.setTitle(null); timePickerDialog.setTitle("");
return timePickerDialog; return timePickerDialog;
} }

@ -37,12 +37,14 @@ public class FileExplore extends InjectingAppCompatActivity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Intent intent = getIntent(); if (savedInstanceState == null) {
directoryMode = intent.getBooleanExtra(EXTRA_DIRECTORY_MODE, false); Intent intent = getIntent();
startPath = intent.getStringExtra(EXTRA_START_PATH); directoryMode = intent.getBooleanExtra(EXTRA_DIRECTORY_MODE, false);
startPath = intent.getStringExtra(EXTRA_START_PATH);
if (permissionRequestor.requestFileWritePermission()) { if (permissionRequestor.requestFileWritePermission()) {
launchPicker(); launchPicker();
}
} }
} }
@ -76,10 +78,12 @@ public class FileExplore extends InjectingAppCompatActivity {
@Override @Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_FILE_WRITE) { if (requestCode == PermissionRequestor.REQUEST_FILE_WRITE) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults.length > 0) {
launchPicker(); if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
} else { launchPicker();
finish(); } else {
finish();
}
} }
} else { } else {
super.onRequestPermissionsResult(requestCode, permissions, grantResults); super.onRequestPermissionsResult(requestCode, permissions, grantResults);

@ -21,7 +21,7 @@ public abstract class InjectingAppCompatActivity extends AppCompatActivity imple
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
activityComponent = ((InjectingApplication) getApplication()).getComponent().plus(new ActivityModule(this)); activityComponent = ((InjectingApplication) getApplication()).getComponent().plus(new ActivityModule(this));
inject(activityComponent); inject(activityComponent);
setTitle(null); setTitle("");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }

@ -16,7 +16,7 @@
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1" android:id="@android:id/text1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight" android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingEnd="@dimen/keyline_first" android:paddingEnd="@dimen/keyline_first"
android:paddingLeft="@dimen/keyline_first" android:paddingLeft="@dimen/keyline_first"

@ -26,7 +26,6 @@
<style name="TasksDialogAlert" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert"> <style name="TasksDialogAlert" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
<item name="android:windowBackground">@color/background_color_dialog</item> <item name="android:windowBackground">@color/background_color_dialog</item>
<item name="colorAccent">?attr/colorAccentDialog</item> <item name="colorAccent">?attr/colorAccentDialog</item>
<item name="colorAccentDialog">@color/blue_grey_400</item>
<item name="asTextColor">@color/text_primary</item> <item name="asTextColor">@color/text_primary</item>
<item name="icon_tint">@color/icon_tint</item> <item name="icon_tint">@color/icon_tint</item>
</style> </style>
@ -34,7 +33,6 @@
<style name="TasksDialog" parent="@style/Theme.AppCompat.DayNight.Dialog"> <style name="TasksDialog" parent="@style/Theme.AppCompat.DayNight.Dialog">
<item name="android:windowBackground">@color/background_color_dialog</item> <item name="android:windowBackground">@color/background_color_dialog</item>
<item name="colorAccent">?attr/colorAccentDialog</item> <item name="colorAccent">?attr/colorAccentDialog</item>
<item name="colorAccentDialog">@color/blue_grey_400</item>
<item name="asTextColor">@color/text_primary</item> <item name="asTextColor">@color/text_primary</item>
<item name="icon_tint">@color/icon_tint</item> <item name="icon_tint">@color/icon_tint</item>
</style> </style>

Loading…
Cancel
Save