Просмотр исходного кода

【Demo】移除compdfkit, media等示例功能

liuxiaolong 11 месяцев назад
Родитель
Сommit
6449f150b6
41 измененных файлов с 68 добавлено и 1807 удалено
  1. 0 2
      app/build.gradle
  2. 9 21
      app/src/main/AndroidManifest.xml
  3. 0 39
      app/src/main/java/com/convenient/android/lib/DateUtilActivity.kt
  4. 2 2
      app/src/main/java/com/convenient/android/lib/LibApplication.kt
  5. 0 153
      app/src/main/java/com/convenient/android/lib/MainActivity.kt
  6. 4 4
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/AdMainActivity.kt
  7. 2 2
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdAppOpenActivity.kt
  8. 2 2
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdBannerActivity.kt
  9. 2 2
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdFeedActivity.kt
  10. 3 3
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdFullScreenAdActivity.kt
  11. 2 2
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdNativeActivity.kt
  12. 4 4
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdNativeListActivity.kt
  13. 2 2
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdNativeTemplateActivity.kt
  14. 4 6
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AppWelcomeActivity.kt
  15. 6 6
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/adapter/NativeAdSampleListAdapter.kt
  16. 4 3
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/model/Datas.kt
  17. 1 1
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/model/NativeListBean.kt
  18. 1 1
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdAppOpenPage.kt
  19. 1 1
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdBannerPage.kt
  20. 9 4
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdHomePage.kt
  21. 3 3
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdInterstitialPage.kt
  22. 2 2
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdMainPage.kt
  23. 1 1
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdNativePage.kt
  24. 1 1
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdRewardVideoPage.kt
  25. 1 1
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/util/CoilImageLoader.kt
  26. 2 2
      app/src/main/java/com/convenient/android/lib/ui/sample/ad/viewmodel/AdConfigViewModel.kt
  27. 0 355
      app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaFilesPage.kt
  28. 0 39
      app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaFilesRepository.kt
  29. 0 114
      app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaFilesViewModel.kt
  30. 0 79
      app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaPermissionPage.kt
  31. 0 156
      app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaSampleActivity.kt
  32. 0 181
      app/src/main/java/com/convenient/android/lib/ui/sample/read/ReaderActivity.kt
  33. 0 27
      app/src/main/java/com/convenient/android/lib/ui/sample/read/ReaderViewActivity.kt
  34. 0 52
      app/src/main/java/com/convenient/android/lib/ui/sample/read/annotation/AnnotationItem.kt
  35. 0 57
      app/src/main/java/com/convenient/android/lib/ui/sample/read/annotation/AnnotationList.kt
  36. 0 14
      app/src/main/java/com/convenient/android/lib/ui/sample/read/data/ReaderData.kt
  37. 0 155
      app/src/main/java/com/convenient/android/lib/ui/sample/read/setting/SettingView.kt
  38. 0 35
      app/src/main/res/layout/activity_date.xml
  39. 0 254
      app/src/main/res/layout/activity_media_sample.xml
  40. 0 16
      app/src/main/res/layout/activity_reader_view.xml
  41. 0 3
      settings.gradle

+ 0 - 2
app/build.gradle

@@ -127,7 +127,6 @@ dependencies {
     implementation project(':lib_ad_applovinmax')
     implementation project(':lib_ad_gromore')
     implementation project(':lib_ad_gromore_adn')
-    implementation project(':lib_pdf_base')
 
     implementation "com.pangle.cn:mediation-sdk:5.8.0.7"
     implementation "com.pangle.cn:mediation-gdt-adapter:4.550.1420.2"
@@ -154,6 +153,5 @@ dependencies {
     api("com.mbridge.msdk.support:mbbid:16.5.47")
     api("com.mbridge.msdk.support:newinterstitial:16.5.47")
 
-    implementation 'com.qq.e.union:union:4.551.1421'
 
 }

+ 9 - 21
app/src/main/AndroidManifest.xml

@@ -42,7 +42,7 @@
         tools:targetApi="31">
 
         <activity
-            android:name=".ui.sample.ad.activity.AppWelcomeActivity"
+            android:name=".ui.ad.activity.AppWelcomeActivity"
             android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -51,42 +51,30 @@
             </intent-filter>
         </activity>
         <activity
-            android:name=".ui.sample.ad.activity.AdNativeTemplateActivity"
+            android:name=".ui.ad.activity.AdNativeTemplateActivity"
             android:exported="false" />
         <activity
-            android:name=".ui.sample.ad.activity.AdAppOpenActivity"
+            android:name=".ui.ad.activity.AdAppOpenActivity"
             android:exported="false" />
         <activity
-            android:name=".ui.sample.ad.activity.AdFullScreenAdActivity"
+            android:name=".ui.ad.activity.AdFullScreenAdActivity"
             android:exported="false" />
         <activity
-            android:name=".ui.sample.ad.activity.AdNativeListActivity"
+            android:name=".ui.ad.activity.AdNativeListActivity"
             android:exported="false" />
         <activity
-            android:name=".ui.sample.ad.activity.AdNativeActivity"
+            android:name=".ui.ad.activity.AdNativeActivity"
             android:exported="false" />
 
         <activity
-            android:name=".ui.sample.ad.activity.AdFeedActivity"
+            android:name=".ui.ad.activity.AdFeedActivity"
             android:exported="false" />
         <activity
-            android:name=".ui.sample.ad.activity.AdBannerActivity"
+            android:name=".ui.ad.activity.AdBannerActivity"
             android:exported="false" />
         <activity
-            android:name=".ui.sample.ad.AdMainActivity"
+            android:name=".ui.ad.AdMainActivity"
             android:exported="false" />
-        <activity
-            android:name=".ui.sample.media.MediaSampleActivity"
-            android:exported="false" />
-        <activity
-            android:name="com.convenient.android.lib.MainActivity"
-            android:exported="false" />
-
-        <activity android:name=".DateUtilActivity" />
-
-        <activity android:name=".ui.sample.read.ReaderActivity" />
-
-        <activity android:name=".ui.sample.read.ReaderViewActivity" />
 
         <meta-data
             android:name="test"

+ 0 - 39
app/src/main/java/com/convenient/android/lib/DateUtilActivity.kt

@@ -1,39 +0,0 @@
-package com.convenient.android.lib
-
-import android.os.Bundle
-import androidx.core.text.isDigitsOnly
-import androidx.lifecycle.lifecycleScope
-import com.convenient.android.common.base.viewbinding.BaseBindingActivity
-import com.convenient.android.common.utils.date.*
-import com.convenient.android.lib.databinding.ActivityDateBinding
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
-
-/**
- * @author: hubowen
- * @date: 2022/8/3
- * @description:
- */
-class DateUtilActivity : BaseBindingActivity<ActivityDateBinding>(ActivityDateBinding::inflate) {
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        binding.apply {
-
-            lifecycleScope.launch(Dispatchers.IO) {
-                while (true) {
-                    delay(1000)
-                    withContext(Dispatchers.Main) {
-                        idDateActivityTvTime.text = System.currentTimeMillis().toDate(DateUtils.DateFormat.DEFAULT_PATTERN.dateFormat)
-                    }
-                }
-            }
-
-            idDateActivityTvContent.text =
-                "${System.currentTimeMillis().toDate(DateUtils.DateFormat.DEFAULT_PATTERN.dateFormat)}\n" +
-                        "${year("年")}${month(isAbbreviation = true)}${day("日")}${hour("时")}${minute("分")}${second("秒")}${week(isAbbreviation = true)}"
-        }
-    }
-}

+ 2 - 2
app/src/main/java/com/convenient/android/lib/LibApplication.kt

@@ -9,8 +9,8 @@ import androidx.lifecycle.*
 import com.composition.android.lib.ad.AdLoad
 import com.convenient.android.common.base.ActivitysUtils
 import com.convenient.android.common.extension.readyGo
