Skip to content

Commit

Permalink
Target API level bump 2023-08
Browse files Browse the repository at this point in the history
* Bumped `compileSdk` and `targetSdk` to `33`.
* Bumped `minSdk` to `26`.
* Replaced JCenter with Maven Central.
* Removed analytics.
* Added additional required permissions.
* Cleaned up EasyPermissions code.
* Various misc. changes required by Android now.
  • Loading branch information
thecosmicfrog committed Aug 30, 2023
1 parent fc256d1 commit 1f97b3b
Show file tree
Hide file tree
Showing 28 changed files with 287 additions and 667 deletions.
17 changes: 7 additions & 10 deletions build.gradle
Expand Up @@ -3,26 +3,23 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:8.1.1'

// Firebase
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.gms:google-services:4.3.15'

// Firebase Performance Monitoring plugin
classpath 'com.google.firebase:perf-plugin:1.3.1'
classpath 'com.google.firebase:perf-plugin:1.4.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'

// Crashlytics plugin
classpath 'io.fabric.tools:gradle:1.29.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -34,11 +31,11 @@ plugins {
}

allprojects {
ext.versionCode = 154
ext.versionCode = 169

repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
11 changes: 5 additions & 6 deletions mobile/build.gradle
@@ -1,17 +1,16 @@
import java.text.SimpleDateFormat

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'

android {
compileSdkVersion 29
buildToolsVersion '28.0.3'
compileSdk 33

defaultConfig {
applicationId "org.thecosmicfrog.luasataglance"
minSdkVersion 21
targetSdkVersion 29
minSdk 26
targetSdk 33
versionCode generateVersionCode()
versionName generateVersionName()
}
Expand All @@ -32,6 +31,7 @@ android {
}
productFlavors {
}
namespace 'org.thecosmicfrog.luasataglance'
}

dependencies {
Expand All @@ -47,7 +47,6 @@ dependencies {
api 'com.google.firebase:firebase-core:17.2.1'
api 'com.google.firebase:firebase-messaging:20.0.1'
implementation "androidx.preference:preference:1.1.0"
implementation 'com.google.firebase:firebase-perf:19.0.2'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'pub.devrel:easypermissions:3.0.0'
}
Expand Down
28 changes: 18 additions & 10 deletions mobile/src/main/AndroidManifest.xml
@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.thecosmicfrog.luasataglance">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Expand Down Expand Up @@ -45,7 +48,8 @@

<activity
android:name=".activity.MainActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -69,23 +73,25 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="org.thecosmicfrog.luasataglance.activity.SettingsActivity" />
</activity>
<activity android:name=".widget.StopForecastWidgetConfigureActivity">
<activity android:name=".widget.StopForecastWidgetConfigureActivity"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>

<receiver android:name=".receiver.NotifyTimesReceiver">
<receiver android:name=".receiver.NotifyTimesReceiver" android:exported="true">
<intent-filter>
<action android:name="org.thecosmicfrog.luasataglance.activity.NotifyTimeActivity" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.OnAppUpdateReceiver">
<receiver android:name=".receiver.OnAppUpdateReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
<receiver android:name=".widget.StopForecastWidget">
<receiver android:name=".widget.StopForecastWidget" android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
Expand All @@ -95,7 +101,7 @@
android:resource="@xml/stop_forecast_widget_info" />
</receiver>

<service android:name=".service.WearMessageListenerService">
<service android:name=".service.WearMessageListenerService" android:exported="true">
<intent-filter>
<action
android:name="com.google.android.gms.wearable.BIND_LISTENER"
Expand Down Expand Up @@ -143,12 +149,14 @@
android:theme="@style/Theme.AppCompat.Dialog" />
<service
android:name=".service.MessagingService"
android:enabled="true">
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".service.WearMessageListenerService">
<service android:name=".service.WearMessageListenerService"
android:exported="true">
<intent-filter>
<action
android:name="com.google.android.gms.wearable.BIND_LISTENER"
Expand Down
Expand Up @@ -22,28 +22,22 @@
package org.thecosmicfrog.luasataglance.activity;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import androidx.fragment.app.FragmentActivity;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import org.thecosmicfrog.luasataglance.R;
import org.thecosmicfrog.luasataglance.util.Analytics;

public class AboutActivity extends FragmentActivity {

private final String LOG_TAG = AboutActivity.class.getSimpleName();

@Override
protected void onCreate(Bundle savedInstanceState) {
/*
* If the user is on Lollipop or above, use a Material Dialog theme. Otherwise, fall back to
* the default theme set in AndroidManifest.xml.
*/
if (Build.VERSION.SDK_INT >= 21)
setTheme(android.R.style.Theme_Material_Dialog);
/* Use a Material Dialog theme. */
setTheme(android.R.style.Theme_Material_Dialog);

/* This is a Dialog. Get rid of the default Window title. */
requestWindowFeature(Window.FEATURE_NO_TITLE);
Expand All @@ -52,18 +46,6 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.activity_about);

TextView textViewSourceCode = findViewById(R.id.textview_sourcecode);
textViewSourceCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Analytics.selectContent(
getApplicationContext(),
"link_tapped",
"sourcecode_tapped"
);
}
});

