一键连删除冗余类 合并主分支代码
This commit is contained in:
parent
d9d32a31a6
commit
e6290145e9
|
|
@ -94,9 +94,6 @@
|
|||
android:name=".act.ChangePwdActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.ResetPwdActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.RegisterActivity"
|
||||
android:process=":background"
|
||||
|
|
@ -145,18 +142,10 @@
|
|||
android:name=".act.SettingActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.ProxyModeActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.ChangeNodeActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.ChangeNodeTzActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.ForGetPwdActivity"
|
||||
android:process=":background"
|
||||
|
|
@ -165,24 +154,17 @@
|
|||
android:name=".act.ActivityActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".act.LossPreventionActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".act.UIMainActivity"
|
||||
<activity android:name=".act.NewMainActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity
|
||||
android:name=".act.ConnectionModeActivity"
|
||||
android:process=":background"
|
||||
android:name=".act.LossPreventionActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".act.MemberRechargeActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait"
|
||||
/>
|
||||
<activity
|
||||
android:name=".fragment.recharge.BackupRechargeActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name=".act.MineInfoActivity"
|
||||
android:process=":background"
|
||||
android:screenOrientation="portrait"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class ActivityActivity : BaseActivity() {
|
|||
private lateinit var expensesRecordRv: RecyclerView
|
||||
private lateinit var getActivityAdapter: GetActivityAdapter
|
||||
private lateinit var aiBack: AppCompatImageView
|
||||
private val mPageInfo = PageInfo()
|
||||
private val mPageInfo = ExpensesRecordActivity.PageInfo()
|
||||
|
||||
companion object {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import com.yingmao.clash.net.http.NetService
|
|||
|
||||
class ActivityAtyVM : PublicViewMode() {
|
||||
|
||||
fun getActivity(mPageInfo: PageInfo) {
|
||||
fun getActivity(mPageInfo: ExpensesRecordActivity.PageInfo) {
|
||||
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
|
||||
val username =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")!!
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import com.google.gson.JsonParser
|
|||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.BuildConfig
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.ProxyModeActivity.ProxyMode
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.clashBinder
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.newUuid
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.profileBinder
|
||||
|
|
@ -595,4 +594,7 @@ class ChangeNodeActivity : BaseActivity(), View.OnClickListener {
|
|||
var oldUrl = nowSubUrl
|
||||
currentHost?.let { changeSubUrl(oldUrl, it) }
|
||||
}
|
||||
enum class ProxyMode {
|
||||
PAC, GLOBAL, PACKAGE
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,605 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonParser
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
import com.cncat.vpn.common.constants.Intents
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.conf.Conf
|
||||
import com.yingmao.clash.entity.ClashNodebBean
|
||||
import com.yingmao.clash.remote.Resource
|
||||
import com.cncat.vpn.service.model.Profile
|
||||
import com.cncat.vpn.service.remote.IProfileManager
|
||||
import com.cncat.vpn.service.remote.IRemoteService
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.fragment.home.HomeFragment
|
||||
import com.yingmao.clash.util.Utils
|
||||
import com.yingmao.clash.view.RxToast
|
||||
import com.yingmao.clash.view.adapter.NodeListAdapter
|
||||
import com.yingmao.clash.view.adapter.NodeTzListAdapter
|
||||
import com.yingmao.clash.view.dialog.DialogDoMainChoose
|
||||
import com.yingmao.clash.view.dialog.DialogSureRestartChoose
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.sync.Semaphore
|
||||
import kotlinx.coroutines.sync.withPermit
|
||||
import java.util.Timer
|
||||
import java.util.TimerTask
|
||||
import java.util.UUID
|
||||
|
||||
class ChangeNodeTzActivity : BaseActivity(), View.OnClickListener {
|
||||
|
||||
companion object {
|
||||
private var currentNode: MutableList<ClashNodebBean> = mutableListOf()
|
||||
|
||||
// var clash: ClashManager? = null
|
||||
}
|
||||
|
||||
private lateinit var swipeLayout: SwipeRefreshLayout
|
||||
private lateinit var changeNodeVM: ChangeNodeVM
|
||||
private lateinit var nodeListRv: RecyclerView
|
||||
private var names: List<String>? = null
|
||||
private lateinit var aiBack: AppCompatImageView
|
||||
private var broadcastReceiver: BroadcastReceiver? = null
|
||||
private var cacheNodeStr: String? = ""
|
||||
|
||||
// private var checkedNode: ClashNodebBean? = null
|
||||
private var uuid: UUID? = null
|
||||
|
||||
private var testRuning = false
|
||||
// var cprofile: ProfileManager? = null
|
||||
// private var currentNode: Profile? = null
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_change_node)
|
||||
setMoreBar("线路测速", this)
|
||||
changeNodeVM = ViewModelProvider(this).get(ChangeNodeVM::class.java)
|
||||
initData()
|
||||
initViews()
|
||||
|
||||
// cprofile = ProfileManager(this)
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
intent.putExtra(BZYConstants.EXTRA_KEY_IS_RUNING, is_runing)
|
||||
setResult(HomeFragment.CHECK_NODE_RESULT_CODE, intent)
|
||||
super.onBackPressed()
|
||||
}
|
||||
|
||||
private fun initData() {
|
||||
// clash = MainApplication.getApp()?.let { ClashManager(it) }
|
||||
cacheNodeStr = MMKV.defaultMMKV().decodeString(BZYConstants.NODE_All_ITEM_NAME_KEY, "");
|
||||
|
||||
val intentFilter = IntentFilter(Intents.ACTION_NODE_LIST)
|
||||
broadcastReceiver = NodeListBR()
|
||||
if (Build.VERSION.SDK_INT >= 34 && applicationInfo.targetSdkVersion >= 34) {
|
||||
registerReceiver(
|
||||
broadcastReceiver,
|
||||
intentFilter,
|
||||
Context.RECEIVER_EXPORTED
|
||||
)
|
||||
} else {
|
||||
registerReceiver(
|
||||
broadcastReceiver,
|
||||
intentFilter
|
||||
)
|
||||
}
|
||||
// registerReceiver(
|
||||
// broadcastReceiver,
|
||||
// intentFilter
|
||||
// )
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun initViews() {
|
||||
aiBack = findViewById(R.id.aiBack)
|
||||
aiBack.setOnClickListener {
|
||||
onBackPressed()
|
||||
}
|
||||
swipeLayout = findViewById(R.id.swipeLayout)
|
||||
initRefreshLayout()
|
||||
nodeListRv = findViewById(R.id.rv_node_list)
|
||||
var userTrafficTv: TextView = findViewById(R.id.node_user_traffic)
|
||||
|
||||
findViewById<ImageView>(R.id.iv_back).setOnClickListener {
|
||||
onBackPressed()
|
||||
}
|
||||
initAdapter()
|
||||
// Log.d("initViews cacheNodeStr==>${cacheNodeStr}")
|
||||
if (!TextUtils.isEmpty(cacheNodeStr)) {
|
||||
currentNode = getNodesInfo(cacheNodeStr!!)
|
||||
setNewData(currentNode)
|
||||
}
|
||||
|
||||
// if (!TextUtils.isEmpty(serStore.userTraffic)) {
|
||||
// userTrafficTv.visibility=View.VISIBLE
|
||||
// var jo = JsonParser.parseString(serStore.userTraffic).asJsonObject
|
||||
// var t = jo.get("total")
|
||||
// var d = jo.get("download").asLong
|
||||
// var u = jo.get("upload").asLong
|
||||
// val trafficUsedInGB = String.format("%.2f", (d + u) / 1024.0 / 1024.0 / 1024.0)
|
||||
// userTrafficTv.text="已用流量:${trafficUsedInGB}GB"
|
||||
// }
|
||||
}
|
||||
|
||||
private fun getNodesInfo(json: String): MutableList<ClashNodebBean> {
|
||||
var mList: MutableList<ClashNodebBean> = mutableListOf()
|
||||
if (TextUtils.isEmpty(json)) {
|
||||
return mList
|
||||
}
|
||||
val gson = Gson()
|
||||
var ja = JsonParser.parseString(json).asJsonArray
|
||||
|
||||
var cnb = ClashNodebBean("自动选择", "", "", 1, "", "", 0, true);
|
||||
mList.add(cnb)
|
||||
for (i in 0 until ja.size()) {
|
||||
var bean = gson.fromJson(ja.get(i).asString, ClashNodebBean::class.java)
|
||||
bean.delay = Utils.generateRandomTwoDigitNumber(10, 60)
|
||||
mList.add(bean)
|
||||
}
|
||||
return mList
|
||||
}
|
||||
|
||||
inner class NodeListBR : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
Intents.ACTION_NODE_LIST -> {
|
||||
Log.d("ACTION_NODE_LIST ACTION_NODE_LIST")
|
||||
// val parcelableArrayListExtra = intent.getParcelableArrayListExtra<Map<String,Any>>("")
|
||||
hideLoading()
|
||||
// stopTimer()
|
||||
timerJob?.cancel()
|
||||
dialogDoMainChoose?.dismiss()
|
||||
// var json = intent.getStringExtra("node_list")
|
||||
// Log.d("onReceive: $json")
|
||||
// currNodeJsonA = json
|
||||
var json = serStore.nodes
|
||||
// Log.d("serStore.nodes: $json")
|
||||
if (TextUtils.isEmpty(json)) {
|
||||
return
|
||||
}
|
||||
//缓存订阅地址
|
||||
UIMainActivity.subUrl = nowSubUrl
|
||||
MMKV.defaultMMKV().encode(BZYConstants.PROFILE_SUB_URL, nowSubUrl)
|
||||
//缓存节点
|
||||
MMKV.defaultMMKV().encode(BZYConstants.NODE_All_ITEM_NAME_KEY, json)
|
||||
currentNode = getNodesInfo(json)
|
||||
// val listType = object : TypeToken<MutableList<ClashNodebBean>>() {}.type
|
||||
// currentNode = gson.fromJson(json, listType)
|
||||
setNewData(currentNode)
|
||||
swipeLayout.isRefreshing = false
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
broadcastReceiver?.let {
|
||||
unregisterReceiver(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
// uuid = intent.getStringExtra(BZYConstants.MMKV_KEY_CURRENT_NODE)
|
||||
// com.cncat.vpn.common.log.Log.d("ChangeNode uuid==>$uuid")
|
||||
is_runing = intent.getBooleanExtra(BZYConstants.EXTRA_KEY_IS_RUNING, false)
|
||||
}
|
||||
|
||||
val remote = Resource<IRemoteService>()
|
||||
var GetNodeTimeOutNum = 5;
|
||||
var is_runing = false
|
||||
private var timer: Timer? = null
|
||||
private var timerTask: TimerTask? = null
|
||||
var nowSubUrl: String = ""
|
||||
private fun updateProfile(isDelete: Boolean) {
|
||||
// showLoading("正在获取...", this@ChangeNodeActivity)
|
||||
|
||||
try {
|
||||
|
||||
|
||||
launch(Dispatchers.IO) {
|
||||
UIMainActivity.profileBinder?.let { profileManager ->
|
||||
var mProfile = profileManager.queryAll().find {
|
||||
it.name == Conf.getClashConfName(this@ChangeNodeTzActivity.applicationContext)
|
||||
}
|
||||
|
||||
if (mProfile == null) {
|
||||
//为空的情况下选择第一个
|
||||
profileManager.queryAll().forEach { profile ->
|
||||
mProfile = profile
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
|
||||
mProfile?.let { profile ->
|
||||
uuid = profile.uuid
|
||||
Log.d("ChangeNode22 uuid==>${profile.uuid}")
|
||||
if (isDelete) {
|
||||
Log.d("gogogogogo isDelete")
|
||||
profileManager.delete(profile.uuid)
|
||||
MMKV.defaultMMKV()
|
||||
.removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
|
||||
setSub2(profileManager, nowSubUrl)
|
||||
} else {
|
||||
Log.d("gogogogogo update")
|
||||
profileManager.setActive(profile)
|
||||
delay(500)
|
||||
if (!TextUtils.isEmpty(profile.source)) {
|
||||
// Log.d("updateProfile pro.source==>${profile.source}, url==>${nowSubUrl}")
|
||||
if (profile.source != nowSubUrl) {
|
||||
Log.d("updateProfile patch")
|
||||
profileManager.patch(
|
||||
profile.uuid,
|
||||
profile.name,
|
||||
nowSubUrl,
|
||||
1800000L
|
||||
)
|
||||
Log.d("updateProfile patch 1")
|
||||
profileManager.commit(profile.uuid) { status ->
|
||||
Log.d("updateProfile updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress)
|
||||
}
|
||||
Log.d("updateProfile patch 2")
|
||||
}
|
||||
}
|
||||
Log.d("updateProfile go update")
|
||||
profileManager.update(profile.uuid)
|
||||
}
|
||||
Log.d("gogogogogo end")
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initRefreshLayout() {
|
||||
swipeLayout.setColorSchemeColors(Color.rgb(47, 223, 189))
|
||||
swipeLayout.setOnRefreshListener(object : OnRefreshListener {
|
||||
override fun onRefresh() {
|
||||
if (testRuning) {
|
||||
RxToast.info("正在测速中.");
|
||||
swipeLayout.isRefreshing = false
|
||||
return
|
||||
}
|
||||
com.cncat.vpn.common.log.Log.d("onRefresh")
|
||||
// getNodesStatus();
|
||||
// changeNodeVM.getAirNodes()
|
||||
swipeLayout.isRefreshing = true
|
||||
updateProfile(false)
|
||||
com.cncat.vpn.common.log.Log.d("onRefresh end")
|
||||
swipeLayout.isRefreshing = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
UIMainActivity.subUrl?.let {
|
||||
nowSubUrl = it
|
||||
}
|
||||
doProfile()
|
||||
|
||||
}
|
||||
|
||||
fun doProfile() {
|
||||
if (TextUtils.isEmpty(cacheNodeStr)) {
|
||||
|
||||
}
|
||||
showLoading("正在获取...", this@ChangeNodeTzActivity)
|
||||
startTimer()
|
||||
updateProfile(false)
|
||||
|
||||
}
|
||||
|
||||
private fun changeSubUrl(originalUrl: String, newUrl: String) {
|
||||
if(!originalUrl.isNullOrEmpty()&&!newUrl.isNullOrEmpty()){
|
||||
nowSubUrl = originalUrl.replace(Regex("https://[^/]+/"), "$newUrl/")
|
||||
MMKV.defaultMMKV().encode(BZYConstants.PROFILE_SUB_URL, nowSubUrl)
|
||||
}
|
||||
}
|
||||
|
||||
val reloadLock = Semaphore(10)
|
||||
private fun setPing() {
|
||||
if (!HomeFragment.clashRunning) {
|
||||
RxToast.info("请先开启加速后,再进行测试.");
|
||||
return
|
||||
}
|
||||
if (testRuning) {
|
||||
RxToast.info("正在测速中.");
|
||||
return
|
||||
}
|
||||
testRuning = true
|
||||
updateMoreBar("测速中")
|
||||
launch(Dispatchers.IO) {
|
||||
var group = reloadLock.withPermit {
|
||||
UIMainActivity.clashBinder?.let { cb ->
|
||||
var names = cb.queryProxyGroupNames(false)
|
||||
if (names.isNotEmpty()) {
|
||||
cb.healthCheck(names[0])
|
||||
}
|
||||
delay(1000)
|
||||
cb.queryProxyGroup(names[0], uiStore.proxySort);
|
||||
}
|
||||
}
|
||||
testRuning = false
|
||||
runOnUiThread { updateMoreBar("线路测速") }
|
||||
var newDatas = mutableListOf<ClashNodebBean>();
|
||||
group?.proxies?.forEach { proxy ->
|
||||
Log.d("node==>${proxy}")
|
||||
if (currentNode?.isNotEmpty() == true) {
|
||||
for (nodeItem: ClashNodebBean in currentNode!!) {
|
||||
if (nodeItem.name == proxy.name) {
|
||||
if (proxy.name != "自动选择") {
|
||||
nodeItem.delay = proxy.delay;
|
||||
}
|
||||
Log.d("nodeItem==>${nodeItem}")
|
||||
newDatas.add(nodeItem)
|
||||
return@forEach
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newDatas.isNotEmpty()) {
|
||||
setNewData(newDatas)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun setNewData(nodes: MutableList<ClashNodebBean>?) {
|
||||
runOnUiThread {
|
||||
if (nodes != null) {
|
||||
nodeListAdapter.setNewInstance(nodes)
|
||||
var selected_name =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.NODE_SELECTED_NAME_KEY, "");
|
||||
for ((index, node) in nodes.withIndex()) {
|
||||
if (node.name == selected_name) {
|
||||
nodeListAdapter.selectedPosition = index
|
||||
// checkedNode = node
|
||||
}
|
||||
}
|
||||
nodeListAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nodeListAdapter: NodeTzListAdapter = NodeTzListAdapter(R.layout.node_tz_list_item_layout)
|
||||
private fun initAdapter() {
|
||||
nodeListRv.layoutManager = LinearLayoutManager(this)
|
||||
nodeListRv.adapter = nodeListAdapter
|
||||
nodeListAdapter.selectedPosition
|
||||
nodeListAdapter.setOnItemClickListener { baseQuickAdapter: BaseQuickAdapter<*, *>, view: View, position: Int ->
|
||||
(baseQuickAdapter.getItem(position) as ClashNodebBean).let { profile ->
|
||||
com.cncat.vpn.common.log.Log.i("select_node : ${profile.name}")
|
||||
// checkedNode = profile
|
||||
MMKV.defaultMMKV().encode(BZYConstants.NODE_SELECTED_NAME_KEY, profile.name)
|
||||
nodeListAdapter.notifyItemChanged(nodeListAdapter.selectedPosition)
|
||||
nodeListAdapter.selectedPosition =
|
||||
if (nodeListAdapter.selectedPosition == position) -1 else position
|
||||
nodeListAdapter.notifyItemChanged(position)
|
||||
// launch {
|
||||
// withClash {
|
||||
// val names = queryProxyGroupNames(false)
|
||||
// val mode = queryOverride(Clash.OverrideSlot.Session).mode
|
||||
// com.cncat.vpn.common.log.Log.d("names 222==>${names}, mode==>$mode")
|
||||
// names?.let { ns ->
|
||||
// if (ns.isNotEmpty()) {
|
||||
// patchSelector(ns[0], profile.name)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
launch(Dispatchers.IO) {
|
||||
val intent = Intent()
|
||||
intent.putExtra(BZYConstants.MMKV_KEY_SELECT_NODE_NAME, "自动选择")
|
||||
intent.putExtra(BZYConstants.EXTRA_KEY_IS_RUNING, is_runing)
|
||||
setResult(HomeFragment.CHECK_NODE_RESULT_CODE, intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createProfile() {
|
||||
launch(Dispatchers.IO) {
|
||||
UIMainActivity.profileBinder?.let { pro ->
|
||||
uuid?.let { uu ->
|
||||
pro.delete(uu)
|
||||
delay(500)
|
||||
setSub2(pro, UIMainActivity.subUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public suspend fun setSub2(pm: IProfileManager, url: String?) {
|
||||
// com.cncat.vpn.common.log.Log.d("setSub2.... url==>$url")
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
com.cncat.vpn.common.log.Log.d("setSub2 url isEmpty")
|
||||
return
|
||||
}
|
||||
|
||||
com.cncat.vpn.common.log.Log.d("setSub2 2")
|
||||
|
||||
|
||||
com.cncat.vpn.common.log.Log.d("setSub2 3")
|
||||
val pro = pm.queryAll().find {
|
||||
it.name == Conf.getClashConfName(this@ChangeNodeTzActivity.applicationContext)
|
||||
}
|
||||
com.cncat.vpn.common.log.Log.d("setSub2 4")
|
||||
pro?.let {
|
||||
com.cncat.vpn.common.log.Log.d("setSub2 pro 已存在 ==>")
|
||||
// pm.setActive(it)
|
||||
|
||||
com.cncat.vpn.common.log.Log.d("setSub2 setActive end")
|
||||
} ?: run {
|
||||
var uuid: UUID = pm.create(
|
||||
Profile.Type.Url,
|
||||
Conf.getClashConfName(this@ChangeNodeTzActivity.applicationContext)
|
||||
)
|
||||
delay(500)
|
||||
pm.queryByUUID(uuid)?.let { qPro ->
|
||||
pm.setActive(qPro)
|
||||
pm.patch(
|
||||
qPro.uuid, qPro.name,
|
||||
// "https://mojie0201.xn--8stx8olrwkucjq3b.com/api/v1/client/subscribe?token=169110d2674c49604b7e5b5cea341579",
|
||||
// "https://www.otcopusapp.cc/lx3af288h5i8pz380/api/v1/client/subscribe?token=d6bc98c7ea53099fa5bd1a3ea415ebb6",
|
||||
url!!,
|
||||
1800000L
|
||||
)
|
||||
// coroutineScope {
|
||||
pm.commit(qPro.uuid) { status ->
|
||||
android.util.Log.d(
|
||||
Conf.TAG,
|
||||
"new updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress
|
||||
)
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isCreate: Boolean = false
|
||||
private var timerJob: Job? = null
|
||||
private fun startTimer() {
|
||||
GetNodeTimeOutNum = 15
|
||||
timerJob = launch {
|
||||
repeat(16) {
|
||||
Log.d("GetNodeTimeOutNum==>$GetNodeTimeOutNum")
|
||||
if (GetNodeTimeOutNum == 0) {
|
||||
hideLoading()
|
||||
Log.d("stopTimer...")
|
||||
RxToast.error("获取节点失败...请尝试切换其他地址")
|
||||
showDomainList()
|
||||
timerJob?.cancel()
|
||||
// delay(1000)
|
||||
// this@ChangeNodeActivity.finish()
|
||||
|
||||
}
|
||||
GetNodeTimeOutNum--
|
||||
delay(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var dialogDoMainChoose: DialogDoMainChoose? = null
|
||||
private fun showDomainList() {
|
||||
try {
|
||||
SplashHelper(changeNodeVM).getHostWithFallback { success ->
|
||||
MainScope().launch {
|
||||
|
||||
if (success) {
|
||||
if (dialogDoMainChoose == null) {
|
||||
dialogDoMainChoose = DialogDoMainChoose(this@ChangeNodeTzActivity)
|
||||
}
|
||||
if (dialogDoMainChoose?.isShowing == false) {
|
||||
dialogDoMainChoose?.setOnTryButtonListener(object :
|
||||
DialogDoMainChoose.OnTryButtonListener {
|
||||
override fun tryButton() {
|
||||
saveSubUrl()
|
||||
doProfile()
|
||||
dialogDoMainChoose?.dismiss()
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
com.cncat.vpn.common.log.Log.d("tryButton CHECK_LOGIN cancel")
|
||||
|
||||
dialogDoMainChoose?.dismiss()
|
||||
}
|
||||
})
|
||||
dialogDoMainChoose?.setOnListItemListener(object :
|
||||
DialogDoMainChoose.OnListItemListener {
|
||||
override fun listItemClick() {
|
||||
saveSubUrl()
|
||||
MainApplication.restartApp(this@ChangeNodeTzActivity, object :
|
||||
MainApplication.OnRestartButtonListener {
|
||||
|
||||
override fun enterButton() {
|
||||
|
||||
}
|
||||
|
||||
override fun cancelButton() {
|
||||
doProfile()
|
||||
dialogDoMainChoose?.dismiss()
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
dialogDoMainChoose?.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun saveSubUrl() {
|
||||
var currentHost = MMKV.defaultMMKV()
|
||||
.decodeString(BZYConstants.MMKV_KEY_CURRENT_HOST, "")
|
||||
// com.cncat.vpn.common.log.Log.d("tryButton currentHost==>${currentHost}")
|
||||
var oldUrl = nowSubUrl
|
||||
currentHost?.let { changeSubUrl(oldUrl, it) }
|
||||
}
|
||||
|
||||
private fun stopTimer() {
|
||||
timerTask?.cancel()
|
||||
timer?.purge()
|
||||
timer?.cancel()
|
||||
timerTask = null
|
||||
timer = null
|
||||
}
|
||||
|
||||
override fun onClick(p0: View?) {
|
||||
when (p0?.id) {
|
||||
R.id.tv_more -> {
|
||||
setPing()
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -78,8 +78,6 @@ class ChangePwdActivity : BaseActivity() {
|
|||
}
|
||||
if(newPassword == originalPassword){
|
||||
RxToast.error(resources.getString(R.string.PasswordSame))
|
||||
// getFocusAndShowSoftInput(newPasswordEt)
|
||||
// newPasswordEt.text.clear()
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,206 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.ViewGroup.LayoutParams
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.cncat.vpn.common.constants.Intents
|
||||
import com.cncat.vpn.service.model.AccessControlMode
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.fragment.home.HomeFragment
|
||||
import com.yingmao.clash.view.RxToast
|
||||
import com.yingmao.clash.view.popwindow.CommonPopupWindow
|
||||
|
||||
class ConnectionModeActivity : BaseActivity() {
|
||||
private var proxyModeAtyVM: ProxyModeAtyVM? = null
|
||||
private lateinit var cardIntelligentModeSelect: ConstraintLayout
|
||||
private lateinit var clGlobalMode: ConstraintLayout
|
||||
private lateinit var clApplicationMode:ConstraintLayout
|
||||
private lateinit var clAccessControlApplication:ConstraintLayout
|
||||
private lateinit var tbApplicationMode:TextView
|
||||
private var popupWindow: CommonPopupWindow? = null
|
||||
private var layoutGravity: CommonPopupWindow.LayoutGravity? = null
|
||||
private lateinit var aiIntelligentModeSelect: AppCompatImageView
|
||||
private lateinit var aiGlobalMode: AppCompatImageView
|
||||
private lateinit var aiBack:AppCompatImageView
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.connection_mode_layout)
|
||||
proxyModeAtyVM = ViewModelProvider(this)[ProxyModeAtyVM::class.java]
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
cardIntelligentModeSelect=findViewById(R.id.cardIntelligentModeSelect)
|
||||
clGlobalMode=findViewById(R.id.clGlobalMode)
|
||||
aiIntelligentModeSelect=findViewById(R.id.aiIntelligentModeSelect)
|
||||
aiGlobalMode=findViewById(R.id.aiGlobalMode)
|
||||
clApplicationMode=findViewById(R.id.clApplicationMode)
|
||||
clAccessControlApplication=findViewById(R.id.clAccessControlApplication)
|
||||
tbApplicationMode=findViewById(R.id.tbApplicationMode)
|
||||
aiBack=findViewById(R.id.aiBack)
|
||||
aiBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
val isGlobal = MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
val px: ProxyMode = if (isGlobal) {
|
||||
ProxyMode.GLOBAL
|
||||
} else {
|
||||
ProxyMode.PAC
|
||||
}
|
||||
setBackground(px)
|
||||
|
||||
clGlobalMode.setOnClickListener {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_GLOBAL_MODEL, true)
|
||||
setBackground(ProxyMode.GLOBAL)
|
||||
goFinish()
|
||||
}
|
||||
cardIntelligentModeSelect.setOnClickListener {
|
||||
setBackground(ProxyMode.PAC)
|
||||
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
goFinish()
|
||||
}
|
||||
clApplicationMode.setOnClickListener {
|
||||
if (HomeFragment.clashRunning) {
|
||||
RxToast.info("请关闭加速后再选择.")
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
popupWindow = object : CommonPopupWindow(
|
||||
this,
|
||||
R.layout.applicationmode_popwindow_item,
|
||||
500,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
) {
|
||||
override fun initView() {
|
||||
|
||||
val view = getContentView()
|
||||
val allApp = view.findViewById<LinearLayout>(R.id.LLAll)
|
||||
val tvAllApp = view.findViewById<TextView>(R.id.TVAllApp)
|
||||
|
||||
val chooseApp = view.findViewById<LinearLayout>(R.id.LLChoose)
|
||||
val tvChooseApp = view.findViewById<TextView>(R.id.TVChoose)
|
||||
|
||||
val noChooseApp = view.findViewById<LinearLayout>(R.id.LLNoChoose)
|
||||
val tvNoChooseApp = view.findViewById<TextView>(R.id.TVNoChoose)
|
||||
|
||||
val applicationModeStr =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.applicationMode)
|
||||
if (applicationModeStr.isNullOrEmpty()) {
|
||||
allApp.setBackgroundResource(R.color.color_clash)
|
||||
tvAllApp.setTextColor(resources.getColor(R.color.white))
|
||||
} else if (applicationModeStr == "AllApp") {
|
||||
allApp.setBackgroundResource(R.color.color_clash)
|
||||
tvAllApp.setTextColor(resources.getColor(R.color.white))
|
||||
} else if (applicationModeStr == "ChooseApp") {
|
||||
chooseApp.setBackgroundResource(R.color.color_clash)
|
||||
tvChooseApp.setTextColor(resources.getColor(R.color.white))
|
||||
} else if (applicationModeStr == "noChooseApp") {
|
||||
noChooseApp.setBackgroundResource(R.color.color_clash)
|
||||
tvNoChooseApp.setTextColor(resources.getColor(R.color.white))
|
||||
}
|
||||
allApp.setOnClickListener {
|
||||
serStore.accessControlMode = AccessControlMode.AcceptAll
|
||||
MMKV.defaultMMKV().encode(BZYConstants.applicationMode, "AllApp")
|
||||
tbApplicationMode.setText(R.string.allow_all_apps)
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
chooseApp.setOnClickListener {
|
||||
serStore.accessControlMode = AccessControlMode.AcceptSelected
|
||||
MMKV.defaultMMKV().encode(BZYConstants.applicationMode, "ChooseApp")
|
||||
tbApplicationMode.setText(R.string.allow_selected_apps)
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
noChooseApp.setOnClickListener {
|
||||
serStore.accessControlMode = AccessControlMode.DenySelected
|
||||
MMKV.defaultMMKV().encode(BZYConstants.applicationMode, "noChooseApp")
|
||||
tbApplicationMode.setText(R.string.deny_selected_apps)
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
override fun initEvent() {}
|
||||
}
|
||||
layoutGravity =
|
||||
CommonPopupWindow.LayoutGravity(CommonPopupWindow.LayoutGravity.ALIGN_LEFT or CommonPopupWindow.LayoutGravity.TO_BOTTOM)
|
||||
(popupWindow as CommonPopupWindow).showBashOfAnchor(
|
||||
tbApplicationMode,
|
||||
layoutGravity,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
|
||||
clAccessControlApplication.setOnClickListener {
|
||||
startActivity(Intent(this, InstallApplicationActivity::class.java))
|
||||
}
|
||||
|
||||
|
||||
val amStr = MMKV.defaultMMKV().decodeString(BZYConstants.applicationMode, "")
|
||||
if (!amStr.isNullOrEmpty()) {
|
||||
when (amStr) {
|
||||
"" -> {
|
||||
tbApplicationMode.setText(R.string.allow_all_apps)
|
||||
}
|
||||
|
||||
"AllApp" -> {
|
||||
tbApplicationMode.setText(R.string.allow_all_apps)
|
||||
}
|
||||
|
||||
"ChooseApp" -> {
|
||||
tbApplicationMode.setText(R.string.allow_selected_apps)
|
||||
}
|
||||
|
||||
"noChooseApp" -> {
|
||||
tbApplicationMode.setText(R.string.deny_selected_apps)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private fun setBackground(proxyMode: ProxyMode) {
|
||||
when (proxyMode) {
|
||||
ProxyMode.PAC -> {
|
||||
HomeFragment.isGlo = false
|
||||
aiIntelligentModeSelect.isSelected = true
|
||||
aiGlobalMode.isSelected = false
|
||||
sendMode(false)
|
||||
}
|
||||
|
||||
ProxyMode.GLOBAL -> {
|
||||
HomeFragment.isGlo = true
|
||||
aiIntelligentModeSelect.isSelected = false
|
||||
aiGlobalMode.isSelected = true
|
||||
sendMode(true)
|
||||
}
|
||||
else->{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun sendMode(type: Boolean) {
|
||||
val intent = Intent(Intents.ACTION_Glo_Mode)
|
||||
intent.putExtra("mode", type)
|
||||
sendBroadcast(
|
||||
intent.setPackage(this.packageName)
|
||||
)
|
||||
}
|
||||
enum class ProxyMode {
|
||||
PAC, GLOBAL, PACKAGE
|
||||
}
|
||||
private fun goFinish() {
|
||||
val intent = Intent()
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
|
@ -149,18 +149,17 @@ class ExpensesRecordActivity : BaseActivity() {
|
|||
expensesRecordAdapter.loadMoreModule.loadMoreFail()
|
||||
}
|
||||
}
|
||||
class PageInfo {
|
||||
var page = 1
|
||||
fun nextPage() {
|
||||
page++
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
page = 1
|
||||
}
|
||||
|
||||
val isFirstPage: Boolean
|
||||
get() = page == 1
|
||||
}
|
||||
}
|
||||
|
||||
class PageInfo {
|
||||
var page = 1
|
||||
fun nextPage() {
|
||||
page++
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
page = 1
|
||||
}
|
||||
|
||||
val isFirstPage: Boolean
|
||||
get() = page == 1
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import com.yingmao.clash.net.http.HttpReqType
|
|||
import com.yingmao.clash.net.http.NetService
|
||||
|
||||
class ExpensesRecordVM: BaseViewMode() {
|
||||
fun getExpensesRecord(page :PageInfo){
|
||||
fun getExpensesRecord(page : ExpensesRecordActivity.PageInfo){
|
||||
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
|
||||
val username = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME,"")!!
|
||||
val phToken = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_PH_TOKEN,"")!!
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
|
|||
|
||||
companion object {
|
||||
private const val LOGIN_TO_REGISTER_REQUEST_CODE = 1
|
||||
const val REGISTER_TO_LOGIN_RESULT_CODE = 2
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
|
@ -79,8 +78,8 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
|
|||
setContentView(R.layout.layout_activity_login)
|
||||
//点击输入框外边隐藏输入法 必须在setContentView之后调用
|
||||
setupUI(findViewById<ViewGroup>(android.R.id.content).getChildAt(0))
|
||||
loginViewMode = ViewModelProvider(this).get(LoginAtyVM::class.java)
|
||||
splashAtyVM = ViewModelProvider(this).get(SplashAtyVM::class.java)
|
||||
loginViewMode = ViewModelProvider(this)[LoginAtyVM::class.java]
|
||||
splashAtyVM = ViewModelProvider(this)[SplashAtyVM::class.java]
|
||||
observe(this, loginViewMode)
|
||||
initViews()
|
||||
loginViewMode.upgradeVersion()
|
||||
|
|
@ -114,7 +113,6 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
|
|||
override fun httpSuccess(httpStatus: HttpStatus.Success) {
|
||||
super.httpSuccess(httpStatus)
|
||||
if (httpStatus.reqType == HttpReqType.LOGIN) {
|
||||
//LoginRsp(isPointCard=2, code=1000, data=Data(password=123456, phoneNumber=123456, phToken=1351418999069523968, vpnToken=ve3f/wy8iql72kmt1ptuvguh/stk1frhbxqbd7nvk/y=, userId=080743151296), phLogin=PhLogin(needBuy=false, vpn=, mobile=123456), message=登录成功)
|
||||
val rsp = httpStatus.rsp
|
||||
com.cncat.vpn.common.log.Log.d("HttpReqType.LOGIN rsp==>${rsp}")
|
||||
if (rsp is LoginRsp) {
|
||||
|
|
|
|||
|
|
@ -1,499 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.yingmao.clash.R
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonArray
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.act.ChangeNodeActivity.Companion
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.newUuid
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
|
||||
import com.cncat.vpn.common.constants.Intents
|
||||
import com.cncat.vpn.core.Clash
|
||||
import com.cncat.vpn.core.model.ProviderList
|
||||
import com.cncat.vpn.core.model.TunnelState
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.conf.Conf
|
||||
|
||||
import com.yingmao.clash.listener.BaseCallBack
|
||||
import com.yingmao.clash.remote.Remote
|
||||
import com.cncat.vpn.service.ClashManager
|
||||
import com.cncat.vpn.service.ProfileManager
|
||||
|
||||
import com.cncat.vpn.service.model.Profile
|
||||
import com.cncat.vpn.service.remote.IClashManager
|
||||
import com.cncat.vpn.service.remote.IProfileManager
|
||||
import com.cncat.vpn.service.remote.wrap
|
||||
import com.cncat.vpn.service.store.ServiceStore
|
||||
import com.yingmao.clash.util.ActivityResultLifecycle
|
||||
import com.yingmao.clash.util.Utils
|
||||
import com.yingmao.clash.util.startClashService
|
||||
import com.yingmao.clash.util.stopClashService
|
||||
import com.yingmao.clash.util.withClash
|
||||
import com.yingmao.clash.util.withProfile
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.selects.select
|
||||
import kotlinx.coroutines.sync.Semaphore
|
||||
import kotlinx.coroutines.withContext
|
||||
import okhttp3.Response
|
||||
import java.util.*
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.suspendCoroutine
|
||||
|
||||
class MainActivity : BaseActivity() {
|
||||
private val TAG: String = "GG"
|
||||
|
||||
|
||||
// private lateinit var mainActVM: MainActVM
|
||||
private lateinit var username: String
|
||||
|
||||
enum class Event {
|
||||
ServiceRecreated,
|
||||
ActivityStart,
|
||||
ActivityStop,
|
||||
ClashStop,
|
||||
ClashStart,
|
||||
ProfileLoaded,
|
||||
ProfileChanged,
|
||||
ProfileUpdateCompleted,
|
||||
ProfileUpdateFailed,
|
||||
}
|
||||
|
||||
enum class Request {
|
||||
ToggleStatus,
|
||||
OpenProxy,
|
||||
OpenProfiles,
|
||||
OpenProviders,
|
||||
OpenLogs,
|
||||
OpenSettings,
|
||||
OpenHelp,
|
||||
OpenAbout,
|
||||
}
|
||||
|
||||
|
||||
protected val clashRunning: Boolean
|
||||
get() = Remote.broadcasts.clashRunning
|
||||
var clash: ClashManager? = null
|
||||
// private var clashBinder: IClashManager? = null
|
||||
|
||||
var profile: ProfileManager? = null
|
||||
val reloadLock = Semaphore(10)
|
||||
private var clashBinder: IClashManager? = null
|
||||
private var profileBinder: IProfileManager? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.main_act)
|
||||
username = Utils.getUniqueID(this)
|
||||
// mainActVM = ViewModelProvider(this)[MainActVM::class.java]
|
||||
// GlobalScope.launch {
|
||||
clash = ClashManager(this@MainActivity)
|
||||
profile = ProfileManager(this@MainActivity)
|
||||
|
||||
clashBinder = clash?.wrap() as IClashManager?
|
||||
profileBinder = profile?.wrap() as IProfileManager?
|
||||
// }
|
||||
|
||||
findViewById<Button>(R.id.create_url).setOnClickListener {
|
||||
launch(Dispatchers.IO) {
|
||||
createByUrl()
|
||||
}
|
||||
}
|
||||
findViewById<Button>(R.id.query_node).setOnClickListener {
|
||||
queryProxy();
|
||||
}
|
||||
findViewById<Button>(R.id.start_v).setOnClickListener {
|
||||
launch {
|
||||
// withClash {
|
||||
// patchSelector(names[it.index], it.name)
|
||||
// }
|
||||
|
||||
profileBinder?.let { pm ->
|
||||
val active = pm.queryActive()
|
||||
if (active == null) {
|
||||
com.cncat.vpn.common.log.Log.d("startClash: 未选择")
|
||||
val pro = pm.queryAll().find {
|
||||
it.name == Conf.getClashConfName(this@MainActivity.applicationContext)
|
||||
}
|
||||
pro?.let { profile ->
|
||||
com.cncat.vpn.common.log.Log.d("new setactive name " + profile.name)
|
||||
pm.setActive(profile)
|
||||
newUuid = profile.uuid.toString();
|
||||
var selected_name =
|
||||
MMKV.defaultMMKV()
|
||||
.decodeString(BZYConstants.NODE_SELECTED_NAME_KEY, "")
|
||||
|
||||
}
|
||||
delay(500)
|
||||
}
|
||||
}
|
||||
|
||||
if (clashRunning)
|
||||
stopClashService()
|
||||
else
|
||||
startClash()
|
||||
}
|
||||
}
|
||||
findViewById<Button>(R.id.update_but).setOnClickListener {
|
||||
launch(Dispatchers.IO) {
|
||||
|
||||
}
|
||||
}
|
||||
// val routerSet = MMKV.defaultMMKV().decodeStringSet(BZYConstants.MMKV_KEY_ROUTER_HOST)
|
||||
// if (routerSet != null && routerSet.size > 0) {
|
||||
// isNeedRegister()
|
||||
// } else {
|
||||
// getHost()
|
||||
// }
|
||||
fetch()
|
||||
|
||||
val intentFilter = IntentFilter(Intents.ACTION_NODE_LIST)
|
||||
if (Build.VERSION.SDK_INT >= 34 && applicationInfo.targetSdkVersion >= 34) {
|
||||
registerReceiver(
|
||||
NodeListBR(), intentFilter, Context.RECEIVER_EXPORTED
|
||||
)
|
||||
} else {
|
||||
registerReceiver(NodeListBR(), intentFilter)
|
||||
}
|
||||
|
||||
findViewById<Button>(R.id.setmode_auto).setOnClickListener {
|
||||
launch(Dispatchers.IO) {
|
||||
clashBinder?.let { cm ->
|
||||
var state = cm.queryTunnelState()
|
||||
var providers = cm.queryProviders()
|
||||
var providersList = Gson().toJson(providers)
|
||||
com.cncat.vpn.common.log.Log.d("state==>${state}, providers==>{$providersList}")
|
||||
|
||||
val o = cm.queryOverride(Clash.OverrideSlot.Session)
|
||||
o.mode = TunnelState.Mode.Rule
|
||||
cm.patchOverride(Clash.OverrideSlot.Session, o)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
findViewById<Button>(R.id.setmode_globa).setOnClickListener {
|
||||
|
||||
launch(Dispatchers.IO) {
|
||||
clashBinder?.let { cm ->
|
||||
val o = cm.queryOverride(Clash.OverrideSlot.Session)
|
||||
o.mode = TunnelState.Mode.Global
|
||||
cm.patchOverride(Clash.OverrideSlot.Session, o)
|
||||
delay(500)
|
||||
cm.patchSelector("GLOBAL", "日本|中转")
|
||||
}
|
||||
}
|
||||
}
|
||||
findViewById<Button>(R.id.query_mode).setOnClickListener {
|
||||
launch(Dispatchers.IO) {
|
||||
clashBinder?.let { cm ->
|
||||
var state = cm.queryTunnelState()
|
||||
var providers = cm.queryProviders()
|
||||
var providersList = Gson().toJson(providers)
|
||||
com.cncat.vpn.common.log.Log.d("query_mode 333 state==>${state}, providers==>{$providersList}")
|
||||
var names = cm.queryProxyGroupNames(false)
|
||||
if (names.isNotEmpty()) {
|
||||
cm.queryProxyGroup(names.get(0), uiStore.proxySort)?.let { proxyGroup ->
|
||||
var list = proxyGroup.proxies
|
||||
com.cncat.vpn.common.log.Log.d("list==>" + Gson().toJson(list))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NodeListBR : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
Intents.ACTION_NODE_LIST -> {
|
||||
// val parcelableArrayListExtra = intent.getParcelableArrayListExtra<Map<String,Any>>("")
|
||||
var json = intent.getStringExtra("node_list")
|
||||
Log.d(Conf.TAG, "onReceive: $json")
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isNeedRegister() {
|
||||
|
||||
// if (MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_IS_REGISTER, false)) {
|
||||
// splashAtyVM.checkLogin()
|
||||
// } else {
|
||||
// doRegister()
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
private fun queryProxy() {
|
||||
Log.d(TAG, "queryProxy 333: ")
|
||||
launch(Dispatchers.IO) {
|
||||
|
||||
// withClash {
|
||||
// val names = queryProxyGroupNames(false)
|
||||
// Log.d(TAG, "queryProxy: names==>" + Gson().toJson(names))
|
||||
//// val group = reloadLock.withPermit {
|
||||
// if (names?.isNotEmpty() == true) {
|
||||
//// var pg = queryProxyGroup(names[0], uiStore.proxySort);
|
||||
// var pro = queryProviders();
|
||||
//// Log.d(TAG, "queryProxyGroup: " + Gson().toJson(pg))
|
||||
// Log.d(TAG, "queryProviders: " + Gson().toJson(pro))
|
||||
//
|
||||
// }
|
||||
// }
|
||||
clashBinder?.let { cb ->
|
||||
val names = cb.queryProxyGroupNames(false)
|
||||
Log.d(TAG, "queryProxy: names==>" + Gson().toJson(names))
|
||||
// val group = reloadLock.withPermit {
|
||||
if (names?.isNotEmpty() == true) {
|
||||
|
||||
// var pg = cb.queryProxyGroup(names[0], uiStore.proxySort);
|
||||
|
||||
var pro = cb.queryProviders();
|
||||
// Log.d(TAG, "queryProxyGroup: " + Gson().toJson(pg))
|
||||
Log.d(TAG, "queryProviders2: " + Gson().toJson(pro))
|
||||
// cb.patchSelector("八爪鱼机场", "德国|中转")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// val store = ServiceStore(this)
|
||||
// store.accessControlPackages.forEach {
|
||||
// Log.d(TAG, "accessControlPackages: $it")
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
//private suspend fun createByUrl() {
|
||||
// var uuid: UUID? = null
|
||||
//
|
||||
// withProfile {
|
||||
// //创建文件
|
||||
// uuid = create(Profile.Type.Url, "八爪猫")
|
||||
//
|
||||
// Log.d(TAG, "createByUrl: uuid==>" + uuid)
|
||||
// delay(1000)
|
||||
//
|
||||
// val original: Profile? = uuid?.let {
|
||||
// Log.d(TAG, "createByUrl: release==>" + it)
|
||||
//// release(it)
|
||||
// queryByUUID(it)
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// original?.let {
|
||||
// Log.d(TAG, "createByUrl: original==>")
|
||||
// setActive(it)
|
||||
// patch(
|
||||
// it.uuid,
|
||||
// it.name,
|
||||
//// "https://mojie0201.xn--8stx8olrwkucjq3b.com/api/v1/client/subscribe?token=169110d2674c49604b7e5b5cea341579",
|
||||
// "https://www.otcopusapp.cc/lx3af288h5i8pz380/api/v1/client/subscribe?token=d6bc98c7ea53099fa5bd1a3ea415ebb6",
|
||||
// it.interval
|
||||
// )
|
||||
// coroutineScope {
|
||||
//
|
||||
// commit(it.uuid) {
|
||||
// Log.d(TAG, "createByUrl: " + it.progress)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// Log.d(TAG, "createByUrl: end")
|
||||
//}
|
||||
|
||||
private suspend fun createByUrl() {
|
||||
var uuid: UUID? = null
|
||||
profile?.let { p ->
|
||||
//创建文件
|
||||
uuid = p.create(Profile.Type.Url, Conf.getClashConfName(this@MainActivity.applicationContext))
|
||||
|
||||
Log.d(TAG, "createByUrl: uuid==>" + uuid)
|
||||
delay(1000)
|
||||
|
||||
val original: Profile? = uuid?.let {
|
||||
Log.d(TAG, "createByUrl: release==>" + it)
|
||||
// release(it)
|
||||
p.queryByUUID(it)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
original?.let {
|
||||
Log.d(TAG, "createByUrl: original==>")
|
||||
p.setActive(it)
|
||||
p.patch(
|
||||
it.uuid,
|
||||
it.name,
|
||||
// "https://mojie0201.xn--8stx8olrwkucjq3b.com/api/v1/client/subscribe?token=169110d2674c49604b7e5b5cea341579",
|
||||
"https://www.otcopusapp.cc/lx3af288h5i8pz380/api/v1/client/subscribe?token=d6bc98c7ea53099fa5bd1a3ea415ebb6",
|
||||
it.interval
|
||||
)
|
||||
|
||||
|
||||
p.commit(it.uuid) {
|
||||
Log.d(TAG, "createByUrl: " + it.progress)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Log.d(TAG, "createByUrl: end")
|
||||
}
|
||||
|
||||
private suspend fun startClash() {
|
||||
// val active = withProfile { queryActive() }
|
||||
//
|
||||
// if (active == null || !active.imported) {
|
||||
// Log.d(TAG, "startClash: 未选择")
|
||||
//
|
||||
// return
|
||||
// }
|
||||
|
||||
val vpnRequest = startClashService()
|
||||
|
||||
try {
|
||||
if (vpnRequest != null) {
|
||||
val result = startActivityForResult(
|
||||
ActivityResultContracts.StartActivityForResult(),
|
||||
vpnRequest
|
||||
)
|
||||
|
||||
if (result.resultCode == RESULT_OK)
|
||||
startClashService()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private val nextRequestKey = AtomicInteger(0)
|
||||
suspend fun <I, O> startActivityForResult(
|
||||
contracts: ActivityResultContract<I, O>,
|
||||
input: I,
|
||||
): O = withContext(Dispatchers.Main) {
|
||||
val requestKey = nextRequestKey.getAndIncrement().toString()
|
||||
|
||||
ActivityResultLifecycle().use { lifecycle, start ->
|
||||
suspendCoroutine { c ->
|
||||
activityResultRegistry.register(requestKey, lifecycle, contracts) {
|
||||
c.resume(it)
|
||||
}.apply { start() }.launch(input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetch2() {
|
||||
|
||||
lifecycleScope.launch {
|
||||
profile?.let {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetch() {
|
||||
// setClashRunning(clashRunning)
|
||||
|
||||
Log.d(TAG, "fetch: 1")
|
||||
launch(Dispatchers.IO) {
|
||||
// profile?.let { p ->
|
||||
Log.d(TAG, "fetch: 2")
|
||||
// withProfile {
|
||||
// var allPro = queryAll()
|
||||
// Log.d(TAG, "fetch: allPro==>" + Gson().toJson(allPro))
|
||||
// allPro?.let {
|
||||
// if (it.isNotEmpty()) {
|
||||
// it[0]?.let { pro ->
|
||||
//
|
||||
// setActive(pro)
|
||||
//
|
||||
// patch(
|
||||
// pro.uuid,
|
||||
// pro.name,
|
||||
//// "https://mojie0201.xn--8stx8olrwkucjq3b.com/api/v1/client/subscribe?token=169110d2674c49604b7e5b5cea341579",
|
||||
// "https://www.otcopusapp.cc/lx3af288h5i8pz380/api/v1/client/subscribe?token=d6bc98c7ea53099fa5bd1a3ea415ebb6",
|
||||
// pro.interval
|
||||
// )
|
||||
// commit(pro.uuid) {
|
||||
// Log.d(TAG, "createByUrl: " + it.progress)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
profileBinder?.let { pm ->
|
||||
var allPro = pm.queryAll()
|
||||
|
||||
|
||||
var actname = pm.queryActive()?.name
|
||||
com.cncat.vpn.common.log.Log.d("actname==>" + actname)
|
||||
|
||||
|
||||
}
|
||||
var state: TunnelState? = null
|
||||
var providers: ProviderList? = null
|
||||
clashBinder?.let { cm ->
|
||||
state = cm.queryTunnelState()
|
||||
providers = cm.queryProviders()
|
||||
|
||||
com.cncat.vpn.common.log.Log.d("state==>${state}, providers==>{$providers}")
|
||||
}
|
||||
// val state = withClash {
|
||||
// queryTunnelState()
|
||||
// }
|
||||
// val providers = withClash {
|
||||
// queryProviders()
|
||||
// }
|
||||
|
||||
// setMode(state.mode)
|
||||
// setHasProviders(providers.isNotEmpty())
|
||||
|
||||
// withProfile {
|
||||
// Log.d(TAG, "fetch: " + queryActive())
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -3,12 +3,10 @@ package com.yingmao.clash.act
|
|||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
|
|
@ -35,7 +33,6 @@ import com.afollestad.materialdialogs.customview.customView
|
|||
import com.afollestad.materialdialogs.customview.getCustomView
|
||||
import com.baidu.mobads.action.ActionType
|
||||
import com.baidu.mobads.action.BaiduAction
|
||||
import com.cncat.vpn.common.constants.Intents
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.cncat.vpn.core.model.LogMessage
|
||||
import com.cncat.vpn.service.ClashManager
|
||||
|
|
@ -61,7 +58,6 @@ import com.yingmao.clash.entity.BannerImgBean
|
|||
import com.yingmao.clash.entity.CheckLoginRsp
|
||||
import com.yingmao.clash.fragment.NewAccFragment
|
||||
import com.yingmao.clash.fragment.NewAccFragment.Companion.CHECK_NODE_REQUEST_CODE
|
||||
import com.yingmao.clash.fragment.mine.MineFragment
|
||||
import com.yingmao.clash.listener.DownLoadListener
|
||||
import com.yingmao.clash.net.http.HttpApi
|
||||
import com.yingmao.clash.net.http.HttpReqType
|
||||
|
|
@ -93,7 +89,6 @@ import com.yingmao.clash.webview.CustomerServiceWebView
|
|||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -433,59 +428,34 @@ class NewMainActivity : BaseActivity() {
|
|||
Logger.d("心跳成功")
|
||||
if (httpStatus.reqType == HttpReqType.HEARTBEAT) {
|
||||
if (httpStatus.rsp is HeartBeatRsp) {
|
||||
(httpStatus.rsp as HeartBeatRsp).let {
|
||||
httpStatus.rsp.let {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
when (it.code) {
|
||||
0 -> {
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_EXPIRED, false)
|
||||
for (fragment in fragments) {
|
||||
if (fragment is MineFragment) {
|
||||
fragment.updateAccountStatus(false, it.validityPeriod)
|
||||
}
|
||||
}
|
||||
HEART_BEAT_FAILURE_FREQUENCY = 0
|
||||
}
|
||||
|
||||
-2 -> {
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_EXPIRED, false)
|
||||
for (fragment in fragments) {
|
||||
if (fragment is MineFragment) {
|
||||
fragment.updateAccountStatus(false, it.validityPeriod)
|
||||
}
|
||||
}
|
||||
HEART_BEAT_FAILURE_FREQUENCY = 0
|
||||
|
||||
cleanUserInfo()
|
||||
// startActivity(Intent(CommonUtils.getApp(), LoginActivity::class.java))
|
||||
// finish()
|
||||
// mainAtyVM.stopHeartBeat()
|
||||
}
|
||||
|
||||
-4 -> {
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_EXPIRED, false)
|
||||
for (fragment in fragments) {
|
||||
if (fragment is MineFragment) {
|
||||
fragment.updateAccountStatus(false, it.validityPeriod)
|
||||
}
|
||||
}
|
||||
HEART_BEAT_FAILURE_FREQUENCY = 0
|
||||
cleanUserInfo()
|
||||
// startActivity(Intent(CommonUtils.getApp(), LoginActivity::class.java))
|
||||
// finish()
|
||||
// mainAtyVM.stopHeartBeat()
|
||||
}
|
||||
|
||||
-3 -> {
|
||||
// RxToast.warning("加速服务已到期,请续费!")
|
||||
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_EXPIRED, true)
|
||||
for (fragment in fragments) {
|
||||
if (fragment is NewAccFragment) {
|
||||
// fragment.heartBeatStopSS()
|
||||
} else if (fragment is MineFragment) {
|
||||
fragment.updateAccountStatus(true, it.validityPeriod)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else->{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -496,23 +466,34 @@ class NewMainActivity : BaseActivity() {
|
|||
val lastNotice =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, "")
|
||||
val data = it.data
|
||||
// if (data?.notice != null) {
|
||||
// initMainPageHorseRaceLamp(data.notice)
|
||||
// }
|
||||
if (data?.notice != null && lastNotice != data.notice) {
|
||||
val notice = data.notice!!
|
||||
val dialog = DialogNotice(this@NewMainActivity, notice, data.downloadUrl)
|
||||
dialog.setOnReadClickListener(object : DialogNotice.OnReadClickListener {
|
||||
override fun onReadClick() {
|
||||
val notice = data.notice
|
||||
MaterialDialog(this).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.dialog_notice_layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
val noticeContent = getCustomView().findViewById<TextView>(R.id.tv_notice_content)
|
||||
noticeContent.text=notice
|
||||
noticeContent.movementMethod = LinkMovementMethod.getInstance()
|
||||
|
||||
val noticeUrl = getCustomView().findViewById<TextView>(R.id.tv_notice_url)
|
||||
noticeUrl.text= context.resources.getString(R.string.ClientDownload)+"\n${data.downloadUrl}"
|
||||
|
||||
getCustomView().findViewById<TextView>(R.id.tv_sure).setOnClickListener {
|
||||
MMKV.defaultMMKV()
|
||||
.encode(BZYConstants.MMKV_KEY_NOTICE_READ, data.notice!!)
|
||||
.encode(BZYConstants.MMKV_KEY_NOTICE_READ, data.notice)
|
||||
MMKV.defaultMMKV().encode(
|
||||
BZYConstants.MMKV_KEY_NOTICE_DOWNLOAD_READ, data.downloadUrl
|
||||
)
|
||||
dialog.dismiss()
|
||||
dismiss()
|
||||
}
|
||||
})
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -537,14 +518,20 @@ class NewMainActivity : BaseActivity() {
|
|||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_EXPIRED, expired ?: true)
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD, nowExpireTime)
|
||||
setExpireDate()
|
||||
fragments.filterIsInstance<NewAccFragment>().forEach { it.setExpireDate() }
|
||||
fragments.filterIsInstance<NewAccFragment>().forEach {
|
||||
it.setExpireDate()
|
||||
it.changeUserState()
|
||||
}
|
||||
checkPayResultDia?.dismiss()
|
||||
mainAtyVM.getAirNodes()
|
||||
RxToast.info(resources.getString(R.string.SuccessfullyUpdatedUserInformation))
|
||||
} else {
|
||||
// RxToast.info(resources.getString(R.string.PaymentResultsStr))
|
||||
}
|
||||
} else {
|
||||
} else if(checkLoginRsp.code == -2){
|
||||
RxToast.info(resources.getString(R.string.LoginOut))
|
||||
cleanUserInfoToLogout()
|
||||
}else{
|
||||
RxToast.info(resources.getString(R.string.QueryFailed))
|
||||
}
|
||||
payResultLoading?.dismiss()
|
||||
|
|
@ -572,26 +559,25 @@ class NewMainActivity : BaseActivity() {
|
|||
} else {
|
||||
RxToast.error(resources.getString(R.string.NodeAcquisitionFailed) + "${data.msg}")
|
||||
}
|
||||
data.data?.let { url ->
|
||||
data.data.let { url ->
|
||||
android.util.Log.e("Data", "机场URL:=${url}")
|
||||
// var url2="https://api.ymvpnpro11.cc:8700/7air2vr7ikiqzgvxz/api/v1/client/subscribe?token=5af82930d222840cbc2dec572b21d6c6"
|
||||
if (url.isNotEmpty()) {
|
||||
//todo 判断订阅地址是否修改过,未修改就用接口返回的地址反之使用本地修改的地址
|
||||
var pro_sub_url =
|
||||
val proSubUrl =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.PROFILE_SUB_URL, "")
|
||||
if (!TextUtils.isEmpty(pro_sub_url)) {
|
||||
if (pro_sub_url == url) {
|
||||
if (!TextUtils.isEmpty(proSubUrl)){
|
||||
if (proSubUrl == url) {
|
||||
subUrl = url
|
||||
} else {
|
||||
subUrl = pro_sub_url
|
||||
subUrl = proSubUrl
|
||||
}
|
||||
} else {
|
||||
}else{
|
||||
subUrl = url
|
||||
}
|
||||
|
||||
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
// setSub(url)
|
||||
subUrl?.let { setSub2(it) }
|
||||
}
|
||||
}
|
||||
|
|
@ -614,31 +600,149 @@ class NewMainActivity : BaseActivity() {
|
|||
} else if (httpStatus.reqType == HttpReqType.GetActivity) {
|
||||
val data = httpStatus.rsp as GetActivityRsp
|
||||
if (data.code == 200) {
|
||||
if (data.data != null) {
|
||||
if (data.data.data != null) {
|
||||
if (data.data.data.list.isNotEmpty()) {
|
||||
data.data.data.list[0].redirectLink.let {
|
||||
if(activityDialog==null){
|
||||
activityDialog =
|
||||
ActivityViewDialog(this, data.data.data.list[0].redirectLink)
|
||||
activityDialog?.setOnDialogClickListener(object :
|
||||
OnDialogClickListener {
|
||||
override fun onRechargeClickListener() {
|
||||
//跳转到支付界面
|
||||
goBackupRechargeWeb()
|
||||
}
|
||||
if (data.data.data.list.isNotEmpty()) {
|
||||
if(data.data.data.list.size>1){
|
||||
val bannerImgBeans=mutableListOf<BannerImgBean>()
|
||||
data.data.data.list.forEach {item->
|
||||
bannerImgBeans.add(BannerImgBean(item.title,item.content,item.redirectLink,0))
|
||||
}
|
||||
homeActivityDialog = HomeActivityDialog(this,bannerImgBeans)
|
||||
homeActivityDialog!!.show()
|
||||
homeActivityDialog?.setOnDialogClickListener(object : HomeActivityDialog.OnHADialogClickListener {
|
||||
override fun onRechargeClickListener() {
|
||||
//跳转到支付界面
|
||||
goBackupRechargeWeb()
|
||||
}
|
||||
|
||||
override fun onCancelClickListener() {
|
||||
activityDialog?.dismiss()
|
||||
override fun onCancelClickListener() {
|
||||
homeActivityDialog?.dismiss()
|
||||
}
|
||||
|
||||
override fun onClickImgType(position: Int) {
|
||||
android.util.Log.i("Postion", "position::$position")
|
||||
|
||||
if(bannerImgBeans.get(position).redirectLink.contains("https:")){
|
||||
val uri = Uri.parse(bannerImgBeans.get(position).redirectLink)
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
intent.setData(uri)
|
||||
startActivity(intent)
|
||||
}else if(bannerImgBeans.get(position).redirectLink.contains("firstCharge")){
|
||||
goBackupRechargeWeb()
|
||||
}else if(bannerImgBeans.get(position).redirectLink.contains("BindAccount")){
|
||||
var useraccount =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")!!
|
||||
if (Utils.isEmail(useraccount) || Utils.isPhoneNumber(useraccount)) {
|
||||
RxToast.info(resources.getString(R.string.bindingAgi))
|
||||
return
|
||||
}
|
||||
val dialog = DialogBandChoose(this@NewMainActivity)
|
||||
dialog.setOnBandClickListener(object : DialogBandChoose.OnBandClickListener {
|
||||
override fun onBandClick(isPhone: Boolean) {
|
||||
val intent = Intent(CommonUtils.getApp(), BandPhoneActivity::class.java)
|
||||
intent.putExtra("isPhone", isPhone)
|
||||
startActivity(intent)
|
||||
}
|
||||
})
|
||||
activityDialog?.show()
|
||||
dialog.show()
|
||||
}else if(bannerImgBeans.get(position).redirectLink.contains("SignIn")){
|
||||
mainAtyVM.vipSign()
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
data.data.data.list[0].redirectLink.let {
|
||||
var bannerImgBeans=mutableListOf<BannerImgBean>()
|
||||
bannerImgBeans.add(BannerImgBean(data.data.data.list[0].title,data.data.data.list[0].content,data.data.data.list[0].redirectLink,0))
|
||||
homeActivityDialog =
|
||||
HomeActivityDialog(this,bannerImgBeans)
|
||||
homeActivityDialog!!.show()
|
||||
homeActivityDialog?.setOnDialogClickListener(object :
|
||||
HomeActivityDialog.OnHADialogClickListener {
|
||||
override fun onRechargeClickListener() {
|
||||
//跳转到支付界面
|
||||
goBackupRechargeWeb()
|
||||
}
|
||||
|
||||
override fun onCancelClickListener() {
|
||||
homeActivityDialog?.dismiss()
|
||||
}
|
||||
|
||||
override fun onClickImgType(position: Int) {
|
||||
android.util.Log.i("Postion", "position::$position")
|
||||
if(bannerImgBeans.get(position).redirectLink.contains("https:")){
|
||||
var uri = Uri.parse(bannerImgBeans.get(position).redirectLink)
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
intent.setData(uri)
|
||||
startActivity(intent)
|
||||
}else if(bannerImgBeans.get(position).redirectLink.contains("firstCharge")){
|
||||
goBackupRechargeWeb()
|
||||
}else if(bannerImgBeans.get(position).redirectLink.contains("BindAccount")){
|
||||
var useraccount =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")!!
|
||||
if (Utils.isEmail(useraccount) || Utils.isPhoneNumber(useraccount)) {
|
||||
RxToast.info(resources.getString(R.string.bindingAgi))
|
||||
return
|
||||
}
|
||||
val dialog = DialogBandChoose(this@NewMainActivity)
|
||||
dialog.setOnBandClickListener(object : DialogBandChoose.OnBandClickListener {
|
||||
override fun onBandClick(isPhone: Boolean) {
|
||||
val intent = Intent(CommonUtils.getApp(), BandPhoneActivity::class.java)
|
||||
intent.putExtra("isPhone", isPhone)
|
||||
startActivity(intent)
|
||||
}
|
||||
})
|
||||
dialog.show()
|
||||
}else if(bannerImgBeans.get(position).redirectLink.contains("SignIn")){
|
||||
mainAtyVM.vipSign()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}else if(httpStatus.reqType == HttpReqType.SelectNode){
|
||||
(httpStatus.rsp as ShowNode).let {
|
||||
if (it.code == 200) {
|
||||
val countryFlag = it.data?.countryFlag
|
||||
if(countryFlag == true){
|
||||
findViewById<ConstraintLayout>(R.id.clLocation).visibility=View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(httpStatus.reqType == HttpReqType.EXPENSES_RECORD){
|
||||
if(httpStatus.rsp is ExpensesRecordRsp){
|
||||
httpStatus.rsp.let { expensesRecordRsp ->
|
||||
if(expensesRecordRsp.code == "1000"){
|
||||
if(expensesRecordRsp.data != null) {
|
||||
val expensesRecordList = expensesRecordRsp.data.expensesRecords
|
||||
if(expensesRecordList!=null){
|
||||
if(expensesRecordList.size==1){
|
||||
val orderID = expensesRecordList[0].id
|
||||
val report = expensesRecordList[0].reportFlag
|
||||
android.util.Log.i("UPLoad:","data:::"+report+"orderId:"+orderID)
|
||||
if(report == null){
|
||||
//调用上报日志 记录数据
|
||||
if (orderID != null) {
|
||||
mainAtyVM.getReport(orderID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(httpStatus.reqType == HttpReqType.Report){
|
||||
(httpStatus.rsp as AppVersionCheckRsp).let {
|
||||
if(it.code==200){
|
||||
//上报百度支付功能
|
||||
android.util.Log.i("reqType:","data:::"+it.code)
|
||||
BaiduAction.logAction(ActionType.PURCHASE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -677,33 +781,34 @@ class NewMainActivity : BaseActivity() {
|
|||
// fragments.add(RechargeFragment())
|
||||
containerVP.adapter = MainVPAdapter(fragments, supportFragmentManager, lifecycle)
|
||||
containerVP.isUserInputEnabled = false
|
||||
var aniAct = findViewById<LottieAnimationView>(R.id.lottie_activity)
|
||||
aniAct.setAnimation(R.raw.activity)
|
||||
aniAct.playAnimation()
|
||||
aniAct.setOnClickListener {
|
||||
startActivity(Intent(CommonUtils.getApp(), ActivityActivity::class.java))
|
||||
clHomeRecharge=findViewById(R.id.clHomeRecharge)
|
||||
clDeepSeek=findViewById(R.id.clDeepSeek)
|
||||
floating=findViewById(R.id.floating)
|
||||
tv_exit=findViewById(R.id.tv_exit)
|
||||
clSing=findViewById(R.id.clSing)
|
||||
clSing.setOnClickListener {
|
||||
mainAtyVM.vipSign()
|
||||
}
|
||||
findViewById<LinearLayout>(R.id.ll_activity).setOnClickListener {
|
||||
startActivity(Intent(CommonUtils.getApp(), ActivityActivity::class.java))
|
||||
|
||||
clHomeRecharge.setOnClickListener {
|
||||
goBackupRechargeWeb()
|
||||
}
|
||||
tv_exit.setOnClickListener {
|
||||
cleanUserInfo()
|
||||
finish()
|
||||
}
|
||||
clDeepSeek.setOnClickListener {
|
||||
startActivity(Intent(this, CustomerServiceWebView::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
floating.setOnClickListener {
|
||||
startActivity(Intent(this, CustomerServiceWebView::class.java))
|
||||
}
|
||||
setSometion()
|
||||
}
|
||||
|
||||
private fun initMainPageHorseRaceLamp(noticeData: String) {
|
||||
val mainPageHorseRaceLamp = findViewById<TextView>(R.id.mainPageHorseRaceLamp)
|
||||
if (noticeData.isNotEmpty()) {
|
||||
mainPageHorseRaceLamp.text = noticeData
|
||||
mainPageHorseRaceLamp.requestFocus()
|
||||
mainPageHorseRaceLamp.marqueeRepeatLimit = Integer.MAX_VALUE
|
||||
mainPageHorseRaceLamp.isFocusable = true
|
||||
mainPageHorseRaceLamp.ellipsize = TextUtils.TruncateAt.MARQUEE
|
||||
mainPageHorseRaceLamp.setSingleLine()
|
||||
mainPageHorseRaceLamp.isFocusableInTouchMode = true
|
||||
mainPageHorseRaceLamp.setHorizontallyScrolling(true)
|
||||
} else {
|
||||
val llNoticeBackground = findViewById<LinearLayout>(R.id.llNoticeBackground)
|
||||
llNoticeBackground.visibility = View.GONE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun cleanUserInfo() {
|
||||
|
|
@ -713,6 +818,7 @@ class NewMainActivity : BaseActivity() {
|
|||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_SELECTED_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.PROFILE_SUB_URL)
|
||||
Log.d("cleanUserInfo clashRunning==>${clashRunning}")
|
||||
if (clashRunning) {
|
||||
fragments.filterIsInstance<NewAccFragment>().forEach { it.stopClash() }
|
||||
|
|
@ -723,6 +829,26 @@ class NewMainActivity : BaseActivity() {
|
|||
startActivity(Intent(CommonUtils.getApp(), LoginActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
private fun cleanUserInfoToLogout() {
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_PH_TOKEN)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_TOKEN)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_CURRENT_NODE)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_SELECTED_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.PROFILE_SUB_URL)
|
||||
Log.d("cleanUserInfo clashRunning==>${clashRunning}")
|
||||
if (clashRunning) {
|
||||
fragments.filterIsInstance<NewAccFragment>().forEach { it.stopClash() }
|
||||
}
|
||||
stopUploadTimer()
|
||||
mainAtyVM.stopHeartBeat()
|
||||
cleanProfile()
|
||||
val intent=Intent(CommonUtils.getApp(), LoginActivity::class.java)
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
|
||||
private fun cleanProfile() {
|
||||
|
|
@ -745,25 +871,11 @@ class NewMainActivity : BaseActivity() {
|
|||
tv_username = findViewById(R.id.tv_username)
|
||||
iv_slider = findViewById(R.id.iv_slider)
|
||||
ll_slider = findViewById(R.id.ll_slider)
|
||||
tv_exit = findViewById(R.id.tv_exit)
|
||||
tv_band = findViewById(R.id.tv_band)
|
||||
// containerVP.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
|
||||
// override fun onPageSelected(position: Int) {
|
||||
// super.onPageSelected(position)
|
||||
// if (position == 1 || position == 2) {
|
||||
// tv_rechar.visibility = View.GONE
|
||||
// } else {
|
||||
// tv_rechar.visibility = View.VISIBLE
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
findViewById<TextView>(R.id.tv_version).text =
|
||||
resources.getString(R.string.edition) + "${BuildConfig.VERSION_NAME}." + BuildConfig.productId
|
||||
|
||||
if (MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_IS_PERFECT)) {
|
||||
// 临时用户显示默认密码
|
||||
// findViewById<TextView>(R.id.tv_default_psw).visibility = View.VISIBLE
|
||||
tv_band.setOnClickListener {//绑定
|
||||
showBingDialogChoose()
|
||||
drawer.close()
|
||||
|
|
@ -777,35 +889,37 @@ class NewMainActivity : BaseActivity() {
|
|||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME)
|
||||
}"
|
||||
}
|
||||
|
||||
tv_exit.setOnClickListener {//退出
|
||||
cleanUserInfo()
|
||||
finish()
|
||||
}
|
||||
|
||||
findViewById<TextView>(R.id.tv_viprecharge).setOnClickListener {//充值
|
||||
// tv_rechar.visibility = View.GONE
|
||||
// iv_slider.setImageResource(R.drawable.ic_s_back)
|
||||
drawer.close()
|
||||
goBackupRechargeWeb()
|
||||
}
|
||||
findViewById<TextView>(R.id.tv_vip_recharge).setOnClickListener {
|
||||
findViewById<ConstraintLayout>(R.id.clRecharge).setOnClickListener {//充值
|
||||
drawer.close()
|
||||
goBackupRechargeWeb()
|
||||
}
|
||||
|
||||
findViewById<TextView>(R.id.tv_notice).setOnClickListener {//通知
|
||||
findViewById<ConstraintLayout>(R.id.clNotice).setOnClickListener {//通知
|
||||
val notice =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, "暂无新通知")!!
|
||||
val download_url =
|
||||
val downloadUrl =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_DOWNLOAD_READ, "")!!
|
||||
val dialog = DialogNotice(this@NewMainActivity, notice, download_url)
|
||||
dialog.setOnReadClickListener(object : DialogNotice.OnReadClickListener {
|
||||
override fun onReadClick() {
|
||||
dialog.dismiss()
|
||||
MaterialDialog(this).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.dialog_notice_layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
val noticeContent = getCustomView().findViewById<TextView>(R.id.tv_notice_content)
|
||||
noticeContent.text=notice
|
||||
noticeContent.movementMethod = LinkMovementMethod.getInstance()
|
||||
|
||||
val noticeUrl = getCustomView().findViewById<TextView>(R.id.tv_notice_url)
|
||||
noticeUrl.text= context.resources.getString(R.string.ClientDownload)+"\n${downloadUrl}"
|
||||
|
||||
getCustomView().findViewById<TextView>(R.id.tv_sure).setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
})
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
drawer.close()
|
||||
}
|
||||
|
||||
|
|
@ -816,68 +930,43 @@ class NewMainActivity : BaseActivity() {
|
|||
clipboardManager.setPrimaryClip(clipData)
|
||||
RxToast.info(resources.getString(R.string.CopyToClipboard))
|
||||
}
|
||||
|
||||
// tv_rechar.setOnClickListener {
|
||||
// goRechargeWeb()
|
||||
// }
|
||||
findViewById<TextView>(R.id.tv_share).setOnClickListener {//分享
|
||||
findViewById<ConstraintLayout>(R.id.clShare).setOnClickListener {//分享
|
||||
startActivity(Intent(this@NewMainActivity, ShareActivity::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
findViewById<TextView>(R.id.tv_setting).setOnClickListener {//设置
|
||||
findViewById<ConstraintLayout>(R.id.clSetting).setOnClickListener {//设置
|
||||
startActivity(Intent(this, SettingActivity::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
findViewById<TextView>(R.id.tv_dianka).setOnClickListener {//点卡
|
||||
startActivity(Intent(this, MyPointCardActivity::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
findViewById<TextView>(R.id.tv_vip_sign).setOnClickListener {//会员签到
|
||||
mainAtyVM.vipSign()
|
||||
// drawer.close()
|
||||
}
|
||||
findViewById<TextView>(R.id.tv_tixian).setOnClickListener {//提现
|
||||
startActivity(Intent(this, ZFBTXActivity::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
val telegramBtn = findViewById<TextView>(R.id.tv_dianbao)
|
||||
|
||||
telegramBtn.setOnClickListener {//电报
|
||||
var uri = Uri.parse(BZYConstants.DefTGUrl)
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
when {
|
||||
BuildConfig.is_ym -> {
|
||||
uri = Uri.parse(BZYConstants.YMTGUrl)
|
||||
}
|
||||
|
||||
BuildConfig.is_tz -> {
|
||||
uri = Uri.parse(BZYConstants.TZTGUrl)
|
||||
}
|
||||
|
||||
BuildConfig.is_yunti -> {
|
||||
uri = Uri.parse(BZYConstants.YunTiTGUrl)
|
||||
}
|
||||
|
||||
else -> {
|
||||
uri = Uri.parse(BZYConstants.DefTGUrl)
|
||||
}
|
||||
findViewById<ConstraintLayout>(R.id.clLocation).setOnClickListener {//变更
|
||||
if (checkExpire()) {
|
||||
RxToast.info(resources.getString(R.string.AccountExpired))
|
||||
return@setOnClickListener
|
||||
}
|
||||
intent.setData(uri)
|
||||
startActivity(intent)
|
||||
val intent = Intent(CommonUtils.getApp(), ChangeNodeActivity::class.java)
|
||||
if (!TextUtils.isEmpty(newUuid)) {
|
||||
intent.putExtra(BZYConstants.MMKV_KEY_CURRENT_NODE, newUuid)
|
||||
intent.putExtra(BZYConstants.EXTRA_KEY_IS_RUNING, clashRunning)
|
||||
}
|
||||
startActivityForResult(intent, CHECK_NODE_REQUEST_CODE)
|
||||
drawer.close()
|
||||
}
|
||||
|
||||
findViewById<TextView>(R.id.tv_kefu).setOnClickListener {//客服
|
||||
startActivity(Intent(this, BZYWebViewKeFu::class.java))
|
||||
|
||||
findViewById<ConstraintLayout>(R.id.clActivity).setOnClickListener {//活动
|
||||
startActivity(Intent(this, ActivityActivity::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
var fds_view = findViewById<TextView>(R.id.tv_fds);
|
||||
fds_view.setOnClickListener {//防丢失
|
||||
startActivity(Intent(this, LossPreventionActivity::class.java))
|
||||
|
||||
findViewById<ConstraintLayout>(R.id.clAccount).setOnClickListener {
|
||||
startActivity(Intent(this, MineInfoActivity::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
|
||||
findViewById<ConstraintLayout>(R.id.clKf).setOnClickListener {//客服
|
||||
startActivity(Intent(this, CustomerServiceWebView::class.java))
|
||||
drawer.close()
|
||||
}
|
||||
|
||||
drawer = findViewById(R.id.drawer)
|
||||
iv_slider.setOnClickListener {
|
||||
if (containerVP.currentItem != 0) {
|
||||
|
|
@ -887,10 +976,6 @@ class NewMainActivity : BaseActivity() {
|
|||
drawer.openDrawer(GravityCompat.START)
|
||||
}
|
||||
}
|
||||
if (BuildConfig.is_tz && BuildConfig.productId == "182269") {
|
||||
telegramBtn.visibility = View.INVISIBLE
|
||||
fds_view.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
var checkPayResultDia: MaterialDialog? = null
|
||||
|
|
@ -912,7 +997,7 @@ class NewMainActivity : BaseActivity() {
|
|||
public fun goBackupRechargeWeb() {
|
||||
|
||||
startActivityForResult(
|
||||
Intent(this@NewMainActivity, BackupRechargeActivity::class.java),
|
||||
Intent(this@NewMainActivity, MemberRechargeActivity::class.java),
|
||||
REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY
|
||||
)
|
||||
}
|
||||
|
|
@ -952,7 +1037,6 @@ class NewMainActivity : BaseActivity() {
|
|||
|
||||
checkBindAccountDia = MaterialDialog(this).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.bind_account_dialog_layout,
|
||||
scrollable = false,
|
||||
|
|
@ -982,9 +1066,6 @@ class NewMainActivity : BaseActivity() {
|
|||
dialog.show()
|
||||
}
|
||||
|
||||
var payResultLoading: RxDialogShapeLoading? = null
|
||||
private var timerJob: Job? = null
|
||||
private var loadingTimeoutNum = 3
|
||||
private fun showLoadingDialog(msg: String) {
|
||||
payResultLoading = RxDialogShapeLoading(this)
|
||||
payResultLoading!!.setMessage(msg)
|
||||
|
|
@ -1197,97 +1278,42 @@ class NewMainActivity : BaseActivity() {
|
|||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
public suspend fun setSub2(url: String) {
|
||||
Log.d("setSub2 2")
|
||||
profileBinder?.let { pm ->
|
||||
Log.d("setSub2 3")
|
||||
pm.queryAll().forEach { itemPro ->
|
||||
Log.d("setSub2 itemPro ==>${itemPro}")
|
||||
if (itemPro.name != Conf.getClashConfName(this@NewMainActivity.applicationContext)) {
|
||||
Log.d("setSub2 delete ==>${itemPro.name}")
|
||||
pm.delete(itemPro.uuid)
|
||||
}
|
||||
}
|
||||
val pro = pm.queryActive()
|
||||
Log.d("setSub2 4")
|
||||
pro?.let {
|
||||
var actname = it.name
|
||||
Log.d("new main actname==>" + actname)
|
||||
Log.d("setSub2 pro 已存在 ==>")
|
||||
pm.setActive(it)
|
||||
delay(500)
|
||||
if (!TextUtils.isEmpty(pro.source)) {
|
||||
// Log.d("setSub2 pro.source==>${pro.source}, url==>${url}")
|
||||
if (pro.source != url) {
|
||||
Log.d("setSub2 patch")
|
||||
pm.patch(pro.uuid, pro.name, url, 1800000L)
|
||||
pm.commit(pro.uuid) { status ->
|
||||
Log.d("setSub2 updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress)
|
||||
}
|
||||
}
|
||||
}
|
||||
pm.update(it.uuid)
|
||||
|
||||
newUuid = pro.uuid.toString();
|
||||
isSubed = true
|
||||
Log.d("setSub2 setActive end")
|
||||
} ?: run {
|
||||
createMyProfile(pm, url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
suspend fun createMyProfile(pm: IProfileManager, url: String) {
|
||||
var uuid: UUID = pm.create(
|
||||
Profile.Type.Url, Conf.getClashConfName(this@NewMainActivity.applicationContext)
|
||||
)
|
||||
delay(500)
|
||||
pm.queryByUUID(uuid)?.let { qPro ->
|
||||
pm.setActive(qPro)
|
||||
pm.patch(
|
||||
qPro.uuid, qPro.name,
|
||||
// "https://mojie0201.xn--8stx8olrwkucjq3b.com/api/v1/client/subscribe?token=169110d2674c49604b7e5b5cea341579",
|
||||
// "https://www.otcopusapp.cc/lx3af288h5i8pz380/api/v1/client/subscribe?token=d6bc98c7ea53099fa5bd1a3ea415ebb6",
|
||||
// "https://reg.bazhuayujiasu.cc/api/v1/client/subscribe?token=7f0f025ab341bcec4822d2c90aadf8b0",
|
||||
url, 1800000L
|
||||
)
|
||||
// coroutineScope {
|
||||
pm.commit(qPro.uuid) { status ->
|
||||
android.util.Log.d(
|
||||
Conf.TAG,
|
||||
"new updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress
|
||||
)
|
||||
}
|
||||
newUuid = qPro.uuid.toString();
|
||||
isSubed = true
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
if (requestCode == REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY) {
|
||||
if (activityDialog != null) {
|
||||
activityDialog?.dismiss()
|
||||
}
|
||||
goCheckLogin()
|
||||
showBindAccount()
|
||||
}else if(requestCode == CHECK_NODE_REQUEST_CODE){
|
||||
fragments.filterIsInstance<NewAccFragment>().forEach { it.nodeChooseBase(data) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
if (activityDialog != null) {
|
||||
if(activityDialog!!.isShowing){
|
||||
activityDialog!!.dismiss()
|
||||
}
|
||||
|
||||
}
|
||||
super.onDestroy()
|
||||
stopUploadTimer()
|
||||
mainAtyVM.stopHeartBeat()
|
||||
}
|
||||
if(dialogDoMainChoose!=null){
|
||||
if(dialogDoMainChoose!!.isShowing){
|
||||
dialogDoMainChoose!!.dismiss()
|
||||
dialogDoMainChoose=null
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
class PageInfo {
|
||||
var page = 1
|
||||
fun nextPage() {
|
||||
page++
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
page = 1
|
||||
}
|
||||
|
||||
val isFirstPage: Boolean
|
||||
get() = page == 1
|
||||
}
|
||||
}
|
||||
|
|
@ -1,253 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.ViewGroup.*
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RadioButton
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.cncat.vpn.common.constants.Intents
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.cncat.vpn.service.model.AccessControlMode
|
||||
import com.yingmao.clash.fragment.home.HomeFragment
|
||||
import com.yingmao.clash.view.RxToast
|
||||
import com.yingmao.clash.view.popwindow.CommonPopupWindow
|
||||
import okio.ByteString.Companion.encode
|
||||
|
||||
class ProxyModeActivity : BaseActivity() {
|
||||
|
||||
var proxyModeAtyVM: ProxyModeAtyVM? = null
|
||||
private lateinit var llApplicationMode: LinearLayout
|
||||
private lateinit var TVApplicationModeTxt: TextView
|
||||
private lateinit var llControlApplication: LinearLayout
|
||||
private lateinit var radioApplicationMode: RadioButton
|
||||
private var popupWindow: CommonPopupWindow? = null
|
||||
private var layoutGravity: CommonPopupWindow.LayoutGravity? = null
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_proxymodel)
|
||||
|
||||
proxyModeAtyVM = ViewModelProvider(this).get(ProxyModeAtyVM::class.java)
|
||||
showTitleBar(resources.getString(R.string.RoutingMode))
|
||||
initView()
|
||||
}
|
||||
|
||||
lateinit var radio_but_pac: RadioButton
|
||||
lateinit var radio_but_global: RadioButton
|
||||
lateinit var pm: LinearLayout
|
||||
lateinit var gm: LinearLayout
|
||||
|
||||
private fun initView() {
|
||||
// var ivPacMode = findViewById<ImageView>(R.id.iv_pac_model)
|
||||
// var ivGlobal = findViewById<ImageView>(R.id.iv_global_mode)
|
||||
radio_but_pac = findViewById<RadioButton>(R.id.radio_but_pac)
|
||||
radio_but_global = findViewById<RadioButton>(R.id.radio_but_global)
|
||||
pm = findViewById<LinearLayout>(R.id.ll_pac_mode)
|
||||
gm = findViewById<LinearLayout>(R.id.ll_global_model)
|
||||
llApplicationMode = findViewById(R.id.llApplicationMode)
|
||||
TVApplicationModeTxt = findViewById(R.id.TVApplicationModeTxt)
|
||||
llControlApplication = findViewById(R.id.llControlApplication)
|
||||
radioApplicationMode = findViewById(R.id.radioApplicationMode)
|
||||
val isGlobal = MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
Log.d("initView isGlobal==>${isGlobal}")
|
||||
// if (isGlobal) {
|
||||
// ivGlobal.visibility = View.VISIBLE
|
||||
//
|
||||
// } else {
|
||||
// ivPacMode.visibility = View.VISIBLE
|
||||
// }
|
||||
var px = ProxyMode.PAC
|
||||
if (isGlobal) {
|
||||
px = ProxyMode.GLOBAL
|
||||
} else {
|
||||
px = ProxyMode.PAC
|
||||
}
|
||||
setBackground(px)
|
||||
pm.setOnClickListener {
|
||||
// ivPacMode.visibility = View.VISIBLE
|
||||
// ivGlobal.visibility = View.INVISIBLE
|
||||
setBackground(ProxyMode.PAC)
|
||||
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
goFinish()
|
||||
}
|
||||
gm.setOnClickListener {
|
||||
// ivPacMode.visibility = View.INVISIBLE
|
||||
// ivGlobal.visibility = View.VISIBLE
|
||||
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_GLOBAL_MODEL, true)
|
||||
setBackground(ProxyMode.GLOBAL)
|
||||
goFinish()
|
||||
}
|
||||
radioApplicationMode.setOnClickListener {
|
||||
// setBackground(ProxyMode.PACKAGE)
|
||||
}
|
||||
|
||||
radio_but_pac.setOnClickListener {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
setBackground(ProxyMode.PAC)
|
||||
goFinish()
|
||||
}
|
||||
|
||||
radio_but_global.setOnClickListener {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_GLOBAL_MODEL, true)
|
||||
setBackground(ProxyMode.GLOBAL)
|
||||
goFinish()
|
||||
}
|
||||
// getNodes()
|
||||
val amStr = MMKV.defaultMMKV().decodeString(BZYConstants.applicationMode, "")
|
||||
if (!amStr.isNullOrEmpty()) {
|
||||
when (amStr) {
|
||||
"" -> {
|
||||
TVApplicationModeTxt.setText(R.string.allow_all_apps)
|
||||
}
|
||||
|
||||
"AllApp" -> {
|
||||
TVApplicationModeTxt.setText(R.string.allow_all_apps)
|
||||
}
|
||||
|
||||
"ChooseApp" -> {
|
||||
TVApplicationModeTxt.setText(R.string.allow_selected_apps)
|
||||
}
|
||||
|
||||
"noChooseApp" -> {
|
||||
TVApplicationModeTxt.setText(R.string.deny_selected_apps)
|
||||
}
|
||||
}
|
||||
}
|
||||
llApplicationMode.setOnClickListener {
|
||||
if (HomeFragment.clashRunning) {
|
||||
RxToast.info("请关闭加速后再选择.");
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
popupWindow = object : CommonPopupWindow(
|
||||
this,
|
||||
R.layout.applicationmode_popwindow_item,
|
||||
500,
|
||||
LayoutParams.WRAP_CONTENT
|
||||
) {
|
||||
override fun initView() {
|
||||
|
||||
val view = getContentView()
|
||||
val allApp = view.findViewById<LinearLayout>(R.id.LLAll)
|
||||
val tvAllApp = view.findViewById<TextView>(R.id.TVAllApp)
|
||||
|
||||
val chooseApp = view.findViewById<LinearLayout>(R.id.LLChoose)
|
||||
val tvChooseApp = view.findViewById<TextView>(R.id.TVChoose)
|
||||
|
||||
val noChooseApp = view.findViewById<LinearLayout>(R.id.LLNoChoose)
|
||||
val tvNoChooseApp = view.findViewById<TextView>(R.id.TVNoChoose)
|
||||
|
||||
val applicationModeStr =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.applicationMode)
|
||||
if (applicationModeStr.isNullOrEmpty()) {
|
||||
allApp.setBackgroundResource(R.color.color_clash)
|
||||
tvAllApp.setTextColor(resources.getColor(R.color.white))
|
||||
} else if (applicationModeStr == "AllApp") {
|
||||
allApp.setBackgroundResource(R.color.color_clash)
|
||||
tvAllApp.setTextColor(resources.getColor(R.color.white))
|
||||
} else if (applicationModeStr == "ChooseApp") {
|
||||
chooseApp.setBackgroundResource(R.color.color_clash)
|
||||
tvChooseApp.setTextColor(resources.getColor(R.color.white))
|
||||
} else if (applicationModeStr == "noChooseApp") {
|
||||
noChooseApp.setBackgroundResource(R.color.color_clash)
|
||||
tvNoChooseApp.setTextColor(resources.getColor(R.color.white))
|
||||
}
|
||||
allApp.setOnClickListener {
|
||||
serStore.accessControlMode = AccessControlMode.AcceptAll
|
||||
MMKV.defaultMMKV().encode(BZYConstants.applicationMode, "AllApp")
|
||||
TVApplicationModeTxt.setText(R.string.allow_all_apps)
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
chooseApp.setOnClickListener {
|
||||
serStore.accessControlMode = AccessControlMode.AcceptSelected
|
||||
MMKV.defaultMMKV().encode(BZYConstants.applicationMode, "ChooseApp")
|
||||
TVApplicationModeTxt.setText(R.string.allow_selected_apps)
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
noChooseApp.setOnClickListener {
|
||||
serStore.accessControlMode = AccessControlMode.DenySelected
|
||||
MMKV.defaultMMKV().encode(BZYConstants.applicationMode, "noChooseApp")
|
||||
TVApplicationModeTxt.setText(R.string.deny_selected_apps)
|
||||
popupWindow.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
override fun initEvent() {}
|
||||
}
|
||||
layoutGravity =
|
||||
CommonPopupWindow.LayoutGravity(CommonPopupWindow.LayoutGravity.ALIGN_LEFT or CommonPopupWindow.LayoutGravity.TO_BOTTOM)
|
||||
(popupWindow as CommonPopupWindow).showBashOfAnchor(
|
||||
TVApplicationModeTxt,
|
||||
layoutGravity,
|
||||
0,
|
||||
0
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
llControlApplication.setOnClickListener {
|
||||
startActivity(Intent(this, InstallApplicationActivity::class.java))
|
||||
}
|
||||
}
|
||||
|
||||
private fun goFinish() {
|
||||
val intent = Intent()
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
|
||||
private fun setBackground(proxyMode: ProxyMode) {
|
||||
|
||||
when (proxyMode) {
|
||||
ProxyMode.PAC -> {
|
||||
HomeFragment.isGlo = false
|
||||
radio_but_global.isChecked = false
|
||||
radio_but_pac.isChecked = true
|
||||
radioApplicationMode.isChecked = false
|
||||
pm.setBackgroundResource(R.drawable.setting_bg_shape_selected)
|
||||
gm.setBackgroundResource(R.drawable.setting_bg_shape)
|
||||
llApplicationMode.setBackgroundResource(R.drawable.setting_bg_shape)
|
||||
sendMode(false)
|
||||
}
|
||||
|
||||
ProxyMode.GLOBAL -> {
|
||||
HomeFragment.isGlo = true
|
||||
radio_but_global.isChecked = true
|
||||
radio_but_pac.isChecked = false
|
||||
radioApplicationMode.isChecked = false
|
||||
pm.setBackgroundResource(R.drawable.setting_bg_shape)
|
||||
gm.setBackgroundResource(R.drawable.setting_bg_shape_selected)
|
||||
llApplicationMode.setBackgroundResource(R.drawable.setting_bg_shape)
|
||||
sendMode(true)
|
||||
}
|
||||
|
||||
ProxyMode.PACKAGE -> {
|
||||
// pm.setBackgroundResource(R.drawable.setting_bg_shape)
|
||||
// gm.setBackgroundResource(R.drawable.setting_bg_shape)
|
||||
// llApplicationMode.setBackgroundResource(R.drawable.setting_bg_shape_selected)
|
||||
// radio_but_global.isChecked = false
|
||||
// radio_but_pac.isChecked = false
|
||||
// radioApplicationMode.isChecked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun sendMode(type: Boolean) {
|
||||
val intent = Intent(Intents.ACTION_Glo_Mode)
|
||||
intent.putExtra("mode", type)
|
||||
sendBroadcast(
|
||||
intent.setPackage(this.packageName)
|
||||
)
|
||||
}
|
||||
|
||||
enum class ProxyMode {
|
||||
PAC, GLOBAL, PACKAGE
|
||||
}
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonArray
|
||||
import com.yingmao.clash.base.PublicViewMode
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.yingmao.clash.entity.ClashNodebBean
|
||||
import com.yingmao.clash.listener.AsyncCallBackListener
|
||||
import com.yingmao.clash.net.http.HttpApi
|
||||
import com.yingmao.clash.net.http.HttpReqType
|
||||
import com.yingmao.clash.net.http.NetService
|
||||
import com.cncat.vpn.service.data.Imported
|
||||
import com.cncat.vpn.service.data.ImportedDao
|
||||
import com.cncat.vpn.service.data.PendingDao
|
||||
import com.cncat.vpn.service.util.sendBroadcastNodeInfo
|
||||
import com.cncat.vpn.service.util.sendProfileChanged
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.yaml.snakeyaml.Yaml
|
||||
import java.math.BigDecimal
|
||||
|
||||
|
||||
class ProxyModeAtyVM : PublicViewMode() {
|
||||
|
||||
fun get_Node_Other(url: String, listener: AsyncCallBackListener) {
|
||||
Log.d("get_Node_Other start")
|
||||
val client = OkHttpClient()
|
||||
try {
|
||||
val request = Request.Builder()
|
||||
.url(url)
|
||||
.header("User-Agent", "ClashforWindows/0.19.23")
|
||||
.build()
|
||||
|
||||
client.newCall(request).execute().use { response ->
|
||||
if (!response.isSuccessful || response.headers["subscription-userinfo"] == null) return
|
||||
|
||||
var upload: Long = 0
|
||||
var download: Long = 0
|
||||
var total: Long = 0
|
||||
var expire: Long = 0
|
||||
|
||||
val userinfo = response.headers["subscription-userinfo"]
|
||||
// Log.d("updateFlow userinfo==>" + Gson().toJson(userinfo))
|
||||
if (response.isSuccessful && userinfo != null) {
|
||||
|
||||
val flags = userinfo.split(";")
|
||||
for (flag in flags) {
|
||||
val info = flag.split("=")
|
||||
when {
|
||||
info[0].contains("upload") && info[1].isNotEmpty() -> upload =
|
||||
BigDecimal(info[1]).longValueExact()
|
||||
|
||||
info[0].contains("download") && info[1].isNotEmpty() -> download =
|
||||
BigDecimal(info[1]).longValueExact()
|
||||
|
||||
info[0].contains("total") && info[1].isNotEmpty() -> total =
|
||||
BigDecimal(info[1]).longValueExact()
|
||||
|
||||
info[0].contains("expire") && info[1].isNotEmpty() -> {
|
||||
if (info[1].isNotEmpty()) {
|
||||
expire = (info[1].toDouble() * 1000).toLong()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d("upload==>${upload}, download==>${download}, total==>${total}, expire==>${expire}")
|
||||
response.body?.let {
|
||||
var respStr = it.string()
|
||||
val conf = Yaml().loadAs(respStr, HashMap::class.java)
|
||||
var proxies = conf.get("proxies");
|
||||
proxies?.let { pro ->
|
||||
|
||||
var proList = pro as ArrayList<Map<String, Any>>
|
||||
var gson = Gson()
|
||||
var dataList = mutableListOf<ClashNodebBean>()
|
||||
proList.forEach { item ->
|
||||
var jo = gson.toJson(item)
|
||||
var bean = gson.fromJson(jo.toString(), ClashNodebBean::class.java)
|
||||
dataList.add(bean)
|
||||
}
|
||||
listener.suc(dataList)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
listener.faild(response)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
System.out.println(e)
|
||||
Log.d("e==>" + e.localizedMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import com.yingmao.clash.R
|
||||
|
||||
|
||||
class ResetPwdActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_reset_pwd)
|
||||
}
|
||||
}
|
||||
|
|
@ -76,13 +76,7 @@ import java.util.UUID
|
|||
|
||||
|
||||
class SettingActivity : BaseActivity() {
|
||||
|
||||
lateinit var tv_proxy_model: TextView
|
||||
private lateinit var llUpErrorLog:LinearLayout
|
||||
private lateinit var llInstallApplication:LinearLayout
|
||||
private lateinit var llLanguageSwitching:LinearLayout
|
||||
private lateinit var mainAtyVM: MainAtyVM
|
||||
var upErrorLogLoading: RxDialogShapeLoading? = null
|
||||
private lateinit var aiBack: AppCompatImageView
|
||||
private lateinit var clLanguageSwitching: ConstraintLayout
|
||||
private lateinit var clVerSionUpdate: ConstraintLayout
|
||||
|
|
@ -107,9 +101,8 @@ class SettingActivity : BaseActivity() {
|
|||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
private fun initView() {
|
||||
aiBack=findViewById(R.id.aiBack)
|
||||
clLanguageSwitching=findViewById(R.id.clLanguageSwitching)
|
||||
clLanguageSwitching=findViewById(R.id.clLanguageSwitchingStr)
|
||||
clVerSionUpdate=findViewById(R.id.clVerSionUpdate)
|
||||
tv_proxy_model = findViewById(R.id.tv_proxy_model)
|
||||
clServiceTerms=findViewById(R.id.clServiceTerms)
|
||||
clyszc=findViewById(R.id.clyszc)
|
||||
clApplicationModeTitleStr=findViewById(R.id.clApplicationModeTitleStr)
|
||||
|
|
@ -300,24 +293,6 @@ class SettingActivity : BaseActivity() {
|
|||
aiBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
findViewById<View>(R.id.ll_proxy_mode).setOnClickListener {
|
||||
val intent = Intent(this, ProxyModeActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
findViewById<View>(R.id.ll_change_psw).setOnClickListener {
|
||||
val intent = Intent(this, ChangePwdActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
findViewById<View>(R.id.ll_yszc).setOnClickListener {
|
||||
val intent = Intent(this, AgreementAndPrivacyActivity::class.java)
|
||||
intent.putExtra(BZYConstants.EXTRA_KEY_AGREEMENT, BZYConstants.EXTRA_PRIVACY_AGREEMENT)
|
||||
startActivity(intent)
|
||||
}
|
||||
findViewById<View>(R.id.ll_fwtk).setOnClickListener {
|
||||
val intent = Intent(this, AgreementAndPrivacyActivity::class.java)
|
||||
intent.putExtra(BZYConstants.EXTRA_KEY_AGREEMENT, BZYConstants.EXTRA_USER_AGREEMENT)
|
||||
startActivity(intent)
|
||||
}
|
||||
findViewById<View>(R.id.clChushihua).setOnClickListener {
|
||||
if (checkExpire()) {
|
||||
RxToast.info(resources.getString(R.string.AccountExpired))
|
||||
|
|
@ -348,43 +323,8 @@ class SettingActivity : BaseActivity() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
llUpErrorLog=findViewById(R.id.llUpErrorLog)
|
||||
llUpErrorLog.setOnClickListener {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){
|
||||
if (Environment.isExternalStorageManager()) {
|
||||
showLoading(resources.getString(R.string.UploadingInProgress), this@SettingActivity)
|
||||
// 已授予权限
|
||||
val directory: File? = this@SettingActivity.getExternalFilesDir("CrashLog")
|
||||
if (directory != null) {
|
||||
val allFilePath = getAllFilePath(directory.path)
|
||||
if (allFilePath.isNotEmpty()) {
|
||||
mainAtyVM.getUploadParameters()
|
||||
} else {
|
||||
android.util.Log.i("checkPermission", "allFilePath is empty")
|
||||
hideLoading()
|
||||
RxToast.info(resources.getString(R.string.NoErrorLogs))
|
||||
}
|
||||
} else {
|
||||
hideLoading()
|
||||
RxToast.error(resources.getString(R.string.NoErrorLogs))
|
||||
}
|
||||
} else {
|
||||
// 未授予权限,跳转到设置页面
|
||||
val intent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
|
||||
startActivity(intent)
|
||||
hideLoading()
|
||||
}
|
||||
}else{
|
||||
checkPermission()
|
||||
}
|
||||
}
|
||||
llInstallApplication=findViewById(R.id.llInstallApplication)
|
||||
llInstallApplication.setOnClickListener {
|
||||
startActivity(Intent(this,InstallApplicationActivity::class.java))
|
||||
}
|
||||
llLanguageSwitching=findViewById(R.id.llLanguageSwitching)
|
||||
llLanguageSwitching.setOnClickListener {
|
||||
clLanguageSwitching=findViewById(R.id.clLanguageSwitchingStr)
|
||||
clLanguageSwitching.setOnClickListener {
|
||||
val decodeString = MMKV.defaultMMKV().decodeString(BZYConstants.languageInfo, "")
|
||||
val languageInfoList = mutableListOf<LanguageInfoEntity>()
|
||||
if (decodeString.isNullOrEmpty()) {
|
||||
|
|
@ -659,15 +599,6 @@ class SettingActivity : BaseActivity() {
|
|||
}
|
||||
})
|
||||
}
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
val isGlobal = MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
if (isGlobal) {
|
||||
tv_proxy_model.text = resources.getString(R.string.GlobalMode)
|
||||
} else {
|
||||
tv_proxy_model.text = resources.getString(R.string.RoutingMode)
|
||||
}
|
||||
}
|
||||
private fun finishInit() {
|
||||
timerJob?.cancel()
|
||||
|
||||
|
|
@ -719,7 +650,7 @@ class SettingActivity : BaseActivity() {
|
|||
)
|
||||
}
|
||||
|
||||
val task: OSSAsyncTask<*> = oss.asyncPutObject(put,
|
||||
oss.asyncPutObject(put,
|
||||
object : OSSCompletedCallback<PutObjectRequest?, PutObjectResult> {
|
||||
override fun onSuccess(request: PutObjectRequest?, result: PutObjectResult) {
|
||||
if (result.statusCode == 200) {
|
||||
|
|
|
|||
|
|
@ -1,771 +0,0 @@
|
|||
package com.yingmao.clash.act
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.materialdialogs.customview.customView
|
||||
import com.afollestad.materialdialogs.customview.getCustomView
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.cncat.vpn.core.model.LogMessage
|
||||
import com.cncat.vpn.service.ClashManager
|
||||
import com.cncat.vpn.service.ProfileManager
|
||||
import com.cncat.vpn.service.model.Profile
|
||||
import com.cncat.vpn.service.remote.IClashManager
|
||||
import com.cncat.vpn.service.remote.ILogObserver
|
||||
import com.cncat.vpn.service.remote.IProfileManager
|
||||
import com.cncat.vpn.service.remote.wrap
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonObject
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.BuildConfig
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.conf.Conf
|
||||
import com.yingmao.clash.entity.CheckLoginRsp
|
||||
import com.yingmao.clash.fragment.home.HomeFragment
|
||||
import com.yingmao.clash.fragment.setting.SettingFragment
|
||||
import com.yingmao.clash.listener.DownLoadListener
|
||||
import com.yingmao.clash.net.http.HttpApi
|
||||
import com.yingmao.clash.net.http.HttpReqType
|
||||
import com.yingmao.clash.net.http.HttpStatus
|
||||
import com.yingmao.clash.net.http.NetService
|
||||
import com.yingmao.clash.net.http.entity.AppVersionCheckRsp
|
||||
import com.yingmao.clash.net.http.entity.ExpensesRecordRsp
|
||||
import com.yingmao.clash.net.http.entity.GetActivityRsp
|
||||
import com.yingmao.clash.net.http.entity.PhDownloadUrlRsp
|
||||
import com.yingmao.clash.net.http.entity.SubscriptionRsp
|
||||
import com.yingmao.clash.remote.Remote
|
||||
import com.yingmao.clash.util.AESUtil
|
||||
import com.yingmao.clash.util.CommonUtils
|
||||
import com.yingmao.clash.util.Utils
|
||||
import com.yingmao.clash.view.RxToast
|
||||
import com.yingmao.clash.view.dialog.ActivityViewDialog
|
||||
import com.yingmao.clash.view.dialog.ActivityViewDialog.OnDialogClickListener
|
||||
import com.yingmao.clash.view.dialog.DialogAppVersion
|
||||
import com.yingmao.clash.view.dialog.DialogBandChoose
|
||||
import com.yingmao.clash.view.dialog.DialogNotice
|
||||
import com.yingmao.clash.view.dialog.RxDialogShapeLoading
|
||||
import com.yingmao.clash.vm.MainAtyVM
|
||||
import com.yingmao.clash.webview.BZYWebViewNormal
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Timer
|
||||
import java.util.TimerTask
|
||||
import java.util.UUID
|
||||
|
||||
|
||||
class UIMainActivity : BaseActivity() {
|
||||
private lateinit var bottomNavigationView: BottomNavigationView
|
||||
|
||||
val fragments = arrayListOf<Fragment>()
|
||||
private lateinit var mainAtyVM: MainAtyVM
|
||||
private var payResultLoading: RxDialogShapeLoading? = null
|
||||
private val clashRunning: Boolean
|
||||
get() = Remote.broadcasts.clashRunning
|
||||
|
||||
private var timer: Timer? = null
|
||||
private var uTimerTask: TimerTask? = null
|
||||
private var newMainActGlo: Boolean = false
|
||||
private var homeFragment: HomeFragment? = null
|
||||
private var settingFragment: SettingFragment? = null
|
||||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
private var activityDialog: ActivityViewDialog? = null
|
||||
private var checkPayResultDia: MaterialDialog? = null
|
||||
private var checkBindAccountDia: MaterialDialog? = null
|
||||
private val mPageInfo = PageInfo()
|
||||
companion object {
|
||||
//记录心跳失败次数
|
||||
var HEART_BEAT_FAILURE_FREQUENCY = 0
|
||||
const val REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY = 1000
|
||||
var isSubed = false
|
||||
var newUuid: String? = null
|
||||
var subUrl: String? = null
|
||||
var clashBinder: IClashManager? = null
|
||||
var profileBinder: IProfileManager? = null
|
||||
var isUpload: Boolean = false
|
||||
var hostsMem: ArrayList<String> = ArrayList()
|
||||
var newMainActGlo: Boolean = false
|
||||
public suspend fun setSub2(url: String) {
|
||||
profileBinder?.let { pm ->
|
||||
pm.queryAll().forEach { itemPro ->
|
||||
Log.d("uimain setSub2 itemPro.name==${itemPro.name}")
|
||||
if (itemPro.name != Conf.getClashConfName(MainApplication.getApp()?.applicationContext)) {
|
||||
Log.d("setSub2 delete ==>${itemPro.name}")
|
||||
pm.delete(itemPro.uuid)
|
||||
}
|
||||
}
|
||||
var mProfile = pm.queryAll().find {
|
||||
it.name == Conf.getClashConfName(MainApplication.getApp()?.applicationContext)
|
||||
}
|
||||
|
||||
mProfile?.let {
|
||||
var actname = it.name
|
||||
Log.d("new main actname==>" + actname)
|
||||
Log.d("setSub2 pro 已存在 ==>")
|
||||
pm.setActive(it)
|
||||
delay(500)
|
||||
//判断配置文件source
|
||||
if (!TextUtils.isEmpty(mProfile.source)) {
|
||||
Log.d("setSub2 pro.source==>${mProfile.source}, url==>${url}")
|
||||
//订阅链接不同就更换
|
||||
if (mProfile.source != url) {
|
||||
pm.patch(
|
||||
mProfile.uuid, mProfile.name,
|
||||
url, 1800000L
|
||||
)
|
||||
pm.commit(mProfile.uuid) { status ->
|
||||
android.util.Log.d(
|
||||
Conf.TAG,
|
||||
"new updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
pm.update(it.uuid)
|
||||
newUuid = mProfile.uuid.toString()
|
||||
isSubed = true
|
||||
} ?: run {
|
||||
Log.d("setSub2 go create")
|
||||
val uuid: UUID = pm.create(
|
||||
Profile.Type.Url, Conf.getClashConfName(MainApplication.getApp()?.applicationContext)
|
||||
)
|
||||
delay(500)
|
||||
pm.queryByUUID(uuid)?.let { qPro ->
|
||||
pm.setActive(qPro)
|
||||
pm.patch(
|
||||
qPro.uuid, qPro.name,
|
||||
url, 1800000L
|
||||
)
|
||||
pm.commit(qPro.uuid) { status ->
|
||||
android.util.Log.d(
|
||||
Conf.TAG,
|
||||
"new updateStatus: " + Gson().toJson(status.args) + ", pro==>" + status.progress
|
||||
)
|
||||
}
|
||||
newUuid = qPro.uuid.toString()
|
||||
isSubed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var isVip:Boolean=false
|
||||
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_uimain)
|
||||
initView(savedInstanceState)
|
||||
profileBinder =
|
||||
MainApplication.getApp()?.let { ProfileManager(it).wrap() as IProfileManager }
|
||||
clashBinder = MainApplication.getApp()?.let { ClashManager(it).wrap() as IClashManager }
|
||||
mainAtyVM = ViewModelProvider(this)[MainAtyVM::class.java]
|
||||
observe(this, mainAtyVM)
|
||||
mainAtyVM.startHeartBeat()
|
||||
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
mainAtyVM.getAirNodes()
|
||||
val isGlobal = MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
newMainActGlo = isGlobal
|
||||
startLog()
|
||||
firstEntry()
|
||||
mainAtyVM.getExpensesRecord(mPageInfo)
|
||||
}
|
||||
|
||||
private fun initView(savedInstanceState: Bundle?) {
|
||||
bottomNavigationView = findViewById(R.id.bottom_navigation)
|
||||
if (savedInstanceState == null) {
|
||||
homeFragment = HomeFragment()
|
||||
supportFragmentManager.beginTransaction()
|
||||
.add(R.id.fragmentContainer, homeFragment!!)
|
||||
.commit()
|
||||
}
|
||||
|
||||
bottomNavigationView.setOnItemSelectedListener { item ->
|
||||
when (item.itemId) {
|
||||
R.id.navigation_home -> {
|
||||
if (homeFragment == null) homeFragment = HomeFragment()
|
||||
showFragment(homeFragment!!)
|
||||
}
|
||||
|
||||
R.id.navigation_setting -> {
|
||||
if (settingFragment == null) settingFragment = SettingFragment()
|
||||
showFragment(settingFragment!!)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadFragment(fragment: Fragment) {
|
||||
val fragmentManager: FragmentManager = supportFragmentManager
|
||||
val transaction: FragmentTransaction = fragmentManager.beginTransaction()
|
||||
transaction.replace(R.id.fragmentContainer, fragment)
|
||||
transaction.commit()
|
||||
}
|
||||
|
||||
private fun showFragment(fragment: Fragment) {
|
||||
val fragmentManager = supportFragmentManager
|
||||
val transaction = fragmentManager.beginTransaction()
|
||||
|
||||
// 隐藏所有 Fragment
|
||||
fragmentManager.fragments.forEach {
|
||||
transaction.hide(it)
|
||||
}
|
||||
|
||||
if (!fragment.isAdded) {
|
||||
transaction.add(R.id.fragmentContainer, fragment)
|
||||
} else {
|
||||
transaction.show(fragment)
|
||||
}
|
||||
transaction.commit()
|
||||
}
|
||||
|
||||
override fun httpLoading(httpStatus: HttpStatus.Loading) {
|
||||
if (httpStatus.reqType == HttpReqType.HEARTBEAT) {
|
||||
Logger.d("心跳中")
|
||||
} else if (httpStatus.reqType == HttpReqType.CHECK_LOGIN) {
|
||||
showLoadingDialog(resources.getString(R.string.QueryingPaymentResults))
|
||||
}
|
||||
}
|
||||
|
||||
override fun httpSuccess(httpStatus: HttpStatus.Success) {
|
||||
when (httpStatus.reqType) {
|
||||
HttpReqType.GET_AIRNODES -> {
|
||||
val data = httpStatus.rsp as SubscriptionRsp
|
||||
if (data.code != "1000") {
|
||||
RxToast.error(resources.getString(R.string.NodeAcquisitionFailed) + "${data.msg}")
|
||||
}
|
||||
data.data.let { url ->
|
||||
android.util.Log.e("Data", "机场URL:=${url}")
|
||||
// var url2="https://api.ymvpnpro11.cc:8700/7air2vr7ikiqzgvxz/api/v1/client/subscribe?token=22f3d75079ec6fa546c1862c4354e448"
|
||||
// if (url.isNotEmpty()) {
|
||||
// subUrl = url
|
||||
// lifecycleScope.launch(Dispatchers.IO) {
|
||||
// setSub2(url)
|
||||
// }
|
||||
// }
|
||||
if (url.isNotEmpty()) {
|
||||
//todo 判断订阅地址是否修改过,未修改就用接口返回的地址反之使用本地修改的地址
|
||||
var pro_sub_url =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.PROFILE_SUB_URL, "")
|
||||
// Log.d("pro_sub_url==>${pro_sub_url}")
|
||||
if (!TextUtils.isEmpty(pro_sub_url)) {
|
||||
if (pro_sub_url == url) {
|
||||
subUrl = url
|
||||
} else {
|
||||
subUrl = pro_sub_url
|
||||
}
|
||||
} else {
|
||||
subUrl = url
|
||||
}
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
// setSub(url)
|
||||
subUrl?.let { setSub2(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HttpReqType.GetActivity -> {
|
||||
val data = httpStatus.rsp as GetActivityRsp
|
||||
if (data.code == 200) {
|
||||
if (data.data.data.list.isNotEmpty()) {
|
||||
data.data.data.list[0].redirectLink.let {
|
||||
if (activityDialog == null) {
|
||||
activityDialog =
|
||||
ActivityViewDialog(this, data.data.data.list[0].redirectLink)
|
||||
activityDialog?.setOnDialogClickListener(object :
|
||||
OnDialogClickListener {
|
||||
override fun onRechargeClickListener() {
|
||||
//跳转到支付界面
|
||||
goBackupRechargeWeb()
|
||||
}
|
||||
|
||||
override fun onCancelClickListener() {
|
||||
activityDialog?.dismiss()
|
||||
}
|
||||
})
|
||||
activityDialog?.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HttpReqType.CHECK_LOGIN -> {
|
||||
(httpStatus.rsp as CheckLoginRsp).let { checkLoginRsp ->
|
||||
if (checkLoginRsp.code == 0) {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
val oldExpireTime =
|
||||
mmkv.decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD, 0)
|
||||
val nowExpireTime = checkLoginRsp.data!!.vpnExpireTime
|
||||
|
||||
if (nowExpireTime > oldExpireTime) {
|
||||
val expired = checkLoginRsp.data.expired
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_EXPIRED, expired ?: true)
|
||||
mmkv.encode(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD, nowExpireTime)
|
||||
val hf =
|
||||
supportFragmentManager.findFragmentById(R.id.fragmentContainer) as? HomeFragment
|
||||
val sf =
|
||||
supportFragmentManager.findFragmentById(R.id.fragmentContainer) as? SettingFragment
|
||||
hf?.setExpireDate()
|
||||
sf?.setExpireDate()
|
||||
checkPayResultDia?.dismiss()
|
||||
mainAtyVM.getAirNodes()
|
||||
RxToast.info(resources.getString(R.string.SuccessfullyUpdatedUserInformation))
|
||||
} else {
|
||||
// RxToast.info(resources.getString(R.string.PaymentResultsStr))
|
||||
}
|
||||
}else if(checkLoginRsp.code == -2){
|
||||
RxToast.info(resources.getString(R.string.LoginOut))
|
||||
cleanUserInfoToLogout()
|
||||
}else {
|
||||
RxToast.info(resources.getString(R.string.QueryFailed))
|
||||
}
|
||||
payResultLoading?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
HttpReqType.PHDOWNLOADURL -> {
|
||||
(httpStatus.rsp as PhDownloadUrlRsp).let {
|
||||
if (it.code == 1000) {
|
||||
val lastNotice =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, "")
|
||||
val data = it.data
|
||||
if (data?.notice != null && lastNotice != data.notice) {
|
||||
val notice = data.notice
|
||||
val dialog = DialogNotice(this@UIMainActivity, notice, data.downloadUrl)
|
||||
dialog.setOnReadClickListener(object :
|
||||
DialogNotice.OnReadClickListener {
|
||||
override fun onReadClick() {
|
||||
MMKV.defaultMMKV()
|
||||
.encode(BZYConstants.MMKV_KEY_NOTICE_READ, data.notice)
|
||||
MMKV.defaultMMKV().encode(
|
||||
BZYConstants.MMKV_KEY_NOTICE_DOWNLOAD_READ, data.downloadUrl
|
||||
)
|
||||
dialog.dismiss()
|
||||
}
|
||||
})
|
||||
dialog.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
HttpReqType.EXPENSES_RECORD ->{
|
||||
if(httpStatus.rsp is ExpensesRecordRsp){
|
||||
httpStatus.rsp.let { expensesRecordRsp ->
|
||||
if(expensesRecordRsp.code == "1000"){
|
||||
if(expensesRecordRsp.data != null) {
|
||||
val expensesRecordList = expensesRecordRsp.data.expensesRecords
|
||||
if(expensesRecordList!=null){
|
||||
if(expensesRecordList.size>0){
|
||||
isVip=true
|
||||
}else{
|
||||
isVip=false
|
||||
}
|
||||
}else{
|
||||
isVip=false
|
||||
}
|
||||
}else{
|
||||
isVip=false
|
||||
}
|
||||
}else{
|
||||
isVip=false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun httpFailure(httpStatus: HttpStatus.Failure) {
|
||||
when (httpStatus.reqType) {
|
||||
HttpReqType.HEARTBEAT -> {
|
||||
Logger.d("心跳失败")
|
||||
if (5 <= HEART_BEAT_FAILURE_FREQUENCY) {
|
||||
HEART_BEAT_FAILURE_FREQUENCY = 0
|
||||
Logger.d("心跳失败次数超过10次,退出登录")
|
||||
cleanUserInfo()
|
||||
}
|
||||
HEART_BEAT_FAILURE_FREQUENCY++
|
||||
}
|
||||
|
||||
HttpReqType.CHECK_LOGIN -> {
|
||||
payResultLoading?.dismiss()
|
||||
RxToast.error(resources.getString(R.string.QueryFailed))
|
||||
}
|
||||
|
||||
HttpReqType.GET_AIRNODES -> {
|
||||
Logger.e("获取节点异常:${httpStatus.msg}")
|
||||
}
|
||||
|
||||
HttpReqType.VIPSIGN -> {
|
||||
RxToast.error(resources.getString(R.string.CheckFailed) + httpStatus.msg)
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showLoadingDialog(msg: String) {
|
||||
payResultLoading = RxDialogShapeLoading(this)
|
||||
payResultLoading!!.setMessage(msg)
|
||||
payResultLoading!!.show()
|
||||
}
|
||||
|
||||
private fun cleanUserInfo() {
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_PH_TOKEN)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_TOKEN)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_CURRENT_NODE)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_SELECTED_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.PROFILE_SUB_URL)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_Switch_Finsh_Set)
|
||||
Log.d("cleanUserInfo clashRunning==>${clashRunning}")
|
||||
//清除源切换记录
|
||||
|
||||
if (clashRunning) {
|
||||
fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() }
|
||||
}
|
||||
isSubed=false
|
||||
stopUploadTimer()
|
||||
mainAtyVM.stopHeartBeat()
|
||||
cleanProfile()
|
||||
startActivity(Intent(CommonUtils.getApp(), LoginActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
|
||||
fun startUploadTimer() {
|
||||
stopUploadTimer()
|
||||
if (timer == null) {
|
||||
timer = Timer()
|
||||
uTimerTask = object : TimerTask() {
|
||||
override fun run() {
|
||||
uploadLogHttp()
|
||||
}
|
||||
}
|
||||
}
|
||||
timer?.schedule(uTimerTask, 60000, 60000)
|
||||
}
|
||||
|
||||
fun stopUploadTimer() {
|
||||
timer?.cancel()
|
||||
timer = null
|
||||
uTimerTask?.cancel()
|
||||
uTimerTask = null
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
private fun cleanProfile() {
|
||||
Log.d("cleanProfile start")
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
profileBinder?.let { pm ->
|
||||
pm.queryAll().forEach { profile ->
|
||||
Log.d("cleanProfile go delete name==>${profile.name}, uuid==>${profile.uuid}")
|
||||
pm.delete(profile.uuid)
|
||||
}
|
||||
} ?: let {
|
||||
Log.d("profileBinder is null")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun startLog() {
|
||||
|
||||
launch(Dispatchers.IO) {
|
||||
val observer = object : ILogObserver {
|
||||
override fun newItem(log: LogMessage) {
|
||||
val msg = log.message
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.i("startLog msg==>${msg}")
|
||||
}
|
||||
val domain = Utils.getDomainNameFromString(msg)
|
||||
if (!TextUtils.isEmpty(domain)) {
|
||||
addOrSendHost(domain!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clashBinder?.let {
|
||||
it.setLogObserver(observer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun addOrSendHost(host: String) {
|
||||
Log.d("hostsMem size==>${hostsMem.size}")
|
||||
if (!hostsMem.contains(host) && !isApiHost(host)) {
|
||||
hostsMem.add(host + "{" + dateFormat.format(Date()))
|
||||
}
|
||||
}
|
||||
|
||||
private fun isApiHost(host: String): Boolean {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
var isApiHost = false
|
||||
val originalUrl =
|
||||
mmkv.decodeString(BZYConstants.MMKV_KEY_CURRENT_HOST, BuildConfig.service_url)
|
||||
val routerHost = mmkv.decodeStringSet(BZYConstants.MMKV_KEY_ROUTER_HOST, HashSet())
|
||||
if (originalUrl?.contains(host) == true) {
|
||||
isApiHost = originalUrl.contains(host)
|
||||
return isApiHost
|
||||
}
|
||||
routerHost?.forEach { rh ->
|
||||
isApiHost = rh.contains(host)
|
||||
}
|
||||
return isApiHost
|
||||
}
|
||||
|
||||
private fun firstEntry() {
|
||||
val decodeBool =
|
||||
MMKV.defaultMMKV().decodeBool(BZYConstants.INITIALIZATION, false)
|
||||
if (decodeBool) {
|
||||
MaterialDialog(this).show {
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.first_entry_layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
getCustomView().findViewById<TextView>(R.id.determine).setOnClickListener {
|
||||
MMKV.defaultMMKV().encode(BZYConstants.INITIALIZATION, false)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mainAtyVM.getNoticeInfo()
|
||||
activityPopupWindow()
|
||||
}
|
||||
}
|
||||
|
||||
private fun activityPopupWindow() {
|
||||
mainAtyVM.getActivity()
|
||||
}
|
||||
|
||||
fun goRechargeWeb() {
|
||||
val mmkv = MMKV.defaultMMKV()
|
||||
val a = mmkv.decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")
|
||||
val b = mmkv.decodeString(BZYConstants.MMKV_KEY_USER_ID, "")
|
||||
val c = mmkv.decodeString(BZYConstants.MMKV_KEY_PH_TOKEN, "")
|
||||
val intent = Intent(this@UIMainActivity, BZYWebViewNormal::class.java)
|
||||
val rcURL = NetService.getCurrentUrl() + "/78zccgy0nsgknh9n4/recharge?a=$a&b=$b&c=$c&d=2"
|
||||
Log.d("rcURL==>${rcURL}")
|
||||
intent.putExtra("url", rcURL)
|
||||
startActivityForResult(intent, REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY)
|
||||
}
|
||||
|
||||
public fun goCheckLogin() {
|
||||
mainAtyVM.checkLogin()
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY) {
|
||||
if (activityDialog != null) {
|
||||
activityDialog?.dismiss()
|
||||
}
|
||||
goCheckLogin()
|
||||
showBindAccount()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
if (activityDialog != null) {
|
||||
if (activityDialog!!.isShowing) {
|
||||
activityDialog!!.dismiss()
|
||||
}
|
||||
|
||||
}
|
||||
super.onDestroy()
|
||||
stopUploadTimer()
|
||||
mainAtyVM.stopHeartBeat()
|
||||
}
|
||||
|
||||
private fun showPayResultDialog() {
|
||||
checkPayResultDia = MaterialDialog(this).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.payconfirm1_dialog_layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener {
|
||||
mainAtyVM.checkLogin()
|
||||
showBindAccount()
|
||||
dismiss()
|
||||
}
|
||||
getCustomView().findViewById<TextView>(R.id.tv_pay_cancle).setOnClickListener {
|
||||
dismiss()
|
||||
showBindAccount()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBindAccount() {
|
||||
val userAccount =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")!!
|
||||
if (Utils.isEmail(userAccount) || Utils.isPhoneNumber(userAccount)) {
|
||||
return
|
||||
}
|
||||
|
||||
checkBindAccountDia = MaterialDialog(this).show {
|
||||
this.cancelable(false)
|
||||
cornerRadius(res = R.dimen.dp_10)
|
||||
customView(
|
||||
R.layout.bind_account_dialog_layout,
|
||||
scrollable = false,
|
||||
noVerticalPadding = true,
|
||||
horizontalPadding = false
|
||||
)
|
||||
getCustomView().findViewById<TextView>(R.id.tv_pay_finish).setOnClickListener {
|
||||
//跳转到绑定邮箱界面
|
||||
showBingDialogChoose()
|
||||
dismiss()
|
||||
}
|
||||
getCustomView().findViewById<TextView>(R.id.tv_pay_cancle).setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBingDialogChoose() {
|
||||
val dialog = DialogBandChoose(this@UIMainActivity)
|
||||
dialog.setOnBandClickListener(object : DialogBandChoose.OnBandClickListener {
|
||||
override fun onBandClick(isPhone: Boolean) {
|
||||
val intent = Intent(CommonUtils.getApp(), BandPhoneActivity::class.java)
|
||||
intent.putExtra("isPhone", isPhone)
|
||||
startActivity(intent)
|
||||
}
|
||||
})
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
fun uploadLogHttp() {
|
||||
if (hostsMem.size <= 0) {
|
||||
return
|
||||
}
|
||||
if (isUpload) {
|
||||
return
|
||||
}
|
||||
isUpload = true
|
||||
GlobalScope.launch {
|
||||
try {
|
||||
val hostsJsonArray = JsonArray()
|
||||
for (hostItem in hostsMem) {
|
||||
val hostAndTime = hostItem.split("{")
|
||||
val hostJsonObject = JsonObject()
|
||||
hostJsonObject.addProperty(
|
||||
"id", MMKV.defaultMMKV().decodeInt(BZYConstants.MMKV_KEY_NOTE_NODE_ID, 0)
|
||||
)
|
||||
hostJsonObject.addProperty("requestHosts", hostAndTime[0])
|
||||
hostJsonObject.addProperty("requestTime", hostAndTime[1])
|
||||
hostsJsonArray.add(hostJsonObject)
|
||||
}
|
||||
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
|
||||
val hostsJsonArrayStr = hostsJsonArray.toString()
|
||||
val hostsJsonArrayStrObject = JsonObject()
|
||||
hostsJsonArrayStrObject.addProperty("requestLogs", hostsJsonArrayStr)
|
||||
val phToken = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_PH_TOKEN, "")
|
||||
hostsJsonArrayStrObject.addProperty("phToken", phToken)
|
||||
|
||||
val encryptHostsJsonArrayStrObject = AESUtil.byteArrayToHexStr(
|
||||
AESUtil.encrypt(hostsJsonArrayStrObject.toString())
|
||||
)
|
||||
val requestBody: RequestBody = encryptHostsJsonArrayStrObject
|
||||
.toRequestBody("text/plain".toMediaTypeOrNull())
|
||||
val uploadRequestLogs = httpApi.uploadRequestLogs(requestBody)
|
||||
Log.d("uploadRequestLogs==>${uploadRequestLogs}")
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
hostsMem.clear()
|
||||
isUpload = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun goBackupRechargeWeb() {
|
||||
startActivityForResult(
|
||||
Intent(this@UIMainActivity, MemberRechargeActivity::class.java),
|
||||
REQUEST_CODE_PAY_WEB_VIEW_ACTIVITY
|
||||
)
|
||||
}
|
||||
private fun cleanUserInfoToLogout() {
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_PH_TOKEN)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_TOKEN)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_CURRENT_NODE)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_SELECTED_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.MMKV_KEY_VPN_UserCommand)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.NODE_All_ITEM_NAME_KEY)
|
||||
MMKV.defaultMMKV().removeValueForKey(BZYConstants.PROFILE_SUB_URL)
|
||||
Log.d("cleanUserInfo clashRunning==>${clashRunning}")
|
||||
if (clashRunning) {
|
||||
fragments.filterIsInstance<HomeFragment>().forEach { it.stopClash() }
|
||||
}
|
||||
isSubed=false
|
||||
stopUploadTimer()
|
||||
mainAtyVM.stopHeartBeat()
|
||||
cleanProfile()
|
||||
val intent=Intent(CommonUtils.getApp(), LoginActivity::class.java)
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
class PageInfo {
|
||||
var page = 1
|
||||
fun nextPage() {
|
||||
page++
|
||||
}
|
||||
|
||||
fun reset() {
|
||||
page = 1
|
||||
}
|
||||
|
||||
val isFirstPage: Boolean
|
||||
get() = page == 1
|
||||
}
|
||||
}
|
||||
|
|
@ -122,8 +122,6 @@ class BZYConstants {
|
|||
const val applicationMode = "ApplicationMode"
|
||||
const val CONNECTID = "connectId"
|
||||
const val is_splash_first = "is_splash_first"
|
||||
const val MMKV_KEY_Switch_Finsh_Set ="MMKV_KEY_Switch_Finsh_Set"
|
||||
const val MMKV_KEY_VPN_LogSwitch = "logSwitch"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ class Conf {
|
|||
return context?.getString(R.string.app_name_taizi)!!
|
||||
} else {
|
||||
if (BuildConfig.is_ym) {
|
||||
return context?.getString(R.string.app_name_gz)!!
|
||||
return context?.getString(R.string.yijianlian)!!
|
||||
} else {
|
||||
return context?.getString(R.string.app_name)!!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.tencent.mmkv.BuildConfig
|
|||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.base.PublicViewMode
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.yingmao.clash.act.PageInfo
|
||||
import com.yingmao.clash.act.ExpensesRecordActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.entity.ClashNodebBean
|
||||
import com.yingmao.clash.entity.NodesRsp
|
||||
|
|
@ -198,7 +198,7 @@ class AccelerateViewModel : PublicViewMode() {
|
|||
httpApi.appUpStatus(paramsToken,requestBody)
|
||||
}
|
||||
}
|
||||
fun getExpensesRecord(page : PageInfo){
|
||||
fun getExpensesRecord(page : ExpensesRecordActivity.PageInfo){
|
||||
val httpApi = NetService.instances.createHttps(HttpApi::class.java)
|
||||
val username = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME,"")!!
|
||||
val phToken = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_PH_TOKEN,"")!!
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ import com.cncat.vpn.core.model.TunnelState
|
|||
import com.orhanobut.logger.Logger
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.ExpensesRecordActivity
|
||||
import com.yingmao.clash.act.NewMainActivity
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.clashBinder
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.isSubbed
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.newUuid
|
||||
import com.yingmao.clash.act.PageInfo
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.conf.Conf
|
||||
import com.yingmao.clash.entity.ClashNodebBean
|
||||
|
|
@ -88,7 +88,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
private lateinit var tvTimeInfo:TextView
|
||||
private lateinit var tvDelayMs:TextView
|
||||
|
||||
private val mPageInfo = PageInfo()
|
||||
private val mPageInfo = ExpensesRecordActivity.PageInfo()
|
||||
private var reConnection = false
|
||||
private var connectId=-1
|
||||
var proList: MutableList<ClashNodebBean>? = null
|
||||
|
|
@ -264,7 +264,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
|
||||
val vpnRequest = context?.startClashService()
|
||||
try {
|
||||
start_u_timer()
|
||||
startUTimer()
|
||||
if (vpnRequest != null) {
|
||||
val result = startActivityForResult(
|
||||
ActivityResultContracts.StartActivityForResult(), vpnRequest
|
||||
|
|
@ -273,15 +273,17 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
stateChanged(Clash_Starting, true)
|
||||
context?.startClashService()
|
||||
accelerateViewModel.appStartupStatus()
|
||||
// clashRunning = true
|
||||
}
|
||||
}else{
|
||||
accelerateViewModel.appStartupStatus()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
stop_u_timer()
|
||||
stopUTimer()
|
||||
e.printStackTrace()
|
||||
}
|
||||
withContext(Dispatchers.Main){
|
||||
hideLoading()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -306,7 +308,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
|
||||
inner class ClashBP : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
com.cncat.vpn.common.log.Log.i("action==>" + intent?.action)
|
||||
Log.i("action==>" + intent?.action)
|
||||
when (intent?.action) {
|
||||
Intents.ACTION_CLASH_STARTED -> {
|
||||
if (::rxDialogShapeLoading.isInitialized) {
|
||||
|
|
@ -315,11 +317,6 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
accelerateIv.isSelected = true
|
||||
clashRunning = true
|
||||
|
||||
// MMKV.defaultMMKV().encode(
|
||||
// BZYConstants.MMKV_KEY_CURRENT_NODE,
|
||||
// currentNode
|
||||
// )
|
||||
// setNodeNameAndImg(currentNode!!.name)
|
||||
if (isAdded) {
|
||||
RxToast.success(resources.getString(R.string.AccelerateSuccess))
|
||||
}
|
||||
|
|
@ -332,12 +329,11 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
accelerateIv.isSelected = false
|
||||
clashRunning = false
|
||||
stop_u_timer()
|
||||
stopUTimer()
|
||||
}
|
||||
|
||||
Intents.ACTION_CLASH_REQUEST_STOP -> {
|
||||
// clashRunning = false
|
||||
com.cncat.vpn.common.log.Log.d("ACTION_CLASH_REQUEST_STOP")
|
||||
Log.d("ACTION_CLASH_REQUEST_STOP")
|
||||
if (::rxDialogShapeLoading.isInitialized) {
|
||||
if (!rxDialogShapeLoading.isShowing) {
|
||||
if (isAdded) {
|
||||
|
|
@ -349,7 +345,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
|
||||
Intents.ACTION_Glo_Mode -> {
|
||||
var mode = intent.getBooleanExtra("mode", false)
|
||||
val mode = intent.getBooleanExtra("mode", false)
|
||||
Log.d("ACTION_Glo_Mode mode==>${mode}")
|
||||
isGlo = mode
|
||||
}
|
||||
|
|
@ -357,14 +353,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun getNodesStatus() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun stateChanged(state: Int, isShowToast: Boolean) {
|
||||
private fun stateChanged(state: Int, isShowToast: Boolean) {
|
||||
Logger.i("!!!!!!!!!!:${state}")
|
||||
|
||||
when (state) {
|
||||
|
|
@ -373,18 +362,11 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
rxDialogShapeLoading.cancel()
|
||||
}
|
||||
accelerateIv.isSelected = true
|
||||
// MMKV.defaultMMKV().encode(
|
||||
// BZYConstants.MMKV_KEY_CURRENT_NODE,
|
||||
// currentNode
|
||||
// )
|
||||
// setNodeNameAndImg(currentNode!!.name)
|
||||
if (isShowToast) {
|
||||
if (isAdded) {
|
||||
RxToast.success(resources.getString(R.string.AccelerateSuccess))
|
||||
}
|
||||
}
|
||||
// File("${Core.deviceStorage.noBackupFilesDir}/${BaseService.CONFIG_FILE}").delete()
|
||||
accelerateViewModel.appStartupStatus()
|
||||
}
|
||||
|
||||
Clash_Stop -> {
|
||||
|
|
@ -392,9 +374,6 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
rxDialogShapeLoading.cancel()
|
||||
}
|
||||
accelerateIv.isSelected = false
|
||||
// if (reConnection) {
|
||||
// connectVPNSS(currentNode)
|
||||
// }
|
||||
}
|
||||
|
||||
Clash_Starting -> {
|
||||
|
|
@ -408,27 +387,37 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
}
|
||||
|
||||
// BaseService.State.Stopping -> {
|
||||
// if (::rxDialogShapeLoading.isInitialized) {
|
||||
// if (!rxDialogShapeLoading.isShowing) {
|
||||
// rxDialogShapeLoading.setMessage("正在断开...")
|
||||
// rxDialogShapeLoading.show()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
fun nodeChooseBase(data: Intent?){
|
||||
val node = data?.extras?.getString(BZYConstants.MMKV_KEY_SELECT_NODE_NAME)
|
||||
val isRunning = data?.extras?.getBoolean(BZYConstants.EXTRA_KEY_IS_RUNING)
|
||||
Log.d("onActivityResult ==>>> Node:${node}")
|
||||
node?.let {
|
||||
if (clashRunning) {
|
||||
Log.d("clashRunning $clashRunning")
|
||||
} else {
|
||||
startClash(false)
|
||||
}
|
||||
checkGlo()
|
||||
}?.run {
|
||||
if (isRunning == true && !clashRunning) {
|
||||
startClash(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
fun changeUserState(){
|
||||
tvTimeInfo.text=resources.getString(R.string.HYDq)
|
||||
}
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
com.cncat.vpn.common.log.Log.i("onActivityResult ==>>> requestCode:${requestCode} resultCode:${resultCode}")
|
||||
if (requestCode == REQUEST_CONNECT) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
if (clashRunning) {
|
||||
Log.d("clashRunning $clashRunning")
|
||||
} else {
|
||||
startClash()
|
||||
startClash(false)
|
||||
}
|
||||
} else {
|
||||
if (::rxDialogShapeLoading.isInitialized || rxDialogShapeLoading.isShowing) {
|
||||
|
|
@ -436,25 +425,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
}
|
||||
} else if (requestCode == CHECK_NODE_REQUEST_CODE) {
|
||||
val node = data?.extras?.getString(BZYConstants.MMKV_KEY_SELECT_NODE_NAME)
|
||||
val is_runing = data?.extras?.getBoolean(BZYConstants.EXTRA_KEY_IS_RUNING)
|
||||
// val node = data?.extras?.getSerializable(BZYConstants.MMKV_KEY_SELECT_NODE) as Profile
|
||||
Log.d("onActivityResult ==>>> Node:${node}")
|
||||
node?.let {
|
||||
setNodeNameAndImg(node)
|
||||
if (clashRunning) {
|
||||
Log.d("clashRunning $clashRunning")
|
||||
} else {
|
||||
startClash()
|
||||
}
|
||||
checkGlo()
|
||||
}?.run {
|
||||
if (is_runing == true && !clashRunning) {
|
||||
startClash()
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
getDelayData()
|
||||
} else if (requestCode == Proxy_Mode_REQUEST_CODE) {
|
||||
checkGlo()
|
||||
}
|
||||
|
|
@ -462,8 +433,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
fun setExpireDate() {
|
||||
var isExpire = checkExpire()
|
||||
// var isExpire = false
|
||||
val isExpire = checkExpire()
|
||||
var endTimeInfo = "--"
|
||||
if (isExpire) {
|
||||
if (isAdded) {
|
||||
|
|
@ -519,118 +489,38 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
}
|
||||
|
||||
tv_end_time.text = endTimeInfo
|
||||
tvEndTime.text = endTimeInfo
|
||||
}
|
||||
|
||||
private fun checkExpire(): Boolean {
|
||||
val validPeriod = MMKV.defaultMMKV().decodeLong(BZYConstants.MMKV_KEY_VPN_VALID_PERIOD)
|
||||
if (validPeriod > 0) {
|
||||
var nowTime = System.currentTimeMillis();
|
||||
com.cncat.vpn.common.log.Log.d("validPeriod==>$validPeriod, nowTime==>$nowTime")
|
||||
val nowTime = System.currentTimeMillis();
|
||||
Log.d("validPeriod==>$validPeriod, nowTime==>$nowTime")
|
||||
if (validPeriod >= nowTime) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private fun setNodeNameAndImg(it: String) {
|
||||
launch(Dispatchers.Main) {
|
||||
nodeNameTv.text = it
|
||||
when {
|
||||
it.contains("中国", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_china)
|
||||
}
|
||||
|
||||
it.contains("香港", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_china)
|
||||
}
|
||||
|
||||
it.contains("日本", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_japan)
|
||||
}
|
||||
|
||||
it.contains("韩国", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_korea)
|
||||
}
|
||||
|
||||
it.contains("美国", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_usa)
|
||||
}
|
||||
|
||||
it.contains("德国", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_germany)
|
||||
}
|
||||
|
||||
it.contains("法国", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_france)
|
||||
}
|
||||
|
||||
it.contains("俄罗斯", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_russia)
|
||||
}
|
||||
|
||||
it.contains("新加坡", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_singapore)
|
||||
}
|
||||
|
||||
it.contains("英国", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_uk)
|
||||
}
|
||||
|
||||
it.contains("澳大利亚", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_australia)
|
||||
}
|
||||
|
||||
it.contains("印度", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_india)
|
||||
}
|
||||
|
||||
it.contains("加拿大", true) -> {
|
||||
countryIv.setImageResource(R.drawable.flag_canada)
|
||||
}
|
||||
|
||||
else -> {
|
||||
countryIv.setImageResource(R.drawable.ic_s_location)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun goRechargeWeb() {
|
||||
if (activity != null) {
|
||||
var mact = activity as NewMainActivity
|
||||
mact.goRechargeWeb()
|
||||
}
|
||||
}
|
||||
|
||||
private fun goNewRecharge() {
|
||||
if (activity != null) {
|
||||
var mact = activity as NewMainActivity
|
||||
mact.goBackupRechargeWeb()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateUserInfo() {
|
||||
if (activity != null) {
|
||||
var mact = activity as NewMainActivity
|
||||
mact.goCheckLogin()
|
||||
val mainAct = activity as NewMainActivity
|
||||
mainAct.goCheckLogin()
|
||||
}
|
||||
}
|
||||
|
||||
private fun start_u_timer() {
|
||||
private fun startUTimer() {
|
||||
if (activity != null) {
|
||||
var mact = activity as NewMainActivity
|
||||
mact.startUploadTimer()
|
||||
val mainAct = activity as NewMainActivity
|
||||
mainAct.startUploadTimer()
|
||||
}
|
||||
}
|
||||
|
||||
private fun stop_u_timer() {
|
||||
private fun stopUTimer() {
|
||||
if (activity != null) {
|
||||
var mact = activity as NewMainActivity
|
||||
mact.stopUploadTimer()
|
||||
val mainAct = activity as NewMainActivity
|
||||
mainAct.stopUploadTimer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -639,7 +529,6 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
val isGlobal = isGlo
|
||||
val isGlobal2 = MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_GLOBAL_MODEL, false)
|
||||
Log.i("checkGlo isGlobal==>${isGlobal}, isGlobal2==>${isGlobal2}")
|
||||
setProxyModeView(isGlobal)
|
||||
launch(Dispatchers.IO) {
|
||||
if (isGlobal) {
|
||||
if (clashRunning) {
|
||||
|
|
@ -648,15 +537,15 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
} else {
|
||||
if (clashRunning) {
|
||||
delay(1000)
|
||||
NewMainActivity.clashBinder?.let { cm ->
|
||||
clashBinder?.let { cm ->
|
||||
val names = cm.queryProxyGroupNames(false)
|
||||
Log.i("checkGlo names==>${names}")
|
||||
if (names.isNotEmpty()) {
|
||||
var selected_name =
|
||||
val selectedName =
|
||||
MMKV.defaultMMKV()
|
||||
.decodeString(BZYConstants.NODE_SELECTED_NAME_KEY, "");
|
||||
Log.i("selected_name ==>${selected_name}")
|
||||
if (!TextUtils.isEmpty(selected_name)) {
|
||||
Log.i("selected_name ==>${selectedName}")
|
||||
if (!TextUtils.isEmpty(selectedName)) {
|
||||
val o = cm.queryOverride(Clash.OverrideSlot.Session)
|
||||
o.mode = TunnelState.Mode.Rule
|
||||
cm.patchOverride(Clash.OverrideSlot.Session, o)
|
||||
|
|
@ -669,9 +558,7 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
gName = names[1]
|
||||
}
|
||||
}
|
||||
cm.patchSelector(gName, selected_name!!)
|
||||
|
||||
} else {
|
||||
cm.patchSelector(gName, selectedName!!)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -680,103 +567,86 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setProxyModeView(isGlobal: Boolean) {
|
||||
if (isGlobal) {
|
||||
iv_proxy_mode.setImageResource(R.drawable.ic_s_global)
|
||||
if (isAdded) {
|
||||
tv_proxy_model.text = resources.getString(R.string.GlobalMode)
|
||||
}
|
||||
} else {
|
||||
iv_proxy_mode.setImageResource(R.drawable.smart)
|
||||
if (isAdded) {
|
||||
tv_proxy_model.text = resources.getString(R.string.IntelligentMode)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
var proList: MutableList<ClashNodebBean>? = null
|
||||
private suspend fun getNodes() {
|
||||
var selected_name =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.NODE_SELECTED_NAME_KEY, "");
|
||||
Log.d("getNodes selected_name==>${selected_name}")
|
||||
if (TextUtils.isEmpty(selected_name)) {
|
||||
NewMainActivity.subUrl?.let {
|
||||
accelerateViewModel?.get_Node_Other(it, object : AsyncCallBackListener {
|
||||
override fun suc(obj: Any?) {
|
||||
proList = obj as MutableList<ClashNodebBean>
|
||||
proList?.let { proListItem ->
|
||||
var nodeName = proListItem[0].name
|
||||
if (!TextUtils.isEmpty(nodeName)) {
|
||||
launch(Dispatchers.IO) {
|
||||
NewMainActivity.clashBinder?.let { cm ->
|
||||
coroutineScope {
|
||||
val selectedName =
|
||||
MMKV.defaultMMKV().decodeString(BZYConstants.NODE_SELECTED_NAME_KEY, "")
|
||||
Log.d("getNodes selected_name==>${selectedName}")
|
||||
if (TextUtils.isEmpty(selectedName)) {
|
||||
NewMainActivity.subUrl?.let {
|
||||
accelerateViewModel.get_Node_Other(it, object : AsyncCallBackListener {
|
||||
override fun suc(obj: Any?) {
|
||||
proList = obj as MutableList<ClashNodebBean>
|
||||
proList?.let { proListItem ->
|
||||
val nodeName = proListItem[0].name
|
||||
if (!TextUtils.isEmpty(nodeName)) {
|
||||
launch(Dispatchers.IO) {
|
||||
clashBinder?.let { cm ->
|
||||
|
||||
val o = cm.queryOverride(Clash.OverrideSlot.Session)
|
||||
o.mode = TunnelState.Mode.Global
|
||||
cm.patchOverride(Clash.OverrideSlot.Session, o)
|
||||
delay(3000)
|
||||
//等待全局模式生效
|
||||
var maxIndex = 0
|
||||
while (true) {
|
||||
if (maxIndex > 3) {
|
||||
break
|
||||
}
|
||||
var names = cm.queryProxyGroupNames(false)
|
||||
if (names.isNotEmpty()) {
|
||||
if (names[0] == "GLOBAL") {
|
||||
Log.d("repeat end")
|
||||
val o = cm.queryOverride(Clash.OverrideSlot.Session)
|
||||
o.mode = TunnelState.Mode.Global
|
||||
cm.patchOverride(Clash.OverrideSlot.Session, o)
|
||||
delay(3000)
|
||||
//等待全局模式生效
|
||||
var maxIndex = 0
|
||||
while (true) {
|
||||
if (maxIndex > 3) {
|
||||
break
|
||||
}
|
||||
val names = cm.queryProxyGroupNames(false)
|
||||
if (names.isNotEmpty()) {
|
||||
if (names[0] == "GLOBAL") {
|
||||
Log.d("repeat end")
|
||||
break
|
||||
}
|
||||
}
|
||||
Log.d("repeat agent")
|
||||
maxIndex++
|
||||
delay(1000)
|
||||
}
|
||||
Log.d("repeat agent")
|
||||
maxIndex++
|
||||
delay(1000)
|
||||
}
|
||||
|
||||
cm.patchSelector("GLOBAL", nodeName)
|
||||
cm.patchSelector("GLOBAL", nodeName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun faild(response: Response) {
|
||||
}
|
||||
override fun faild(response: Response) {
|
||||
}
|
||||
|
||||
override fun err(msg: String, exception: Exception?) {
|
||||
}
|
||||
override fun err(msg: String, exception: Exception?) {
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
} else {
|
||||
NewMainActivity.clashBinder?.let { cm ->
|
||||
val o = cm.queryOverride(Clash.OverrideSlot.Session)
|
||||
o.mode = TunnelState.Mode.Global
|
||||
cm.patchOverride(Clash.OverrideSlot.Session, o)
|
||||
delay(3000)
|
||||
//等待全局
|
||||
var maxIndex = 0
|
||||
while (true) {
|
||||
if (maxIndex > 3) {
|
||||
break
|
||||
}
|
||||
var names = cm.queryProxyGroupNames(false)
|
||||
if (names.isNotEmpty()) {
|
||||
if (names[0] == "GLOBAL") {
|
||||
Log.d("repeat end")
|
||||
})
|
||||
}
|
||||
} else {
|
||||
clashBinder?.let { cm ->
|
||||
val o = cm.queryOverride(Clash.OverrideSlot.Session)
|
||||
o.mode = TunnelState.Mode.Global
|
||||
cm.patchOverride(Clash.OverrideSlot.Session, o)
|
||||
delay(3000)
|
||||
//等待全局
|
||||
var maxIndex = 0
|
||||
while (true) {
|
||||
if (maxIndex > 3) {
|
||||
break
|
||||
}
|
||||
val names = cm.queryProxyGroupNames(false)
|
||||
if (names.isNotEmpty()) {
|
||||
if (names[0] == "GLOBAL") {
|
||||
Log.d("repeat end")
|
||||
break
|
||||
}
|
||||
}
|
||||
Log.d("repeat agent")
|
||||
maxIndex++
|
||||
delay(1000)
|
||||
}
|
||||
Log.d("repeat agent")
|
||||
maxIndex++
|
||||
delay(1000)
|
||||
}
|
||||
|
||||
cm.patchSelector("GLOBAL", selected_name!!)
|
||||
cm.patchSelector("GLOBAL", selectedName!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -801,9 +671,16 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
if(dataInfo.data!=null){
|
||||
if(dataInfo.data.id!=null){
|
||||
connectId= dataInfo.data.id
|
||||
|
||||
val serviceIntent= Intent(requireContext(), ConnectionService::class.java)
|
||||
serviceIntent.putExtra("receiver",resultReceiver)
|
||||
requireContext().startService(serviceIntent)
|
||||
val serviceRunning =
|
||||
Utils.isServiceRunning(requireContext(), ConnectionService::class.java)
|
||||
android.util.Log.i("AppStartupStatus","data::"+serviceRunning)
|
||||
if(!serviceRunning){
|
||||
requireContext().startService(serviceIntent)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -812,6 +689,26 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
val serviceIntent= Intent(requireContext(), ConnectionService::class.java)
|
||||
requireContext().stopService(serviceIntent)
|
||||
}
|
||||
HttpReqType.EXPENSES_RECORD->{
|
||||
if(httpStatus.rsp is ExpensesRecordRsp){
|
||||
httpStatus.rsp.let { expensesRecordRsp ->
|
||||
if(expensesRecordRsp.code == "1000"){
|
||||
if(expensesRecordRsp.data != null){
|
||||
val expensesRecordList = expensesRecordRsp.data.expensesRecords
|
||||
if(expensesRecordList!=null){
|
||||
if(expensesRecordList.size>0){
|
||||
tvTimeInfo.text=resources.getString(R.string.HYDq)
|
||||
}else{
|
||||
tvTimeInfo.text=resources.getString(R.string.YkStr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
RxToast.error("${expensesRecordRsp.code}${expensesRecordRsp.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else->{
|
||||
|
||||
}
|
||||
|
|
@ -830,4 +727,36 @@ open class NewAccFragment : BaseFragment(), CoroutineScope by CoroutineScope(Dis
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
val serviceRunning =
|
||||
Utils.isServiceRunning(requireContext(), ConnectionService::class.java)
|
||||
if(serviceRunning){
|
||||
val serviceIntent= Intent(requireContext(), ConnectionService::class.java)
|
||||
requireContext().stopService(serviceIntent)
|
||||
}
|
||||
}
|
||||
fun showLoading(str: String, context: Context) {
|
||||
val message = if (TextUtils.isEmpty(str)) "进行中..." else str
|
||||
if (baseLoading == null) {
|
||||
baseLoading = RxDialogShapeLoading(context)
|
||||
}
|
||||
baseLoading?.setMessage(message)
|
||||
if (baseLoading?.isShowing == false) {
|
||||
baseLoading?.show()
|
||||
}
|
||||
}
|
||||
|
||||
fun hideLoading() {
|
||||
if (baseLoading != null && baseLoading?.isShowing == true) {
|
||||
baseLoading?.cancel()
|
||||
}
|
||||
}
|
||||
private fun goNewRecharge() {
|
||||
if (activity != null) {
|
||||
val newMain = activity as NewMainActivity
|
||||
newMain.goBackupRechargeWeb()
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,14 +0,0 @@
|
|||
package com.yingmao.clash.fragment.recharge
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.base.BaseActivity
|
||||
|
||||
class BackupRechargeActivity : BaseActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_backup_recharge)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -25,7 +25,6 @@ import com.tencent.mmkv.MMKV
|
|||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.AgreementAndPrivacyActivity
|
||||
import com.yingmao.clash.act.MyClickableSpan
|
||||
import com.yingmao.clash.act.UIMainActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.entity.DomainItemBean
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import com.tencent.mmkv.MMKV
|
|||
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.NewMainActivity.Companion.subUrl
|
||||
import com.yingmao.clash.act.UIMainActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.entity.DomainItemBean
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import com.cncat.vpn.common.log.Log
|
|||
import com.tencent.mmkv.MMKV
|
||||
|
||||
import com.yingmao.clash.R
|
||||
import com.yingmao.clash.act.UIMainActivity
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.entity.DomainItemBean
|
||||
|
||||
|
|
|
|||
|
|
@ -1,41 +1,32 @@
|
|||
package com.yingmao.clash.vm
|
||||
|
||||
import android.os.Build
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonObject
|
||||
import com.yingmao.clash.net.http.entity.HeartBeatRsp
|
||||
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.google.gson.Gson
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.tencent.mmkv.MMKV
|
||||
import com.yingmao.clash.BuildConfig
|
||||
import com.yingmao.clash.act.NewMainActivity
|
||||
import com.yingmao.clash.base.PublicViewMode
|
||||
import com.cncat.vpn.common.log.Log
|
||||
import com.google.gson.Gson
|
||||
import com.yingmao.clash.app.MainApplication
|
||||
import com.yingmao.clash.conf.BZYConstants
|
||||
import com.yingmao.clash.entity.CheckLoginRsp
|
||||
import com.yingmao.clash.entity.ClashNodebBean
|
||||
import com.yingmao.clash.entity.Node
|
||||
import com.yingmao.clash.fragment.setting.SettingFragment
|
||||
import com.yingmao.clash.http.OkHttpBase
|
||||
import com.yingmao.clash.listener.AsyncCallBackListener
|
||||
import com.yingmao.clash.listener.DownLoadListener
|
||||
import com.yingmao.clash.net.http.HttpApi
|
||||
import com.yingmao.clash.net.http.HttpReqType
|
||||
import com.yingmao.clash.net.http.NetService
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import com.yingmao.clash.net.http.entity.HeartBeatRsp
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.yaml.snakeyaml.Yaml
|
||||
import java.math.BigDecimal
|
||||
import java.util.*
|
||||
import kotlin.concurrent.schedule
|
||||
import java.util.Timer
|
||||
import java.util.TimerTask
|
||||
|
||||
|
||||
class MainAtyVM : PublicViewMode() {
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black_141b21"
|
||||
tools:context=".fragment.recharge.BackupRechargeActivity">
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/BackupRechargeView"
|
||||
android:layout_marginTop="20dp"
|
||||
android:name="com.yingmao.clash.fragment.recharge.RechargeFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
<?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"
|
||||
android:background="@color/main_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:elevation="@dimen/dp_10"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:cardElevation="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/main_bg"
|
||||
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_pac_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/setting_bg_shape_selected"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="30dp"
|
||||
|
||||
android:layout_margin="5dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/IntelligentModeSelect"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/IntelligentStr"
|
||||
android:textColor="@color/white_70"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_proxy_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/white_70" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pac_model"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_select"
|
||||
android:visibility="invisible" />
|
||||
<RadioButton
|
||||
android:id="@+id/radio_but_pac"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</RadioButton>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/ll_global_model"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/setting_bg_shape"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingRight="30dp"
|
||||
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/GlobalMode"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/GlobalModeStr"
|
||||
android:textColor="@color/white_70"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_global_mode"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_select"
|
||||
android:visibility="invisible" />
|
||||
<RadioButton
|
||||
android:id="@+id/radio_but_global"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</RadioButton>
|
||||
</LinearLayout>
|
||||
<View
|
||||
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/white"
|
||||
android:layout_height="1dp">
|
||||
|
||||
</View>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/llApplicationMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/setting_bg_shape"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TVApplicationModeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/ApplicationMode"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TVApplicationModeTxt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/allow_all_apps"
|
||||
android:textColor="@color/red"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioApplicationMode"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</RadioButton>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/llControlApplication"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/setting_bg_shape"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TVControlApplication"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/AccessControlApplication"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TVControlApplicationStr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/ConfigurePermissions"
|
||||
android:textColor="@color/white_70"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
tools:context=".act.ResetPwdActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -439,305 +439,5 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:visibility="gone"
|
||||
app:cardCornerRadius="25dp"
|
||||
app:cardElevation="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="1dp"
|
||||
android:background="@drawable/setting_bg_shape"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_proxy_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/RoutingMode"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_proxy_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/white_70" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_change_psw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/change_password"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_fwtk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/ServiceTerms"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_yszc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/PrivacyPolicy"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_chushihua"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/InitializationRepair"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/llUpErrorLog"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/UploadErrorLog"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/llInstallApplication"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/SubApplicationProxy"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/llLanguageSwitching"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/LanguageSwitching"
|
||||
android:textColor="@color/text_yellow"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/homeact_linea_bg">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="34dp"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aiBack"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_mode_back"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="15dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:text="@string/ConnectionMode"
|
||||
android:textSize="18sp"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cardIntelligentModeSelect"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clTitle"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/setting_model_change_bg"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginBottom="28dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/aiIntelligentModeSelect"
|
||||
android:layout_marginEnd="80dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/IntelligentModeSelect"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:maxLines="2"
|
||||
android:text="@string/IntelligentStr"
|
||||
android:textColor="@color/gray_828282"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aiIntelligentModeSelect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="21dp"
|
||||
android:src="@drawable/check_img_selector"
|
||||
android:padding="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/linearLayout2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/linearLayout2"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clGlobalMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cardIntelligentModeSelect"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/setting_model_change_bg"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llGlobalMode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/aiGlobalMode"
|
||||
android:layout_marginEnd="80dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/GlobalMode"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:maxLines="2"
|
||||
android:text="@string/GlobalModeStr"
|
||||
android:textColor="@color/gray_828282"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aiGlobalMode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="21dp"
|
||||
android:src="@drawable/check_img_selector"
|
||||
android:padding="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/llGlobalMode"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/llGlobalMode"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clApplicationMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clGlobalMode"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/setting_model_change_bg"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llApplicationMode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginEnd="80dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/ApplicationMode"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tbApplicationMode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:maxLines="2"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/allow_all_apps"
|
||||
android:textColor="@color/red"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clAccessControlApplication"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clApplicationMode"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:background="@drawable/setting_model_change_bg"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llAccessControlApplication"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="22dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="80dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/AccessControlApplication"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:maxLines="2"
|
||||
android:textSize="12sp"
|
||||
android:text="@string/ConfigurePermissions"
|
||||
android:textColor="@color/gray_828282"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -1,406 +0,0 @@
|
|||
<?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"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_mine"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="23dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:text="@string/mine"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_exit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="23dp"
|
||||
android:drawablePadding="5dp"
|
||||
android:text="@string/exit"
|
||||
android:textColor="#468BFF"
|
||||
android:textSize="18sp"
|
||||
app:drawableLeftCompat="@drawable/quit" />
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="65dp"
|
||||
tools:context=".ui.fragment.mine.MineFragment">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_user_photo"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:background="@drawable/user_img"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_user_photo"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_user_photo"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_user_photo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_phone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="@color/white_50"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_username"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_username"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_username" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/mine_frg_info_bg"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingBottom="10dp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tv_phone"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_phone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_phone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_expenses_record"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="@string/expenses_record"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:drawableTopCompat="@drawable/bill" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_point_card"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="@string/point_card"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:drawableTopCompat="@drawable/card" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_change_password"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="@string/change_password"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:drawableTopCompat="@drawable/user_pwd" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_common_problem"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawablePadding="10dp"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
android:text="@string/common_problem"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
app:drawableTopCompat="@drawable/user_q_a" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/mine_frg_info_bg"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout"
|
||||
tools:layout_editor_absoluteX="16dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="15dp"
|
||||
android:text="@string/expire_date"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_s_time" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_expire_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:padding="16dp"
|
||||
android:text="--"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="8dp"
|
||||
android:paddingLeft="11dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="@string/account_status"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_s_user" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_support_acceleration_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:padding="16dp"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_proxy_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="15dp"
|
||||
android:text="智能模式"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_s_proxy" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/sc_proxy_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:padding="15dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/rl_band_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="15dp"
|
||||
android:text="完善信息"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_s_account" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_band_gift"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="完善成功,赠送时长"
|
||||
android:textColor="#FFB400"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_tixian"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="15dp"
|
||||
android:text="奖励提现"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_s_tixian" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/tv_tixian_amount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:textColor="#FFB400"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_add_freiend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gif1"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:src="@drawable/ic_s_gif" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/iv_gif1"
|
||||
android:paddingLeft="7dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="好友邀请"
|
||||
android:textColor="#FFB400"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="15dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="邀请成功,赠现金送时长"
|
||||
android:textColor="#FFB400"
|
||||
android:textSize="13sp" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_kefu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="15dp"
|
||||
android:text="联系客服"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_s_kefu" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:text="前往电报(Telegram)获取支持与福利"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_current_version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="15dp"
|
||||
android:text="@string/current_version"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:drawableLeftCompat="@drawable/ic_s_version" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_version_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:drawablePadding="10dp"
|
||||
android:padding="16dp"
|
||||
android:text="1.0"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout 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:id="@+id/swipeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragment.recharge.RechargeFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:background="@drawable/recharge_user_info_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="53dp"
|
||||
android:layout_height="53dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:background="@drawable/user_img"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_username"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:textColor="@color/white_60"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_activity_information"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="@+id/imageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_activity_information"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开通会员立享100+专属线路"
|
||||
android:textColor="#FFD200"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/imageView"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_vip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="21dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="VIP"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_check_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="23dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:text="选择时长"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_be_suitable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="(适用于手机/Pad/电脑)"
|
||||
android:textColor="@color/white_60"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tv_check_duration"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_check_duration"
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_check_duration" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_recharge_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="148dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/constraintLayout"
|
||||
app:layout_constraintStart_toStartOf="@+id/constraintLayout"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_check_duration"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="限时福利,欲购从速"
|
||||
android:textColor="@color/white_60"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_check_duration"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rv_recharge_list" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="17dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_notice">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:drawableLeft="@drawable/dianka"
|
||||
android:drawablePadding="10dp"
|
||||
android:text="点卡"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toStartOf="@+id/switch_balance"
|
||||
android:layout_centerInParent="true"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/tv_point"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_point_loading"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:indeterminateTint="@color/orange"
|
||||
android:indeterminateTintMode="src_atop"
|
||||
android:gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch_balance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:switchMinWidth="42dp"
|
||||
android:thumb="@drawable/switch_thumb_selector"
|
||||
android:track="@drawable/switch_bg_selector"
|
||||
tools:ignore="UseSwitchCompatOrMaterialXml" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="36dp"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:layout_marginBottom="36dp"
|
||||
android:background="@drawable/pay_btn_bg_selector"
|
||||
android:gravity="center"
|
||||
android:padding="15dp"
|
||||
android:text="立即支付"
|
||||
android:textColor="#2B3950"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/relativeLayout" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/main_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:elevation="@dimen/dp_10"
|
||||
app:cardCornerRadius="20dp"
|
||||
app:cardElevation="@dimen/dp_10">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/setting_bg_shape"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_proxy_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="路由模式"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_proxy_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="aaaaa"
|
||||
android:textColor="@color/white_70" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_change_psw"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="修改密码"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_fwtk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="服务条款"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white_50"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_yszc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="30dp"
|
||||
android:paddingLeft="30dp"
|
||||
android:paddingTop="@dimen/dp_10"
|
||||
android:paddingBottom="@dimen/dp_10">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="隐私政策"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:src="@drawable/ic_s_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -1,403 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:background="@drawable/ic_index_bg"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llCustomer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="41dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/ivCustomer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
app:srcCompat="@mipmap/ic_customer_service" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCustomer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="5dp"
|
||||
android:text="@string/kefu"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBinding"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="34dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:background="@drawable/home_login_splash_bg"
|
||||
android:padding="5dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="@string/login"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/llCustomer"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/llCustomer" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llNoticeBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:background="@drawable/home_notice_splash_bg"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/llCustomer">
|
||||
|
||||
<com.yingmao.clash.util.MarqueeTextView
|
||||
android:id="@+id/tvNotice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:padding="10dp"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:text="新会员充值优惠,畅享未来更多精彩"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llLink"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.135"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/llNoticeBackground">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/llIntelligentMode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/home_mode_bg"
|
||||
android:orientation="vertical"
|
||||
android:translationZ="1dp"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_proxy_mode"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="39dp"
|
||||
android:layout_marginEnd="39dp"
|
||||
android:src="@drawable/smart"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.55"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.55" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_proxy_model"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:text="@string/IntelligentMode"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_proxy_mode" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/llLine"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/home_link_bg"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/countryIv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="39dp"
|
||||
android:layout_marginEnd="39dp"
|
||||
android:src="@drawable/ic_s_location"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.55"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_percent="0.55" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nodeNameTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:text="@string/AutomaticSelection"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/countryIv" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:background="@drawable/home_pay_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/llLink">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/refresh_expire_iv"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:contentDescription="@string/confirm"
|
||||
android:src="@drawable/refresh2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvExpirationTimeTxt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@string/expire_date"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/refresh_expire_iv"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/refresh_expire_iv" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvExpirationTime"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tvExpirationTimeTxt"
|
||||
app:layout_constraintEnd_toStartOf="@+id/refresh_expire_iv"
|
||||
app:layout_constraintStart_toEndOf="@+id/tvExpirationTimeTxt"
|
||||
app:layout_constraintTop_toTopOf="@+id/tvExpirationTimeTxt" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/acceleratedStartup"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintHeight_percent="0.255"
|
||||
app:layout_constraintWidth_percent="0.588"
|
||||
android:layout_marginTop="27dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/accelerate_selector"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout2" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clActivity"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/home_activity_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/clMember"
|
||||
app:layout_constraintStart_toStartOf="@+id/clMember"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clMember">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/actIcon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:src="@mipmap/ic_home_activity"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvActIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity"
|
||||
android:textColor="@color/bule_1F22B8"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/actIcon"
|
||||
app:layout_constraintTop_toTopOf="@+id/actIcon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/actIcon"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clMember"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:background="@drawable/home_activity_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/acceleratedStartup">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center"
|
||||
>
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/appCompatImageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:src="@drawable/icon_pay"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTxt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="@string/CZHY"
|
||||
android:textColor="@color/bule_1F22B8"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/appCompatImageView"
|
||||
app:layout_constraintStart_toEndOf="@+id/appCompatImageView"
|
||||
app:layout_constraintTop_toTopOf="@+id/appCompatImageView" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llGetMember"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/clMember"
|
||||
app:layout_constraintStart_toEndOf="@+id/clMember"
|
||||
app:layout_constraintTop_toTopOf="@+id/clMember">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvGetMember"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/getMember"
|
||||
android:textColor="@color/bule_1F22B8"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvGetMemberStr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:text="@string/MoreWonderful"
|
||||
android:textColor="@color/blue_0136CB"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
<?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="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingTop="20dp">
|
||||
<Button
|
||||
android:id="@+id/create_url"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="创建"></Button>
|
||||
<Button
|
||||
android:id="@+id/query_node"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="查询节点"></Button>
|
||||
<Button
|
||||
android:id="@+id/update_but"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="更新"></Button>
|
||||
<Button
|
||||
android:id="@+id/start_v"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="开启v"></Button>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/setmode_auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="智能模式">
|
||||
|
||||
</Button>
|
||||
<Button
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/setmode_globa"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="全局模式">
|
||||
|
||||
</Button>
|
||||
<Button
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/query_mode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="查询当前模式">
|
||||
|
||||
</Button>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -416,4 +416,5 @@
|
|||
<string name="LoginOut">检测到当前账号在其他设备登录,如非本人操作,请立即修改密码并退出陌生设备。</string>
|
||||
<string name="tooFast">应用初始化中,请等待1~2秒后重试</string>
|
||||
<string name="Starting">启动中</string>
|
||||
<string name="yijianlian">一键连</string>
|
||||
</resources>
|
||||
|
|
@ -62,13 +62,6 @@ subprojects {
|
|||
applicationId = "com.jsq.wufu"
|
||||
namespace = "com.yingmao.clash"
|
||||
}
|
||||
// if (isTZ){
|
||||
// applicationId = "com.taizi.clash"
|
||||
// namespace = "com.yingmao.clash"
|
||||
// }
|
||||
// minSdk = 21
|
||||
//noinspection ExpiredTargetSdkVersion
|
||||
// targetSdk = 32
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
versionName = "1.0.4.7"
|
||||
|
|
@ -100,7 +93,7 @@ subprojects {
|
|||
}
|
||||
productFlavors {
|
||||
flavorDimensions("feature")
|
||||
create("6666") {
|
||||
create("66666") {
|
||||
isDefault = true
|
||||
dimension = flavorDimensionList[0]
|
||||
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
|
||||
|
|
@ -111,7 +104,7 @@ subprojects {
|
|||
buildConfigField("String", "applicationId", "\"com.jsq.wufu\"")
|
||||
buildConfigField("String", "service_url", "\"https://api.yijianlianjsq.com/\"")
|
||||
buildConfigField("boolean", "is_free", "false")
|
||||
buildConfigField("String", "productId", "\"6666\"")
|
||||
buildConfigField("String", "productId", "\"66666\"")
|
||||
manifestPlaceholders(
|
||||
mapOf(
|
||||
"APP_NAME" to "@string/wf",
|
||||
|
|
|
|||
Loading…
Reference in New Issue