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.InjectingAppCompatActivity;
import static org.tasks.activities.CalendarSelectionDialog.newCalendarSelectionDialog;
public class CalendarSelectionActivity extends InjectingAppCompatActivity implements CalendarSelectionDialog.CalendarSelectionHandler {
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();
CalendarSelectionDialog fragmentByTag = (CalendarSelectionDialog) fragmentManager.findFragmentByTag(FRAG_TAG_CALENDAR_PREFERENCE_SELECTION);
if (fragmentByTag == null) {
fragmentByTag = new CalendarSelectionDialog();
if (getIntent().getBooleanExtra(EXTRA_SHOW_NONE, false)) {
fragmentByTag.enableNone();
}
fragmentByTag = newCalendarSelectionDialog(getIntent().getBooleanExtra(EXTRA_SHOW_NONE, false));
fragmentByTag.show(fragmentManager, FRAG_TAG_CALENDAR_PREFERENCE_SELECTION);
}
fragmentByTag.setCalendarSelectionHandler(this);

@ -21,6 +21,7 @@ import org.tasks.injection.InjectingDialogFragment;
import org.tasks.preferences.FragmentPermissionRequestor;
import org.tasks.preferences.PermissionChecker;
import org.tasks.preferences.PermissionRequestor;
import org.tasks.themes.Theme;
import java.util.ArrayList;
import java.util.List;
@ -32,17 +33,26 @@ import static org.tasks.PermissionUtil.verifyPermissions;
public class CalendarSelectionDialog extends InjectingDialogFragment {
public static CalendarSelectionDialog newCalendarSelectionDialog(boolean enableNone) {
CalendarSelectionDialog dialog = new CalendarSelectionDialog();
dialog.enableNone = enableNone;
return dialog;
}
public interface CalendarSelectionHandler {
void selectedCalendar(AndroidCalendar calendar);
void cancel();
}
private static final String EXTRA_NONE_ENABLED = "extra_none_enabled";
@Inject DialogBuilder dialogBuilder;
@Inject CalendarProvider calendarProvider;
@Inject @ForActivity Context context;
@Inject FragmentPermissionRequestor fragmentPermissionRequestor;
@Inject PermissionChecker permissionChecker;
@Inject Theme theme;
private CalendarSelectionHandler handler;
private boolean enableNone;
private ArrayAdapter<String> adapter;
@ -54,9 +64,12 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) {
if (savedInstanceState == null) {
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()
.setAdapter(adapter, new DialogInterface.OnClickListener() {
@ -98,7 +111,7 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
}
}));
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();
} else {
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
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
@ -129,10 +149,6 @@ public class CalendarSelectionDialog extends InjectingDialogFragment {
component.inject(this);
}
public void enableNone() {
enableNone = true;
}
public void setCalendarSelectionHandler(CalendarSelectionHandler handler) {
this.handler = handler;
}

@ -73,7 +73,7 @@ public class ColorPickerDialog extends InjectingDialogFragment {
TextView textView = (TextView) (convertView == null
? inflater.inflate(R.layout.color_selection_row, parent, false)
: 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_vpn_key_black_24dp);
Drawable wrapped = DrawableCompat.wrap(original.mutate());

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

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

@ -37,6 +37,7 @@ public class FileExplore extends InjectingAppCompatActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
Intent intent = getIntent();
directoryMode = intent.getBooleanExtra(EXTRA_DIRECTORY_MODE, false);
startPath = intent.getStringExtra(EXTRA_START_PATH);
@ -45,6 +46,7 @@ public class FileExplore extends InjectingAppCompatActivity {
launchPicker();
}
}
}
@Override
public void inject(ActivityComponent component) {
@ -76,11 +78,13 @@ public class FileExplore extends InjectingAppCompatActivity {
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode == PermissionRequestor.REQUEST_FILE_WRITE) {
if (grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
launchPicker();
} else {
finish();
}
}
} else {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

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

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

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

Loading…
Cancel
Save