Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Migrated to Material3 design #359

Open
wants to merge 4 commits 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
11 changes: 6 additions & 5 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 30
compileSdkVersion 33
testOptions.unitTests.includeAndroidResources = true

defaultConfig {
applicationId "pub.devrel.easypermissions.sample"
minSdkVersion 14
targetSdkVersion 30
targetSdkVersion 33
versionCode 1
versionName "1.0"
}
Expand All @@ -29,7 +29,8 @@ android {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.annotation:annotation:1.1.0"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.annotation:annotation:1.6.0"
implementation 'com.google.android.material:material:1.8.0'
implementation project(':easypermissions')
}
}
9 changes: 6 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

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

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
tools:ignore="CoarseFineLocation" />
<uses-permission android:name="android.permission.READ_CONTACTS" />

<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />

<application
android:label="@string/app_name"
Expand All @@ -20,7 +22,8 @@
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">

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

Expand Down
6 changes: 2 additions & 4 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.Material3.DayNight">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

</style>

</resources>
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
buildscript {
ext.kotlin_version = '1.8.0'

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

dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

plugins {
id 'org.jetbrains.dokka' version '1.4.20'
}


allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}
Expand Down
20 changes: 14 additions & 6 deletions easypermissions/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

// See: https://github.com/vanniktech/gradle-maven-publish-plugin/issues/206
ext {
Expand All @@ -9,12 +10,12 @@ ext {
apply plugin: 'com.vanniktech.maven.publish'

android {
compileSdkVersion 30
compileSdkVersion 33
testOptions.unitTests.includeAndroidResources = true

defaultConfig {
minSdkVersion 14
targetSdkVersion 30
targetSdkVersion 33
versionCode 1
versionName "3.0.0"
}
Expand All @@ -38,10 +39,13 @@ android {
}

dependencies {
api "androidx.appcompat:appcompat:1.1.0"
api "androidx.annotation:annotation:1.1.0"
api "androidx.core:core:1.3.0"
api "androidx.fragment:fragment:1.2.5"
api "androidx.appcompat:appcompat:1.6.1"
api "androidx.annotation:annotation:1.6.0"
api "androidx.core:core:1.10.0"
api "androidx.fragment:fragment:1.5.7"

implementation "com.google.android.material:material:1.8.0"
implementation(platform("org.jetbrains.kotlin:kotlin-bom:$kotlin_version"))

testImplementation 'junit:junit:4.13'
testImplementation 'com.google.truth:truth:0.42'
Expand All @@ -50,3 +54,7 @@ dependencies {
testImplementation 'androidx.fragment:fragment-testing:1.2.5'
testImplementation 'org.mockito:mockito-core:2.23.4'
}

repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;

/**
* Dialog to prompt the user to go to the app's settings screen and enable permissions. If the user
* clicks 'OK' on the dialog, they are sent to the settings screen. The result is returned to the
Expand Down Expand Up @@ -136,11 +138,11 @@ public void show() {
*/
AlertDialog showDialog(DialogInterface.OnClickListener positiveListener,
DialogInterface.OnClickListener negativeListener) {
AlertDialog.Builder builder;
MaterialAlertDialogBuilder builder;
if (mThemeResId != -1) {
builder = new AlertDialog.Builder(mContext, mThemeResId);
builder = new MaterialAlertDialogBuilder(mContext, mThemeResId);
} else {
builder = new AlertDialog.Builder(mContext);
builder = new MaterialAlertDialogBuilder(mContext);
}
return builder
.setCancelable(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import androidx.annotation.StyleRes;
import androidx.appcompat.app.AlertDialog;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;

/**
* Configuration for either {@link RationaleDialogFragment} or {@link RationaleDialogFragmentCompat}.
*/
Expand Down Expand Up @@ -63,11 +65,11 @@ Bundle toBundle() {
}

AlertDialog createSupportDialog(Context context, Dialog.OnClickListener listener) {
AlertDialog.Builder builder;
MaterialAlertDialogBuilder builder;
if (theme > 0) {
builder = new AlertDialog.Builder(context, theme);
builder = new MaterialAlertDialogBuilder(context, theme);
} else {
builder = new AlertDialog.Builder(context);
builder = new MaterialAlertDialogBuilder(context);
}
return builder
.setCancelable(false)
Expand Down
6 changes: 2 additions & 4 deletions easypermissions/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="EasyPermissions" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<style name="EasyPermissions" parent="Theme.Material3.DayNight">

</style>

<style name="EasyPermissions.Transparent">
Expand Down
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Apr 24 21:29:15 IST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME