Skip to content

Commit

Permalink
Remove unused resources
Browse files Browse the repository at this point in the history
  • Loading branch information
niteshpatel committed Oct 27, 2022
1 parent 19b9485 commit f6e28d7
Show file tree
Hide file tree
Showing 33 changed files with 384 additions and 669 deletions.
21 changes: 11 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools.build:gradle:7.3.1'
}
}

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

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -31,10 +31,10 @@ android {
}

defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 80
versionName "80"
minSdkVersion 23
targetSdkVersion 33
versionCode 81
versionName "81"
}

buildTypes {
Expand All @@ -43,10 +43,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
lint {
abortOnError false
}
namespace 'nitezh.ministock'

}

dependencies {
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
android.useAndroidX=true
android.enableJetifier=true
org.gradle.unsafe.configuration-cache=true
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat May 11 22:19:40 BST 2019
#Sat Jan 30 12:04:34 GMT 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
40 changes: 25 additions & 15 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
THE SOFTWARE.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="nitezh.ministock">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -37,8 +36,8 @@
<activity
android:name=".activities.MinistocksActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog">
android:theme="@android:style/Theme.Dialog"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -49,7 +48,8 @@
android:name=".activities.PortfolioActivity"
android:configChanges="orientation"
android:label="Portfolio"
android:launchMode="singleInstance">
android:launchMode="singleInstance"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -61,7 +61,8 @@
android:configChanges="orientation"
android:finishOnTaskLaunch="true"
android:label="Preferences"
android:launchMode="singleInstance">
android:launchMode="singleInstance"
android:exported="false">

<intent-filter>
<action android:name="android.intent.action.EDIT" />
Expand All @@ -82,31 +83,35 @@
</activity>
<activity
android:name=".activities.configure.ConfigureActivity1x2"
android:theme="@android:style/Theme.Dialog">
android:theme="@android:style/Theme.Dialog"
android:exported="false">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity
android:name=".activities.configure.ConfigureActivity2x2"
android:theme="@android:style/Theme.Dialog">
android:theme="@android:style/Theme.Dialog"
android:exported="false">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity
android:name=".activities.configure.ConfigureActivity1x4"
android:theme="@android:style/Theme.Dialog">
android:theme="@android:style/Theme.Dialog"
android:exported="false">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
<activity
android:name=".activities.configure.ConfigureActivity2x4"
android:theme="@android:style/Theme.Dialog">
android:theme="@android:style/Theme.Dialog"
android:exported="false">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
Expand All @@ -117,7 +122,8 @@
android:configChanges="orientation"
android:excludeFromRecents="true"
android:launchMode="singleTop"
android:theme="@android:style/Theme.NoTitleBar">
android:theme="@android:style/Theme.NoTitleBar"
android:exported="false">

<intent-filter>
<action android:name="android.intent.action.EDIT" />
Expand Down Expand Up @@ -147,7 +153,8 @@
<!-- Receivers -->
<receiver
android:name=".WidgetProvider"
android:label="Ministocks">
android:label="Ministocks"
android:exported="true">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
Expand All @@ -159,7 +166,8 @@
</receiver>
<receiver
android:name=".activities.widget.WidgetProvider1x4"
android:label="Ministocks (wide)">
android:label="Ministocks (wide)"
android:exported="true">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
Expand All @@ -171,7 +179,8 @@
</receiver>
<receiver
android:name=".activities.widget.WidgetProvider2x2"
android:label="Ministocks (tall)">
android:label="Ministocks (tall)"
android:exported="true">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
Expand All @@ -183,7 +192,8 @@
</receiver>
<receiver
android:name=".activities.widget.WidgetProvider2x4"
android:label="Ministocks (wide/tall)">
android:label="Ministocks (wide/tall)"
android:exported="true">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/nitezh/ministock/BackupAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,15 @@ public void onCreate() {
}

@Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
ParcelFileDescriptor newState) throws IOException {
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) throws IOException {
// Hold the lock while the FileBackupHelper performs backup
synchronized (UserData.sFileBackupLock) {
super.onBackup(oldState, data, newState);
}
}

@Override
public void onRestore(BackupDataInput data, int appVersionCode,
ParcelFileDescriptor newState) throws IOException {
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
// Hold the lock while the FileBackupHelper restores the file
synchronized (UserData.sFileBackupLock) {
super.onRestore(data, appVersionCode, newState);
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/nitezh/ministock/CustomAlarmManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,21 @@ public CustomAlarmManager(Context context) {
this.appStorage = PreferenceStorage.getInstance(context);
this.alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent("UPDATE", null, context, WidgetProvider.class);
this.pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
this.pendingIntent = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);
}

private Long getUpdateInterval() {
return Long.parseLong((this.appStorage.getString("update_interval",
Long.toString(AlarmManager.INTERVAL_HALF_HOUR))));
return Long.parseLong((this.appStorage.getString("update_interval", Long.toString(AlarmManager.INTERVAL_HALF_HOUR))));
}

private int getTimeToNextUpdate(Long updateInterval) {
Double timeToNextUpdate = updateInterval.doubleValue();
Double elapsedTime = DateTools.elapsedTime(this.appStorage.getString("last_update1", null));
double timeToNextUpdate = updateInterval.doubleValue();
double elapsedTime = DateTools.elapsedTime(this.appStorage.getString("last_update1", null));
if (elapsedTime > 0) {
timeToNextUpdate = Math.max(updateInterval - elapsedTime, 0);
}

return timeToNextUpdate.intValue();
return (int) timeToNextUpdate;
}

public void setUpdateTimestamp() {
Expand All @@ -77,8 +76,7 @@ public void reinitialize() {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.MILLISECOND, this.getTimeToNextUpdate(updateInterval));
alarmManager.setInexactRepeating(AlarmManager.RTC, calendar.getTimeInMillis(),
updateInterval, pendingIntent);
alarmManager.setInexactRepeating(AlarmManager.RTC, calendar.getTimeInMillis(), updateInterval, pendingIntent);
}

public void cancel() {
Expand Down
Loading

0 comments on commit f6e28d7

Please sign in to comment.