Skip to content

Commit e00b61b

Browse files
committed
-Migrate material library back to 1.7.0 version and appcompat back to 1.6.0 version.
-Remove font files and style.xml and colors.xml. -Add overload for buildPdfPermissionsRationalDialog method in order to set dialog theme.
1 parent 60c3beb commit e00b61b

File tree

8 files changed

+42
-36
lines changed

8 files changed

+42
-36
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ android {
3030

3131
dependencies {
3232

33-
implementation 'androidx.appcompat:appcompat:1.6.1'
34-
implementation 'com.google.android.material:material:1.8.0'
33+
implementation 'androidx.appcompat:appcompat:1.6.0'
34+
implementation 'com.google.android.material:material:1.7.0'
3535
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
3636
testImplementation 'junit:junit:4.13.2'
3737
androidTestImplementation 'androidx.test.ext:junit:1.1.5'

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Sun Feb 19 02:50:47 IRST 2023
1+
#Fri Feb 24 02:54:04 IRST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
44
distributionPath=wrapper/dists

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ pluginManagement {
33
google()
44
mavenCentral()
55
gradlePluginPortal()
6+
maven { url 'https://jitpack.io' }
67
}
78
}
89
dependencyResolutionManagement {
910
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
1011
repositories {
1112
google()
1213
mavenCentral()
14+
maven { url 'https://jitpack.io' }
1315
}
1416
}
1517
rootProject.name = "WebView To Pdf"

webview-to-pdf/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ afterEvaluate {
4343
from components.release
4444
groupId 'amir-asdp'
4545
artifactId 'webview-to-pdf'
46-
version = '1.0.0'
46+
version = '1.0.1'
4747
}
4848
}
4949
}
5050
}
5151

5252
dependencies {
5353

54-
implementation 'androidx.appcompat:appcompat:1.6.1'
55-
implementation 'com.google.android.material:material:1.8.0'
54+
implementation 'androidx.appcompat:appcompat:1.6.0'
55+
implementation 'com.google.android.material:material:1.7.0'
5656
implementation 'com.karumi:dexter:6.2.3'
5757

5858
testImplementation 'junit:junit:4.13.2'

webview-to-pdf/src/main/java/com/ossoft/webview_to_pdf/WebViewToPdf.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,40 @@ public void onClick(DialogInterface dialog, int which) {
149149
}
150150
};
151151

152-
return new MaterialAlertDialogBuilder(context, R.style.AlertDialogStyle)
152+
return new MaterialAlertDialogBuilder(context)
153+
.setIcon(R.drawable.ic_permission_media)
154+
.setTitle(dialogStrings[0])
155+
.setMessage(dialogStrings[1])
156+
.setPositiveButton(dialogStrings[2], rationalDialogClickListener)
157+
.setNegativeButton(dialogStrings[3], rationalDialogClickListener)
158+
.create();
159+
160+
}
161+
162+
public static AlertDialog buildPdfPermissionsRationalDialog(Context context, String language, int overrideThemeResId){
163+
164+
String[] dialogStrings = context.getResources().getStringArray(R.array.english_permission_rational_dialog);
165+
if (language.equals(PERMISSION_DIALOG_FARSI)){
166+
dialogStrings = context.getResources().getStringArray(R.array.farsi_permission_rational_dialog);
167+
}
168+
169+
DialogInterface.OnClickListener rationalDialogClickListener = new DialogInterface.OnClickListener() {
170+
@Override
171+
public void onClick(DialogInterface dialog, int which) {
172+
if (which == DialogInterface.BUTTON_POSITIVE){
173+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){
174+
context.startActivity(new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION));
175+
}
176+
else {
177+
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
178+
context.startActivity(new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(uri));
179+
}
180+
}
181+
dialog.cancel();
182+
}
183+
};
184+
185+
return new MaterialAlertDialogBuilder(context, overrideThemeResId)
153186
.setIcon(R.drawable.ic_permission_media)
154187
.setTitle(dialogStrings[0])
155188
.setMessage(dialogStrings[1])
-82.1 KB
Binary file not shown.

webview-to-pdf/src/main/res/values/colors.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

webview-to-pdf/src/main/res/values/style.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)