-import com.convenient.android.lib.ui.sample.ad.activity.AppWelcomeActivity
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.activity.AppWelcomeActivity
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.launch
 
 /**

+ 0 - 153
app/src/main/java/com/convenient/android/lib/MainActivity.kt

@@ -1,153 +0,0 @@
-package com.convenient.android.lib
-
-import android.annotation.SuppressLint
-import android.os.Bundle
-import androidx.activity.ComponentActivity
-import androidx.activity.compose.setContent
-import androidx.compose.foundation.layout.*
-import androidx.compose.foundation.lazy.LazyColumn
-import androidx.compose.material.Icon
-import androidx.compose.material.Text
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.Build
-import androidx.compose.material.icons.filled.Home
-import androidx.compose.material.icons.filled.List
-import androidx.compose.material3.*
-import androidx.compose.runtime.*
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.tooling.preview.Preview
-import androidx.compose.ui.unit.dp
-import androidx.navigation.compose.rememberNavController
-import com.convenient.android.common.extension.readyGo
-import com.convenient.android.lib.ui.sample.ad.AdMainActivity
-import com.convenient.android.lib.ui.sample.media.MediaSampleActivity
-import com.convenient.android.lib.ui.sample.read.ReaderActivity
-import com.convenient.android.lib.ui.sample.read.annotation.BottomItem
-import com.convenient.android.lib.ui.theme.SampleTheme
-
-class MainActivity : ComponentActivity() {
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        setContent {
-            SampleTheme {
-                MainPage()
-            }
-        }
-    }
-}
-
-@Preview(showSystemUi = true)
-@Composable
-fun MainPagePreview() {
-    SampleTheme {
-        MainPage()
-    }
-}
-
-@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
-@OptIn(ExperimentalMaterial3Api::class)
-@Composable
-private fun MainPage() {
-    var bottomSelectedState by remember { mutableStateOf(0) }
-    Column {
-        SmallTopAppBar(title = {
-            Text(text = "组件库", style = MaterialTheme.typography.titleMedium)
-        }, colors = TopAppBarDefaults.smallTopAppBarColors(
-            containerColor = MaterialTheme.colorScheme.primary.copy(alpha = .1F)
-        ))
-        Scaffold(bottomBar = {
-            BottomBarView(selectedPosition = bottomSelectedState, onItemSelected = {
-                bottomSelectedState = it
-            })
-        }) {
-            when (bottomSelectedState) {
-                0 -> FuncListView()
-                1 -> ReaderView()
-                else -> {
-                    Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
-                        Text(text = "建设中")
-                    }
-                }
-            }
-        }
-    }
-}
-
-data class FuncBean(
-    val title: String,
-    val class_: Class<*>,
-)
-
-@Composable
-private fun FuncListView() {
-    val context = LocalContext.current
-    val funcList = arrayListOf(
-        FuncBean("DateUtils", DateUtilActivity::class.java),
-        FuncBean("MediaUtils", MediaSampleActivity::class.java),
-        FuncBean("广告测试", AdMainActivity::class.java)
-    )
-    Column {
-        LazyColumn {
-            items(funcList.size) { index ->
-                ElevatedButton(modifier = Modifier
-                    .fillMaxWidth()
-                    .padding(horizontal = 16.dp), onClick = {
-                    context.readyGo(funcList[index].class_)
-                }) {
-                    Text(text = funcList[index].title)
-                }
-            }
-        }
-    }
-}
-
-@Composable
-private fun ReaderView() {
-    val context = LocalContext.current
-
-    val navController = rememberNavController()
-
-    val funcList = arrayListOf(
-        FuncBean("阅读界面", ReaderActivity::class.java),
-    )
-
-    Column {
-        LazyColumn {
-            items(funcList.size) { index ->
-                ElevatedButton(modifier = Modifier
-                    .fillMaxWidth()
-                    .padding(horizontal = 16.dp), onClick = {
-                    context.readyGo(funcList[index].class_)
-                }) {
-                    Text(text = funcList[index].title)
-                }
-            }
-        }
-    }
-}
-
-@Composable
-private fun BottomBarView(selectedPosition: Int, onItemSelected: (position: Int) -> Unit) {
-    val itemList = arrayListOf(
-        BottomItem(title = "工具", Icons.Filled.Home),
-        BottomItem(title = "PDF", Icons.Filled.List),
-        BottomItem(title = "建设中", Icons.Filled.Build),
-        BottomItem(title = "建设中", Icons.Filled.Build)
-    )
-    NavigationBar() {
-        itemList.forEachIndexed { index, bottomItem ->
-            NavigationBarItem(
-                selected = selectedPosition == index,
-                onClick = { onItemSelected.invoke(index) },
-                icon = {
-                    Icon(bottomItem.icon, contentDescription = null)
-                },
-                label = {
-                    Text(bottomItem.title)
-                }
-            )
-        }
-    }
-}

+ 4 - 4
app/src/main/java/com/convenient/android/lib/ui/sample/ad/AdMainActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad
+package com.convenient.android.lib.ui.ad
 
 import android.os.Bundle
 import android.util.Log
@@ -14,9 +14,9 @@ import com.composition.android.lib.ad.basic.AdResult
 import com.composition.android.lib.ad.util.adLogWithFrame
 import com.convenient.android.common.extension.readyGo
 import com.convenient.android.common.utils.ToastUtil
-import com.convenient.android.lib.ui.sample.ad.activity.AppWelcomeActivity
-import com.convenient.android.lib.ui.sample.ad.model.Datas
-import com.convenient.android.lib.ui.sample.ad.page.AdMainPage
+import com.convenient.android.lib.ui.ad.activity.AppWelcomeActivity
+import com.convenient.android.lib.ui.ad.model.Datas
+import com.convenient.android.lib.ui.ad.page.AdMainPage
 import com.convenient.android.lib.ui.theme.SampleTheme
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch

+ 2 - 2
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdAppOpenActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.graphics.Point
 import android.os.Bundle
@@ -14,7 +14,7 @@ import com.convenient.android.common.extension.setViewsClick
 import com.convenient.android.common.utils.ToastUtil
 import com.convenient.android.lib.R
 import com.convenient.android.lib.databinding.ActivityAdAppOpenBinding
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.model.Datas
 import com.qq.e.ads.banner2.UnifiedBannerADListener
 import com.qq.e.ads.banner2.UnifiedBannerView
 import com.qq.e.comm.util.AdError

+ 2 - 2
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdBannerActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.os.Bundle
 import androidx.core.view.isVisible
@@ -15,7 +15,7 @@ import com.convenient.android.common.extension.setViewsClick
 import com.convenient.android.common.utils.ToastUtil
 import com.convenient.android.lib.R
 import com.convenient.android.lib.databinding.ActivityAdBannerBinding
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch
 

+ 2 - 2
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdFeedActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.os.Bundle
 import androidx.core.view.isVisible
@@ -16,7 +16,7 @@ import com.convenient.android.common.utils.ToastUtil
 import com.convenient.android.lib.R
 import com.convenient.android.lib.databinding.ActivityAdFeedBinding
 import com.convenient.android.lib.databinding.ViewAdNativeBinding
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch
 

+ 3 - 3
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdFullScreenAdActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.os.Bundle
 import androidx.lifecycle.lifecycleScope
@@ -11,7 +11,7 @@ import com.convenient.android.common.extension.setViewsClick
 import com.convenient.android.common.utils.ToastUtil
 import com.convenient.android.lib.R
 import com.convenient.android.lib.databinding.ActivityAdInterstitialBinding
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.launch
 
 /**
@@ -28,7 +28,7 @@ class AdFullScreenAdActivity : BaseBindingActivity<ActivityAdInterstitialBinding
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
-        adSlotName = intent.getStringExtra("ad_slot_name")?:Datas.INTERSTITIAL
+        adSlotName = intent.getStringExtra("ad_slot_name")?: Datas.INTERSTITIAL
         binding.tvAdSlotName.text = "当前加载广告位为:${adSlotName}"
 
         setViewsClick({

+ 2 - 2
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdNativeActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.os.Bundle
 import androidx.core.view.isVisible
@@ -16,7 +16,7 @@ import com.convenient.android.common.utils.ToastUtil
 import com.convenient.android.lib.R
 import com.convenient.android.lib.databinding.ActivityAdNativeBinding
 import com.convenient.android.lib.databinding.ViewAdNativeBinding
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch
 

+ 4 - 4
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdNativeListActivity.kt

@@ -1,12 +1,12 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.os.Bundle
 import androidx.lifecycle.lifecycleScope
 import androidx.recyclerview.widget.LinearLayoutManager
 import com.convenient.android.common.base.viewbinding.BaseBindingActivity
 import com.convenient.android.lib.databinding.ActivityAdNativeListBinding
-import com.convenient.android.lib.ui.sample.ad.adapter.NativeAdSampleListAdapter
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.adapter.NativeAdSampleListAdapter
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.launch
 
 /**
@@ -21,7 +21,7 @@ class AdNativeListActivity : BaseBindingActivity<ActivityAdNativeListBinding>(Ac
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
-        val adSlotName = intent.getStringExtra("ad_slot_name")?:Datas.NATIVE
+        val adSlotName = intent.getStringExtra("ad_slot_name")?: Datas.NATIVE
         adapter = NativeAdSampleListAdapter()
         binding.recyclerView.layoutManager = LinearLayoutManager(this)
         binding.recyclerView.adapter = adapter

+ 2 - 2
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AdNativeTemplateActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.os.Bundle
 import androidx.core.view.isVisible
@@ -15,7 +15,7 @@ import com.convenient.android.common.extension.setViewsClick
 import com.convenient.android.common.utils.ToastUtil
 import com.convenient.android.lib.R
 import com.convenient.android.lib.databinding.ActivityAdNativeTemplateBinding
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch
 

+ 4 - 6
app/src/main/java/com/convenient/android/lib/ui/sample/ad/activity/AppWelcomeActivity.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.activity
+package com.convenient.android.lib.ui.ad.activity
 
 import android.os.Bundle
 import androidx.lifecycle.lifecycleScope
@@ -6,9 +6,9 @@ import com.composition.android.lib.ad.AdLoad
 import com.composition.android.lib.ad.basic.AdResult
 import com.convenient.android.common.base.viewbinding.BaseBindingActivity
 import com.convenient.android.common.extension.readyGo
-import com.convenient.android.lib.MainActivity
 import com.convenient.android.lib.databinding.ActivityAppWelcomeBinding
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.AdMainActivity
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.launch
 
@@ -78,13 +78,11 @@ class AppWelcomeActivity : BaseBindingActivity<ActivityAppWelcomeBinding>(Activi
 
 
     private fun toGoMainActivity(delay : Long = 3000){
-
         lifecycleScope.launch {
             delay(delay)
-            this@AppWelcomeActivity.readyGo(MainActivity::class.java)
+            this@AppWelcomeActivity.readyGo(AdMainActivity::class.java)
             finish()
         }
-
     }
 }
 

+ 6 - 6
app/src/main/java/com/convenient/android/lib/ui/sample/ad/adapter/NativeAdSampleListAdapter.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.adapter
+package com.convenient.android.lib.ui.ad.adapter
 
 import android.view.ViewGroup
 import androidx.recyclerview.widget.RecyclerView
@@ -9,7 +9,7 @@ import com.convenient.android.lib.R
 import com.convenient.android.lib.databinding.ViewRvAdNativeItemBinding
 import com.convenient.android.lib.databinding.ViewRvAdNativeTemplateItemBinding
 import com.convenient.android.lib.databinding.ViewRvMediaSampleItemBinding
-import com.convenient.android.lib.ui.sample.ad.model.NativeListBean
+import com.convenient.android.lib.ui.ad.model.NativeListBean
 
 /**
  * @classname:
@@ -41,15 +41,15 @@ class NativeAdSampleListAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder
 
     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
         return when(viewType){
-            ITEM_NORMAL-> BindingViewHolder(parent, ViewRvMediaSampleItemBinding::inflate)
-            ITEM_NATIVE_AD->  BindingViewHolder(parent, ViewRvAdNativeItemBinding::inflate)
+            ITEM_NORMAL -> BindingViewHolder(parent, ViewRvMediaSampleItemBinding::inflate)
+            ITEM_NATIVE_AD ->  BindingViewHolder(parent, ViewRvAdNativeItemBinding::inflate)
             else-> BindingViewHolder(parent, ViewRvAdNativeTemplateItemBinding::inflate)
         }
     }
 
     override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
         when(lists[position].viewType){
-            ITEM_NORMAL->{
+            ITEM_NORMAL ->{
                 val normalHolder = holder as BindingViewHolder<ViewRvMediaSampleItemBinding>
                 val item = lists[position]
                 item.media?.let {
@@ -60,7 +60,7 @@ class NativeAdSampleListAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder
                     }
                 }
             }
-            ITEM_NATIVE_AD->{
+            ITEM_NATIVE_AD ->{
                 (holder as BindingViewHolder<ViewRvAdNativeItemBinding>).apply {
                     binding.nativeAdView.populateAd(lists[position].success!!)
                     binding.nativeAdView.setAdListener {

+ 4 - 3
app/src/main/java/com/convenient/android/lib/ui/sample/ad/model/Datas.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.model
+package com.convenient.android.lib.ui.ad.model
 
 import android.content.Context
 import com.composition.android.lib.ad.AdLoad
@@ -13,7 +13,7 @@ import com.composition.android.lib.ad.util.px2dip
 import com.convenient.android.common.extension.getScreenWidth
 import com.convenient.android.common.media.MediaBean
 import com.convenient.android.lib.LibApplication
-import com.convenient.android.lib.ui.sample.ad.adapter.NativeAdSampleListAdapter
+import com.convenient.android.lib.ui.ad.adapter.NativeAdSampleListAdapter
 import kotlinx.coroutines.flow.firstOrNull
 import kotlin.random.Random
 
@@ -75,7 +75,8 @@ object Datas {
             AdUnitBean(APP_OPEN, Advertisers.GroMore.name, AdType.APP_OPEN.name, "887622184"),
             AdUnitBean(REWARDED_VIDEO, Advertisers.GroMore.name, AdType.REWARDED_VIDEO.name, "102137844"),
             AdUnitBean(NATIVE_TEMPLATE, Advertisers.GroMore.name, AdType.NATIVE_TEMPLATE.name, "945947744", adSize = AdSize(widthPx = (getScreenWidth(LibApplication.context) * 0.9F).toInt(), heightPx = px2dip(LibApplication.context, (getScreenWidth(LibApplication.context).toFloat() * 0.702F - 20)))),
-            AdUnitBean(FEED, Advertisers.GroMore.name, AdType.FEED.name, "102217511", adSize =
+            AdUnitBean(
+                FEED, Advertisers.GroMore.name, AdType.FEED.name, "102217511", adSize =
             AdSize(LibApplication.context.getScreenWidth(), 120)),
         )
 

+ 1 - 1
app/src/main/java/com/convenient/android/lib/ui/sample/ad/model/NativeListBean.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.model
+package com.convenient.android.lib.ui.ad.model
 
 import com.composition.android.lib.ad.basic.AdResult
 import com.convenient.android.common.media.MediaBean

+ 1 - 1
app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdAppOpenPage.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.page
+package com.convenient.android.lib.ui.ad.page
 
 import androidx.compose.runtime.Composable
 

+ 1 - 1
app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdBannerPage.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.page
+package com.convenient.android.lib.ui.ad.page
 
 import androidx.compose.runtime.Composable
 

+ 9 - 4
app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdHomePage.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.page
+package com.convenient.android.lib.ui.ad.page
 
 import android.content.Context
 import androidx.compose.foundation.layout.*
@@ -23,9 +23,14 @@ import com.bumptech.glide.Glide
 import com.bytedance.mtesttools.api.TTMediationTestTool
 import com.composition.android.lib.ad.basic.Advertisers
 import com.convenient.android.common.extension.readyGo
-import com.convenient.android.lib.ui.sample.ad.activity.*
-import com.convenient.android.lib.ui.sample.ad.model.Datas
-import com.convenient.android.lib.ui.sample.ad.viewmodel.AdConfigViewModel
+import com.convenient.android.lib.ui.ad.activity.AdAppOpenActivity
+import com.convenient.android.lib.ui.ad.activity.AdBannerActivity
+import com.convenient.android.lib.ui.ad.activity.AdFeedActivity
+import com.convenient.android.lib.ui.ad.activity.AdFullScreenAdActivity
+import com.convenient.android.lib.ui.ad.activity.AdNativeActivity
+import com.convenient.android.lib.ui.ad.activity.AdNativeTemplateActivity
+import com.convenient.android.lib.ui.ad.model.Datas
+import com.convenient.android.lib.ui.ad.viewmodel.AdConfigViewModel
 
 /**
  * @classname:

+ 3 - 3
app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdInterstitialPage.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.page
+package com.convenient.android.lib.ui.ad.page
 
 import android.annotation.SuppressLint
 import android.content.Context
@@ -15,8 +15,8 @@ import androidx.compose.ui.platform.LocalContext
 import com.composition.android.lib.ad.AdLoad
 import com.composition.android.lib.ad.basic.AdResult
 import com.convenient.android.common.utils.ToastUtil
-import com.convenient.android.lib.ui.sample.ad.AdMainActivity
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.AdMainActivity
+import com.convenient.android.lib.ui.ad.model.Datas
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.launch
 

+ 2 - 2
app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdMainPage.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.page
+package com.convenient.android.lib.ui.ad.page
 
 import androidx.compose.foundation.layout.padding
 import androidx.compose.runtime.Composable
@@ -9,7 +9,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
 import androidx.navigation.NavHostController
 import androidx.navigation.compose.composable
 import androidx.navigation.compose.rememberNavController
-import com.convenient.android.lib.ui.sample.ad.viewmodel.AdConfigViewModel
+import com.convenient.android.lib.ui.ad.viewmodel.AdConfigViewModel
 import com.convenient.android.lib.ui.theme.SampleTheme
 
 /**

+ 1 - 1
app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdNativePage.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.page
+package com.convenient.android.lib.ui.ad.page
 
 import androidx.compose.runtime.Composable
 

+ 1 - 1
app/src/main/java/com/convenient/android/lib/ui/sample/ad/page/AdRewardVideoPage.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.page
+package com.convenient.android.lib.ui.ad.page
 
 import androidx.compose.runtime.Composable
 

+ 1 - 1
app/src/main/java/com/convenient/android/lib/ui/sample/ad/util/CoilImageLoader.kt

@@ -1,4 +1,4 @@
-package com.convenient.android.lib.ui.sample.ad.util
+package com.convenient.android.lib.ui.ad.util
 
 import android.content.Context
 import androidx.appcompat.widget.AppCompatImageView

+ 2 - 2
app/src/main/java/com/convenient/android/lib/ui/sample/ad/viewmodel/AdConfigViewModel.kt

@@ -1,11 +1,11 @@
-package com.convenient.android.lib.ui.sample.ad.viewmodel
+package com.convenient.android.lib.ui.ad.viewmodel
 
 import androidx.compose.runtime.mutableStateOf
 import androidx.lifecycle.ViewModel
 import com.composition.android.lib.ad.AdManager
 import com.composition.android.lib.ad.basic.Advertisers
 import com.composition.android.lib.ad.bean.AdUnitBean
-import com.convenient.android.lib.ui.sample.ad.model.Datas
+import com.convenient.android.lib.ui.ad.model.Datas
 
 /**
  * @classname:

+ 0 - 355
app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaFilesPage.kt

@@ -1,355 +0,0 @@
-package com.convenient.android.lib.ui.sample.media
-
-import android.Manifest
-import android.content.Intent
-import android.content.pm.PackageManager
-import androidx.activity.compose.rememberLauncherForActivityResult
-import androidx.activity.result.contract.ActivityResultContracts
-import androidx.compose.foundation.Image
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.*
-import androidx.compose.foundation.lazy.LazyColumn
-import androidx.compose.foundation.lazy.items
-import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.foundation.text.KeyboardOptions
-import androidx.compose.material.Icon
-import androidx.compose.material.RadioButton
-import androidx.compose.material.Text
-import androidx.compose.material.TextField
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.Delete
-import androidx.compose.material3.*
-import androidx.compose.runtime.*
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.vector.ImageVector
-import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.res.vectorResource
-import androidx.compose.ui.text.TextStyle
-import androidx.compose.ui.text.font.FontWeight
-import androidx.compose.ui.text.input.KeyboardCapitalization
-import androidx.compose.ui.tooling.preview.Preview
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.unit.sp
-import androidx.constraintlayout.compose.ConstraintLayout
-import androidx.constraintlayout.compose.Dimension
-import androidx.core.content.ContextCompat
-import androidx.lifecycle.viewmodel.compose.viewModel
-import com.convenient.android.common.extension.lengthToFitMemorySize
-import com.convenient.android.common.extension.spSave
-import com.convenient.android.common.extension.toFile
-import com.convenient.android.common.media.config.MediaSortOrder
-import com.convenient.android.common.media.config.MediaSortType
-import com.convenient.android.common.utils.date.DateUtils
-import com.convenient.android.lib.R
-import com.convenient.android.lib.ui.theme.SampleTheme
-
-/**
- * @classname:
- * @author: LiuXiaoLong
- * @date: 2022/8/4
- * description:
- */
-
-@Composable
-fun MediaPage() {
-    val context = LocalContext.current
-    var rememberPermission by remember {
-        mutableStateOf(ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)
-    }
-    if (rememberPermission) {
-        MediaFilesPage()
-    } else {
-        PermissionPage {
-            rememberPermission = true
-        }
-    }
-
-}
-
-@Composable
-fun MediaFilesPage() {
-    val viewModel: MediaFilesViewModel = viewModel()
-    val result = viewModel.result.collectAsState()
-
-    LazyColumn {
-
-        item {
-            QueryInfoPage(viewModel = viewModel)
-        }
-
-        item {
-            ResultInfoPage(viewModel = viewModel)
-        }
-
-        items(result.value){item->
-            Row(
-                modifier = Modifier
-                    .padding(vertical = 8.dp)
-                    .fillMaxWidth(), verticalAlignment = Alignment.CenterVertically
-            ) {
-                Image(
-                    imageVector = ImageVector.vectorResource(id = if (item.isFile) R.drawable.ic_icons8_file else R.drawable.ic_icons8_folder),
-                    modifier = Modifier.padding(top = 8.dp, bottom = 8.dp),
-                    contentDescription = null
-                )
-
-                Column {
-                    Text(text = item.name, style = TextStyle(color = Color.Black, fontWeight = FontWeight.Bold, fontSize = 14.sp))
-                    Row {
-                        Text(text = DateUtils.getFormatDate(item.lastModified), fontSize = 12.sp)
-                        Spacer(modifier = Modifier.padding(horizontal = 8.dp))
-                        Text(text = item.mediaPath.toFile()?.lengthToFitMemorySize() ?: "", fontSize = 12.sp)
-                    }
-                }
-            }
-        }
-    }
-}
-
-
-@Composable
-fun QueryInfoPage(viewModel: MediaFilesViewModel) {
-    val context = LocalContext.current
-    val config = viewModel.config.collectAsState()
-    val dir = viewModel.dir.collectAsState()
-    val queryType = viewModel.queryType.collectAsState()
-
-    val addIgnoreFolderLauncher = rememberLauncherForActivityResult(contract = ActivityResultContracts.StartActivityForResult(), onResult = {
-        it.data?.data?.let {
-            val folder = resolveContentUri(context, it)
-            viewModel.addConfigIgnoreChildFiles(folder.toFile())
-        }
-    })
-
-
-    val addIgnoreFileLauncher = rememberLauncherForActivityResult(contract = ActivityResultContracts.GetContent(), onResult = {
-        it?.let { uri ->
-            val folder = UriTofilePath.getFilePathByUri(context, uri)
-            viewModel.addConfigIgnoreChildFiles(folder.toFile())
-        }
-    })
-
-    val chooseDirLauncher = rememberLauncherForActivityResult(contract = ActivityResultContracts.StartActivityForResult(), onResult = {
-        it.data?.data?.let {
-            val path = resolveContentUri(context, it)
-            context.spSave("dir", path)
-            viewModel.changeQueryDir(path)
-        }
-    })
-
-    ConstraintLayout(
-        modifier = Modifier
-            .fillMaxWidth()
-    ) {
-        val (btnFromFiles, btnFromMediaStore, btnChooseDir) = createRefs()
-
-        ElevatedButton(
-            onClick = { chooseDirLauncher.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)) },
-            modifier = Modifier
-                .fillMaxWidth()
-                .constrainAs(btnChooseDir) {
-                    top.linkTo(parent.top)
-                    start.linkTo(parent.start)
-                    end.linkTo(parent.end)
-                }) {
-            Text(text = "选择文件夹")
-        }
-
-        ElevatedButton(onClick = { viewModel.changeQueryType(MediaQueryType.FILES) }, modifier = Modifier
-            .padding(end = 8.dp)
-            .constrainAs(btnFromFiles) {
-                top.linkTo(btnChooseDir.bottom)
-                start.linkTo(parent.start)
-                end.linkTo(btnFromMediaStore.start)
-                width = Dimension.fillToConstraints
-            }) {
-            Text(text = "从FilesMedia获取")
-
-        }
-
-        ElevatedButton(onClick = { viewModel.changeQueryType(MediaQueryType.MEDIA_STORE) },
-            modifier = Modifier
-                .padding(start = 8.dp)
-                .constrainAs(btnFromMediaStore) {
-                    top.linkTo(btnFromFiles.top)
-                    start.linkTo(btnFromFiles.end)
-                    end.linkTo(parent.end)
-                    width = Dimension.fillToConstraints
-                }) {
-            Text(text = "从MediaStore获取")
-        }
-    }
-
-
-    Column() {
-        InfoItem(title = "目录:", info = dir.value, infoPosition = InfoPosition.END)
-        InfoItem(title = "获取方式:", info = queryType.value.name, infoPosition = InfoPosition.END)
-
-        InfoItem(title = "查询的文件格式:", info = config.value.supportMimeTypes.toString(), infoPosition = InfoPosition.END)
-        TextField(
-            keyboardOptions = KeyboardOptions(autoCorrect = false, capitalization = KeyboardCapitalization.None),
-            value = viewModel.getSupportMimeTypesFiledTextValue(config.value),
-            singleLine = true,
-            shape = RoundedCornerShape(4.dp),
-            onValueChange = {
-                val a = it.replace("[", "").replace("]", "").trim().lowercase()
-                val supportMimeTypes = a.split(",").toMutableList()
-                viewModel.changeConfig(config = config.value.copy(supportMimeTypes = supportMimeTypes))
-            }, placeholder = {
-                Text(text = "png,jpg 以,分割")
-            })
-        Row {
-            val includeFolder = config.value.includeFolder
-            RadioButton(selected = includeFolder, onClick = {
-                viewModel.changeConfigIncludeFolder(includeFolder.not())
-            })
-            InfoItem(title = "结果是否包含文件夹:", info = config.value.includeFolder.toString())
-        }
-        Row {
-            val recursively = config.value.recursively
-            RadioButton(selected = recursively, onClick = {
-                viewModel.changeConfig(config.value.copy(recursively = recursively.not()))
-            })
-            InfoItem(title = "遍历子文件夹:", info = config.value.recursively.toString())
-        }
-        InfoItem(title = "排序类型:", info = "")
-        SortTypeButton(viewModel = viewModel)
-        InfoItem(title = "排序方式:", info = "")
-        OrderTypeButton(viewModel = viewModel)
-
-        InfoItem(title = "忽略的文件:", info = "")
-        Row {
-            ElevatedButton(onClick = { addIgnoreFolderLauncher.launch(Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)) }) {
-                Text(text = "选择忽略的文件夹")
-            }
-
-            ElevatedButton(onClick = { addIgnoreFileLauncher.launch("*/*") }) {
-                Text(text = "选择忽略的文件")
-            }
-        }
-        for (ignoreChildFile in config.value.ignoreChildFiles) {
-            Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
-                Text(modifier = Modifier.weight(3F), text = ignoreChildFile.absolutePath)
-                IconButton(modifier = Modifier.weight(1F), onClick = {
-                    viewModel.removeConfigIgnoreChildFiles(ignoreChildFile)
-                }) {
-                    Icon(imageVector = Icons.Default.Delete, contentDescription = null)
-                }
-            }
-        }
-        Spacer(
-            modifier = Modifier
-                .fillMaxWidth()
-                .height(1.dp)
-                .background(color = Color.LightGray)
-        )
-
-    }
-}
-
-@Composable
-fun SortTypeButton(viewModel: MediaFilesViewModel) {
-    val sortType = viewModel.config.collectAsState()
-
-    val types = listOf(MediaSortType.DATE, MediaSortType.SIZE, MediaSortType.NAME)
-
-    Row {
-        types.forEach {
-            FilledTonalButton(
-                colors = ButtonDefaults.filledTonalButtonColors(
-                    containerColor = if (it == sortType.value.sortType) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.primary.copy(0.1F)
-                )
-                ,onClick = {
-                viewModel.changeSortType(it)
-            }) {
-                Text(text = it.name, color = Color.White)
-            }
-        }
-    }
-}
-
-@Composable
-fun OrderTypeButton(viewModel: MediaFilesViewModel) {
-    val orderType = viewModel.config.collectAsState()
-
-    val types = listOf(MediaSortOrder.ASC, MediaSortOrder.DESC)
-
-    Row {
-        types.forEach {
-            FilledTonalButton(
-                colors = ButtonDefaults.filledTonalButtonColors(
-                    containerColor = if (it == orderType.value.order) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.primary.copy(0.1F)
-                )
-                ,onClick = {
-                    viewModel.changeOrder(it)
-                }) {
-                Text(text = it.name, color = Color.White)
-            }
-        }
-    }
-}
-
-enum class InfoPosition {
-    TOP, BOTTOM, START, END
-}
-
-@Composable
-fun InfoItem(title: String, info: String, infoPosition: InfoPosition = InfoPosition.BOTTOM) {
-
-
-    Column(verticalArrangement = Arrangement.Center) {
-        if (infoPosition == InfoPosition.TOP) {
-            info(info)
-        }
-        Row {
-            if (infoPosition == InfoPosition.START) {
-                info(info)
-            }
-            Text(text = title, style = TextStyle(fontSize = 14.sp, color = Color.Black, fontWeight = FontWeight.Bold))
-            if (infoPosition == InfoPosition.END) {
-                info(info)
-            }
-        }
-        if (infoPosition == InfoPosition.BOTTOM) {
-            info(info)
-        }
-        Spacer(modifier = Modifier.padding(top = 8.dp))
-    }
-}
-
-@Composable
-fun info(info: String) {
-    if (info.isNotEmpty() && info.equals("[]").not()) {
-        Text(text = info, style = TextStyle(fontSize = 12.sp), modifier = Modifier.padding(horizontal = 8.dp))
-    }
-}
-
-@Composable
-fun ResultInfoPage(viewModel: MediaFilesViewModel) {
-
-    InfoItem(title = "查询结果", info = "")
-
-    val result = viewModel.result.collectAsState()
-    val count = result.value.size
-    val mimeTypes = result.value.distinctBy {
-        it.extension
-    }.map {
-        it.extension
-    }
-
-    InfoItem(title = "数量", info = count.toString())
-    InfoItem(title = "结果文件格式", info = mimeTypes.toString())
-
-}
-
-
-@Preview(showSystemUi = true)
-@Composable
-fun MediaFilesPagePreview() {
-    SampleTheme {
-        MediaFilesPage()
-    }
-}
-

