GPS Status: animation icon for ready but not fixed status (GPS bad signal).

This commit is contained in:
Román
2020-08-13 11:08:55 +02:00
committed by Román Martínez
parent 2b90bfd054
commit 80a8017a18
3 changed files with 42 additions and 1 deletions
@@ -24,6 +24,7 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.location.LocationManager;
import android.os.Bundle;
import android.provider.Settings;
@@ -467,6 +468,9 @@ public class TrackListActivity extends AbstractListActivity implements ConfirmDe
if (!isRecording) {
startGpsMenuItem.setTitle(isGpsStarted ? R.string.menu_stop_gps : R.string.menu_start_gps);
startGpsMenuItem.setIcon(isGpsStarted ? gpsStatusValue.icon : R.drawable.ic_gps_off_24dp);
if (startGpsMenuItem.getIcon() instanceof AnimatedVectorDrawable) {
((AnimatedVectorDrawable) startGpsMenuItem.getIcon()).start();
}
}
}
}
@@ -10,7 +10,7 @@ public enum GpsStatusValue {
GPS_ENABLED(R.drawable.ic_gps_not_fixed_24dp, R.string.gps_wait_for_signal),
GPS_DISABLED(R.drawable.ic_gps_off_24dp, R.string.gps_disabled_msg),
GPS_SIGNAL_FIX(R.drawable.ic_gps_fixed_24dp, R.string.gps_fixed_and_ready),
GPS_SIGNAL_BAD(R.drawable.ic_gps_fixed_24dp, R.string.gps_wait_for_better_signal),
GPS_SIGNAL_BAD(R.drawable.ic_gps_ready_animation, R.string.gps_wait_for_better_signal),
GPS_SIGNAL_LOST(R.drawable.ic_gps_not_fixed_24dp, R.string.gps_wait_for_signal);
public final int icon;
@@ -0,0 +1,37 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:name="vector"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF">
<path
android:name="path"
android:pathData="M 20.94 11 C 20.48 6.83 17.17 3.52 13 3.06 L 13 1 L 11 1 L 11 3.06 C 6.83 3.52 3.52 6.83 3.06 11 L 1 11 L 1 13 L 3.06 13 C 3.52 17.17 6.83 20.48 11 20.94 L 11 23 L 13 23 L 13 20.94 C 17.17 20.48 20.48 17.17 20.94 13 L 23 13 L 23 11 L 20.94 11 Z M 12 19 C 8.13 19 5 15.87 5 12 C 5 8.13 8.13 5 12 5 C 15.87 5 19 8.13 19 12 C 19 15.87 15.87 19 12 19 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
<path
android:name="path_1"
android:pathData="M 12 8 C 10.94 8 9.921 8.422 9.172 9.172 C 8.422 9.921 8 10.94 8 12 C 8 13.06 8.422 14.079 9.172 14.828 C 9.921 15.578 10.94 16 12 16 C 13.06 16 14.079 15.578 14.828 14.828 C 15.578 14.079 16 13.06 16 12 C 16 10.94 15.578 9.921 14.828 9.172 C 14.079 8.422 13.06 8 12 8 Z"
android:fillColor="#000001"
android:strokeWidth="1"/>
</vector>
</aapt:attr>
<target android:name="path_1">
<aapt:attr name="android:animation">
<objectAnimator
android:propertyName="fillAlpha"
android:duration="2000"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType"
android:interpolator="@android:anim/linear_interpolator"
android:repeatCount="infinite"
android:repeatMode="restart"/>
</aapt:attr>
</target>
</animated-vector>