Commit 5b98f8d8 authored by sheteng's avatar sheteng

资讯

parent 7ba55d3a
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<package android:name="com.tencent.mobileqq" /> <package android:name="com.tencent.mobileqq" />
<package android:name="com.baidu.browser.apps" /> <package android:name="com.baidu.browser.apps" />
<package android:name="com.ldsanguo.shark" /> <package android:name="com.ldsanguo.shark" />
<package android:name="com.nexon.mdnf.cbt" />
</queries> </queries>
<application <application
......
...@@ -15,5 +15,6 @@ data class GameInfo( ...@@ -15,5 +15,6 @@ data class GameInfo(
val boosterServerIp:String, val boosterServerIp:String,
val imgs: String, val imgs: String,
val introduction: String, val introduction: String,
val packageName: String val packageName: String,
val boosterPackageName :String
) )
\ No newline at end of file
package com.ccwangluo.accelerator.model package com.ccwangluo.accelerator.model
data class News ( data class News(
val aavatar: String?,
val abbrContent: String?, val abbrContent: String?,
val acreatedDate: String?,
val anickname: String?,
val auserId: String?,
val avatar: String?, val avatar: String?,
val content: String?,
val createdDate: String?, val createdDate: String?,
val greatNum: Int?, val greatNum: Int?,
val id: Int?, val id: Int,
val imgs: String?, val imgs: String?,
var isGreat: Boolean?,
val nickname: String?, val nickname: String?,
val pageViews: Int?, val pageViews: Int?,
val qavatar: String?,
val qcreatedDate: String?,
val qnickname: String?,
val quserId: String?,
val star: String?,
val title: String?, val title: String?,
val type: Int, val type: Int?,
val videoUrl: String? val videoUrl: String?
) )
\ No newline at end of file
package com.ccwangluo.accelerator.model
data class Notice(
val content: String?,
val createName: String?,
val createdDate: String?,
val gameId: Int?,
val id: Int?,
val title: String?
)
\ No newline at end of file
package com.ccwangluo.accelerator.model
data class NoticeList(
val list: List<Notice>,
val total: Int
)
\ No newline at end of file
...@@ -25,14 +25,17 @@ import com.karumi.dexter.listener.multi.MultiplePermissionsListener ...@@ -25,14 +25,17 @@ import com.karumi.dexter.listener.multi.MultiplePermissionsListener
import com.tencent.map.geolocation.TencentLocation import com.tencent.map.geolocation.TencentLocation
import com.tencent.map.geolocation.TencentLocationListener import com.tencent.map.geolocation.TencentLocationListener
import com.tencent.map.geolocation.TencentLocationManager import com.tencent.map.geolocation.TencentLocationManager
import com.tencent.mmkv.MMKV
import com.tencent.tauth.Tencent import com.tencent.tauth.Tencent
import com.umeng.socialize.UMShareAPI import com.umeng.socialize.UMShareAPI
import com.xuexiang.xpage.base.XPageActivity import com.xuexiang.xpage.base.XPageActivity
import com.xuexiang.xpage.core.PageOption import com.xuexiang.xpage.core.PageOption
import android.hardware.SensorManager import android.hardware.SensorManager
import android.hardware.SensorEventListener import android.hardware.SensorEventListener
import com.ccwangluo.accelerator.utils.SysUtils
import com.xuexiang.xutil.net.NetworkUtils
import com.xuexiang.xutil.system.PermissionUtils
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
import java.security.Permission
class MainActivity() : XPageActivity(), TencentLocationListener { class MainActivity() : XPageActivity(), TencentLocationListener {
...@@ -80,8 +83,7 @@ class MainActivity() : XPageActivity(), TencentLocationListener { ...@@ -80,8 +83,7 @@ class MainActivity() : XPageActivity(), TencentLocationListener {
p0: MutableList<PermissionRequest>?, p0: MutableList<PermissionRequest>?,
p1: PermissionToken? p1: PermissionToken?
) { ) {
println(p0) PermissionUtils.openAppSettings()
println(p1)
} }
}).check() }).check()
...@@ -103,6 +105,8 @@ class MainActivity() : XPageActivity(), TencentLocationListener { ...@@ -103,6 +105,8 @@ class MainActivity() : XPageActivity(), TencentLocationListener {
AcceleratorUtils.initConnect(this, connect) AcceleratorUtils.initConnect(this, connect)
mSensorManager = getSystemService(SENSOR_SERVICE) as SensorManager mSensorManager = getSystemService(SENSOR_SERVICE) as SensorManager
mSensorEventListener = JCVideoPlayer.JCAutoFullscreenListener() mSensorEventListener = JCVideoPlayer.JCAutoFullscreenListener()
} }
private fun initPhoneUtils() { private fun initPhoneUtils() {
......
package com.ccwangluo.accelerator.ui.dialog package com.ccwangluo.accelerator.ui.dialog
import android.app.Activity
import android.content.Context import android.content.Context
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
...@@ -8,8 +9,8 @@ import com.xuexiang.xui.widget.dialog.materialdialog.CustomMaterialDialog ...@@ -8,8 +9,8 @@ import com.xuexiang.xui.widget.dialog.materialdialog.CustomMaterialDialog
import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog import com.xuexiang.xui.widget.dialog.materialdialog.MaterialDialog
class CommonDialog( class CommonDialog(
var fragment: Fragment var context: Context
) : CustomMaterialDialog(fragment.context) { ) : CustomMaterialDialog(context) {
override fun getDialogBuilder(context: Context?): MaterialDialog.Builder { override fun getDialogBuilder(context: Context?): MaterialDialog.Builder {
......
...@@ -28,7 +28,7 @@ class MemberDialog( ...@@ -28,7 +28,7 @@ class MemberDialog(
btn.setOnClickListener { btn.setOnClickListener {
dismiss<MemberDialog>() dismiss<MemberDialog>()
val params = Bundle() val params = Bundle()
params.putString(CommonWebViewFragment.WEBVIEW_URL_KEY, HttpConfig.privacy_url) params.putString(CommonWebViewFragment.WEBVIEW_URL_KEY, HttpConfig.MEMBER_CENTER)
fragment.openPage(CommonWebViewFragment::class.java, params) fragment.openPage(CommonWebViewFragment::class.java, params)
} }
} }
......
...@@ -101,6 +101,10 @@ class AccelertorFragment : XPageFragment() { ...@@ -101,6 +101,10 @@ class AccelertorFragment : XPageFragment() {
state = it state = it
freshData(it) freshData(it)
} }
if (isStartAcc && state == BaseService.State.Stopped) {
isStartAcc = false
ToastUtils.show("加速失败")
}
if (SettingSPUtils.isSmartAccOpen) { if (SettingSPUtils.isSmartAccOpen) {
binding.smartAccOpen.setText("已开启") binding.smartAccOpen.setText("已开启")
binding.smartAccOpen.setTextColor(resources.getColor(R.color.open_acc_enable)) binding.smartAccOpen.setTextColor(resources.getColor(R.color.open_acc_enable))
...@@ -188,11 +192,13 @@ class AccelertorFragment : XPageFragment() { ...@@ -188,11 +192,13 @@ class AccelertorFragment : XPageFragment() {
binding.btnQuick.setOnClickListener { binding.btnQuick.setOnClickListener {
accelertorViewModel.accState.value?.let { accelertorViewModel.accState.value?.let {
if (it.canStop) { if (it.canStop) {
CommonDialog(this).setTitle("加速停止确认") context?.let {
CommonDialog(it).setTitle("加速停止确认")
.setContent("停止加速可能会导致游戏断线,是否确认停止?") .setContent("停止加速可能会导致游戏断线,是否确认停止?")
.setBtnLeft("取消", {}).setBtnRight("停止加速", { .setBtnLeft("取消", {}).setBtnRight("停止加速", {
AcceleratorUtils.stopAccelerator() AcceleratorUtils.stopAccelerator()
}).show<CommonDialog>() }).show<CommonDialog>()
}
return@setOnClickListener return@setOnClickListener
} }
} }
...@@ -244,6 +250,11 @@ class AccelertorFragment : XPageFragment() { ...@@ -244,6 +250,11 @@ class AccelertorFragment : XPageFragment() {
binding.gameStart.setOnClickListener { binding.gameStart.setOnClickListener {
AcceleratorUtils.game?.let { AcceleratorUtils.game?.let {
AppUtils.launchApp(it.packageName) AppUtils.launchApp(it.packageName)
if (state == BaseService.State.Connected) {
binding.gameStart.postDelayed({
ToastUtils.show("TT正在为游戏加速")
}, 1000)
}
} }
} }
} }
...@@ -275,6 +286,7 @@ class AccelertorFragment : XPageFragment() { ...@@ -275,6 +286,7 @@ class AccelertorFragment : XPageFragment() {
fun freshData(state: BaseService.State) { fun freshData(state: BaseService.State) {
if (state == BaseService.State.Connected) { if (state == BaseService.State.Connected) {
isStartAcc = false
binding.gamePicIn1.startAnimation(getDefaultAnim()) binding.gamePicIn1.startAnimation(getDefaultAnim())
binding.accStateTx.visibility = View.VISIBLE binding.accStateTx.visibility = View.VISIBLE
binding.btnQuick.setBackgroundResource(R.mipmap.quick_stop) binding.btnQuick.setBackgroundResource(R.mipmap.quick_stop)
...@@ -282,13 +294,16 @@ class AccelertorFragment : XPageFragment() { ...@@ -282,13 +294,16 @@ class AccelertorFragment : XPageFragment() {
(binding.gamePicOut.background as AnimationDrawable).stop() (binding.gamePicOut.background as AnimationDrawable).stop()
} }
if (SettingSPUtils.isFirstAccSuccess) { if (SettingSPUtils.isFirstAccSuccess) {
CommonDialog(this).setTitle("防止加速掉线") context?.let {
CommonDialog(it).setTitle("防止加速掉线")
.setContent("为了防止加速进程被手机系统中断,影响游戏加速,请确保完成相关设置") .setContent("为了防止加速进程被手机系统中断,影响游戏加速,请确保完成相关设置")
.setBtnLeft("取消", {}).setBtnRight("去设置", { .setBtnLeft("取消", {}).setBtnRight("去设置", {
openToWebview(HttpConfig.UI_SETTING_URL) openToWebview(HttpConfig.UI_SETTING_URL)
}).show<CommonDialog>() }).show<CommonDialog>()
SettingSPUtils.isFirstAccSuccess = false SettingSPUtils.isFirstAccSuccess = false
} }
}
binding.gameStart.visibility = View.VISIBLE binding.gameStart.visibility = View.VISIBLE
} else { } else {
binding.gamePicIn1.clearAnimation() binding.gamePicIn1.clearAnimation()
......
...@@ -37,7 +37,8 @@ class MineFragment : XPageFragment() { ...@@ -37,7 +37,8 @@ class MineFragment : XPageFragment() {
} }
agentWeb = agentWeb =
createAgentWeb(this, binding.mineWebview, weburl) createAgentWeb(this, binding.mineWebview, weburl)
agentWeb?.getJsInterfaceHolder()?.addJavaObject("android", AndroidInterface(this, agentWeb!!)) agentWeb?.getJsInterfaceHolder()
?.addJavaObject("android", AndroidInterface(this, agentWeb!!))
} }
override fun initListeners() { override fun initListeners() {
...@@ -68,9 +69,19 @@ class MineFragment : XPageFragment() { ...@@ -68,9 +69,19 @@ class MineFragment : XPageFragment() {
.go(url) .go(url)
} }
override fun setUserVisibleHint(isVisibleToUser: Boolean) {
super.setUserVisibleHint(isVisibleToUser)
refreshLogin()
}
override fun onHiddenChanged(hidden: Boolean) { override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden) super.onHiddenChanged(hidden)
if (!hidden) { if (!hidden) {
refreshLogin()
}
}
private fun refreshLogin() {
LoginUtils.token?.let { LoginUtils.token?.let {
agentWeb?.getJsAccessEntrace() agentWeb?.getJsAccessEntrace()
?.quickCallJs("userToken", it) ?.quickCallJs("userToken", it)
...@@ -80,14 +91,13 @@ class MineFragment : XPageFragment() { ...@@ -80,14 +91,13 @@ class MineFragment : XPageFragment() {
} }
} }
}
override fun onPause() { override fun onPause() {
agentWeb?.getWebLifeCycle()?.onPause() agentWeb?.getWebLifeCycle()?.onPause()
super.onPause() super.onPause()
} }
override fun onResume() { override fun onResume() {
refreshLogin()
agentWeb?.getWebLifeCycle()?.onResume() agentWeb?.getWebLifeCycle()?.onResume()
super.onResume() super.onResume()
} }
......
...@@ -10,6 +10,7 @@ import com.ccwangluo.accelerator.databinding.FragmentNewsBinding ...@@ -10,6 +10,7 @@ import com.ccwangluo.accelerator.databinding.FragmentNewsBinding
import com.ccwangluo.accelerator.model.News import com.ccwangluo.accelerator.model.News
import com.ccwangluo.accelerator.ui.news.NewsCollectionAdapter import com.ccwangluo.accelerator.ui.news.NewsCollectionAdapter
import com.ccwangluo.accelerator.utils.AcceleratorUtils
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.xuexiang.xpage.base.XPageFragment import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xpage.utils.TitleBar import com.xuexiang.xpage.utils.TitleBar
...@@ -27,21 +28,24 @@ class NewsFragment : XPageFragment() { ...@@ -27,21 +28,24 @@ class NewsFragment : XPageFragment() {
override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View { override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View {
_binding = FragmentNewsBinding.inflate(inflater!!, container, false) _binding = FragmentNewsBinding.inflate(inflater!!, container, false)
newsViewModel = ViewModelProvider(requireActivity()).get(NewsViewModel::class.java) newsViewModel = ViewModelProvider(this).get(NewsViewModel::class.java)
return binding.root return binding.root
} }
val titles = arrayOf("全部", "攻略", "视频", "评价", "问答") val titles = arrayOf("全部", "攻略", "视频", "评价", "问答")
var adapter: NewsCollectionAdapter? = null var adapter: NewsCollectionAdapter? = null
override fun initViews() { override fun initViews() {
newsViewModel.refreshState.observe(this, { newsViewModel.notice.observe(this,{
if (!it) { binding.tvMarquee.addDisplayString(it.title)
binding.tvMarquee.startRoll()
}
}) })
binding.tvMarquee.addDisplayString("【公告】韩服 DNF已经开启预约啦,小伙伴…") binding.refreshNews.setOnClickListener {
binding.tvMarquee.startRoll() adapter?.refresh(binding.viewPager.currentItem)
binding.refreshNews.postDelayed({
binding.refreshNews.isRefreshing = false
},1000)
}
binding.gameNewsList.adapter = KotlinDataAdapter.Builder<String>() binding.gameNewsList.adapter = KotlinDataAdapter.Builder<String>()
.setData(dataList) .setData(dataList)
...@@ -56,6 +60,9 @@ class NewsFragment : XPageFragment() { ...@@ -56,6 +60,9 @@ class NewsFragment : XPageFragment() {
tab.setCustomView(R.layout.item_tab) tab.setCustomView(R.layout.item_tab)
tab.text = titles[position] tab.text = titles[position]
}.attach() }.attach()
AcceleratorUtils.game?.let {
newsViewModel.getNotice(it.id)
}
} }
......
...@@ -4,24 +4,27 @@ import androidx.lifecycle.MutableLiveData ...@@ -4,24 +4,27 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.ccwangluo.accelerator.model.NewsModel import com.ccwangluo.accelerator.model.NewsModel
import com.ccwangluo.accelerator.model.Notice
import com.ccwangluo.accelerator.model.NoticeList
import com.ccwangluo.accelerator.utils.http.HttpGo import com.ccwangluo.accelerator.utils.http.HttpGo
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.security.auth.callback.Callback
class NewsViewModel : ViewModel() { class NewsViewModel : ViewModel() {
/**
* 刷新状态
*/
val refreshState = MutableLiveData<Boolean>()
val newsModel = MutableLiveData<NewsModel>() val newsModel = MutableLiveData<NewsModel>()
val notice = MutableLiveData<Notice>()
fun freshData(position: String, gameId: Int, page: Int) { fun freshData(position: String, gameId: Int, page: Int) {
val type = when (position) { val type = when (position) {
"0" -> ""
"1" -> 1 "1" -> 1
"2" -> 2 "2" -> 2
else -> position "3" -> 4
"4" -> 5
else -> ""
} }
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
val res = val res =
...@@ -36,7 +39,42 @@ class NewsViewModel : ViewModel() { ...@@ -36,7 +39,42 @@ class NewsViewModel : ViewModel() {
} }
} }
fun getNotice(gameId: Int) {
viewModelScope.launch(Dispatchers.IO) {
val res =
HttpGo.getSync<NoticeList>("/api/announcement/list?gameId=$gameId&page=1&size=10")
res?.let {
if (it.code == 200) {
it.data?.list?.let {
notice.postValue(it.get(0))
}
}
}
}
}
/**
* 点赞
*/
fun greate(type: Int?,parentId : Int, gameId: Int, callback: () -> Unit) {
val map = mutableMapOf<String, String>()
map.put("gameId", gameId.toString())
map.put("parentId",parentId.toString())
type?.let {
map.put("type", it.toString())
}
viewModelScope.launch(Dispatchers.IO) {
val res =
HttpGo.postSync<String>("/api/new/great", map)
res?.let {
if (it.code == 200) {
withContext(Dispatchers.Main) {
callback()
}
}
}
}
}
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.ccwangluo.accelerator.utils.http.HttpGo ...@@ -9,6 +9,7 @@ import com.ccwangluo.accelerator.utils.http.HttpGo
import com.hjq.toast.ToastUtils import com.hjq.toast.ToastUtils
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class LoginViewModel : ViewModel() { class LoginViewModel : ViewModel() {
...@@ -47,8 +48,7 @@ class LoginViewModel : ViewModel() { ...@@ -47,8 +48,7 @@ class LoginViewModel : ViewModel() {
sendCodeState.postValue(false) sendCodeState.postValue(false)
ToastUtils.show(it.error) ToastUtils.show(it.error)
} }
} }?:let {
if (res == null) {
sendCodeState.postValue(false) sendCodeState.postValue(false)
} }
} }
......
...@@ -6,6 +6,7 @@ import android.view.ViewGroup ...@@ -6,6 +6,7 @@ import android.view.ViewGroup
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.ccwangluo.accelerator.databinding.FragmentSplashBinding import com.ccwangluo.accelerator.databinding.FragmentSplashBinding
import com.ccwangluo.accelerator.ui.BottomNavigationFragment import com.ccwangluo.accelerator.ui.BottomNavigationFragment
import com.ccwangluo.accelerator.utils.SysUtils
import com.tencent.map.geolocation.TencentLocationManager import com.tencent.map.geolocation.TencentLocationManager
import com.xuexiang.xpage.annotation.Page import com.xuexiang.xpage.annotation.Page
import com.xuexiang.xpage.base.XPageFragment import com.xuexiang.xpage.base.XPageFragment
......
...@@ -6,8 +6,6 @@ import androidx.viewpager2.adapter.FragmentStateAdapter ...@@ -6,8 +6,6 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
class NewsCollectionAdapter(fragment: Fragment, val titles: Array<String>) : class NewsCollectionAdapter(fragment: Fragment, val titles: Array<String>) :
FragmentStateAdapter(fragment) { FragmentStateAdapter(fragment) {
override fun getItemCount(): Int = titles.size override fun getItemCount(): Int = titles.size
var list = mutableListOf<NewsObjectFragment>() var list = mutableListOf<NewsObjectFragment>()
......
package com.ccwangluo.accelerator.ui.news package com.ccwangluo.accelerator.ui.news
import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
...@@ -18,13 +19,10 @@ import com.ccwangluo.accelerator.utils.AcceleratorUtils ...@@ -18,13 +19,10 @@ import com.ccwangluo.accelerator.utils.AcceleratorUtils
import com.xuexiang.xpage.base.XPageFragment import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xpage.utils.TitleBar import com.xuexiang.xpage.utils.TitleBar
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
import android.graphics.Bitmap
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
import android.media.MediaMetadataRetriever
import com.ccwangluo.accelerator.model.NewsModel import com.ccwangluo.accelerator.model.NewsModel
import java.lang.IllegalArgumentException import com.ccwangluo.accelerator.ui.view.RatingBar
import com.ccwangluo.accelerator.ui.web.CommonWebViewFragment
class NewsObjectFragment : XPageFragment() { class NewsObjectFragment : XPageFragment() {
...@@ -73,7 +71,6 @@ class NewsObjectFragment : XPageFragment() { ...@@ -73,7 +71,6 @@ class NewsObjectFragment : XPageFragment() {
} ?: let { } ?: let {
itemView.findViewById<TextView>(R.id.abbrContent).visibility = View.GONE itemView.findViewById<TextView>(R.id.abbrContent).visibility = View.GONE
} }
// 资讯类型:0攻略 1视频 // 资讯类型:0攻略 1视频
val imgs = itemView.findViewById<ImageView>(R.id.imgs) val imgs = itemView.findViewById<ImageView>(R.id.imgs)
val vedio = itemView.findViewById<JCVideoPlayerStandard>(R.id.video_view) val vedio = itemView.findViewById<JCVideoPlayerStandard>(R.id.video_view)
...@@ -81,17 +78,23 @@ class NewsObjectFragment : XPageFragment() { ...@@ -81,17 +78,23 @@ class NewsObjectFragment : XPageFragment() {
vedio.tinyBackImageView.visibility = View.GONE vedio.tinyBackImageView.visibility = View.GONE
itemData.imgs?.let { itemData.imgs?.let {
imgs.visibility = View.VISIBLE imgs.visibility = View.VISIBLE
vedio.visibility = View.GONE Glide.with(this@NewsObjectFragment).load(itemData.imgs.split(",").get(0))
Glide.with(this@NewsObjectFragment).load(itemData.imgs).into(imgs) .into(imgs)
} }
itemData.videoUrl?.let { itemData.videoUrl?.let {
imgs.visibility = View.GONE
vedio.visibility = View.VISIBLE vedio.visibility = View.VISIBLE
vedio.setUp( vedio.setUp(
it, JCVideoPlayer.SCREEN_LAYOUT_LIST it, JCVideoPlayer.SCREEN_LAYOUT_LIST
) )
Glide.with(this@NewsObjectFragment).load(getNetVideoBitmap(it)) // Glide.with(this@NewsObjectFragment).load(url)
.into(vedio.thumbImageView) // .into(vedio.thumbImageView)
}
val star = itemView.findViewById<RatingBar>(R.id.star)
itemData.star?.let {
star.visibility = View.VISIBLE
star.setStar(it.toFloat())
} ?: let {
star.visibility = View.GONE
} }
itemData.pageViews?.let { itemData.pageViews?.let {
...@@ -100,6 +103,32 @@ class NewsObjectFragment : XPageFragment() { ...@@ -100,6 +103,32 @@ class NewsObjectFragment : XPageFragment() {
itemData.greatNum?.let { itemData.greatNum?.let {
itemView.findViewById<TextView>(R.id.great_num).setText("${it}") itemView.findViewById<TextView>(R.id.great_num).setText("${it}")
} }
itemData.isGreat?.let {
if(it) {
itemView.findViewById<ImageView>(R.id.great_img)
.setBackgroundResource(R.mipmap.icon_praise_bu)
} else {
itemView.findViewById<ImageView>(R.id.great_img)
.setBackgroundResource(R.mipmap.icon_praise_ga)
}
}
itemView.findViewById<ImageView>(R.id.great_img).setOnClickListener {
itemData.isGreat?.let {
if (it) {
return@setOnClickListener
}
newsViewModel.greate(itemData.type, gameId, itemData.id,{
itemData.isGreat = true
recycle_view?.adapter?.notifyDataSetChanged()
})
}
}
itemView.setOnClickListener {
val params = Bundle()
params.putString(CommonWebViewFragment.WEBVIEW_URL_KEY, "/gameDetail?gameId=${gameId}&id=${itemData.id}")
openPage(CommonWebViewFragment::class.java, params)
}
} }
.create() .create()
recycle_view?.adapter = adapter recycle_view?.adapter = adapter
...@@ -142,21 +171,6 @@ class NewsObjectFragment : XPageFragment() { ...@@ -142,21 +171,6 @@ class NewsObjectFragment : XPageFragment() {
return if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange()) true else false return if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange()) true else false
} }
fun getNetVideoBitmap(videoUrl: String?): Bitmap? {
var bitmap: Bitmap? = null
val retriever = MediaMetadataRetriever()
try {
//根据url获取缩略图
retriever.setDataSource(videoUrl, HashMap())
//获得第一帧图片
bitmap = retriever.frameAtTime
} catch (e: IllegalArgumentException) {
e.printStackTrace()
} finally {
retriever.release()
}
return bitmap
}
override fun initListeners() { override fun initListeners() {
......
package com.ccwangluo.accelerator.ui.view;
//(view)RatingBar
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.ccwangluo.accelerator.R;
import java.math.BigDecimal;
public class RatingBar extends LinearLayout {
/**
* 是否可点击
*/
private boolean mClickable;
/**
* 星星总数
*/
private int starCount;
/**
* 星星的点击事件
*/
private OnRatingChangeListener onRatingChangeListener;
/**
* 每个星星的大小
*/
private float starImageSize;
/**
* 每个星星的间距
*/
private float starPadding;
/**
* 星星的显示数量,支持小数点
*/
private float starStep;
/**
* 空白的默认星星图片
*/
private Drawable starEmptyDrawable;
/**
* 选中后的星星填充图片
*/
private Drawable starFillDrawable;
/**
* 半颗星的图片
*/
private Drawable starHalfDrawable;
/**
* 每次点击星星所增加的量是整个还是半个
*/
private StepSize stepSize;
/**
* 设置半星的图片资源文件
*/
public void setStarHalfDrawable(Drawable starHalfDrawable) {
this.starHalfDrawable = starHalfDrawable;
}
/**
* 设置满星的图片资源文件
*/
public void setStarFillDrawable(Drawable starFillDrawable) {
this.starFillDrawable = starFillDrawable;
}
/**
* 设置空白和默认的图片资源文件
*/
public void setStarEmptyDrawable(Drawable starEmptyDrawable) {
this.starEmptyDrawable = starEmptyDrawable;
}
/**
* 设置星星是否可以点击操作
*/
public void setClickable(boolean clickable) {
this.mClickable = clickable;
}
/**
* 设置星星点击事件
*/
public void setOnRatingChangeListener(OnRatingChangeListener onRatingChangeListener) {
this.onRatingChangeListener = onRatingChangeListener;
}
/**
* 设置星星的大小
*/
public void setStarImageSize(float starImageSize) {
this.starImageSize = starImageSize;
}
public void setStepSize(StepSize stepSize) {
this.stepSize = stepSize;
}
/**
* 构造函数
* 获取xml中设置的资源文件
*/
public RatingBar(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(LinearLayout.HORIZONTAL);
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RatingBar);
starImageSize = mTypedArray.getDimension(R.styleable.RatingBar_starImageSize, 20);
starPadding = mTypedArray.getDimension(R.styleable.RatingBar_starPadding, 10);
starStep = mTypedArray.getFloat(R.styleable.RatingBar_starStep, 1.0f);
stepSize = StepSize.fromStep(mTypedArray.getInt(R.styleable.RatingBar_stepSize, 1));
starCount = mTypedArray.getInteger(R.styleable.RatingBar_starCount, 5);
starEmptyDrawable = mTypedArray.getDrawable(R.styleable.RatingBar_starEmpty);
starFillDrawable = mTypedArray.getDrawable(R.styleable.RatingBar_starFill);
starHalfDrawable = mTypedArray.getDrawable(R.styleable.RatingBar_starHalf);
mClickable = mTypedArray.getBoolean(R.styleable.RatingBar_clickable, true);
mTypedArray.recycle();
for (int i = 0; i < starCount; ++i) {
final ImageView imageView = getStarImageView();
imageView.setImageDrawable(starEmptyDrawable);
imageView.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
if (mClickable) {
//浮点数的整数部分
int fint = (int) starStep;
BigDecimal b1 = new BigDecimal(Float.toString(starStep));
BigDecimal b2 = new BigDecimal(Integer.toString(fint));
//浮点数的小数部分
float fPoint = b1.subtract(b2).floatValue();
if (fPoint == 0) {
fint -= 1;
}
if (indexOfChild(v) > fint) {
setStar(indexOfChild(v) + 1);
} else if (indexOfChild(v) == fint) {
if (stepSize == StepSize.Full) {//如果是满星 就不考虑半颗星了
return;
}
//点击之后默认每次先增加一颗星,再次点击变为半颗星
if (imageView.getDrawable().getCurrent().getConstantState().equals(starHalfDrawable.getConstantState())) {
setStar(indexOfChild(v) + 1);
} else {
setStar(indexOfChild(v) + 0.5f);
}
} else {
setStar(indexOfChild(v) + 1f);
}
}
}
}
);
addView(imageView);
}
setStar(starStep);
}
/**
* 设置每颗星星的参数
*/
private ImageView getStarImageView() {
ImageView imageView = new ImageView(getContext());
LayoutParams layout = new LayoutParams(
Math.round(starImageSize), Math.round(starImageSize));//设置每颗星星在线性布局的大小
layout.setMargins(0, 0, Math.round(starPadding), 0);//设置每颗星星在线性布局的间距
imageView.setLayoutParams(layout);
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageDrawable(starEmptyDrawable);
imageView.setMinimumWidth(10);
imageView.setMaxHeight(10);
return imageView;
}
/**
* 设置星星的个数
*/
public void setStar(float rating) {
if (onRatingChangeListener != null) {
onRatingChangeListener.onRatingChange(rating);
}
this.starStep = rating;
//浮点数的整数部分
int fint = (int) rating;
BigDecimal b1 = new BigDecimal(Float.toString(rating));
BigDecimal b2 = new BigDecimal(Integer.toString(fint));
//浮点数的小数部分
float fPoint = b1.subtract(b2).floatValue();
//设置选中的星星
for (int i = 0; i < fint; ++i) {
((ImageView) getChildAt(i)).setImageDrawable(starFillDrawable);
}
//设置没有选中的星星
for (int i = fint; i < starCount; i++) {
((ImageView) getChildAt(i)).setImageDrawable(starEmptyDrawable);
}
//小数点默认增加半颗星
if (fPoint > 0) {
((ImageView) getChildAt(fint)).setImageDrawable(starHalfDrawable);
}
}
/**
* 操作星星的点击事件
*/
public interface OnRatingChangeListener {
/**
* 选中的星星的个数
*/
void onRatingChange(float ratingCount);
}
/**
* 星星每次增加的方式整星还是半星,枚举类型
* 类似于View.GONE
*/
public enum StepSize {
Half(0), Full(1);
int step;
StepSize(int step) {
this.step = step;
}
public static StepSize fromStep(int step) {
for (StepSize f : values()) {
if (f.step == step) {
return f;
}
}
throw new IllegalArgumentException();
}
}
}
...@@ -19,6 +19,8 @@ import android.content.Intent ...@@ -19,6 +19,8 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import com.hjq.toast.ToastUtils import com.hjq.toast.ToastUtils
import java.lang.Exception import java.lang.Exception
import android.util.DisplayMetrics
import com.ccwangluo.accelerator.utils.SysUtils
/** /**
...@@ -132,21 +134,25 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb) ...@@ -132,21 +134,25 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
override fun onPermissionsChecked(p0: MultiplePermissionsReport?) { override fun onPermissionsChecked(p0: MultiplePermissionsReport?) {
p0?.let { p0?.let {
it.grantedPermissionResponses.forEach { it.grantedPermissionResponses.forEach {
if (it.permissionName.equals(key)) {
agentWeb.getJsAccessEntrace() agentWeb.getJsAccessEntrace()
.quickCallJs(callback, key, "true") .quickCallJs(callback, key, "true")
} }
}
it.deniedPermissionResponses.forEach { it.deniedPermissionResponses.forEach {
if (it.permissionName.equals(key)) {
agentWeb.getJsAccessEntrace() agentWeb.getJsAccessEntrace()
.quickCallJs(callback, key, "false") .quickCallJs(callback, key, "false")
} }
} }
} }
}
override fun onPermissionRationaleShouldBeShown( override fun onPermissionRationaleShouldBeShown(
p0: MutableList<PermissionRequest>?, p0: MutableList<PermissionRequest>?,
p1: PermissionToken? p1: PermissionToken?
) { ) {
PermissionUtils.openAppSettings()
} }
}).check() }).check()
...@@ -187,7 +193,11 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb) ...@@ -187,7 +193,11 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
@JavascriptInterface @JavascriptInterface
fun getVersion(callback: String) { fun getVersion(callback: String) {
agentWeb.getJsAccessEntrace() agentWeb.getJsAccessEntrace()
.quickCallJs(callback, AppUtils.getAppVersionName(), AppUtils.getAppVersionCode().toString()) .quickCallJs(
callback,
AppUtils.getAppVersionName(),
AppUtils.getAppVersionCode().toString()
)
} }
/**************** /****************
...@@ -212,4 +222,22 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb) ...@@ -212,4 +222,22 @@ class AndroidInterface(val xPageFragment: XPageFragment, val agentWeb: AgentWeb)
} }
/**
* 获取android版本号
*/
@JavascriptInterface
fun getSystemVersion(callback: String) {
agentWeb.getJsAccessEntrace()
.quickCallJs(callback, android.os.Build.VERSION.RELEASE)
}
/**
* 获取android dpi
*/
@JavascriptInterface
fun getDpi(callback: String) {
agentWeb.getJsAccessEntrace()
.quickCallJs(callback, SysUtils.getDpi(xPageFragment).toString())
}
} }
\ No newline at end of file
...@@ -46,6 +46,7 @@ class CommonWebViewFragment : XPageFragment() { ...@@ -46,6 +46,7 @@ class CommonWebViewFragment : XPageFragment() {
} }
agentWeb?.getJsInterfaceHolder() agentWeb?.getJsInterfaceHolder()
?.addJavaObject("android", AndroidInterface(this, agentWeb!!)) ?.addJavaObject("android", AndroidInterface(this, agentWeb!!))
agentWeb?.webCreator?.webView?.requestFocus(View.FOCUS_DOWN);
} }
fun createAgentWeb(fragment: Fragment?, viewGroup: ViewGroup, url: String): AgentWeb { fun createAgentWeb(fragment: Fragment?, viewGroup: ViewGroup, url: String): AgentWeb {
......
...@@ -7,6 +7,7 @@ import androidx.activity.result.ActivityResultLauncher ...@@ -7,6 +7,7 @@ import androidx.activity.result.ActivityResultLauncher
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.ccwangluo.accelerator.model.* import com.ccwangluo.accelerator.model.*
import com.ccwangluo.accelerator.ui.dialog.CommonDialog
import com.ccwangluo.accelerator.utils.http.HttpGo import com.ccwangluo.accelerator.utils.http.HttpGo
import com.ccwangluo.cc_quickly.utils.SettingSPUtils import com.ccwangluo.cc_quickly.utils.SettingSPUtils
import com.github.shadowsocks.Core import com.github.shadowsocks.Core
...@@ -24,7 +25,9 @@ import com.github.shadowsocks.http.LineConfig ...@@ -24,7 +25,9 @@ import com.github.shadowsocks.http.LineConfig
import com.hjq.toast.ToastUtils import com.hjq.toast.ToastUtils
import com.tencent.mmkv.MMKV import com.tencent.mmkv.MMKV
import com.xuexiang.xpage.base.XPageFragment import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xutil.common.StringUtils
import com.xuexiang.xutil.net.NetworkUtils import com.xuexiang.xutil.net.NetworkUtils
import com.xuexiang.xutil.system.PermissionUtils
import kotlinx.coroutines.* import kotlinx.coroutines.*
import timber.log.Timber import timber.log.Timber
import java.util.concurrent.Executors import java.util.concurrent.Executors
...@@ -81,12 +84,24 @@ object AcceleratorUtils { ...@@ -81,12 +84,24 @@ object AcceleratorUtils {
fun initConnect(context: AppCompatActivity, connect: ActivityResultLauncher<Void?>) { fun initConnect(context: AppCompatActivity, connect: ActivityResultLauncher<Void?>) {
this.context = context this.context = context
this.connect = connect this.connect = connect
if (SysUtils.isVpn(context) && state != BaseService.State.Connected){
CommonDialog(context).setTitle("VPN被挤占")
.setContent("请确保已关闭其他加速器,并未开起任何游戏空间等类似功能")
.setBtnLeft("取消", {
context.finish()
}).setBtnRight("我知道了", {
context.finish()
NetworkUtils.openWirelessSettings()
}).show<CommonDialog>()
return
}
connection.connect(context, shadowsocksConnection) connection.connect(context, shadowsocksConnection)
ProfileManager.ensureNotEmpty() ProfileManager.ensureNotEmpty()
context.lifecycleScope.launch(Dispatchers.IO) { context.lifecycleScope.launch(Dispatchers.IO) {
while (true) { while (true) {
game?.let { game?.let {
val net = SysUtils.getNetPing(it.boosterServerIp) val net = SysUtils.getNetPing(it.boosterServerIp)
println(net)
if (state != BaseService.State.Connected) { if (state != BaseService.State.Connected) {
pre_net = net.delay pre_net = net.delay
acc_net = -1 acc_net = -1
...@@ -121,15 +136,8 @@ object AcceleratorUtils { ...@@ -121,15 +136,8 @@ object AcceleratorUtils {
fun initAuthProfile(xPageFragment: XPageFragment) { fun initAuthProfile(xPageFragment: XPageFragment) {
xPageFragment.lifecycleScope.launch(Dispatchers.IO) { xPageFragment.lifecycleScope.launch(Dispatchers.IO) {
AuthManager.getLineConfig()?.let {
if (it.code != 200) {
return@let
}
val profileId = 1L val profileId = 1L
val profile = ProfileManager.getProfile(profileId) ?: Profile() val profile = ProfileManager.getProfile(profileId) ?: Profile()
profile.host = it.data.host
profile.token = it.data.token
profile.remotePort = it.data.port
profile.proxyApps = true profile.proxyApps = true
val proxyGames = mutableSetOf( val proxyGames = mutableSetOf(
"com.sec.android.app.sbrowser", "com.sec.android.app.sbrowser",
...@@ -146,10 +154,14 @@ object AcceleratorUtils { ...@@ -146,10 +154,14 @@ object AcceleratorUtils {
"com.tgc.sky.android", "com.tgc.sky.android",
"com.YoStarJP.Arknights", "com.YoStarJP.Arknights",
"com.riotgames.league.wildrifttw", "com.riotgames.league.wildrifttw",
game?.packageName "com.baidu.browser.apps"
) )
game?.boosterPackageName?.split(",")?.forEach {
if (!StringUtils.isEmpty(it)) {
proxyGames.add(it)
}
}
proxyGames.addAll(profile.individual.split("\n")) proxyGames.addAll(profile.individual.split("\n"))
Timber.d("start vpn with games: $proxyGames")
profile.individual = proxyGames.joinToString("\n") profile.individual = proxyGames.joinToString("\n")
profile.route = Acl.BYPASS_LAN profile.route = Acl.BYPASS_LAN
profile.password = "barfoo!" profile.password = "barfoo!"
...@@ -160,7 +172,6 @@ object AcceleratorUtils { ...@@ -160,7 +172,6 @@ object AcceleratorUtils {
connect.launch(null) connect.launch(null)
} }
} }
}
} }
......
package com.ccwangluo.accelerator.utils
import kotlinx.coroutines.isActive
import timber.log.Timber
import java.io.IOException
import java.net.InetSocketAddress
import java.net.Proxy
import java.net.Socket
import java.net.UnknownHostException
import kotlin.coroutines.coroutineContext
object NetUtils {
suspend fun tcpPing(url: String, port: Int, proxyPort: Int = 0): Long {
var time = -1L
for (k in 0 until 2) {
val one = socketConnectTime(url, port, proxyPort)
if (!coroutineContext.isActive) {
break
}
if (one != -1L && (time == -1L || one < time)) {
time = one
}
}
return time
}
private fun socketConnectTime(url: String, port: Int, proxyPort: Int): Long {
try {
val socket = if (proxyPort == 0) {
Socket()
} else {
Socket(Proxy(Proxy.Type.SOCKS, InetSocketAddress("127.0.0.1", proxyPort)))
}
val start = System.currentTimeMillis()
socket.connect(InetSocketAddress(url, port))
val time = System.currentTimeMillis() - start
socket.close()
return time
} catch (e: UnknownHostException) {
e.printStackTrace()
} catch (e: IOException) {
Timber.d("socketConnectTime IOException: $e")
} catch (e: Exception) {
e.printStackTrace()
}
return -1
}
}
\ No newline at end of file
...@@ -2,13 +2,24 @@ package com.ccwangluo.accelerator.utils ...@@ -2,13 +2,24 @@ package com.ccwangluo.accelerator.utils
import android.content.Context import android.content.Context
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.net.ConnectivityManager
import android.net.Network
import android.net.Proxy
import android.os.Build
import android.text.TextUtils
import android.util.DisplayMetrics
import com.ccwangluo.accelerator.model.NetState import com.ccwangluo.accelerator.model.NetState
import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xutil.net.NetworkUtils import com.xuexiang.xutil.net.NetworkUtils
import java.io.BufferedReader import java.io.BufferedReader
import java.io.InputStreamReader import java.io.InputStreamReader
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
import android.net.NetworkCapabilities
object SysUtils { object SysUtils {
...@@ -57,6 +68,20 @@ object SysUtils { ...@@ -57,6 +68,20 @@ object SysUtils {
return NetState(-1, -1, delay, lost) return NetState(-1, -1, delay, lost)
} }
/*
* 判断设备 是否使用代理上网
* */
fun isVpn(context: Context): Boolean {
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetwork = connectivityManager?.getActiveNetwork()
val caps = connectivityManager.getNetworkCapabilities(activeNetwork)
caps?.hasTransport(NetworkCapabilities.TRANSPORT_VPN)?.let {
return it
}
return false
}
/** /**
* 判断包是否安装 * 判断包是否安装
*/ */
...@@ -93,4 +118,13 @@ object SysUtils { ...@@ -93,4 +118,13 @@ object SysUtils {
return hms return hms
} }
/**
* 获取dpi
*/
fun getDpi(xPageFragment: XPageFragment): Float {
val dm = DisplayMetrics()
xPageFragment.activity?.windowManager?.getDefaultDisplay()?.getMetrics(dm)
return (dm.density*160)
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:drawable="@mipmap/icon_praise_ga"/>
<item android:state_enabled="false" android:drawable="@mipmap/icon_praise_bu"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#4c000000" />
<size android:height="4.0dip" />
<corners android:radius="1.0dip" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<solid android:color="#ffe0e0e0" />
<size android:height="4.0dip" />
<corners android:radius="1.0dip" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/btn_blue_1" />
<size android:height="4.0dip" />
<corners android:radius="1.0dip" />
</shape>
</clip>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#cc999999" />
<size android:height="3dp" />
<corners android:radius="1.5dp" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<solid android:color="#ffe0e0e0" />
<size android:height="3dp" />
<corners android:radius="1.5dp" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/btn_blue_1" />
<size android:height="3dp" />
<corners android:radius="1.5dp" />
</shape>
</clip>
</item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+android:id/background"
android:drawable="@mipmap/star_ga">
</item>
<item
android:id="@+android:id/secondaryProgress"
android:drawable="@mipmap/star_half">
</item>
<item
android:id="@+android:id/progress"
android:drawable="@mipmap/star_bu">
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/refresh_news"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"> android:background="@color/white">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:background="@color/white"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView <TextView
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@mipmap/new_top" android:background="@mipmap/new_top"
...@@ -24,29 +29,31 @@ ...@@ -24,29 +29,31 @@
android:text="地下城与勇士 韩服" android:text="地下城与勇士 韩服"
android:textColor="#FFFFFFFF" android:textColor="#FFFFFFFF"
android:textSize="16sp" android:textSize="16sp"
app:layout_collapseMode="pin" /> app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|exitUntilCollapsed" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:id="@+id/game_news_list" android:id="@+id/game_news_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="21dp" android:layout_marginTop="21dp"
android:background="@color/white" android:background="@color/white"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_collapseMode="parallax"> app:layout_collapseMode="parallax"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
</androidx.recyclerview.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>
<LinearLayout <LinearLayout
app:layout_scrollFlags="noScroll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="21dp" android:layout_marginTop="21dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
app:layout_collapseMode="parallax"> android:layout_marginBottom="5dp"
app:layout_collapseMode="parallax"
app:layout_scrollFlags="noScroll">
<ImageView <ImageView
android:layout_width="17.95dp" android:layout_width="17.95dp"
...@@ -82,7 +89,6 @@ ...@@ -82,7 +89,6 @@
style="@style/MyTablayoutstyle" style="@style/MyTablayoutstyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp"
app:tabBackground="@null" app:tabBackground="@null"
app:tabRippleColor="@null" /> app:tabRippleColor="@null" />
...@@ -91,4 +97,6 @@ ...@@ -91,4 +97,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file </androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
\ No newline at end of file
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
android:id="@+id/nickname" android:id="@+id/nickname"
android:layout_width="70.5dp" android:layout_width="70.5dp"
android:layout_height="20dp" android:layout_height="20dp"
android:text="DNF小管家"
android:textColor="#FF000000" android:textColor="#FF000000"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -44,20 +43,33 @@ ...@@ -44,20 +43,33 @@
android:id="@+id/createdDate" android:id="@+id/createdDate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="2020-12-12"
android:textColor="#FFB4B4B4" android:textColor="#FFB4B4B4"
android:textSize="11sp" /> android:textSize="11sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<com.ccwangluo.accelerator.ui.view.RatingBar
android:id="@+id/star"
android:visibility="gone"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:starCount="5"
app:starEmpty="@mipmap/star_ga"
app:starFill="@mipmap/star_bu"
app:starHalf="@mipmap/star_half"
app:starImageSize="18dp"
app:starPadding="13.5dp"
app:starStep="0"
app:stepSize="Half"/>
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2"
android:textColor="#FF000000" android:textColor="#FF000000"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -66,8 +78,8 @@ ...@@ -66,8 +78,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:maxLines="3"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="3"
android:textColor="#FF4A4A4A" android:textColor="#FF4A4A4A"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -76,13 +88,15 @@ ...@@ -76,13 +88,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="182.5dp" android:layout_height="182.5dp"
android:layout_marginTop="12.65dp" android:layout_marginTop="12.65dp"
android:scaleType="fitXY"
android:visibility="gone" /> android:visibility="gone" />
<fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard <fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
android:id="@+id/video_view" android:id="@+id/video_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="182.5dp" android:layout_height="182.5dp"
android:layout_marginTop="12.65dp" /> android:layout_marginTop="12.65dp"
android:visibility="gone" />
<RelativeLayout <RelativeLayout
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="RatingBar">
<!--尺寸值-->
<attr name="starImageSize" format="dimension" />
<!--星星间距-->
<attr name="starPadding" format="dimension" />
<!--星星总数-->
<attr name="starCount" format="integer" />
<!--空白的星星资源文件值-->
<attr name="starEmpty" format="reference" />
<!--满星资源文件值-->
<attr name="starFill" format="reference" />
<!--半星资源文件值-->
<attr name="starHalf" format="reference" />
<!--是否可点击boolean值-->
<attr name="clickable" format="boolean" />
<!--当前进度float值-->
<attr name="starStep" format="float" />
<!--每次进度方式的值,整星还是半星-->
<attr name="stepSize">
<enum name="Half" value="0" />
<enum name="Full" value="1" />
</attr>
</declare-styleable>
</resources>
\ No newline at end of file
...@@ -19,4 +19,13 @@ ...@@ -19,4 +19,13 @@
<item name="android:textColor">#FF9E9E9E</item> <item name="android:textColor">#FF9E9E9E</item>
<item name="tabBackground">@color/white</item> <item name="tabBackground">@color/white</item>
</style> </style>
<style name="RadingStyle" parent="@android:style/Widget.RatingBar">
<!-- 定义星星图片 -->
<item name="android:progressDrawable">@drawable/layer_live_rating_bar</item>
<!-- 根据自定义星星图片的大小,设置相应的值,否则可能显示不全 -->
<item name="android:minHeight">18dp</item>
<item name="android:maxHeight">18dp</item>
<item name="android:numColumns">5</item>
</style>
</resources> </resources>
\ No newline at end of file
...@@ -88,7 +88,9 @@ object AuthManager { ...@@ -88,7 +88,9 @@ object AuthManager {
} }
val profileId = 1L val profileId = 1L
val profile = ProfileManager.getProfile(profileId) ?: Profile() val profile = ProfileManager.getProfile(profileId) ?: Profile()
profile.host = it.data.host
profile.token = it.data.token profile.token = it.data.token
profile.remotePort = it.data.port
Timber.d("start vpn with games: ${profile.individual}") Timber.d("start vpn with games: ${profile.individual}")
ProfileManager.updateProfile(profile) ProfileManager.updateProfile(profile)
} }
...@@ -119,7 +121,7 @@ object AuthManager { ...@@ -119,7 +121,7 @@ object AuthManager {
} }
} }
}, 3, 3, TimeUnit.MINUTES) }, 1, 1, TimeUnit.MINUTES)
} }
fun getToken(): FreshToken? { fun getToken(): FreshToken? {
......
...@@ -9,8 +9,8 @@ object HttpConfig { ...@@ -9,8 +9,8 @@ object HttpConfig {
/** /**
* 主页h5 * 主页h5
*/ */
val UI_MAIN_URL = "https://test-cc-tt-front.orangenet.org.cn/#" // val UI_MAIN_URL = "https://test-cc-tt-front.orangenet.org.cn/#"
// val UI_MAIN_URL = "http://10.3.0.217:8080/#" val UI_MAIN_URL = "http://10.3.0.217:8080/#"
//隐私协议地址 //隐私协议地址
val privacy_url = "http:wwww.baidu.com" val privacy_url = "http:wwww.baidu.com"
...@@ -25,4 +25,6 @@ object HttpConfig { ...@@ -25,4 +25,6 @@ object HttpConfig {
val UI_QUESTION_URL = "/questionDetail" val UI_QUESTION_URL = "/questionDetail"
val UI_SPEED_URL = "/speed" val UI_SPEED_URL = "/speed"
val MEMBER_CENTER = "/memberCenter"
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment