Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
B
Browser White
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
Browser White
Commits
ba9b5a2b
Commit
ba9b5a2b
authored
Aug 12, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
439b1930
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
339 additions
and
29 deletions
+339
-29
build.gradle.kts
app/build.gradle.kts
+7
-0
proguard-rules.pro
app/proguard-rules.pro
+9
-1
WebSiteBean.kt
app/src/main/java/com/base/browserwhite/bean/WebSiteBean.kt
+53
-6
MediaBrowserActivity.kt
...serwhite/ui/activity/mediabrowser/MediaBrowserActivity.kt
+34
-3
WevStoreActivity.kt
...ase/browserwhite/ui/activity/webstore/WevStoreActivity.kt
+27
-5
WebSiteGroupAdapter.kt
...a/com/base/browserwhite/ui/adapter/WebSiteGroupAdapter.kt
+26
-0
WebsiteAdapter.kt
...n/java/com/base/browserwhite/ui/adapter/WebsiteAdapter.kt
+1
-1
HomeFragment.kt
...in/java/com/base/browserwhite/ui/fragment/HomeFragment.kt
+14
-11
AssetUtils.kt
app/src/main/java/com/base/browserwhite/utils/AssetUtils.kt
+31
-0
IntentEx.kt
app/src/main/java/com/base/browserwhite/utils/IntentEx.kt
+45
-2
bg_0571ed_2.xml
app/src/main/res/drawable/bg_0571ed_2.xml
+5
-0
bg_f3f4f6_10.xml
app/src/main/res/drawable/bg_f3f4f6_10.xml
+5
-0
item_website_grid_2.xml
app/src/main/res/layout/item_website_grid_2.xml
+38
-0
item_website_group.xml
app/src/main/res/layout/item_website_group.xml
+44
-0
w_tianjia.png
app/src/main/res/mipmap-xxhdpi/w_tianjia.png
+0
-0
w_xuan.png
app/src/main/res/mipmap-xxhdpi/w_xuan.png
+0
-0
No files found.
app/build.gradle.kts
View file @
ba9b5a2b
...
@@ -63,5 +63,12 @@ dependencies {
...
@@ -63,5 +63,12 @@ dependencies {
implementation
(
"androidx.media3:media3-exoplayer:1.4.0"
)
implementation
(
"androidx.media3:media3-exoplayer:1.4.0"
)
implementation
(
"androidx.media3:media3-ui:1.4.0"
)
implementation
(
"androidx.media3:media3-ui:1.4.0"
)
//网络请求和解析
implementation
(
"com.google.code.gson:gson:2.11.0"
)
// define a BOM and its version
implementation
(
platform
(
"com.squareup.okhttp3:okhttp-bom:4.12.0"
))
// define any required OkHttp artifacts without version
implementation
(
"com.squareup.okhttp3:okhttp"
)
implementation
(
"com.squareup.okhttp3:logging-interceptor"
)
}
}
\ No newline at end of file
app/proguard-rules.pro
View file @
ba9b5a2b
...
@@ -18,4 +18,12 @@
...
@@ -18,4 +18,12 @@
# If you keep the line number information, uncomment this to
# If you keep the line number information, uncomment this to
# hide the original source file name.
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile
\ No newline at end of file
-
keep
class
com
.
google
.
gson
.
reflect
.
**
{
*
;
}
-
keep
class
com
.
google
.
gson
.
stream
.
**
{
*
;
}
-
keepattributes
*
Annotation
*
-
keep
class
*
extends
com
.
google
.
gson
.
TypeAdapter
-
keep
class
*
extends
com
.
google
.
gson
.
JsonSerializer
-
keep
class
*
extends
com
.
google
.
gson
.
Deserializer
-
keep
class
com
.
google
.
gson
.
TypeAdapters
{
*
;}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/bean/WebSiteBean.kt
View file @
ba9b5a2b
package
com.base.browserwhite.bean
package
com.base.browserwhite.bean
import
android.graphics.drawable.Drawable
import
com.google.gson.Gson
import
android.net.Uri
import
com.google.gson.reflect.TypeToken
import
org.json.JSONObject
import
java.lang.reflect.Type
class
WebSiteBean
(
data class
WebCategoryBean
(
val
id
:
Int
,
val
name
:
String
,
val
iconUrl
:
String
,
)
data class
WebSiteGroupBean
(
val
category_id
:
Int
=
0
,
val
category_name
:
String
=
""
,
val
items
:
List
<
WebSiteBean
>
=
listOf
()
)
data class
WebSiteBean
(
val
id
:
Int
=
0
,
val
icon_url
:
String
=
""
,
val
url
:
String
=
""
,
val
name
:
String
=
""
,
val
name
:
String
=
""
,
val
icon
:
Int
=
0
,
val
desc
:
String
=
""
,
val
iconUri
:
Uri
=
Uri
.
EMPTY
)
{
)
{
var
localIcon
:
Int
=
0
var
increase
=
false
var
increase
=
false
}
}
\ No newline at end of file
fun
webCategoryBeanList
(
json
:
String
):
ArrayList
<
WebCategoryBean
>
{
val
jsonObject
=
JSONObject
(
json
)
val
dataJsonObject
=
jsonObject
.
getJSONObject
(
"data"
)
val
categoryList
=
dataJsonObject
.
getJSONArray
(
"category_list"
)
val
list
=
arrayListOf
<
WebCategoryBean
>()
for
(
i
in
0
until
categoryList
.
length
())
{
val
webSiteBeanJsonObject
=
categoryList
.
getJSONObject
(
i
)
val
id
=
webSiteBeanJsonObject
.
getInt
(
"id"
)
val
name
=
webSiteBeanJsonObject
.
getString
(
"name"
)
val
iconUrl
=
webSiteBeanJsonObject
.
getString
(
"icon_url"
)
list
.
add
(
WebCategoryBean
(
id
,
name
,
iconUrl
))
}
return
list
}
fun
webSiteGroupBeanList
(
json
:
String
):
List
<
WebSiteGroupBean
>
{
val
jsonObject
=
JSONObject
(
json
)
val
dataJsonObject
=
jsonObject
.
getJSONObject
(
"data"
)
val
groupsList
=
dataJsonObject
.
getJSONArray
(
"groups"
)
val
webSiteGroupBeanType
:
Type
=
object
:
TypeToken
<
List
<
WebSiteGroupBean
>>()
{}.
type
return
Gson
().
fromJson
(
groupsList
.
toString
(),
webSiteGroupBeanType
)
}
app/src/main/java/com/base/browserwhite/ui/activity/mediabrowser/MediaBrowserActivity.kt
View file @
ba9b5a2b
...
@@ -2,6 +2,8 @@ package com.base.browserwhite.ui.activity.mediabrowser
...
@@ -2,6 +2,8 @@ package com.base.browserwhite.ui.activity.mediabrowser
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
android.provider.Settings
import
androidx.activity.addCallback
import
androidx.activity.addCallback
import
androidx.core.view.updatePadding
import
androidx.core.view.updatePadding
import
androidx.lifecycle.lifecycleScope
import
androidx.lifecycle.lifecycleScope
...
@@ -14,6 +16,9 @@ import com.base.browserwhite.ui.activity.BaseActivity
...
@@ -14,6 +16,9 @@ import com.base.browserwhite.ui.activity.BaseActivity
import
com.base.browserwhite.ui.adapter.MediaAdapter
import
com.base.browserwhite.ui.adapter.MediaAdapter
import
com.base.browserwhite.ui.fragment.FileFragment
import
com.base.browserwhite.ui.fragment.FileFragment
import
com.base.browserwhite.utils.BarUtils
import
com.base.browserwhite.utils.BarUtils
import
com.base.browserwhite.utils.IntentEx.installAokAction
import
com.base.browserwhite.utils.IntentEx.viewAudioAction
import
com.base.browserwhite.utils.IntentEx.viewDocumentAction
import
com.base.browserwhite.utils.LogEx
import
com.base.browserwhite.utils.LogEx
import
com.base.browserwhite.utils.MediaStoreUtils.getMediaAudio
import
com.base.browserwhite.utils.MediaStoreUtils.getMediaAudio
import
com.base.browserwhite.utils.MediaStoreUtils.getMediaFile
import
com.base.browserwhite.utils.MediaStoreUtils.getMediaFile
...
@@ -71,9 +76,35 @@ class MediaBrowserActivity : BaseActivity<ActivityMediaBrowserBinding>() {
...
@@ -71,9 +76,35 @@ class MediaBrowserActivity : BaseActivity<ActivityMediaBrowserBinding>() {
}
}
"Document"
,
"APK"
,
"Music"
,
"Zip"
->
{
"Document"
,
"APK"
,
"Music"
,
"Zip"
->
{
adapter
=
MediaAdapter
(
2
,
moreAction
=
{
view
,
bean
->
adapter
=
MediaAdapter
(
2
,
FileFragment
.
moreAction
(
this
,
view
,
bean
,
adapter
)
clickAction
=
{
bean
->
})
if
(
tittle
==
"Document"
)
{
this
.
viewDocumentAction
(
bean
.
uri
,
bean
.
mimeType
)
}
if
(
tittle
==
"APK"
)
{
try
{
this
.
installAokAction
(
bean
.
uri
)
}
catch
(
e
:
Exception
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
val
intent
=
Intent
(
Settings
.
ACTION_MANAGE_UNKNOWN_APP_SOURCES
)
launcher
.
launch
(
intent
)
{
runCatching
{
this
.
installAokAction
(
bean
.
uri
)
}
}
}
}
}
if
(
tittle
==
"Zip"
)
{
}
if
(
tittle
==
"Music"
)
{
this
.
viewAudioAction
(
bean
.
uri
,
bean
.
mimeType
)
}
},
moreAction
=
{
view
,
bean
->
FileFragment
.
moreAction
(
this
,
view
,
bean
,
adapter
)
})
binding
.
rv
.
layoutManager
=
LinearLayoutManager
(
this
)
binding
.
rv
.
layoutManager
=
LinearLayoutManager
(
this
)
}
}
}
}
...
...
app/src/main/java/com/base/browserwhite/ui/activity/webstore/WevStoreActivity.kt
View file @
ba9b5a2b
...
@@ -3,17 +3,26 @@ package com.base.browserwhite.ui.activity.webstore
...
@@ -3,17 +3,26 @@ package com.base.browserwhite.ui.activity.webstore
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.graphics.Color
import
android.graphics.Color
import
androidx.core.view.updatePadding
import
androidx.core.view.updatePadding
import
androidx.lifecycle.lifecycleScope
import
com.base.browserwhite.bean.WebCategoryBean
import
com.base.browserwhite.bean.WebSiteGroupBean
import
com.base.browserwhite.bean.webCategoryBeanList
import
com.base.browserwhite.bean.webSiteGroupBeanList
import
com.base.browserwhite.databinding.ActivityWevStoreBinding
import
com.base.browserwhite.databinding.ActivityWevStoreBinding
import
com.base.browserwhite.databinding.ItemTabWebstoreBinding
import
com.base.browserwhite.databinding.ItemTabWebstoreBinding
import
com.base.browserwhite.ui.activity.BaseActivity
import
com.base.browserwhite.ui.activity.BaseActivity
import
com.base.browserwhite.utils.AssetUtils.readJsonFromAsset
import
com.base.browserwhite.utils.BarUtils
import
com.base.browserwhite.utils.BarUtils
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
class
WevStoreActivity
:
BaseActivity
<
ActivityWevStoreBinding
>()
{
class
WevStoreActivity
:
BaseActivity
<
ActivityWevStoreBinding
>()
{
override
val
binding
:
ActivityWevStoreBinding
by
lazy
{
override
val
binding
:
ActivityWevStoreBinding
by
lazy
{
ActivityWevStoreBinding
.
inflate
(
layoutInflater
)
ActivityWevStoreBinding
.
inflate
(
layoutInflater
)
}
}
private
val
webCategoryBean
:
ArrayList
<
WebCategoryBean
>
=
arrayListOf
()
private
val
webSiteGroupBean
:
ArrayList
<
WebSiteGroupBean
>
=
arrayListOf
()
@SuppressLint
(
"SetTextI18n"
)
@SuppressLint
(
"SetTextI18n"
)
override
fun
initView
()
{
override
fun
initView
()
{
...
@@ -21,11 +30,24 @@ class WevStoreActivity : BaseActivity<ActivityWevStoreBinding>() {
...
@@ -21,11 +30,24 @@ class WevStoreActivity : BaseActivity<ActivityWevStoreBinding>() {
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
repeat
(
5
)
{
initData
()
val
itemTab
=
ItemTabWebstoreBinding
.
inflate
(
layoutInflater
)
}
itemTab
.
tv
.
text
=
"Socialize"
binding
.
tabLayout
.
addView
(
itemTab
.
root
)
private
fun
initData
()
=
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
json
=
readJsonFromAsset
(
"navigateWebsiteCfg.json"
)
val
beanList
=
webCategoryBeanList
(
json
)
webCategoryBean
.
addAll
(
beanList
)
val
list
=
webSiteGroupBeanList
(
json
)
webSiteGroupBean
.
addAll
(
list
)
launch
(
Dispatchers
.
Main
)
{
webCategoryBean
.
forEach
{
bean
->
val
tabBinding
=
ItemTabWebstoreBinding
.
inflate
(
layoutInflater
)
tabBinding
.
tv
.
text
=
bean
.
name
binding
.
tabLayout
.
addView
(
tabBinding
.
root
)
}
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/adapter/WebSiteGroupAdapter.kt
0 → 100644
View file @
ba9b5a2b
package
com.base.browserwhite.ui.adapter
import
android.view.View
import
android.view.ViewGroup
import
androidx.recyclerview.widget.RecyclerView
import
androidx.recyclerview.widget.RecyclerView.ViewHolder
import
com.base.browserwhite.bean.WebSiteGroupBean
class
WebSiteGroupAdapter
:
RecyclerView
.
Adapter
<
WebSiteGroupAdapter
.
GroupViewHolder
>()
{
val
beanList
=
arrayListOf
<
WebSiteGroupBean
>()
inner
class
GroupViewHolder
(
view
:
View
)
:
ViewHolder
(
view
)
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
GroupViewHolder
{
TODO
(
"Not yet implemented"
)
}
override
fun
getItemCount
():
Int
{
return
beanList
.
size
}
override
fun
onBindViewHolder
(
holder
:
GroupViewHolder
,
position
:
Int
)
{
TODO
(
"Not yet implemented"
)
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/adapter/WebsiteAdapter.kt
View file @
ba9b5a2b
...
@@ -32,7 +32,7 @@ class WebsiteAdapter(val click: (bean: WebSiteBean) -> Unit) : RecyclerView.Adap
...
@@ -32,7 +32,7 @@ class WebsiteAdapter(val click: (bean: WebSiteBean) -> Unit) : RecyclerView.Adap
override
fun
onBindViewHolder
(
holder
:
WebSiteViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
WebSiteViewHolder
,
position
:
Int
)
{
val
binding
=
ItemWebsiteGridBinding
.
bind
(
holder
.
itemView
)
val
binding
=
ItemWebsiteGridBinding
.
bind
(
holder
.
itemView
)
val
bean
=
beanList
[
position
]
val
bean
=
beanList
[
position
]
binding
.
ivIcon
.
setImageResource
(
bean
.
i
con
)
binding
.
ivIcon
.
setImageResource
(
bean
.
localI
con
)
binding
.
tvName
.
text
=
bean
.
name
binding
.
tvName
.
text
=
bean
.
name
holder
.
canDrag
=
!
bean
.
increase
holder
.
canDrag
=
!
bean
.
increase
binding
.
root
.
setOnClickListener
{
binding
.
root
.
setOnClickListener
{
...
...
app/src/main/java/com/base/browserwhite/ui/fragment/HomeFragment.kt
View file @
ba9b5a2b
...
@@ -48,17 +48,20 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
...
@@ -48,17 +48,20 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
val
recommendWebSite
=
listOf
(
val
recommendWebSite
=
listOf
(
WebSiteBean
(
"Amazon"
,
R
.
mipmap
.
amazon
),
WebSiteBean
(
name
=
"Amazon"
).
apply
{
localIcon
=
R
.
mipmap
.
amazon
},
WebSiteBean
(
"Youtube"
,
R
.
mipmap
.
youtube
),
WebSiteBean
(
name
=
"Youtube"
).
apply
{
localIcon
=
R
.
mipmap
.
youtube
},
WebSiteBean
(
"ChatGPT"
,
R
.
mipmap
.
chatgpt
),
WebSiteBean
(
name
=
"ChatGPT"
).
apply
{
localIcon
=
R
.
mipmap
.
chatgpt
},
WebSiteBean
(
"Bing"
,
R
.
mipmap
.
bing
),
WebSiteBean
(
name
=
"Bing"
).
apply
{
localIcon
=
R
.
mipmap
.
bing
},
WebSiteBean
(
"Twitter"
,
R
.
mipmap
.
twitter
),
WebSiteBean
(
name
=
"Twitter"
).
apply
{
localIcon
=
R
.
mipmap
.
twitter
},
WebSiteBean
(
"Wikipedia"
,
R
.
mipmap
.
wikipedia
),
WebSiteBean
(
name
=
"Wikipedia"
).
apply
{
localIcon
=
R
.
mipmap
.
wikipedia
},
WebSiteBean
(
"Facebook"
,
R
.
mipmap
.
facebook
),
WebSiteBean
(
name
=
"Facebook"
).
apply
{
localIcon
=
R
.
mipmap
.
facebook
},
WebSiteBean
(
"Ebay"
,
R
.
mipmap
.
ebay
),
WebSiteBean
(
name
=
"Ebay"
).
apply
{
localIcon
=
R
.
mipmap
.
ebay
},
WebSiteBean
(
"Tiktok"
,
R
.
mipmap
.
tiktok
),
WebSiteBean
(
name
=
"Tiktok"
).
apply
{
localIcon
=
R
.
mipmap
.
tiktok
},
WebSiteBean
(
"Whatsapp"
,
R
.
mipmap
.
whatsapp
),
WebSiteBean
(
name
=
"Whatsapp"
).
apply
{
localIcon
=
R
.
mipmap
.
whatsapp
},
WebSiteBean
(
"Increase"
,
R
.
mipmap
.
increase
).
apply
{
increase
=
true
},
WebSiteBean
(
name
=
"Increase"
).
apply
{
localIcon
=
R
.
mipmap
.
increase
increase
=
true
},
)
)
websiteAdapter
.
setData
(
recommendWebSite
)
websiteAdapter
.
setData
(
recommendWebSite
)
}
}
...
...
app/src/main/java/com/base/browserwhite/utils/AssetUtils.kt
0 → 100644
View file @
ba9b5a2b
package
com.base.browserwhite.utils
import
android.content.Context
import
java.io.BufferedReader
import
java.io.IOException
import
java.io.InputStreamReader
object
AssetUtils
{
fun
Context
.
readJsonFromAsset
(
fileName
:
String
):
String
{
var
json
=
""
try
{
val
assetManager
=
this
.
assets
val
inputStream
=
assetManager
.
open
(
fileName
)
val
reader
=
BufferedReader
(
InputStreamReader
(
inputStream
))
var
line
:
String
?
val
jsonString
=
StringBuilder
()
while
(
reader
.
readLine
().
also
{
line
=
it
}
!=
null
)
{
jsonString
.
append
(
line
)
}
reader
.
close
()
inputStream
.
close
()
json
=
jsonString
.
toString
()
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
}
return
json
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/utils/IntentEx.kt
View file @
ba9b5a2b
...
@@ -6,14 +6,14 @@ import android.content.Intent
...
@@ -6,14 +6,14 @@ import android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.widget.Toast
import
android.widget.Toast
@SuppressLint
(
"QueryPermissionsNeeded"
)
object
IntentEx
{
object
IntentEx
{
@SuppressLint
(
"QueryPermissionsNeeded"
)
fun
Context
.
shareAction
(
uri
:
Uri
,
mimeType
:
String
)
{
fun
Context
.
shareAction
(
uri
:
Uri
,
mimeType
:
String
)
{
val
shareIntent
=
Intent
().
apply
{
val
shareIntent
=
Intent
().
apply
{
action
=
Intent
.
ACTION_SEND
action
=
Intent
.
ACTION_SEND
type
=
mimeType
type
=
mimeType
putExtra
(
Intent
.
EXTRA_STREAM
,
uri
)
putExtra
(
Intent
.
EXTRA_STREAM
,
uri
)
flags
=
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
flags
=
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
// 可以添加更多额外信息,如主题、文本等
// 可以添加更多额外信息,如主题、文本等
}
}
...
@@ -24,4 +24,47 @@ object IntentEx {
...
@@ -24,4 +24,47 @@ object IntentEx {
Toast
.
makeText
(
this
,
"no app can share the file"
,
Toast
.
LENGTH_SHORT
).
show
()
Toast
.
makeText
(
this
,
"no app can share the file"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
}
fun
Context
.
viewDocumentAction
(
uri
:
Uri
,
mimeType
:
String
)
{
val
viewIntent
=
Intent
().
apply
{
action
=
Intent
.
ACTION_VIEW
setDataAndType
(
uri
,
mimeType
)
flags
=
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
// 可以添加更多额外信息,如主题、文本等
}
val
chooserIntent
=
Intent
.
createChooser
(
viewIntent
,
"Share File"
)
if
(
chooserIntent
.
resolveActivity
(
this
.
packageManager
)
!=
null
)
{
this
.
startActivity
(
viewIntent
)
}
else
{
Toast
.
makeText
(
this
,
"no app can open the file"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
fun
Context
.
viewAudioAction
(
uri
:
Uri
,
mimeType
:
String
)
{
// 构建一个Intent,使用ACTION_VIEW操作
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
)
intent
.
setDataAndType
(
uri
,
mimeType
)
// 设置标志,以便Intent可以选择其他应用来完成这个操作
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
intent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
// 尝试启动Intent
if
(
intent
.
resolveActivity
(
packageManager
)
!=
null
)
{
startActivity
(
intent
)
}
else
{
// 如果没有应用可以处理这个Intent,可以在这里处理错误
// 例如,显示一个Toast消息
Toast
.
makeText
(
this
,
"no app can play the audio"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
fun
Context
.
installAokAction
(
uri
:
Uri
)
{
val
installIntent
=
Intent
(
Intent
.
ACTION_VIEW
)
installIntent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
)
installIntent
.
setDataAndType
(
uri
,
"application/vnd.android.package-archive"
)
installIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
startActivity
(
installIntent
)
}
}
}
\ No newline at end of file
app/src/main/res/drawable/bg_0571ed_2.xml
0 → 100644
View file @
ba9b5a2b
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#0571ED"
/>
<corners
android:radius=
"2dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/bg_f3f4f6_10.xml
0 → 100644
View file @
ba9b5a2b
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#F3F4F6"
/>
<corners
android:radius=
"10dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/item_website_grid_2.xml
0 → 100644
View file @
ba9b5a2b
<?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=
"45dp"
android:layout_marginHorizontal=
"6dp"
android:layout_marginVertical=
"5dp"
android:background=
"@drawable/bg_f3f4f6_10"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"10dp"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"8dp"
android:layout_weight=
"1"
android:text=
"Reddit"
android:textSize=
"17sp"
tools:ignore=
"HardcodedText"
/>
<ImageView
android:id=
"@+id/iv_select_add"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"15dp"
tools:ignore=
"ContentDescription"
tools:src=
"@mipmap/w_tianjia"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/item_website_group.xml
0 → 100644
View file @
ba9b5a2b
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:layout_marginVertical=
"12dp"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:orientation=
"horizontal"
>
<View
android:layout_width=
"4dp"
android:layout_height=
"15dp"
android:layout_gravity=
"center_vertical"
android:background=
"@drawable/bg_0571ed_16"
/>
<TextView
android:id=
"@+id/tv_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"6dp"
android:textColor=
"@color/black"
android:textSize=
"17sp"
android:textStyle=
"bold"
tools:text=
"Socialize"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_group"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"10dp"
android:layout_marginTop=
"10dp"
app:layoutManager=
"androidx.recyclerview.widget.GridLayoutManager"
app:spanCount=
"2"
tools:listitem=
"@layout/item_website_grid_2"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/mipmap-xxhdpi/w_tianjia.png
0 → 100644
View file @
ba9b5a2b
526 Bytes
app/src/main/res/mipmap-xxhdpi/w_xuan.png
0 → 100644
View file @
ba9b5a2b
1.36 KB
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