+ 0 - 39
app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaFilesRepository.kt

@@ -1,39 +0,0 @@
-package com.convenient.android.lib.ui.sample.media
-
-import com.convenient.android.common.media.MediaBean
-import com.convenient.android.common.media.config.MediaQueryConfig
-import com.convenient.android.common.media.scan.FileStore
-import com.convenient.android.common.media.scan.MediaStore
-
-/**
- * @classname:
- * @author: LiuXiaoLong
- * @date: 2022/8/4
- * description:
- * */
-
-enum class MediaQueryType{
-    FILES,MEDIA_STORE
-}
-
-class MediaFilesRepository {
-
-    companion object{
-
-        val instance by lazy {
-            MediaFilesRepository()
-        }
-
-    }
-
-
-    suspend fun queryMediaFiles(queryType: MediaQueryType,dir : String, config: MediaQueryConfig) : List<MediaBean>{
-        return when(queryType){
-            MediaQueryType.MEDIA_STORE-> MediaStore.query(dir = dir, config)
-            MediaQueryType.FILES -> FileStore.query(dir, config)
-        }
-    }
-
-
-
-}

+ 0 - 114
app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaFilesViewModel.kt

@@ -1,114 +0,0 @@
-package com.convenient.android.lib.ui.sample.media
-
-import android.app.Application
-import androidx.lifecycle.AndroidViewModel
-import androidx.lifecycle.viewModelScope
-import com.convenient.android.common.extension.spGetString
-import com.convenient.android.common.media.MediaBean
-import com.convenient.android.common.media.config.MediaQueryConfig
-import com.convenient.android.common.media.config.MediaSortOrder
-import com.convenient.android.common.media.config.MediaSortType
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.launch
-import java.io.File
-
-/**
- * @classname:
- * @author: LiuXiaoLong
- * @date: 2022/8/4
- * description:
- */
-class MediaFilesViewModel(application: Application) : AndroidViewModel(application) {
-
-    private var _config : MutableStateFlow<MediaQueryConfig> = MutableStateFlow(MediaQueryConfig())
-    var config : StateFlow<MediaQueryConfig> = _config
-
-    private var _dir : MutableStateFlow<String> = MutableStateFlow(application.spGetString(key = "dir"))
-    var dir : StateFlow<String> = _dir
-
-    private var _queryType : MutableStateFlow<MediaQueryType> = MutableStateFlow(MediaQueryType.FILES)
-    var queryType : StateFlow<MediaQueryType> = _queryType
-
-    private var _result : MutableStateFlow<List<MediaBean>> = MutableStateFlow(mutableListOf())
-    var result :StateFlow<List<MediaBean>>  = _result
-
-
-    fun changeQueryType(queryType: MediaQueryType){
-        _queryType.value = queryType
-        viewModelScope.launch {
-            query()
-        }
-    }
-
-    fun changeConfig(config: MediaQueryConfig){
-        _config.value = config
-    }
-
-
-    fun changeQueryDir(dir : String){
-        _dir.value = dir
-    }
-
-    fun addConfigIgnoreChildFiles(file: File?){
-        file?.let {
-            changeConfig(copyNewConfig {
-                this.ignoreChildFiles = this.ignoreChildFiles.toMutableList().apply { add(file) }
-            })
-        }
-    }
-
-    fun removeConfigIgnoreChildFiles(file : File){
-        changeConfig(copyNewConfig {
-            ignoreChildFiles = ignoreChildFiles.toMutableList().apply {
-                remove(file)
-            }
-        })
-    }
-
-    fun changeConfigIncludeFolder(includeFolder : Boolean){
-        changeConfig(copyNewConfig {
-            this.includeFolder = includeFolder
-        })
-    }
-
-    fun changeSortType(sortType: MediaSortType){
-        changeConfig(copyNewConfig {
-            this.sortType = sortType
-        })
-    }
-    fun changeOrder(order: MediaSortOrder){
-        changeConfig(copyNewConfig {
-            this.order = order
-        })
-    }
-
-
-    private fun copyNewConfig(config: MediaQueryConfig.()-> Unit) : MediaQueryConfig{
-        return _config.value.copy().also(config)
-    }
-
-    fun getSupportMimeTypesFiledTextValue(config: MediaQueryConfig) : String{
-        val value = if (config.supportMimeTypes.isNotEmpty()) {
-            buildString {
-                config.supportMimeTypes.forEachIndexed { index, s ->
-                    if (index != config.supportMimeTypes.lastIndex) {
-                        append(s).append(",")
-                    } else {
-                        append(s)
-                    }
-                }
-            }
-        } else {
-            ""
-        }
-        return value
-    }
-
-    suspend fun query(){
-        _result.value = MediaFilesRepository.instance.queryMediaFiles(_queryType.value, _dir.value, _config.value)
-    }
-
-
-
-}

+ 0 - 79
app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaPermissionPage.kt

@@ -1,79 +0,0 @@
-package com.convenient.android.lib.ui.sample.media
-
-import android.Manifest
-import android.app.Activity
-import android.content.Intent
-import android.content.pm.PackageManager
-import android.os.Build
-import android.os.Environment
-import android.provider.Settings
-import androidx.activity.compose.rememberLauncherForActivityResult
-import androidx.activity.result.contract.ActivityResultContracts
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxHeight
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.material.Text
-import androidx.compose.material3.ElevatedButton
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalContext
-import androidx.core.content.ContextCompat
-import com.convenient.android.common.utils.ToastUtil
-
-/**
- * @classname:
- * @author: LiuXiaoLong
- * @date: 2022/8/30
- * description:
- */
-
-
-
-@Composable
-fun PermissionPage(permissionCallback: () -> Unit) {
-
-    val context = LocalContext.current
-    val androidRStoragePermissionLauncher = rememberLauncherForActivityResult(contract = ActivityResultContracts.StartActivityForResult(), onResult = {
-        if (it.resultCode == Activity.RESULT_OK && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
-            if (Environment.isExternalStorageManager()) {
-                ToastUtil.showToast(context, "访问所有文件权限获取成功")
-                permissionCallback.invoke()
-            }
-        }
-    })
-
-    val permissionLaunch = rememberLauncherForActivityResult(contract = ActivityResultContracts.RequestPermission(), onResult = {
-        if (it) {
-            ToastUtil.showToast(context, "存储权限获取成功")
-            permissionCallback.invoke()
-        }
-    })
-
-    Column(
-        modifier = Modifier
-            .fillMaxWidth()
-            .fillMaxHeight(), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally
-    ) {
-
-        ElevatedButton(onClick = {
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
-                if (Environment.isExternalStorageManager().not()) {
-                    androidRStoragePermissionLauncher.launch(Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION))
-                } else {
-                    if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
-                        ToastUtil.showToast(context, "已获取存储权限")
-                    } else {
-                        permissionLaunch.launch(Manifest.permission.WRITE_EXTERNAL_STORAGE)
-                    }
-                }
-            } else {
-                permissionLaunch.launch(Manifest.permission.WRITE_EXTERNAL_STORAGE)
-            }
-        }) {
-            Text(text = "获取存储权限")
-        }
-    }
-
-}

