Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
pdf all 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
pdf all reader
Commits
f5f2d12d
Commit
f5f2d12d
authored
Nov 08, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化
parent
f52ae86a
Hide whitespace changes
Inline
Side-by-side
Showing
62 changed files
with
4437 additions
and
176 deletions
+4437
-176
build.gradle.kts
app/build.gradle.kts
+1
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+68
-8
WeatherBean.kt
...n/java/com/base/pdfreaderallpdfreader/bean/WeatherBean.kt
+15
-0
FCMManager.kt
...ain/java/com/base/pdfreaderallpdfreader/fcm/FCMManager.kt
+70
-0
FcmReceiver.java
.../java/com/base/pdfreaderallpdfreader/fcm/FcmReceiver.java
+17
-0
MessagingService.java
.../com/base/pdfreaderallpdfreader/fcm/MessagingService.java
+29
-0
NotificationHoverUtils.kt
.../base/pdfreaderallpdfreader/fcm/NotificationHoverUtils.kt
+69
-0
NotificationUiUtil.kt
.../com/base/pdfreaderallpdfreader/fcm/NotificationUiUtil.kt
+374
-0
PopupConstObject.kt
...va/com/base/pdfreaderallpdfreader/fcm/PopupConstObject.kt
+45
-0
ScreenStatusReceiver.java
.../base/pdfreaderallpdfreader/fcm/ScreenStatusReceiver.java
+78
-0
TimerManager.java
...java/com/base/pdfreaderallpdfreader/fcm/TimerManager.java
+70
-0
InstallHelper.kt
...va/com/base/pdfreaderallpdfreader/helper/InstallHelper.kt
+94
-0
MyApplication.kt
...va/com/base/pdfreaderallpdfreader/helper/MyApplication.kt
+61
-52
NewComUtils.kt
...java/com/base/pdfreaderallpdfreader/helper/NewComUtils.kt
+111
-0
UmpUtils.kt
...in/java/com/base/pdfreaderallpdfreader/helper/UmpUtils.kt
+129
-0
WeatherUtils.kt
...ava/com/base/pdfreaderallpdfreader/helper/WeatherUtils.kt
+166
-0
MeidaContentObserver.kt
...ase/pdfreaderallpdfreader/service/MeidaContentObserver.kt
+74
-0
StayJobService.kt
.../com/base/pdfreaderallpdfreader/service/StayJobService.kt
+186
-0
DocumentFragment.kt
...ase/pdfreaderallpdfreader/ui/document/DocumentFragment.kt
+46
-2
ExcelActivity.kt
.../com/base/pdfreaderallpdfreader/ui/excel/ExcelActivity.kt
+293
-0
DocumentEx.kt
...java/com/base/pdfreaderallpdfreader/ui/main/DocumentEx.kt
+13
-1
MainActivity.kt
...va/com/base/pdfreaderallpdfreader/ui/main/MainActivity.kt
+64
-10
HomeFragment.kt
...m/base/pdfreaderallpdfreader/ui/main/home/HomeFragment.kt
+15
-2
DocumentPdfAdapter.kt
...m/base/pdfreaderallpdfreader/ui/pdf/DocumentPdfAdapter.kt
+4
-3
PdfActivity.kt
...java/com/base/pdfreaderallpdfreader/ui/pdf/PdfActivity.kt
+3
-2
PdfLoadingActivity.kt
...m/base/pdfreaderallpdfreader/ui/pdf/PdfLoadingActivity.kt
+10
-9
PptActivity.kt
...java/com/base/pdfreaderallpdfreader/ui/ppt/PptActivity.kt
+184
-0
SplashActivity.kt
...om/base/pdfreaderallpdfreader/ui/splash/SplashActivity.kt
+199
-1
SplashViewModel.kt
...m/base/pdfreaderallpdfreader/ui/splash/SplashViewModel.kt
+47
-0
DocumentDialog.kt
.../com/base/pdfreaderallpdfreader/ui/view/DocumentDialog.kt
+54
-52
RateDialog.kt
...java/com/base/pdfreaderallpdfreader/ui/view/RateDialog.kt
+112
-0
WordActivity.kt
...va/com/base/pdfreaderallpdfreader/ui/word/WordActivity.kt
+350
-0
LogEx.kt
...c/main/java/com/base/pdfreaderallpdfreader/utils/LogEx.kt
+0
-4
bg_00b8de_16.xml
app/src/main/res/drawable/bg_00b8de_16.xml
+5
-0
bg_stroke_ffffff_10.xml
app/src/main/res/drawable/bg_stroke_ffffff_10.xml
+9
-0
bg_transparent.xml
app/src/main/res/drawable/bg_transparent.xml
+5
-0
activity_excel.xml
app/src/main/res/layout/activity_excel.xml
+187
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+32
-17
activity_ppt.xml
app/src/main/res/layout/activity_ppt.xml
+126
-0
activity_splash.xml
app/src/main/res/layout/activity_splash.xml
+14
-0
activity_word.xml
app/src/main/res/layout/activity_word.xml
+226
-0
dialog_document_more.xml
app/src/main/res/layout/dialog_document_more.xml
+173
-0
dialog_rate_star.xml
app/src/main/res/layout/dialog_rate_star.xml
+160
-0
fragment_document.xml
app/src/main/res/layout/fragment_document.xml
+22
-10
layout_admob_document.xml
app/src/main/res/layout/layout_admob_document.xml
+105
-0
layout_admob_document_in.xml
app/src/main/res/layout/layout_admob_document_in.xml
+101
-0
notification_message.xml
app/src/main/res/layout/notification_message.xml
+55
-0
stay_notification_big.xml
app/src/main/res/layout/stay_notification_big.xml
+117
-0
left.png
app/src/main/res/mipmap-xxhdpi/left.png
+0
-0
logo.png
app/src/main/res/mipmap-xxhdpi/logo.png
+0
-0
pdf_arrowhead.png
app/src/main/res/mipmap-xxhdpi/pdf_arrowhead.png
+0
-0
pdf_expression.png
app/src/main/res/mipmap-xxhdpi/pdf_expression.png
+0
-0
pdf_expression1.png
app/src/main/res/mipmap-xxhdpi/pdf_expression1.png
+0
-0
pdf_expression2.png
app/src/main/res/mipmap-xxhdpi/pdf_expression2.png
+0
-0
pdf_expression3.png
app/src/main/res/mipmap-xxhdpi/pdf_expression3.png
+0
-0
pdf_xing_n.png
app/src/main/res/mipmap-xxhdpi/pdf_xing_n.png
+0
-0
pdf_xing_s.png
app/src/main/res/mipmap-xxhdpi/pdf_xing_s.png
+0
-0
right.png
app/src/main/res/mipmap-xxhdpi/right.png
+0
-0
lottie_animation_splash.json
app/src/main/res/raw/lottie_animation_splash.json
+1
-0
dimens.xml
app/src/main/res/values/dimens.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+35
-2
file_paths.xml
app/src/main/res/xml/file_paths.xml
+12
-0
No files found.
app/build.gradle.kts
View file @
f5f2d12d
...
...
@@ -98,7 +98,7 @@ dependencies {
//Word库
//PPT库
//Excel库
//
api(project(":library"))
api
(
project
(
":library"
))
//广告
implementation
(
"com.google.android.gms:play-services-ads:23.1.0"
)
...
...
app/src/main/AndroidManifest.xml
View file @
f5f2d12d
...
...
@@ -18,6 +18,7 @@
android:value=
"document_ui"
/>
<application
android:logo=
"@mipmap/logo"
android:name=
".helper.MyApplication"
android:allowBackup=
"true"
android:dataExtractionRules=
"@xml/data_extraction_rules"
...
...
@@ -28,12 +29,7 @@
android:supportsRtl=
"true"
android:theme=
"@style/Theme.PdfReaderAllPdfReader"
tools:targetApi=
"31"
>
<activity
android:name=
".ui.document.DocumentActivity"
android:exported=
"false"
/>
<activity
android:name=
".ui.search.SearchActivity"
android:exported=
"false"
/>
<activity
android:name=
".ui.splash.SplashActivity"
android:exported=
"true"
>
...
...
@@ -56,15 +52,79 @@
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
android:name=
".ui.pdf.PdfActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
/>
android:launchMode=
"singleTop"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.word.WordActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.excel.ExcelActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.ppt.PptActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.document.DocumentActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<activity
android:name=
".ui.search.SearchActivity"
android:exported=
"false"
android:launchMode=
"singleTop"
tools:ignore=
"DiscouragedApi,LockedOrientationActivity"
/>
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"${applicationId}.provider"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/file_paths"
/>
</provider>
<service
android:name=
".fcm.MessagingService"
android:exported=
"false"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
</intent-filter>
</service>
<service
android:name=
".service.StayJobService"
android:exported=
"false"
android:foregroundServiceType=
"dataSync"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<receiver
android:name=
".fcm.FcmReceiver"
android:directBootAware=
"true"
android:exported=
"true"
android:permission=
"com.google.android.c2dm.permission.SEND"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
<action
android:name=
"com.google.android.c2dm.intent.RECEIVE"
/>
<category
android:name=
"confine.scream"
/>
</intent-filter>
</receiver>
<meta-data
android:name=
"com.google.android.gms.ads.APPLICATION_ID"
android:value=
"ca-app-pub-3940256099942544~3347511713"
/>
<meta-data
android:name=
"com.facebook.sdk.ApplicationId"
android:value=
"@string/facebook_app_id"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/bean/WeatherBean.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.bean
data class
WeatherBean
(
val
city
:
String
,
val
list
:
List
<
ListBean
>)
data class
ListBean
(
val
tempMax
:
String
,
val
tempMin
:
String
,
val
humidity
:
String
,
val
fxDate
:
String
,
val
iconDay
:
String
,
val
windScaleDay
:
String
,
val
pressure
:
String
,
val
textDay
:
String
,
val
textNight
:
String
,
)
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/FCMManager.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.fcm
import
android.content.Context
import
android.util.Log
import
com.base.pdfreaderallpdfreader.helper.EventHelper.event
import
com.base.pdfreaderallpdfreader.helper.EventUtils
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.google.android.gms.tasks.OnCompleteListener
import
com.google.android.gms.tasks.Task
import
com.google.firebase.FirebaseApp
import
com.google.firebase.messaging.FirebaseMessaging
import
org.json.JSONObject
object
FCMManager
{
fun
initFirebase
(
context
:
Context
?)
{
FirebaseApp
.
initializeApp
(
context
!!
)
LogEx
.
logDebug
(
"initFirebase"
,
"initFirebase"
)
getToken
()
}
fun
subscribeToTopic
(
topic
:
String
)
{
Log
.
e
(
"FCMUtil"
,
"subscribeToTopic"
)
FirebaseMessaging
.
getInstance
().
subscribeToTopic
(
topic
)
.
addOnCompleteListener
{
task
->
if
(
task
.
isSuccessful
)
{
getToken
()
Log
.
e
(
"FCMUtil"
,
"isSuccessful"
)
event
(
"FCM_Topic_$topic"
,
null
,
null
,
false
)
}
else
{
event
(
"FCM_Error"
,
"subscribeToTopic task.isSuccessful=${task.isSuccessful} "
,
null
,
false
)
}
}
}
fun
unsubscribeFromTopic
(
topic
:
String
?)
{
FirebaseMessaging
.
getInstance
().
unsubscribeFromTopic
(
topic
!!
)
.
addOnCompleteListener
{
task
->
if
(
task
.
isSuccessful
)
{
}
else
{
}
}
}
fun
getToken
()
{
FirebaseMessaging
.
getInstance
().
token
.
addOnCompleteListener
(
object
:
OnCompleteListener
<
String
>
{
override
fun
onComplete
(
task
:
Task
<
String
>)
{
LogEx
.
logDebug
(
"FCM"
,
"onComplete ${task.isSuccessful}"
)
if
(!
task
.
isSuccessful
)
{
Log
.
e
(
"FCM"
,
"Fetching FCM registration token failed"
,
task
.
exception
)
return
}
// Get new FCM registration token
val
token
:
String
=
task
.
result
LogEx
.
logDebug
(
"FCM"
,
"token=$token"
)
val
json
=
JSONObject
()
json
.
put
(
"token"
,
token
)
EventUtils
.
event
(
"fcm_message_received"
,
ext
=
json
)
AppPreferences
.
getInstance
().
put
(
"token"
,
token
)
// Handle new token
Log
.
d
(
"FCM"
,
"FCM Registration Token: $token"
)
}
})
}
}
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/FcmReceiver.java
0 → 100644
View file @
f5f2d12d
package
com
.
base
.
pdfreaderallpdfreader
.
fcm
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
com.base.pdfreaderallpdfreader.utils.LogEx
;
public
class
FcmReceiver
extends
BroadcastReceiver
{
private
String
TAG
=
"FcmReceiver"
;
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
LogEx
.
INSTANCE
.
logDebug
(
TAG
,
"onReceive"
,
false
);
}
}
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/MessagingService.java
0 → 100644
View file @
f5f2d12d
package
com
.
base
.
pdfreaderallpdfreader
.
fcm
;
import
android.annotation.SuppressLint
;
import
androidx.annotation.NonNull
;
import
com.base.pdfreaderallpdfreader.helper.EventUtils
;
import
com.base.pdfreaderallpdfreader.utils.LogEx
;
import
com.google.firebase.messaging.FirebaseMessagingService
;
import
com.google.firebase.messaging.RemoteMessage
;
@SuppressLint
(
"MissingFirebaseInstanceTokenRefresh"
)
public
class
MessagingService
extends
FirebaseMessagingService
{
private
static
final
String
TAG
=
"MessagingService"
;
@Override
public
void
onMessageReceived
(
@NonNull
RemoteMessage
remoteMessage
)
{
super
.
onMessageReceived
(
remoteMessage
);
LogEx
.
INSTANCE
.
logDebug
(
TAG
,
"onMessageReceived"
,
false
);
EventUtils
.
INSTANCE
.
event
(
"FCM_Received"
,
null
,
null
,
false
);
String
action
=
NotificationUiUtil
.
INSTANCE
.
getNextActionId
();
NotificationUiUtil
.
INSTANCE
.
sendNotificationIfCan
(
this
,
action
,
PopupConstObject
.
POPUP_WHERE_FCM
);
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/NotificationHoverUtils.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.fcm
import
android.content.Context
import
android.os.Handler
import
android.os.HandlerThread
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_hover_count
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_hover_delay
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_hover_status
import
com.base.pdfreaderallpdfreader.helper.MyApplication
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
object
NotificationHoverUtils
{
private
val
TAG
=
"NotificationHoverUtils"
private
var
handlerThread
:
HandlerThread
?
=
null
private
var
handler
:
Handler
?
=
null
/**
* 发送悬停通知
*/
fun
sendHoverNotification
(
context
:
Context
)
{
val
hoverCount
=
AppPreferences
.
getInstance
().
getString
(
popup_hover_count
,
"0"
).
toInt
()
val
hoverDelay
=
AppPreferences
.
getInstance
().
getString
(
popup_hover_delay
,
"0"
).
toLong
()
val
hoverStatus
=
AppPreferences
.
getInstance
().
getString
(
popup_hover_status
,
"0"
).
toInt
()
if
(
hoverStatus
==
0
)
return
if
(
handlerThread
==
null
)
{
handlerThread
=
HandlerThread
(
"NotificationHandlerThread"
)
handlerThread
?.
start
()
}
// 创建 Handler
if
(
handler
==
null
)
{
handlerThread
?.
let
{
handler
=
Handler
(
it
.
getLooper
())
}
}
for
(
i
in
1
..
hoverCount
)
{
val
time
=
i
*
hoverDelay
handler
?.
postDelayed
(
Runnable
{
LogEx
.
logDebug
(
TAG
,
"handler ${MyApplication.PAUSED_VALUE}"
)
if
(
MyApplication
.
PAUSED_VALUE
==
1
)
{
handler
?.
removeCallbacksAndMessages
(
null
)
return
@Runnable
}
if
(
MyApplication
.
PAUSED_VALUE
!=
1
)
{
LogEx
.
logDebug
(
TAG
,
"handler send notification"
)
NotificationUiUtil
.
setActionNotification
(
context
,
NotificationUiUtil
.
hoverActionId
)
}
},
time
)
}
}
fun
stopNotificationHandler
()
{
// 停止 HandlerThread
if
(
handler
!=
null
)
{
handler
?.
removeCallbacksAndMessages
(
null
)
}
if
(
handlerThread
!=
null
)
{
handlerThread
?.
quit
()
handlerThread
=
null
}
handler
=
null
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/NotificationUiUtil.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.fcm
import
android.annotation.SuppressLint
import
android.app.NotificationChannel
import
android.app.NotificationManager
import
android.app.PendingIntent
import
android.content.Context
import
android.content.Intent
import
android.graphics.drawable.Icon
import
android.os.Build
import
android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
import
com.base.pdfreaderallpdfreader.BuildConfig
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_APP_PROCESS
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_CLEAN_JUNK
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_NEW_IMAGE_PDF
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_READ_DOCUMENTS
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_READ_PDF
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_UN_VIEW_FILES
import
com.base.pdfreaderallpdfreader.bean.ConstObject.NOTIFICATION_ACTION_WEATHER
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_FCM
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_LOCK
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.POPUP_WHERE_TIMBER
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_count
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_end
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_fcm_interval
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_interval
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_lock_interval
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_start
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_status
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_timer_interval
import
com.base.pdfreaderallpdfreader.helper.EventUtils
import
com.base.pdfreaderallpdfreader.helper.MyApplication
import
com.base.pdfreaderallpdfreader.ui.splash.SplashActivity
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
java.text.SimpleDateFormat
import
java.util.Calendar
import
java.util.Locale
import
kotlin.random.Random
/**
* 构建发送通知 UI
* 用的actionId代替notificationId使用
*/
object
NotificationUiUtil
{
private
val
TAG
=
"NotificationUiUtil"
private
const
val
CHANNEL_ID
=
"browser_notification_id"
// 通知渠道ID
private
const
val
CHANNEL_NAME
=
"browser_fcm_channel"
// 通知渠道名称
var
NOTIFICATION_ID
=
8999
private
fun
currentDate
():
String
{
val
dateFormat
=
SimpleDateFormat
(
"yyyy-MM-dd"
,
Locale
.
getDefault
())
val
currentDate
=
Calendar
.
getInstance
().
time
return
dateFormat
.
format
(
currentDate
)
}
//当天推送次数
var
dayPopupCount
=
0
get
()
{
return
AppPreferences
.
getInstance
().
getInt
(
"dayPopupCount_${currentDate()}"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"dayPopupCount_${currentDate()}"
,
value
,
true
)
}
var
lastPopupTime
=
0L
get
()
{
return
AppPreferences
.
getInstance
().
getLong
(
"lastPopupTime"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"lastPopupTime"
,
value
,
true
)
}
fun
canSendNotification
(
where
:
String
,
actionId
:
String
):
Boolean
{
//是否开启推送
val
status
=
AppPreferences
.
getInstance
().
getString
(
popup_status
,
"1"
).
toInt
()
if
(
status
==
0
)
{
EventUtils
.
event
(
"Notification_Error"
,
"status=$status"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"status"
)
return
false
}
//当天推送次数
val
count
=
AppPreferences
.
getInstance
().
getString
(
popup_count
,
"20"
).
toInt
()
if
(
dayPopupCount
>
count
)
{
LogEx
.
logDebug
(
"canSendNotification"
,
"count"
)
EventUtils
.
event
(
"Notification_Error"
,
"dayPopupCount=$dayPopupCount count=$count where=$where actionId=$actionId"
)
return
false
}
//判断是否在时间区域
val
start
=
AppPreferences
.
getInstance
().
getString
(
popup_start
,
"0"
).
toInt
()
val
end
=
AppPreferences
.
getInstance
().
getString
(
popup_end
,
"24"
).
toInt
()
val
calendar
=
Calendar
.
getInstance
()
val
currentHour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)
if
(
currentHour
!
in
start
until
end
)
{
LogEx
.
logDebug
(
"canSendNotification"
,
"start-end currentHour=$currentHour start=$start end=$end"
)
EventUtils
.
event
(
"Notification_Error"
,
"start=$start end=$end currentHour=$currentHour where=$where actionId=$actionId"
)
return
false
}
//单位分钟
var
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_interval
,
"1"
).
toInt
()
if
(
where
==
POPUP_WHERE_TIMBER
)
{
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_timer_interval
,
"7"
).
toInt
()
}
if
(
where
==
POPUP_WHERE_LOCK
)
{
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_lock_interval
,
"1"
).
toInt
()
}
if
(
where
==
POPUP_WHERE_FCM
)
{
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_fcm_interval
,
"1"
).
toInt
()
}
val
passedTime
=
System
.
currentTimeMillis
()
-
lastPopupTime
if
(
passedTime
<
interval
*
60
*
1000L
)
{
EventUtils
.
event
(
"Notification_Error"
,
"where=$where actionId=$actionId interval=$interval passedTime=$passedTime"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"interval where=$where passedTime=$passedTime interval=$interval"
)
return
false
}
return
true
}
var
hoverActionId
=
""
@SuppressLint
(
"RemoteViewLayout"
)
fun
sendNotificationIfCan
(
context
:
Context
,
actionId
:
String
,
where
:
String
=
""
)
{
if
(!
canSendNotification
(
where
,
actionId
))
return
//发送通知
setActionNotification
(
context
,
actionId
)
//上报通知
EventUtils
.
event
(
"Notification_Popup"
,
"where=$where actionId=$actionId"
)
//当天次数加一
dayPopupCount
+=
1
//推送时间
lastPopupTime
=
System
.
currentTimeMillis
()
//悬停通知
hoverActionId
=
actionId
NotificationHoverUtils
.
sendHoverNotification
(
context
)
}
fun
setActionNotification
(
context
:
Context
,
actionId
:
String
)
{
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
context
.
packageName
,
R
.
layout
.
notification_message
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
context
.
packageName
,
R
.
layout
.
notification_message
)
val
intent
=
Intent
(
context
,
SplashActivity
::
class
.
java
)
intent
.
putExtra
(
"actionId"
,
actionId
)
when
(
actionId
)
{
NOTIFICATION_ACTION_NEW_IMAGE_PDF
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
new_image_for_creating_pdf
)
val
desc
=
context
.
getString
(
R
.
string
.
edit_images_to_create_pdf_files
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_READ_PDF
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
read_your_pdf_file
)
val
desc
=
context
.
getString
(
R
.
string
.
did_you_miss_this_pdf_file
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_READ_DOCUMENTS
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
read_more_phone_documents
)
val
desc
=
context
.
getString
(
R
.
string
.
click_to_read_and_edit_your_document
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_UN_VIEW_FILES
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
there_are_unviewed_files
)
val
desc
=
context
.
getString
(
R
.
string
.
click_to_read_now
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
don_t_miss_important_documents
)
val
desc
=
context
.
getString
(
R
.
string
.
view_now
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_APP_PROCESS
->
{
// val pair = MyApplication.context.ramPair()
// val percent = (pair.first * 100 / pair.second).toInt()
//
// val desc = "Memory is $percent% used"
// val smallRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_memory_small_1)
// smallRemoteViewsVar.setProgressBar(R.id.progress_bar, percent, 100, false)
// smallRemoteViewsVar.setTextViewText(R.id.tv_desc, desc)
// val btnRequestCode = Random.nextInt(1000)
// smallRemoteViewsVar.setOnClickPendingIntent(
// R.id.tv_btn,
// PendingIntent.getActivity(context, btnRequestCode, intent, PendingIntent.FLAG_IMMUTABLE)
// )
//
// val bigRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_memory_big)
//
// sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar)
}
NOTIFICATION_ACTION_CLEAN_JUNK
->
{
// var size = fastGetJunkSize(context)
// if (size == 0L) {
// size = Random.nextLong(1024 * 5, 1024 * 10)
// }
// val bigRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_junk_big)
// bigRemoteViewsVar.setTextViewText(R.id.tv_size, size.toFormatSize())
//
// val smallRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_junk_small)
// smallRemoteViewsVar.setTextViewText(R.id.tv_size, size.toFormatSize())
//
// sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar)
}
NOTIFICATION_ACTION_WEATHER
->
{
// val weatherBean: WeatherBean = WeatherUtils.getWeatherEntity() ?: return
// if (weatherBean.list.isEmpty()) return
//
// val subBean = weatherBean.list[0]
// val smallRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_weather_small)
// smallRemoteViewsVar.setTextViewText(R.id.tv_city, weatherBean.city)
// val min = subBean.tempMin.toInt()
// val max = subBean.tempMax.toInt()
// smallRemoteViewsVar.setTextViewText(R.id.tv_wendu_now, Random.nextInt(min, max).toString())
// val icon = when (WeatherUtils.getWeatherType(subBean.iconDay.toInt())) {
// "Sunny day" -> R.mipmap.d_qing
// "Cloudy day" -> R.mipmap.d_yin
// "Rainy day" -> R.mipmap.d_dayu
// "Snowy day" -> R.mipmap.d_xiaxue
// "Greasy day" -> R.mipmap.d_wumaishachengbao
// "Unknown" -> R.mipmap.d_qing
// else -> R.mipmap.d_qing
// }
//
// smallRemoteViewsVar.setImageViewResource(R.id.iv_weather, icon)
// smallRemoteViewsVar.setTextViewText(R.id.tv_wendu_range, "$min℃/$max℃")
//
// val bigRemoteViewsVar = RemoteViews(context.packageName, R.layout.notification_weather_big)
// bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_11h, icon)
// bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_14h, icon)
// bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_17h, icon)
// bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_20h, icon)
// bigRemoteViewsVar.setImageViewResource(R.id.iv_weather_23h, icon)
// bigRemoteViewsVar.setImageViewResource(R.id.iv_weather, icon)
//
// bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_11h, Random.nextInt(min, max).toString())
// bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_14h, Random.nextInt(min, max).toString())
// bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_17h, Random.nextInt(min, max).toString())
// bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_20h, Random.nextInt(min, max).toString())
// bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_23h, Random.nextInt(min, max).toString())
//
// bigRemoteViewsVar.setTextViewText(R.id.tv_wendu_now, Random.nextInt(min, max).toString())
// bigRemoteViewsVar.setTextViewText(R.id.tv_day_desc, if (isDayOrNight()) subBean.textDay else subBean.textNight)
// bigRemoteViewsVar.setTextViewText(R.id.tv_weather_info, "$min℃/$max℃ ${formatATime()}")
//
// sendCustomNotification(context, intent, bigRemoteViewsVar, smallRemoteViewsVar)
}
else
->
{
EventUtils
.
event
(
"Notification_Error"
,
"unKnow actionId actionId=$actionId"
)
}
}
}
private
fun
sendCustomNotification
(
context
:
Context
,
intent
:
Intent
,
bigRemoteViews
:
RemoteViews
,
smallRemoteViews
:
RemoteViews
,
)
{
val
notificationManager
=
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
//创建channel
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
val
channel
=
NotificationChannel
(
CHANNEL_ID
,
CHANNEL_NAME
,
NotificationManager
.
IMPORTANCE_HIGH
)
channel
.
lockscreenVisibility
=
NotificationCompat
.
VISIBILITY_PUBLIC
notificationManager
.
createNotificationChannel
(
channel
)
}
// Create the notification
val
builder
:
NotificationCompat
.
Builder
=
NotificationCompat
.
Builder
(
context
,
CHANNEL_ID
)
//设置状态栏内的小图标
val
smallIcon
=
IconCompat
.
createFromIcon
(
context
,
Icon
.
createWithResource
(
context
,
R
.
mipmap
.
logox
)
)
smallIcon
?.
let
{
builder
.
setSmallIcon
(
smallIcon
)
}
builder
.
setContentTitle
(
context
.
resources
.
getString
(
R
.
string
.
app_name
))
.
setContentText
(
"notification"
)
val
requestCode
=
Random
.
nextInt
(
1000
)
val
pendingIntent
=
PendingIntent
.
getActivity
(
context
,
requestCode
,
intent
,
PendingIntent
.
FLAG_IMMUTABLE
)
builder
.
setContentIntent
(
pendingIntent
)
.
setPriority
(
NotificationCompat
.
PRIORITY_MAX
)
.
setAutoCancel
(
true
)
var
small
:
RemoteViews
?
=
bigRemoteViews
//Android 12以下需要适配小RemoteViews
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
S
)
{
small
=
smallRemoteViews
}
// 设置小视图
builder
.
setCustomContentView
(
smallRemoteViews
)
// 设置悬浮通知视图(Android 12 及以上)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
S
)
{
builder
.
setCustomHeadsUpContentView
(
bigRemoteViews
)
}
// 设置大视图
builder
.
setCustomBigContentView
(
bigRemoteViews
)
notificationManager
.
notify
(
NOTIFICATION_ID
,
builder
.
build
())
}
val
looper_actionId
=
listOf
(
NOTIFICATION_ACTION_READ_PDF
,
NOTIFICATION_ACTION_READ_DOCUMENTS
,
NOTIFICATION_ACTION_UN_VIEW_FILES
,
NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
,
NOTIFICATION_ACTION_APP_PROCESS
,
NOTIFICATION_ACTION_CLEAN_JUNK
,
NOTIFICATION_ACTION_WEATHER
)
var
actionIdList
=
arrayListOf
<
String
>()
fun
getNextActionId
():
String
{
if
(
actionIdList
.
isEmpty
())
{
actionIdList
.
addAll
(
looper_actionId
)
}
val
next
=
actionIdList
[
0
]
actionIdList
.
removeAt
(
0
)
if
(
BuildConfig
.
DEBUG
)
{
// return NOTIFICATION_ACTION_WEATHER
}
return
next
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/PopupConstObject.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.fcm
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
object
PopupConstObject
{
const
val
POPUP_WHERE_TIMBER
=
"Timer"
const
val
POPUP_WHERE_LOCK
=
"Lock"
const
val
POPUP_WHERE_FCM
=
"fcm"
const
val
POPUP_WHERE_WORK_MANAGER
=
"workmanager"
const
val
POPUP_WHERE_MEDIA_CHANGE
=
"media_change"
const
val
POPUP_WHERE_HOVER_HANDLE
=
"hover_handle"
//悬停调用
//推送总开关 0 关 1开
val
popup_status
=
"popup_status"
//推送总数量现在
const
val
popup_count
=
"popup_count"
//所有常规推送的当日推送次数限制,0 为不限制
const
val
popup_start
=
"popup_start"
const
val
popup_end
=
"popup_end"
const
val
popup_interval
=
"popup_interval"
const
val
popup_timer_interval
=
"popup_timber_interval"
const
val
popup_lock_interval
=
"popup_lock_interval"
const
val
popup_fcm_interval
=
"popup_fcm_interval"
const
val
popup_hover_status
=
"popup_hover_status"
const
val
popup_hover_count
=
"popup_hover_count"
const
val
popup_hover_delay
=
"popup_hover_delay"
const
val
lockS
=
"lockS"
const
val
timerS
=
"timerS"
const
val
timerDelay
=
"timerDelay"
const
val
timerInterval
=
"timerInterval"
var
topic_number
=
""
get
()
{
return
AppPreferences
.
getInstance
().
getString
(
"topic_number"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"topic_number"
,
value
,
true
)
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/ScreenStatusReceiver.java
0 → 100644
View file @
f5f2d12d
package
com
.
base
.
pdfreaderallpdfreader
.
fcm
;
import
static
com
.
base
.
pdfreaderallpdfreader
.
fcm
.
PopupConstObject
.
lockS
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.os.Build
;
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
;
import
com.base.pdfreaderallpdfreader.utils.LogEx
;
import
java.util.Objects
;
public
class
ScreenStatusReceiver
extends
BroadcastReceiver
{
private
static
boolean
isDeviceInteractive
=
true
;
private
static
boolean
isSecureLockActive
=
false
;
public
static
void
setupScreenStatusListener
(
Context
context
)
{
IntentFilter
intentFilter
=
new
IntentFilter
();
intentFilter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
);
intentFilter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
);
intentFilter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
);
final
Context
applicationContext
=
context
.
getApplicationContext
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
applicationContext
.
registerReceiver
(
new
ScreenStatusReceiver
(),
intentFilter
,
Context
.
RECEIVER_EXPORTED
);
}
else
{
applicationContext
.
registerReceiver
(
new
ScreenStatusReceiver
(),
intentFilter
);
}
}
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
switch
(
Objects
.
requireNonNull
(
action
))
{
case
Intent
.
ACTION_SCREEN_ON
:
setDeviceInteractive
(
true
);
break
;
case
Intent
.
ACTION_SCREEN_OFF
:
setDeviceInteractive
(
false
);
setSecureLockActive
(
true
);
break
;
case
Intent
.
ACTION_USER_PRESENT
:
LogEx
.
INSTANCE
.
logDebug
(
"ScreenStatusReceiver"
,
"ACTION_USER_PRESENT"
,
false
);
setSecureLockActive
(
false
);
if
(
isDeviceInteractive
()
&&
!
isSecureLockActive
())
{
int
secureSetting
=
Integer
.
parseInt
(
AppPreferences
.
getInstance
().
getString
(
lockS
,
"1"
));
if
(
secureSetting
==
1
)
{
String
actionId
=
NotificationUiUtil
.
INSTANCE
.
getNextActionId
();
NotificationUiUtil
.
INSTANCE
.
sendNotificationIfCan
(
context
,
actionId
,
PopupConstObject
.
POPUP_WHERE_LOCK
);
}
}
break
;
}
}
private
void
setDeviceInteractive
(
boolean
interactive
)
{
isDeviceInteractive
=
interactive
;
}
public
static
boolean
isDeviceInteractive
()
{
return
isDeviceInteractive
;
}
private
void
setSecureLockActive
(
boolean
active
)
{
isSecureLockActive
=
active
;
}
public
static
boolean
isSecureLockActive
()
{
return
isSecureLockActive
;
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/fcm/TimerManager.java
0 → 100644
View file @
f5f2d12d
package
com
.
base
.
pdfreaderallpdfreader
.
fcm
;
import
android.util.Log
;
import
com.base.pdfreaderallpdfreader.helper.MyApplication
;
import
com.base.pdfreaderallpdfreader.utils.LogEx
;
import
java.util.Timer
;
import
java.util.TimerTask
;
public
class
TimerManager
{
private
static
TimerManager
instance
;
private
Timer
taskTimer
;
private
boolean
isTimerActive
;
private
TimerManager
()
{
// 私有构造方法
}
public
static
synchronized
TimerManager
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
TimerManager
();
}
return
instance
;
}
public
void
scheduleTask
(
long
delay
,
long
period
)
{
LogEx
.
INSTANCE
.
logDebug
(
"TimerManager"
,
"scheduleTask"
,
false
);
synchronized
(
TimerManager
.
class
)
{
ensureTimerIsStopped
();
// 确保定时器未运行
taskTimer
=
new
Timer
();
// 创建新的 Timer 实例
TimerTask
task
=
new
TimerTask
()
{
@Override
public
void
run
()
{
Log
.
d
(
"glc"
,
"Scheduled task is running"
);
// 确保设备处于交互状态,未锁定,且应用未暂停
if
(
ScreenStatusReceiver
.
isDeviceInteractive
()
&&
!
ScreenStatusReceiver
.
isSecureLockActive
()
&&
MyApplication
.
PAUSED_VALUE
!=
1
)
{
Log
.
d
(
"glc"
,
"Scheduled task conditions are met"
);
String
actionId
=
NotificationUiUtil
.
INSTANCE
.
getNextActionId
();
NotificationUiUtil
.
INSTANCE
.
sendNotificationIfCan
(
MyApplication
.
context
,
actionId
,
PopupConstObject
.
POPUP_WHERE_TIMBER
);
}
}
};
taskTimer
.
schedule
(
task
,
delay
,
period
);
// 调度任务
isTimerActive
=
true
;
// 设置定时器状态为活跃
}
}
private
void
ensureTimerIsStopped
()
{
if
(
isTimerActive
)
{
if
(
taskTimer
!=
null
)
{
taskTimer
.
cancel
();
taskTimer
.
purge
();
// 清除所有取消的任务
}
isTimerActive
=
false
;
// 重置定时器状态
}
}
public
void
stopTaskTimer
()
{
synchronized
(
TimerManager
.
class
)
{
ensureTimerIsStopped
();
// 停止定时器
}
}
public
boolean
isTaskTimerActive
()
{
return
isTimerActive
;
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/helper/InstallHelper.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.helper
import
com.android.installreferrer.api.InstallReferrerClient
import
com.android.installreferrer.api.InstallReferrerStateListener
import
com.base.pdfreaderallpdfreader.BuildConfig
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.timerDelay
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.timerInterval
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject.timerS
import
com.base.pdfreaderallpdfreader.fcm.TimerManager
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
org.json.JSONObject
/**
* call before agree
*/
object
InstallHelps
{
private
val
TAG
=
"InstallHelps"
fun
init
()
{
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
MyApplication
.
context
).
build
()
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
override
fun
onInstallReferrerSetupFinished
(
responseCode
:
Int
)
{
try
{
when
(
responseCode
)
{
InstallReferrerClient
.
InstallReferrerResponse
.
OK
->
{
val
response
=
referrerClient
.
installReferrer
val
installInfo
=
response
.
installReferrer
val
obj
=
JSONObject
()
obj
.
put
(
"referrerUrl"
,
response
.
installReferrer
)
obj
.
put
(
"referrerClickTime"
,
response
.
referrerClickTimestampSeconds
)
obj
.
put
(
"appInstallTime"
,
response
.
installBeginTimestampSeconds
)
obj
.
put
(
"instantExperienceLaunched"
,
installInfo
.
toString
())
EventUtils
.
event
(
"install_referrer"
,
ext
=
obj
,
isSingleEvent
=
true
)
LogEx
.
logDebug
(
TAG
,
"referrerUrl=${response.installReferrer}"
)
AppPreferences
.
getInstance
().
put
(
"referrerUrl"
,
response
.
installReferrer
)
if
(
listOf
(
"gclid"
,
"facebook"
,
"instagram"
).
all
{
!
installInfo
.
contains
(
it
,
true
)
}
)
{
//自然用户
if
(
BuildConfig
.
DEBUG
)
{
AppPreferences
.
getInstance
().
put
(
"install_source"
,
"channel"
)
}
else
{
AppPreferences
.
getInstance
().
put
(
"install_source"
,
"origin"
)
}
}
else
{
//渠道用户
AppPreferences
.
getInstance
().
put
(
"install_source"
,
"channel"
)
}
requestCfg
()
}
else
->
{
EventUtils
.
event
(
"install_referrer_error"
)
requestCfg
()
}
}
}
catch
(
_
:
Exception
)
{
EventUtils
.
event
(
"install_referrer_error"
)
requestCfg
()
}
}
override
fun
onInstallReferrerServiceDisconnected
()
{
}
})
}
private
fun
requestCfg
()
{
NewComUtils
.
requestCfg
{
val
timerStatus
:
Int
=
AppPreferences
.
getInstance
().
getString
(
timerS
,
"1"
).
toIntOrNull
()
?:
1
if
(
timerStatus
==
0
)
{
TimerManager
.
getInstance
().
stopTaskTimer
()
}
else
{
val
timerDelay
:
Int
=
AppPreferences
.
getInstance
().
getString
(
timerDelay
,
"1"
).
toIntOrNull
()
?:
1
val
timerInterval
:
Int
=
AppPreferences
.
getInstance
().
getString
(
timerInterval
,
"1"
).
toIntOrNull
()
?:
1
if
(!
TimerManager
.
getInstance
().
isTaskTimerActive
)
{
TimerManager
.
getInstance
().
scheduleTask
(
(
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
()
)
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/helper/MyApplication.kt
View file @
f5f2d12d
...
...
@@ -5,12 +5,22 @@ import android.app.Application
import
android.content.Intent
import
android.os.Bundle
import
android.text.TextUtils
import
com.base.pdfreaderallpdfreader.BuildConfig
import
com.base.pdfreaderallpdfreader.fcm.FCMManager
import
com.base.pdfreaderallpdfreader.fcm.ScreenStatusReceiver
import
com.base.pdfreaderallpdfreader.helper.WeatherUtils.requestWeatherData
import
com.base.pdfreaderallpdfreader.service.StayJobService.Companion.startJob
import
com.base.pdfreaderallpdfreader.ui.splash.SplashActivity
import
com.base.pdfreaderallpdfreader.utils.ActivityManagerUtils
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.facebook.FacebookSdk
import
com.reyun.solar.engine.OnAttributionListener
import
com.reyun.solar.engine.OnInitializationCallback
import
com.reyun.solar.engine.SolarEngineConfig
import
com.reyun.solar.engine.SolarEngineManager
import
com.tom_roush.pdfbox.android.PDFBoxResourceLoader
import
org.json.JSONObject
import
java.util.Locale
import
java.util.UUID
...
...
@@ -39,19 +49,18 @@ class MyApplication : Application() {
var
PAUSED_VALUE
=
0
}
override
fun
onCreate
()
{
super
.
onCreate
()
context
=
this
initUUid
()
initApp
()
PDFBoxResourceLoader
.
init
(
applicationContext
)
//
initWeather()
initWeather
()
}
//
private fun initWeather() {
//
requestWeatherData()
//
}
private
fun
initWeather
()
{
requestWeatherData
()
}
private
fun
initUUid
()
{
uuid
=
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
)
...
...
@@ -62,9 +71,9 @@ class MyApplication : Application() {
}
}
fun
initApp
()
{
//
SolarEngineManager.getInstance().preInit(context, "81a11caa4076cd7c")
//
FacebookSdk.sdkInitialize(applicationContext)
private
fun
initApp
()
{
SolarEngineManager
.
getInstance
().
preInit
(
context
,
"81a11caa4076cd7c"
)
FacebookSdk
.
sdkInitialize
(
applicationContext
)
// var topicNumber = System.currentTimeMillis().toFormatMinute()
// LogEx.logDebug(TAG, "topicNumber=$topicNumber")
// if (topic_number.isNotEmpty()) {
...
...
@@ -75,54 +84,54 @@ class MyApplication : Application() {
// val topic = ConfigHelper.packageName + "_push_$topicNumber"
val
topic
=
ConfigHelper
.
packageName
+
"_push"
LogEx
.
logDebug
(
TAG
,
"topic=${topic}"
)
//
FCMManager.initFirebase(this)
//
FCMManager.subscribeToTopic(topic)
//
InstallHelps.init()
FCMManager
.
initFirebase
(
this
)
FCMManager
.
subscribeToTopic
(
topic
)
InstallHelps
.
init
()
initLifeListener
()
// ScreenStatusReceiver.setupScreenStatusListener(this)
ScreenStatusReceiver
.
setupScreenStatusListener
(
this
)
startJob
()
}
// fun initSolarEngine(gdprDeny: Boolean = false) {
//
// val configBuilder = SolarEngineConfig.Builder()
//
// if (BuildConfig.DEBUG) {
// configBuilder.logEnabled() //开启本地调试日志
// }
// if (gdprDeny) {
// configBuilder.isGDPRArea = true
// configBuilder.adPersonalizationEnabled = true
// configBuilder.adUserDataEnabled = true
// }
// configBuilder.isCoppaEnabled = true
// configBuilder.setKidsAppEnabled(true)
// configBuilder.fbAppID = ""
//
// val config = configBuilder.build()
//
// SolarEngineManager.getInstance().initialize(context, "81a11caa4076cd7c", config,
// OnInitializationCallback { code ->
// if (code == 0) {
// //初始化成功
// config.setOnAttributionListener(object : OnAttributionListener {
// override fun onAttributionSuccess(attribution: JSONObject) {
// //获取归因结果成功时执行的动作
// LogEx.logDebug(TAG, "attribution=$attribution")
// EventHelper.event("install_referrer", attribution.toString())
// }
//
// override fun onAttributionFail(errorCode: Int) {
// //获取归因结果失败时执行的动作
// EventHelper.event("SolarEngineManager onAttributionFail errorCode=$errorCode")
// }
// })
// } else {
// //初始化失败,具体失败原因参考下方code码释义
// EventHelper.event("SolarEngineManager init error code=$code")
// }
// })
// }
fun
initSolarEngine
(
gdprDeny
:
Boolean
=
false
)
{
val
configBuilder
=
SolarEngineConfig
.
Builder
()
if
(
BuildConfig
.
DEBUG
)
{
configBuilder
.
logEnabled
()
//开启本地调试日志
}
if
(
gdprDeny
)
{
configBuilder
.
isGDPRArea
=
true
configBuilder
.
adPersonalizationEnabled
=
true
configBuilder
.
adUserDataEnabled
=
true
}
configBuilder
.
isCoppaEnabled
=
true
configBuilder
.
setKidsAppEnabled
(
true
)
configBuilder
.
fbAppID
=
""
val
config
=
configBuilder
.
build
()
SolarEngineManager
.
getInstance
().
initialize
(
context
,
"81a11caa4076cd7c"
,
config
,
OnInitializationCallback
{
code
->
if
(
code
==
0
)
{
//初始化成功
config
.
setOnAttributionListener
(
object
:
OnAttributionListener
{
override
fun
onAttributionSuccess
(
attribution
:
JSONObject
)
{
//获取归因结果成功时执行的动作
LogEx
.
logDebug
(
TAG
,
"attribution=$attribution"
)
EventHelper
.
event
(
"install_referrer"
,
attribution
.
toString
())
}
override
fun
onAttributionFail
(
errorCode
:
Int
)
{
//获取归因结果失败时执行的动作
EventHelper
.
event
(
"SolarEngineManager onAttributionFail errorCode=$errorCode"
)
}
})
}
else
{
//初始化失败,具体失败原因参考下方code码释义
EventHelper
.
event
(
"SolarEngineManager init error code=$code"
)
}
})
}
private
var
lastTimePause
=
0L
private
var
lastTimeResume
=
0L
...
...
app/src/main/java/com/base/pdfreaderallpdfreader/helper/NewComUtils.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.helper
import
android.util.Log
import
com.base.pdfreaderallpdfreader.BuildConfig
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
org.json.JSONObject
import
java.io.BufferedReader
import
java.io.InputStreamReader
import
java.net.HttpURLConnection
import
java.net.URL
import
java.util.Locale
object
NewComUtils
{
private
val
TAG
=
"NewComUtils"
private
const
val
API_URL
=
ConfigHelper
.
apiUrl
private
const
val
PACKAGE_NAME_PREFIX
=
ConfigHelper
.
packageName
private
const
val
DATA_KEY
=
"data"
private
val
url
:
String
by
lazy
{
val
packageName
=
ConfigHelper
.
packageName
val
appCode
=
packageName
.
substringAfter
(
PACKAGE_NAME_PREFIX
).
take
(
5
).
toLowerCase
(
Locale
.
getDefault
())
val
bRefer
=
android
.
util
.
Base64
.
encodeToString
(
AppPreferences
.
getInstance
().
getString
(
"referrerUrl"
,
""
).
toByteArray
(),
android
.
util
.
Base64
.
DEFAULT
)
"$API_URL/${appCode}spk?pkg=$packageName&referrer=${bRefer}&vn=${BuildConfig.VERSION_NAME}&vc=${BuildConfig.VERSION_CODE}&device=${
AppPreferences
.
getInstance
().
getString
(
"gid"
,
""
)
}&
aid
=
$
{
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
)}
"
// &mode=3
}
fun
requestCfg
(
callback
:
()
->
Unit
)
{
CoroutineScope
(
Dispatchers
.
IO
).
launch
{
val
response
=
doGet
()
if
(
response
==
null
)
{
withContext
(
Dispatchers
.
Main
)
{
callback
()
}
return
@launch
}
val
data
=
extractData
(
response
)
if
(
data
==
null
)
{
withContext
(
Dispatchers
.
Main
)
{
callback
()
}
return
@launch
}
val
decryptedData
=
AESHelper
.
decrypt
(
data
)
parseConfigBean
(
decryptedData
)
withContext
(
Dispatchers
.
Main
)
{
callback
()
}
}
}
private
fun
doGet
():
String
?
{
val
urlPath
=
url
LogEx
.
logDebug
(
TAG
,
"url=$url"
)
try
{
val
conn
:
HttpURLConnection
=
URL
(
urlPath
).
openConnection
()
as
HttpURLConnection
conn
.
setRequestMethod
(
"GET"
)
conn
.
connectTimeout
=
150000
if
(
200
==
conn
.
getResponseCode
())
{
val
json
=
BufferedReader
(
InputStreamReader
(
conn
.
inputStream
)).
readLine
()
LogEx
.
logDebug
(
TAG
,
"json=$json"
)
return
json
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
Log
.
d
(
"okhttp"
,
e
.
toString
())
}
return
null
}
private
fun
extractData
(
response
:
String
):
String
?
{
val
regex
=
Regex
(
"\"$DATA_KEY\":\"(.*?)\""
)
val
match
=
regex
.
find
(
response
)
return
match
?.
groupValues
?.
get
(
1
)
}
private
fun
parseConfigBean
(
json
:
String
)
{
val
gson
=
Gson
()
val
type
=
object
:
TypeToken
<
Map
<
String
,
String
>>()
{}.
type
val
configMap
=
gson
.
fromJson
<
Map
<
String
,
String
>>(
json
,
type
)
configMap
.
forEach
{
t
,
u
->
// 对于整型值使用parseInt, 长整型使用parseLong
AppPreferences
.
getInstance
().
put
(
t
,
u
)
LogEx
.
logDebug
(
TAG
,
"t=$t u=$u"
)
}
val
jsonObject
=
JSONObject
()
jsonObject
.
put
(
"ut"
,
AppPreferences
.
getInstance
().
getString
(
"ut"
,
""
))
EventUtils
.
event
(
"user_type"
,
ext
=
jsonObject
)
}
}
app/src/main/java/com/base/pdfreaderallpdfreader/helper/UmpUtils.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.helper
import
android.app.Activity
import
android.content.Context
import
com.base.pdfreaderallpdfreader.BuildConfig
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.google.android.ump.ConsentDebugSettings
import
com.google.android.ump.ConsentForm
import
com.google.android.ump.ConsentInformation
import
com.google.android.ump.ConsentRequestParameters
import
com.google.android.ump.FormError
import
com.google.android.ump.UserMessagingPlatform
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
object
UmpUtils
{
var
umpCanAd
=
true
get
()
{
return
AppPreferences
.
getInstance
().
getBoolean
(
"umpCanAd"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"umpCanAd"
,
value
,
true
)
}
var
umpCalled
=
false
get
()
{
return
AppPreferences
.
getInstance
().
getBoolean
(
"umpCalled"
,
field
)
}
set
(
value
)
{
field
=
value
AppPreferences
.
getInstance
().
put
(
"umpCalled"
,
value
,
true
)
}
private
fun
Context
.
umpTest
():
ConsentDebugSettings
{
val
debugSettings
=
ConsentDebugSettings
.
Builder
(
this
)
debugSettings
.
setDebugGeography
(
ConsentDebugSettings
.
DebugGeography
.
DEBUG_GEOGRAPHY_EEA
)
//通过TEST-DEVICE-HASHED-ID log过滤ConsentDebugSettings 打印测试id,使用测试id来测试
// debugSettings.addTestDeviceHashedId("TEST-DEVICE-HASHED-ID")
debugSettings
.
addTestDeviceHashedId
(
"73FE7C2634104D50A11BE9B902AA0FA6"
)
return
debugSettings
.
build
()
}
var
callback
:
((
canAd
:
Boolean
)
->
Unit
)?
=
null
private
val
TAG
=
"UmpUtils"
fun
requestUMP
(
activity
:
Activity
)
{
val
paramsBuild
=
ConsentRequestParameters
.
Builder
()
if
(
BuildConfig
.
DEBUG
)
{
paramsBuild
.
setConsentDebugSettings
(
activity
.
umpTest
())
}
// 指示用户是否低于同意年龄; true 低于同意年龄
// 未满同意年龄的用户不会收到 GDPR 消息表单
paramsBuild
.
setTagForUnderAgeOfConsent
(
false
)
val
params
=
paramsBuild
.
build
()
val
consentInformation
:
ConsentInformation
=
UserMessagingPlatform
.
getConsentInformation
(
activity
)
if
(
BuildConfig
.
DEBUG
)
{
consentInformation
.
reset
()
}
val
updateSuccessListener
=
ConsentInformation
.
OnConsentInfoUpdateSuccessListener
{
LogEx
.
logDebug
(
TAG
,
"isConsentFormAvailable=${consentInformation.isConsentFormAvailable}"
)
if
(
consentInformation
.
isConsentFormAvailable
)
{
MainScope
().
launch
(
Dispatchers
.
Main
)
{
delay
(
500
)
loadAndShowConsentFormIfRequired
(
activity
,
consentInformation
)
}
}
else
{
callback
?.
invoke
(
true
)
callback
=
null
}
}
val
updateFailureListener
=
ConsentInformation
.
OnConsentInfoUpdateFailureListener
{
LogEx
.
logDebug
(
TAG
,
"message=${it.message} errorCode=${it.errorCode}"
)
callback
?.
invoke
(
true
)
callback
=
null
}
consentInformation
.
requestConsentInfoUpdate
(
activity
,
params
,
updateSuccessListener
,
updateFailureListener
)
}
fun
loadAndShowConsentFormIfRequired
(
activity
:
Activity
,
consentInformation
:
ConsentInformation
)
{
UserMessagingPlatform
.
loadConsentForm
(
activity
,
object
:
UserMessagingPlatform
.
OnConsentFormLoadSuccessListener
{
override
fun
onConsentFormLoadSuccess
(
consentForm
:
ConsentForm
)
{
LogEx
.
logDebug
(
TAG
,
"onConsentFormLoadSuccess"
)
consentForm
.
show
(
activity
)
{
callback
?.
invoke
(
consentInformation
.
canRequestAds
())
callback
=
null
}
}
},
object
:
UserMessagingPlatform
.
OnConsentFormLoadFailureListener
{
override
fun
onConsentFormLoadFailure
(
p0
:
FormError
)
{
//https://groups.google.com/g/google-admob-ads-sdk/c/x-fyDOfMSqU/m/MeZX3mO4AAAJ
LogEx
.
logDebug
(
TAG
,
"onConsentFormLoadFailure ${p0.message} ${p0.errorCode}"
)
callback
?.
invoke
(
true
)
callback
=
null
}
})
// UserMessagingPlatform.loadAndShowConsentFormIfRequired(activity) { loadAndShowError: FormError? ->
// LogEx.logDebug(
// TAG,
// "loadAndShowConsentFormIfRequired message=${loadAndShowError?.message} errorCode=${loadAndShowError?.errorCode}"
// )
// if (loadAndShowError != null) {
// callback?.invoke(false)
// callback = null
// } else {
// callback?.invoke(consentInformation.canRequestAds())
// callback = null
// }
// }
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/helper/WeatherUtils.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.helper
import
android.text.TextUtils
import
com.base.pdfreaderallpdfreader.BuildConfig
import
com.base.pdfreaderallpdfreader.bean.WeatherBean
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.google.gson.Gson
import
okhttp3.Call
import
okhttp3.Callback
import
okhttp3.OkHttpClient
import
okhttp3.Request
import
okhttp3.Response
import
okhttp3.logging.HttpLoggingInterceptor
import
java.io.IOException
import
java.text.SimpleDateFormat
import
java.util.Calendar
import
java.util.concurrent.TimeUnit
object
WeatherUtils
{
private
val
TAG
=
"WeatherUtils"
fun
getWeatherType
(
param
:
Int
):
String
{
val
sunny_day
:
IntArray
=
intArrayOf
(
100
,
101
,
102
,
103
,
150
,
151
,
152
,
153
)
val
cloudy_day
:
IntArray
=
intArrayOf
(
104
)
val
rainy_day
:
IntArray
=
intArrayOf
(
300
,
301
,
302
,
303
,
304
,
305
,
306
,
307
,
307
,
309
,
310
,
311
,
312
,
313
,
314
,
315
,
316
,
317
,
318
,
350
,
351
,
399
)
val
snowy_day
:
IntArray
=
intArrayOf
(
400
,
401
,
402
,
403
,
404
,
405
,
406
,
407
,
408
,
409
,
410
,
456
,
457
,
499
)
val
greasy_day
:
IntArray
=
intArrayOf
(
500
,
501
,
502
,
503
,
504
,
505
,
507
,
508
,
509
,
510
,
511
,
512
,
513
,
514
,
515
)
when
(
param
)
{
in
sunny_day
->
return
"Sunny day"
in
cloudy_day
->
return
"Cloudy day"
in
rainy_day
->
return
"Rainy day"
in
snowy_day
->
return
"Snowy day"
in
greasy_day
->
return
"Greasy day"
else
->
return
"Unknown"
}
}
fun
hasWeatherDataToday
():
Boolean
{
return
!
TextUtils
.
isEmpty
(
getWeatherJsonStr
())
}
fun
getWeatherJsonStr
():
String
{
val
data
=
AppPreferences
.
getInstance
().
getString
(
getTodayStr
()
+
"_weather"
,
""
)
return
data
}
fun
getWeatherEntity
():
WeatherBean
?
{
val
str
=
getWeatherJsonStr
()
LogEx
.
logDebug
(
TAG
,
"getWeatherEntity str=$str"
)
if
(
TextUtils
.
isEmpty
(
str
))
{
}
else
{
try
{
val
gson
=
Gson
()
val
wBean
=
gson
.
fromJson
(
str
,
WeatherBean
::
class
.
java
)
return
wBean
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
return
null
}
private
val
url
by
lazy
{
val
pkg
=
ConfigHelper
.
packageName
val
url
=
StringBuilder
(
"${ConfigHelper.apiUrl}/city/${
pkg
.
filter
{
it
.
isLowerCase
()
}.
substring
(
4
,
9
)
}
tq
"
)
url
.
append
(
"?pkg=$pkg"
)
val
sdf
=
SimpleDateFormat
(
"yyyyMMdd"
)
url
.
append
(
"&date=${sdf.format(Calendar.getInstance().time)}"
)
url
.
toString
()
}
fun
requestWeatherData
()
{
val
client
=
OkHttpClient
.
Builder
().
apply
{
if
(
BuildConfig
.
DEBUG
)
{
addInterceptor
(
HttpLoggingInterceptor
().
apply
{
level
=
HttpLoggingInterceptor
.
Level
.
BODY
})
}
}.
build
()
val
request
=
Request
.
Builder
()
.
url
(
url
)
.
get
()
.
build
()
LogEx
.
logDebug
(
TAG
,
"url=$url"
)
client
.
newCall
(
request
).
enqueue
(
object
:
Callback
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
}
override
fun
onResponse
(
call
:
Call
,
response
:
Response
)
{
response
.
body
?.
string
()
?.
let
{
val
i
=
Regex
(
"\"data\":\"(.*?)\""
).
find
(
it
)
if
(
i
.
toString
()
!=
"null"
)
{
i
?.
groupValues
?.
get
(
1
).
let
{
data
->
LogEx
.
logDebug
(
TAG
,
"data=$data"
)
if
(!
TextUtils
.
isEmpty
(
data
))
{
val
str
=
AESHelper
.
decrypt
(
data
?:
""
)
saveWeatherData
(
str
)
}
}
}
}
}
})
}
/**
* 同步
*/
fun
getWeatherData
()
=
runCatching
{
val
client
=
OkHttpClient
.
Builder
().
apply
{
if
(
BuildConfig
.
DEBUG
)
{
addInterceptor
(
HttpLoggingInterceptor
().
apply
{
level
=
HttpLoggingInterceptor
.
Level
.
BODY
})
}
}.
connectTimeout
(
1
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
1
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
1
,
TimeUnit
.
SECONDS
)
.
build
()
val
request
=
Request
.
Builder
()
.
url
(
url
)
.
get
()
.
build
()
val
response
=
client
.
newCall
(
request
).
execute
()
response
.
body
?.
string
()
?.
let
{
val
i
=
Regex
(
"\"data\":\"(.*?)\""
).
find
(
it
)
if
(
i
.
toString
()
!=
"null"
)
{
i
?.
groupValues
?.
get
(
1
).
let
{
if
(!
TextUtils
.
isEmpty
(
it
))
{
val
str
=
AESHelper
.
decrypt
(
it
!!
)
saveWeatherData
(
str
)
}
}
}
}
}
private
fun
saveWeatherData
(
string
:
String
)
{
AppPreferences
.
getInstance
().
put
(
getTodayStr
()
+
"_weather"
,
string
)
}
private
fun
getTodayStr
():
String
{
val
calendar
=
Calendar
.
getInstance
()
val
year
=
calendar
[
Calendar
.
YEAR
]
val
month
=
calendar
[
Calendar
.
MONTH
]
+
1
val
day
=
calendar
[
Calendar
.
DAY_OF_MONTH
]
val
today
=
year
.
toString
()
+
"-"
+
String
.
format
(
"%02d"
,
month
)
+
"-"
+
String
.
format
(
"%02d"
,
day
)
return
today
;
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/service/MeidaContentObserver.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.service
import
android.annotation.SuppressLint
import
android.content.Context
import
android.database.ContentObserver
import
android.database.Cursor
import
android.net.Uri
import
android.provider.MediaStore
import
com.base.pdfreaderallpdfreader.bean.ConstObject
import
com.base.pdfreaderallpdfreader.fcm.NotificationUiUtil
import
com.base.pdfreaderallpdfreader.fcm.PopupConstObject
import
com.base.pdfreaderallpdfreader.utils.LogEx
/**
* Observer MediaContent add
*/
class
MediaContentObserver
(
val
context
:
Context
)
:
ContentObserver
(
null
)
{
private
val
TAG
=
"MediaContentObserver"
override
fun
onChange
(
selfChange
:
Boolean
,
uri
:
Uri
?)
{
super
.
onChange
(
selfChange
,
uri
)
LogEx
.
logDebug
(
TAG
,
"uri=${uri.toString()}"
)
if
(
uri
.
toString
().
contains
(
"images"
))
{
NotificationUiUtil
.
sendNotificationIfCan
(
context
,
ConstObject
.
NOTIFICATION_ACTION_NEW_IMAGE_PDF
,
PopupConstObject
.
POPUP_WHERE_MEDIA_CHANGE
)
}
// uri?.let { queryNewMediaFiles(it) }
}
@SuppressLint
(
"Range"
)
private
fun
queryNewMediaFiles
(
uri
:
Uri
)
=
Thread
{
// 查询新添加的媒体文件
val
projection
=
arrayOf
(
MediaStore
.
MediaColumns
.
DISPLAY_NAME
,
MediaStore
.
MediaColumns
.
DATA
,
MediaStore
.
MediaColumns
.
MIME_TYPE
,
MediaStore
.
MediaColumns
.
SIZE
,
)
val
cursor
:
Cursor
?
=
context
.
contentResolver
.
query
(
uri
,
projection
,
null
,
null
,
null
)
if
(
cursor
!=
null
)
{
LogEx
.
logDebug
(
TAG
,
"cursor=$cursor"
)
try
{
if
(
cursor
.
count
>
0
)
{
while
(
cursor
.
moveToNext
())
{
val
name
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
MediaStore
.
MediaColumns
.
DISPLAY_NAME
))
val
path
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
MediaStore
.
MediaColumns
.
DATA
))
val
mimeType
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
MediaStore
.
MediaColumns
.
MIME_TYPE
))
val
size
=
cursor
.
getString
(
cursor
.
getColumnIndex
(
MediaStore
.
MediaColumns
.
SIZE
))
LogEx
.
logDebug
(
TAG
,
"path=$path"
)
// 处理新文件路径
}
}
else
{
LogEx
.
logDebug
(
TAG
,
"count=0 deleted file uri"
)
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
LogEx
.
logDebug
(
TAG
,
"Exception=$e"
)
}
finally
{
cursor
.
close
()
}
}
else
{
LogEx
.
logDebug
(
TAG
,
"cursor=$cursor"
)
}
}.
start
()
}
app/src/main/java/com/base/pdfreaderallpdfreader/service/StayJobService.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.service
import
android.app.Notification
import
android.app.NotificationChannel
import
android.app.NotificationManager
import
android.app.PendingIntent
import
android.app.job.JobInfo
import
android.app.job.JobParameters
import
android.app.job.JobScheduler
import
android.app.job.JobService
import
android.content.ComponentName
import
android.content.Context
import
android.content.Intent
import
android.content.pm.ServiceInfo
import
android.graphics.BitmapFactory
import
android.graphics.drawable.Icon
import
android.os.Build
import
android.os.CountDownTimer
import
android.provider.MediaStore
import
android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
import
androidx.work.Configuration
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ui.main.MainActivity
import
com.base.pdfreaderallpdfreader.utils.LogEx
/**
* 常驻通知栏
*/
class
StayJobService
:
JobService
()
{
init
{
val
builder
=
Configuration
.
Builder
()
builder
.
setJobSchedulerJobIdRange
(
0
,
1000
)
}
private
val
TAG
=
"StayNotificationService"
val
channelName
=
"PDF Reader Foreground Service Channel"
val
channelId
=
"PDF_Reader_Service_Id"
val
NOTIFICATION_PERMANENT_ID
=
186
companion
object
{
var
isRunning
=
false
private
const
val
JOB_INFO_ID
:
Int
=
101
private
const
val
JOB_PERIODIC
:
Long
=
5
*
1000L
fun
Context
.
startJob
()
{
if
(
isRunning
)
return
val
jobScheduler
=
getSystemService
(
JOB_SCHEDULER_SERVICE
)
as
JobScheduler
val
componentName
=
ComponentName
(
this
,
StayJobService
::
class
.
java
)
val
jobInfo
=
JobInfo
.
Builder
(
JOB_INFO_ID
,
componentName
)
.
setMinimumLatency
(
30000
)
.
build
()
jobScheduler
.
schedule
(
jobInfo
)
}
fun
createPermanentNotification
(
context
:
Context
):
Notification
{
val
channelName
=
"Permanent Foreground Service Channel"
val
channelId
=
"permanent_channel"
val
contentView
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
stay_notification_big
)
val
expendView
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
stay_notification_big
)
val
builder
=
NotificationCompat
.
Builder
(
context
,
channelId
)
val
smallIcon
=
IconCompat
.
createFromIcon
(
context
,
Icon
.
createWithResource
(
context
,
R
.
mipmap
.
logox
)
)
smallIcon
?.
let
{
builder
.
setSmallIcon
(
smallIcon
)
//设置状态栏内的小图标
}
val
nfIntent
=
Intent
(
context
,
MainActivity
::
class
.
java
)
val
pendingIntent
=
PendingIntent
.
getActivity
(
context
,
0
,
nfIntent
,
PendingIntent
.
FLAG_IMMUTABLE
)
builder
.
setLargeIcon
(
BitmapFactory
.
decodeResource
(
context
.
resources
,
R
.
mipmap
.
logox
)
)
builder
.
setContentTitle
(
context
.
resources
.
getString
(
R
.
string
.
app_name
))
builder
.
setContentIntent
(
pendingIntent
)
//设置PendingIntent
builder
.
setVisibility
(
NotificationCompat
.
VISIBILITY_PRIVATE
)
//设置通知公开可见
builder
.
setAutoCancel
(
false
)
builder
.
setOngoing
(
true
)
builder
.
setPriority
(
NotificationCompat
.
PRIORITY_MAX
)
//优先级为:重要通知
builder
.
setWhen
(
System
.
currentTimeMillis
())
builder
.
setCustomContentView
(
contentView
)
builder
.
setCustomBigContentView
(
expendView
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
val
channel
=
NotificationChannel
(
channelId
,
channelName
,
NotificationManager
.
IMPORTANCE_LOW
)
channel
.
lockscreenVisibility
=
1
val
notificationManager
=
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
notificationManager
.
createNotificationChannel
(
channel
)
builder
.
setChannelId
(
channelId
)
}
return
builder
.
build
()
}
}
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
{
//监听媒体库变化
observerMediaContentObserver
()
return
super
.
onStartCommand
(
intent
,
flags
,
startId
)
}
private
fun
startForeground
()
{
val
notification
=
createPermanentNotification
(
applicationContext
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
startForeground
(
NOTIFICATION_PERMANENT_ID
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
}
else
{
startForeground
(
NOTIFICATION_PERMANENT_ID
,
notification
)
}
isRunning
=
true
}
override
fun
onDestroy
()
{
isRunning
=
false
super
.
onDestroy
()
}
override
fun
onCreate
()
{
if
(!
isRunning
)
{
startForeground
()
isRunning
=
true
Timer
{
startForeground
()
}.
apply
{
start
()
}
}
super
.
onCreate
()
}
override
fun
onStartJob
(
params
:
JobParameters
?):
Boolean
{
return
true
}
override
fun
onStopJob
(
params
:
JobParameters
?):
Boolean
{
return
false
}
private
var
mediaContentObserver
:
MediaContentObserver
?
=
null
private
fun
observerMediaContentObserver
()
{
if
(
mediaContentObserver
==
null
)
{
LogEx
.
logDebug
(
TAG
,
"observerMediaContentObserver"
)
mediaContentObserver
=
MediaContentObserver
(
this
)
mediaContentObserver
?.
let
{
this
.
contentResolver
.
registerContentObserver
(
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
,
true
,
it
)
}
}
}
}
class
Timer
(
val
block
:
()
->
Unit
)
:
CountDownTimer
(
30000
,
1000
)
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
}
override
fun
onFinish
()
{
Timer
{
block
()
}.
apply
{
start
()
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/document/DocumentFragment.kt
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.document
import
android.app.Activity
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.lifecycle.lifecycleScope
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobNativeUtils
import
com.base.pdfreaderallpdfreader.bean.DocumentBean
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_EXCEL
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_PDF
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_PPT
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_WORD
import
com.base.pdfreaderallpdfreader.databinding.FragmentDocumentBinding
import
com.base.pdfreaderallpdfreader.ui.excel.ExcelActivity
import
com.base.pdfreaderallpdfreader.ui.main.DocumentAdapter
import
com.base.pdfreaderallpdfreader.ui.main.getAllDocument
import
com.base.pdfreaderallpdfreader.ui.main.getExcelDocument
...
...
@@ -19,6 +24,8 @@ import com.base.pdfreaderallpdfreader.ui.main.getPdfDocument
import
com.base.pdfreaderallpdfreader.ui.main.getPptDocument
import
com.base.pdfreaderallpdfreader.ui.main.getWordDocument
import
com.base.pdfreaderallpdfreader.ui.pdf.PdfActivity
import
com.base.pdfreaderallpdfreader.ui.ppt.PptActivity
import
com.base.pdfreaderallpdfreader.ui.word.WordActivity
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
java.io.File
...
...
@@ -47,7 +54,11 @@ class DocumentFragment() : Fragment() {
super
.
onViewCreated
(
view
,
savedInstanceState
)
adapter
=
DocumentAdapter
()
adapter
?.
itemClickAction
=
{
item
:
DocumentBean
->
PdfActivity
.
jumpPdfActivity
(
requireActivity
(),
item
)
if
(
item
.
type
==
TYPE_PDF
)
{
PdfActivity
.
jumpPdfActivity
(
requireActivity
(),
item
)
}
else
{
requireActivity
().
jumpOtherDocument
(
item
)
}
}
binding
.
rv
.
adapter
=
adapter
}
...
...
@@ -94,15 +105,32 @@ class DocumentFragment() : Fragment() {
if
(
list
.
isEmpty
())
{
binding
.
llEmpty
.
visibility
=
View
.
VISIBLE
adapter
?.
submitList
(
listOf
())
val
flag
=
AdmobHelper
.
isShowRvNativeAd
()
if
(
flag
)
{
binding
.
flAd
.
visibility
=
View
.
VISIBLE
AdmobNativeUtils
.
showNativeAd
(
requireActivity
(),
binding
.
flAd
,
R
.
layout
.
layout_admob_document
)
}
}
else
{
binding
.
llEmpty
.
visibility
=
View
.
GONE
adapter
?.
submitList
(
list
)
binding
.
flAd
.
visibility
=
View
.
GONE
adapter
?.
submitList
(
getRvAdList
(
list
))
}
binding
.
swipeRefreshLayout
.
isRefreshing
=
false
}
}
}
private
fun
getRvAdList
(
list
:
List
<
DocumentBean
>):
List
<
DocumentBean
>
{
val
flag
=
AdmobHelper
.
isShowRvNativeAd
()
if
(
flag
)
{
val
arrayList
=
arrayListOf
<
DocumentBean
>()
arrayList
.
addAll
(
list
)
arrayList
.
add
(
1
,
DocumentBean
().
apply
{
isAd
=
true
})
return
arrayList
}
return
list
}
fun
deleteDocument
(
item
:
DocumentBean
)
{
val
flag
=
File
(
item
.
path
).
delete
()
if
(
flag
)
{
...
...
@@ -124,5 +152,21 @@ class DocumentFragment() : Fragment() {
companion
object
{
var
pdfNeedRefresh
:
Boolean
=
true
fun
Activity
.
jumpOtherDocument
(
item
:
DocumentBean
)
{
if
(
item
.
type
==
TYPE_WORD
)
{
WordActivity
.
wordDocumentBean
=
item
WordActivity
.
launchDocViewer
(
this
,
3
,
item
.
path
,
-
1
,
100
)
}
if
(
item
.
type
==
TYPE_EXCEL
)
{
ExcelActivity
.
excelDocumentBean
=
item
ExcelActivity
.
launchDocViewer
(
this
,
3
,
item
.
path
,
-
1
,
100
)
}
if
(
item
.
type
==
TYPE_PPT
)
{
PptActivity
.
pptDocumentBean
=
item
PptActivity
.
launchDocViewer
(
this
,
3
,
item
.
path
,
-
1
,
100
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/excel/ExcelActivity.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.excel
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.content.Intent
import
android.content.pm.ActivityInfo
import
android.view.View
import
android.view.animation.Animation
import
android.view.animation.TranslateAnimation
import
android.view.inputmethod.EditorInfo
import
androidx.activity.addCallback
import
androidx.core.widget.addTextChangedListener
import
androidx.lifecycle.lifecycleScope
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobNativeUtils
import
com.base.pdfreaderallpdfreader.base.BaseActivity
import
com.base.pdfreaderallpdfreader.bean.DocumentBean
import
com.base.pdfreaderallpdfreader.databinding.ActivityExcelBinding
import
com.base.pdfreaderallpdfreader.ui.view.DocumentDialog.showDocumentMore
import
com.base.pdfreaderallpdfreader.utils.KeyBoardUtils.hideKeyboard
import
com.base.pdfreaderallpdfreader.utils.KeyBoardUtils.showKeyBoard
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.base.pdfreaderallpdfreader.utils.SpStringUtils
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.office.constant.EventConstant
import
com.cherry.lib.doc.office.ss.control.SSControl
import
com.cherry.lib.doc.office.ss.control.Spreadsheet
import
com.cherry.lib.doc.office.ss.sheetbar.SheetBar
import
com.cherry.lib.doc.util.Constant
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
import
java.io.File
class
ExcelActivity
:
BaseActivity
<
ActivityExcelBinding
>()
{
private
val
TAG
=
"ExcelActivity"
override
val
binding
:
ActivityExcelBinding
by
lazy
{
ActivityExcelBinding
.
inflate
(
layoutInflater
)
}
companion
object
{
var
excelDocumentBean
:
DocumentBean
=
DocumentBean
()
fun
launchDocViewer
(
activity
:
Activity
,
docSourceType
:
Int
,
pathOrUri
:
String
?,
fileType
:
Int
?
=
null
,
engine
:
Int
?
=
null
)
{
val
intent
=
Intent
(
activity
,
ExcelActivity
::
class
.
java
)
intent
.
putExtra
(
Constant
.
INTENT_SOURCE_KEY
,
docSourceType
)
intent
.
putExtra
(
Constant
.
INTENT_DATA_KEY
,
pathOrUri
)
intent
.
putExtra
(
Constant
.
INTENT_TYPE_KEY
,
fileType
)
intent
.
putExtra
(
Constant
.
INTENT_ENGINE_KEY
,
engine
)
activity
.
startActivity
(
intent
)
}
}
override
fun
initView
()
{
initSpData
(
intent
)
val
file
=
File
(
pathOrUri
?:
""
)
if
(
file
.
exists
())
{
binding
.
tvName
.
text
=
file
.
name
}
AdmobNativeUtils
.
showNativeAd
(
this
,
binding
.
flAd
,
R
.
layout
.
layout_admob_document_in
)
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
binding
.
mDocView
.
onDestroy
()
AdmobNativeUtils
.
onDestroy
()
}
@SuppressLint
(
"ClickableViewAccessibility"
)
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
if
(
isSearchUI
)
{
cancelSearchUI
()
return
@addCallback
}
if
(
AdmobHelper
.
isShowCloseDocumentInter
())
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@ExcelActivity
)
{
if
(
it
)
{
AdmobHelper
.
lastCloseDocumentShowAd
=
System
.
currentTimeMillis
()
}
binding
.
root
.
postDelayed
({
finishToMain
()
},
500
)
}
}
else
{
binding
.
root
.
postDelayed
({
finishToMain
()
},
500
)
}
}
binding
.
flFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
binding
.
ivXuanzhuan
.
setOnClickListener
{
switchOrientation
()
}
binding
.
ivMore
.
setOnClickListener
{
showDocumentMore
(
excelDocumentBean
)
}
binding
.
mDocView
.
singleTapAction
=
{
LogEx
.
logDebug
(
TAG
,
"actionDownCallBack"
)
if
(
isShowTopLayout
)
{
LogEx
.
logDebug
(
TAG
,
"hide"
)
hideTopLayout
()
hideBottomLayout
()
}
else
{
showTopLayout
()
showBottomLayout
()
LogEx
.
logDebug
(
TAG
,
"show"
)
}
}
binding
.
ivSearch
.
setOnClickListener
{
showSearchUI
()
}
binding
.
editSearch
.
addTextChangedListener
{
binding
.
mDocView
.
visibility
=
View
.
VISIBLE
haveSearchResult
=
false
hideBottomLayout
()
getSpreadsheet
()
?.
resetSearchResult
()
}
binding
.
editSearch
.
setOnEditorActionListener
{
v
,
actionId
,
event
->
if
(
actionId
==
EditorInfo
.
IME_ACTION_DONE
)
{
// Perform your action here
searchExcel
()
return
@setOnEditorActionListener
true
}
false
}
binding
.
flPre
.
setOnClickListener
{
getSpreadsheet
()
?.
findBackward
()
}
binding
.
flNext
.
setOnClickListener
{
getSpreadsheet
()
?.
findForward
()
}
lifecycleScope
.
launch
{
delay
(
3000
)
val
ssControl
:
SSControl
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
SSControl
)
val
sheetBar
:
SheetBar
=
ssControl
.
excelView
.
bar
ssControl
.
actionEvent
(
EventConstant
.
SS_SHOW_SHEET
,
0
)
}
}
private
fun
getSpreadsheet
():
Spreadsheet
?
{
val
ssControl
:
SSControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
SSControl
?)
return
(
ssControl
?.
find
as
Spreadsheet
?)
}
private
fun
searchExcel
()
{
val
text
=
binding
.
editSearch
.
text
if
(
text
.
isNullOrEmpty
())
{
return
}
val
flag
=
getSpreadsheet
()
?.
find
(
text
.
toString
())
?:
false
haveSearchResult
=
flag
if
(
flag
)
{
hideKeyboard
(
binding
.
editSearch
)
showBottomLayout
()
}
else
{
binding
.
mDocView
.
visibility
=
View
.
GONE
}
}
private
var
haveSearchResult
:
Boolean
=
false
private
fun
switchOrientation
()
{
requestedOrientation
=
if
(
requestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
)
{
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
}
}
private
var
isShowTopLayout
=
true
private
var
isSearchUI
:
Boolean
=
false
private
fun
showTopLayout
()
{
if
(!
isShowTopLayout
)
{
isShowTopLayout
=
true
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
(),
0f
)
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
VISIBLE
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
private
fun
showBottomLayout
()
{
if
(
isSearchUI
&&
haveSearchResult
)
{
val
bottomAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
binding
.
vAnimatorBottom
.
height
.
toFloat
(),
0f
)
bottomAnim
.
duration
=
200
bottomAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
binding
.
vAnimatorBottom
.
visibility
=
View
.
VISIBLE
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
}
})
binding
.
vAnimatorBottom
.
startAnimation
(
bottomAnim
)
}
}
private
fun
hideTopLayout
()
{
if
(
isShowTopLayout
)
{
isShowTopLayout
=
false
hideKeyboard
(
binding
.
editSearch
)
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
())
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
GONE
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
private
fun
hideBottomLayout
()
{
if
(
isSearchUI
)
{
val
bottomAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
0f
,
binding
.
vAnimatorBottom
.
height
.
toFloat
())
bottomAnim
.
duration
=
200
bottomAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
binding
.
vAnimatorBottom
.
visibility
=
View
.
GONE
}
})
binding
.
vAnimatorBottom
.
startAnimation
(
bottomAnim
)
}
}
private
fun
showSearchUI
()
{
isSearchUI
=
true
binding
.
ivXuanzhuan
.
visibility
=
View
.
GONE
binding
.
ivMore
.
visibility
=
View
.
GONE
binding
.
tvName
.
visibility
=
View
.
INVISIBLE
binding
.
editSearch
.
visibility
=
View
.
VISIBLE
showKeyBoard
(
binding
.
editSearch
)
}
private
fun
cancelSearchUI
()
{
hideBottomLayout
()
isSearchUI
=
false
binding
.
editSearch
.
visibility
=
View
.
GONE
binding
.
ivXuanzhuan
.
visibility
=
View
.
VISIBLE
binding
.
ivMore
.
visibility
=
View
.
VISIBLE
binding
.
tvName
.
visibility
=
View
.
VISIBLE
binding
.
mDocView
.
visibility
=
View
.
VISIBLE
hideKeyboard
(
binding
.
editSearch
)
}
private
var
docSourceType
=
0
private
var
fileType
=
-
1
private
var
engine
:
Int
=
DocEngine
.
INTERNAL
.
value
private
var
pathOrUri
:
String
?
=
null
// 文件地址
private
fun
initSpData
(
intent
:
Intent
?)
{
pathOrUri
=
intent
?.
getStringExtra
(
Constant
.
INTENT_DATA_KEY
)
docSourceType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_SOURCE_KEY
,
0
)
?:
0
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
)
LogEx
.
logDebug
(
TAG
,
"initData-pathOrUri = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
(
pathOrUri
?:
""
)
+
"_/_"
+
System
.
currentTimeMillis
())
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/main/DocumentEx.kt
View file @
f5f2d12d
...
...
@@ -135,6 +135,19 @@ fun getAllDocument(context: Context): MutableList<DocumentBean> {
return
new
}
fun
getPdfFastSize
(
context
:
Context
):
Int
{
val
selectionArgs
=
arrayOf
(
MIME_TYPE_PDF
)
val
list
=
context
.
getMediaFile
(
selectionArgs
=
selectionArgs
)
var
size
=
list
.
size
val
pdfDemo
=
getPdfDemo
(
context
)
if
(
File
(
pdfDemo
.
path
).
exists
())
{
size
+=
1
}
return
size
}
fun
getPdfDocument
(
context
:
Context
):
MutableList
<
DocumentBean
>
{
if
(!
ConstObject
.
haveSaveDemo
)
{
context
.
saveAssetsFile
()
...
...
@@ -247,5 +260,4 @@ fun getDocumentType(mediaBean: MediaBean): String {
}
else
{
TYPE_PPT
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/main/MainActivity.kt
View file @
f5f2d12d
...
...
@@ -2,22 +2,33 @@ package com.base.pdfreaderallpdfreader.ui.main
import
android.content.Intent
import
android.graphics.Color
import
android.net.Uri
import
android.text.Spannable
import
android.text.SpannableString
import
android.text.style.ForegroundColorSpan
import
androidx.core.view.GravityCompat
import
androidx.core.view.updatePadding
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.lifecycleScope
import
androidx.navigation.NavController
import
androidx.navigation.findNavController
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper.lastScanShowAd
import
com.base.pdfreaderallpdfreader.base.BaseActivity
import
com.base.pdfreaderallpdfreader.databinding.ActivityMainBinding
import
com.base.pdfreaderallpdfreader.ui.language.LanguageActivity
import
com.base.pdfreaderallpdfreader.ui.pdf.PdfActivity
import
com.base.pdfreaderallpdfreader.ui.search.SearchActivity
import
com.base.pdfreaderallpdfreader.ui.view.MainDialog.showStoragePermission
import
com.base.pdfreaderallpdfreader.ui.view.PwdDialog.showPdfPwdDialog
import
com.base.pdfreaderallpdfreader.ui.view.RateDialog.showRateDialog
import
com.base.pdfreaderallpdfreader.utils.BarUtils
import
com.base.pdfreaderallpdfreader.utils.PdfBoxUtils
import
com.base.pdfreaderallpdfreader.utils.PdfBoxUtils.checkPdfEncryption
import
com.base.pdfreaderallpdfreader.utils.PermissionUtils.checkStorePermission
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
>()
{
...
...
@@ -47,6 +58,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding
.
includeMain
.
tvTittle
.
text
=
spannableString
binding
.
tvPdfReader
.
text
=
spannableString
}
override
fun
onResume
()
{
super
.
onResume
()
if
(!
checkStorePermission
())
{
showStoragePermission
(
launcher
)
}
...
...
@@ -79,21 +95,59 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding
.
includeMain
.
ivSearch
.
setOnClickListener
{
startActivity
(
Intent
(
this
,
SearchActivity
::
class
.
java
))
}
binding
.
llFileManager
.
setOnClickListener
{
val
intent
=
Intent
(
Intent
.
ACTION_OPEN_DOCUMENT
)
intent
.
addCategory
(
Intent
.
CATEGORY_OPENABLE
)
intent
.
setType
(
"application/pdf"
)
intent
.
flags
=
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
launcher
.
launch
(
intent
)
{
val
uri
=
it
.
data
?.
data
?:
Uri
.
EMPTY
jumpUriPdf
(
uri
)
}
}
binding
.
llRate
.
setOnClickListener
{
showRateDialog
(
true
)
}
}
private
fun
jumpUriPdf
(
uri
:
Uri
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
state
=
checkPdfEncryption
(
uri
=
uri
.
toString
())
launch
(
Dispatchers
.
Main
)
{
if
(
state
==
0
)
{
startActivity
(
Intent
(
this
@MainActivity
,
PdfActivity
::
class
.
java
).
apply
{
putExtra
(
"uri"
,
uri
.
toString
())
})
}
else
{
showPdfPwdDialog
(
state
=
state
,
uri
=
uri
.
toString
(),
isCheckPwd
=
true
,
verificationAction
=
{
pwd
->
startActivity
(
Intent
(
this
@MainActivity
,
PdfActivity
::
class
.
java
).
apply
{
putExtra
(
"uri"
,
uri
.
toString
())
putExtra
(
"pwd"
,
pwd
)
})
})
}
}
}
}
private
fun
starAdGmsScan
()
{
// if (com.base.pdfreaderallpdfreader.ads.AdmobHelper.isShowScanInter() && com.base.pdfreaderallpdfreader.ads.
AdmobHelper.canCommonShowAd()) {
// com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils.showInterstitialAd(activity
) {
//
if (it) {
//
lastScanShowAd = System.currentTimeMillis()
//
}
// starGmsScan(activity
)
//
}
//
} else {
mainViewModel
.
starGmsScan
(
this
)
//
}
if
(
AdmobHelper
.
isShowScanInter
()
&&
AdmobHelper
.
canCommonShowAd
())
{
com
.
base
.
pdfreaderallpdfreader
.
ads
.
admob
.
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
if
(
it
)
{
lastScanShowAd
=
System
.
currentTimeMillis
()
}
mainViewModel
.
starGmsScan
(
this
)
}
}
else
{
mainViewModel
.
starGmsScan
(
this
)
}
}
...
...
app/src/main/java/com/base/pdfreaderallpdfreader/ui/main/home/HomeFragment.kt
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.main.home
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.os.Bundle
...
...
@@ -11,9 +12,14 @@ import android.view.View
import
android.view.ViewGroup
import
androidx.fragment.app.Fragment
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.lifecycleScope
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.databinding.FragmentHomeBinding
import
com.base.pdfreaderallpdfreader.ui.document.DocumentActivity
import
com.base.pdfreaderallpdfreader.ui.main.getPdfFastSize
import
com.base.pdfreaderallpdfreader.utils.PermissionUtils.checkStorePermission
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
class
HomeFragment
:
Fragment
()
{
...
...
@@ -37,14 +43,21 @@ class HomeFragment : Fragment() {
return
root
}
@SuppressLint
(
"SetTextI18n"
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
binding
.
clPdfReader
.
setOnClickListener
{
startActivity
(
Intent
(
requireContext
(),
DocumentActivity
::
class
.
java
))
}
if
(
requireContext
().
checkStorePermission
())
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
size
=
getPdfFastSize
(
requireContext
())
launch
(
Dispatchers
.
Main
)
{
binding
.
tvFileNumber
.
text
=
"$size Files"
}
}
}
}
override
fun
onDestroyView
()
{
...
...
app/src/main/java/com/base/pdfreaderallpdfreader/ui/pdf/DocumentPdfAdapter.kt
View file @
f5f2d12d
...
...
@@ -6,11 +6,13 @@ import android.view.View
import
android.view.ViewGroup
import
androidx.recyclerview.widget.RecyclerView.ViewHolder
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobNativeUtils
import
com.base.pdfreaderallpdfreader.bean.DocumentBean
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_EXCEL
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_PDF
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_PPT
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_WORD
import
com.base.pdfreaderallpdfreader.databinding.ItemAdBinding
import
com.base.pdfreaderallpdfreader.databinding.ItemDocumentPdfBinding
import
com.base.pdfreaderallpdfreader.utils.KotlinExt.toFormatSize
import
com.base.pdfreaderallpdfreader.utils.KotlinExt.toFormatTime
...
...
@@ -33,9 +35,8 @@ class DocumentPdfAdapter() : BaseQuickAdapter<DocumentBean, DocumentPdfAdapter.D
override
fun
onBindViewHolder
(
holder
:
DocumentPdfViewHolder
,
position
:
Int
,
item
:
DocumentBean
?)
{
if
(
item
==
null
)
return
if
(
item
.
isAd
)
{
//todo
// val binding = ItemAdBinding.bind(holder.itemView)
// com.base.pdfreaderallpdfreader.ads.admob.AdmobNativeUtils.showNativeAd(null, binding.flAd, R.layout.layout_admob_document)
val
binding
=
ItemAdBinding
.
bind
(
holder
.
itemView
)
AdmobNativeUtils
.
showNativeAd
(
null
,
binding
.
flAd
,
R
.
layout
.
layout_admob_document
)
}
else
{
val
binding
=
ItemDocumentPdfBinding
.
bind
(
holder
.
itemView
)
changeIcon
(
item
,
binding
)
...
...
app/src/main/java/com/base/pdfreaderallpdfreader/ui/pdf/PdfActivity.kt
View file @
f5f2d12d
...
...
@@ -28,6 +28,7 @@ import com.artifex.mupdfdemo.MuPDFView
import
com.artifex.mupdfdemo.SearchTask
import
com.artifex.mupdfdemo.SearchTaskResult
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobNativeUtils
import
com.base.pdfreaderallpdfreader.base.BaseActivity
import
com.base.pdfreaderallpdfreader.bean.ConstObject
import
com.base.pdfreaderallpdfreader.bean.ConstObject.DO_SAVE_PDF
...
...
@@ -84,7 +85,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>() {
override
fun
onDestroy
()
{
super
.
onDestroy
()
muPDFCore
?.
onDestroy
()
// com.base.pdfreaderallpdfreader.ads.admob.
AdmobNativeUtils.onDestroy()
AdmobNativeUtils
.
onDestroy
()
}
...
...
@@ -154,7 +155,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>() {
}
}
// com.base.pdfreaderallpdfreader.ads.admob.
AdmobNativeUtils.showNativeAd(this, binding.flAd, R.layout.layout_admob_document_in)
AdmobNativeUtils
.
showNativeAd
(
this
,
binding
.
flAd
,
R
.
layout
.
layout_admob_document_in
)
}
fun
jumpPage
(
pageIndex
:
Int
)
{
...
...
app/src/main/java/com/base/pdfreaderallpdfreader/ui/pdf/PdfLoadingActivity.kt
View file @
f5f2d12d
...
...
@@ -4,6 +4,8 @@ import android.content.Intent
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.lifecycleScope
import
com.artifex.mupdfdemo.MuPDFCore
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils
import
com.base.pdfreaderallpdfreader.base.BaseActivity
import
com.base.pdfreaderallpdfreader.bean.ConstObject.DO_MERGE_PDF
import
com.base.pdfreaderallpdfreader.bean.ConstObject.DO_SAVE_PDF
...
...
@@ -44,15 +46,14 @@ class PdfLoadingActivity : BaseActivity<ActivityPdfLoadingBinding>() {
// }
}
fun
progressFinishAd
(
next
:
()
->
Unit
)
{
//todo
// if (com.base.pdfreaderallpdfreader.ads.AdmobHelper.canCommonShowAd()) {
// com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils.showInterstitialAd(this) {
// next.invoke()
// }
// } else {
// next.invoke()
// }
private
fun
progressFinishAd
(
next
:
()
->
Unit
)
{
if
(
AdmobHelper
.
canCommonShowAd
())
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
)
{
next
.
invoke
()
}
}
else
{
next
.
invoke
()
}
}
override
fun
initView
()
{
...
...
app/src/main/java/com/base/pdfreaderallpdfreader/ui/ppt/PptActivity.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.ppt
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.content.Intent
import
android.content.pm.ActivityInfo
import
android.view.View
import
android.view.animation.Animation
import
android.view.animation.TranslateAnimation
import
androidx.activity.addCallback
import
androidx.core.view.isVisible
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobNativeUtils
import
com.base.pdfreaderallpdfreader.base.BaseActivity
import
com.base.pdfreaderallpdfreader.bean.DocumentBean
import
com.base.pdfreaderallpdfreader.databinding.ActivityPptBinding
import
com.base.pdfreaderallpdfreader.helper.MyApplication
import
com.base.pdfreaderallpdfreader.ui.view.DocumentDialog.showDocumentMore
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.base.pdfreaderallpdfreader.utils.SpStringUtils
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.office.pg.control.PGControl
import
com.cherry.lib.doc.util.Constant
class
PptActivity
:
BaseActivity
<
ActivityPptBinding
>()
{
private
val
TAG
=
"PptActivity"
override
val
binding
:
ActivityPptBinding
by
lazy
{
ActivityPptBinding
.
inflate
(
layoutInflater
)
}
companion
object
{
var
pptDocumentBean
:
DocumentBean
=
DocumentBean
()
fun
launchDocViewer
(
activity
:
Activity
,
docSourceType
:
Int
,
path
:
String
?,
fileType
:
Int
?
=
null
,
engine
:
Int
?
=
null
)
{
val
intent
=
Intent
(
activity
,
PptActivity
::
class
.
java
)
intent
.
putExtra
(
Constant
.
INTENT_SOURCE_KEY
,
docSourceType
)
intent
.
putExtra
(
Constant
.
INTENT_DATA_KEY
,
path
)
intent
.
putExtra
(
Constant
.
INTENT_TYPE_KEY
,
fileType
)
intent
.
putExtra
(
Constant
.
INTENT_ENGINE_KEY
,
engine
)
activity
.
startActivity
(
intent
)
}
}
override
fun
onResume
()
{
super
.
onResume
()
updateAppLanguage
(
MyApplication
.
pptLanguage
)
{
MyApplication
.
pptLanguage
=
it
}
}
private
var
totalPageNumber
=
0
@SuppressLint
(
"SetTextI18n"
)
override
fun
initView
()
{
initSpData
(
intent
)
binding
.
mDocView
.
getPageNumberAction
=
{
current
,
total
->
if
(!
binding
.
tvPageCount
.
isVisible
)
{
binding
.
tvPageCount
.
isVisible
=
true
}
totalPageNumber
=
total
binding
.
tvPageCount
.
text
=
"$current/$total"
}
binding
.
mDocView
.
singleTapAction
=
{
LogEx
.
logDebug
(
TAG
,
"actionDownCallBack"
)
if
(
isShowTopLayout
)
{
LogEx
.
logDebug
(
TAG
,
"hide"
)
hideTopLayout
()
}
else
{
showTopLayout
()
LogEx
.
logDebug
(
TAG
,
"show"
)
}
}
AdmobNativeUtils
.
showNativeAd
(
this
,
binding
.
flAd
,
R
.
layout
.
layout_admob_document_in
)
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
binding
.
mDocView
.
onDestroy
()
AdmobNativeUtils
.
onDestroy
()
}
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
if
(
AdmobHelper
.
isShowCloseDocumentInter
())
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@PptActivity
)
{
if
(
it
)
{
AdmobHelper
.
lastCloseDocumentShowAd
=
System
.
currentTimeMillis
()
}
binding
.
root
.
postDelayed
({
finishToMain
()
},
500
)
}
}
else
{
binding
.
root
.
postDelayed
({
finishToMain
()
},
500
)
}
}
binding
.
flFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
binding
.
ivXuanzhuan
.
setOnClickListener
{
switchOrientation
()
}
binding
.
ivMore
.
setOnClickListener
{
showDocumentMore
(
pptDocumentBean
,
totalPageNumber
-
1
)
{
pageIndex
->
((
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
PGControl
)
.
pgView
.
pgPrintMode
.
listView
.
showPDFPageForIndex
(
pageIndex
))
}
}
}
private
fun
switchOrientation
()
{
requestedOrientation
=
if
(
requestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
)
{
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
}
}
private
var
docSourceType
=
0
private
var
fileType
=
-
1
private
var
engine
:
Int
=
DocEngine
.
INTERNAL
.
value
private
var
pathOrUri
:
String
?
=
null
// 文件地址
private
fun
initSpData
(
intent
:
Intent
?)
{
pathOrUri
=
intent
?.
getStringExtra
(
Constant
.
INTENT_DATA_KEY
)
docSourceType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_SOURCE_KEY
,
0
)
?:
0
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
)
LogEx
.
logDebug
(
TAG
,
"initData-docUrl = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
(
pathOrUri
?:
""
)
+
"_/_"
+
System
.
currentTimeMillis
())
}
private
fun
showTopLayout
()
{
if
(!
isShowTopLayout
)
{
isShowTopLayout
=
true
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
(),
0f
)
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
VISIBLE
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
private
var
isShowTopLayout
=
true
private
fun
hideTopLayout
()
{
if
(
isShowTopLayout
)
{
isShowTopLayout
=
false
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
())
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
GONE
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/splash/SplashActivity.kt
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.splash
import
android.Manifest
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.os.Build
import
androidx.activity.result.contract.ActivityResultContracts
import
androidx.core.view.updatePadding
import
androidx.lifecycle.ViewModelProvider
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper.initAdmobAd
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobOpenUtils
import
com.base.pdfreaderallpdfreader.base.BaseActivity
import
com.base.pdfreaderallpdfreader.bean.ConstObject.ifAgreePrivacy
import
com.base.pdfreaderallpdfreader.bean.ConstObject.isFirstStart
import
com.base.pdfreaderallpdfreader.databinding.ActivitySplashBinding
import
com.base.pdfreaderallpdfreader.fcm.NotificationHoverUtils
import
com.base.pdfreaderallpdfreader.helper.EventUtils
import
com.base.pdfreaderallpdfreader.helper.MyApplication
import
com.base.pdfreaderallpdfreader.helper.UmpUtils
import
com.base.pdfreaderallpdfreader.helper.UmpUtils.requestUMP
import
com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCalled
import
com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCanAd
import
com.base.pdfreaderallpdfreader.ui.language.LanguageActivity
import
com.base.pdfreaderallpdfreader.ui.main.MainActivity
import
com.base.pdfreaderallpdfreader.utils.BarUtils
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
java.util.Calendar
import
java.util.Locale
import
java.util.concurrent.atomic.AtomicBoolean
@SuppressLint
(
"CustomSplashScreen"
)
class
SplashActivity
:
BaseActivity
<
ActivitySplashBinding
>()
{
private
val
TAG
=
"SplashActivity"
private
lateinit
var
splashViewModel
:
SplashViewModel
override
val
binding
:
ActivitySplashBinding
by
lazy
{
ActivitySplashBinding
.
inflate
(
layoutInflater
)
}
private
var
actionId
=
""
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
splashViewModel
=
ViewModelProvider
(
this
)[
SplashViewModel
::
class
.
java
]
if
(
Build
.
VERSION
.
SDK_INT
>=
33
)
{
registerForActivityResult
(
ActivityResultContracts
.
RequestPermission
())
{}.
launch
(
Manifest
.
permission
.
POST_NOTIFICATIONS
)
}
actionId
=
intent
.
extras
?.
getString
(
"actionId"
)
?:
""
LogEx
.
logDebug
(
TAG
,
"actionId=$actionId"
)
if
(
actionId
.
isNotEmpty
())
{
NotificationHoverUtils
.
stopNotificationHandler
()
}
initWeatherUI
()
val
isHotLaunch
=
intent
.
extras
?.
getBoolean
(
"isHotLaunch"
)
?:
false
ifAgreePrivacy
=
true
if
(
ifAgreePrivacy
)
{
if
(
isHotLaunch
)
{
agreePrivacy
()
}
else
{
if
(!
umpCalled
)
{
//第一次请求ump
UmpUtils
.
callback
=
{
umpCalled
=
true
umpCanAd
=
it
LogEx
.
logDebug
(
TAG
,
"UmpUtils.callback $it"
)
(
application
as
MyApplication
).
initSolarEngine
(
it
)
agreePrivacy
()
EventUtils
.
event
(
"ump"
,
"umpCanAd=$umpCanAd"
)
}
requestUMP
(
this
)
}
else
{
agreePrivacy
()
}
}
}
}
private
fun
agreePrivacy
()
{
if
(
umpCanAd
)
{
initAdmobAd
(
this
)
showAd
()
splashViewModel
.
startJumpJob
=
true
splashViewModel
.
startJumpJob
(
this
)
}
else
{
jumpNext
()
}
}
private
fun
initWeatherUI
()
{
// 获取当前日期
val
calendar
:
Calendar
=
Calendar
.
getInstance
()
val
month
:
Int
=
calendar
.
get
(
Calendar
.
MONTH
)
// 获取当月的第几天
val
dayOfMonth
:
Int
=
calendar
.
get
(
Calendar
.
DAY_OF_MONTH
)
//是星期几
val
dayOfWeek
=
calendar
.
get
(
Calendar
.
DAY_OF_WEEK
)
val
dayOfWeekName
=
when
(
dayOfWeek
)
{
Calendar
.
SUNDAY
->
R
.
string
.
sunday
Calendar
.
MONDAY
->
R
.
string
.
monday
Calendar
.
TUESDAY
->
R
.
string
.
tuesday
Calendar
.
WEDNESDAY
->
R
.
string
.
wednesday
Calendar
.
THURSDAY
->
R
.
string
.
thursday
Calendar
.
FRIDAY
->
R
.
string
.
friday
Calendar
.
SATURDAY
->
R
.
string
.
saturday
else
->
0
}
// binding.tvXingqi.text = resources.getString(dayOfWeekName)
val
monthName
=
when
(
month
)
{
0
->
"January"
1
->
"February"
2
->
"March"
3
->
"April"
4
->
"May"
5
->
"June"
6
->
"July"
7
->
"August"
8
->
"September"
9
->
"October"
10
->
"November"
11
->
"December"
else
->
"Unknown"
}
// binding.tvMonthDay.text = "$monthName $dayOfMonth"
}
private
fun
showAd
()
{
LogEx
.
logDebug
(
TAG
,
"showAd"
)
if
(
AdmobOpenUtils
.
haveReadAd
())
{
showReadOpenAd
()
}
else
{
if
(
AdmobInterstitialUtils
.
haveReadAd
())
{
showReadOpenAd
()
}
else
{
AdmobOpenUtils
.
loadAppOpenAd
{
loaded
->
LogEx
.
logDebug
(
TAG
,
"loadAppOpenAd loaded=$loaded"
)
if
(
loaded
)
{
showReadOpenAd
()
}
else
{
LogEx
.
logDebug
(
TAG
,
"no load ad jumpNext"
)
jumpNext
()
}
}
}
}
}
private
fun
showReadOpenAd
()
{
AdmobOpenUtils
.
showAppOpenAd
(
this
,
showBefore
=
{
if
(
it
)
{
splashViewModel
.
pauseJumpJob
()
}
},
onHidden
=
{
LogEx
.
logDebug
(
TAG
,
"ad jumpNext"
)
jumpNext
()
})
}
private
var
jump
:
AtomicBoolean
=
AtomicBoolean
(
false
)
fun
jumpNext
()
{
if
(
jump
.
get
())
{
return
}
jump
.
set
(
true
)
binding
.
root
.
postDelayed
({
if
(
isFirstStart
)
{
firstStartJump
()
}
else
{
LogEx
.
logDebug
(
TAG
,
"jumpNext actionId=$actionId"
)
when
(
actionId
)
{
else
->
{
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
actionId
)
})
}
}
this
.
intent
.
extras
?.
clear
()
finish
()
}
},
100
)
}
private
fun
firstStartJump
()
{
isFirstStart
=
false
if
(
Locale
.
getDefault
().
language
!=
Locale
.
ENGLISH
.
language
)
{
startActivity
(
Intent
(
this
,
LanguageActivity
::
class
.
java
))
}
else
{
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
))
}
finish
()
}
override
fun
onPause
()
{
super
.
onPause
()
splashViewModel
.
pauseJumpJob
()
}
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
))
override
fun
onResume
()
{
super
.
onResume
()
splashViewModel
.
startJumpJob
(
this
)
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/splash/SplashViewModel.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.splash
import
android.content.ContentValues.TAG
import
androidx.lifecycle.LifecycleCoroutineScope
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper.open_ad_loading
import
com.base.pdfreaderallpdfreader.bean.ConstObject
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
class
SplashViewModel
:
ViewModel
()
{
var
startJumpJob
:
Boolean
=
false
private
var
jumpJob
:
Job
?
=
null
private
var
loadingTime
=
AppPreferences
.
getInstance
().
getString
(
open_ad_loading
,
"15"
).
toInt
()
/**
* 超时跳转
*/
fun
startJumpJob
(
splashActivity
:
SplashActivity
)
{
if
(
ConstObject
.
ifAgreePrivacy
&&
startJumpJob
)
{
if
(
jumpJob
==
null
)
{
val
startTime
=
System
.
currentTimeMillis
()
jumpJob
=
viewModelScope
.
launch
{
LogEx
.
logDebug
(
TAG
,
"open_ad_loading=$loadingTime"
)
delay
(
loadingTime
*
1000L
)
val
endTime
=
System
.
currentTimeMillis
()
LogEx
.
logDebug
(
TAG
,
"超时跳转 time=${endTime - startTime}"
)
splashActivity
.
jumpNext
()
}
}
}
}
/**
* 暂停超时跳转
*/
fun
pauseJumpJob
()
{
jumpJob
?.
cancel
()
jumpJob
=
null
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/view/DocumentDialog.kt
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.view
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.content.Context
import
android.view.LayoutInflater
import
android.view.View
...
...
@@ -13,6 +14,7 @@ import com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_PPT
import
com.base.pdfreaderallpdfreader.bean.DocumentBean.Companion.TYPE_WORD
import
com.base.pdfreaderallpdfreader.databinding.DialogDocumentDetailBinding
import
com.base.pdfreaderallpdfreader.databinding.DialogDocumentHomeMoreBinding
import
com.base.pdfreaderallpdfreader.databinding.DialogDocumentMoreBinding
import
com.base.pdfreaderallpdfreader.databinding.DialogPageNumberBinding
import
com.base.pdfreaderallpdfreader.ui.document.DocumentFragment
import
com.base.pdfreaderallpdfreader.ui.view.DialogView.showDeleteDialog
...
...
@@ -123,58 +125,58 @@ object DocumentDialog {
}
//
fun Activity.showDocumentMore(
//
documentBean: DocumentBean,
//
pageNumber: Int = 0,
//
jumpAction: ((pageIndex: Int) -> Unit)? = null
//
) {
//
val dialog = BottomSheetDialog(this, R.style.BottomSheetDialog)
//
val binding = DialogDocumentMoreBinding.inflate(LayoutInflater.from(this))
//
dialog.setContentView(binding.root)
//
dialog.setCanceledOnTouchOutside(false)
//
//
dialog.show()
//
//
val parentView = binding.root.parent as View
//
val behavior = BottomSheetBehavior.from(parentView)
//
//展开
//
behavior.state = BottomSheetBehavior.STATE_EXPANDED
//
//
if (documentBean.type == TYPE_EXCEL) {
//
binding.llJump.visibility = View.GONE
//
}
//
//
if (documentBean.isBookmarked) {
// binding.ivBookmark.setImageResource(R.mipmap.h_soucang
_s)
//
} else {
// binding.ivBookmark.setImageResource(R.mipmap.h_soucang
_n)
//
}
//
//
binding.ivBookmark.setOnClickListener {
//
binding.ivBookmark.isSelected = !binding.ivBookmark.isSelected
//
//
if (binding.ivBookmark.isSelected) {
// binding.ivBookmark.setImageResource(R.mipmap.h_soucang
_s)
//
SpStringUtils.addSpString(SpStringUtils.BOOKMARK_KEY, documentBean.path)
//
} else {
// binding.ivBookmark.setImageResource(R.mipmap.h_soucang
_n)
//
SpStringUtils.deleteSpString(SpStringUtils.BOOKMARK_KEY, documentBean.path)
//
}
//
}
//
binding.llDetail.setOnClickListener {
//
showDocumentDetail(documentBean.path)
//
}
//
binding.llShare.setOnClickListener {
//
documentShare(documentBean)
//
}
//
binding.llJump.setOnClickListener {
//
showJumpPageNumberDialog(pageNumber) { pageIndex ->
//
dialog.dismiss()
//
jumpAction?.invoke(pageIndex)
//
}
//
}
//
//
}
fun
Activity
.
showDocumentMore
(
documentBean
:
DocumentBean
,
pageNumber
:
Int
=
0
,
jumpAction
:
((
pageIndex
:
Int
)
->
Unit
)?
=
null
)
{
val
dialog
=
BottomSheetDialog
(
this
,
R
.
style
.
BottomSheetDialog
)
val
binding
=
DialogDocumentMoreBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
dialog
.
setContentView
(
binding
.
root
)
dialog
.
setCanceledOnTouchOutside
(
false
)
dialog
.
show
()
val
parentView
=
binding
.
root
.
parent
as
View
val
behavior
=
BottomSheetBehavior
.
from
(
parentView
)
//展开
behavior
.
state
=
BottomSheetBehavior
.
STATE_EXPANDED
if
(
documentBean
.
type
==
TYPE_EXCEL
)
{
binding
.
llJump
.
visibility
=
View
.
GONE
}
if
(
documentBean
.
isBookmarked
)
{
binding
.
ivBookmark
.
setImageResource
(
R
.
mipmap
.
pdf_bookmark
_s
)
}
else
{
binding
.
ivBookmark
.
setImageResource
(
R
.
mipmap
.
pdf_bookmark
_n
)
}
binding
.
ivBookmark
.
setOnClickListener
{
binding
.
ivBookmark
.
isSelected
=
!
binding
.
ivBookmark
.
isSelected
if
(
binding
.
ivBookmark
.
isSelected
)
{
binding
.
ivBookmark
.
setImageResource
(
R
.
mipmap
.
pdf_bookmark
_s
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
BOOKMARK_KEY
,
documentBean
.
path
)
}
else
{
binding
.
ivBookmark
.
setImageResource
(
R
.
mipmap
.
pdf_bookmark
_n
)
SpStringUtils
.
deleteSpString
(
SpStringUtils
.
BOOKMARK_KEY
,
documentBean
.
path
)
}
}
binding
.
llDetail
.
setOnClickListener
{
showDocumentDetail
(
documentBean
.
path
)
}
binding
.
llShare
.
setOnClickListener
{
documentShare
(
documentBean
)
}
binding
.
llJump
.
setOnClickListener
{
showJumpPageNumberDialog
(
pageNumber
)
{
pageIndex
->
dialog
.
dismiss
()
jumpAction
?.
invoke
(
pageIndex
)
}
}
}
fun
Context
.
showJumpPageNumberDialog
(
pageNumber
:
Int
,
okAction
:
((
pageIndex
:
Int
)
->
Unit
)?)
{
val
dialog
=
BottomSheetDialog
(
this
,
R
.
style
.
BottomSheetDialog
)
...
...
app/src/main/java/com/base/pdfreaderallpdfreader/ui/view/RateDialog.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.view
import
android.annotation.SuppressLint
import
android.content.Context
import
android.content.Intent
import
android.net.Uri
import
android.view.LayoutInflater
import
android.view.View
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.databinding.DialogRateStarBinding
import
com.base.pdfreaderallpdfreader.utils.AppPreferences
import
com.google.android.material.bottomsheet.BottomSheetBehavior
import
com.google.android.material.bottomsheet.BottomSheetDialog
object
RateDialog
{
fun
Context
.
showRateDialog
(
mustShow
:
Boolean
=
false
)
{
if
(!
mustShow
)
{
if
(
AppPreferences
.
getInstance
().
getBoolean
(
"isRated"
,
false
))
{
return
}
}
val
dialog
=
BottomSheetDialog
(
this
,
R
.
style
.
BottomSheetDialog
)
val
binding
=
DialogRateStarBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
dialog
.
setContentView
(
binding
.
root
)
dialog
.
setCanceledOnTouchOutside
(
false
)
dialog
.
show
()
val
parentView
=
binding
.
root
.
parent
as
View
val
behavior
=
BottomSheetBehavior
.
from
(
parentView
)
//展开
behavior
.
state
=
BottomSheetBehavior
.
STATE_EXPANDED
listOf
(
binding
.
iv1
,
binding
.
iv2
,
binding
.
iv3
,
binding
.
iv4
,
binding
.
iv5
).
forEachIndexed
{
index
,
it
->
it
.
setOnClickListener
{
setStar
(
binding
,
index
)
}
}
binding
.
tvSubmit
.
setOnClickListener
{
if
(
star
>=
5
)
{
AppPreferences
.
getInstance
().
put
(
"isRated"
,
true
)
try
{
val
uri
=
Uri
.
parse
(
"https://play.google.com/store/apps/details?id="
+
this
.
packageName
)
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
uri
)
this
.
startActivity
(
intent
)
}
catch
(
_
:
Exception
)
{
}
}
dialog
.
dismiss
()
}
dialog
.
setOnDismissListener
{
AppPreferences
.
getInstance
().
put
(
"isRated"
,
true
)
}
}
private
var
star
=
5
@SuppressLint
(
"SetTextI18n"
)
private
fun
setStar
(
binding
:
DialogRateStarBinding
,
star
:
Int
)
{
val
context
=
binding
.
root
.
context
this
.
star
=
star
+
1
// if (this.star < 3) {
// binding.ivFace.setImageResource(R.mipmap.pingfeniconk)
// } else {
// binding.ivFace.setImageResource(R.mipmap.pingfenicon)
// }
listOf
(
binding
.
iv1
,
binding
.
iv2
,
binding
.
iv3
,
binding
.
iv4
,
binding
.
iv5
).
forEachIndexed
{
index
,
it
->
it
.
setImageResource
(
if
(
index
<=
star
)
{
R
.
mipmap
.
pdf_xing_s
}
else
{
R
.
mipmap
.
pdf_xing_n
}
)
}
when
(
this
.
star
)
{
in
1
..
2
->
{
binding
.
tv1
.
text
=
context
.
getString
(
R
.
string
.
oh_no
)
binding
.
tv2
.
text
=
context
.
getString
(
R
.
string
.
leave_us_your_feedback
)
binding
.
ivFace
.
setImageResource
(
R
.
mipmap
.
pdf_expression2
)
}
in
3
..
4
->
{
binding
.
tv1
.
text
=
context
.
getString
(
R
.
string
.
oh_we_are_sorry
)
binding
.
tv2
.
text
=
context
.
getString
(
R
.
string
.
leave_us_your_feedback
)
binding
.
ivFace
.
setImageResource
(
R
.
mipmap
.
pdf_expression1
)
}
5
->
{
binding
.
tv1
.
text
=
context
.
getString
(
R
.
string
.
much_appreciated
)
binding
.
tv2
.
text
=
context
.
getString
(
R
.
string
.
your_support_is_our_motivation
)
binding
.
ivFace
.
setImageResource
(
R
.
mipmap
.
pdf_expression3
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/ui/word/WordActivity.kt
0 → 100644
View file @
f5f2d12d
package
com.base.pdfreaderallpdfreader.ui.word
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.content.Intent
import
android.content.pm.ActivityInfo
import
android.graphics.Color
import
android.view.View
import
android.view.animation.Animation
import
android.view.animation.TranslateAnimation
import
android.view.inputmethod.EditorInfo
import
androidx.activity.addCallback
import
androidx.core.content.ContextCompat
import
androidx.core.view.isVisible
import
androidx.core.widget.addTextChangedListener
import
com.base.pdfreaderallpdfreader.R
import
com.base.pdfreaderallpdfreader.ads.AdmobHelper
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobInterstitialUtils
import
com.base.pdfreaderallpdfreader.ads.admob.AdmobNativeUtils
import
com.base.pdfreaderallpdfreader.base.BaseActivity
import
com.base.pdfreaderallpdfreader.bean.DocumentBean
import
com.base.pdfreaderallpdfreader.databinding.ActivityWordBinding
import
com.base.pdfreaderallpdfreader.ui.view.DocumentDialog.showDocumentMore
import
com.base.pdfreaderallpdfreader.utils.KeyBoardUtils.hideKeyboard
import
com.base.pdfreaderallpdfreader.utils.KeyBoardUtils.showKeyBoard
import
com.base.pdfreaderallpdfreader.utils.LogEx
import
com.base.pdfreaderallpdfreader.utils.SpStringUtils
import
com.cherry.lib.doc.bean.DocEngine
import
com.cherry.lib.doc.office.constant.EventConstant.APP_PAGE_DOWN_ID
import
com.cherry.lib.doc.office.constant.EventConstant.APP_PAGE_UP_ID
import
com.cherry.lib.doc.office.wp.control.WPControl
import
com.cherry.lib.doc.office.wp.control.WPFind
import
com.cherry.lib.doc.util.Constant
import
java.io.File
class
WordActivity
:
BaseActivity
<
ActivityWordBinding
>()
{
private
val
TAG
=
"WordActivity"
override
val
binding
:
ActivityWordBinding
by
lazy
{
ActivityWordBinding
.
inflate
(
layoutInflater
)
}
private
var
totalPageNumber
=
0
private
var
currentPageNumber
=
0
override
fun
onResume
()
{
super
.
onResume
()
// updateAppLanguage(MyApplication.wordLanguage) {
// MyApplication.wordLanguage = it
// }
}
@SuppressLint
(
"SetTextI18n"
)
override
fun
initView
()
{
initSpData
(
intent
)
val
file
=
File
(
wordDocumentBean
.
path
)
binding
.
tvName
.
text
=
file
.
name
binding
.
mDocView
.
getPageNumberAction
=
{
current
,
total
->
LogEx
.
logDebug
(
TAG
,
"getPageNumberAction"
)
if
(!
binding
.
tvPageCount
.
isVisible
)
{
binding
.
tvPageCount
.
isVisible
=
true
}
currentPageNumber
=
current
totalPageNumber
=
total
binding
.
tvPageCount
.
text
=
"$current/$total"
setVerticalSeekbar
(
current
,
total
)
}
binding
.
mDocView
.
singleTapAction
=
{
LogEx
.
logDebug
(
TAG
,
"actionDownCallBack"
)
if
(
isShowTopLayout
)
{
LogEx
.
logDebug
(
TAG
,
"hide"
)
hideTopLayout
()
hideBottomLayout
()
}
else
{
showTopLayout
()
showBottomLayout
()
LogEx
.
logDebug
(
TAG
,
"show"
)
}
}
AdmobNativeUtils
.
showNativeAd
(
this
,
binding
.
flAd
,
R
.
layout
.
layout_admob_document_in
)
}
private
fun
setVerticalSeekbar
(
current
:
Int
,
max
:
Int
)
{
binding
.
verticalSeekbar
.
showThumb
=
true
binding
.
verticalSeekbar
.
thumbContainerColor
=
Color
.
TRANSPARENT
binding
.
verticalSeekbar
.
thumbPlaceholderDrawable
=
ContextCompat
.
getDrawable
(
this
,
R
.
mipmap
.
fanye
)
if
(
binding
.
verticalSeekbar
.
maxValue
!=
max
-
1
)
{
binding
.
verticalSeekbar
.
maxValue
=
max
-
1
}
val
process
=
max
-
current
LogEx
.
logDebug
(
TAG
,
"process=$process $current $max"
)
binding
.
verticalSeekbar
.
progress
=
process
}
override
fun
initListener
()
{
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
if
(
isSearchUI
)
{
cancelSearchUI
()
return
@addCallback
}
LogEx
.
logDebug
(
TAG
,
"finishToMain"
)
if
(
AdmobHelper
.
isShowCloseDocumentInter
())
{
AdmobInterstitialUtils
.
showInterstitialAd
(
this
@WordActivity
)
{
if
(
it
)
{
AdmobHelper
.
lastCloseDocumentShowAd
=
System
.
currentTimeMillis
()
}
binding
.
root
.
postDelayed
({
finishToMain
()
},
500
)
}
}
else
{
binding
.
root
.
postDelayed
({
finishToMain
()
},
500
)
}
}
binding
.
flFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
binding
.
ivXuanzhuan
.
setOnClickListener
{
switchOrientation
()
}
binding
.
ivMore
.
setOnClickListener
{
showDocumentMore
(
wordDocumentBean
,
totalPageNumber
-
1
)
{
pageIndex
->
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?)
if
(
pageIndex
>
currentPageNumber
)
{
wpControl
?.
wpView
?.
showPage
(
pageIndex
,
APP_PAGE_DOWN_ID
)
}
else
{
wpControl
?.
wpView
?.
showPage
(
pageIndex
,
APP_PAGE_UP_ID
)
}
// wpControl.actionEvent(APP_PAGE_UP_ID, null)
}
}
binding
.
ivSearch
.
setOnClickListener
{
showSearchUI
()
}
binding
.
editSearch
.
addTextChangedListener
{
binding
.
mDocView
.
visibility
=
View
.
VISIBLE
binding
.
tvPageCount
.
visibility
=
View
.
VISIBLE
haveSearchResult
=
false
hideBottomLayout
()
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?)
(
wpControl
?.
find
as
WPFind
?)
?.
resetSearchResult
()
}
binding
.
editSearch
.
setOnEditorActionListener
{
v
,
actionId
,
event
->
if
(
actionId
==
EditorInfo
.
IME_ACTION_DONE
)
{
// Perform your action here
searchWord
()
return
@setOnEditorActionListener
true
}
false
}
binding
.
flPre
.
setOnClickListener
{
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?)
(
wpControl
?.
find
as
WPFind
?)
?.
findBackward
()
}
binding
.
flNext
.
setOnClickListener
{
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?)
(
wpControl
?.
find
as
WPFind
).
findForward
()
}
binding
.
verticalSeekbar
.
setOnReleaseListener
{
progress
->
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?)
LogEx
.
logDebug
(
TAG
,
"progress=$progress"
)
val
pageIndex
=
totalPageNumber
-
1
-
progress
if
(
progress
>
currentPageNumber
)
{
wpControl
?.
wpView
?.
showPage
(
pageIndex
,
APP_PAGE_DOWN_ID
)
}
else
{
wpControl
?.
wpView
?.
showPage
(
pageIndex
,
APP_PAGE_UP_ID
)
}
}
}
private
var
haveSearchResult
:
Boolean
=
false
private
fun
searchWord
()
{
val
text
=
binding
.
editSearch
.
text
if
(
text
.
isNullOrEmpty
())
{
return
}
val
wpControl
:
WPControl
?
=
(
binding
.
mDocView
.
iOffice
?.
control
?.
appControl
as
WPControl
?)
val
flag
=
(
wpControl
?.
find
as
WPFind
?)
?.
find
(
text
.
toString
())
haveSearchResult
=
flag
?:
false
if
(
flag
==
true
)
{
hideKeyboard
(
binding
.
editSearch
)
showBottomLayout
()
}
else
{
binding
.
mDocView
.
visibility
=
View
.
GONE
}
}
private
var
isSearchUI
:
Boolean
=
false
private
fun
showSearchUI
()
{
isSearchUI
=
true
binding
.
ivXuanzhuan
.
visibility
=
View
.
GONE
binding
.
tvPageCount
.
visibility
=
View
.
GONE
binding
.
ivMore
.
visibility
=
View
.
GONE
binding
.
tvName
.
visibility
=
View
.
INVISIBLE
binding
.
editSearch
.
visibility
=
View
.
VISIBLE
showKeyBoard
(
binding
.
editSearch
)
}
private
fun
cancelSearchUI
()
{
hideBottomLayout
()
isSearchUI
=
false
binding
.
editSearch
.
visibility
=
View
.
GONE
binding
.
ivXuanzhuan
.
visibility
=
View
.
VISIBLE
binding
.
ivMore
.
visibility
=
View
.
VISIBLE
binding
.
tvName
.
visibility
=
View
.
VISIBLE
binding
.
mDocView
.
visibility
=
View
.
VISIBLE
binding
.
tvPageCount
.
visibility
=
View
.
VISIBLE
hideKeyboard
(
binding
.
editSearch
)
}
private
fun
switchOrientation
()
{
requestedOrientation
=
if
(
requestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
)
{
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
}
else
{
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
}
}
private
var
isShowTopLayout
=
true
private
var
isShowBottomLayout
=
false
private
fun
showTopLayout
()
{
if
(!
isShowTopLayout
)
{
isShowTopLayout
=
true
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
(),
0f
)
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
VISIBLE
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
private
fun
showBottomLayout
()
{
if
(
isSearchUI
&&
haveSearchResult
)
{
val
bottomAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
binding
.
vAnimatorBottom
.
height
.
toFloat
(),
0f
)
bottomAnim
.
duration
=
200
bottomAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{
binding
.
vAnimatorBottom
.
visibility
=
View
.
VISIBLE
}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
}
})
binding
.
vAnimatorBottom
.
startAnimation
(
bottomAnim
)
}
}
private
fun
hideTopLayout
()
{
if
(
isShowTopLayout
)
{
isShowTopLayout
=
false
hideKeyboard
(
binding
.
editSearch
)
val
topAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
0f
,
-
binding
.
vAnimatorTop
.
height
.
toFloat
())
topAnim
.
setDuration
(
200
)
topAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
binding
.
vAnimatorTop
.
visibility
=
View
.
GONE
}
})
binding
.
vAnimatorTop
.
startAnimation
(
topAnim
)
}
}
private
fun
hideBottomLayout
()
{
if
(
isSearchUI
)
{
val
bottomAnim
:
Animation
=
TranslateAnimation
(
0f
,
0f
,
0f
,
binding
.
vAnimatorBottom
.
height
.
toFloat
())
bottomAnim
.
duration
=
200
bottomAnim
.
setAnimationListener
(
object
:
Animation
.
AnimationListener
{
override
fun
onAnimationStart
(
animation
:
Animation
)
{}
override
fun
onAnimationRepeat
(
animation
:
Animation
)
{}
override
fun
onAnimationEnd
(
animation
:
Animation
)
{
binding
.
vAnimatorBottom
.
visibility
=
View
.
GONE
}
})
binding
.
vAnimatorBottom
.
startAnimation
(
bottomAnim
)
}
}
private
var
docSourceType
=
0
private
var
fileType
=
-
1
private
var
engine
:
Int
=
DocEngine
.
INTERNAL
.
value
private
var
pathOrUri
:
String
?
=
null
// 文件地址
private
fun
initSpData
(
intent
:
Intent
?)
{
pathOrUri
=
intent
?.
getStringExtra
(
Constant
.
INTENT_DATA_KEY
)
docSourceType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_SOURCE_KEY
,
0
)
?:
0
fileType
=
intent
?.
getIntExtra
(
Constant
.
INTENT_TYPE_KEY
,
-
1
)
?:
-
1
engine
=
intent
?.
getIntExtra
(
Constant
.
INTENT_ENGINE_KEY
,
DocEngine
.
INTERNAL
.
value
)
?:
DocEngine
.
INTERNAL
.
value
binding
.
mDocView
.
openDoc
(
this
,
pathOrUri
,
docSourceType
,
fileType
,
false
)
LogEx
.
logDebug
(
TAG
,
"initData-docUrl = $pathOrUri"
)
LogEx
.
logDebug
(
TAG
,
"initData-docSourceType = $docSourceType"
)
LogEx
.
logDebug
(
TAG
,
"initData-fileType = $fileType"
)
LogEx
.
logDebug
(
TAG
,
"initData-engine = $engine"
)
val
value
=
(
pathOrUri
?:
""
)
+
"_/_"
+
System
.
currentTimeMillis
()
LogEx
.
logDebug
(
TAG
,
"value=$value"
)
SpStringUtils
.
addSpString
(
SpStringUtils
.
LAST_VIEW_KEY
,
value
)
}
companion
object
{
var
wordDocumentBean
:
DocumentBean
=
DocumentBean
()
fun
launchDocViewer
(
activity
:
Activity
,
docSourceType
:
Int
,
path
:
String
?,
fileType
:
Int
?
=
null
,
engine
:
Int
?
=
null
)
{
val
intent
=
Intent
(
activity
,
WordActivity
::
class
.
java
)
intent
.
putExtra
(
Constant
.
INTENT_SOURCE_KEY
,
docSourceType
)
intent
.
putExtra
(
Constant
.
INTENT_DATA_KEY
,
path
)
intent
.
putExtra
(
Constant
.
INTENT_TYPE_KEY
,
fileType
)
intent
.
putExtra
(
Constant
.
INTENT_ENGINE_KEY
,
engine
)
activity
.
startActivity
(
intent
)
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
binding
.
mDocView
.
onDestroy
()
AdmobNativeUtils
.
onDestroy
()
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfreaderallpdfreader/utils/LogEx.kt
View file @
f5f2d12d
...
...
@@ -6,10 +6,6 @@ object LogEx {
val
isOpen
=
true
val
filterTAG
=
arrayOf
(
""
,
"MediaStoreUtils"
,
"DocumentFragment"
,
"EventUtils"
,
"ReportUtils"
,
// "NewComUtils",
)
...
...
app/src/main/res/drawable/bg_00b8de_16.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#00B8DE"
/>
<corners
android:radius=
"16dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_stroke_ffffff_10.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<stroke
android:width=
"0.5dp"
android:color=
"#E5E5E5"
/>
<solid
android:color=
"@color/white"
/>
<corners
android:radius=
"10dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_transparent.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"@color/transparent"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/activity_excel.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ViewAnimator
android:id=
"@+id/v_animator_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"@color/white"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<FrameLayout
android:id=
"@+id/fl_fanhui"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/tv_name"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:padding=
"15dp"
android:src=
"@mipmap/fanhui_b"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textSize=
"19sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/iv_xuanzhuan"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
tools:text=
"DEMO.xlsx"
/>
<ImageView
android:id=
"@+id/iv_xuanzhuan"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/hengping"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_search"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/h_sousuo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_more"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/x_genduo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<EditText
android:id=
"@+id/edit_search"
android:layout_width=
"0dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"5dp"
android:layout_marginEnd=
"20dp"
android:background=
"@drawable/bg_f8f9fe_10"
android:hint=
"input..."
android:paddingHorizontal=
"18dp"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textColorHint=
"#B8B9BD"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"Autofill,HardcodedText,TextFields"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ViewAnimator>
<com.cherry.lib.doc.widget.DocView
android:id=
"@+id/mDocView"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:dv_moving_orientation=
"vertical"
app:dv_show_page_num=
"false"
app:layout_constraintBottom_toTopOf=
"@id/fl_ad"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
/>
<ViewAnimator
android:id=
"@+id/v_animator_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_50"
android:layout_alignParentBottom=
"true"
android:background=
"@color/white"
android:visibility=
"gone"
app:layout_constraintBottom_toTopOf=
"@id/fl_ad"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:ignore=
"UselessParent"
>
<FrameLayout
android:id=
"@+id/fl_pre"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|start"
android:layout_marginStart=
"20dp"
android:padding=
"10dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/left"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_next"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"20dp"
android:padding=
"10dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/right"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</FrameLayout>
</ViewAnimator>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/zhanweitu2"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
f5f2d12d
...
...
@@ -43,7 +43,6 @@
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_pdf_reader"
android:layout_width=
"wrap_content"
...
...
@@ -81,7 +80,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"16dp"
android:src=
"@mipmap/pdf_file"
/>
android:src=
"@mipmap/pdf_file"
tools:ignore=
"ContentDescription"
/>
<LinearLayout
android:layout_width=
"0dp"
...
...
@@ -104,7 +104,8 @@
android:layout_marginTop=
"8dp"
android:text=
"@string/access_and_manage_your_documents"
android:textColor=
"#929295"
android:textSize=
"10sp"
/>
android:textSize=
"10sp"
tools:ignore=
"SmallSp"
/>
</LinearLayout>
...
...
@@ -113,11 +114,13 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"38dp"
android:src=
"@mipmap/pdf_right"
/>
android:src=
"@mipmap/pdf_right"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_file_manager"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"10dp"
...
...
@@ -128,7 +131,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"16dp"
android:src=
"@mipmap/pdf_language"
/>
android:src=
"@mipmap/pdf_language"
tools:ignore=
"ContentDescription"
/>
<LinearLayout
android:id=
"@+id/ll_language"
...
...
@@ -152,7 +156,8 @@
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:textColor=
"#929295"
android:textSize=
"10sp"
/>
android:textSize=
"10sp"
tools:ignore=
"SmallSp"
/>
</LinearLayout>
...
...
@@ -161,7 +166,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"38dp"
android:src=
"@mipmap/pdf_right"
/>
android:src=
"@mipmap/pdf_right"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
...
...
@@ -171,11 +177,12 @@
android:layout_height=
"wrap_content"
android:layout_marginStart=
"21dp"
android:layout_marginTop=
"36dp"
android:text=
"
O
thers"
android:text=
"
@string/o
thers"
android:textColor=
"#B1B3B9"
android:textSize=
"13sp"
/>
<LinearLayout
android:id=
"@+id/ll_rate"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"10dp"
...
...
@@ -186,7 +193,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"16dp"
android:src=
"@mipmap/pdf_rate"
/>
android:src=
"@mipmap/pdf_rate"
tools:ignore=
"ContentDescription"
/>
<LinearLayout
android:layout_width=
"0dp"
...
...
@@ -210,7 +218,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"38dp"
android:src=
"@mipmap/pdf_right"
/>
android:src=
"@mipmap/pdf_right"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
...
...
@@ -225,7 +234,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"16dp"
android:src=
"@mipmap/pdf_share"
/>
android:src=
"@mipmap/pdf_share"
tools:ignore=
"ContentDescription"
/>
<LinearLayout
android:layout_width=
"0dp"
...
...
@@ -250,7 +260,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"38dp"
android:src=
"@mipmap/pdf_right"
/>
android:src=
"@mipmap/pdf_right"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
...
...
@@ -265,7 +276,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"16dp"
android:src=
"@mipmap/pdf_privacy"
/>
android:src=
"@mipmap/pdf_privacy"
tools:ignore=
"ContentDescription"
/>
<LinearLayout
android:layout_width=
"0dp"
...
...
@@ -289,7 +301,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"38dp"
android:src=
"@mipmap/pdf_right"
/>
android:src=
"@mipmap/pdf_right"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
...
...
@@ -304,7 +317,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"16dp"
android:src=
"@mipmap/pdf_feedback"
/>
android:src=
"@mipmap/pdf_feedback"
tools:ignore=
"ContentDescription"
/>
<LinearLayout
android:layout_width=
"0dp"
...
...
@@ -317,7 +331,7 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"
F
eedback"
android:text=
"
@string/f
eedback"
android:textColor=
"@color/black"
android:textSize=
"15sp"
/>
...
...
@@ -328,7 +342,8 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"38dp"
android:src=
"@mipmap/pdf_right"
/>
android:src=
"@mipmap/pdf_right"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
...
...
app/src/main/res/layout/activity_ppt.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ViewAnimator
android:id=
"@+id/v_animator_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"@color/white"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<FrameLayout
android:id=
"@+id/fl_fanhui"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/tv_name"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:padding=
"15dp"
android:src=
"@mipmap/fanhui_b"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textSize=
"19sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/iv_xuanzhuan"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
tools:text=
"DEMO.ppt"
/>
<ImageView
android:id=
"@+id/iv_xuanzhuan"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/hengping"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_more"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/x_genduo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ViewAnimator>
<com.cherry.lib.doc.widget.DocView
android:id=
"@+id/mDocView"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:dv_engine=
"internal"
app:dv_moving_orientation=
"vertical"
app:dv_page_pb_color=
"@color/yellow"
app:dv_page_pb_height=
"2dp"
app:dv_show_page_num=
"true"
app:layout_constraintBottom_toTopOf=
"@id/fl_ad"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
/>
<TextView
android:id=
"@+id/tv_pageCount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"28dp"
android:layout_marginTop=
"28dp"
android:background=
"@drawable/bg_54585b_5"
android:includeFontPadding=
"false"
android:paddingHorizontal=
"2dp"
android:paddingVertical=
"2dp"
android:textColor=
"@color/white"
android:textSize=
"12sp"
android:visibility=
"gone"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
tools:text=
"1/3"
/>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/zhanweitu2"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_splash.xml
View file @
f5f2d12d
...
...
@@ -44,4 +44,18 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_spanner"
/>
<com.base.pdfreaderallpdfreader.widget.XmlLottieAnimationView
android:id=
"@+id/lottie"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginBottom=
"150dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:lottie_autoPlay=
"true"
app:lottie_loop=
"true"
app:lottie_rawRes=
"@raw/lottie_animation_splash"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_word.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ViewAnimator
android:id=
"@+id/v_animator_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"@color/white"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_top"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<FrameLayout
android:id=
"@+id/fl_fanhui"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/tv_name"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:padding=
"15dp"
android:src=
"@mipmap/fanhui_b"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textSize=
"19sp"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/iv_xuanzhuan"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
tools:text=
"DEMO.xlsx"
/>
<ImageView
android:id=
"@+id/iv_xuanzhuan"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/hengping"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_search"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/h_sousuo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_more"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:src=
"@mipmap/x_genduo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
<EditText
android:id=
"@+id/edit_search"
android:layout_width=
"0dp"
android:layout_height=
"40dp"
android:layout_marginStart=
"5dp"
android:layout_marginEnd=
"20dp"
android:background=
"@drawable/bg_f8f9fe_10"
android:hint=
"input..."
android:paddingHorizontal=
"18dp"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textColorHint=
"#B8B9BD"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/iv_search"
app:layout_constraintStart_toEndOf=
"@id/fl_fanhui"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"Autofill,HardcodedText,TextFields"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ViewAnimator>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@id/fl_ad"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
>
<com.cherry.lib.doc.widget.DocView
android:id=
"@+id/mDocView"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:dv_engine=
"internal"
app:dv_moving_orientation=
"vertical"
app:dv_page_pb_color=
"@color/yellow"
app:dv_page_pb_height=
"2dp"
app:dv_show_page_num=
"true"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
/>
<com.base.pdfreaderallpdfreader.ui.view.VerticalSeekBar
android:id=
"@+id/vertical_seekbar"
android:layout_width=
"30dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"end"
android:layout_marginEnd=
"10dp"
android:background=
"@color/transparent"
app:vsb_bar_background=
"@color/transparent"
app:vsb_bar_background_gradient_end=
"@color/transparent"
app:vsb_bar_background_gradient_start=
"@color/transparent"
app:vsb_bar_progress=
"@drawable/bg_transparent"
app:vsb_show_thumb=
"true"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_pageCount"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"28dp"
android:layout_marginTop=
"28dp"
android:background=
"@drawable/bg_54585b_5"
android:includeFontPadding=
"false"
android:paddingHorizontal=
"2dp"
android:paddingVertical=
"2dp"
android:textColor=
"@color/white"
android:textSize=
"12sp"
android:visibility=
"gone"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/v_animator_top"
tools:text=
"1/3"
/>
<ViewAnimator
android:id=
"@+id/v_animator_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_50"
android:layout_alignParentBottom=
"true"
android:background=
"@color/white"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"@id/fl_ad"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:ignore=
"UselessParent"
>
<FrameLayout
android:id=
"@+id/fl_pre"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|start"
android:layout_marginStart=
"20dp"
android:padding=
"10dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/left"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_next"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"20dp"
android:padding=
"10dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/right"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</FrameLayout>
</ViewAnimator>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/zhanweitu2"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/dialog_document_more.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_ffffff_tlr15"
android:orientation=
"vertical"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl"
android:layout_width=
"match_parent"
android:layout_height=
"65dp"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:text=
"@string/more"
android:textColor=
"#333333"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:id=
"@+id/iv_bookmark"
android:layout_width=
"24dp"
android:layout_height=
"32dp"
android:layout_marginEnd=
"27dp"
android:src=
"@mipmap/h_tab_bookmark_n"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/cl"
>
<LinearLayout
android:id=
"@+id/ll_jump"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"?android:selectableItemBackground"
android:orientation=
"horizontal"
>
<!-- android:src="@mipmap/jump"-->
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"13dp"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"13dp"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:text=
"@string/jump_to_the_specified_page"
android:textColor=
"#333333"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"20dp"
android:src=
"@mipmap/jianotou"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_detail"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:background=
"?android:selectableItemBackground"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"13dp"
android:src=
"@mipmap/pdf_details"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"13dp"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:text=
"@string/detail"
android:textColor=
"#333333"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"20dp"
android:src=
"@mipmap/jianotou"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_share"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_marginBottom=
"20dp"
android:background=
"?android:selectableItemBackground"
android:orientation=
"horizontal"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"13dp"
android:src=
"@mipmap/pdf_share"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"13dp"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:text=
"@string/share"
android:textColor=
"#333333"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"20dp"
android:src=
"@mipmap/jianotou"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
app/src/main/res/layout/dialog_rate_star.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@android:color/transparent"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"50dp"
android:background=
"@drawable/bg_ffffff_tlr15"
app:layout_constraintTop_toTopOf=
"parent"
>
<TextView
android:id=
"@+id/tv_1"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"70dp"
android:text=
"@string/much_appreciated"
android:textColor=
"#333333"
android:textSize=
"18sp"
android:textStyle=
"bold"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/tv_2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"15dp"
android:text=
"@string/your_support_is_our_motivation"
android:textColor=
"#333333"
android:textSize=
"15sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_1"
tools:ignore=
"HardcodedText"
/>
<LinearLayout
android:id=
"@+id/ll_star"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_2"
>
<ImageView
android:id=
"@+id/iv_1"
android:layout_width=
"38dp"
android:layout_height=
"38dp"
android:layout_margin=
"10dp"
android:src=
"@mipmap/pdf_xing_s"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_2"
android:layout_width=
"38dp"
android:layout_height=
"38dp"
android:layout_margin=
"10dp"
android:src=
"@mipmap/pdf_xing_s"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_3"
android:layout_width=
"38dp"
android:layout_height=
"38dp"
android:layout_margin=
"10dp"
android:src=
"@mipmap/pdf_xing_s"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_4"
android:layout_width=
"38dp"
android:layout_height=
"38dp"
android:layout_margin=
"10dp"
android:src=
"@mipmap/pdf_xing_s"
tools:ignore=
"ContentDescription"
/>
<ImageView
android:id=
"@+id/iv_5"
android:layout_width=
"38dp"
android:layout_height=
"38dp"
android:layout_margin=
"10dp"
android:src=
"@mipmap/pdf_xing_s"
tools:ignore=
"ContentDescription"
/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_best"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/ll_star"
>
<TextView
android:id=
"@+id/tv_best"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/the_best_we_can_get"
android:textColor=
"#A1A1A3"
android:textSize=
"12sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"MissingConstraints"
/>
<ImageView
android:id=
"@+id/iv_best"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"50dp"
android:src=
"@mipmap/pdf_arrowhead"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id=
"@+id/tv_submit"
android:layout_width=
"338dp"
android:layout_height=
"48dp"
android:layout_marginTop=
"24dp"
android:layout_marginBottom=
"36dp"
android:background=
"@drawable/bg_00b8de_10"
android:gravity=
"center"
android:text=
"@string/rate_on_google_play"
android:textColor=
"@color/white"
android:textSize=
"18sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/cl_best"
tools:ignore=
"HardcodedText"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id=
"@+id/iv_face"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@mipmap/pdf_expression"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_document.xml
View file @
f5f2d12d
...
...
@@ -6,19 +6,31 @@
android:layout_height=
"match_parent"
tools:context=
".ui.document.DocumentFragment"
>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id=
"@+id/swipeRefreshLayout"
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<androidx.
recyclerview.widget.RecyclerView
android:id=
"@+id/
rv
"
<androidx.
swiperefreshlayout.widget.SwipeRefreshLayout
android:id=
"@+id/
swipeRefreshLayout
"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginVertical=
"16dp"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem=
"@layout/item_document"
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
android:layout_height=
"match_parent"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginVertical=
"16dp"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem=
"@layout/item_document"
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<LinearLayout
...
...
app/src/main/res/layout/layout_admob_document.xml
0 → 100644
View file @
f5f2d12d
<com.google.android.gms.ads.nativead.NativeAdView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"#F4F5FA"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"99dp"
android:layout_gravity=
"center"
android:layout_marginHorizontal=
"10dp"
android:layout_marginVertical=
"10dp"
android:background=
"@drawable/bg_stroke_ffffff_10"
android:baselineAligned=
"false"
tools:ignore=
"UselessParent"
>
<com.google.android.gms.ads.nativead.MediaView
android:id=
"@+id/ad_media"
android:layout_width=
"86dp"
android:layout_height=
"64dp"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
/>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"8dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/ad_headline"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"2"
android:singleLine=
"true"
android:textColor=
"@color/black"
android:textSize=
"13sp"
android:textStyle=
"bold"
tools:text=
"Your Dlgital Bible Guide Hold The Complete Bible In Your Hand a"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingVertical=
"5dp"
>
<ImageView
android:id=
"@+id/ad_app_icon"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"center_vertical"
tools:ignore=
"ContentDescription"
/>
<TextView
android:id=
"@+id/ad_body"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:maxLines=
"2"
android:singleLine=
"true"
android:textColor=
"#999999"
android:textSize=
"13sp"
tools:ignore=
"TextContrastCheck"
tools:text=
"wuyunbooster"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:text=
"| AD"
android:textColor=
"#999999"
android:textSize=
"13sp"
tools:ignore=
"HardcodedText,TextContrastCheck"
/>
<androidx.appcompat.widget.AppCompatButton
android:id=
"@+id/ad_call_to_action"
android:layout_width=
"82dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"12dp"
android:background=
"@drawable/bg_00b8de_10"
android:gravity=
"center"
android:maxHeight=
"28dp"
android:textColor=
"@color/white"
android:textSize=
"15sp"
tools:ignore=
"SpeakableTextPresentCheck,TouchTargetSizeCheck"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</com.google.android.gms.ads.nativead.NativeAdView>
\ No newline at end of file
app/src/main/res/layout/layout_admob_document_in.xml
0 → 100644
View file @
f5f2d12d
<com.google.android.gms.ads.nativead.NativeAdView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1.5dp"
android:background=
"#D2D2D2"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:layout_marginHorizontal=
"8dp"
android:layout_marginVertical=
"8dp"
android:baselineAligned=
"false"
>
<com.google.android.gms.ads.nativead.MediaView
android:id=
"@+id/ad_media"
android:layout_width=
"64dp"
android:layout_height=
"64dp"
android:layout_gravity=
"center_vertical"
/>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"8dp"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/ad_headline"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"@color/black"
android:textSize=
"13sp"
android:textStyle=
"bold"
tools:text=
"Your Dlgital Bible Guide Hold The Complete Bible In Your Hand a"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingVertical=
"5dp"
>
<ImageView
android:id=
"@+id/ad_app_icon"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"center_vertical"
tools:ignore=
"ContentDescription"
/>
<TextView
android:id=
"@+id/ad_body"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"8dp"
android:layout_marginEnd=
"10dp"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textColor=
"@color/black"
android:textSize=
"12sp"
tools:lines=
"2"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:text=
"| AD"
android:textColor=
"#999999"
android:textSize=
"13sp"
tools:ignore=
"HardcodedText,TextContrastCheck"
/>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id=
"@+id/ad_call_to_action"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"8dp"
android:background=
"@drawable/bg_00b8de_16"
android:gravity=
"center"
android:textColor=
"@color/white"
android:textSize=
"15sp"
tools:ignore=
"SpeakableTextPresentCheck"
/>
</LinearLayout>
</com.google.android.gms.ads.nativead.NativeAdView>
\ No newline at end of file
app/src/main/res/layout/notification_message.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<LinearLayout
android:id=
"@+id/ll_logo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:layout_marginTop=
"12dp"
tools:ignore=
"UseCompoundDrawables"
>
<!-- android:src="@mipmap/moren_logo"-->
<ImageView
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center_vertical"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"16dp"
android:text=
"@string/app_name"
android:textColor=
"#4E4E4E"
android:textSize=
"16sp"
/>
</LinearLayout>
<TextView
android:id=
"@+id/tv_tittle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/ll_logo"
android:layout_marginStart=
"15dp"
android:layout_marginTop=
"16dp"
android:textColor=
"#010101"
android:textSize=
"16sp"
android:textStyle=
"bold"
tools:text=
"New file available for view"
/>
<TextView
android:id=
"@+id/tv_desc"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tv_tittle"
android:layout_marginStart=
"15dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"15dp"
android:textColor=
"#898989"
tools:text=
"Did you miss this PDF file?"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/stay_notification_big.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingVertical=
"8dp"
tools:ignore=
"DisableBaselineAlignment"
>
<FrameLayout
android:id=
"@+id/fl_1"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_gravity=
"center_vertical"
android:layout_weight=
"1"
>
<!-- todo-->
<!-- android:src="@mipmap/moren_logo"-->
<ImageView
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_gravity=
"center"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<LinearLayout
android:id=
"@+id/ll_2"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_weight=
"1.3"
android:orientation=
"vertical"
tools:ignore=
"UseCompoundDrawables"
>
<!-- todo-->
<!-- android:src="@mipmap/doc_notification"-->
<ImageView
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"2dp"
android:includeFontPadding=
"false"
android:text=
"Document"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1.3"
android:orientation=
"vertical"
tools:ignore=
"UseCompoundDrawables"
>
<!-- todo-->
<!-- android:src="@mipmap/bookmark_notification"-->
<ImageView
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"2dp"
android:includeFontPadding=
"false"
android:text=
"Bookmark"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_4"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1.3"
android:orientation=
"vertical"
tools:ignore=
"UseCompoundDrawables"
>
<!-- todo-->
<!-- android:src="@mipmap/image_notification"-->
<ImageView
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"2dp"
android:includeFontPadding=
"false"
android:text=
"Image PDF"
android:textColor=
"@color/black"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/mipmap-xxhdpi/left.png
0 → 100644
View file @
f5f2d12d
1.35 KB
app/src/main/res/mipmap-xxhdpi/logo.png
0 → 100644
View file @
f5f2d12d
36.1 KB
app/src/main/res/mipmap-xxhdpi/pdf_arrowhead.png
0 → 100644
View file @
f5f2d12d
5.2 KB
app/src/main/res/mipmap-xxhdpi/pdf_expression.png
0 → 100644
View file @
f5f2d12d
51.5 KB
app/src/main/res/mipmap-xxhdpi/pdf_expression1.png
0 → 100644
View file @
f5f2d12d
60.4 KB
app/src/main/res/mipmap-xxhdpi/pdf_expression2.png
0 → 100644
View file @
f5f2d12d
70.4 KB
app/src/main/res/mipmap-xxhdpi/pdf_expression3.png
0 → 100644
View file @
f5f2d12d
58.9 KB
app/src/main/res/mipmap-xxhdpi/pdf_xing_n.png
0 → 100644
View file @
f5f2d12d
6.76 KB
app/src/main/res/mipmap-xxhdpi/pdf_xing_s.png
0 → 100644
View file @
f5f2d12d
6.49 KB
app/src/main/res/mipmap-xxhdpi/right.png
0 → 100644
View file @
f5f2d12d
1.36 KB
app/src/main/res/raw/lottie_animation_splash.json
0 → 100644
View file @
f5f2d12d
{
"v"
:
"5.8.1"
,
"fr"
:
10
,
"ip"
:
0
,
"op"
:
23
,
"w"
:
73
,
"h"
:
73
,
"nm"
:
"Lottie_Main_Comp"
,
"ddd"
:
0
,
"assets"
:[],
"layers"
:[{
"ddd"
:
0
,
"ind"
:
1
,
"ty"
:
4
,
"nm"
:
"Layer 1"
,
"sr"
:
1
,
"ks"
:{
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
11
},
"r"
:{
"a"
:
1
,
"k"
:[{
"i"
:{
"x"
:[
0.58
],
"y"
:[
1
]},
"o"
:{
"x"
:[
0.42
],
"y"
:[
0
]},
"t"
:
5.7
,
"s"
:[
0
]},{
"i"
:{
"x"
:[
0.833
],
"y"
:[
1
]},
"o"
:{
"x"
:[
0.167
],
"y"
:[
0
]},
"t"
:
7.1
,
"s"
:[
45
]},{
"i"
:{
"x"
:[
0.58
],
"y"
:[
1
]},
"o"
:{
"x"
:[
0.42
],
"y"
:[
0
]},
"t"
:
8.6
,
"s"
:[
45
]},{
"t"
:
10
,
"s"
:[
90
]}],
"ix"
:
10
},
"p"
:{
"a"
:
0
,
"k"
:[
36
,
36
,
0
],
"ix"
:
2
,
"l"
:
2
},
"a"
:{
"a"
:
0
,
"k"
:[
19
,
19
,
0
],
"ix"
:
1
,
"l"
:
2
},
"s"
:{
"a"
:
0
,
"k"
:[
120
,
120
,
100
],
"ix"
:
6
,
"l"
:
2
}},
"ao"
:
0
,
"shapes"
:[{
"ty"
:
"gr"
,
"it"
:[{
"ind"
:
0
,
"ty"
:
"sh"
,
"ix"
:
1
,
"ks"
:{
"a"
:
0
,
"k"
:{
"i"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"o"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"v"
:[[
0
,
0
],[
15
,
0
],[
15
,
15
],[
0
,
15
]],
"c"
:
true
},
"ix"
:
2
},
"nm"
:
"Path 1"
,
"mn"
:
"ADBE Vector Shape - Group"
,
"hd"
:
false
},{
"ty"
:
"st"
,
"c"
:{
"a"
:
0
,
"k"
:[
0.262745098039
,
0.521568627451
,
0.960784313725
,
1
],
"ix"
:
3
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
4
},
"w"
:{
"a"
:
0
,
"k"
:
5
,
"ix"
:
5
},
"lc"
:
2
,
"lj"
:
2
,
"bm"
:
0
,
"nm"
:
"undefined"
,
"mn"
:
"ADBE Vector Graphic - Stroke"
,
"hd"
:
false
},{
"ty"
:
"tr"
,
"p"
:{
"a"
:
1
,
"k"
:[{
"i"
:{
"x"
:
0.58
,
"y"
:
1
},
"o"
:{
"x"
:
0.42
,
"y"
:
0
},
"t"
:
0
,
"s"
:[
7.5
,
7.5
],
"to"
:[
0
,
0
],
"ti"
:[
0
,
0
]},{
"i"
:{
"x"
:
0.58
,
"y"
:
1
},
"o"
:{
"x"
:
0.42
,
"y"
:
0
},
"t"
:
1.4
,
"s"
:[
30.5
,
7.5
],
"to"
:[
0
,
0
],
"ti"
:[
0
,
0
]},{
"i"
:{
"x"
:
0.58
,
"y"
:
1
},
"o"
:{
"x"
:
0.42
,
"y"
:
0
},
"t"
:
2.9
,
"s"
:[
30.5
,
30.5
],
"to"
:[
0
,
0
],
"ti"
:[
0
,
0
]},{
"t"
:
4.2998046875
,
"s"
:[
7.5
,
30.5
]}],
"ix"
:
2
},
"a"
:{
"a"
:
0
,
"k"
:[
7.5
,
7.5
],
"ix"
:
1
},
"s"
:{
"a"
:
0
,
"k"
:[
100
,
100
],
"ix"
:
3
},
"r"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
6
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
7
},
"sk"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
4
},
"sa"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
5
},
"nm"
:
"Transform"
}],
"nm"
:
"Object"
,
"np"
:
2
,
"cix"
:
2
,
"bm"
:
0
,
"ix"
:
1
,
"mn"
:
"ADBE Vector Group"
,
"hd"
:
false
},{
"ty"
:
"gr"
,
"it"
:[{
"ind"
:
0
,
"ty"
:
"sh"
,
"ix"
:
1
,
"ks"
:{
"a"
:
0
,
"k"
:{
"i"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"o"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"v"
:[[
0
,
0
],[
15
,
0
],[
15
,
15
],[
0
,
15
]],
"c"
:
true
},
"ix"
:
2
},
"nm"
:
"Path 1"
,
"mn"
:
"ADBE Vector Shape - Group"
,
"hd"
:
false
},{
"ty"
:
"st"
,
"c"
:{
"a"
:
0
,
"k"
:[
1
,
0.623529411765
,
0.196078431373
,
1
],
"ix"
:
3
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
4
},
"w"
:{
"a"
:
0
,
"k"
:
5
,
"ix"
:
5
},
"lc"
:
2
,
"lj"
:
2
,
"bm"
:
0
,
"nm"
:
"undefined"
,
"mn"
:
"ADBE Vector Graphic - Stroke"
,
"hd"
:
false
},{
"ty"
:
"tr"
,
"p"
:{
"a"
:
1
,
"k"
:[{
"i"
:{
"x"
:
0.58
,
"y"
:
1
},
"o"
:{
"x"
:
0.42
,
"y"
:
0
},
"t"
:
0
,
"s"
:[
7.5
,
7.5
],
"to"
:[
0
,
0
],
"ti"
:[
0
,
0
]},{
"i"
:{
"x"
:
0.58
,
"y"
:
1
},
"o"
:{
"x"
:
0.42
,
"y"
:
0
},
"t"
:
1.4
,
"s"
:[
30.5
,
7.5
],
"to"
:[
0
,
0
],
"ti"
:[
0
,
0
]},{
"t"
:
2.89990234375
,
"s"
:[
30.5
,
30.5
]}],
"ix"
:
2
},
"a"
:{
"a"
:
0
,
"k"
:[
7.5
,
7.5
],
"ix"
:
1
},
"s"
:{
"a"
:
0
,
"k"
:[
100
,
100
],
"ix"
:
3
},
"r"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
6
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
7
},
"sk"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
4
},
"sa"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
5
},
"nm"
:
"Transform"
}],
"nm"
:
"Object"
,
"np"
:
2
,
"cix"
:
2
,
"bm"
:
0
,
"ix"
:
2
,
"mn"
:
"ADBE Vector Group"
,
"hd"
:
false
},{
"ty"
:
"gr"
,
"it"
:[{
"ind"
:
0
,
"ty"
:
"sh"
,
"ix"
:
1
,
"ks"
:{
"a"
:
0
,
"k"
:{
"i"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"o"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"v"
:[[
0
,
0
],[
15
,
0
],[
15
,
15
],[
0
,
15
]],
"c"
:
true
},
"ix"
:
2
},
"nm"
:
"Path 1"
,
"mn"
:
"ADBE Vector Shape - Group"
,
"hd"
:
false
},{
"ty"
:
"st"
,
"c"
:{
"a"
:
0
,
"k"
:[
0
,
0.674509803922
,
0.258823529412
,
1
],
"ix"
:
3
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
4
},
"w"
:{
"a"
:
0
,
"k"
:
5
,
"ix"
:
5
},
"lc"
:
2
,
"lj"
:
2
,
"bm"
:
0
,
"nm"
:
"undefined"
,
"mn"
:
"ADBE Vector Graphic - Stroke"
,
"hd"
:
false
},{
"ty"
:
"tr"
,
"p"
:{
"a"
:
1
,
"k"
:[{
"i"
:{
"x"
:
0.58
,
"y"
:
1
},
"o"
:{
"x"
:
0.42
,
"y"
:
0
},
"t"
:
0
,
"s"
:[
7.5
,
7.5
],
"to"
:[
0
,
0
],
"ti"
:[
0
,
0
]},{
"i"
:{
"x"
:
0.58
,
"y"
:
0.58
},
"o"
:{
"x"
:
0.42
,
"y"
:
0.42
},
"t"
:
1.4
,
"s"
:[
30.5
,
7.5
],
"to"
:[
0
,
0
],
"ti"
:[
0
,
0
]},{
"t"
:
4.2998046875
,
"s"
:[
30.5
,
7.5
]}],
"ix"
:
2
},
"a"
:{
"a"
:
0
,
"k"
:[
7.5
,
7.5
],
"ix"
:
1
},
"s"
:{
"a"
:
0
,
"k"
:[
100
,
100
],
"ix"
:
3
},
"r"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
6
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
7
},
"sk"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
4
},
"sa"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
5
},
"nm"
:
"Transform"
}],
"nm"
:
"Object"
,
"np"
:
2
,
"cix"
:
2
,
"bm"
:
0
,
"ix"
:
3
,
"mn"
:
"ADBE Vector Group"
,
"hd"
:
false
},{
"ty"
:
"gr"
,
"it"
:[{
"ind"
:
0
,
"ty"
:
"sh"
,
"ix"
:
1
,
"ks"
:{
"a"
:
0
,
"k"
:{
"i"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"o"
:[[
0
,
0
],[
0
,
0
],[
0
,
0
],[
0
,
0
]],
"v"
:[[
0
,
0
],[
15
,
0
],[
15
,
15
],[
0
,
15
]],
"c"
:
true
},
"ix"
:
2
},
"nm"
:
"Path 1"
,
"mn"
:
"ADBE Vector Shape - Group"
,
"hd"
:
false
},{
"ty"
:
"st"
,
"c"
:{
"a"
:
0
,
"k"
:[
0.886274509804
,
0
,
0.003921568627
,
1
],
"ix"
:
3
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
4
},
"w"
:{
"a"
:
0
,
"k"
:
5
,
"ix"
:
5
},
"lc"
:
2
,
"lj"
:
2
,
"bm"
:
0
,
"nm"
:
"undefined"
,
"mn"
:
"ADBE Vector Graphic - Stroke"
,
"hd"
:
false
},{
"ty"
:
"tr"
,
"p"
:{
"a"
:
0
,
"k"
:[
7.5
,
7.5
],
"ix"
:
2
},
"a"
:{
"a"
:
0
,
"k"
:[
7.5
,
7.5
],
"ix"
:
1
},
"s"
:{
"a"
:
0
,
"k"
:[
100
,
100
],
"ix"
:
3
},
"r"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
6
},
"o"
:{
"a"
:
0
,
"k"
:
100
,
"ix"
:
7
},
"sk"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
4
},
"sa"
:{
"a"
:
0
,
"k"
:
0
,
"ix"
:
5
},
"nm"
:
"Transform"
}],
"nm"
:
"Object"
,
"np"
:
2
,
"cix"
:
2
,
"bm"
:
0
,
"ix"
:
4
,
"mn"
:
"ADBE Vector Group"
,
"hd"
:
false
}],
"ip"
:
0
,
"op"
:
23
,
"st"
:
0
,
"bm"
:
0
}],
"markers"
:[]}
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
f5f2d12d
...
...
@@ -7,4 +7,5 @@
<dimen
name=
"fab_margin"
>
16dp
</dimen>
<dimen
name=
"dp_200"
>
200dp
</dimen>
<dimen
name=
"dp_146"
>
146dp
</dimen>
<dimen
name=
"dp_50"
>
50dp
</dimen>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
f5f2d12d
<resources>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<string
name=
"app_name"
>
Pdf Reader All Pdf Reader
</string>
<string
name=
"one_application_for_all_documents"
>
One application for all documents
</string>
<string
name=
"facebook_app_id"
tools:ignore=
"MissingTranslation"
>
939938294571154
</string>
<!-- 通知文本-->
<string
name=
"new_image_for_creating_pdf"
>
New image for creating PDF
</string>
<string
name=
"edit_images_to_create_pdf_files"
>
Edit images to create PDF files
</string>
<string
name=
"read_your_pdf_file"
>
Read your PDF file
</string>
<string
name=
"did_you_miss_this_pdf_file"
>
Did you miss this PDF file?
</string>
<string
name=
"read_more_phone_documents"
>
Read more phone documents
</string>
<string
name=
"click_to_read_and_edit_your_document"
>
Click to read and edit your document
</string>
<string
name=
"there_are_unviewed_files"
>
There are unviewed files
</string>
<string
name=
"click_to_read_now"
>
Click to read now
</string>
<string
name=
"don_t_miss_important_documents"
>
Don\'t miss important documents
</string>
<string
name=
"view_now"
>
View Now
</string>
<!-- /////////////////////////////////////// 分割///////////////////////////////////////////////// -->
<string
name=
"sunday"
>
Sunday
</string>
<string
name=
"monday"
>
Monday
</string>
<string
name=
"tuesday"
>
Tuesday
</string>
<string
name=
"wednesday"
>
Wednesday
</string>
<string
name=
"thursday"
>
Thursday
</string>
<string
name=
"friday"
>
Friday
</string>
<string
name=
"saturday"
>
Saturday
</string>
<string
name=
"one_application_for_all_documents"
>
One application for all documents
</string>
<string
name=
"menu_home"
>
Home
</string>
<string
name=
"menu_gallery"
>
Gallery
</string>
<string
name=
"menu_slideshow"
>
Slideshow
</string>
...
...
@@ -63,6 +87,15 @@
<string
name=
"add"
>
Add
</string>
<string
name=
"merge"
>
Merge
</string>
<string
name=
"preparing_advertisement"
>
Preparing advertisement…
</string>
<string
name=
"others"
>
Others
</string>
<string
name=
"feedback"
>
Feedback
</string>
<string
name=
"much_appreciated"
>
Much Appreciated!
</string>
<string
name=
"your_support_is_our_motivation"
>
Your support is our motivation
</string>
<string
name=
"rate_on_google_play"
>
Rate on Google Play
</string>
<string
name=
"the_best_we_can_get"
>
The best we can get
</string>
<string
name=
"oh_no"
>
Oh No!
</string>
<string
name=
"leave_us_your_feedback"
>
Leave us your feedback
</string>
<string
name=
"oh_we_are_sorry"
>
Oh,We are Sorry
</string>
</resources>
\ No newline at end of file
app/src/main/res/xml/file_paths.xml
0 → 100644
View file @
f5f2d12d
<?xml version="1.0" encoding="utf-8"?>
<paths
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<cache-path
name=
"cache_files"
path=
"."
/>
<external-path
name=
"extern_files"
path=
"."
/>
<files-path
name=
"files"
path=
"."
/>
</paths>
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