Skip to content

Commit 9b46ca4

Browse files
Merge branch 'dev'
2 parents e722ea9 + 1de0789 commit 9b46ca4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1567
-196
lines changed

.idea/codeStyles/Project.xml

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

.idea/codeStyles/codeStyleConfig.xml

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

.idea/misc.xml

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

README.md

Lines changed: 114 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,117 @@
11
# HangoverClock
2-
This is a clock app/widget using the previously tested new time display from my [Stopwatch](https://github.com/programminghoch10/Stopwatch)
32

4-
_Currently this app is in alpha stadium, don't expect it to work, maybe look at latest commits to know how good it works yet._
3+
Welcome to HangoverClock, the only clock which displays the real time in an unrealistic way!
54

6-
[Download APK](https://github.com/programminghoch10/HangoverClock/raw/master/app/release/app-release.apk)
5+
If you just want to see what this widget looks like now,
6+
please click [here](https://github.com/programminghoch10/HangoverClock#the-next-generation)
7+
8+
[Download the newest APK](https://github.com/programminghoch10/HangoverClock/raw/master/app/release/app-release.apk)
9+
or look at the
10+
[latest stable releases](https://github.com/programminghoch10/HangoverClock/releases)
11+
12+
For Wear OS Users, please look [here](https://github.com/programminghoch10/HangoverClock/tree/wear)
13+
14+
![HangoverClock Icon new](icon/clock.png)
15+
![HangoverClock Icon old](app/src/main/res/drawable-v24/clock.png)
16+
17+
## What makes HangoverClock special?
18+
19+
It all started with this meme:
20+
21+
![Astrolodgermeme](pictures/astrolodgermeme.jpg)
22+
23+
"You will meet your girlfriend today at 11" and the clock shows 10:65.
24+
25+
I thought this needs to get real.
26+
Its obvious that 10:65 would actually be 11:05.
27+
28+
My first test of this was my [Stopwatch](https://github.com/programminghoch10/Stopwatch).
29+
30+
To describe how many minutes the clock should go over the full hour, I used the word "Overhang".
31+
An Overhang of 0 would result in the clock being totally normal.
32+
Any Overhang above 0 would result in the clock counting over 60 until the Overhang is reached, at which point it shows the real time again.
33+
E.g. With an overhang of 10 the clock would go up to 10:69 and the next minute to 11:10.
34+
Of course you could also go insane with this setting, which results in ridiculous clocks like 03:384829323
35+
(Yes my friend [@IlijazM](https://github.com/IlijazM) actually did that).
36+
37+
And because of that variable, which makes the clock unique, its named HangoverClock.
38+
39+
## Good old times
40+
41+
![HangoverClock Toxic Picture 1](pictures/toxic1.png)
42+
![HangoverClock Toxic Picture 2](pictures/toxic2.png)
43+
44+
This was HangoverClock "Toxic". A simple widget which displayed the time.
45+
You were able to modify the Overhang, by clicking in the middle once.
46+
Then the current overhang was displayed and you could increase or decrease it by clicking the + or - button.
47+
Also the text was always the same size, no matter how big the widget was resized too.
48+
49+
So my friends inspired me saying the idea is amazing, but the clocks design sucks. So I needed to do something about it.
50+
51+
## The next generation
52+
53+
![HangoverClock Dynamite Picture 1](pictures/dynamite1.jpg)
54+
![HangoverClock Dynamite Picture 2](pictures/dynamite2.png)
55+
(background not included)
56+
57+
Here is HangoverClock "Dynamite".
58+
59+
Dynamite brings a lot of new features:
60+
First of there are fonts. Around 20 fonts (more incoming) are just waiting for amazing clock widgets to be created.
61+
With the freely choosable color (16.777.216 combinations) you can select the most fitting for your background.
62+
And you can enable a date to be shown below the clock, which **also has the ability to overhang**!
63+
Also you can now choose whether to use 12 or 24h time format, or use the system setting.
64+
65+
When creating the widget on your home launcher the app greets you with a settings menu,
66+
which lets you easily set up the widget as you like it.
67+
68+
Also you are now able to not choose one Overhang, but all 4 seperatly. Those are:
69+
* Minutes
70+
* Hours
71+
* Days
72+
* Months
73+
* _Seconds coming soon (maybe)_
74+
75+
Same thing as always,
76+
hours defines how much to go over 12/24h mark,
77+
days defines how much to go over a month
78+
and months defines how much to go over a year.
79+
80+
[@IlijazM](https://github.com/IlijazM) im expecting you to live in 2017 :)
81+
82+
 
83+
84+
***Special info for 12h users:***
85+
86+
Overhang calculation turns out to be really difficult and confusing in the 12h format.
87+
That's why whole calculation happens in 24h format and then gets later subtracted down,
88+
if the hour field is between or equal of 12+houroverhang and 24.
89+
Try setting houroverhang to 0 or 1 and watch what suits you better.
90+
*This behaviour is only relevant when using the date,*
91+
so please remember that using the 12h setting may not reflect the real time!
92+
But maybe nobody will notice...
93+
94+
## The Future
95+
96+
I'm always trying to leave as much options open as possible, but at some point there are too much settings for the user to choose.
97+
Apple already learned that ;) So its probably not getting more customizable in regards to the current features,
98+
but I'm always thinking of new features.
99+
I'm always on the quest to make this the best HangoverClock ever.
100+
101+
## Code Stuff
102+
103+
* All calculations happen inside the Class WidgetGenerator.
104+
* The only public method is generateWidget, which returns a Bitmap Image.
105+
* The fonts get dynamically collected from all available resource files
106+
and saved in a static String array within the ClockWidgetProvider class.
107+
* The sharedPreference keys are defined in preferencekeys.xml and their defaults in preferencekeydefaults.xml.
108+
* sharedPreferences are saved in the format key and directly appended widget ID.
109+
* If a key is not defined its default value is assumed and only gets saved when not default or when alwayssavepreferences bool is active.
110+
* if one of the widgets has seconds enabled, the setalarmmanager method will request intent for one second instead of one second.
111+
* That behaviour is dependent on sharedPreferences key "increaserefreshrate".
112+
* That key will be determined on every clock update by looping though all widgets and looking if any has seconds enabled.
113+
114+
## Thanksgiving
115+
116+
Thanks to all my friends, who motivated me to do this.
117+
Also thanks to my laptop, which crashed 2 times with literally nothing saved to disk.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
applicationId "com.JJ.hangoverclock"
77
minSdkVersion 16
88
targetSdkVersion 28
9-
versionCode 6
10-
versionName "toxic"
9+
versionCode 9
10+
versionName "dynamite"
1111
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1212
}
1313
buildTypes {

app/release/app-release.apk

655 KB
Binary file not shown.

app/release/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":6,"versionName":"v1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
1+
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":9,"versionName":"dynamite","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

app/src/main/AndroidManifest.xml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
23
xmlns:tools="http://schemas.android.com/tools"
3-
android:installLocation="internalOnly"
4-
package="com.JJ.hangoverclock">
4+
package="com.JJ.hangoverclock"
5+
android:installLocation="internalOnly">
56

67
<application
78
android:allowBackup="false"
89
android:icon="@mipmap/clock_c"
910
android:label="@string/app_name"
1011
android:roundIcon="@mipmap/clock_c"
11-
android:supportsRtl="false"
12+
android:supportsRtl="true"
1213
android:theme="@style/AppTheme"
1314
tools:ignore="GoogleAppIndexingWarning">
14-
<receiver android:name="ClockWidgetProvider" >
15+
<activity android:name=".ConfigureWidget">
1516
<intent-filter>
16-
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
17-
<action android:name="com.JJ.hangoverclock.widgetupdate" />
17+
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
18+
</intent-filter>
19+
</activity>
20+
21+
<meta-data
22+
android:name="preloaded_fonts"
23+
android:resource="@array/preloaded_fonts" />
24+
<receiver android:name=".BootReceiver">
25+
<intent-filter>
26+
<action android:name="android.intent.action.BOOT_COMPLETED" />
1827
</intent-filter>
19-
<meta-data android:name="android.appwidget.provider"
20-
android:resource="@xml/appwidgetproviderinfo" />
2128
</receiver>
22-
<receiver android:name="BootReceiver">
29+
30+
<receiver android:name=".ClockWidgetProvider">
2331
<intent-filter>
24-
<action android:name="android.intent.action.BOOT_COMPLETED"/>
32+
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
33+
<action android:name="com.JJ.hangoverclock.widgetupdate" />
2534
</intent-filter>
35+
36+
<meta-data
37+
android:name="android.appwidget.provider"
38+
android:resource="@xml/appwidgetproviderinfo" />
2639
</receiver>
2740
</application>
28-
</manifest>
41+
42+
</manifest>

app/src/main/java/com/JJ/hangoverclock/BootReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import android.content.Intent;
66

77
public class BootReceiver extends BroadcastReceiver {
8-
8+
99
@Override
1010
public void onReceive(Context context, Intent intent) {
1111
ClockWidgetProvider clockWidgetProvider = new ClockWidgetProvider();

0 commit comments

Comments
 (0)