+ 0 - 156
app/src/main/java/com/convenient/android/lib/ui/sample/media/MediaSampleActivity.kt

@@ -1,156 +0,0 @@
-package com.convenient.android.lib.ui.sample.media
-
-import android.content.ContentResolver
-import android.content.ContentUris
-import android.content.Context
-import android.database.Cursor
-import android.net.Uri
-import android.os.Build
-import android.os.Bundle
-import android.os.Environment.getExternalStorageDirectory
-import android.provider.DocumentsContract
-import android.provider.MediaStore
-import androidx.activity.compose.setContent
-import com.convenient.android.common.base.view.BaseActivity
-import com.convenient.android.common.config.MyPdfBaseModule
-import com.convenient.android.lib.ui.theme.SampleTheme
-import java.io.File
-
-class MediaSampleActivity : BaseActivity() {
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        MyPdfBaseModule.init(application, true, "1")
-        setContent {
-            SampleTheme {
-                MediaPage()
-            }
-        }
-    }
-
-}
-
-fun resolveContentUri(context: Context, uri: Uri): String {
-
-
-    val docUri = DocumentsContract.buildDocumentUriUsingTree(uri, DocumentsContract.getTreeDocumentId(uri))
-
-    val docCursor = context.contentResolver.query(docUri, null, null, null, null)
-
-    var str: String = ""
-
-    // get a string of the form : primary:Audiobooks or 1407-1105:Audiobooks
-    while (docCursor!!.moveToNext()) {
-        str = docCursor.getString(0)
-        if (str.matches(Regex(".*:.*"))) break //Maybe useless
-    }
-
-    docCursor.close()
-
-    val split = str.split(":")
-
-    val base: File =
-        if (split[0] == "primary") getExternalStorageDirectory()
-        else File("/storage/${split[0]}")
-
-    if (!base.isDirectory) throw Exception("'$uri' cannot be resolved in a valid path")
-
-    return File(base, split[1]).canonicalPath
-}
-
-
-object UriTofilePath {
-    fun getFilePathByUri(context: Context, uri: Uri): String? {
-        var path: String? = null
-        // 4.4及之后的 是以 content:// 开头的,比如 content://com.android.providers.media.documents/document/image%3A235700
-        if (ContentResolver.SCHEME_CONTENT.equals(uri.scheme) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-            if (DocumentsContract.isDocumentUri(context, uri)) {
-                if (isExternalStorageDocument(uri)) {
-                    // ExternalStorageProvider
-                    val docId = DocumentsContract.getDocumentId(uri)
-                    val split = docId.split(":".toRegex()).toTypedArray()
-                    val type = split[0]
-                    if ("primary".equals(type, ignoreCase = true)) {
-                        path = getExternalStorageDirectory().toString() + "/" + split[1]
-                        return path
-                    }
-                } else if (isDownloadsDocument(uri)) {
-                    // DownloadsProvider
-                    val id = DocumentsContract.getDocumentId(uri)
-                    val contentUri: Uri = ContentUris.withAppendedId(
-                        Uri.parse("content://downloads/public_downloads"),
-                        java.lang.Long.valueOf(id)
-                    )
-                    path = getDataColumn(context, contentUri, null, null)
-                    return path
-                } else if (isMediaDocument(uri)) {
-                    // MediaProvider
-                    val docId = DocumentsContract.getDocumentId(uri)
-                    val split = docId.split(":".toRegex()).toTypedArray()
-                    val type = split[0]
-                    var contentUri: Uri? = null
-                    if ("image" == type) {
-                        contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
-                    } else if ("video" == type) {
-                        contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
-                    } else if ("audio" == type) {
-                        contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
-                    }
-                    val selection = "_id=?"
-                    val selectionArgs = arrayOf(split[1])
-                    path = getDataColumn(context, contentUri, selection, selectionArgs)
-                    return path
-                }
-            }
-        } else {
-            // 以 file:// 开头的
-            if (ContentResolver.SCHEME_FILE.equals(uri.scheme)) {
-                path = uri.path
-                return path
-            }
-            // 以 content:// 开头的,比如 content://media/extenral/images/media/17766
-            if (ContentResolver.SCHEME_CONTENT.equals(uri.scheme) && Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
-                val cursor: Cursor? = context.contentResolver.query(uri, arrayOf(MediaStore.Images.Media.DATA), null, null, null)
-                if (cursor != null) {
-                    if (cursor.moveToFirst()) {
-                        val columnIndex: Int = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)
-                        if (columnIndex > -1) {
-                            path = cursor.getString(columnIndex)
-                        }
-                    }
-                    cursor.close()
-                }
-                return path
-            }
-        }
-        return null
-    }
-
-    private fun getDataColumn(context: Context, uri: Uri?, selection: String?, selectionArgs: Array<String>?): String? {
-        var cursor: Cursor? = null
-        val column = "_data"
-        val projection = arrayOf(column)
-        try {
-            cursor = context.contentResolver.query(uri!!, projection, selection, selectionArgs, null)
-            if (cursor != null && cursor.moveToFirst()) {
-                val column_index: Int = cursor.getColumnIndexOrThrow(column)
-                return cursor.getString(column_index)
-            }
-        } finally {
-            if (cursor != null) cursor.close()
-        }
-        return null
-    }
-
-    private fun isExternalStorageDocument(uri: Uri): Boolean {
-        return "com.android.externalstorage.documents" == uri.authority
-    }
-
-    private fun isDownloadsDocument(uri: Uri): Boolean {
-        return "com.android.providers.downloads.documents" == uri.authority
-    }
-
-    private fun isMediaDocument(uri: Uri): Boolean {
-        return "com.android.providers.media.documents" == uri.authority
-    }
-}

