Skip to content

Commit 7eb09a8

Browse files
authored
UI improvements and configurations for Android (#9)
UI improvements and configurations for Android
2 parents 042653c + 8609b0f commit 7eb09a8

File tree

60 files changed

+444
-119
lines changed

Some content is hidden

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

60 files changed

+444
-119
lines changed

android/app/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ android {
4242
}
4343

4444
defaultConfig {
45-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
46-
applicationId "com.example.cuckoo"
45+
applicationId "xyz.hku.cuckoo"
4746
// You can update the following values to match your application needs.
4847
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
4948
minSdkVersion flutter.minSdkVersion

android/app/src/main/AndroidManifest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<application
3-
android:label="cuckoo"
3+
android:label="Cuckoo"
44
android:name="${applicationName}"
55
android:icon="@mipmap/ic_launcher">
66
<activity
77
android:name=".MainActivity"
88
android:exported="true"
9+
android:screenOrientation="portrait"
910
android:launchMode="singleTop"
1011
android:theme="@style/LaunchTheme"
1112
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
22.5 KB
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="250"
5+
android:viewportHeight="250"
6+
android:tint="#FFFFFF">
7+
<group android:scaleX="0.92"
8+
android:scaleY="0.92"
9+
android:translateX="10"
10+
android:translateY="10">
11+
<path
12+
android:pathData="M173.65,31.45C165.16,32.89 156.45,38.5 151.46,45.83C147.73,51.31 146.25,56.07 145.62,64.6C145.3,68.83 144.85,71.21 143.82,74.26C142.52,78.12 139.29,84.05 137.8,85.31C136.73,86.21 136.99,86.84 139.15,87.96C141.98,89.45 146.65,93.85 149.08,97.31C154.56,104.94 156.49,115.99 153.98,125.52C150.74,137.6 140.5,147.84 128.37,151.08C120.33,153.23 106.36,152.07 94.95,148.25C86.37,145.37 76.3,139.67 69.3,133.65C67.32,131.94 66.33,131.36 66.24,131.81C66.15,132.17 66.69,134.73 67.46,137.51C72.98,158.18 86.46,174.93 105.23,184.37C112.15,187.82 122.31,190.92 129.04,191.6L132.19,191.91V199.01V206.15H121.41C111.43,206.15 110.44,206.24 108.83,207.05C106.81,208.08 105.23,210.64 105.23,212.89C105.23,215.14 106.81,217.7 108.83,218.73C110.49,219.58 111.43,219.63 125.45,219.63C139.24,219.63 140.45,219.58 142.02,218.77C142.92,218.28 144,217.56 144.36,217.11C145.62,215.54 149.3,214.24 152.4,214.24C155.5,214.24 159.19,215.54 160.44,217.11C161.43,218.28 164.31,219.63 165.88,219.63C169.29,219.63 172.62,216.3 172.62,212.89C172.62,208.58 166.06,203.19 158.6,201.43C155.46,200.72 149.93,200.58 147.37,201.17L145.66,201.57V196.99V192.36L149.39,191.82C182.81,186.79 208.73,158.94 212.55,123.86C213.18,118.11 213.23,70.17 212.55,65.1C210.62,49.37 203.21,38.1 191.71,33.34C186.72,31.23 179.45,30.51 173.65,31.45ZM182.5,58.81C184.52,59.84 186.09,62.4 186.09,64.65C186.09,68.06 182.77,71.39 179.31,71.39C176.03,71.39 172.62,67.97 172.62,64.65C172.62,62.49 174.19,59.84 176.12,58.85C178.28,57.69 180.3,57.69 182.5,58.81Z"
13+
android:fillColor="#ffffff"/>
14+
<path
15+
android:pathData="M223.56,33.11L215.38,35.22L217.76,39.13C221.45,45.2 223.6,51.04 225.4,59.89C225.67,61.1 226.16,60.52 231.96,51.8C239.19,41.02 240,39.58 240,37.7C240,34.24 236.63,30.91 233.17,31C232.36,31 228.01,31.99 223.56,33.11Z"
16+
android:fillColor="#ffffff"/>
17+
<path
18+
android:pathData="M13.5,52.12C11.53,53.15 10,55.75 10,58.09C10,60.25 13.46,66.8 16.87,71.16C19.16,74.08 25,79.16 50.61,100.5C79.81,124.84 85.69,129.47 91.08,132.17C100.79,136.97 115.61,139.85 123.29,138.37C135.87,135.85 144.09,123.23 140.9,111.14C140,107.64 138.39,104.94 135.56,102.16C132.68,99.37 129.04,97.53 124.42,96.63C121,95.96 120.64,95.96 115.16,96.99C107.89,98.34 103.48,98.56 98.86,97.94C94.45,97.26 87.94,95.2 84.79,93.44C83.58,92.72 69.43,83.7 53.35,73.41C37.31,63.08 22.85,53.82 21.23,52.88C17.91,50.95 16.06,50.72 13.5,52.12Z"
19+
android:fillColor="#ffffff"/>
20+
</group>
21+
</vector>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
-544 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-442 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

android/app/src/main/res/values-night-v31/styles.xml

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<item name="android:windowFullscreen">false</item>
77
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
88
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
9+
<item name="android:windowSplashScreenBackground">#000000</item>
10+
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
911
</style>
1012
<!-- Theme applied to the Android Window as soon as the process has started.
1113
This theme determines the color of the Android Window while your

android/app/src/main/res/values-v31/styles.xml

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<item name="android:windowFullscreen">false</item>
77
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
88
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
9+
<item name="android:windowSplashScreenBackground">#ffffff</item>
10+
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
911
</style>
1012
<!-- Theme applied to the Android Window as soon as the process has started.
1113
This theme determines the color of the Android Window while your
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="ic_launcher_background">#586CF5</color>
4+
</resources>

flutter_native_splash.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ flutter_native_splash:
5454
# 640 pixels in diameter.
5555
# App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
5656
# 768 pixels in diameter.
57-
#image: assets/android12splash.png
57+
image: images/splash/cuckoo-android.png
5858

5959
# Splash screen background color.
60-
#color: "#42a5f5"
60+
color: "#ffffff"
6161

6262
# App icon background color.
6363
#icon_background_color: "#111111"
@@ -68,8 +68,8 @@ flutter_native_splash:
6868
# The image_dark, color_dark, icon_background_color_dark, and branding_dark set values that
6969
# apply when the device is in dark mode. If they are not specified, the app will use the
7070
# parameters from above.
71-
#image_dark: assets/android12splash-invert.png
72-
#color_dark: "#042a49"
71+
# image_dark: assets/android12splash-invert.png
72+
color_dark: "#000000"
7373
#icon_background_color_dark: "#eeeeee"
7474

7575
# The android, ios and web parameters can be used to disable generating a splash screen on a given

images/splash/cuckoo-android.png

16.6 KB

ios/Podfile.lock

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ PODS:
22
- connectivity_plus (0.0.1):
33
- Flutter
44
- FlutterMacOS
5+
- device_info_plus (0.0.1):
6+
- Flutter
57
- Flutter (1.0.0)
68
- flutter_local_notifications (0.0.1):
79
- Flutter
@@ -36,6 +38,7 @@ PODS:
3638

3739
DEPENDENCIES:
3840
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
41+
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
3942
- Flutter (from `Flutter`)
4043
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
4144
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
@@ -57,6 +60,8 @@ SPEC REPOS:
5760
EXTERNAL SOURCES:
5861
connectivity_plus:
5962
:path: ".symlinks/plugins/connectivity_plus/darwin"
63+
device_info_plus:
64+
:path: ".symlinks/plugins/device_info_plus/ios"
6065
Flutter:
6166
:path: Flutter
6267
flutter_local_notifications:
@@ -86,6 +91,7 @@ EXTERNAL SOURCES:
8691

8792
SPEC CHECKSUMS:
8893
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
94+
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
8995
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
9096
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
9197
flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778

ios/Runner/Info.plist

+60-60
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict>
5-
<key>CADisableMinimumFrameDurationOnPhone</key>
6-
<true/>
7-
<key>CFBundleDevelopmentRegion</key>
8-
<string>$(DEVELOPMENT_LANGUAGE)</string>
9-
<key>CFBundleDisplayName</key>
10-
<string>Cuckoo</string>
11-
<key>CFBundleExecutable</key>
12-
<string>$(EXECUTABLE_NAME)</string>
13-
<key>CFBundleIdentifier</key>
14-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
15-
<key>CFBundleInfoDictionaryVersion</key>
16-
<string>6.0</string>
17-
<key>CFBundleName</key>
18-
<string>cuckoo</string>
19-
<key>CFBundlePackageType</key>
20-
<string>APPL</string>
21-
<key>CFBundleShortVersionString</key>
22-
<string>$(FLUTTER_BUILD_NAME)</string>
23-
<key>CFBundleSignature</key>
24-
<string>????</string>
25-
<key>CFBundleURLTypes</key>
26-
<array>
27-
<dict>
28-
<key>CFBundleURLName</key>
29-
<string>CuckooApp</string>
30-
<key>CFBundleURLSchemes</key>
31-
<array>
32-
<string>cuckoo</string>
33-
</array>
34-
</dict>
35-
</array>
36-
<key>CFBundleVersion</key>
37-
<string>$(FLUTTER_BUILD_NUMBER)</string>
38-
<key>FLTEnableImpeller</key>
39-
<false/>
40-
<key>FlutterDeepLinkingEnabled</key>
41-
<true/>
42-
<key>LSRequiresIPhoneOS</key>
43-
<true/>
44-
<key>UIApplicationSupportsIndirectInputEvents</key>
45-
<true/>
46-
<key>UILaunchStoryboardName</key>
47-
<string>LaunchScreen</string>
48-
<key>UIMainStoryboardFile</key>
49-
<string>Main</string>
50-
<key>UIStatusBarHidden</key>
51-
<false/>
52-
<key>UISupportedInterfaceOrientations</key>
53-
<array>
54-
<string>UIInterfaceOrientationPortrait</string>
55-
</array>
56-
<key>UISupportedInterfaceOrientations~ipad</key>
57-
<array>
58-
<string>UIInterfaceOrientationLandscapeLeft</string>
59-
<string>UIInterfaceOrientationLandscapeRight</string>
60-
<string>UIInterfaceOrientationPortrait</string>
61-
<string>UIInterfaceOrientationPortraitUpsideDown</string>
62-
</array>
63-
</dict>
4+
<dict>
5+
<key>CADisableMinimumFrameDurationOnPhone</key>
6+
<true/>
7+
<key>CFBundleDevelopmentRegion</key>
8+
<string>$(DEVELOPMENT_LANGUAGE)</string>
9+
<key>CFBundleDisplayName</key>
10+
<string>Cuckoo</string>
11+
<key>CFBundleExecutable</key>
12+
<string>$(EXECUTABLE_NAME)</string>
13+
<key>CFBundleIdentifier</key>
14+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
15+
<key>CFBundleInfoDictionaryVersion</key>
16+
<string>6.0</string>
17+
<key>CFBundleName</key>
18+
<string>cuckoo</string>
19+
<key>CFBundlePackageType</key>
20+
<string>APPL</string>
21+
<key>CFBundleShortVersionString</key>
22+
<string>$(FLUTTER_BUILD_NAME)</string>
23+
<key>CFBundleSignature</key>
24+
<string>????</string>
25+
<key>CFBundleURLTypes</key>
26+
<array>
27+
<dict>
28+
<key>CFBundleURLName</key>
29+
<string>CuckooApp</string>
30+
<key>CFBundleURLSchemes</key>
31+
<array>
32+
<string>cuckoo</string>
33+
</array>
34+
</dict>
35+
</array>
36+
<key>CFBundleVersion</key>
37+
<string>$(FLUTTER_BUILD_NUMBER)</string>
38+
<key>FLTEnableImpeller</key>
39+
<false/>
40+
<key>FlutterDeepLinkingEnabled</key>
41+
<true/>
42+
<key>LSRequiresIPhoneOS</key>
43+
<true/>
44+
<key>UIApplicationSupportsIndirectInputEvents</key>
45+
<true/>
46+
<key>UILaunchStoryboardName</key>
47+
<string>LaunchScreen</string>
48+
<key>UIMainStoryboardFile</key>
49+
<string>Main</string>
50+
<key>UIStatusBarHidden</key>
51+
<false/>
52+
<key>UISupportedInterfaceOrientations</key>
53+
<array>
54+
<string>UIInterfaceOrientationPortrait</string>
55+
</array>
56+
<key>UISupportedInterfaceOrientations~ipad</key>
57+
<array>
58+
<string>UIInterfaceOrientationLandscapeLeft</string>
59+
<string>UIInterfaceOrientationLandscapeRight</string>
60+
<string>UIInterfaceOrientationPortrait</string>
61+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
62+
</array>
63+
</dict>
6464
</plist>

lib/src/common/services/constants.dart

+16-5
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@ class Constants {
2727
static const kSessionInvalidErrDesc =
2828
'Your session may have expired or your Internet connection is unstable. Please try logging into Moodle again.';
2929
static const kAuthIncompleteDialog =
30-
'The login is not complete. Try closing your browser and log in again.';
30+
'The login is not complete. Try restarting the app and log in again if this keeps happening.';
31+
static const kAuthTryAgainButton = 'Try Again in External Browser';
3132
static const kTryAgain = 'Try Again';
3233
static const kEventDetailDueItem = 'DUE IN';
3334
static const kEventDetailDetailItem = 'DESCRIPTION';
35+
static const kEventDetailReminderItem = 'REMINDERS';
36+
static const kEventDetailMutedRemindersCompleted =
37+
'Reminders are muted for completed events.';
38+
static const kEventDetailMutedRemindersCustom =
39+
'Reminders are muted for custom events.';
40+
static const kEventDetailNoReminders = 'No reminders applied to this event.';
3441
static const kMarkCompleteToast = 'Event Marked as Completed';
3542
static const kUnmarkCompleteToast = 'Event Unmarked as Completed';
3643
static const kMoodleUrlOpenLoading = 'Launching Moodle website...';
@@ -130,20 +137,22 @@ class Constants {
130137
static const kLearnMore = 'Learn more';
131138
static const kAboutTitle = 'About';
132139
static const kTipTitle = 'Tip Jar';
133-
static const kAccountLearnMoreUrl = 'https://cuckoo-hku.xyz/safety/';
140+
static const kAccountLearnMoreUrl = 'https://cuckoo-hku.xyz/safety';
134141
static const kCheckGithub = 'Check repo on Github';
135142
static const kAboutWebsiteTitle = 'Project Website';
136-
static const kAboutWebsiteUrl = 'https://cuckoo-hku.xyz/';
143+
static const kAboutWebsiteUrl = 'https://cuckoo-hku.xyz';
137144
static const kAboutDiscordTitle = 'Discord Community';
138145
static const kAboutDiscordContent =
139146
'Join our Discord community to leave your thoughts and receive latest updates.';
140147
static const kAboutDiscordUrl = 'https://discord.gg/K9scQKDF';
141148
static const kAboutPrivacyTitle = 'Privacy Policy';
142-
static const kAboutPrivacyUrl = 'https://cuckoo-hku.xyz/privacy/';
149+
static const kAboutPrivacyUrl = 'https://cuckoo-hku.xyz/privacy';
143150
static const kAboutSoftwareLicense = 'Software Licenses';
144-
static const kAboutSoftwareLicenseUrl = 'https://cuckoo-hku.xyz/license/';
151+
static const kAboutSoftwareLicenseUrl = 'https://cuckoo-hku.xyz/license';
145152
static const kProjectGithubUrl =
146153
'https://github.com/thermitex/cuckoo-flutter';
154+
static const kProjectContributorsUrl =
155+
'https://github.com/thermitex/cuckoo-flutter/graphs/contributors';
147156
static const kTipJarTitle =
148157
'Donate any amount to help Cuckoo stay on App Store.';
149158
static const kTipJarSubtitle =
@@ -158,4 +167,6 @@ class Constants {
158167
'Thank you for your tip! Your support means a lot to us.';
159168
static const kTipThankYouDesc =
160169
'We strive to constantly improve Cuckoo for a better user experience. Don\'t forget to join the Discord community to let us know how we can further improve.';
170+
static const kNotiPermissionWarning =
171+
'Cuckoo currently does not have the permission to display notifications, and therfore the reminders here may not work as expected. Please go to Settings and allow notifications from Cuckoo.';
161172
}

lib/src/common/services/moodle.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,14 @@ class Moodle {
175175
/// This method will check if a user has logged in. It will not prompt another
176176
/// authentication process if there is already a logged-in user unless `force`
177177
/// is set to true.
178-
static Future<bool> startAuth({bool force = false}) async {
178+
static Future<bool> startAuth(
179+
{bool force = false, bool internal = true}) async {
179180
if (!force && isUserLoggedIn) return false;
180181
final authUrl = Moodle()._buildLaunchUrl();
181-
return await launchUrl(authUrl, mode: LaunchMode.externalApplication);
182+
return await launchUrl(authUrl,
183+
mode: internal
184+
? LaunchMode.inAppBrowserView
185+
: LaunchMode.externalApplication);
182186
}
183187

184188
/// Handle the authentication result.

lib/src/common/services/reminders.dart

+16-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class Reminders with ChangeNotifier {
5858
final reminders = Reminders();
5959
reminders._prefs = Global.prefs;
6060
reminders._load();
61+
reminders._initTimezoneIfNeeded();
6162
}
6263

6364
// ------------Common interfaces------------
@@ -71,6 +72,11 @@ class Reminders with ChangeNotifier {
7172
// Get reminder at a specific index.
7273
EventReminder reminderAtIndex(int index) => _reminders[index];
7374

75+
/// Reminders applied to a specific event.
76+
List<EventReminder> remindersAppliedToEvent(MoodleEvent event) => _reminders
77+
.where((reminder) => reminder.applicableToEvent(event))
78+
.toList();
79+
7480
/// Create a new reminder for configuration.
7581
static EventReminder create() {
7682
final reminder = EventReminder();
@@ -181,7 +187,7 @@ class Reminders with ChangeNotifier {
181187
const NotificationDetails(
182188
android: AndroidNotificationDetails(
183189
'reminder_noti',
184-
'Reminder notifications',
190+
'Reminders',
185191
importance: Importance.max,
186192
priority: Priority.high,
187193
)),
@@ -323,4 +329,13 @@ extension EventReminderExtenson on EventReminder {
323329
}
324330
return eventTime;
325331
}
332+
333+
/// If the schedule time has passed for an event.
334+
bool scheduleTimePassed(MoodleEvent event) {
335+
try {
336+
return scheduleTime(event).isBefore(tz.TZDateTime.now(tz.local));
337+
} catch (_) {
338+
return false;
339+
}
340+
}
326341
}

lib/src/common/ui/color.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ class ColorPresets {
1010
static const Color black = Colors.black;
1111

1212
static const Color negativePrimary = Color.fromARGB(255, 255, 91, 91);
13-
static const Color negativeTertiary = Color.fromARGB(26, 255, 91, 91);
13+
static const Color negativeTertiary = Color.fromARGB(30, 255, 91, 91);
14+
static const Color warningPrimary = Color.fromARGB(255, 234, 187, 0);
15+
static const Color warningTertiary = Color.fromARGB(30, 255, 204, 0);
1416
static const Color positivePrimary = Color.fromARGB(255, 105, 240, 174);
15-
static const Color positiveTertiary = Color.fromARGB(26, 105, 240, 174);
17+
static const Color positiveTertiary = Color.fromARGB(30, 105, 240, 174);
1618

1719
// ******* Light *******
1820

0 commit comments

Comments
 (0)