Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made to work in 2023 Android Studio and SDK 33 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
compileSdk 33
buildToolsVersion '33.0.0'

defaultConfig {
applicationId "com.em.batterywidget"
minSdkVersion 8
targetSdkVersion 21
minSdk 29
targetSdk 33
versionCode 1
versionName "1.0"
}
Expand All @@ -21,7 +21,7 @@ android {
}

dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:21.0.0'
compile files('libs/achartengine-1.0.0.jar')
implementation files('libs/achartengine-1.2.0.jar')
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.appcompat:appcompat:1.6.0'
}
Binary file removed app/libs/achartengine-1.0.0.jar
Binary file not shown.
Binary file added app/libs/achartengine-1.2.0.jar
Binary file not shown.
9 changes: 6 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@
android:theme="@style/AppTheme">
<activity
android:name=".WidgetActivity"
android:label="@string/app_name">
android:label="@string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

<receiver android:name=".BatteryWidget">
<receiver android:name=".BatteryWidget"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
Expand All @@ -49,7 +51,8 @@

<receiver
android:name=".BootReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/em/batterywidget/UpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private RemoteViews createRemoteViews(final int level, final boolean isCharging)
View.VISIBLE : View.INVISIBLE);
remoteViews.setTextViewText(R.id.batterytext, String.valueOf(level) + "%");
Intent activityIntent = new Intent(this, WidgetActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, activityIntent, 0);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, activityIntent, PendingIntent.FLAG_IMMUTABLE );
remoteViews.setOnClickPendingIntent(R.id.widget_view, pendingIntent);
return remoteViews;
}
Expand Down
19 changes: 4 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

allprojects {
repositories {
jcenter()
}
}
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Wed Oct 21 11:34:03 PDT 2015
#Mon Jan 30 11:56:18 GMT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
zipStoreBase=GRADLE_USER_HOME

15 changes: 15 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Android-Battery-Widget"
include ':app'