+ 0 - 181
app/src/main/java/com/convenient/android/lib/ui/sample/read/ReaderActivity.kt

@@ -1,181 +0,0 @@
-package com.convenient.android.lib.ui.sample.read
-
-import android.annotation.SuppressLint
-import android.os.Bundle
-import android.util.Log
-import androidx.activity.ComponentActivity
-import androidx.activity.compose.rememberLauncherForActivityResult
-import androidx.activity.compose.setContent
-import androidx.activity.result.contract.ActivityResultContracts
-import androidx.compose.foundation.layout.*
-import androidx.compose.material.*
-import androidx.compose.material.Text
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.Add
-import androidx.compose.material.icons.filled.Settings
-import androidx.compose.material3.*
-import androidx.compose.material3.Icon
-import androidx.compose.material3.IconButton
-import androidx.compose.runtime.*
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.tooling.preview.Preview
-import androidx.compose.ui.viewinterop.AndroidView
-import androidx.lifecycle.LifecycleCoroutineScope
-import androidx.lifecycle.lifecycleScope
-import com.compdfkit.core.document.CPDFDocument
-import com.compdfkit.ui.reader.CPDFReaderView
-import com.compdfkit.ui.reader.IReaderViewCallback
-import com.convenient.android.common.utils.ToastUtil
-import com.convenient.android.lib.ui.sample.read.setting.BottomSettingView
-import com.convenient.android.lib.ui.theme.SampleTheme
-import com.pdf.base.function.documentIsEncrypt
-import com.pdf.base.function.openDocument
-import com.pdf.base.function.retryOpenDocument
-import kotlinx.coroutines.launch
-
-/**
- * @author: hubowen
- * @date: 2022/9/20
- * @description:
- */
-var readerView: CPDFReaderView? = null
-
-class ReaderActivity : ComponentActivity() {
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        setContent {
-            SampleTheme {
-                readerPage(lifecycleScope)
-            }
-        }
-    }
-}
-
-@Preview(showSystemUi = true)
-@Composable
-fun MainPagePreview() {
-    SampleTheme {
-        readerPage(null)
-    }
-}
-
-@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class)
-@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter", "CoroutineCreationDuringComposition")
-@Composable
-fun readerPage(life: LifecycleCoroutineScope?) {
-    val context = LocalContext.current
-
-    val coroutineScope = rememberCoroutineScope()
-
-    var currentDocument by remember { mutableStateOf<CPDFDocument?>(null) }
-
-    val choosePDFFileLauncher = rememberLauncherForActivityResult(contract = ActivityResultContracts.OpenMultipleDocuments(), onResult = {
-        //第一个文件
-        when (it.isNotEmpty()) {
-            true -> it[0].apply {
-                life?.launch {
-
-                    if (context.documentIsEncrypt(this@apply)) {
-                        Log.e("AAAA", "文档已加密")
-                    }else{
-                        Log.e("AAAA", "文档未加密")
-                    }
-
-                    context.openDocument(this@apply, "", ""){
-
-                        success {
-                            currentDocument = it
-                        }
-
-                        fail {
-                            Log.e("AAAA", "初始化失败")
-                        }
-
-                        isEncrypt {
-                            ToastUtil.showToast(context, "文档已加密")
-                            life.launch {
-                                it.retryOpenDocument(this@apply, absolutePath = "", password = "", normalOpenDocumentCallback = this@openDocument)
-                            }
-                        }
-                    }
-                }
-            }
-            else -> ToastUtil.showToast(context, "初始化失败")
-        }
-    })
-
-    val sheetState = rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden)
-    ModalBottomSheetLayout(
-        modifier = Modifier.fillMaxSize(),
-        sheetState = sheetState,
-        sheetContent = {
-            BottomSettingView()
-        }) {
-        Column {
-            Scaffold(
-                modifier = Modifier.fillMaxSize(),
-                topBar = {
-                    SmallTopAppBar(
-                        title = {
-                            Text(text = "ReadView", style = androidx.compose.material3.MaterialTheme.typography.titleMedium)
-                        },
-                        colors = TopAppBarDefaults.smallTopAppBarColors(
-                            containerColor = androidx.compose.material3.MaterialTheme.colorScheme.primary.copy(alpha = .1F)
-                        ),
-                        actions = {
-                            IconButton(onClick = {
-                                coroutineScope.launch {
-                                    sheetState.show()
-                                }
-                            }) {
-                                Icon(Icons.Filled.Settings, null)
-                            }
-                            IconButton(onClick = {
-                                choosePDFFileLauncher.launch(arrayOf("*/*"))
-                            }) {
-                                Icon(Icons.Filled.Add, null)
-                            }
-                        }
-                    )
-                }
-            ) {
-                Column(modifier = Modifier
-                    .fillMaxWidth()
-                    .wrapContentHeight(Alignment.CenterVertically)) {
-                    //ReaderView展示位置
-                    AndroidView(factory = { context ->
-                        CPDFReaderView(context).apply {
-                            readerView = this
-                            //监听设置
-                            setReaderViewCallback(object : IReaderViewCallback {
-                                override fun onTapMainDocArea() {
-                                    Log.e("AAAA", "onTapMainDocArea")
-                                }
-
-                                override fun onMoveToChild(p0: Int) {
-                                }
-
-                                override fun onEndScroll() {
-                                }
-
-                                override fun onScrolling() {
-                                }
-
-                                override fun onRecordLastJumpPageNum(p0: Int) {
-                                    Log.e("AAAA", "onRecordLastJumpPageNum")
-                                }
-                            })
-                        }
-                    }, update = { readerView ->
-                        readerView.pdfDocument = currentDocument
-                        readerView.reloadPages()
-                    }, modifier = Modifier
-                        .fillMaxWidth()
-                        .fillMaxHeight())
-                }
-            }
-        }
-    }
-}

