Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
5b740373
Commit
5b740373
authored
Jul 26, 2022
by
sheteng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0 开发 6
parent
ae8e4fcb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
23 deletions
+29
-23
app/src/main/java/com/ccwangluo/accelerator/ui/gameList/GameListFragment.kt
...com/ccwangluo/accelerator/ui/gameList/GameListFragment.kt
+13
-11
app/src/main/java/com/ccwangluo/accelerator/ui/gameList/GameListModel.kt
...va/com/ccwangluo/accelerator/ui/gameList/GameListModel.kt
+5
-2
app/src/main/java/com/ccwangluo/accelerator/ui/login/SplashFragment.kt
...java/com/ccwangluo/accelerator/ui/login/SplashFragment.kt
+3
-3
app/src/main/java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
.../java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
+1
-0
app/src/main/java/com/ccwangluo/accelerator/utils/http/HttpGo.kt
.../main/java/com/ccwangluo/accelerator/utils/http/HttpGo.kt
+6
-7
core/src/main/java/com/ccnet/acc/AccVpn.kt
core/src/main/java/com/ccnet/acc/AccVpn.kt
+1
-0
No files found.
app/src/main/java/com/ccwangluo/accelerator/ui/gameList/GameListFragment.kt
View file @
5b740373
...
...
@@ -149,7 +149,6 @@ class GameListFragment : XPageFragment() {
.
load
(
itemData
.
icon
)
.
into
(
game_img
)
game_name
.
setText
(
itemData
.
gameName
)
println
(
itemData
)
if
(
itemData
.
type
==
1
)
{
is_free
.
visibility
=
View
.
VISIBLE
}
else
{
...
...
@@ -190,6 +189,17 @@ class GameListFragment : XPageFragment() {
btn_download_status
.
visibility
=
View
.
GONE
}
//应用加速中
else
if
(
AcceleratorUtils
.
state
==
BaseService
.
State
.
Connected
&&
AcceleratorUtils
.
game
!!
.
id
==
itemData
.
id
)
{
btn_uninstall
.
visibility
=
View
.
GONE
btn_acc
.
visibility
=
View
.
GONE
btn_acc_stop
.
visibility
=
View
.
VISIBLE
tx_game_update_notice
.
visibility
=
View
.
GONE
tx_download_status
.
visibility
=
View
.
VISIBLE
btn_download_status
.
visibility
=
View
.
GONE
tx_download_size
.
visibility
=
View
.
GONE
tx_status
.
setText
(
SysUtils
.
getAccTimeString
(
acctime
))
}
//应用升级
else
if
(!
SysUtils
.
compareVersionTo
(
AppUtils
.
getAppVersionName
(
itemData
.
packageName
),
...
...
@@ -202,16 +212,8 @@ class GameListFragment : XPageFragment() {
tx_game_update_notice
.
visibility
=
View
.
VISIBLE
tx_download_status
.
visibility
=
View
.
GONE
btn_download_status
.
visibility
=
View
.
GONE
}
else
if
(
AcceleratorUtils
.
state
==
BaseService
.
State
.
Connected
&&
AcceleratorUtils
.
game
!!
.
id
==
itemData
.
id
)
{
btn_uninstall
.
visibility
=
View
.
GONE
btn_acc
.
visibility
=
View
.
GONE
btn_acc_stop
.
visibility
=
View
.
VISIBLE
tx_game_update_notice
.
visibility
=
View
.
GONE
tx_download_status
.
visibility
=
View
.
VISIBLE
btn_download_status
.
visibility
=
View
.
GONE
tx_download_size
.
visibility
=
View
.
GONE
tx_status
.
setText
(
SysUtils
.
getAccTimeString
(
acctime
))
}
else
{
}
else
{
btn_uninstall
.
visibility
=
View
.
GONE
btn_acc
.
visibility
=
View
.
VISIBLE
btn_acc_stop
.
visibility
=
View
.
GONE
...
...
app/src/main/java/com/ccwangluo/accelerator/ui/gameList/GameListModel.kt
View file @
5b740373
...
...
@@ -5,12 +5,15 @@ import androidx.lifecycle.ViewModel
import
androidx.lifecycle.lifecycleScope
import
com.ccwangluo.accelerator.model.Game
import
com.ccwangluo.accelerator.model.GameInfo
import
com.ccwangluo.accelerator.utils.AcceleratorUtils
import
com.ccwangluo.accelerator.utils.SysUtils
import
com.ccwangluo.accelerator.utils.http.HttpGo
import
com.xuexiang.xpage.base.XPageFragment
import
com.xuexiang.xutil.app.AppUtils
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
java.net.URLDecoder
import
java.net.URLEncoder
class
GameListModel
:
ViewModel
()
{
...
...
@@ -18,10 +21,10 @@ class GameListModel : ViewModel() {
val
clearList
=
MutableLiveData
<
Boolean
>()
fun
freshData
(
xPageFragment
:
XPageFragment
,
page
:
Int
)
{
var
packageName
=
if
(
AcceleratorUtils
.
game
==
null
)
""
else
AcceleratorUtils
.
game
!!
.
packageName
xPageFragment
.
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
res
=
HttpGo
.
getSync
<
Game
>(
"/api/new/game/list?page=${page}&size=20&channelId=${SysUtils.getChannel()}"
)
HttpGo
.
getSync
<
Game
>(
"/api/new/game/list?page=${page}&size=20&channelId=${SysUtils.getChannel()}
&packageName=${packageName}
"
)
res
?.
let
{
it
.
data
?.
let
{
clearList
.
postValue
(
page
==
1
)
...
...
app/src/main/java/com/ccwangluo/accelerator/ui/login/SplashFragment.kt
View file @
5b740373
...
...
@@ -33,9 +33,9 @@ class SplashFragment : XPageFragment() {
override
fun
initViews
()
{
TencentLocationManager
.
getInstance
(
context
)
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
map
=
mutableMapOf
<
String
,
Any
>()
map
.
put
(
"packageNameList"
,
SysUtils
.
getAllAppInfo
(
context
!!
))
HttpGo
.
postSync
<
String
>(
"/api/game/addHotGame"
,
map
)
//
val map = mutableMapOf<String, Any>()
//
map.put("packageNameList", SysUtils.getAllAppInfo(context!!))
//
HttpGo.postSync<String>("/api/game/addHotGame",map)
delay
(
1000
)
withContext
(
Dispatchers
.
Main
)
{
openPage
(
BottomNavigationFragment
::
class
.
java
,
false
)
...
...
app/src/main/java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
View file @
5b740373
...
...
@@ -241,6 +241,7 @@ object AcceleratorUtils : TencentLocationListener {
fun
stopAccelerator
()
{
Core
.
stopService
()
game
=
null
}
private
val
shadowsocksConnection
=
object
:
ShadowsocksConnection
.
Callback
{
...
...
app/src/main/java/com/ccwangluo/accelerator/utils/http/HttpGo.kt
View file @
5b740373
...
...
@@ -8,6 +8,7 @@ import com.github.shadowsocks.http.HttpConfig
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.hjq.toast.ToastUtils
import
com.just.agentweb.utils.LogUtils
import
com.xuexiang.xutil.XUtil
import
okhttp3.*
import
okhttp3.HttpUrl.Companion.toHttpUrlOrNull
...
...
@@ -30,7 +31,7 @@ object HttpGo {
val
gson
:
Gson
val
TAG
=
HttpGo
::
class
.
java
.
name
val
logger
=
Logger
.
getLogger
(
OkHttpClient
::
class
.
java
.
getName
())
init
{
okHttpClient
=
OkHttpClient
().
newBuilder
()
.
readTimeout
(
60
,
TimeUnit
.
SECONDS
)
//设置读取超时时间
...
...
@@ -41,8 +42,6 @@ object HttpGo {
.
sslSocketFactory
(
initSSLSocketFactory
(),
initTrustManager
())
.
build
()
gson
=
Gson
()
Logger
.
getLogger
(
OkHttpClient
::
class
.
java
.
getName
()).
setLevel
(
Level
.
FINE
)
}
fun
getClient
():
OkHttpClient
{
...
...
@@ -58,13 +57,13 @@ object HttpGo {
LoginUtils
.
token
?.
let
{
request
.
addHeader
(
"Authorization"
,
it
)
}
Timber
.
i
(
"%s%s"
,
url
,
request
.
toString
()
)
logger
.
info
(
url
)
val
call
=
okHttpClient
.
newCall
(
request
.
build
())
val
response
:
Response
=
call
.
execute
()
if
(
response
.
isSuccessful
)
{
val
type
=
object
:
TypeToken
<
BaseModel
<
T
>>()
{}.
type
val
string
=
response
.
body
?.
string
()
Timber
.
i
(
"getSync:"
+
string
.
toString
())
logger
.
info
(
"getSync:"
+
string
.
toString
())
val
result
:
BaseModel
<
T
>?
=
gson
.
fromJson
(
string
,
type
)
return
result
}
else
if
(
response
.
code
==
401
)
{
...
...
@@ -99,12 +98,12 @@ object HttpGo {
LoginUtils
.
token
?.
let
{
request
.
addHeader
(
"Authorization"
,
it
)
}
Timber
.
i
(
request
.
toString
())
logger
.
info
(
request
.
toString
())
val
call
=
okHttpClient
.
newCall
(
request
.
build
())
val
response
:
Response
=
call
.
execute
()
if
(
response
.
isSuccessful
)
{
val
string
=
response
.
body
?.
string
()
Timber
.
i
(
"postSync:"
+
string
.
toString
())
logger
.
info
(
"postSync:"
+
string
.
toString
())
val
type
=
object
:
TypeToken
<
BaseModel
<
T
>>()
{}.
type
val
result
:
BaseModel
<
T
>?
=
gson
.
fromJson
(
string
,
type
)
return
result
...
...
core/src/main/java/com/ccnet/acc/AccVpn.kt
View file @
5b740373
...
...
@@ -36,5 +36,6 @@ object AccVpn {
val
configFile
=
configFile
(
context
)
Timber
.
d
(
"writeConfig ${configFile.absolutePath}"
)
configFile
.
writeText
(
configContent
)
Timber
.
d
(
"writeConfig readLines ${configContent}"
)
}
}
\ 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