Skip to content

Commit

Permalink
Removed all legacy datepicking libraries. Still to replace.... (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed Nov 17, 2019
1 parent 9172950 commit 835ce3e
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 53 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ Pull requests will be automatically analyzed and rejected if they'll rise the co
They're all listed into the [build.gradle](https://github.com/federicoiosue/Omni-Notes/blob/develop/omniNotes/build.gradle) file but due to the fact that many of the dependences have been customized by me I'd like to say thanks here to the original developers of these great libraries:

* https://github.com/RobotiumTech/robotium
* https://github.com/flavienlaurent/datetimepicker
* https://github.com/LarsWerkman/HoloColorPicker
* https://github.com/keyboardsurfer/Crouton
* https://github.com/romannurik/dashclock/wiki/API
Expand Down
13 changes: 8 additions & 5 deletions omniNotes/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,16 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
}

implementation 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
implementation 'com.larswerkman:HoloColorPicker:1.4'
implementation 'de.keyboardsurfer.android.widget:crouton:1.8.4@aar'
implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
implementation "ch.acra:acra-http:5.2.1"
implementation "ch.acra:acra-toast:5.2.1"
implementation 'com.github.gabrielemariotti.changeloglib:changelog:2.0.0'
implementation 'be.billington.calendar.recurrencepicker:library:1.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:multidex:1.0.3'
// implementation 'be.billington.calendar.recurrencepicker:library:1.1.1'
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support:design:28.0.0'
// implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.pushbullet:android-extensions:1.0.4@aar'
Expand All @@ -153,9 +152,13 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation('com.github.afollestad.material-dialogs:core:0.8.5.6@aar') {
transitive = true
exclude group: "com.android.support"

}
implementation('com.github.afollestad.material-dialogs:commons:0.8.5.6@aar') {
transitive = true
exclude group: "com.android.support"

}