TextView textViewLicense = findViewById(R.id.textview_license);
textViewLicense.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -74,12 +56,6 @@ public void onClick(View v) {
LicenseActivity.class
)
);

Analytics.selectContent(
getApplicationContext(),
"link_tapped",
"license_tapped"
);
}
});
}
Expand Down
Expand Up @@ -77,15 +77,13 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_fares);

/* Set status bar colour. */
if (Build.VERSION.SDK_INT >= 21) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(
ContextCompat.getColor(getApplicationContext(),
R.color.luas_purple_statusbar)
);
}
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(
ContextCompat.getColor(getApplicationContext(),
R.color.luas_purple_statusbar)
);

initializeActivity();
}
Expand Down
Expand Up @@ -58,12 +58,8 @@ public class FavouritesActivity extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
final String TUTORIAL_FAVOURITES = "favourites";

/*
* If the user is on Lollipop or above, use a Material Dialog theme. Otherwise, fall back to
* the default theme set in AndroidManifest.xml.
*/
if (Build.VERSION.SDK_INT >= 21)
setTheme(android.R.style.Theme_Material_Dialog);
/* Use a Material Dialog theme. */
setTheme(android.R.style.Theme_Material_Dialog);

/* This is a Dialog. Get rid of the default Window title. */
requestWindowFeature(Window.FEATURE_NO_TITLE);
Expand Down
Expand Up @@ -50,7 +50,7 @@
import org.thecosmicfrog.luasataglance.object.NotifyTimesMap;
import org.thecosmicfrog.luasataglance.object.StopForecast;
import org.thecosmicfrog.luasataglance.object.StopNameIdMap;
import org.thecosmicfrog.luasataglance.util.Analytics;
import org.thecosmicfrog.luasataglance.util.AppUtil;
import org.thecosmicfrog.luasataglance.util.Constant;
import org.thecosmicfrog.luasataglance.util.Preferences;
import org.thecosmicfrog.luasataglance.util.Settings;
Expand Down Expand Up @@ -240,6 +240,8 @@ public void onResume() {

super.onResume();

AppUtil.resetShouldNotAskAgainIfPermissionsChangedOutsideApp(context);

/* Remove Favourites tutorial if it has been completed once already. */
if (line.equals(Constant.RED_LINE)
&& Preferences.hasRunOnce(context, Constant.TUTORIAL_FAVOURITES)) {
Expand Down Expand Up @@ -859,12 +861,6 @@ public void success(ApiTimes apiTimes, Response response) {
);
}
}
} else {
Analytics.nullApitimes(
context,
"null",
"null_apitimes_mobile"
);
}
}
}
Expand Down Expand Up @@ -910,12 +906,6 @@ public void failure(RetrofitError retrofitError) {
if (retrofitError.getKind() != null) {
Log.e(LOG_TAG, "Kind: " + retrofitError.getKind().toString());
}

Analytics.httpError(
context,
"http_error",
"http_error_general_mobile"
);
}
};

Expand Down Expand Up @@ -952,12 +942,6 @@ private String getApiCreatedTime(ApiTimes apiTimes) {
);
} catch (ParseException e) {
Log.e(LOG_TAG, "Failed to parse created time from API.");

Analytics.apiCreatedParseError(
context,
"api_error",
"api_created_parse_error_mobile"
);
}

return null;
Expand Down

0 comments on commit 1f97b3b

Please sign in to comment.