Skip to content

Commit

Permalink
Update to v3.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
GrazianoCapelli committed Mar 25, 2022
2 parents 3f2b789 + 10601e6 commit 7bf54a5
Show file tree
Hide file tree
Showing 25 changed files with 796 additions and 302 deletions.
Binary file added apk/GPSLogger-3.1.4.apk
Binary file not shown.
Binary file modified apk/GPSLogger-latest.apk
Binary file not shown.
33 changes: 14 additions & 19 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,19 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
buildToolsVersion '30.0.3'

lintOptions {
//checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileSdkVersion 32
buildToolsVersion '32.0.0'

aaptOptions {
// Disable PNG Crunching
cruncherEnabled = false
}

defaultConfig {
applicationId "eu.basicairdata.graziano.gpslogger"
minSdkVersion 14
targetSdkVersion 30
targetSdkVersion 32

// -----------------------------------------------------------------------------------------
// We use the Semantic Versioning (https://semver.org/):
versionName '3.1.3'
versionCode 44
versionName '3.1.4'
versionCode 45
// -----------------------------------------------------------------------------------------

vectorDrawables.useSupportLibrary = true
Expand All @@ -60,6 +49,7 @@ android {
buildTypes {
debug {
minifyEnabled false
crunchPngs false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

Expand All @@ -68,21 +58,26 @@ android {
}
release {
minifyEnabled false
crunchPngs false
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

lint {
abortOnError false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.13.2'

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.android.material:material:1.5.0'

implementation 'com.github.bumptech.glide:glide:3.8.0'

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.basicairdata.graziano.gpslogger">

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Expand Down Expand Up @@ -59,7 +61,6 @@
android:supportsRtl="true">

<activity android:name=".GPSActivity"
android:label="@string/app_name"
android:exported="true"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan" >
Expand Down Expand Up @@ -90,7 +91,8 @@
android:resource="@xml/filepaths" />
</provider>

<receiver android:name=".ActionsBroadcastReceiver">
<receiver android:name=".ActionsBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package eu.basicairdata.graziano.gpslogger;

import static android.content.Context.POWER_SERVICE;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
Expand All @@ -32,12 +34,16 @@
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import android.os.PowerManager;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView;
Expand Down Expand Up @@ -93,7 +99,9 @@ public class FragmentGPSFix extends Fragment {
private CardView cvWarningLocationDenied;
private CardView cvWarningGPSDisabled;
private CardView cvWarningBackgroundRestricted;
private CardView cvWarningBatteryOptimised;
private LinearLayout llTimeSatellites;
private ImageView iwWarningBatteryOptimisedClose;

private PhysicalData phdLatitude;
private PhysicalData phdLongitude;
Expand All @@ -110,6 +118,7 @@ public class FragmentGPSFix extends Fragment {
private boolean EGMAltitudeCorrection;
private boolean isValidAltitude;
private boolean isBackgroundActivityRestricted;
private PowerManager powerManager;

/**
* The Observer that calculate the new available height when the layout is changed.
Expand Down Expand Up @@ -185,6 +194,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
cvWarningLocationDenied = view.findViewById(R.id.card_view_warning_location_denied);
cvWarningGPSDisabled = view.findViewById(R.id.card_view_warning_enable_location_service);
cvWarningBackgroundRestricted = view.findViewById(R.id.card_view_warning_background_restricted);
cvWarningBatteryOptimised = view.findViewById(R.id.card_view_warning_battery_optimised);

// TableLayouts
tlCoordinates = view.findViewById(R.id.id_TableLayout_Coordinates) ;
Expand All @@ -195,9 +205,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
tlTime = view.findViewById(R.id.id_TableLayout_Time);
tlSatellites = view.findViewById(R.id.id_TableLayout_Satellites);

// ImageViews

iwWarningBatteryOptimisedClose = view.findViewById(R.id.id_warning_battery_optimised_close);

// LinearLayouts
llTimeSatellites = view.findViewById(R.id.id_linearLayout_Time_Satellites);

powerManager = (PowerManager) gpsApp.getSystemService(POWER_SERVICE);

cvWarningGPSDisabled.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -215,6 +231,14 @@ public void onClick(View v) {
}
});

iwWarningBatteryOptimisedClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gpsApp.setBatteryOptimisedWarningVisible(false);
update();
}
});

cvWarningBackgroundRestricted.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -235,6 +259,25 @@ public void onClick(View v) {
}
});

cvWarningBatteryOptimised.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isAWarningClicked && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)) {
isAWarningClicked = true;
// Go to Settings screen
Intent intent = new Intent();
intent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);

try {
getContext().startActivity(intent);
} catch (Exception e) {
isAWarningClicked = false;
// Unable to open Intent
}
}
}
});

cvWarningLocationDenied.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -351,6 +394,7 @@ public void update() {

tvGPSFixStatus.setVisibility(View.INVISIBLE);
cvWarningBackgroundRestricted.setVisibility(View.GONE);
cvWarningBatteryOptimised.setVisibility(View.GONE);
cvWarningGPSDisabled.setVisibility(View.GONE);
cvWarningLocationDenied.setVisibility(View.GONE);
} else {
Expand Down Expand Up @@ -394,6 +438,14 @@ public void update() {
cvWarningBackgroundRestricted.setVisibility(View.GONE);
}

if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
&& !powerManager.isIgnoringBatteryOptimizations(gpsApp.getPackageName())
&& gpsApp.isBatteryOptimisedWarningVisible()) {
cvWarningBatteryOptimised.setVisibility(View.VISIBLE);
} else {
cvWarningBatteryOptimised.setVisibility(View.GONE);
}

if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
tvGPSFixStatus.setText(R.string.gps_not_accessible);
cvWarningLocationDenied.setVisibility(View.VISIBLE);
Expand Down
Loading

0 comments on commit 7bf54a5

Please sign in to comment.