implementation 'com.jakewharton:butterknife:10.2.0'
Expand Down
1 change: 0 additions & 1 deletion omniNotes/src/main/assets/html/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
<li><a href="https://github.com/gabrielemariotti/changeloglib">ChangelogLib</a> by Gabriele Mariotti</li>
<li><a href="https://github.com/federicoiosue/CheckListView">CheckListView</a> by Federico Iosue</li>
<li><a href="https://github.com/keyboardsurfer/Crouton">Crouton</a> by Benjamin Weiss</li>
<li><a href="https://github.com/flavienlaurent/datetimepicker">Datetimepicker</a> by Flavien Laurent</li>
<li><a href="https://github.com/greenrobot/EventBus">EventBus</a> by GreenRobot</li>
<li><a href="https://github.com/futuresimple/android-floating-action-button">FloatingActionButton</a> by Base</li>
<li><a href="https://github.com/bumptech/glide">Glide</a> by Bump Technologies</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.Time;
import be.billington.calendar.recurrencepicker.EventRecurrence;
import be.billington.calendar.recurrencepicker.EventRecurrenceFormatter;
import it.feio.android.omninotes.OmniNotes;
import it.feio.android.omninotes.R;
import it.feio.android.omninotes.helpers.LogDelegate;
Expand Down Expand Up @@ -120,11 +118,14 @@ public static String formatShortTime (Context mContext, long time) {

public static String formatRecurrence (Context mContext, String recurrenceRule) {
if (!TextUtils.isEmpty(recurrenceRule)) {
EventRecurrence recurrenceEvent = new EventRecurrence();
recurrenceEvent.setStartDate(new Time("" + new Date().getTime()));
recurrenceEvent.parse(recurrenceRule);
return EventRecurrenceFormatter.getRepeatString(mContext.getApplicationContext(),
mContext.getResources(), recurrenceEvent, true);
// EventRecurrence recurrenceEvent = new EventRecurrence();
// recurrenceEvent.setStartDate(new Time("" + new Date().getTime()));
// recurrenceEvent.parse(recurrenceRule);
// return EventRecurrenceFormatter.getRepeatString(mContext.getApplicationContext(),
// mContext.getResources(), recurrenceEvent, true);

return null; //FIXME

} else {
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

public class DatePickerDialogFragment extends DialogFragment {

public static final String DEFAULT_DATE = "default_date";
static final String DEFAULT_DATE = "default_date";

private OnDateSetListener mListener;
private Long defaultDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.os.Bundle;
import android.widget.DatePicker;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import android.widget.DatePicker;
import be.billington.calendar.recurrencepicker.RecurrencePickerDialog;
import com.fourmob.datetimepicker.date.DatePickerDialog;
import com.sleepbot.datetimepicker.time.TimePickerDialog;
//import be.billington.calendar.recurrencepicker.RecurrencePirDialog;
import it.feio.android.omninotes.models.listeners.OnReminderPickedListener;
import it.feio.android.omninotes.utils.Constants;
import java.util.Calendar;

//import com.fourmob.datetimepicker.date.DatePickerDialog;
//import com.sleepbot.datetimepicker.time.TimePickerDialog;

public class ReminderPickers implements OnDateSetListener, OnTimeSetListener,
RecurrencePickerDialog.OnRecurrenceSetListener {

public class ReminderPickers implements OnDateSetListener, OnTimeSetListener {

public static final int TYPE_GOOGLE = 0;
public static final int TYPE_AOSP = 1;
Expand Down Expand Up @@ -91,21 +91,21 @@ protected void showDateTimeSelectors (long reminder) {

// Sets actual time or previously saved in note
final Calendar now = DateUtils.getCalendar(reminder);
DatePickerDialog mCalendarDatePickerDialog = DatePickerDialog.newInstance(
(dialog, year, monthOfYear, dayOfMonth) -> {
reminderYear = year;
reminderMonth = monthOfYear;
reminderDay = dayOfMonth;
TimePickerDialog mRadialTimePickerDialog = TimePickerDialog.newInstance(
(radialPickerLayout, hour, minute) -> {
hourOfDay = hour;
minutes = minute;
showRecurrencePickerDialog(recurrenceRule);
}, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE),
DateUtils.is24HourMode(mActivity));
mRadialTimePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
mCalendarDatePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
// DatePickerDialog mCalendarDatePickerDialog = DatePickerDialog.newInstance(
// (dialog, year, monthOfYear, dayOfMonth) -> {
// reminderYear = year;
// reminderMonth = monthOfYear;
// reminderDay = dayOfMonth;
// TimePickerDialog mRadialTimePickerDialog = TimePickerDialog.newInstance(
// (radialPickerLayout, hour, minute) -> {
// hourOfDay = hour;
// minutes = minute;
// showRecurrencePickerDialog(recurrenceRule);
// }, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE),
// DateUtils.is24HourMode(mActivity));
// mRadialTimePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
// }, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
// mCalendarDatePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}


Expand All @@ -132,14 +132,14 @@ private void showTimePickerDialog (long presetDateTime) {


private void showRecurrencePickerDialog (String recurrenceRule) {
RecurrencePickerDialog recurrencePickerDialog = new RecurrencePickerDialog();
if (recurrenceRule != null && recurrenceRule.length() > 0) {
Bundle bundle = new Bundle();
bundle.putString(RecurrencePickerDialog.BUNDLE_RRULE, recurrenceRule);
recurrencePickerDialog.setArguments(bundle);
}
recurrencePickerDialog.setOnRecurrenceSetListener(this);
recurrencePickerDialog.show(mActivity.getSupportFragmentManager(), "recurrencePicker");
// RecurrencePickerDialog recurrencePickerDialog = new RecurrencePickerDialog();
// if (recurrenceRule != null && recurrenceRule.length() > 0) {
// Bundle bundle = new Bundle();
// bundle.putString(RecurrencePickerDialog.BUNDLE_RRULE, recurrenceRule);
// recurrencePickerDialog.setArguments(bundle);
// }
// recurrencePickerDialog.setOnRecurrenceSetListener(this);
// recurrencePickerDialog.show(mActivity.getSupportFragmentManager(), "recurrencePicker");
}


Expand All @@ -166,13 +166,13 @@ public void onTimeSet (android.widget.TimePicker view, int hourOfDay, int minute
}


@Override
public void onRecurrenceSet (final String rrule) {
Calendar c = Calendar.getInstance();
c.set(reminderYear, reminderMonth, reminderDay, hourOfDay, minutes, 0);
if (mOnReminderPickedListener != null) {
mOnReminderPickedListener.onReminderPicked(c.getTimeInMillis());
mOnReminderPickedListener.onRecurrenceReminderPicked(rrule);
}
}
// @Override
// public void onRecurrenceSet (final String rrule) {
// Calendar c = Calendar.getInstance();
// c.set(reminderYear, reminderMonth, reminderDay, hourOfDay, minutes, 0);
// if (mOnReminderPickedListener != null) {
// mOnReminderPickedListener.onReminderPicked(c.getTimeInMillis());
// mOnReminderPickedListener.onRecurrenceReminderPicked(rrule);
// }
// }
}

0 comments on commit 835ce3e

Please sign in to comment.