Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
Super PDF Reader
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Super PDF Reader
Commits
8214428f
Commit
8214428f
authored
Jul 02, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...master需同步到功能...
parent
eb1214ae
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
793 additions
and
75 deletions
+793
-75
build.gradle
app/build.gradle
+1
-0
ExampleInstrumentedTest.kt
...t/java/com/base/superpdfreader/ExampleInstrumentedTest.kt
+0
-24
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+21
-15
SplashActivity.kt
...n/java/com/base/superpdfreader/activity/SplashActivity.kt
+127
-0
ConstObject.kt
...src/main/java/com/base/superpdfreader/bean/ConstObject.kt
+6
-0
DocumentListFragment.kt
.../com/base/superpdfreader/fragment/DocumentListFragment.kt
+20
-11
SPUtils.java
app/src/main/java/com/base/superpdfreader/utils/SPUtils.java
+439
-0
DialogViews.kt
...src/main/java/com/base/superpdfreader/view/DialogViews.kt
+7
-2
PDFSaveDialog.kt
...c/main/java/com/base/superpdfreader/view/PDFSaveDialog.kt
+3
-0
shape_splash_s.xml
app/src/main/res/drawable/shape_splash_s.xml
+25
-0
splash_bp.xml
app/src/main/res/drawable/splash_bp.xml
+11
-0
activity_splash.xml
app/src/main/res/layout/activity_splash.xml
+118
-0
dialog_pdf_save.xml
app/src/main/res/layout/dialog_pdf_save.xml
+13
-5
dialog_permisson_open.xml
app/src/main/res/layout/dialog_permisson_open.xml
+1
-0
qdylogo.png
app/src/main/res/mipmap-xxhdpi/qdylogo.png
+0
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-1
ExampleUnitTest.kt
app/src/test/java/com/base/superpdfreader/ExampleUnitTest.kt
+0
-17
No files found.
app/build.gradle
View file @
8214428f
...
@@ -8,6 +8,7 @@ android {
...
@@ -8,6 +8,7 @@ android {
compileSdk
34
compileSdk
34
defaultConfig
{
defaultConfig
{
//com.pdfninja.pdfreaderandimagetopdf.bmw
applicationId
"com.base.superpdfreader"
applicationId
"com.base.superpdfreader"
minSdk
26
minSdk
26
targetSdk
34
targetSdk
34
...
...
app/src/androidTest/java/com/base/superpdfreader/ExampleInstrumentedTest.kt
deleted
100644 → 0
View file @
eb1214ae
package
com.base.superpdfreader
import
androidx.test.platform.app.InstrumentationRegistry
import
androidx.test.ext.junit.runners.AndroidJUnit4
import
org.junit.Test
import
org.junit.runner.RunWith
import
org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith
(
AndroidJUnit4
::
class
)
class
ExampleInstrumentedTest
{
@Test
fun
useAppContext
()
{
// Context of the app under test.
val
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
targetContext
assertEquals
(
"com.base.superpdfreader"
,
appContext
.
packageName
)
}
}
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
8214428f
...
@@ -19,6 +19,27 @@
...
@@ -19,6 +19,27 @@
android:theme=
"@style/Theme.SuperPDFReader"
android:theme=
"@style/Theme.SuperPDFReader"
tools:targetApi=
"33"
>
tools:targetApi=
"33"
>
<activity
android:name=
".activity.SplashActivity"
android:exported=
"true"
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".MainActivity"
android:exported=
"true"
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
>
</activity>
<activity
<activity
android:name=
".activity.PdfConvertedActivity"
android:name=
".activity.PdfConvertedActivity"
android:exported=
"false"
android:exported=
"false"
...
@@ -55,19 +76,6 @@
...
@@ -55,19 +76,6 @@
android:launchMode=
"singleTop"
android:launchMode=
"singleTop"
android:screenOrientation=
"portrait"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".MainActivity"
android:exported=
"true"
android:launchMode=
"singleTask"
android:screenOrientation=
"portrait"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<provider
<provider
android:name=
"androidx.core.content.FileProvider"
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"${applicationId}.fileProvider"
android:authorities=
"${applicationId}.fileProvider"
...
@@ -81,8 +89,6 @@
...
@@ -81,8 +89,6 @@
<meta-data
<meta-data
android:name=
"com.facebook.sdk.ApplicationId"
android:name=
"com.facebook.sdk.ApplicationId"
android:value=
"@string/facebook_app_id"
/>
android:value=
"@string/facebook_app_id"
/>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/com/base/superpdfreader/activity/SplashActivity.kt
0 → 100644
View file @
8214428f
package
com.base.superpdfreader.activity
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.net.Uri
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.style.UnderlineSpan
import
android.view.View
import
androidx.lifecycle.lifecycleScope
import
com.base.superpdfreader.MainActivity
import
com.base.superpdfreader.bean.ConstObject.PrivacyPolicy
import
com.base.superpdfreader.databinding.ActivitySplashBinding
import
com.base.superpdfreader.helps.BaseActivity
import
com.base.superpdfreader.utils.BarUtils
import
com.base.superpdfreader.utils.SPUtils
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.channels.BufferOverflow
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.flow.MutableSharedFlow
import
kotlinx.coroutines.flow.SharedFlow
import
kotlinx.coroutines.flow.collectLatest
import
kotlinx.coroutines.isActive
import
kotlinx.coroutines.launch
import
kotlin.random.Random
@SuppressLint
(
"CustomSplashScreen"
)
class
SplashActivity
:
BaseActivity
<
ActivitySplashBinding
>()
{
private
var
job
:
Job
?
=
null
private
val
progress
=
MutableSharedFlow
<
Int
>()
private
val
progressFlow
:
SharedFlow
<
Int
>
=
progress
private
var
oneClickStart
:
Boolean
=
false
var
ifAgreePrivacy
=
false
get
()
{
return
SPUtils
.
getInstance
().
getBoolean
(
"ifAgreePrivacy"
,
field
)
}
set
(
value
)
{
field
=
value
SPUtils
.
getInstance
().
put
(
"ifAgreePrivacy"
,
value
,
true
)
}
override
val
binding
:
ActivitySplashBinding
by
lazy
{
ActivitySplashBinding
.
inflate
(
layoutInflater
)
}
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
jumpNext
()
if
(
ifAgreePrivacy
)
{
startProgress
()
binding
.
llStart
.
visibility
=
View
.
GONE
binding
.
llProgress
.
visibility
=
View
.
VISIBLE
}
else
{
binding
.
llStart
.
visibility
=
View
.
VISIBLE
binding
.
llProgress
.
visibility
=
View
.
GONE
}
val
spannableString
=
SpannableString
(
"Privacy Policy"
)
spannableString
.
setSpan
(
UnderlineSpan
(),
0
,
spannableString
.
length
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
binding
.
idTvPrivacyPolicy
.
text
=
spannableString
binding
.
idTvPrivacyPolicy
.
setOnClickListener
{
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
PrivacyPolicy
)
)
startActivity
(
intent
)
}
}
private
fun
jumpNext
()
{
lifecycleScope
.
launch
{
progressFlow
.
collectLatest
{
if
(
it
>=
100
)
{
startActivity
(
Intent
(
this
@SplashActivity
,
MainActivity
::
class
.
java
))
finish
()
}
}
}
}
override
fun
initListener
()
{
binding
.
idTvStart
.
setOnClickListener
{
if
(
oneClickStart
)
{
return
@setOnClickListener
}
oneClickStart
=
true
ifAgreePrivacy
=
true
binding
.
llStart
.
visibility
=
View
.
GONE
binding
.
llProgress
.
visibility
=
View
.
VISIBLE
startProgress
()
}
}
fun
startProgress
()
=
lifecycleScope
.
launch
{
while
(
isActive
)
{
delay
(
Random
.
nextLong
(
50
,
150
))
val
value
=
binding
.
pb
.
progress
+
Random
.
nextInt
(
3
,
5
)
binding
.
pb
.
setProgress
(
value
,
true
)
progress
.
emit
(
value
)
}
}
override
fun
onResume
()
{
super
.
onResume
()
if
(
ifAgreePrivacy
)
{
job
=
startProgress
()
}
}
override
fun
onPause
()
{
super
.
onPause
()
job
?.
cancel
()
}
}
\ No newline at end of file
app/src/main/java/com/base/superpdfreader/bean/ConstObject.kt
0 → 100644
View file @
8214428f
package
com.base.superpdfreader.bean
object
ConstObject
{
const
val
PrivacyPolicy
=
"https://sites.google.com/view/pdfreaderimagetopdf/pdf-reader-image-to-pdf"
}
\ No newline at end of file
app/src/main/java/com/base/superpdfreader/fragment/DocumentListFragment.kt
View file @
8214428f
...
@@ -16,6 +16,7 @@ import com.base.superpdfreader.helps.PermissionHelp.requestStorePermission
...
@@ -16,6 +16,7 @@ import com.base.superpdfreader.helps.PermissionHelp.requestStorePermission
import
com.base.superpdfreader.view.DialogViews.showGerPermission
import
com.base.superpdfreader.view.DialogViews.showGerPermission
import
com.base.superpdfreader.view.DocumentDetailDialog.showDocumentDetailDialog
import
com.base.superpdfreader.view.DocumentDetailDialog.showDocumentDetailDialog
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
java.io.File
import
java.io.File
...
@@ -78,7 +79,7 @@ class DocumentListFragment() : BaseFragment<FragmentDocumentListBinding>() {
...
@@ -78,7 +79,7 @@ class DocumentListFragment() : BaseFragment<FragmentDocumentListBinding>() {
override
fun
setListener
()
{
override
fun
setListener
()
{
binding
.
tvAllow
.
setOnClickListener
{
binding
.
tvAllow
.
setOnClickListener
{
val
launcher
=
(
requireActivity
()
as
MainActivity
).
launcher
val
launcher
=
(
requireActivity
()
as
MainActivity
).
launcher
if
(
dialog
==
null
)
{
dialog
=
requireContext
().
showGerPermission
(
null
,
deny
=
{},
allow
=
{
dialog
=
requireContext
().
showGerPermission
(
null
,
deny
=
{},
allow
=
{
requireContext
().
requestStorePermission
(
launcher
,
requireContext
().
requestStorePermission
(
launcher
,
jumpAction
=
{},
jumpAction
=
{},
...
@@ -87,12 +88,17 @@ class DocumentListFragment() : BaseFragment<FragmentDocumentListBinding>() {
...
@@ -87,12 +88,17 @@ class DocumentListFragment() : BaseFragment<FragmentDocumentListBinding>() {
initData
()
initData
()
}
}
)
)
})
},
dismiss
=
{
dialog
=
null
})
}
}
}
binding
.
swipeRefresh
.
setOnRefreshListener
{
binding
.
swipeRefresh
.
setOnRefreshListener
{
lifecycleScope
.
launch
{
delay
(
2000
)
binding
.
swipeRefresh
.
isRefreshing
=
false
binding
.
swipeRefresh
.
isRefreshing
=
false
initData
()
}
}
}
}
}
...
@@ -153,6 +159,9 @@ class DocumentListFragment() : BaseFragment<FragmentDocumentListBinding>() {
...
@@ -153,6 +159,9 @@ class DocumentListFragment() : BaseFragment<FragmentDocumentListBinding>() {
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
binding
.
llPermission
.
isVisible
=
!
requireContext
().
checkStorePermission
()
binding
.
llPermission
.
isVisible
=
!
requireContext
().
checkStorePermission
()
if
(
requireContext
().
checkStorePermission
())
{
initData
()
}
}
}
companion
object
{
companion
object
{
...
...
app/src/main/java/com/base/superpdfreader/utils/SPUtils.java
0 → 100644
View file @
8214428f
package
com
.
base
.
superpdfreader
.
utils
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
androidx.annotation.NonNull
;
import
com.base.superpdfreader.helps.BaseApplication
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
@SuppressLint
(
"ApplySharedPref"
)
public
final
class
SPUtils
{
private
static
final
Map
<
String
,
SPUtils
>
SP_UTILS_MAP
=
new
HashMap
<>();
private
SharedPreferences
sp
;
/**
* Return the single {@link SPUtils} instance
*
* @return the single {@link SPUtils} instance
*/
public
static
SPUtils
getInstance
()
{
return
getInstance
(
""
,
Context
.
MODE_PRIVATE
);
}
/**
* Return the single {@link SPUtils} instance
*
* @param mode Operating mode.
* @return the single {@link SPUtils} instance
*/
public
static
SPUtils
getInstance
(
final
int
mode
)
{
return
getInstance
(
""
,
mode
);
}
/**
* Return the single {@link SPUtils} instance
*
* @param spName The name of sp.
* @return the single {@link SPUtils} instance
*/
public
static
SPUtils
getInstance
(
String
spName
)
{
return
getInstance
(
spName
,
Context
.
MODE_PRIVATE
);
}
/**
* Return the single {@link SPUtils} instance
*
* @param spName The name of sp.
* @param mode Operating mode.
* @return the single {@link SPUtils} instance
*/
public
static
SPUtils
getInstance
(
String
spName
,
final
int
mode
)
{
if
(
isSpace
(
spName
))
spName
=
"spUtils"
;
SPUtils
spUtils
=
SP_UTILS_MAP
.
get
(
spName
);
if
(
spUtils
==
null
)
{
synchronized
(
SPUtils
.
class
)
{
spUtils
=
SP_UTILS_MAP
.
get
(
spName
);
if
(
spUtils
==
null
)
{
spUtils
=
new
SPUtils
(
spName
,
mode
);
SP_UTILS_MAP
.
put
(
spName
,
spUtils
);
}
}
}
return
spUtils
;
}
private
SPUtils
(
final
String
spName
)
{
sp
=
BaseApplication
.
context
.
getSharedPreferences
(
spName
,
Context
.
MODE_PRIVATE
);
}
private
SPUtils
(
final
String
spName
,
final
int
mode
)
{
sp
=
BaseApplication
.
context
.
getSharedPreferences
(
spName
,
mode
);
}
/**
* Put the string value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
*/
public
void
put
(
@NonNull
final
String
key
,
final
String
value
)
{
put
(
key
,
value
,
false
);
}
/**
* Put the string value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
put
(
@NonNull
final
String
key
,
final
String
value
,
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
putString
(
key
,
value
).
commit
();
}
else
{
sp
.
edit
().
putString
(
key
,
value
).
apply
();
}
}
/**
* Return the string value in sp.
*
* @param key The key of sp.
* @return the string value if sp exists or {@code ""} otherwise
*/
public
String
getString
(
@NonNull
final
String
key
)
{
return
getString
(
key
,
""
);
}
/**
* Return the string value in sp.
*
* @param key The key of sp.
* @param defaultValue The default value if the sp doesn't exist.
* @return the string value if sp exists or {@code defaultValue} otherwise
*/
public
String
getString
(
@NonNull
final
String
key
,
final
String
defaultValue
)
{
return
sp
.
getString
(
key
,
defaultValue
);
}
/**
* Put the int value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
*/
public
void
put
(
@NonNull
final
String
key
,
final
int
value
)
{
put
(
key
,
value
,
false
);
}
/**
* Put the int value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
put
(
@NonNull
final
String
key
,
final
int
value
,
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
putInt
(
key
,
value
).
commit
();
}
else
{
sp
.
edit
().
putInt
(
key
,
value
).
apply
();
}
}
/**
* Return the int value in sp.
*
* @param key The key of sp.
* @return the int value if sp exists or {@code -1} otherwise
*/
public
int
getInt
(
@NonNull
final
String
key
)
{
return
getInt
(
key
,
-
1
);
}
/**
* Return the int value in sp.
*
* @param key The key of sp.
* @param defaultValue The default value if the sp doesn't exist.
* @return the int value if sp exists or {@code defaultValue} otherwise
*/
public
int
getInt
(
@NonNull
final
String
key
,
final
int
defaultValue
)
{
return
sp
.
getInt
(
key
,
defaultValue
);
}
/**
* Put the long value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
*/
public
void
put
(
@NonNull
final
String
key
,
final
long
value
)
{
put
(
key
,
value
,
false
);
}
/**
* Put the long value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
put
(
@NonNull
final
String
key
,
final
long
value
,
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
putLong
(
key
,
value
).
commit
();
}
else
{
sp
.
edit
().
putLong
(
key
,
value
).
apply
();
}
}
/**
* Return the long value in sp.
*
* @param key The key of sp.
* @return the long value if sp exists or {@code -1} otherwise
*/
public
long
getLong
(
@NonNull
final
String
key
)
{
return
getLong
(
key
,
-
1L
);
}
/**
* Return the long value in sp.
*
* @param key The key of sp.
* @param defaultValue The default value if the sp doesn't exist.
* @return the long value if sp exists or {@code defaultValue} otherwise
*/
public
long
getLong
(
@NonNull
final
String
key
,
final
long
defaultValue
)
{
return
sp
.
getLong
(
key
,
defaultValue
);
}
/**
* Put the float value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
*/
public
void
put
(
@NonNull
final
String
key
,
final
float
value
)
{
put
(
key
,
value
,
false
);
}
/**
* Put the float value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
put
(
@NonNull
final
String
key
,
final
float
value
,
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
putFloat
(
key
,
value
).
commit
();
}
else
{
sp
.
edit
().
putFloat
(
key
,
value
).
apply
();
}
}
/**
* Return the float value in sp.
*
* @param key The key of sp.
* @return the float value if sp exists or {@code -1f} otherwise
*/
public
float
getFloat
(
@NonNull
final
String
key
)
{
return
getFloat
(
key
,
-
1
f
);
}
/**
* Return the float value in sp.
*
* @param key The key of sp.
* @param defaultValue The default value if the sp doesn't exist.
* @return the float value if sp exists or {@code defaultValue} otherwise
*/
public
float
getFloat
(
@NonNull
final
String
key
,
final
float
defaultValue
)
{
return
sp
.
getFloat
(
key
,
defaultValue
);
}
/**
* Put the boolean value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
*/
public
void
put
(
@NonNull
final
String
key
,
final
boolean
value
)
{
put
(
key
,
value
,
false
);
}
/**
* Put the boolean value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
put
(
@NonNull
final
String
key
,
final
boolean
value
,
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
putBoolean
(
key
,
value
).
commit
();
}
else
{
sp
.
edit
().
putBoolean
(
key
,
value
).
apply
();
}
}
/**
* Return the boolean value in sp.
*
* @param key The key of sp.
* @return the boolean value if sp exists or {@code false} otherwise
*/
public
boolean
getBoolean
(
@NonNull
final
String
key
)
{
return
getBoolean
(
key
,
false
);
}
/**
* Return the boolean value in sp.
*
* @param key The key of sp.
* @param defaultValue The default value if the sp doesn't exist.
* @return the boolean value if sp exists or {@code defaultValue} otherwise
*/
public
boolean
getBoolean
(
@NonNull
final
String
key
,
final
boolean
defaultValue
)
{
return
sp
.
getBoolean
(
key
,
defaultValue
);
}
/**
* Put the set of string value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
*/
public
void
put
(
@NonNull
final
String
key
,
final
Set
<
String
>
value
)
{
put
(
key
,
value
,
false
);
}
/**
* Put the set of string value in sp.
*
* @param key The key of sp.
* @param value The value of sp.
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
put
(
@NonNull
final
String
key
,
final
Set
<
String
>
value
,
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
putStringSet
(
key
,
value
).
commit
();
}
else
{
sp
.
edit
().
putStringSet
(
key
,
value
).
apply
();
}
}
/**
* Return the set of string value in sp.
*
* @param key The key of sp.
* @return the set of string value if sp exists
* or {@code Collections.<String>emptySet()} otherwise
*/
public
Set
<
String
>
getStringSet
(
@NonNull
final
String
key
)
{
return
getStringSet
(
key
,
Collections
.<
String
>
emptySet
());
}
/**
* Return the set of string value in sp.
*
* @param key The key of sp.
* @param defaultValue The default value if the sp doesn't exist.
* @return the set of string value if sp exists or {@code defaultValue} otherwise
*/
public
Set
<
String
>
getStringSet
(
@NonNull
final
String
key
,
final
Set
<
String
>
defaultValue
)
{
return
sp
.
getStringSet
(
key
,
defaultValue
);
}
/**
* Return all values in sp.
*
* @return all values in sp
*/
public
Map
<
String
,
?>
getAll
()
{
return
sp
.
getAll
();
}
/**
* Return whether the sp contains the preference.
*
* @param key The key of sp.
* @return {@code true}: yes<br>{@code false}: no
*/
public
boolean
contains
(
@NonNull
final
String
key
)
{
return
sp
.
contains
(
key
);
}
/**
* Remove the preference in sp.
*
* @param key The key of sp.
*/
public
void
remove
(
@NonNull
final
String
key
)
{
remove
(
key
,
false
);
}
/**
* Remove the preference in sp.
*
* @param key The key of sp.
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
remove
(
@NonNull
final
String
key
,
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
remove
(
key
).
commit
();
}
else
{
sp
.
edit
().
remove
(
key
).
apply
();
}
}
/**
* Remove all preferences in sp.
*/
public
void
clear
()
{
clear
(
false
);
}
/**
* Remove all preferences in sp.
*
* @param isCommit True to use {@link SharedPreferences.Editor#commit()},
* false to use {@link SharedPreferences.Editor#apply()}
*/
public
void
clear
(
final
boolean
isCommit
)
{
if
(
isCommit
)
{
sp
.
edit
().
clear
().
commit
();
}
else
{
sp
.
edit
().
clear
().
apply
();
}
}
private
static
boolean
isSpace
(
final
String
s
)
{
if
(
s
==
null
)
return
true
;
for
(
int
i
=
0
,
len
=
s
.
length
();
i
<
len
;
++
i
)
{
if
(!
Character
.
isWhitespace
(
s
.
charAt
(
i
)))
{
return
false
;
}
}
return
true
;
}
}
app/src/main/java/com/base/superpdfreader/view/DialogViews.kt
View file @
8214428f
...
@@ -23,7 +23,8 @@ object DialogViews {
...
@@ -23,7 +23,8 @@ object DialogViews {
fun
Context
.
showGerPermission
(
fun
Context
.
showGerPermission
(
tittle
:
String
?
=
null
,
tittle
:
String
?
=
null
,
deny
:
((
view
:
Dialog
)
->
Unit
)?
=
null
,
deny
:
((
view
:
Dialog
)
->
Unit
)?
=
null
,
allow
:
((
view
:
Dialog
)
->
Unit
)?
=
null
allow
:
((
view
:
Dialog
)
->
Unit
)?
=
null
,
dismiss
:
(()
->
Unit
)?
=
null
,
):
Dialog
{
):
Dialog
{
val
dialog
=
Dialog
(
this
)
val
dialog
=
Dialog
(
this
)
val
binding
=
DialogPermissonOpenBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
val
binding
=
DialogPermissonOpenBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
...
@@ -46,7 +47,8 @@ object DialogViews {
...
@@ -46,7 +47,8 @@ object DialogViews {
// .setFontSize(13, true)
// .setFontSize(13, true)
// .setForegroundColor(0xFF999999.toInt())
// .setForegroundColor(0xFF999999.toInt())
// .create()
// .create()
binding
.
idTvTt
.
text
=
"We need access to your files in order to provide you with the ability to scan PDF and image files. The image files will be used to support the image to PDF conversion feature. Would you like to grant us permission to access your files?"
tittle
?.
let
{
binding
.
idTvTt
.
text
=
it
}
tittle
?.
let
{
binding
.
idTvTt
.
text
=
it
}
binding
.
idFullLottie
.
imageAssetsFolder
=
"easy_permission_finger/images/"
binding
.
idFullLottie
.
imageAssetsFolder
=
"easy_permission_finger/images/"
binding
.
idFullLottie
.
setAnimation
(
"easy_permission_finger/data.json"
)
binding
.
idFullLottie
.
setAnimation
(
"easy_permission_finger/data.json"
)
...
@@ -59,6 +61,9 @@ object DialogViews {
...
@@ -59,6 +61,9 @@ object DialogViews {
dialog
.
dismiss
()
dialog
.
dismiss
()
allow
?.
invoke
(
dialog
)
allow
?.
invoke
(
dialog
)
}
}
dialog
.
setOnDismissListener
{
dismiss
?.
invoke
()
}
dialog
.
show
()
dialog
.
show
()
return
dialog
return
dialog
}
}
...
...
app/src/main/java/com/base/superpdfreader/view/PDFSaveDialog.kt
View file @
8214428f
...
@@ -89,6 +89,9 @@ object PDFSaveDialog {
...
@@ -89,6 +89,9 @@ object PDFSaveDialog {
saveAction
.
invoke
(
pdfParameterBean
)
saveAction
.
invoke
(
pdfParameterBean
)
dialog
.
dismiss
()
dialog
.
dismiss
()
}
}
binding
.
flGuanbi
.
setOnClickListener
{
dialog
.
dismiss
()
}
//https://cloud.tencent.com/developer/article/1829876
//https://cloud.tencent.com/developer/article/1829876
val
parentView
=
binding
.
root
.
parent
as
View
val
parentView
=
binding
.
root
.
parent
as
View
BottomSheetBehavior
.
from
(
parentView
).
state
=
BottomSheetBehavior
.
STATE_EXPANDED
BottomSheetBehavior
.
from
(
parentView
).
state
=
BottomSheetBehavior
.
STATE_EXPANDED
...
...
app/src/main/res/drawable/shape_splash_s.xml
0 → 100644
View file @
8214428f
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@android:id/background"
>
<shape>
<stroke
android:width=
"1px"
android:color=
"#FF3835"
/>
<corners
android:radius=
"6dp"
/>
</shape>
</item>
<item
android:id=
"@android:id/progress"
android:bottom=
"3dp"
android:end=
"3dp"
android:start=
"3dp"
android:top=
"3dp"
>
<scale
android:scaleWidth=
"100%"
>
<shape>
<corners
android:radius=
"5dp"
/>
<solid
android:color=
"#FF3835"
/>
</shape>
</scale>
</item>
</layer-list>
\ No newline at end of file
app/src/main/res/drawable/splash_bp.xml
0 → 100644
View file @
8214428f
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@color/white"
/>
<!-- <item android:drawable="@drawable/splash_bg" />-->
<item
android:top=
"130dp"
android:gravity=
"top|center_horizontal"
>
<bitmap
android:src=
"@mipmap/qdylogo"
/>
</item>
</layer-list>
\ No newline at end of file
app/src/main/res/layout/activity_splash.xml
0 → 100644
View file @
8214428f
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/splash_bp"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<View
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
<View
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"2"
/>
<LinearLayout
android:id=
"@+id/ll_progress"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"49dp"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:visibility=
"gone"
>
<ProgressBar
android:id=
"@+id/pb"
style=
"@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"15dp"
android:layout_marginHorizontal=
"32dp"
android:layout_marginTop=
"5dp"
android:max=
"100"
android:progressDrawable=
"@drawable/shape_splash_s"
tools:progress=
"50"
/>
<TextView
android:id=
"@+id/tv_load"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"18dp"
android:text=
"Loading..."
android:textColor=
"#000000"
android:textSize=
"15sp"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/tv_ad_des"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"42dp"
android:text=
"This process may involve ad."
android:textColor=
"#000000"
android:textSize=
"15sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_start"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"20dp"
android:gravity=
"center"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"4dp"
android:text=
"By continuing you are agreeing to the"
android:textColor=
"#676767"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" & "
android:visibility=
"gone"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/id_tv_privacy_policy"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Privacy Policy"
android:textColor=
"#676767"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
<TextView
android:id=
"@+id/id_tv_start"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginHorizontal=
"40dp"
android:layout_marginBottom=
"49dp"
android:background=
"@color/color_pdf"
android:gravity=
"center"
android:text=
"START TO USE"
android:textColor=
"@color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
android:visibility=
"visible"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
\ No newline at end of file
app/src/main/res/layout/dialog_pdf_save.xml
View file @
8214428f
...
@@ -24,17 +24,25 @@
...
@@ -24,17 +24,25 @@
android:textStyle=
"bold"
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
tools:ignore=
"HardcodedText"
/>
<
ImageView
<
FrameLayout
android:id=
"@+id/
iv
_guanbi"
android:id=
"@+id/
fl
_guanbi"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"11dp"
android:layout_marginEnd=
"6dp"
android:padding=
"5dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/guanbi"
android:src=
"@mipmap/guanbi"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</FrameLayout>
</FrameLayout>
<com.noober.background.view.BLLinearLayout
<com.noober.background.view.BLLinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:layout_height=
"45dp"
...
...
app/src/main/res/layout/dialog_permisson_open.xml
View file @
8214428f
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
android:layout_marginHorizontal=
"15dp"
android:layout_marginHorizontal=
"15dp"
android:layout_marginTop=
"22dp"
android:layout_marginTop=
"22dp"
android:layout_marginBottom=
"38dp"
android:layout_marginBottom=
"38dp"
android:gravity=
"center"
android:textSize=
"13sp"
/>
android:textSize=
"13sp"
/>
<com.airbnb.lottie.LottieAnimationView
<com.airbnb.lottie.LottieAnimationView
...
...
app/src/main/res/mipmap-xxhdpi/qdylogo.png
0 → 100644
View file @
8214428f
37.7 KB
app/src/main/res/values/strings.xml
View file @
8214428f
<resources>
<resources>
<string
name=
"app_name"
>
Super PDF Reader
</string>
<string
name=
"app_name"
>
Super PDF Reader
</string>
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"facebook_app_id"
>
11
</string>
<string
name=
"facebook_app_id"
>
944700447857513
</string>
</resources>
</resources>
\ No newline at end of file
app/src/test/java/com/base/superpdfreader/ExampleUnitTest.kt
deleted
100644 → 0
View file @
eb1214ae
package
com.base.superpdfreader
import
org.junit.Test
import
org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class
ExampleUnitTest
{
@Test
fun
addition_isCorrect
()
{
assertEquals
(
4
,
2
+
2
)
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment