Skip to content

Commit

Permalink
Small fixes version 1.0.1
Browse files Browse the repository at this point in the history
- Removed annoying refresh toast
- Added "No events" message
  • Loading branch information
GreatApo committed Jan 28, 2019
1 parent e36e671 commit 0e5c375
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
6 changes: 3 additions & 3 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.0.0-green.svg?style=flat-square) ![release date](https://img.shields.io/badge/release%20date-2019.01.24-orange.svg?style=flat-square)](https://github.com/GreatApo/Amazfit-Timeline-Widget/releases/latest)
[![latest release](https://img.shields.io/badge/latest%20release-v1.0.1-green.svg?style=flat-square) ![release date](https://img.shields.io/badge/release%20date-2019.01.28-orange.svg?style=flat-square)](https://github.com/GreatApo/Amazfit-Timeline-Widget/releases/latest)

# Amazfit Timeline Widget

Expand All @@ -8,14 +8,14 @@ Here is the first Calendar Events Widget for our Amazfits!

### Features
- This is a Pace/Stratos/Verge Widget
- Shows your phone calendar
- Shows your phone calendar events
- Shows only future events and from the last 10 minutes
- Long press time at top to manually refresh the events list (provided that new data have been send from phone)

In order to work, [Amazmod](https://github.com/AmazMod/AmazMod) (both phone and service/watch) must be installed, and calendar data forwarding should be enabled.


### Bugs / To Do
- Amazmod has no on/off option (events are just pushed along battery/alarm data)
- No interaction with the events items (data not used: account, description)
- Time should constantly be updated

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
targetSdkVersion 27
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionName '1.0.0'
versionCode 20190123
versionName '1.0.1'
versionCode 20190128
}
buildTypes {
release {
Expand Down
22 changes: 9 additions & 13 deletions app/src/main/java/com/dinodevs/timelinewidget/widget.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void onClick(View v) {
public boolean onLongClick(View v) {
refresh_time();
loadCalendarEvents();
widget.this.toast("Refreshing events...");
widget.this.toast("Events were refreshed");
return true;
}
});
Expand Down Expand Up @@ -210,17 +210,6 @@ private void loadCalendarEvents() {
// adding events to events list
eventsList.add(event);
}
}else{
HashMap<String, String> event = new HashMap<>();
event.put("title", "No events");
//event.put("description", "-");
//event.put("start", "-");
//event.put("end", "-");
//event.put("location", "-");
//event.put("account", "-");
event.put("subtitle", "-");
event.put("dot", "" );
eventsList.add(event);
}
} catch (JSONException e) {
//default
Expand All @@ -236,6 +225,14 @@ private void loadCalendarEvents() {
eventsList.add(event);
}

if(eventsList.isEmpty()){
HashMap<String, String> elem = new HashMap<>();
elem.put("title", "\nNo events");
elem.put("subtitle", "Make sure you use Amazmod on your phone and that your stock calendar has events.");
elem.put("dot", "" );
eventsList.add(elem);
}

ListAdapter adapter = new SimpleAdapter(mContext, eventsList, R.layout.list_item, new String[]{"title", "subtitle", "dot"}, new int[]{R.id.title, R.id.description, R.id.dot});
lv.setAdapter(adapter);
}
Expand Down Expand Up @@ -272,7 +269,6 @@ private void onShow() {
if ( next_event+10*1000 < Calendar.getInstance().getTimeInMillis() || !calendarEvents.equals(Settings.System.getString(mContext.getContentResolver(), "CustomCalendarData")) ) {
// Refresh timeline
loadCalendarEvents();
widget.this.toast("Refreshing events...");
}

}
Expand Down

0 comments on commit 0e5c375

Please sign in to comment.