+ 0 - 27
app/src/main/java/com/convenient/android/lib/ui/sample/read/ReaderViewActivity.kt

@@ -1,27 +0,0 @@
-package com.convenient.android.lib.ui.sample.read
-
-import android.os.Bundle
-import androidx.lifecycle.lifecycleScope
-import com.convenient.android.common.base.viewbinding.BaseBindingActivity
-import com.convenient.android.lib.databinding.ActivityReaderViewBinding
-import com.pdf.base.function.openDocument
-import kotlinx.coroutines.launch
-
-/**
- * @author: hubowen
- * @date: 2022/9/20
- * @description:
- */
-class ReaderViewActivity : BaseBindingActivity<ActivityReaderViewBinding>(ActivityReaderViewBinding::inflate) {
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        lifecycleScope.launch {
-            this@ReaderViewActivity.openDocument(uri = null, absolutePath = "/storage/emulated/0/17PDF/123.pdf", password = ""){
-                success {  }
-                fail {  }
-                isEncrypt {  }
-            }
-        }
-        readerView
-    }
-}

+ 0 - 52
app/src/main/java/com/convenient/android/lib/ui/sample/read/annotation/AnnotationItem.kt

@@ -1,52 +0,0 @@
-package com.convenient.android.lib.ui.sample.read.annotation
-
-import androidx.compose.foundation.layout.Column
-import androidx.compose.material3.Text
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.vector.ImageVector
-
-/**
- * @author: hubowen
- * @date: 2022/9/29
- * @description:
- */
-
-data class BottomItem(
-    val title: String,
-    val icon: ImageVector,
-)
-
-@Composable
-fun AnnotationItem(
-    imageId: ImageVector,
-    annotationName: String,
-    onClick: () -> Unit,
-    modifier: Modifier = Modifier,
-) {
-    Column(
-        modifier = modifier,
-        horizontalAlignment = Alignment.CenterHorizontally
-    ) {
-        Text(text = annotationName)
-//        ProfilePicture(
-//            imageId = profileImageId,
-//            contentDescription = null,
-//            size = ProfileSizes.large,
-//            modifier = Modifier
-//                .border(
-//                    shape = CircleShape,
-//                    border = BorderStroke(width = 3.dp, brush = borderColor)
-//                )
-//                .clickable(
-//                    interactionSource = interactionSource,
-//                    indication = rememberRipple(bounded = false, radius = ProfileSizes.large / 2),
-//                    enabled = true,
-//                    onClickLabel = null,
-//                    onClick = onClick
-//                )
-//        )
-//        Text(text = profileName, style = textStyle, textAlign = TextAlign.Center, onClick = onClick.invoke())
-    }
-}

+ 0 - 57
app/src/main/java/com/convenient/android/lib/ui/sample/read/annotation/AnnotationList.kt

@@ -1,57 +0,0 @@
-package com.convenient.android.lib.ui.sample.read.annotation
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.lazy.LazyRow
-import androidx.compose.foundation.lazy.items
-import androidx.compose.material.icons.Icons
-import androidx.compose.material.icons.filled.AddCircle
-import androidx.compose.material.icons.filled.Edit
-import androidx.compose.material.icons.filled.List
-import androidx.compose.material.icons.filled.Settings
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.unit.dp
-
-/**
- * @author: hubowen
- * @date: 2022/9/29
- * @description:
- */
-
-val annotationItemList = arrayListOf(
-    BottomItem(title = "注释", Icons.Filled.List),
-    BottomItem(title = "背景", Icons.Filled.AddCircle),
-    BottomItem(title = "编辑", Icons.Filled.Edit),
-    BottomItem(title = "设置", Icons.Filled.Settings),
-    BottomItem(title = "注释", Icons.Filled.List),
-    BottomItem(title = "背景", Icons.Filled.AddCircle),
-    BottomItem(title = "编辑", Icons.Filled.Edit),
-    BottomItem(title = "设置", Icons.Filled.Settings),
-    BottomItem(title = "注释", Icons.Filled.List),
-    BottomItem(title = "背景", Icons.Filled.AddCircle),
-    BottomItem(title = "编辑", Icons.Filled.Edit),
-    BottomItem(title = "设置", Icons.Filled.Settings)
-)
-
-@Composable
-fun AnnotationList(
-    annotationList: List<BottomItem>,
-    onClicked: () -> Unit,
-    modifier: Modifier = Modifier,
-) {
-    LazyRow(
-        modifier = modifier.padding(top = 8.dp, bottom = 8.dp),
-        horizontalArrangement = Arrangement.spacedBy(8.dp),
-        contentPadding = PaddingValues(horizontal = 8.dp)
-    ) {
-        items(annotationList) {
-            AnnotationItem(
-                imageId = it.icon,
-                annotationName = it.title,
-                onClick = onClicked
-            )
-        }
-    }
-}

+ 0 - 14
app/src/main/java/com/convenient/android/lib/ui/sample/read/data/ReaderData.kt

@@ -1,14 +0,0 @@
-package com.convenient.android.lib.ui.sample.read.data
-
-/**
- * @author: hubowen
- * @date: 2022/9/29
- * @description:
- */
-
-enum class ReaderMode(val mode: Int) {
-    VERTICAL_CONTINUE(0),
-    VERTICAL_N_CONTINUE(1),
-    HORIZONTAL_CONTINUE(2),
-    HORIZONTAL_N_CONTINUE(3)
-}

+ 0 - 155
app/src/main/java/com/convenient/android/lib/ui/sample/read/setting/SettingView.kt

