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
9c9733aa
Commit
9c9733aa
authored
Aug 15, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
522d11b2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
33 deletions
+67
-33
build.gradle.kts
app/build.gradle.kts
+4
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-0
MainActivity.kt
...in/java/com/base/browserwhite/ui/activity/MainActivity.kt
+35
-0
FileFragment.kt
...in/java/com/base/browserwhite/ui/fragment/FileFragment.kt
+2
-27
HomeFragment.kt
...in/java/com/base/browserwhite/ui/fragment/HomeFragment.kt
+20
-5
ConfigHelper.kt
...src/main/java/com/base/browserwhite/utils/ConfigHelper.kt
+1
-1
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/build.gradle.kts
View file @
9c9733aa
...
@@ -74,4 +74,8 @@ dependencies {
...
@@ -74,4 +74,8 @@ dependencies {
implementation
(
"com.squareup.okhttp3:okhttp"
)
implementation
(
"com.squareup.okhttp3:okhttp"
)
implementation
(
"com.squareup.okhttp3:logging-interceptor"
)
implementation
(
"com.squareup.okhttp3:logging-interceptor"
)
//facebook
implementation
(
"com.facebook.android:facebook-android-sdk:[8,9)"
)
}
}
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
9c9733aa
...
@@ -112,6 +112,10 @@
...
@@ -112,6 +112,10 @@
<service
<service
android:name=
".service.StayNotificationService"
android:name=
".service.StayNotificationService"
android:foregroundServiceType=
"dataSync"
/>
android:foregroundServiceType=
"dataSync"
/>
<meta-data
android:name=
"com.facebook.sdk.ApplicationId"
android:value=
"@string/facebook_app_id"
/>
</application>
</application>
</manifest>
</manifest>
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/activity/MainActivity.kt
View file @
9c9733aa
package
com.base.browserwhite.ui.activity
package
com.base.browserwhite.ui.activity
import
android.annotation.SuppressLint
import
android.app.usage.StorageStatsManager
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Build
import
android.os.Environment
import
android.os.StatFs
import
android.os.storage.StorageManager
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.view.isEmpty
import
androidx.core.view.isEmpty
import
androidx.core.view.updatePadding
import
androidx.core.view.updatePadding
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
...
@@ -10,6 +17,8 @@ import com.base.browserwhite.ui.fragment.FileFragment
...
@@ -10,6 +17,8 @@ import com.base.browserwhite.ui.fragment.FileFragment
import
com.base.browserwhite.ui.fragment.HomeFragment
import
com.base.browserwhite.ui.fragment.HomeFragment
import
com.base.browserwhite.ui.views.DialogViews.showMyAccountDialog
import
com.base.browserwhite.ui.views.DialogViews.showMyAccountDialog
import
com.base.browserwhite.utils.BarUtils
import
com.base.browserwhite.utils.BarUtils
import
com.base.browserwhite.utils.KotlinExt.toFormatSize
import
java.io.File
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
>()
{
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
>()
{
...
@@ -23,6 +32,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
...
@@ -23,6 +32,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
override
val
binding
:
ActivityMainBinding
by
lazy
{
override
val
binding
:
ActivityMainBinding
by
lazy
{
ActivityMainBinding
.
inflate
(
layoutInflater
)
ActivityMainBinding
.
inflate
(
layoutInflater
)
}
}
var
usedBytes
:
Long
=
0
var
totalBytes
:
Long
=
0
override
fun
initView
()
{
override
fun
initView
()
{
...
@@ -71,5 +82,29 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
...
@@ -71,5 +82,29 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding
.
llFile
.
isSelected
=
false
binding
.
llFile
.
isSelected
=
false
}
}
override
fun
onResume
()
{
super
.
onResume
()
showStorage
()
}
private
fun
showStorage
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
)
{
val
storageStatsManager
=
getSystemService
(
AppCompatActivity
.
STORAGE_STATS_SERVICE
)
as
StorageStatsManager
Thread
{
totalBytes
=
storageStatsManager
.
getTotalBytes
(
StorageManager
.
UUID_DEFAULT
)
usedBytes
=
totalBytes
-
storageStatsManager
.
getFreeBytes
(
StorageManager
.
UUID_DEFAULT
)
}.
start
()
}
else
{
val
path1
:
File
=
Environment
.
getDataDirectory
()
val
stat1
=
StatFs
(
path1
.
path
)
val
path2
:
File
=
Environment
.
getExternalStorageDirectory
()
val
stat2
=
StatFs
(
path2
.
path
)
totalBytes
=
(
stat1
.
totalBytes
+
stat2
.
totalBytes
)
usedBytes
=
((
stat1
.
totalBytes
+
stat2
.
totalBytes
)
-
(
stat1
.
availableBytes
+
stat2
.
availableBytes
))
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/fragment/FileFragment.kt
View file @
9c9733aa
...
@@ -49,7 +49,8 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
...
@@ -49,7 +49,8 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
@SuppressLint
(
"QueryPermissionsNeeded"
)
@SuppressLint
(
"QueryPermissionsNeeded"
)
override
fun
setView
()
{
override
fun
setView
()
{
showStorage
()
binding
.
tvUsedStorage
.
text
=
(
requireActivity
()
as
MainActivity
).
usedBytes
.
toFormatSize
()
binding
.
tvTotalStorage
.
text
=
" / ${(requireActivity() as MainActivity).totalBytes.toFormatSize()}"
adapter
=
MediaAdapter
(
0
,
adapter
=
MediaAdapter
(
0
,
clickAction
=
{
clickAction
=
{
...
@@ -129,32 +130,6 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
...
@@ -129,32 +130,6 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
}
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
showStorage
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
)
{
val
storageStatsManager
=
requireContext
().
getSystemService
(
AppCompatActivity
.
STORAGE_STATS_SERVICE
)
as
StorageStatsManager
Thread
{
val
totalBytes
=
storageStatsManager
.
getTotalBytes
(
StorageManager
.
UUID_DEFAULT
)
val
usedBytes
=
totalBytes
-
storageStatsManager
.
getFreeBytes
(
StorageManager
.
UUID_DEFAULT
)
binding
.
root
.
post
{
binding
.
tvUsedStorage
.
text
=
usedBytes
.
toFormatSize
()
binding
.
tvTotalStorage
.
text
=
" / "
+
totalBytes
.
toFormatSize
()
}
}.
start
()
}
else
{
val
path1
:
File
=
Environment
.
getDataDirectory
()
val
stat1
=
StatFs
(
path1
.
path
)
val
path2
:
File
=
Environment
.
getExternalStorageDirectory
()
val
stat2
=
StatFs
(
path2
.
path
)
val
totalSize
=
(
stat1
.
totalBytes
+
stat2
.
totalBytes
).
toFormatSize
()
val
usedSize
=
((
stat1
.
totalBytes
+
stat2
.
totalBytes
)
-
(
stat1
.
availableBytes
+
stat2
.
availableBytes
)).
toFormatSize
()
binding
.
tvUsedStorage
.
text
=
usedSize
binding
.
tvTotalStorage
.
text
=
" / $totalSize"
}
}
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
...
...
app/src/main/java/com/base/browserwhite/ui/fragment/HomeFragment.kt
View file @
9c9733aa
...
@@ -101,6 +101,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
...
@@ -101,6 +101,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
setWebSiteData
()
setWebSiteData
()
binding
.
editWeb
.
setText
(
""
)
}
}
private
fun
setWebSiteData
()
{
private
fun
setWebSiteData
()
{
...
@@ -154,11 +155,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
...
@@ -154,11 +155,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
override
fun
onEditorAction
(
v
:
TextView
?,
actionId
:
Int
,
event
:
KeyEvent
?):
Boolean
{
override
fun
onEditorAction
(
v
:
TextView
?,
actionId
:
Int
,
event
:
KeyEvent
?):
Boolean
{
if
(
actionId
==
IME_ACTION_DONE
)
{
if
(
actionId
==
IME_ACTION_DONE
)
{
requireActivity
().
startActivity
(
Intent
(
requireContext
(),
WebBrowserActivity
::
class
.
java
).
apply
{
requireActivity
().
startActivity
(
Intent
(
requireContext
(),
WebBrowserActivity
::
class
.
java
).
apply
{
putExtra
(
"uri"
,
getGoogleSearch
(
v
.
toString
()))
val
base
=
"https://www.google.com/"
val
content
=
v
?.
text
val
search
=
"search?q=${content}&oq=${content}"
putExtra
(
"uri"
,
"$base$search"
)
})
})
return
true
;
// 返回true表示事件已处理
return
true
;
// 返回true表示事件已处理
}
}
...
@@ -174,4 +171,22 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
...
@@ -174,4 +171,22 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
}
}
companion
object
{
fun
getGoogleSearch
(
content
:
String
):
String
{
val
base
=
"https://www.google.com/"
val
search
=
"search?q=${content}&oq=${content}"
return
"$base$search"
}
fun
getBingSearch
(
content
:
String
):
String
{
//https://cn.bing.com/search?q=aaa&form=QBLHCN&sp=-1&lq=0&pq=aaa&sc=10-3&qs=n&sk=&cvid=CBA1E2A2A9124EBB9C9970DC69330095&ghsh=0&ghacc=0&ghpl=
val
base
=
"https://cn.bing.com/"
val
search
=
"search?q=${content}&form=QBLHCN&sp=-1&lq=0&pq=${content}"
return
"$base$search"
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/utils/ConfigHelper.kt
View file @
9c9733aa
...
@@ -4,7 +4,7 @@ package com.base.browserwhite.utils
...
@@ -4,7 +4,7 @@ package com.base.browserwhite.utils
object
ConfigHelper
{
object
ConfigHelper
{
const
val
privacyPolicy
=
"https://sites.google.com/view/
dumpsterphoto-recovery/home
"
const
val
privacyPolicy
=
"https://sites.google.com/view/
aibrowserprivacy/ai-browser-privacy
"
// 域名
// 域名
const
val
eventUrl
=
"https://rp.rocioxyn.xyz"
const
val
eventUrl
=
"https://rp.rocioxyn.xyz"
...
...
app/src/main/res/values/strings.xml
View file @
9c9733aa
<resources>
<resources>
<string
name=
"app_name"
>
AI Browser
&
Privacy
</string>
<string
name=
"app_name"
>
AI Browser
&
Privacy
</string>
<string
name=
"facebook_app_id"
>
421266364258459
</string>
<!-- TODO: Remove or change this placeholder text -->
<!-- TODO: Remove or change this placeholder text -->
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
</resources>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment