mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Switch to AppCompatDialogFragment and compat Fragment
This commit is contained in:
@@ -18,9 +18,9 @@ package com.android.colorpicker;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.DialogFragment;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
import android.support.v7.app.AppCompatDialogFragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
@@ -33,7 +33,7 @@ import org.isoron.uhabits.R;
|
|||||||
* A dialog which takes in as input an array of palette and creates a palette allowing the user to
|
* A dialog which takes in as input an array of palette and creates a palette allowing the user to
|
||||||
* select a specific color swatch, which invokes a listener.
|
* select a specific color swatch, which invokes a listener.
|
||||||
*/
|
*/
|
||||||
public class ColorPickerDialog extends DialogFragment implements OnColorSelectedListener {
|
public class ColorPickerDialog extends AppCompatDialogFragment implements OnColorSelectedListener {
|
||||||
|
|
||||||
public static final int SIZE_LARGE = 1;
|
public static final int SIZE_LARGE = 1;
|
||||||
public static final int SIZE_SMALL = 2;
|
public static final int SIZE_SMALL = 2;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.content.Context;
|
|||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatDialogFragment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyCharacterMap;
|
import android.view.KeyCharacterMap;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@@ -49,7 +50,7 @@ import com.android.datetimepicker.time.RadialPickerLayout.OnValueSelectedListene
|
|||||||
/**
|
/**
|
||||||
* Dialog to set a time.
|
* Dialog to set a time.
|
||||||
*/
|
*/
|
||||||
public class TimePickerDialog extends DialogFragment implements OnValueSelectedListener{
|
public class TimePickerDialog extends AppCompatDialogFragment implements OnValueSelectedListener{
|
||||||
private static final String TAG = "TimePickerDialog";
|
private static final String TAG = "TimePickerDialog";
|
||||||
|
|
||||||
private static final String KEY_HOUR_OF_DAY = "hour_of_day";
|
private static final String KEY_HOUR_OF_DAY = "hour_of_day";
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class MainActivity extends BaseActivity
|
|||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
listHabitsFragment =
|
listHabitsFragment =
|
||||||
(ListHabitsFragment) getFragmentManager().findFragmentById(R.id.fragment1);
|
(ListHabitsFragment) getSupportFragmentManager().findFragmentById(R.id.fragment1);
|
||||||
|
|
||||||
receiver = new Receiver();
|
receiver = new Receiver();
|
||||||
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
package org.isoron.uhabits.dialogs;
|
package org.isoron.uhabits.dialogs;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.DialogFragment;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.app.AppCompatDialogFragment;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -51,7 +51,7 @@ import org.isoron.uhabits.models.Habit;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class EditHabitDialogFragment extends DialogFragment
|
public class EditHabitDialogFragment extends AppCompatDialogFragment
|
||||||
implements OnClickListener, WeekdayPickerDialog.OnWeekdaysPickedListener,
|
implements OnClickListener, WeekdayPickerDialog.OnWeekdaysPickedListener,
|
||||||
TimePickerDialog.OnTimeSetListener, Spinner.OnItemSelectedListener
|
TimePickerDialog.OnTimeSetListener, Spinner.OnItemSelectedListener
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,11 +20,11 @@
|
|||||||
package org.isoron.uhabits.dialogs;
|
package org.isoron.uhabits.dialogs;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.DialogFragment;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
import android.support.v7.app.AppCompatDialogFragment;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
|
||||||
import org.isoron.uhabits.R;
|
import org.isoron.uhabits.R;
|
||||||
@@ -32,7 +32,7 @@ import org.isoron.uhabits.models.Habit;
|
|||||||
import org.isoron.uhabits.tasks.BaseTask;
|
import org.isoron.uhabits.tasks.BaseTask;
|
||||||
import org.isoron.uhabits.views.HabitHistoryView;
|
import org.isoron.uhabits.views.HabitHistoryView;
|
||||||
|
|
||||||
public class HistoryEditorDialog extends DialogFragment
|
public class HistoryEditorDialog extends AppCompatDialogFragment
|
||||||
implements DialogInterface.OnClickListener
|
implements DialogInterface.OnClickListener
|
||||||
{
|
{
|
||||||
private Habit habit;
|
private Habit habit;
|
||||||
|
|||||||
@@ -20,15 +20,15 @@
|
|||||||
package org.isoron.uhabits.dialogs;
|
package org.isoron.uhabits.dialogs;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.DialogFragment;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
import android.support.v7.app.AppCompatDialogFragment;
|
||||||
|
|
||||||
import org.isoron.uhabits.R;
|
import org.isoron.uhabits.R;
|
||||||
import org.isoron.uhabits.helpers.DateHelper;
|
import org.isoron.uhabits.helpers.DateHelper;
|
||||||
|
|
||||||
public class WeekdayPickerDialog extends DialogFragment
|
public class WeekdayPickerDialog extends AppCompatDialogFragment
|
||||||
implements DialogInterface.OnMultiChoiceClickListener, DialogInterface.OnClickListener
|
implements DialogInterface.OnMultiChoiceClickListener, DialogInterface.OnClickListener
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class HabitSelectionCallback implements ActionMode.Callback
|
|||||||
EditHabitDialogFragment
|
EditHabitDialogFragment
|
||||||
frag = EditHabitDialogFragment.editSingleHabitFragment(firstHabit.getId());
|
frag = EditHabitDialogFragment.editSingleHabitFragment(firstHabit.getId());
|
||||||
frag.setOnSavedListener(onSavedListener);
|
frag.setOnSavedListener(onSavedListener);
|
||||||
frag.show(activity.getFragmentManager(), "editHabit");
|
frag.show(activity.getSupportFragmentManager(), "editHabit");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ public class HabitSelectionCallback implements ActionMode.Callback
|
|||||||
mode.finish();
|
mode.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
picker.show(activity.getFragmentManager(), "picker");
|
picker.show(activity.getSupportFragmentManager(), "picker");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
package org.isoron.uhabits.fragments;
|
package org.isoron.uhabits.fragments;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
@@ -50,18 +50,18 @@ import com.mobeta.android.dslv.DragSortController;
|
|||||||
import com.mobeta.android.dslv.DragSortListView;
|
import com.mobeta.android.dslv.DragSortListView;
|
||||||
import com.mobeta.android.dslv.DragSortListView.DropListener;
|
import com.mobeta.android.dslv.DragSortListView.DropListener;
|
||||||
|
|
||||||
import org.isoron.uhabits.R;
|
|
||||||
import org.isoron.uhabits.BaseActivity;
|
import org.isoron.uhabits.BaseActivity;
|
||||||
|
import org.isoron.uhabits.R;
|
||||||
import org.isoron.uhabits.commands.Command;
|
import org.isoron.uhabits.commands.Command;
|
||||||
import org.isoron.uhabits.commands.ToggleRepetitionCommand;
|
import org.isoron.uhabits.commands.ToggleRepetitionCommand;
|
||||||
import org.isoron.uhabits.dialogs.EditHabitDialogFragment;
|
import org.isoron.uhabits.dialogs.EditHabitDialogFragment;
|
||||||
import org.isoron.uhabits.dialogs.FilePickerDialog;
|
import org.isoron.uhabits.dialogs.FilePickerDialog;
|
||||||
import org.isoron.uhabits.helpers.DatabaseHelper;
|
import org.isoron.uhabits.helpers.DatabaseHelper;
|
||||||
import org.isoron.uhabits.helpers.DateHelper;
|
import org.isoron.uhabits.helpers.DateHelper;
|
||||||
import org.isoron.uhabits.helpers.UIHelper.OnSavedListener;
|
|
||||||
import org.isoron.uhabits.helpers.HintManager;
|
import org.isoron.uhabits.helpers.HintManager;
|
||||||
import org.isoron.uhabits.helpers.ListHabitsHelper;
|
import org.isoron.uhabits.helpers.ListHabitsHelper;
|
||||||
import org.isoron.uhabits.helpers.ReminderHelper;
|
import org.isoron.uhabits.helpers.ReminderHelper;
|
||||||
|
import org.isoron.uhabits.helpers.UIHelper.OnSavedListener;
|
||||||
import org.isoron.uhabits.loaders.HabitListLoader;
|
import org.isoron.uhabits.loaders.HabitListLoader;
|
||||||
import org.isoron.uhabits.models.Habit;
|
import org.isoron.uhabits.models.Habit;
|
||||||
import org.isoron.uhabits.tasks.ExportCSVTask;
|
import org.isoron.uhabits.tasks.ExportCSVTask;
|
||||||
|
|||||||
@@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.fragments;
|
package org.isoron.uhabits.fragments;
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
|
|||||||
Reference in New Issue
Block a user