@@ -1,155 +0,0 @@
-package com.convenient.android.lib.ui.sample.read.setting
-
-import androidx.compose.foundation.clickable
-import androidx.compose.foundation.layout.*
-import androidx.compose.material.Divider
-import androidx.compose.material.RadioButton
-import androidx.compose.material.Switch
-import androidx.compose.material.Text
-import androidx.compose.runtime.*
-import androidx.compose.ui.Alignment
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.unit.dp
-import com.convenient.android.lib.ui.sample.read.data.ReaderMode
-import com.convenient.android.lib.ui.sample.read.readerView
-import com.pdf.base.function.annotationDeleteAll
-import kotlinx.coroutines.launch
-
-/**
- * @author: hubowen
- * @date: 2022/9/29
- * @description:
- */
-@Composable
-fun BottomSettingView() {
-    var readerModeRemember by remember { mutableStateOf(ReaderMode.VERTICAL_CONTINUE.mode) }
-    var readerSinglePageRemember by remember { mutableStateOf(true) }
-    var readerClipRemember by remember { mutableStateOf(true) }
-    var readerVisiblePageRemember by remember { mutableStateOf(true) }
-    var readerAnnotationDeleteAllRemember by remember { mutableStateOf(false) }
-
-    Column(modifier = Modifier.fillMaxSize()) {
-        Row(modifier = Modifier
-            .fillMaxWidth()
-            .padding(10.dp, 5.dp, 10.dp, 5.dp),
-            horizontalArrangement = Arrangement.SpaceBetween,
-            verticalAlignment = Alignment.CenterVertically
-        ) {
-            RadioButton(modifier = Modifier.width(15.dp), selected = readerModeRemember == ReaderMode.VERTICAL_CONTINUE.mode, onClick = { readerModeRemember = ReaderMode.VERTICAL_CONTINUE.mode })
-            Text(
-                text = "垂直连续",
-                modifier = Modifier
-                    .clickable(onClick = { readerModeRemember = ReaderMode.VERTICAL_CONTINUE.mode })
-            )
-            RadioButton(modifier = Modifier.width(15.dp), selected = readerModeRemember == ReaderMode.VERTICAL_N_CONTINUE.mode, onClick = { readerModeRemember = ReaderMode.VERTICAL_N_CONTINUE.mode })
-            Text(
-                text = "垂直不连续",
-                modifier = Modifier
-                    .clickable(onClick = { readerModeRemember = ReaderMode.VERTICAL_N_CONTINUE.mode })
-            )
-        }
-        Row(modifier = Modifier
-            .fillMaxWidth()
-            .padding(10.dp, 5.dp, 10.dp, 5.dp),
-            horizontalArrangement = Arrangement.SpaceBetween,
-            verticalAlignment = Alignment.CenterVertically) {
-            RadioButton(modifier = Modifier.width(15.dp), selected = readerModeRemember == ReaderMode.HORIZONTAL_CONTINUE.mode, onClick = { readerModeRemember = ReaderMode.HORIZONTAL_CONTINUE.mode })
-            Text(
-                text = "水平连续",
-                modifier = Modifier
-                    .clickable(onClick = { readerModeRemember = ReaderMode.HORIZONTAL_CONTINUE.mode })
-            )
-            RadioButton(modifier = Modifier.width(15.dp), selected = readerModeRemember == ReaderMode.HORIZONTAL_N_CONTINUE.mode, onClick = { readerModeRemember = ReaderMode.HORIZONTAL_N_CONTINUE.mode })
-            Text(
-                text = "水平不连续",
-                modifier = Modifier
-                    .clickable(onClick = { readerModeRemember = ReaderMode.HORIZONTAL_N_CONTINUE.mode })
-            )
-        }
-        Divider()
-        Row(modifier = Modifier
-            .fillMaxWidth()
-            .padding(10.dp, 5.dp, 10.dp, 5.dp),
-            horizontalArrangement = Arrangement.SpaceBetween,
-            verticalAlignment = Alignment.CenterVertically
-        ) {
-            Text(text = "单页模式")
-            Switch(checked = readerSinglePageRemember, onCheckedChange = {
-                readerSinglePageRemember = it
-            })
-        }
-        Divider()
-        Row(modifier = Modifier
-            .fillMaxWidth()
-            .padding(10.dp, 5.dp, 10.dp, 5.dp),
-            horizontalArrangement = Arrangement.SpaceBetween,
-            verticalAlignment = Alignment.CenterVertically
-        ) {
-            Text(text = "裁剪模式")
-            Switch(checked = readerClipRemember, onCheckedChange = {
-                readerClipRemember = it
-            })
-        }
-        Divider()
-        Row(modifier = Modifier
-            .fillMaxWidth()
-            .padding(10.dp, 5.dp, 10.dp, 5.dp),
-            horizontalArrangement = Arrangement.SpaceBetween,
-            verticalAlignment = Alignment.CenterVertically) {
-            Text(text = "页码显示")
-            Switch(checked = readerVisiblePageRemember, onCheckedChange = {
-                readerVisiblePageRemember = it
-            })
-        }
-        Divider()
-        Row(modifier = Modifier
-            .clickable(onClick = {
-                //删除所有注释
-                readerAnnotationDeleteAllRemember = !readerAnnotationDeleteAllRemember
-            })
-            .fillMaxWidth()
-            .height(50.dp)
-            .padding(10.dp, 5.dp, 10.dp, 5.dp),
-            horizontalArrangement = Arrangement.SpaceBetween,
-            verticalAlignment = Alignment.CenterVertically) {
-            Text(text = "删除所有注释")
-        }
-        //界面更改
-        readerView?.apply {
-            //阅读模式
-            when (readerModeRemember) {
-                ReaderMode.VERTICAL_CONTINUE.mode -> {
-                    isContinueMode = true
-                    isVerticalMode = true
-                }
-                ReaderMode.VERTICAL_N_CONTINUE.mode -> {
-                    isContinueMode = false
-                    isVerticalMode = true
-                }
-                ReaderMode.HORIZONTAL_CONTINUE.mode -> {
-                    isContinueMode = true
-                    isVerticalMode = false
-                }
-                ReaderMode.HORIZONTAL_N_CONTINUE.mode -> {
-                    isContinueMode = false
-                    isVerticalMode = false
-                }
-            }
-            //单页模式
-            isDoublePageMode = !readerSinglePageRemember
-            //裁剪模式
-            isCropMode = readerClipRemember
-        }
-        //删除所有注释
-        LaunchedEffect(readerAnnotationDeleteAllRemember) {
-            readerView?.apply {
-                pdfDocument?.annotationDeleteAll(onSuccess = {
-                    launch {
-                        //重新加载阅读界面
-                        if (it) reloadPages()
-                    }
-                })
-            }
-        }
-    }
-}

+ 0 - 35
app/src/main/res/layout/activity_date.xml

@@ -1,35 +0,0 @@
-<?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"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/id_date_activity_tv_date"
-        android:layout_width="match_parent"
-        android:layout_height="50dp"
-        android:gravity="center"
-        android:text="DateUtil"
-        android:textSize="14sp"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/id_date_activity_tv_time"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:gravity="center"
-        android:textSize="14sp"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/id_date_activity_tv_date" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/id_date_activity_tv_content"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="10dp"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/id_date_activity_tv_time" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 254
app/src/main/res/layout/activity_media_sample.xml

@@ -1,254 +0,0 @@
-<?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="match_parent"
-    tools:context=".ui.sample.media.MediaSampleActivity">
-
-
-    <androidx.appcompat.widget.AppCompatButton
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="选择文件夹"
-        app:layout_constraintStart_toStartOf="parent"
-        android:id="@+id/btn_choose_dir"
-        app:layout_constraintTop_toTopOf="parent"
-        />
-
-    <androidx.appcompat.widget.AppCompatButton
-        android:id="@+id/btn_query_from_files"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:text="从FileMedia获取"
-        android:textAllCaps="false"
-        app:layout_constraintEnd_toStartOf="@id/btn_query_from_media_store"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/btn_choose_dir"/>
-
-
-    <androidx.appcompat.widget.AppCompatButton
-        android:id="@+id/btn_query_from_media_store"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:text="从MediaStore获取"
-        android:textAllCaps="false"
-        app:layout_constraintTop_toTopOf="@id/btn_query_from_files"
-        app:layout_constraintStart_toEndOf="@id/btn_query_from_files"
-        app:layout_constraintEnd_toEndOf="parent"
-        />
-
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/id_tv_query_dir"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:text="查询的目录:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/btn_query_from_files" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_dir"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintBaseline_toBaselineOf="@id/id_tv_query_dir"
-        app:layout_constraintStart_toEndOf="@id/info_barrier"
-        tools:text="ME" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/id_tv_query_type_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="获取方式:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/id_tv_query_dir" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_type"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintBaseline_toBaselineOf="@id/id_tv_query_type_title"
-        app:layout_constraintStart_toEndOf="@id/info_barrier"
-        tools:text="MediaStore" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_file_type_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="获取文件格式:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/id_tv_query_type_title" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_file_type"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintBaseline_toBaselineOf="@id/tv_file_type_title"
-        app:layout_constraintStart_toEndOf="@id/info_barrier"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0"
-        app:layout_constrainedWidth="true"
-        tools:text="pdf,png,jpg" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_ignore_child_dir_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="结果是否包含文件夹:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/tv_file_type_title" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_ignore_child_dir"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintBaseline_toBaselineOf="@id/tv_query_ignore_child_dir_title"
-        app:layout_constraintStart_toEndOf="@id/info_barrier"
-        tools:text="true" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_recursively_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="是否遍历子文件夹:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/tv_query_ignore_child_dir_title" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_recursively"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintBaseline_toBaselineOf="@id/tv_query_recursively_title"
-        app:layout_constraintStart_toEndOf="@id/info_barrier"
-        tools:text="true" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_ignore_child_files_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="忽略的文件:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/tv_query_recursively_title" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:layout_constraintBaseline_toBaselineOf="@id/tv_query_ignore_child_files_title"
-        android:text="(可忽略文件夹及文件)"
-        app:layout_constraintStart_toEndOf="@id/tv_query_ignore_child_files_title"
-        />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_query_ignore_child_files"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintTop_toBottomOf="@id/tv_query_ignore_child_files_title"
-        app:layout_constraintStart_toStartOf="parent"
-        tools:text="/" />
-
-    <androidx.constraintlayout.widget.Barrier
-        android:id="@+id/info_barrier"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:barrierDirection="end"
-        app:constraint_referenced_ids="tv_file_type_title,tv_query_recursively_title,tv_query_ignore_child_dir_title,tv_query_ignore_child_files_title,id_tv_query_type_title"/>
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_line"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginVertical="16dp"
-        app:layout_constraintStart_toStartOf="parent"
-        android:text="------------------------------------->"
-        app:layout_constraintTop_toBottomOf="@id/tv_query_ignore_child_files" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:layout_constraintTop_toBottomOf="@id/tv_line"
-        app:layout_constraintStart_toStartOf="parent"
-        android:text="查询结果"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        android:id="@+id/tv_result"
-        />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_result_count_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:text="数量:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/tv_result" />
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_result_count"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintBaseline_toBaselineOf="@id/tv_result_count_title"
-        app:layout_constraintStart_toEndOf="@id/info_barrier"
-        tools:text="120" />
-
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_result_file_types_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
-        android:text="结果文件格式:"
-        android:textColor="@color/black"
-        android:textStyle="bold"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/tv_result_count_title" />
-
-
-
-    <androidx.appcompat.widget.AppCompatTextView
-        android:id="@+id/tv_result_file_types"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0"
-        app:layout_constrainedWidth="true"
-        app:layout_constraintBaseline_toBaselineOf="@id/tv_result_file_types_title"
-        app:layout_constraintStart_toEndOf="@id/info_barrier"
-        tools:text="png jpg" />
-
-
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/recycler_view"
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        app:layout_constraintTop_toBottomOf="@id/tv_result_file_types_title"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-
-        />
-
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 16
app/src/main/res/layout/activity_reader_view.xml

@@ -1,16 +0,0 @@
-<?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"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <com.compdfkit.ui.reader.CPDFReaderView
-        android:id="@+id/id_reader_view"
-        android:layout_width="match_parent"
-        android:layout_height="300dp"
-        android:background="@color/black"
-        android:focusable="true"
-        android:focusableInTouchMode="true"
-        app:layout_constraintTop_toBottomOf="parent" />
-
-</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 3
settings.gradle

@@ -36,10 +36,7 @@ include ':app'
 include ':lib_common'
 include ':lib_ad_core'
 include ':lib_ad_admob'
-//include ':lib_ad_csj'
 include ':lib_ad_gromore'
-include ':lib_pdf_base'
 include ':lib_ad_applovinmax'
-include ':lib_material_tokens'
 include ':lib_ad_gromore_adn'
 include ':lib_ad_custom'