Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit 281e8b7

Browse files
committed
Update build.
1 parent 1c7aac8 commit 281e8b7

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
lines changed

.idea/misc.xml

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ android {
2525

2626
dependencies {
2727
compile fileTree(dir: 'libs', include: ['*.jar'])
28-
compile 'com.android.support:design:25.2.0'
29-
compile 'com.android.support:appcompat-v7:25.2.0'
30-
compile 'com.android.support:support-v4:25.2.0'
28+
compile 'com.android.support:design:25.3.0'
29+
compile 'com.android.support:appcompat-v7:25.3.0'
30+
compile 'com.android.support:support-v4:25.3.0'
3131
}

app/src/main/java/org/miamplayer/autoairplanemode/AlarmBroadcastReceiver.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,20 @@ public class AlarmBroadcastReceiver extends WakefulBroadcastReceiver
2727
{
2828
private static final String TAG = "AlarmBroadcastReceiver";
2929

30+
/** The most important object in this class. */
3031
private AlarmManager alarmManager;
32+
33+
/** Attach an intent to the manager with specific ID. */
3134
private PendingIntent enableAirplaneModePendingIntent;
35+
36+
/** Attach another intent to the manager with specific ID. */
3237
private PendingIntent disableAirplaneModePendingIntent;
3338

34-
private final SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM", Locale.getDefault());
35-
private final SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm", Locale.getDefault());
39+
/** Display days/month. */
40+
private static final SimpleDateFormat SDF_1 = new SimpleDateFormat("dd/MM", Locale.getDefault());
41+
42+
/** Display hours/minutes. */
43+
private static final SimpleDateFormat SDF_2 = new SimpleDateFormat("HH:mm", Locale.getDefault());
3644

3745
@Override
3846
public void onReceive(Context context, Intent intent)
@@ -54,6 +62,7 @@ public void onReceive(Context context, Intent intent)
5462
}
5563

5664
/**
65+
* Set both start / stop alarms.
5766
*
5867
* @param context the context
5968
* @return true if alarm was set
@@ -82,6 +91,8 @@ public String setAlarms(Context context)
8291

8392
calendarEnd.set(Calendar.HOUR_OF_DAY, Integer.valueOf(disable[0]));
8493
calendarEnd.set(Calendar.MINUTE, Integer.valueOf(disable[1]));
94+
calendarEnd.set(Calendar.SECOND, 0);
95+
calendarEnd.set(Calendar.MILLISECOND, 0);
8596

8697
// If settings are like this [23:00 -> 08:00], convert to [23:00 -> (day +1) 08:00]
8798
if (calendarStart.after(calendarEnd)) {
@@ -113,8 +124,8 @@ public String setAlarms(Context context)
113124
message = context.getString(R.string.toast_next_airplane_mode_tomorrow);
114125
} else {
115126
message = String.format(context.getString(R.string.toast_next_airplane_mode_later),
116-
sdf1.format(calendarStart.getTime()),
117-
sdf2.format(calendarStart.getTime()));
127+
SDF_1.format(calendarStart.getTime()),
128+
SDF_2.format(calendarStart.getTime()));
118129
}
119130
return message;
120131
}
@@ -177,6 +188,7 @@ private boolean getNextScheduledDay(Context context, Calendar now, Calendar star
177188
}
178189

179190
/**
191+
* Removes any registered alarms.
180192
*
181193
* @param context the context
182194
*/

0 commit comments

Comments
 (0)