Skip to content

Commit

Permalink
version 1.9.1
Browse files Browse the repository at this point in the history
- New icons buttons
- iCal support (local URL, update with wifi) by LFOM
- Long press timer on timeline to load iCal events
- Crash fix when events have never been saved
- Previous month crash fix
- Verge compartibility fixes by LFOM
  • Loading branch information
GreatApo committed Feb 2, 2019
1 parent 1ea9b3d commit f45e833
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 247 deletions.
32 changes: 32 additions & 0 deletions .idea/assetWizardSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![latest release](https://img.shields.io/badge/latest%20release-v1.9.0-green.svg?style=flat-square) ![release date](https://img.shields.io/badge/release%20date-2019.02.02-orange.svg?style=flat-square)](https://github.com/GreatApo/AmazfitPaceCalendarWidget/releases/latest)
[![latest release](https://img.shields.io/badge/latest%20release-v1.9.1-green.svg?style=flat-square) ![release date](https://img.shields.io/badge/release%20date-2019.02.02-orange.svg?style=flat-square)](https://github.com/GreatApo/AmazfitPaceCalendarWidget/releases/latest)

# Amazfit Pace/Stratos/Verge Calendar Widget
![Amazfit Pace Calendar Widget Banner](other%20files/amazfit-calendar-widget.png)
Expand All @@ -21,8 +21,10 @@ So, here is the first Calendar Widget for our Amazfit Pace/Stratos!
- Supported languages: English, Chinese, Czech, Dutch, French, German, Greek, Hebrew, Hungarian, Italian, Japanese, Korean, Polish, Portuguese, Romanian, Russian, Slovak, Spanish, Thai, Turkish
- Right to left Calendar support
- Settings are saved
- Calendar events are shown (requires Amazmod phone + watch)
- Calendar events are shown, new style (requires Amazmod phone + watch or local ICS URL file)
- [Timeline Widget](https://forum.xda-developers.com/smartwatch/amazfit/app-widget-timeline-v1-0-1-pace-stratos-t3894632) is also integrated in the calendar
- iCal support by LFOM (write your ICS URL in a file at: /sdcard/Android/data/com.dinodevs.pacecalendar/files/pacecalendar.txt, updates through wifi)
- Long press the timer/date at the top of the Timeline to load iCal events



Expand Down
88 changes: 36 additions & 52 deletions app/src/main/java/com/dinodevs/pacecalendarwidget/APcalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,19 +273,11 @@ public void refresh() {
// Populate last month boxes
for (int i = monthStart - 1; i >= 0; i--) {
int currDay = previousMonthDays - monthStart + i + 1;
int prevMonth = this.month > 0 ? this.month - 1 : 11;
//int prevMonth = this.month > 0 ? this.month - 1 : 11;
//Log.i(Constants.TAG, "previous month day: " + currDay);
temp_view_boxes[i].setText(String.valueOf(currDay));
temp_view_boxes[i].setBackgroundResource(android.R.color.transparent);
if (eventsList != null) {
if (eventsList.get(prevMonth).isEmpty()) {
temp_view_boxes[i].setTextColor(Color.parseColor("#505050"));
} else if (eventsList.get(prevMonth).contains(currDay)) {
//Log.i(Constants.TAG, "previous month event: " + currDay);
temp_view_boxes[i].setTextColor(Color.parseColor(Constants.EVENT_COLOR));
}
} else
temp_view_boxes[i].setTextColor(Color.parseColor("#505050"));
temp_view_boxes[i].setTextColor(Color.parseColor("#505050"));
}
// Populate month's boxes
for (int i = 0; i < monthDays; i++) {
Expand All @@ -300,56 +292,48 @@ public void refresh() {
temp_view_boxes[monthStart + i].setTextColor(Color.parseColor("#FFFFFF"));
temp_view_boxes[monthStart + i].setBackgroundResource(android.R.color.transparent);
}

if (eventsList != null) {
if (eventsList.get(this.month).contains(thisDay)) {
//Log.i(Constants.TAG, "this month event: " + thisDay);
final int index = eventsList.get(this.month).indexOf(thisDay);

//temp_view_boxes[monthStart + i].setTextColor(Color.parseColor(Constants.EVENT_COLOR));

if (thisDay == this.day) {
temp_view_boxes[monthStart + i].setBackgroundResource(R.drawable.round_bg_event_today);

LayerDrawable shape = (LayerDrawable) mContext.getResources().getDrawable(R.drawable.round_bg_event_today);
GradientDrawable circle = (GradientDrawable) shape.findDrawableByLayerId(R.id.outer_circle);
circle.setColor(this.color);
circle = (GradientDrawable) shape.findDrawableByLayerId(R.id.inner_circle);
circle.setColor(this.color);

//((GradientDrawable) temp_view_boxes[monthStart + i].getBackground()).setColor(this.color);
}
else {
temp_view_boxes[monthStart + i].setBackgroundResource(R.drawable.round_bg_event);
((GradientDrawable) temp_view_boxes[monthStart + i].getBackground()).setColor(this.color);
}

temp_view_boxes[monthStart + i].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toast( String.valueOf(thisDay) + "/" + String.valueOf(month+1) +" - "+ eventsHours.get(month).get(index) +"\n"+ eventsTitle.get(month).get(index));
}
});
}
}
//Log.i(Constants.TAG, "this month event: " + thisDay);
final int index = eventsList.get(this.month).indexOf(thisDay);

//temp_view_boxes[monthStart + i].setTextColor(Color.parseColor(Constants.EVENT_COLOR));

if (thisDay == this.day) {
temp_view_boxes[monthStart + i].setBackgroundResource(R.drawable.round_bg_event_today);

LayerDrawable shape = (LayerDrawable) mContext.getResources().getDrawable(R.drawable.round_bg_event_today);
GradientDrawable circle = (GradientDrawable) shape.findDrawableByLayerId(R.id.outer_circle);
circle.setColor(this.color);
circle = (GradientDrawable) shape.findDrawableByLayerId(R.id.inner_circle);
circle.setColor(this.color);

//((GradientDrawable) temp_view_boxes[monthStart + i].getBackground()).setColor(this.color);
} else {
temp_view_boxes[monthStart + i].setBackgroundResource(R.drawable.round_bg_event);
((GradientDrawable) temp_view_boxes[monthStart + i].getBackground()).setColor(this.color);
}

temp_view_boxes[monthStart + i].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toast(String.valueOf(thisDay) + "/" + String.valueOf(month + 1) + " - " + eventsHours.get(month).get(index) + "\n" + eventsTitle.get(month).get(index));
}
});
} else
temp_view_boxes[monthStart + i].setOnClickListener(null);
} else
temp_view_boxes[monthStart + i].setOnClickListener(null);
}
// Populate next month's boxes
for (int i = monthStart + monthDays; i < 42; i++) {
int currDay = i - monthStart - monthDays + 1;
int nextMonth = this.month < 11 ? this.month + 1 : 0;
//int nextMonth = this.month < 11 ? this.month + 1 : 0;
//Log.i(Constants.TAG, "next month day: " + currDay);
temp_view_boxes[i].setText(String.valueOf(currDay));
temp_view_boxes[i].setBackgroundResource(android.R.color.transparent);

if (eventsList != null) {
if (eventsList.get(nextMonth).isEmpty()) {
temp_view_boxes[i].setTextColor(Color.parseColor("#505050"));
} else if (eventsList.get(nextMonth).contains(currDay)) {
temp_view_boxes[monthStart + i].setBackgroundResource(R.drawable.round_bg_event);
((GradientDrawable) temp_view_boxes[monthStart + i].getBackground()).setColor(Color.parseColor("#505050"));
} else
temp_view_boxes[i].setTextColor(Color.parseColor("#505050"));
}
temp_view_boxes[i].setTextColor(Color.parseColor("#505050"));
}

// Populate week boxes
Expand Down Expand Up @@ -398,7 +382,7 @@ private void loadCalendarEvents() {
hours.add(list2);
}

if (calendarEvents != null && !calendarEvents.isEmpty()) {
if(calendarEvents!=null && !calendarEvents.isEmpty()) {
try {
// Check if correct form of JSON
JSONObject json_data = new JSONObject(calendarEvents);
Expand Down
Loading

0 comments on commit f45e833

Please sign in to comment.