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
385826ea
Commit
385826ea
authored
Aug 28, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
7d66088f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
184 additions
and
63 deletions
+184
-63
WeatherBean.kt
app/src/main/java/com/base/browserwhite/bean/WeatherBean.kt
+14
-0
WeatherUtils.kt
app/src/main/java/com/base/browserwhite/help/WeatherUtils.kt
+75
-0
MainActivity.kt
...in/java/com/base/browserwhite/ui/activity/MainActivity.kt
+1
-6
Splash2Activity.kt
...m/base/browserwhite/ui/activity/splash/Splash2Activity.kt
+13
-0
bg_stroke_ffffff_30.xml
app/src/main/res/drawable/bg_stroke_ffffff_30.xml
+11
-0
shape_splash_s.xml
app/src/main/res/drawable/shape_splash_s.xml
+4
-4
activity_splash_2.xml
app/src/main/res/layout/activity_splash_2.xml
+66
-53
duoyun_splash.png
app/src/main/res/mipmap-xxhdpi/duoyun_splash.png
+0
-0
No files found.
app/src/main/java/com/base/browserwhite/bean/WeatherBean.kt
0 → 100644
View file @
385826ea
package
com.base.browserwhite.bean
data class
WeatherCityBean
(
val
city
:
String
,
val
list
:
List
<
WeatherBean
>
)
data class
WeatherBean
(
val
fxDate
:
String
,
val
tempMin
:
String
,
val
tempMax
:
String
,
val
textDay
:
String
,
val
textNight
:
String
)
\ No newline at end of file
app/src/main/java/com/base/browserwhite/help/WeatherUtils.kt
0 → 100644
View file @
385826ea
package
com.base.browserwhite.help
import
android.annotation.SuppressLint
import
com.base.browserwhite.BuildConfig
import
com.base.browserwhite.bean.WeatherBean
import
com.base.browserwhite.bean.WeatherCityBean
import
com.base.browserwhite.utils.LogEx
import
com.google.gson.Gson
import
com.google.gson.JsonParser
import
com.google.gson.reflect.TypeToken
import
okhttp3.OkHttpClient
import
okhttp3.Request
import
okhttp3.logging.HttpLoggingInterceptor
import
java.lang.reflect.Type
import
java.text.SimpleDateFormat
import
java.util.concurrent.TimeUnit
@SuppressLint
(
"SimpleDateFormat"
)
object
WeatherUtils
{
private
const
val
TAG
=
"WeatherUtils"
private
val
url
by
lazy
{
val
pkg
=
ConfigHelper
.
packageName
val
pkgSubString
=
pkg
.
filter
{
it
.
isLowerCase
()
}.
substring
(
4
,
9
)
val
url
=
StringBuilder
(
"${ConfigHelper.apiUrl}/city/${pkgSubString}tq"
)
// url.append("?pkg=$pkg")
url
.
append
(
"?data=${SimpleDateFormat("
yyyyMMMdd
").format(System.currentTimeMillis())}"
)
url
.
toString
()
}
fun
getWeather
():
WeatherCityBean
?
{
val
client
=
OkHttpClient
.
Builder
()
.
apply
{
if
(
BuildConfig
.
DEBUG
)
{
addInterceptor
(
HttpLoggingInterceptor
().
apply
{
level
=
HttpLoggingInterceptor
.
Level
.
BODY
})
}
connectTimeout
(
10
,
TimeUnit
.
SECONDS
)
readTimeout
(
20
,
TimeUnit
.
SECONDS
)
writeTimeout
(
15
,
TimeUnit
.
SECONDS
)
}.
build
()
LogEx
.
logDebug
(
TAG
,
"url=$url"
)
val
request
=
Request
.
Builder
()
.
url
(
url
)
.
build
()
val
response
=
client
.
newCall
(
request
).
execute
()
response
.
body
?.
string
()
?.
let
{
LogEx
.
logDebug
(
TAG
,
it
)
val
dataJson
=
getDataJson
(
it
)
LogEx
.
logDebug
(
TAG
,
"dataJson=$dataJson"
)
return
parseWeather
(
dataJson
)
}
return
null
}
private
fun
parseWeather
(
dataJson
:
String
):
WeatherCityBean
?
{
return
try
{
Gson
().
fromJson
(
dataJson
,
WeatherCityBean
::
class
.
java
)
}
catch
(
e
:
Exception
)
{
LogEx
.
logDebug
(
TAG
,
"$e"
)
null
}
}
private
fun
getDataJson
(
jsonString
:
String
):
String
{
val
jsonRootObject
=
JsonParser
.
parseString
(
jsonString
).
getAsJsonObject
()
return
jsonRootObject
[
"result"
].
getAsJsonObject
()[
"data"
].
toString
()
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/activity/MainActivity.kt
View file @
385826ea
...
...
@@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment
import
androidx.viewpager2.adapter.FragmentStateAdapter
import
androidx.viewpager2.widget.ViewPager2
import
com.base.browserwhite.databinding.ActivityMainBinding
import
com.base.browserwhite.help.WeatherUtils
import
com.base.browserwhite.ui.activity.scanqrc.QRImageAnalyzer
import
com.base.browserwhite.ui.activity.scanqrc.ScanQRCActivity
import
com.base.browserwhite.ui.fragment.FileFragment
...
...
@@ -67,12 +68,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}
})
// val qq = QRImageAnalyzer()
// qq.action = { qrCodeValue ->
//
// }
// val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, Uri.EMPTY)
// qq.processImage(this, bitmap)
}
...
...
app/src/main/java/com/base/browserwhite/ui/activity/splash/Splash2Activity.kt
View file @
385826ea
...
...
@@ -14,6 +14,7 @@ import com.base.browserwhite.bean.ConstObject.ifAgreePrivacy
import
com.base.browserwhite.databinding.ActivitySplash2Binding
import
com.base.browserwhite.fcm.NotificationUtil
import
com.base.browserwhite.help.EventUtils
import
com.base.browserwhite.help.WeatherUtils
import
com.base.browserwhite.service.StayNotificationService.Companion.startStayNotification
import
com.base.browserwhite.ui.activity.BaseActivity
import
com.base.browserwhite.utils.BarUtils
...
...
@@ -47,6 +48,7 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
private
var
mTaskManager
:
TaskManager
?
=
null
var
jumpType
=
0
@SuppressLint
(
"SetTextI18n"
)
override
fun
initView
()
{
initStatusBar
()
if
(
isDestroyed
)
{
...
...
@@ -63,6 +65,17 @@ class Splash2Activity : BaseActivity<ActivitySplash2Binding>(),
PrivacyManager
(
binding
,
this
,
this
)
}
Thread
{
val
weatherCityBean
=
WeatherUtils
.
getWeather
()
val
weather
=
weatherCityBean
?.
list
?.
random
()
if
(
weather
!=
null
)
{
binding
.
root
.
post
{
binding
.
tvDate
.
text
=
weather
.
fxDate
binding
.
tvTemperature
.
text
=
weather
.
tempMin
+
"℃"
+
" / "
+
weather
.
tempMax
+
"℃"
}
}
}.
start
()
}
private
fun
closeNotification
()
{
...
...
app/src/main/res/drawable/bg_stroke_ffffff_30.xml
0 → 100644
View file @
385826ea
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#26FFFFFF"
/>
<stroke
android:width=
"2.5dp"
android:color=
"#ffffff"
/>
<corners
android:radius=
"30dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/shape_splash_s.xml
View file @
385826ea
...
...
@@ -5,8 +5,8 @@
<!-- <stroke-->
<!-- android:width="1px"-->
<!-- android:color="#FF3835" />-->
<solid
android:color=
"#
E5E5E5
"
/>
<corners
android:radius=
"
10
dp"
/>
<solid
android:color=
"#
8C94A2
"
/>
<corners
android:radius=
"
4
dp"
/>
</shape>
</item>
...
...
@@ -14,8 +14,8 @@
<item
android:id=
"@android:id/progress"
>
<scale
android:scaleWidth=
"100%"
>
<shape>
<corners
android:radius=
"
10
dp"
/>
<solid
android:color=
"#
577DFD
"
/>
<corners
android:radius=
"
4
dp"
/>
<solid
android:color=
"#
ffffff
"
/>
</shape>
</scale>
</item>
...
...
app/src/main/res/layout/activity_splash_2.xml
View file @
385826ea
...
...
@@ -10,20 +10,59 @@
<LinearLayout
android:visibility=
"gone"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.3"
tools:ignore=
"UseCompoundDrawables"
>
<ImageView
android:id=
"@+id/iv_weather"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
tools:ignore=
"ContentDescription"
tools:src=
"@mipmap/duoyun_splash"
/>
<TextView
android:id=
"@+id/tv_date"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"25dp"
android:textColor=
"@color/white"
android:textSize=
"31sp"
tools:text=
"August 27th"
/>
<TextView
android:id=
"@+id/tv_temperature"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20dp"
android:textColor=
"@color/white"
android:textSize=
"25sp"
tools:text=
"23℃/39℃"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_progress"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"49dp"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<ProgressBar
android:id=
"@+id/pb"
style=
"@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width=
"
match_parent
"
android:layout_height=
"
10
dp"
android:layout_width=
"
129dp
"
android:layout_height=
"
8
dp"
android:layout_marginHorizontal=
"32dp"
android:layout_marginTop=
"5dp"
android:max=
"100"
...
...
@@ -31,24 +70,17 @@
tools:progress=
"50"
/>
<TextView
android:id=
"@+id/tv_load"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"18dp"
android:text=
"Loading..."
android:textColor=
"#000000"
android:layout_marginBottom=
"28dp"
android:text=
"Safe Starting..."
android:textColor=
"@color/white"
android:textSize=
"15sp"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/tv_ad_des"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"42dp"
android:text=
"This process may involve ad."
android:textColor=
"#000000"
android:textSize=
"15sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
...
...
@@ -57,48 +89,15 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"20dp"
android:gravity=
"center"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"4dp"
android:text=
"By continuing you are agreeing to the"
android:textColor=
"#676767"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
" & "
android:visibility=
"gone"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/id_tv_privacy_policy"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Privacy Policy"
android:textColor=
"#676767"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
<TextView
android:id=
"@+id/id_tv_start"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:layout_marginHorizontal=
"40dp"
android:layout_marginBottom=
"49dp"
android:background=
"#577CFB"
android:layout_height=
"59dp"
android:layout_marginHorizontal=
"20dp"
android:background=
"@drawable/bg_stroke_ffffff_30"
android:gravity=
"center"
android:text=
"START TO USE"
android:textColor=
"@color/white"
...
...
@@ -107,6 +106,20 @@
android:visibility=
"visible"
tools:ignore=
"HardcodedText"
/>
<TextView
android:id=
"@+id/id_tv_privacy_policy"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"18dp"
android:layout_marginBottom=
"30dp"
android:text=
"Privacy Policy"
android:textColor=
"#676767"
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
...
...
app/src/main/res/mipmap-xxhdpi/duoyun_splash.png
0 → 100644
View file @
385826ea
17.4 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