Commit f6b90158 authored by sheteng's avatar sheteng

加入模块app

parent 068dc478
......@@ -21,7 +21,7 @@ android {
// targetSdk 30
// versionCode = 1
// versionName = "1.0"
//
// testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// javaCompileOptions {
// annotationProcessor(Options {)
......@@ -31,33 +31,25 @@ android {
// manifestPlaceholders = listOf(qqappid = "你的qq appid")
// }
// buildTypes {
// named("release"){
// signingConfig = signingConfigs.getByName("config")
// isMinifyEnabled = false
// setProguardFiles(listOf(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"))
// buildConfigField "String", "BASE_URL", "\"http://10.16.1.98:9002/api(\"")
// }
// named("debug"){
// signingConfig = signingConfigs.getByName("config")
// isMinifyEnabled = false
// buildConfigField "String", "BASE_URL", "\"http://10.16.1.98:9002/api(\"")
// }
// }
// compileOptions {
// sourceCompatibility = JavaVersion.VERSION_1_8
// targetCompatibility = JavaVersion.VERSION_1_8
// }
// kotlinOptions {
// jvmTarget = "1.8"
// }
buildTypes {
named("release"){
signingConfig = signingConfigs.getByName("config")
isMinifyEnabled = false
setProguardFiles(listOf(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"))
}
named("debug"){
signingConfig = signingConfigs.getByName("config")
isMinifyEnabled = false
}
}
}
setupApp()
android.defaultConfig.applicationId = "com.ccwangluo.accelerator"
android.buildFeatures.viewBinding = true
android.buildTypes.named("release")
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
implementation("androidx.appcompat:appcompat:1.3.1")
......@@ -113,4 +105,7 @@ dependencies {
//
// implementation("com.umeng.umsdk:share-qq:7.1.7")//QQ完整版)
// implementation("com.squareup.okhttp3:okhttp:3.14.9")//QQ官方sdk 3.53及之后版本需要集成okhttp3.x,必选)
//gps
implementation ("com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0")
}
\ No newline at end of file
......@@ -148,3 +148,20 @@
-keep class com.linkedin.** { *; }
-keep class com.android.dingtalk.share.ddsharemodule.** { *; }
-keepattributes Signature
-keepclassmembers class ** {
public void on*Event(...);
}
-keep class c.t.**{*;}
-keep class com.tencent.map.geolocation.**{*;}
-keep public class com.tencent.location.**{
public protected *;
}
-keepclasseswithmembernames class * {
native <methods>;
}
-dontwarn org.eclipse.jdt.annotation.**
-dontwarn c.t.**
......@@ -2,36 +2,38 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ccwangluo.accelerator">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<!-- 通过GPS得到精确位置 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 通过网络得到粗略位置 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 访问网络. 某些位置信息需要从网络服务器获取 -->
<uses-permission android:name="android.permission.INTERNET" /> <!-- 访问WiFi状态. 需要WiFi信息用于网络定位 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 修改WiFi状态. 发起WiFi扫描, 需要WiFi信息用于网络定位 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 访问网络状态, 检测网络的可用性. 需要网络运营商相关信息用于网络定位 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 访问网络的变化, 需要某些信息用于网络定位 -->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 访问手机当前状态, 需要device id用于网络定位 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 访问蓝牙状态,需要蓝牙信息用于网络定位 -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 支持A-GPS辅助定位 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于 log 日志 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<queries>
<package android:name="com.tencent.mm" />
<package android:name="com.tencent.mobileqq" />
<package android:name="com.tencent.mm" />
<package android:name="com.tencent.mobileqq" />
</queries>
<application
android:name=".App"
android:allowBackup="true"
android:usesCleartextTraffic="true"
android:icon="@mipmap/tt_logo"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".ui.MainActivity"
android:label="@string/app_name"
......@@ -43,30 +45,33 @@
</intent-filter>
</activity>
<meta-data
android:name="TencentMapSDK"
android:value="KZFBZ-QJ26J-WAYFC-FIO5N-FE453-QTFTT" />
<activity
android:name=".wxapi.WXEntryActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<!-- <provider-->
<!-- android:name="android.support.v4.content.FileProvider"-->
<!-- android:authorities="com.ccwangluo.accelerator.fileprovider"-->
<!-- android:exported="false"-->
<!-- android:grantUriPermissions="true">-->
<!-- <meta-data-->
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/filepaths"/>-->
<!-- </provider>-->
android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <!-- <provider -->
<!-- android:name="android.support.v4.content.FileProvider" -->
<!-- android:authorities="com.ccwangluo.accelerator.fileprovider" -->
<!-- android:exported="false" -->
<!-- android:grantUriPermissions="true"> -->
<!-- <meta-data -->
<!-- android:name="android.support.FILE_PROVIDER_PATHS" -->
<!-- android:resource="@xml/filepaths"/> -->
<!-- </provider> -->
<activity
android:name="com.tencent.tauth.AuthActivity"
android:noHistory="true"
android:launchMode="singleTask" >
android:launchMode="singleTask"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="1212121" />
</intent-filter>
</activity>
......@@ -74,44 +79,39 @@
android:name="com.tencent.connect.common.AssistActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="behind"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- <provider-->
<!-- android:authorities="${applicationId}.fileprovider"-->
<!-- android:name="android.support.v4.content.FileProvider"-->
<!-- android:exported="false"-->
<!-- android:grantUriPermissions="true"-->
<!-- >-->
<!-- <meta-data-->
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/filepaths"/>-->
<!-- </provider>-->
android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <!-- <provider -->
<!-- android:authorities="${applicationId}.fileprovider" -->
<!-- android:name="android.support.v4.content.FileProvider" -->
<!-- android:exported="false" -->
<!-- android:grantUriPermissions="true" -->
<!-- > -->
<!-- <meta-data -->
<!-- android:name="android.support.FILE_PROVIDER_PATHS" -->
<!-- android:resource="@xml/filepaths"/> -->
<!-- </provider> -->
<activity
android:name="com.chuanglan.shanyan_sdk.view.CmccLoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:screenOrientation="behind"
/>
android:screenOrientation="behind" />
<activity-alias
android:name="com.cmic.sso.sdk.view.LoginAuthActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:screenOrientation="behind"
android:targetActivity="com.chuanglan.shanyan_sdk.view.CmccLoginActivity"
/>
android:targetActivity="com.chuanglan.shanyan_sdk.view.CmccLoginActivity" />
<activity
android:name="com.chuanglan.shanyan_sdk.view.ShanYanOneKeyActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:screenOrientation="behind"
/>
android:screenOrientation="behind" />
<activity
android:name="com.chuanglan.shanyan_sdk.view.CTCCPrivacyProtocolActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:screenOrientation="behind"
/>
android:screenOrientation="behind" />
</application>
</manifest>
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.ccwangluo.accelerator.ui.MainActivity
import com.ccwangluo.accelerator.utils.PhoneUtils
import com.github.shadowsocks.Core
import com.hjq.toast.ToastUtils
import com.tencent.map.geolocation.TencentLocationManager
import com.xuexiang.xpage.PageConfig
import com.xuexiang.xpage.base.XPageActivity
......@@ -23,7 +24,6 @@ class App : Application(), androidx.work.Configuration.Provider by Core {
PhoneUtils.initSdk(this)
// 初始化 Toast 框架
ToastUtils.init(this)
// UMConfigure.preInit()
MultiDex.install(this)
Core.init(this, MainActivity::class)
}
......
package com.ccwangluo.accelerator.model
data class UserProfile(
val avatar: String,
val hasUnreadNotice: Boolean,
val username: String,
val vip: Boolean,
val vipExpireTime: String
)
\ No newline at end of file
package com.ccwangluo.accelerator.ui
import android.view.*
import androidx.lifecycle.ViewModelProvider
import androidx.viewpager.widget.ViewPager
import com.ccwangluo.accelerator.databinding.FragmentBtnNavBinding
import com.ccwangluo.accelerator.ui.home.AccelertorFragment
import com.ccwangluo.accelerator.ui.home.AccelertorViewModel
import com.ccwangluo.accelerator.ui.home.MineFragment
import com.ccwangluo.accelerator.ui.home.NewsFragment
import com.ccwangluo.accelerator.utils.LoginUtils
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.xuexiang.xpage.annotation.Page
import com.xuexiang.xpage.base.XPageFragment
......@@ -18,13 +21,16 @@ import com.xuexiang.xutil.common.CollectionUtils
@Page(name = "主页")
class BottomNavigationFragment : XPageFragment(), ViewPager.OnPageChangeListener,
BottomNavigationView.OnNavigationItemSelectedListener {
private lateinit var accelertorViewModel: AccelertorViewModel
lateinit var binding: FragmentBtnNavBinding
override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View {
binding = FragmentBtnNavBinding.inflate(inflater!!, container, false)
accelertorViewModel =
ViewModelProvider(requireActivity()).get(AccelertorViewModel::class.java)
return binding.root
}
override fun initTitleBar(): TitleBar? {
//不使用@Page标注的一定要注意覆盖这个方法
return null
......@@ -55,7 +61,19 @@ class BottomNavigationFragment : XPageFragment(), ViewPager.OnPageChangeListener
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
if (hidden) {
getUserProfile()
}
}
fun getUserProfile() {
LoginUtils.token?.let {
LoginUtils.getUserProfile(this) {
it?.let {
accelertorViewModel.userProfile.postValue(it)
}
}
}
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
......
......@@ -3,8 +3,12 @@ package com.ccwangluo.accelerator.ui
import android.Manifest
import android.content.Intent
import android.os.Bundle
import android.os.Looper
import android.view.KeyEvent
import androidx.lifecycle.ViewModelProvider
import com.ccwangluo.accelerator.ui.dialog.PrivacyDialog
import com.ccwangluo.accelerator.ui.home.AccelertorViewModel
import com.ccwangluo.accelerator.ui.login.SplashFragment
import com.ccwangluo.accelerator.utils.AcceleratorUtils
import com.ccwangluo.accelerator.utils.LoginUtils
import com.ccwangluo.accelerator.utils.PhoneUtils
......@@ -17,6 +21,9 @@ import com.karumi.dexter.MultiplePermissionsReport
import com.karumi.dexter.PermissionToken
import com.karumi.dexter.listener.PermissionRequest
import com.karumi.dexter.listener.multi.MultiplePermissionsListener
import com.tencent.map.geolocation.TencentLocation
import com.tencent.map.geolocation.TencentLocationListener
import com.tencent.map.geolocation.TencentLocationManager
import com.tencent.mmkv.MMKV
import com.tencent.tauth.Tencent
import com.umeng.socialize.UMShareAPI
......@@ -24,7 +31,7 @@ import com.xuexiang.xpage.base.XPageActivity
import com.xuexiang.xpage.core.PageOption
class MainActivity() : XPageActivity() {
class MainActivity() : XPageActivity(), TencentLocationListener {
private val connect = registerForActivityResult(StartService()) {
if (it) {
......@@ -32,8 +39,12 @@ class MainActivity() : XPageActivity() {
}
}
private lateinit var accelertorViewModel: AccelertorViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
accelertorViewModel =
ViewModelProvider(this).get(AccelertorViewModel::class.java)
MMKV.initialize(this)
initPhoneUtils()
//获取权限
......@@ -41,11 +52,23 @@ class MainActivity() : XPageActivity() {
.withPermissions(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.ACCESS_FINE_LOCATION
)
.withListener(object : MultiplePermissionsListener {
override fun onPermissionsChecked(p0: MultiplePermissionsReport?) {
println(p0)
p0?.let {
it.grantedPermissionResponses.forEach {
if (it.permissionName.equals(Manifest.permission.ACCESS_FINE_LOCATION)) {
TencentLocationManager.getInstance(this@MainActivity)
.requestSingleFreshLocation(
null,
this@MainActivity,
Looper.getMainLooper()
)
}
}
}
}
override fun onPermissionRationaleShouldBeShown(
......@@ -57,7 +80,7 @@ class MainActivity() : XPageActivity() {
}
}).check()
PageOption.to(BottomNavigationFragment::class.java).open(this)
PageOption.to(SplashFragment::class.java).open(this)
Tencent.setIsPermissionGranted(true)
//隐私协议
......@@ -73,6 +96,7 @@ class MainActivity() : XPageActivity() {
}
AcceleratorUtils.initConnect(this, connect)
}
private fun initPhoneUtils() {
......@@ -91,7 +115,6 @@ class MainActivity() : XPageActivity() {
override fun onDestroy() {
super.onDestroy()
LoginUtils.clearToken()
AcceleratorUtils.onDestroy(this)
}
......@@ -113,5 +136,13 @@ class MainActivity() : XPageActivity() {
return super.onKeyDown(keyCode, event)
}
override fun onLocationChanged(p0: TencentLocation?, p1: Int, p2: String?) {
println(p0)
}
override fun onStatusUpdate(p0: String?, p1: Int, p2: String?) {
println(p0)
}
}
\ No newline at end of file
......@@ -54,4 +54,8 @@ class CommonDialog(
return this
}
init {
mDialog.setCancelable(false)
}
}
\ No newline at end of file
......@@ -32,6 +32,9 @@ class MemberDialog(
fragment.openPage(CommonWebViewFragment::class.java, params)
}
}
init {
mDialog.setCancelable(false)
}
}
\ No newline at end of file
......@@ -42,6 +42,7 @@ class PrivacyDialog(
val container = findViewById<FrameLayout>(R.id.privacy_webview)
val agentWeb =
createAgentWeb(xPageActivity, container, privacy_url)
mDialog.setCancelable(false)
}
fun createAgentWeb(xPageActivity: XPageActivity, viewGroup: ViewGroup, url: String): AgentWeb {
......
package com.ccwangluo.accelerator.ui.home
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
......@@ -9,11 +10,12 @@ import android.view.animation.RotateAnimation
import androidx.lifecycle.ViewModelProvider
import com.ccwangluo.accelerator.R
import com.ccwangluo.accelerator.databinding.FragmentQuickBinding
import com.ccwangluo.accelerator.ui.dialog.CommonDialog
import com.ccwangluo.accelerator.ui.dialog.MemberDialog
import com.ccwangluo.accelerator.utils.AcceleratorUtils
import com.ccwangluo.accelerator.utils.LoginUtils
import com.ccwangluo.accelerator.utils.SysUtils
import com.ccwangluo.cc_quickly.utils.SettingSPUtils
import com.github.shadowsocks.bg.BaseService
import com.hjq.toast.ToastUtils
import com.xuexiang.xpage.base.XPageFragment
......@@ -79,12 +81,30 @@ class AccelertorFragment : XPageFragment() {
if (it.delay != -1) {
binding.netQuality.setText(SysUtils.getnetQuality(it.delay))
}
binding.activeNetwork.setText(SysUtils.getActiveNet())
if (SettingSPUtils.isSmartAccOpen) {
binding.smartAccOpen.setText("已开启")
binding.smartAccOpen.setTextColor(resources.getColor(R.color.open_acc_enable))
binding.smartAccOpenBtn.visibility = View.GONE
} else {
binding.smartAccOpen.setText("未开启 >")
binding.smartAccOpen.setTextColor(resources.getColor(R.color.white))
binding.smartAccOpenBtn.visibility = View.VISIBLE
}
})
accelertorViewModel.accState.observe(this, {
freshData(it, acc_timer)
})
accelertorViewModel.userProfile.observe(this,{
if (it.hasUnreadNotice) {
binding.iconNoticeBadge.visibility = View.VISIBLE
} else {
binding.iconNoticeBadge.visibility = View.GONE
}
})
}
override fun initListeners() {
......@@ -105,17 +125,17 @@ class AccelertorFragment : XPageFragment() {
CommonDialog(this).setTitle("加速停止确认")
.setContent("停止加速可能会导致游戏断线,是否确认停止?")
.setBtnLeft("取消", {}).setBtnRight("停止加速", {
AcceleratorUtils.stopAccelerator()
}).show<CommonDialog>()
AcceleratorUtils.stopAccelerator()
}).show<CommonDialog>()
return@setOnClickListener
}
}
// if (!LoginUtils.hasToken()) {
// LoginUtils.login(this, {
//
// })
// return@setOnClickListener
// }
if (!LoginUtils.hasToken()) {
LoginUtils.login(this, {
})
return@setOnClickListener
}
if (!SysUtils.getConnectivityStatus()) {
binding.quickTopToast.visibility = View.VISIBLE
......@@ -125,25 +145,30 @@ class AccelertorFragment : XPageFragment() {
}, 2000)
return@setOnClickListener
}
// TODO: 2022/2/16 是否安装了这个包
//用户是否有使用时长
// if (){
// MemberDialog(this).show<MemberDialog>()
// return@setOnClickListener
// }
//
AcceleratorUtils.startAccelerator()
startAnim()
LoginUtils.getUserHasTimer(this) {
if (it) {
binding.btnQuick.isEnabled = false
AcceleratorUtils.startAccelerator()
startAnim()
} else {
MemberDialog(this).show<MemberDialog>()
}
}
}
}
override fun onResume() {
super.onResume()
AcceleratorUtils.registerStateListener({ state, l, net ->
accelertorViewModel.netState.postValue(net)
AcceleratorUtils.registerStateListener { state, l, net ->
net?.let {
accelertorViewModel.netState.postValue(net)
}
acc_timer = l
accelertorViewModel.accState.postValue(state)
})
}
}
fun freshData(state: BaseService.State, time: Long) {
......@@ -159,6 +184,18 @@ class AccelertorFragment : XPageFragment() {
binding.progressViewCircleSmall.progress = 0F
binding.btnQuick.setBackgroundResource(R.mipmap.quick_start)
}
}
fun getUserProfile() {
LoginUtils.token?.let {
LoginUtils.getUserProfile(this) {
it?.let {
accelertorViewModel.userProfile.postValue(it)
}
}
}
}
override fun onPause() {
......@@ -167,6 +204,7 @@ class AccelertorFragment : XPageFragment() {
}
fun stopAnim() {
binding.btnQuick.isEnabled = true
binding.progressViewCircleSmall.stopProgressAnimation()
binding.progressViewCircleSmall.setProgressTextVisibility(false)
binding.gamePicOut.clearAnimation()
......@@ -201,6 +239,13 @@ class AccelertorFragment : XPageFragment() {
return rotate
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser) {
getUserProfile()
}
}
companion object {
fun newInstance(): AccelertorFragment {
val fragment = AccelertorFragment()
......
......@@ -3,9 +3,14 @@ package com.ccwangluo.accelerator.ui.home
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.ccwangluo.accelerator.model.LoginRes
import com.ccwangluo.accelerator.model.NetState
import com.ccwangluo.accelerator.model.UserProfile
import com.ccwangluo.accelerator.utils.LoginUtils
import com.ccwangluo.accelerator.utils.SysUtils
import com.ccwangluo.accelerator.utils.http.HttpGo
import com.github.shadowsocks.bg.BaseService
import com.hjq.toast.ToastUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
......@@ -17,6 +22,9 @@ class AccelertorViewModel : ViewModel() {
//网络状态
var netState = MutableLiveData<NetState>()
//加速状态
var accState = MutableLiveData<BaseService.State>()
var userProfile = MutableLiveData<UserProfile>()
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import android.widget.FrameLayout
import androidx.fragment.app.Fragment
import com.ccwangluo.accelerator.databinding.FragmentMineBinding
import com.ccwangluo.accelerator.ui.web.AndroidInterface
import com.ccwangluo.accelerator.utils.LoginUtils
import com.ccwangluo.accelerator.utils.http.HttpConfig
import com.just.agentweb.core.AgentWeb
import com.just.agentweb.core.client.DefaultWebClient
......@@ -30,8 +31,12 @@ class MineFragment : XPageFragment() {
}
override fun initViews() {
var weburl = HttpConfig.UI_MAIN_URL
LoginUtils.token?.let {
weburl = weburl + "?token=$it"
}
val agentWeb =
createAgentWeb(this, binding.mineWebview, HttpConfig.UI_MAIN_URL)
createAgentWeb(this, binding.mineWebview, weburl)
agentWeb.getJsInterfaceHolder().addJavaObject("android", AndroidInterface(this, agentWeb))
}
......@@ -63,6 +68,15 @@ class MineFragment : XPageFragment() {
.go(url)
}
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser) {
LoginUtils.token?.let {
// TODO: 2022/2/16 调用h5 设置token
}
}
}
override fun onPause() {
agentWeb?.getWebLifeCycle()?.onPause()
super.onPause()
......
......@@ -29,7 +29,6 @@ class NewsFragment : XPageFragment() {
val titles = arrayOf("动态", "攻略", "视频", "评价", "问答")
var adapter: DemoCollectionAdapter? = null
override fun initViews() {
newsViewModel.refreshState.observe(this, {
if (!it) {
binding.refreshLayout.isRefreshing = false
......
......@@ -22,7 +22,7 @@ class LoginViewModel : ViewModel() {
map.put("phone", phone)
map.put("verifyCode", authCdoe)
viewModelScope.launch(Dispatchers.IO) {
val res = HttpGo.postSync<LoginRes>("/user/verifyCode/login", map)
val res = HttpGo.postSync<LoginRes>("/api/user/verifyCode/login", map)
res?.let {
if (it.code == 200) {
LoginUtils.token = it.data?.token
......@@ -39,7 +39,7 @@ class LoginViewModel : ViewModel() {
val map = mutableMapOf<String, String>()
map.put("phone", phone)
viewModelScope.launch(Dispatchers.IO) {
val res = HttpGo.postSync<Boolean>("/user/sendSms", map)
val res = HttpGo.postSync<Boolean>("/api/user/sendSms", map)
res?.let {
if (it.code == 200) {
sendCodeState.postValue(true)
......
......@@ -23,14 +23,13 @@ import java.util.regex.Pattern
* Use the [PhoneLoginFragment.newInstance] factory method to
* create an instance of this fragment.
*/
@Page(name = "登录")
@Page(name = "login")
class PhoneLoginFragment : XPageFragment() {
override fun initTitleBar(): TitleBar? {
return null
}
private val mHandler: Handler = Handler(Looper.getMainLooper());
private var mCountTime = 60
private lateinit var loginViewModel: LoginViewModel
......
package com.ccwangluo.accelerator.ui.login
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope
import com.ccwangluo.accelerator.databinding.FragmentSplashBinding
import com.ccwangluo.accelerator.ui.BottomNavigationFragment
import com.tencent.map.geolocation.TencentLocationManager
import com.xuexiang.xpage.annotation.Page
import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xpage.core.PageOption
import com.xuexiang.xpage.utils.TitleBar
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@Page(name = "splash")
class SplashFragment : XPageFragment() {
override fun initTitleBar(): TitleBar? {
return null
}
override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View {
val inflate = FragmentSplashBinding.inflate(inflater!!, container, false)
return inflate.root
}
override fun initViews() {
lifecycleScope.launch(Dispatchers.IO) {
delay(1000)
withContext(Dispatchers.Main) {
openPage(BottomNavigationFragment::class.java,false)
}
}
TencentLocationManager.getInstance(context)
}
override fun initListeners() {
}
}
\ No newline at end of file
......@@ -7,6 +7,8 @@ import android.webkit.JavascriptInterface
import androidx.core.content.ContextCompat.checkSelfPermission
import com.ccwangluo.accelerator.utils.LoginUtils
import com.ccwangluo.accelerator.utils.SysUtils
import com.ccwangluo.accelerator.utils.http.HttpConfig
import com.ccwangluo.cc_quickly.utils.SettingSPUtils
import com.ccwangluo.cc_quickly.utils.XToastUtils
import com.just.agentweb.core.AgentWeb
import com.karumi.dexter.Dexter
......@@ -15,6 +17,8 @@ import com.karumi.dexter.PermissionToken
import com.karumi.dexter.listener.PermissionRequest
import com.karumi.dexter.listener.multi.MultiplePermissionsListener
import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xutil.app.AppUtils
import com.xuexiang.xutil.system.PermissionUtils
/**
......@@ -40,7 +44,7 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
@JavascriptInterface
fun openWebview(url: String) {
val params = Bundle()
params.putString(CommonWebViewFragment.WEBVIEW_URL_KEY, url)
params.putString(CommonWebViewFragment.WEBVIEW_URL_KEY, HttpConfig.UI_MAIN_URL + url)
xPageFragment.openPage(CommonWebViewFragment::class.java, params)
}
......@@ -54,6 +58,22 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
})
}
/**
* 智能极限加速
*/
@JavascriptInterface
fun setSmartAccOpen(isopen: Boolean) {
SettingSPUtils.isSmartAccOpen = isopen
}
/**
* 清除token
*/
@JavascriptInterface
fun clearToken() {
LoginUtils.clearToken()
}
/**
* 检查权限
......@@ -61,6 +81,7 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
@JavascriptInterface
fun getPermissionState(key: String, callback: String) {
xPageFragment.context?.let {
PermissionUtils.openAppSettings()
val hasPermission: Boolean = if (checkSelfPermission(it, key) > 0) true else false
agentWeb.getJsAccessEntrace()
.quickCallJs(callback, key, hasPermission.toString())
......@@ -107,7 +128,7 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
@JavascriptInterface
fun getPackageState(packageName: String, callback: String) {
xPageFragment.context?.let {
val packageInstall = SysUtils.isPackageInstall(it, packageName)
val packageInstall = AppUtils.isInstallApp(packageName)
agentWeb.getJsAccessEntrace()
.quickCallJs(callback, packageName, packageInstall.toString())
}
......@@ -118,16 +139,7 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
*/
@JavascriptInterface
fun uninstallPackge(pageName: String) {
xPageFragment.context?.let {
//创建Intent意图
val intent = Intent(Intent.ACTION_DELETE)
//通过程序的包名创建URL
val packageURI = Uri.parse("package:${pageName}")
//设置Uri
intent.setData(packageURI)
//卸载程序
it.startActivity(intent)
}
AppUtils.uninstallApp(pageName)
}
}
\ No newline at end of file
......@@ -7,15 +7,21 @@ import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.fragment.app.Fragment
import com.ccwangluo.accelerator.databinding.FragmentWebviewBinding
import com.ccwangluo.accelerator.utils.LoginUtils
import com.just.agentweb.core.AgentWeb
import com.just.agentweb.core.client.DefaultWebClient
import com.xuexiang.xpage.annotation.Page
import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xpage.utils.TitleBar
@Page(name = "webview")
class CommonWebViewFragment : XPageFragment() {
override fun initTitleBar(): TitleBar? {
return null
}
var agentWeb: AgentWeb? = null
lateinit var binding: FragmentWebviewBinding
override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View {
......@@ -25,8 +31,19 @@ class CommonWebViewFragment : XPageFragment() {
override fun initViews() {
val url = arguments?.getString(WEBVIEW_URL_KEY)
agentWeb =
url?.let { createAgentWeb(this, binding.commonWebview, it) }
url?.let {
var weburl = it
LoginUtils.token?.let {
if (weburl.contains("?")){
weburl = weburl + "&token=$it"
} else {
weburl = weburl + "?token=$it"
}
}
createAgentWeb(this, binding.commonWebview, weburl)
}
agentWeb?.getJsInterfaceHolder()
?.addJavaObject("android", AndroidInterface(this, agentWeb!!))
}
......
......@@ -14,10 +14,9 @@ import com.github.shadowsocks.aidl.ShadowsocksConnection
import com.github.shadowsocks.bg.BaseService
import com.github.shadowsocks.database.ProfileManager
import com.xuexiang.xutil.net.NetworkUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.*
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
/**
......@@ -40,16 +39,17 @@ object AcceleratorUtils {
//加速后延迟
var acc_net = -1
var netState = NetState(-1, -1, -1, "0")
private val preStateList = mutableListOf<NetState>()
//
var count = 0
// 加速时长
var ACC_TIME = 0L
var stateListener: (BaseService.State, Long, NetState) -> Unit = { state, l, net ->
var stateListener: (BaseService.State, Long, NetState?) -> Unit = { state, l, net ->
}
fun initConnect(context: AppCompatActivity, connect: ActivityResultLauncher<Void?>) {
this.context = context
this.connect = connect
......@@ -60,13 +60,25 @@ object AcceleratorUtils {
val net = SysUtils.getNetPing("10.3.0.34")
if (state != BaseService.State.Connected) {
pre_net = net.delay
acc_net = -1
} else {
net.accNetDelay = if (net.delay > pre_net) pre_net else net.delay
acc_net = if (net.delay > pre_net) pre_net else net.delay
LoginUtils.getUserHasTimer {
if (!it) { //没有加速时长关闭服务
stopAccelerator()
}
}
}
net.preNetDelay = pre_net
netState = net
net.accNetDelay = acc_net
stateListener(state, getAccTime(), net)
delay(2000)
delay(1000)
}
}
context.lifecycleScope.launch(Dispatchers.IO) {
while (true) {
stateListener(state, getAccTime(), null)
delay(1000)
}
}
}
......@@ -75,9 +87,9 @@ object AcceleratorUtils {
connect.launch(null)
}
fun registerStateListener(listener: (BaseService.State, Long, NetState) -> Unit) {
fun registerStateListener(listener: (BaseService.State, Long, NetState?) -> Unit) {
stateListener = listener
stateListener(state, getAccTime(), netState)
stateListener(state, getAccTime(), null)
}
fun unRegisterStateListener() {
......@@ -93,10 +105,10 @@ object AcceleratorUtils {
private val shadowsocksConnection = object : ShadowsocksConnection.Callback {
override fun stateChanged(state: BaseService.State, profileName: String?, msg: String?) {
AcceleratorUtils.state = state
if(state == BaseService.State.Connected){
if (state == BaseService.State.Connected) {
ACC_TIME = System.currentTimeMillis()
}
stateListener(state, getAccTime(), netState)
stateListener(state, getAccTime(), null)
}
override fun onServiceConnected(service: IShadowsocksService) {
......@@ -105,7 +117,7 @@ object AcceleratorUtils {
} catch (_: RemoteException) {
state = BaseService.State.Idle
}
stateListener(state, getAccTime(), netState)
stateListener(state, getAccTime(), null)
}
override fun onBinderDied() {
......
......@@ -2,7 +2,9 @@ package com.ccwangluo.accelerator.utils
import android.content.Context
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.viewModelScope
import com.ccwangluo.accelerator.model.LoginRes
import com.ccwangluo.accelerator.model.UserProfile
import com.ccwangluo.accelerator.ui.login.PhoneLoginFragment
import com.ccwangluo.accelerator.utils.http.HttpGo
import com.chuanglan.shanyan_sdk.OneKeyLoginManager
......@@ -15,17 +17,62 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.*
/**
* 登录信息工具类
*/
object LoginUtils {
var loginRes: LoginRes? = null
var timeNumber = 60
private var timeNumber = 60
private var userProfile: UserProfile? = null
private var timer: Timer? = null
private var timerTask: TimerTask? = null
private var timerCallBack: (Int) -> Unit? = {}
fun getUserProfile(xPageFragment: XPageFragment, callBack: (UserProfile?) -> Unit) {
xPageFragment.lifecycleScope.launch(Dispatchers.IO) {
val res = HttpGo.getSync<UserProfile>("/api/user/profile")
res?.let {
if (it.code == 200) {
it.data?.let {
userProfile = it
}
} else {
ToastUtils.show(it.error)
}
withContext(Dispatchers.Main) {
callBack(userProfile)
}
}
}
}
fun getUserHasTimer(xPageFragment: XPageFragment, callBack: (Boolean) -> Unit) {
userProfile?.let {
val dateToStamp = TimeUtils.dateToStamp(it.vipExpireTime) + 24 * 60 * 60 * 1000
// && it.vipExpireTime > System.currentTimeMillis()
callBack(it.vip && dateToStamp > System.currentTimeMillis())
} ?: let {
getUserProfile(xPageFragment) {
it?.let {
callBack(true)
} ?: let {
callBack(false)
}
}
}
}
fun getUserHasTimer(callBack: (Boolean) -> Unit) {
userProfile?.let {
val dateToStamp = TimeUtils.dateToStamp(it.vipExpireTime) + 24 * 60 * 60 * 1000
// && it.vipExpireTime > System.currentTimeMillis()
callBack(it.vip && dateToStamp > System.currentTimeMillis())
}
}
fun registerTimerCallBack(callBack: (Int) -> Unit) {
timerCallBack = callBack
}
......@@ -56,11 +103,10 @@ object LoginUtils {
val map = mutableMapOf<String, String>()
map.put("token", s)
xPageFragment.lifecycleScope.launch(Dispatchers.IO) {
val res = HttpGo.postSync<LoginRes>("/user/flash/login", map)
val res = HttpGo.postSync<LoginRes>("/api/user/flash/login", map)
res?.let {
if (it.code == 200) {
token = it.data?.token
loginRes = it.data
ToastUtils.show("登录成功")
OneKeyLoginManager.getInstance().finishAuthActivity()
withContext(Dispatchers.Main) {
......@@ -82,25 +128,15 @@ object LoginUtils {
}
}
private var sToken: String? = null
private const val KEY_TOKEN = "com.ccwangluo.KEY_TOKEN"
/**
* 初始化Token信息
*/
fun init(context: Context?) {
sToken = MMKV.defaultMMKV().decodeString(KEY_TOKEN, "")
}
fun clearToken() {
sToken = null
MMKV.defaultMMKV().remove(KEY_TOKEN)
}
var token: String?
get() = sToken
get() = MMKV.defaultMMKV().decodeString(KEY_TOKEN, null)
set(token) {
sToken = token
MMKV.defaultMMKV().putString(KEY_TOKEN, token)
}
......
......@@ -122,10 +122,10 @@ object PhoneUtils {
.setNavText("")
.setSloganHidden(true)
//导航栏标题设置成空
.setLogoHeight(130)
.setLogoWidth(130)
.setLogoHeight(160)
.setLogoWidth(160)
.setLogoOffsetY(30)
.setLogoImgPath(context.resources.getDrawable(R.mipmap.ic_launcher))
.setLogoImgPath(context.resources.getDrawable(R.mipmap.phone_login_logo))
// .addCustomView(
// mOtherTv2, true, false, null
// )
......
......@@ -11,9 +11,9 @@ import com.tencent.mmkv.MMKV
object SettingSPUtils {
private val IS_FIRST_OPEN_KEY = "is_first_open_key"
private val IS_AGREE_PRIVACY_KEY = "is_agree_privacy_key"
/**
* 是否是第一次启动
*/
private val IS_SMART_ACC_OPEN = "is_smart_acc_open"
/**
* 设置是否是第一次启动
*/
......@@ -31,4 +31,13 @@ object SettingSPUtils {
set(isAgreePrivacy) {
MMKV.defaultMMKV().putBoolean(IS_AGREE_PRIVACY_KEY, isAgreePrivacy)
}
/**
* 智能加速是否启动
*/
var isSmartAccOpen: Boolean
get() = MMKV.defaultMMKV().decodeBool(IS_SMART_ACC_OPEN, false)
set(isSmartAccOpen) {
MMKV.defaultMMKV().putBoolean(IS_SMART_ACC_OPEN, isSmartAccOpen)
}
}
\ No newline at end of file
......@@ -13,7 +13,20 @@ import kotlin.collections.ArrayList
object SysUtils {
fun getConnectivityStatus(): Boolean {
return NetworkUtils.isNetworkAvailable()
return NetworkUtils.isHaveInternet()
}
fun getActiveNet(): String {
when(NetworkUtils.getNetStateType()){
NetworkUtils.NetState.NET_WIFI -> return "WIFI"
NetworkUtils.NetState.NET_5G -> return "5G"
NetworkUtils.NetState.NET_4G -> return "4G"
NetworkUtils.NetState.NET_3G -> return "3G"
NetworkUtils.NetState.NET_2G -> return "2G"
NetworkUtils.NetState.NET_UNKNOWN -> return "UNKNOWN"
NetworkUtils.NetState.NET_NO -> return "__"
else -> return "__"
}
}
/**
......
package com.ccwangluo.accelerator.utils
import java.text.SimpleDateFormat
import java.util.*
object TimeUtils {
/*
* 将时间转换为时间戳
*/
fun dateToStamp(s: String?): Long {
val res: String
val simpleDateFormat = SimpleDateFormat("yyyy-MM-dd")
val date: Date = simpleDateFormat.parse(s)
val ts: Long = date.getTime()
return ts
}
}
\ No newline at end of file
package com.ccwangluo.accelerator.utils.http
object HttpConfig {
val baseUrl = "http://10.16.1.98:9002/api"
val UI_MAIN_URL = "http:wwww.baidu.com"
//app后端
val baseUrl = "http://test-cc-tt-api.orangenet.org.cn"
/**
* 主页h5
*/
val UI_MAIN_URL = "http://test-cc-tt-front.orangenet.org.cn/#"
//隐私协议地址
val privacy_url = "http:wwww.baidu.com"
......
package com.ccwangluo.accelerator.utils.http
import android.util.Log
import com.ccwangluo.accelerator.model.BaseModel
import com.ccwangluo.accelerator.utils.LoginUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.hjq.toast.ToastUtils
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
import timber.log.Timber
import java.io.IOException
import java.security.SecureRandom
import java.security.cert.X509Certificate
import java.util.concurrent.TimeUnit
import java.util.logging.Logger
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.X509TrustManager
......@@ -20,6 +24,8 @@ object HttpGo {
val okHttpClient: OkHttpClient
val gson: Gson
val TAG = HttpGo::class.java.name
init {
okHttpClient = OkHttpClient().newBuilder()
.readTimeout(60, TimeUnit.SECONDS)//设置读取超时时间
......@@ -37,48 +43,35 @@ object HttpGo {
return okHttpClient;
}
inline fun <reified T> getSync(url: String): T? {
val request: Request = Request.Builder()
.url(HttpConfig.baseUrl + url)
.get()
.build()
val call = okHttpClient.newCall(request)
val response: Response = call.execute()
if (response.isSuccessful) {
return gson.fromJson(response.body?.string(), T::class.java)
} else {
inline fun <reified T> getSync(url: String): BaseModel<T>? {
try {
val request = Request.Builder()
.url(HttpConfig.baseUrl + url)
.get()
LoginUtils.token?.let {
request.addHeader("Authorization", it)
}
Timber.i(request.toString())
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(string.toString())
return gson.fromJson(string, type)
} else {
ToastUtils.show("网络错误")
}
} catch (e: java.lang.Exception) {
ToastUtils.show("网络错误")
return null
}
return null
}
val jsonType get() = "application/json; charset=utf-8".toMediaTypeOrNull()
/**
* 异步请求
*/
inline fun <reified T> postASync(
url: String,
param: MutableMap<String, String>,
crossinline callback: (T) -> Unit
) {
val body: RequestBody = gson.toJson(param).toString().toRequestBody(jsonType)
val request: Request = Request.Builder()
.url(HttpConfig.baseUrl + url)
.post(body)
.build()
val call = okHttpClient.newCall(request)
call.enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
ToastUtils.show("网络错误")
}
override fun onResponse(call: Call, response: Response) {
callback(gson.fromJson(response.body?.string(), T::class.java))
}
})
}
/**
* 同步请求
......@@ -86,20 +79,22 @@ object HttpGo {
inline fun <reified T> postSync(url: String, param: MutableMap<String, String>): BaseModel<T>? {
try {
val body: RequestBody = gson.toJson(param).toString().toRequestBody(jsonType)
val request: Request = Request.Builder()
val request = Request.Builder()
.url(HttpConfig.baseUrl + url)
.post(body)
.build()
val call = okHttpClient.newCall(request)
LoginUtils.token?.let {
request.addHeader("Authorization", it)
}
Timber.i(request.toString())
val call = okHttpClient.newCall(request.build())
val response: Response = call.execute()
if (response.isSuccessful) {
val string = response.body?.string()
println(string)
Timber.i(string.toString())
val type = object : TypeToken<BaseModel<T>>() {}.type
return gson.fromJson(string, type)
}
} catch (e : java.lang.Exception){
println(e)
} catch (e: java.lang.Exception) {
ToastUtils.show("网络错误")
}
return null
......
......@@ -57,6 +57,7 @@
app:xui_radius="10dp">
<EditText
android:focusable="true"
android:id="@+id/phone_et"
android:layout_width="match_parent"
android:layout_height="30dp"
......@@ -92,6 +93,7 @@
app:xui_radius="10dp">
<EditText
android:focusable="true"
android:id="@+id/auth_code_et"
android:layout_width="match_parent"
android:layout_height="30dp"
......
......@@ -7,6 +7,7 @@
android:layout_height="match_parent">
<FrameLayout
android:layout_marginTop="36dp"
android:id="@+id/mine_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
......
......@@ -49,10 +49,12 @@
<com.xuexiang.xui.widget.button.roundbutton.RoundButton
android:id="@+id/icon_notice_badge"
android:layout_width="4dp"
android:visibility="gone"
android:layout_alignParentEnd="true"
android:layout_height="4dp"
app:rb_radius="4dp"
app:rb_backgroundColor="@color/red"/>
<ImageView
android:layout_width="19dp"
android:layout_height="21dp"
......@@ -269,6 +271,7 @@
android:textSize="13sp" />
<TextView
android:id="@+id/active_network"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
......@@ -318,6 +321,7 @@
android:textSize="13sp" />
<TextView
android:id="@+id/smart_acc_open"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
......@@ -531,6 +535,7 @@
</LinearLayout>
<com.xuexiang.xui.widget.button.roundbutton.RoundButton
android:id="@+id/smart_acc_open_btn"
android:layout_width="70dp"
android:layout_height="25dp"
android:gravity="center"
......
<?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="match_parent">
<ImageView
android:layout_width="match_parent"
android:background="@mipmap/splash"
android:layout_height="match_parent"/>
</LinearLayout>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:orientation="vertical">
<FrameLayout
android:layout_marginTop="36dp"
android:id="@+id/common_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:background="@color/white"
android:layout_marginRight="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_marginTop="16.5dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<ImageView
android:layout_width="36dp"
android:layout_gravity="center_vertical"
android:layout_height="36dp"/>
<LinearLayout
android:layout_marginLeft="10dp"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_width="70.5dp"
android:layout_height="20dp"
android:text="DNF小管家"
android:textColor="#FF000000"
android:textSize="14sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2020-12-12"
android:textColor="#FFB4B4B4"
android:textSize="11sp"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_marginTop="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="DNF合金战士怎么还没出?智慧的引导和奥兹玛怎么进?"
android:textColor="#FF000000"
android:textSize="14sp"/>
<TextView
android:visibility="gone"
android:layout_marginTop="6dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="DNF合金战士怎么还没出?智慧的引导和奥兹玛怎么进?智慧的引导和奥兹玛怎么进?智慧的引导和奥兹玛怎么进…"
android:textColor="#FF4A4A4A"
android:textSize="14sp"
/>
<ImageView
android:visibility="gone"
android:layout_marginTop="12.65dp"
android:layout_width="match_parent"
android:layout_height="182.5dp"/>
<VideoView
android:layout_marginTop="12.65dp"
android:layout_width="match_parent"
android:layout_height="182.5dp"/>
<RelativeLayout
android:layout_marginTop="11dp"
android:layout_width="match_parent"
android:layout_marginBottom="11dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="57.5dp"
android:layout_height="15dp"
android:text="1502次浏览"
android:textColor="#FFB4B4B4"
android:textSize="11sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="16"
android:gravity="center_vertical"
android:layout_alignParentRight="true"
android:layout_marginRight="18.5dp"
android:textColor="#FFBBBBBB"
android:textSize="14sp"
/>
<ImageView
android:layout_alignParentRight="true"
android:layout_width="14dp"
android:layout_centerVertical="true"
android:layout_height="14dp"
android:background="@mipmap/icon_praise_ga"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
......@@ -14,4 +14,7 @@
<color name="transparent">#00000000</color>
<color name="red">#FFFF0000</color>
<color name="open_acc_enable">#45D2D8</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">cc_quickly</string>
<string name="app_name">TT加速器</string>
<string name="title_activity_main">MainActivity</string>
<string name="title_home">Home</string>
<string name="title_dashboard">Dashboard</string>
......
......@@ -25,9 +25,9 @@
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<!-- <item name="android:background">@mipmap/splash</item>-->
<item name="android:windowBackground">@mipmap/splash</item>
<item name="android:windowBackground">@mipmap/win_bg</item>
<item name="android:windowDisablePreview">true</item>
<item name="xui_config_splash_app_logo">@mipmap/tt_logo</item>
<!-- <item name="xui_config_splash_app_logo">@mipmap/tt_logo</item>-->
<item name="xpage_actionbar_background">@null</item>
<!--标题栏的背景颜色-->
<item name="xpage_actionbar_color">@color/white</item>
......
......@@ -16,7 +16,7 @@ buildscript {
dependencies {
val kotlinVersion = rootProject.extra["kotlinVersion"].toString()
classpath(rootProject.extra["androidPlugin"].toString())
classpath(kotlin("gradle-plugin", kotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
classpath("com.google.android.gms:oss-licenses-plugin:0.10.4")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
classpath("com.google.gms:google-services:4.3.8")
......
......@@ -56,8 +56,8 @@ fun Project.setupCore() {
setupCommon()
android.apply {
defaultConfig {
versionCode = 5020550
versionName = "5.2.5-nightly"
versionCode = 1
versionName = "1.0.0"
}
compileOptions.isCoreLibraryDesugaringEnabled = true
lintOptions {
......
......@@ -74,9 +74,9 @@ class ServiceNotification(private val service: BaseService.Interface, profileNam
.setWhen(0)
.setColor(ContextCompat.getColor(service, R.color.material_primary_500))
.setTicker(service.getString(R.string.forward_success))
.setContentTitle(profileName)
.setContentTitle("TT加速器")
.setContentIntent(Core.configureIntent(service))
.setSmallIcon(R.drawable.ic_service_active)
.setSmallIcon(R.mipmap.tt_logo)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
.setPriority(if (visible) NotificationCompat.PRIORITY_LOW else NotificationCompat.PRIORITY_MIN)
......
......@@ -11,4 +11,5 @@ repositories {
maven { url = uri("https://repo1.maven.org/maven2/") }
google()
jcenter()
mavenCentral()
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment