add logcatch debug view

This commit is contained in:
zhongchao
2022-01-07 20:37:26 +08:00
parent 202f7bf3c3
commit 5105e66388
44 changed files with 2594 additions and 5 deletions

View File

@@ -109,8 +109,12 @@ object MogoLogCatchManager : IMogoOnMessageListener<RemoteLogPushContent>, Handl
logInfoManager = LogInfoManagerFactory.createPushLogInfoManager(
mContext,
MoGoAiCloudClientConfig.getInstance().sn + File.separator + TimeUtils.formatYMD(System.currentTimeMillis()),
content, this)
content, this
)
logInfoManager?.start()
logInfoManager?.registerLogOutListener { lineLog ->
CallerDevaToolsListenerManager.invokeDevaToolsLogCatchLines(lineLog)
}
}
private fun stopCatchLog(content: RemoteLogPushContent) {

View File

@@ -0,0 +1,496 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.res.Resources
import android.graphics.PixelFormat
import android.util.Log
import android.view.*
import android.widget.FrameLayout
import androidx.annotation.IdRes
import androidx.annotation.StringRes
import androidx.core.view.GravityCompat
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.eagle.core.utilcode.util.ScreenUtils
import com.mogo.eagle.core.utilcode.util.Utils
abstract class AbsLogView : ILogView, TouchProxy.OnTouchEventListener {
class ViewArgs {
var edgePinned = false
}
private val mInnerReceiver = InnerReceiver()
@JvmField
protected var mWindowManager =
ContextHolderUtil.getContext().getSystemService(Context.WINDOW_SERVICE) as WindowManager
/**
* 创建FrameLayout#LayoutParams 系统悬浮窗调用
*/
protected var systemLayoutParams: WindowManager.LayoutParams? = null
/**
* 整个悬浮窗的View
*/
private var mRootView: FrameLayout? = null
/**
* rootView的直接子View 一般是用户的xml布局 被添加到mRootView中
*/
private var mChildView: View? = null
val logView: View?
get() = mRootView
/**
* 手势代理
*/
@JvmField
var mTouchProxy = TouchProxy(this)
private val viewProps = ViewArgs()
/**
* 控件在布局边界发生大小变化被裁剪的原因
*/
val parentView: LogFrameLayout?
get() = if (mRootView != null) {
mRootView!!.parent as LogFrameLayout
} else null
fun show(context: Context) {
if (isShow) {
Log.d("EmArrow", "isShow : $isShow")
return
}
performCreate(context)
createView()
onResume()
}
fun dismiss() {
removeView()
performDestroy()
}
/**
* 执行floatPage create
*
* @param context 上下文环境
*/
@SuppressLint("ClickableViewAccessibility")
private fun performCreate(context: Context) {
try {
//调用onCreate方法
onCreate(context)
//系统悬浮窗的返回按键监听
mRootView = object : LogFrameLayout(context, LogFrameLayoutFlag_CHILD) {
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
if (event.action == KeyEvent.ACTION_UP && shouldDealBackKey()) {
//监听返回键
if (event.keyCode == KeyEvent.KEYCODE_BACK || event.keyCode == KeyEvent.KEYCODE_HOME) {
return onBackPressed()
}
}
return super.dispatchKeyEvent(event)
}
}
//添加根布局的layout回调
addViewTreeObserverListener()
//调用onCreateView抽象方法
mChildView = onCreateView(context, mRootView)
//将子View添加到rootView中
mRootView?.addView(mChildView)
//设置根布局的手势拦截
mRootView?.setOnTouchListener { v, event -> mTouchProxy.onTouchEvent(v, event) }
//调用onViewCreated回调
onViewCreated(mRootView)
mLogViewLayoutParams = LogViewLayoutParams()
//分别创建对应的LayoutParams
systemLayoutParams = WindowManager.LayoutParams()
//shouldDealBackKey : false 不自己收返回事件处理
if (shouldDealBackKey()) {
//自己处理返回按键
systemLayoutParams?.flags =
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
mLogViewLayoutParams.flags =
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or LogViewLayoutParams.FLAG_LAYOUT_NO_LIMITS
} else {
//设置WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE会导致RootView监听不到返回按键的监听失效 系统处理返回按键
systemLayoutParams?.flags =
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
mLogViewLayoutParams.flags =
LogViewLayoutParams.FLAG_NOT_FOCUSABLE or LogViewLayoutParams.FLAG_LAYOUT_NO_LIMITS
}
systemLayoutParams?.apply {
format = PixelFormat.TRANSPARENT
gravity = GravityCompat.START or Gravity.TOP
}
mLogViewLayoutParams.gravity = GravityCompat.START or Gravity.TOP
//动态注册关闭系统弹窗的广播
val intentFilter = IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
context.registerReceiver(mInnerReceiver, intentFilter)
initViewLayoutParams(mLogViewLayoutParams)
onSystemLayoutParamsCreated()
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun createView() {
mWindowManager.addView(logView, systemLayoutParams)
}
override fun onResume() {
mRootView?.requestLayout()
}
private fun removeView() {
mWindowManager.removeView(logView)
}
private fun performDestroy() {
context?.unregisterReceiver(mInnerReceiver)
//移除布局监听
removeViewTreeObserverListener()
mRootView = null
onDestroy()
}
/**
* 用来保存rootView的LayoutParams
*/
private lateinit var mLogViewLayoutParams: LogViewLayoutParams
/**
* 上一次LogView的位置信息
*/
private val mLastLogViewPosInfo: LastLogViewPosInfo = LastLogViewPosInfo()
/**
* 根布局的实际宽
*/
private var mLogViewWidth = 0
/**
* 根布局的实际高
*/
private var mLogViewHeight = 0
private var mViewTreeObserver: ViewTreeObserver? = null
private val mOnGlobalLayoutListener: ViewTreeObserver.OnGlobalLayoutListener =
ViewTreeObserver.OnGlobalLayoutListener {
//每次布局发生变动的时候重新赋值
mRootView?.let {
mLogViewWidth = it.measuredWidth
mLogViewHeight = it.measuredHeight
mLastLogViewPosInfo.logViewWidth = mLogViewWidth
mLastLogViewPosInfo.logViewHeight = mLogViewHeight
}
}
private fun addViewTreeObserverListener() {
if (mViewTreeObserver == null && mRootView != null) {
mViewTreeObserver = mRootView!!.viewTreeObserver
mViewTreeObserver?.addOnGlobalLayoutListener(mOnGlobalLayoutListener)
}
}
private fun removeViewTreeObserverListener() {
mViewTreeObserver?.let {
if (it.isAlive) {
it.removeOnGlobalLayoutListener(mOnGlobalLayoutListener)
}
}
}
override fun onDestroy() {
}
/**
* 确定系统浮标的初始位置
* LayoutParams创建完以后调用
* 调用时建议放在实现下方
*/
private fun onSystemLayoutParamsCreated() {
//如果有上一个页面的位置记录 这更新位置
systemLayoutParams?.flags = mLogViewLayoutParams.flags
systemLayoutParams?.gravity = mLogViewLayoutParams.gravity
systemLayoutParams?.width = mLogViewLayoutParams.width
systemLayoutParams?.height = mLogViewLayoutParams.height
systemLayoutParams?.x = mLogViewLayoutParams.x
systemLayoutParams?.y = mLogViewLayoutParams.y
}
/**
* 默认实现为true
*
* @return
*/
override fun canDrag(): Boolean {
return true
}
/**
* 搭配shouldDealBackKey使用 自定义处理完以后需要返回true
* 默认模式的onBackPressed 拦截在NormViewManager#getRootContentView中被处理
* 系统模式下的onBackPressed 在当前类的performCreate 初始化View时被处理
* 返回false 表示交由系统处理
* 返回 true 表示当前的返回事件已由自己处理 并拦截了改返回事件
*/
override fun onBackPressed(): Boolean {
return false
}
/**
* 默认不自己处理返回按键
*
* @return
*/
override fun shouldDealBackKey(): Boolean {
return false
}
override fun onEnterBackground() {
mRootView?.let {
it.visibility = View.GONE
}
}
override fun onEnterForeground() {
mRootView?.let {
it.visibility = View.VISIBLE
}
}
override fun onMove(x: Int, y: Int, dx: Int, dy: Int) {
if (!canDrag()) {
return
}
systemLayoutParams?.apply {
this.x += dx
this.y += dy
}
//限制布局边界
resetBorderline(systemLayoutParams)
mWindowManager.updateViewLayout(mRootView, systemLayoutParams)
}
/**
* 限制边界 调用的时候必须保证是在控件能获取到宽高德前提下
*/
private fun resetBorderline(
windowLayoutParams: WindowManager.LayoutParams?
) {
//如果是系统模式或者手动关闭动态限制边界
if (!restrictBorderline()) {
return
}
if (windowLayoutParams != null) {
// 均是横向计算
if (windowLayoutParams.y >= screenShortSideLength - mLogViewHeight) {
windowLayoutParams.y = screenShortSideLength - mLogViewHeight
}
// 均是横向计算
if (windowLayoutParams.x >= screenLongSideLength - mLogViewWidth) {
windowLayoutParams.x = screenLongSideLength - mLogViewWidth
}
//系统模式
if (windowLayoutParams.y <= 0) {
windowLayoutParams.y = 0
}
if (windowLayoutParams.x <= 0) {
windowLayoutParams.x = 0
}
}
}
/**
* 手指弹起时保存当前浮标位置
*
* @param x
* @param y
*/
override fun onUp(x: Int, y: Int) {
if (!canDrag()) {
return
}
if (!viewProps.edgePinned) {
endMoveAndRecord()
return
}
animatedMoveToEdge()
}
private fun endMoveAndRecord() {
systemLayoutParams?.let {
mLastLogViewPosInfo.logViewWidth = it.x
mLastLogViewPosInfo.logViewHeight = it.y
}
}
private fun animatedMoveToEdge() {
val viewSize = mRootView?.width ?: return
systemLayoutParams?.also { layoutAttrs ->
makeAnimator(layoutAttrs.x, viewSize, ViewGroup.LayoutParams.MATCH_PARENT) {
addUpdateListener { v ->
layoutAttrs.x = v.animatedValue as Int
mWindowManager.updateViewLayout(mRootView, layoutAttrs)
}
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator?) {
endMoveAndRecord()
}
})
}
}
}
private inline fun makeAnimator(
from: Int,
size: Int,
containerSize: Int,
setup: ValueAnimator.() -> Unit
) {
if (size <= 0 || containerSize <= 0) return
ValueAnimator.ofInt(
from,
if (from <= (containerSize - size) / 2) 0 else (containerSize - size)
)
.apply {
duration = 150L
setup()
}
.start()
}
/**
* 手指按下时的操作
*
* @param x
* @param y
*/
override fun onDown(x: Int, y: Int) {
if (!canDrag()) {
return
}
}
/**
* home键被点击 只有系统悬浮窗控件才会被调用
*/
open fun onHomeKeyPress() {}
/**
* 菜单键被点击 只有系统悬浮窗控件才会被调用
*/
open fun onRecentAppKeyPress() {}
override fun onPause() {}
/**
* 系统悬浮窗需要调用
*
* @return
*/
val context: Context?
get() = if (mRootView != null) {
mRootView!!.context
} else {
null
}
val resources: Resources?
get() = if (context == null) {
null
} else context!!.resources
fun getString(@StringRes resId: Int): String? {
return if (context == null) {
null
} else context!!.getString(resId)
}
private val isShow: Boolean
get() = mRootView?.isShown ?: false
protected fun <T : View> findViewById(@IdRes id: Int): T? {
if (mRootView == null) {
return null
}
return mRootView?.findViewById(id)
}
/**
* 是否限制布局边界
*
* @return
*/
open fun restrictBorderline(): Boolean {
return true
}
/**
* 获取屏幕短边的长度(横屏) 不包含statusBar
*
* @return
*/
private val screenShortSideLength: Int
get() = ScreenUtils.getAppScreenHeight()
/**
* 获取屏幕长边的长度(横屏) 不包含statusBar
*
* @return
*/
private val screenLongSideLength: Int
get() = ScreenUtils.getAppScreenWidth()
/**
* 强制刷新当前view
*/
open fun immInvalidate() {
mRootView?.requestLayout()
}
/**
* 广播接收器 系统悬浮窗需要调用
*/
private inner class InnerReceiver : BroadcastReceiver() {
private val SYSTEM_DIALOG_REASON_KEY = "reason"
private val SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps"
private val SYSTEM_DIALOG_REASON_HOME_KEY = "homekey"
override fun onReceive(context: Context, intent: Intent) {
val action = intent.action
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS == action) {
val reason = intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY)
if (reason != null) {
if (reason == SYSTEM_DIALOG_REASON_HOME_KEY) {
//点击home键
onHomeKeyPress()
} else if (reason == SYSTEM_DIALOG_REASON_RECENT_APPS) {
//点击menu按钮
onRecentAppKeyPress()
}
}
}
}
}
}

View File

@@ -0,0 +1,148 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch;
import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* 内置一个List的通用、简化的适用于RecyclerView的Adapter。
*/
public abstract class AbsRecyclerAdapter<T extends AbsViewBinder, V> extends RecyclerView.Adapter<T> {
protected List<V> mList;
private LayoutInflater mInflater;
protected Context mContext;
public AbsRecyclerAdapter(Context context) {
if (context == null) {
return;
}
mContext = context;
mList = new ArrayList<>();
mInflater = LayoutInflater.from(context);
}
@NonNull
@Override
public final T onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = createView(mInflater, parent, viewType);
return createViewHolder(view, viewType);
}
protected abstract T createViewHolder(View view, int viewType);
/**
* 如果是通过LayoutInflater创建的View,不要绑定到父View,RecyclerView会负责添加。
*/
protected abstract View createView(LayoutInflater inflater, ViewGroup parent, int viewType);
@Override
public final void onBindViewHolder(T holder, int position) {
V data = mList.get(position);
holder.setData(data);
holder.bind(data, position);
}
@Override
public int getItemCount() {
return mList.size();
}
/**
* 列表末尾追加一个元素
*/
@SuppressLint("NotifyDataSetChanged")
public void append(V item) {
if (item == null) {
return;
}
mList.add(item);
notifyDataSetChanged();
}
/**
* 在特定位置增加一个元素
*/
public void append(V item, int position) {
if (item == null) {
return;
}
if (position < 0) {
position = 0;
} else if (position > mList.size()) {
position = mList.size();
}
mList.add(position, item);
notifyItemChanged(position, item);
}
/**
* 追加一个集合
*/
@SuppressLint("NotifyDataSetChanged")
public final void append(Collection<V> items) {
if (items == null || items.size() == 0) {
return;
}
mList.addAll(items);
notifyDataSetChanged();
}
/**
* 清空集合
*/
@SuppressLint("NotifyDataSetChanged")
public final void clear() {
if (mList.isEmpty()) {
return;
}
mList.clear();
notifyDataSetChanged();
}
/**
* 删除一个元素
*/
@SuppressLint("NotifyDataSetChanged")
public final void remove(V item) {
if (item == null) {
return;
}
if (mList.contains(item)) {
mList.remove(item);
notifyDataSetChanged();
}
}
/**
* 删除一个元素
*/
public final void remove(int index) {
if (index < mList.size()) {
mList.remove(index);
notifyItemRemoved(index);
}
}
/**
* 删除一个集合
*/
@SuppressLint("NotifyDataSetChanged")
public final void remove(Collection<V> items) {
if (items == null || items.size() == 0) {
return;
}
if (mList.removeAll(items)) {
notifyDataSetChanged();
}
}
}

View File

@@ -0,0 +1,55 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch;
import android.content.Context;
import android.view.View;
import androidx.annotation.IdRes;
import androidx.recyclerview.widget.RecyclerView;
/**
* 简单封装的适用于RecyclerView的ViewHolder
*/
public abstract class AbsViewBinder<T> extends RecyclerView.ViewHolder {
private T data;
private View mView;
public AbsViewBinder(final View view) {
super(view);
mView = view;
getViews();
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onViewClick(view, data);
}
});
}
protected final View getView() {
return mView;
}
protected abstract void getViews();
public final <V extends View> V getView(@IdRes int id) {
return (V) mView.findViewById(id);
}
public abstract void bind(T t);
public void bind(T t, int position) {
bind(t);
}
protected void onViewClick(View view, T data) {
}
protected final void setData(T data) {
this.data = data;
}
protected final Context getContext() {
return mView.getContext();
}
}

View File

@@ -0,0 +1,82 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch
import android.content.Context
import android.view.View
import android.widget.FrameLayout
interface ILogView {
/**
* view 创建时调用 做一些变量的初始化 当还不能进行View的操作
*
* @param context
*/
fun onCreate(context: Context?)
/**
* 传入rootView 用于创建控件
*
* @param context
* @param rootView
* @return 返回创建的childView
*/
fun onCreateView(context: Context?, rootView: FrameLayout?): View?
/**
* 将xml中的控件添加到rootView以后调用在当前方法中可以进行view的一些操作
*
* @param rootView
*/
fun onViewCreated(rootView: FrameLayout?)
/**
* 当前的View添加到根布局里时调用
*/
fun onResume()
/**
* 当前activity onPause时调用
*/
fun onPause()
/**
* 确定系统悬浮窗浮标的初始位置
* LayoutParams创建完以后调用
*
* @param params
*/
fun initViewLayoutParams(params: LogViewLayoutParams?)
/**
* app进入后台时调用 内置View 不需要实现
*/
fun onEnterBackground()
/**
* app回到前台时调用 内置view 不需要实现
*/
fun onEnterForeground()
/**
* 浮标控件是否可以拖动
*
* @return
*/
fun canDrag(): Boolean
/**
* 是否需要自己处理返回键
*
* @return
*/
fun shouldDealBackKey(): Boolean
/**
* shouldDealBackKey == true 时调用
*/
fun onBackPressed(): Boolean
/**
* 悬浮窗主动销毁时调用 不能在当前生命周期回调函数中调用 detach自己 否则会出现死循环
*/
fun onDestroy()
}

View File

@@ -0,0 +1,6 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch
interface ILogViewListener {
fun onAttach()
fun onDetach()
}

View File

@@ -0,0 +1,30 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch
import com.mogo.eagle.core.utilcode.util.ScreenUtils
/**
* 保存上一次LogView的位置信息
*/
class LastLogViewPosInfo {
var logViewWidth = 0
var logViewHeight = 0
var leftMarginPercent = 0f
private set
var topMarginPercent = 0f
private set
fun setLeftMargin(leftMargin: Int) {
leftMarginPercent = leftMargin.toFloat() / ScreenUtils.getAppScreenWidth().toFloat()
}
fun setTopMargin(topMargin: Int) {
topMarginPercent = topMargin.toFloat() / ScreenUtils.getAppScreenHeight().toFloat()
}
override fun toString(): String {
return "LastLogViewPosInfo{" +
", leftMarginPercent=" + leftMarginPercent +
", topMarginPercent=" + topMarginPercent +
'}'
}
}

View File

@@ -0,0 +1,26 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch
import android.content.Context
import android.util.AttributeSet
import android.widget.FrameLayout
open class LogFrameLayout : FrameLayout {
private var mFlag = LogFrameLayoutFlag_ROOT
constructor(context: Context, flag: Int) : super(context) {
mFlag = flag
}
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {}
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
) {
}
companion object {
const val LogFrameLayoutFlag_ROOT = 100
const val LogFrameLayoutFlag_CHILD = 200
}
}

View File

@@ -0,0 +1,287 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch
import android.annotation.SuppressLint
import android.content.Context
import android.text.Editable
import android.text.TextWatcher
import android.util.Log
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.widget.*
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.function.hmi.R
import java.util.*
class LogInfoView : AbsLogView() {
companion object {
const val MAX_LOG_LINE_NUM = 10000
const val UPDATE_CHECK_INTERVAL = 200
}
private var logLines = LinkedList<LogLine>()
private var counter = 0
private var mAutoScrollToBottom = true
private var mIsLoaded = false
private var mLogRv: RecyclerView? = null
private var mLogItemAdapter: LogItemAdapter? = null
private var mLogFilter: EditText? = null
private var mRadioGroup: RadioGroup? = null
private var mLinearLayout: LinearLayout? = null
/**
* 单行的log
*/
private var mLogHint: TextView? = null
private var mLogRvWrap: RelativeLayout? = null
private var logViewListener: ILogViewListener? = null
override fun onCreate(context: Context?) {}
override fun onCreateView(context: Context?, rootView: FrameLayout?): View? {
return LayoutInflater.from(context).inflate(R.layout.log_view, rootView, false)
}
override fun onViewCreated(rootView: FrameLayout?) {
initView()
}
private fun initView() {
mLogHint = findViewById(R.id.log_hint)
mLogRvWrap = findViewById(R.id.log_page)
mLogRv = findViewById(R.id.log_list)
mLogRv!!.layoutManager = LinearLayoutManager(context)
mLogItemAdapter = LogItemAdapter(context!!)
mLogRv!!.adapter = mLogItemAdapter
mLogFilter = findViewById(R.id.log_filter)
mLogFilter!!.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable) {
mLogItemAdapter!!.filter.filter(s)
}
})
val mTitleBar = findViewById<LogTitleBar>(R.id.title_bar)
mTitleBar!!.setListener(object : LogTitleBar.OnTitleBarClickListener {
override fun onRightClick() {
if (logViewListener != null) {
logViewListener!!.onDetach()
}
}
override fun onLeftClick() {
minimize()
}
})
mLogHint!!.setOnClickListener { v: View? -> maximize() }
mRadioGroup = findViewById(R.id.radio_group)
mRadioGroup!!.setOnCheckedChangeListener { group: RadioGroup?, checkedId: Int ->
when (checkedId) {
R.id.verbose -> {
mLogItemAdapter!!.logLevelLimit = Log.VERBOSE
}
R.id.debug -> {
mLogItemAdapter!!.logLevelLimit = Log.DEBUG
}
R.id.info -> {
mLogItemAdapter!!.logLevelLimit = Log.INFO
}
R.id.warn -> {
mLogItemAdapter!!.logLevelLimit = Log.WARN
}
R.id.error -> {
mLogItemAdapter!!.logLevelLimit = Log.ERROR
}
}
mLogItemAdapter!!.filter.filter(mLogFilter!!.text)
}
mLogRv!!.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
val layoutManager = recyclerView.layoutManager as LinearLayoutManager?
// if the bottom of the list isn't visible anymore, then stop autoscrolling
mAutoScrollToBottom =
layoutManager!!.findLastCompletelyVisibleItemPosition() == recyclerView.adapter!!
.itemCount - 1
}
})
mRadioGroup!!.check(R.id.verbose)
val mBtnTop = findViewById<Button>(R.id.btn_top)
val mBtnBottom = findViewById<Button>(R.id.btn_bottom)
val mBtnClean = findViewById<Button>(R.id.btn_clean)
val mBtnExport = findViewById<Button>(R.id.btn_export)
mBtnTop!!.setOnClickListener {
if (mLogItemAdapter == null || mLogItemAdapter!!.itemCount == 0) {
return@setOnClickListener
}
mLogRv!!.scrollToPosition(0)
}
mBtnBottom!!.setOnClickListener {
if (mLogItemAdapter == null || mLogItemAdapter!!.itemCount == 0) {
return@setOnClickListener
}
mLogRv!!.scrollToPosition(mLogItemAdapter!!.itemCount - 1)
}
mBtnExport!!.setOnClickListener { }
mBtnClean!!.setOnClickListener {
if (mLogItemAdapter == null || mLogItemAdapter!!.itemCount == 0) {
return@setOnClickListener
}
counter = 0
mLogItemAdapter!!.clearLog()
}
}
override fun onResume() {
super.onResume()
if (logViewListener != null) {
logViewListener!!.onAttach()
}
}
override fun onEnterForeground() {
super.onEnterForeground()
parentView?.visibility = View.VISIBLE
}
override fun onEnterBackground() {
super.onEnterBackground()
parentView?.visibility = View.GONE
}
fun registerLogViewListener(listener: ILogViewListener?) {
logViewListener = listener
}
fun unRegisterLogViewListener() {
logViewListener = null
}
override fun initViewLayoutParams(params: LogViewLayoutParams?) {
params!!.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
params.width = LogViewLayoutParams.MATCH_PARENT
params.height = LogViewLayoutParams.MATCH_PARENT
}
@SuppressLint("NotifyDataSetChanged")
fun onLogCatch(lineLog: String) {
if (mLogRv == null || mLogItemAdapter == null) {
return
}
if (!mIsLoaded) {
mIsLoaded = true
mLinearLayout = findViewById(R.id.ll_loading)
mLinearLayout!!.visibility = View.GONE
mLogRv!!.visibility = View.VISIBLE
}
val logLine = LogLine.newLogLine(lineLog, false)
if (logLines.size > MAX_LOG_LINE_NUM) {
logLines.removeFirst()
}
logLines.add(logLine)
if (logLines.size == 1) {
mLogItemAdapter!!.addWithFilter(logLines[0], mLogFilter?.text, true)
} else {
mLogItemAdapter!!.addWithFilter(logLine, mLogFilter?.text, false)
mLogItemAdapter!!.notifyDataSetChanged()
}
if (logLines.size > 0) {
val line = logLines[logLines.size - 1]
"${line.tag} : ${line.logOutput}".also { mLogHint?.text = it }
}
if (++counter % UPDATE_CHECK_INTERVAL == 0
&& mLogItemAdapter!!.trueValues.size > MAX_LOG_LINE_NUM
) {
val numItemsToRemove = mLogItemAdapter!!.trueValues.size - MAX_LOG_LINE_NUM
mLogItemAdapter!!.removeFirst(numItemsToRemove)
}
if (mAutoScrollToBottom) {
scrollToBottom()
}
}
private fun scrollToBottom() {
mLogRv!!.scrollToPosition(mLogItemAdapter!!.itemCount - 1)
}
private val selectLogLevel: Int
get() {
return when (mRadioGroup!!.checkedRadioButtonId) {
R.id.verbose -> {
Log.VERBOSE
}
R.id.debug -> {
Log.DEBUG
}
R.id.info -> {
Log.INFO
}
R.id.warn -> {
Log.WARN
}
R.id.error -> {
Log.ERROR
}
else -> {
Log.VERBOSE
}
}
}
/**
* 最小化
*/
fun minimize() {
isMaximize = false
mLogHint!!.visibility = View.VISIBLE
mLogRvWrap!!.visibility = View.GONE
val layoutParams = systemLayoutParams ?: return
Log.d("EmArrow", "minimize , layoutParams is not null")
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
layoutParams.gravity = Gravity.START or Gravity.TOP
mWindowManager.updateViewLayout(logView, layoutParams)
}
/**
* 是否最大化
*/
private var isMaximize = true
private fun maximize() {
isMaximize = true
mLogHint!!.visibility = View.GONE
mLogRvWrap!!.visibility = View.VISIBLE
val layoutParams = systemLayoutParams ?: return
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT
layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT
layoutParams.gravity = Gravity.START or Gravity.TOP
mWindowManager.updateViewLayout(logView, layoutParams)
}
override fun onBackPressed(): Boolean {
return if (isMaximize) {
minimize()
true
} else {
false
}
}
override fun shouldDealBackKey(): Boolean {
return true
}
override fun canDrag(): Boolean {
return false
}
}

View File

@@ -0,0 +1,260 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch;
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static android.content.Context.CLIPBOARD_SERVICE;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.hmi.ui.utils.SearchCriteria;
import com.mogo.eagle.core.function.hmi.ui.utils.TagColorUtil;
public class LogItemAdapter extends AbsRecyclerAdapter<AbsViewBinder<LogLine>, LogLine> implements Filterable {
public LogItemAdapter(Context context) {
super(context);
mClipboard = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE);
}
private ArrayList<LogLine> mOriginalValues = new ArrayList<>();
private final ArrayFilter mFilter = new ArrayFilter();
private int logLevelLimit = Log.VERBOSE;
private final ClipboardManager mClipboard;
/**
* 清空log
*/
@SuppressLint("NotifyDataSetChanged")
public void clearLog() {
if (mOriginalValues != null && mOriginalValues.size() > 0) {
mOriginalValues.clear();
}
clear();
notifyDataSetChanged();
}
@Override
protected AbsViewBinder<LogLine> createViewHolder(View view, int viewType) {
return new LogInfoViewHolder(view);
}
@Override
protected View createView(LayoutInflater inflater, ViewGroup parent, int viewType) {
return inflater.inflate(R.layout.item_log, parent, false);
}
@Override
public Filter getFilter() {
return mFilter;
}
public int getLogLevelLimit() {
return logLevelLimit;
}
public void setLogLevelLimit(int logLevelLimit) {
this.logLevelLimit = logLevelLimit;
}
public List<LogLine> getTrueValues() {
return mOriginalValues != null ? mOriginalValues : mList;
}
@SuppressLint("NotifyDataSetChanged")
public void removeFirst(int n) {
if (mOriginalValues != null) {
List<LogLine> subList = mOriginalValues.subList(n, mOriginalValues.size());
for (int i = 0; i < n; i++) {
// value to delete - delete it from the mObjects as well
mList.remove(mOriginalValues.get(i));
}
mOriginalValues = new ArrayList<>(subList);
}
notifyDataSetChanged();
}
public class LogInfoViewHolder extends AbsViewBinder<LogLine> {
private TextView mLogText;
private TextView mPid;
private TextView mTime;
private TextView mTag;
private TextView mLevel;
public LogInfoViewHolder(View view) {
super(view);
}
@Override
protected void getViews() {
mLogText = getView(R.id.log_output_text);
mLevel = getView(R.id.log_level_text);
mPid = getView(R.id.pid_text);
mTime = getView(R.id.timestamp_text);
mTag = getView(R.id.tag_text);
}
@Override
protected void onViewClick(View view, final LogLine data) {
super.onViewClick(view, data);
data.setExpanded(!data.isExpanded());
if (data.isExpanded() && data.getProcessId() != -1) {
mLogText.setSingleLine(false);
mTime.setVisibility(View.VISIBLE);
mPid.setVisibility(View.VISIBLE);
view.setBackgroundColor(Color.BLACK);
mLogText.setTextColor(TagColorUtil.getTextColor(getContext(), data.getLogLevel(), true));
mTag.setTextColor(TagColorUtil.getTextColor(getContext(), data.getLogLevel(), true));
} else {
mLogText.setSingleLine(true);
mTime.setVisibility(View.GONE);
mPid.setVisibility(View.GONE);
view.setBackgroundColor(Color.WHITE);
mLogText.setTextColor(TagColorUtil.getTextColor(getContext(), data.getLogLevel(), false));
mTag.setTextColor(TagColorUtil.getTextColor(getContext(), data.getLogLevel(), false));
}
itemView.setOnLongClickListener(v -> {
ClipData clipData = ClipData.newPlainText("Label", data.getOriginalLine());
mClipboard.setPrimaryClip(clipData);
return true;
});
}
@Override
public void bind(LogLine item) {
mLevel.setText(item.getLogLevelText());
mLevel.setTextColor(TagColorUtil.getLevelColor(getContext(), item.getLogLevel()));
mLevel.setBackgroundColor(TagColorUtil.getLevelBgColor(getContext(), item.getLogLevel()));
mPid.setText(String.valueOf(item.getProcessId()));
mTime.setText(item.getTimestamp());
mLogText.setText(item.getLogOutput());
mTag.setText(item.getTag());
if (item.isExpanded() && item.getProcessId() != -1) {
mLogText.setSingleLine(false);
mTime.setVisibility(View.VISIBLE);
mPid.setVisibility(View.VISIBLE);
mLogText.setTextColor(TagColorUtil.getTextColor(getContext(), item.getLogLevel(), true));
mTag.setTextColor(TagColorUtil.getTextColor(getContext(), item.getLogLevel(), true));
itemView.setBackgroundColor(Color.BLACK);
} else {
mLogText.setSingleLine(true);
mTime.setVisibility(View.GONE);
mPid.setVisibility(View.GONE);
itemView.setBackgroundColor(Color.WHITE);
mLogText.setTextColor(TagColorUtil.getTextColor(getContext(), item.getLogLevel(), false));
mTag.setTextColor(TagColorUtil.getTextColor(getContext(), item.getLogLevel(), false));
}
}
}
/**
* 添加日志到adapter中
*/
public void addWithFilter(LogLine logObj, CharSequence text, boolean notify) {
if (mOriginalValues != null) {
List<LogLine> inputList = Collections.singletonList(logObj);
List<LogLine> filteredObjects = mFilter.performFilteringOnList(inputList, text);
mOriginalValues.add(logObj);
mList.addAll(filteredObjects);
if (notify) {
notifyItemRangeInserted(mList.size() - filteredObjects.size(), filteredObjects.size());
}
} else {
mList.add(logObj);
if (notify) {
notifyItemInserted(mList.size());
}
}
}
private class ArrayFilter extends Filter {
@Override
protected FilterResults performFiltering(CharSequence prefix) {
FilterResults results = new FilterResults();
ArrayList<LogLine> allValues = performFilteringOnList(mOriginalValues, prefix);
results.values = allValues;
results.count = allValues.size();
return results;
}
public ArrayList<LogLine> performFilteringOnList(List<LogLine> inputList, CharSequence query) {
SearchCriteria searchCriteria = new SearchCriteria(query);
// search by log level
ArrayList<LogLine> allValues = new ArrayList<>();
ArrayList<LogLine> logLines = new ArrayList<>(inputList);
for (LogLine logLine : logLines) {
if (logLine != null && logLine.getLogLevel() >= logLevelLimit) {
allValues.add(logLine);
}
}
ArrayList<LogLine> finalValues = allValues;
// search by criteria
if (!searchCriteria.isEmpty()) {
final int count = allValues.size();
final ArrayList<LogLine> newValues = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
final LogLine value = allValues.get(i);
// search the logLine based on the criteria
if (searchCriteria.matches(value)) {
newValues.add(value);
}
}
finalValues = newValues;
}
return finalValues;
}
@SuppressLint("NotifyDataSetChanged")
@SuppressWarnings("unchecked")
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
//noinspection unchecked
mList = (List<LogLine>) results.values;
if (results.count > 0) {
notifyDataSetChanged();
} else {
notifyDataSetChanged();
}
}
}
}

View File

@@ -0,0 +1,202 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch;
import android.text.TextUtils;
import android.util.Log;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class LogLine {
private static final int TIMESTAMP_LENGTH = 19;
private static final Pattern logPattern = Pattern.compile(
// log level
"(\\w)" +
"/" +
// tag
"([^(]+)" +
"\\(\\s*" +
// pid
"(\\d+)" +
// optional weird number that only occurs on ZTE blade
"(?:\\*\\s*\\d+)?" +
"\\): ");
private static final String filterPattern = "ResourceType|memtrack|android.os.Debug|BufferItemConsumer|DPM.*|MDM.*|ChimeraUtils|BatteryExternalStats.*|chatty.*|DisplayPowerController|WidgetHelper|WearableService|DigitalWidget.*|^ANDR-PERF-.*";
private int logLevel;
private String tag;
private String logOutput;
private int processId = -1;
private String timestamp;
private boolean expanded = false;
private boolean highlighted = false;
public static LogLine newLogLine(String originalLine, boolean expanded) {
LogLine logLine = new LogLine();
logLine.setExpanded(expanded);
int startIdx = 0;
// if the first char is a digit, then this starts out with a timestamp
// otherwise, it's a legacy log or the beginning of the log output or something
if (!TextUtils.isEmpty(originalLine)
&& Character.isDigit(originalLine.charAt(0))
&& originalLine.length() >= TIMESTAMP_LENGTH) {
String timestamp = originalLine.substring(0, TIMESTAMP_LENGTH - 1);
logLine.setTimestamp(timestamp);
// cut off timestamp
startIdx = TIMESTAMP_LENGTH;
}
Matcher matcher = logPattern.matcher(originalLine);
if (matcher.find(startIdx)) {
char logLevelChar = matcher.group(1).charAt(0);
String logText = originalLine.substring(matcher.end());
if (logText.matches("^maxLineHeight.*|Failed to read.*")) {
logLine.setLogLevel(convertCharToLogLevel('V'));
} else {
logLine.setLogLevel(convertCharToLogLevel(logLevelChar));
}
String tagText = matcher.group(2);
if (tagText.matches(filterPattern)) {
logLine.setLogLevel(convertCharToLogLevel('V'));
}
logLine.setTag(tagText);
logLine.setProcessId(Integer.parseInt(matcher.group(3)));
logLine.setLogOutput(logText);
} else {
logLine.setLogOutput(originalLine);
logLine.setLogLevel(-1);
}
return logLine;
}
private static int convertCharToLogLevel(char logLevelChar) {
switch (logLevelChar) {
case 'D':
return Log.DEBUG;
case 'E':
return Log.ERROR;
case 'I':
return Log.INFO;
case 'V':
case 'F':
return Log.VERBOSE;
case 'W':
return Log.WARN;
}
return -1;
}
private static char convertLogLevelToChar(int logLevel) {
switch (logLevel) {
case Log.DEBUG:
return 'D';
case Log.ERROR:
return 'E';
case Log.INFO:
return 'I';
case Log.VERBOSE:
return 'V';
case Log.WARN:
return 'W';
}
return ' ';
}
public String getOriginalLine() {
if (logLevel == -1) { // starter line like "begin of log etc. etc."
return logOutput;
}
StringBuilder stringBuilder = new StringBuilder();
if (timestamp != null) {
stringBuilder.append(timestamp).append(' ');
}
stringBuilder.append(convertLogLevelToChar(logLevel))
.append('/')
.append(tag)
.append('(')
.append(processId)
.append("): ")
.append(logOutput);
return stringBuilder.toString();
}
public String getLogLevelText() {
return Character.toString(convertLogLevelToChar(logLevel));
}
public int getLogLevel() {
return logLevel;
}
public void setLogLevel(int logLevel) {
this.logLevel = logLevel;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getLogOutput() {
return logOutput;
}
public void setLogOutput(String logOutput) {
this.logOutput = logOutput;
}
public int getProcessId() {
return processId;
}
public void setProcessId(int processId) {
this.processId = processId;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public boolean isExpanded() {
return expanded;
}
public void setExpanded(boolean expanded) {
this.expanded = expanded;
}
public boolean isHighlighted() {
return highlighted;
}
public void setHighlighted(boolean highlighted) {
this.highlighted = highlighted;
}
}

View File

@@ -0,0 +1,114 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.mogo.eagle.core.function.hmi.R;
/**
* 日志专属TitleBar
*/
public class LogTitleBar extends FrameLayout {
private OnTitleBarClickListener mListener;
private TextView mBack;
private TextView mTitle;
private ImageView mIcon;
public LogTitleBar(@NonNull Context context) {
this(context, null);
}
public LogTitleBar(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public LogTitleBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
LayoutInflater.from(context).inflate(R.layout.log_title_bar, this, true);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.LogTitleBar);
int icon = a.getResourceId(R.styleable.LogTitleBar_Icon, 0);
String title = a.getString(R.styleable.LogTitleBar_Title);
String back = a.getString(R.styleable.LogTitleBar_Back);
a.recycle();
mBack = findViewById(R.id.back);
mIcon = findViewById(R.id.icon);
mTitle = findViewById(R.id.title);
mIcon.setOnClickListener(v -> {
if (mListener != null) {
mListener.onRightClick();
}
});
mBack.setOnClickListener(v -> {
if (mListener != null) {
mListener.onLeftClick();
}
});
setBack(back);
setTitle(title);
setIcon(icon);
}
/**
* TitleBar 点击事件回调
*/
public interface OnTitleBarClickListener {
void onRightClick();
void onLeftClick();
}
public void setTitle(@StringRes int title) {
setTitle(getResources().getString(title));
}
public void setTitle(String title) {
if (TextUtils.isEmpty(title)) {
mTitle.setText("");
} else {
mTitle.setText(title);
mTitle.setAlpha(0);
mTitle.setVisibility(View.VISIBLE);
mTitle.animate().alpha(1).start();
}
}
public void setBack(String back) {
if (TextUtils.isEmpty(back)) {
mBack.setText("");
} else {
mBack.setText(back);
}
}
public void setIcon(@DrawableRes int id) {
if (id == 0) {
return;
}
mIcon.setImageResource(id);
mIcon.setVisibility(View.VISIBLE);
}
public void setListener(OnTitleBarClickListener listener) {
mListener = listener;
}
}

View File

@@ -0,0 +1,49 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch;
import android.view.ViewGroup;
import android.view.WindowManager;
public class LogViewLayoutParams {
/**
* 悬浮窗不能获取焦点
*/
public static int FLAG_NOT_FOCUSABLE = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
public static int FLAG_NOT_TOUCHABLE = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
/**
* 是否允许超出屏幕
*/
public static int FLAG_LAYOUT_NO_LIMITS = WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
/**
* 悬浮窗不能获取焦点并且不相应触摸
*/
public static int FLAG_NOT_FOCUSABLE_AND_NOT_TOUCHABLE = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
public static int MATCH_PARENT = ViewGroup.LayoutParams.MATCH_PARENT;
public static int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT;
/**
* 只针对系统悬浮窗起作用 值基本上为以上2个
*/
public int flags;
/**
* 只针对系统悬浮窗起作用 值基本上为Gravity
*/
public int gravity;
public int x;
public int y;
public int width;
public int height;
@Override
public String toString() {
return "LogViewLayoutParams{" +
"flags=" + flags +
", gravity=" + gravity +
", x=" + x +
", y=" + y +
", width=" + width +
", height=" + height +
'}';
}
}

View File

@@ -0,0 +1,32 @@
package com.mogo.eagle.core.function.hmi.ui.logcatch;
import android.view.MotionEvent;
import android.view.View;
/**
* touch 事件代理 解决点击和触摸事件的冲突
*/
public class TouchProxy {
public TouchProxy(OnTouchEventListener eventListener) {
}
public void setEventListener(OnTouchEventListener eventListener) {
}
public boolean onTouchEvent(View v, MotionEvent event) {
return true;
}
public interface OnTouchEventListener {
void onMove(int x, int y, int dx, int dy);
void onUp(int x, int y);
void onDown(int x, int y);
}
}

View File

@@ -34,6 +34,8 @@ import com.mogo.eagle.core.function.call.map.CallerSmpManager
import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.call.obu.CallerObuListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
@@ -55,8 +57,12 @@ class DebugSettingView @JvmOverloads constructor(
IMoGoAutopilotStatusListener, IMoGoAutopilotCarStateListener, IMoGoMapLocationListener {
private val TAG = "DebugSettingView"
// 初始化App 配置信息
val mAppConfigInfo = AppConfigInfo()
private val mAppConfigInfo = AppConfigInfo()
private var logInfoView: LogInfoView? = null
private var logViewAttach = false
init {
LayoutInflater.from(context).inflate(R.layout.view_debug_setting, this, true)
@@ -69,6 +75,9 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
CallerMapLocationListenerManager.addListener(TAG, this)
if (logInfoView != null) {
logInfoView!!.onEnterForeground()
}
}
override fun onDetachedFromWindow() {
@@ -77,6 +86,9 @@ class DebugSettingView @JvmOverloads constructor(
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
CallerMapLocationListenerManager.removeListener(TAG)
if (logInfoView != null) {
logInfoView!!.onEnterBackground()
}
}
private fun initView() {
@@ -160,7 +172,7 @@ class DebugSettingView @JvmOverloads constructor(
// 初始化工控机 IP信息
val autoPilotIpAddress =
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.AUTOPILOT_IP, "192.168.1.102")
SharedPrefsMgr.getInstance(context).getString(MoGoConfig.AUTOPILOT_IP, "192.168.1.102")
etAutopilotIP.setText(autoPilotIpAddress)
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
@@ -296,7 +308,7 @@ class DebugSettingView @JvmOverloads constructor(
}
tbLogCatch.isChecked =
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG,false)
SharedPrefsMgr.getInstance(context).getBoolean(MoGoConfig.CATCH_LOG, false)
tbLogCatch.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
CallerDevaToolsManager.startCatchLog()
@@ -312,7 +324,43 @@ class DebugSettingView @JvmOverloads constructor(
super.onLogCatchClose()
tbLogCatch.isChecked = false
}
override fun onLogCatch(lineLog: String) {
logInfoView?.let {
if (logViewAttach) {
it.onLogCatch(lineLog)
}
}
}
})
tbLogDebugView.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
logInfoView = LogInfoView()
logInfoView!!.registerLogViewListener(object : ILogViewListener {
override fun onAttach() {
logViewAttach = true
}
override fun onDetach() {
logViewDestroy()
tbLogDebugView.isChecked = false
}
})
logInfoView!!.show(context)
} else {
logViewDestroy()
}
}
}
private fun logViewDestroy() {
logInfoView?.let {
it.dismiss()
it.unRegisterLogViewListener()
logInfoView = null
logViewAttach = false
}
}
/**

View File

@@ -0,0 +1,120 @@
package com.mogo.eagle.core.function.hmi.ui.utils
import android.text.TextUtils
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogLine
import java.util.regex.Pattern
class SearchCriteria(inputQuery: CharSequence?) {
private var pid = -1
private var tag: String? = null
private val searchText: String
private var searchTextAsInt = -1
val isEmpty: Boolean
get() = pid == -1 && TextUtils.isEmpty(tag) && TextUtils.isEmpty(searchText)
fun matches(logLine: LogLine): Boolean {
// consider the criteria to be ANDed
if (!checkFoundPid(logLine)) {
return false
}
return if (!checkFoundTag(logLine)) {
false
} else checkFoundText(logLine)
}
private fun checkFoundText(logLine: LogLine): Boolean {
return (TextUtils.isEmpty(searchText)
|| searchTextAsInt != -1 && searchTextAsInt == logLine.processId
|| logLine.tag != null && containsIgnoreCase(logLine.tag, searchText)
|| logLine.logOutput != null && containsIgnoreCase(
logLine.logOutput,
searchText
))
}
private fun checkFoundTag(logLine: LogLine): Boolean {
return (TextUtils.isEmpty(tag)
|| logLine.tag != null && containsIgnoreCase(logLine.tag, tag))
}
private fun checkFoundPid(logLine: LogLine): Boolean {
return pid == -1 || logLine.processId == pid
}
fun nullToEmpty(str: CharSequence?): String {
return str?.toString() ?: ""
}
/**
* same as String.contains, but ignores case.
*
* @param str
* @param query
* @return
*/
fun containsIgnoreCase(str: String?, query: String?): Boolean {
if (str != null && query != null) {
val limit = str.length - query.length + 1
for (i in 0 until limit) {
if (matchesIgnoreCase(str, query, i)) {
return true
}
}
}
return false
}
private fun matchesIgnoreCase(str: String, query: String, startingAt: Int): Boolean {
val len = query.length
for (i in 0 until len) {
if (Character.toUpperCase(query[i]) != Character.toUpperCase(str[startingAt + i])) {
return false
}
}
return true
}
companion object {
private const val PID_KEYWORD = "pid:"
private const val TAG_KEYWORD = "tag:"
private val PID_PATTERN = Pattern.compile("$PID_KEYWORD:(\\d+)", Pattern.CASE_INSENSITIVE)
private val TAG_PATTERN = Pattern.compile("$TAG_KEYWORD:(\"[^\"]+\"|\\S+)", Pattern.CASE_INSENSITIVE)
}
init {
// check for the "pid" keyword
val query = StringBuilder(nullToEmpty(inputQuery))
val pidMatcher = PID_PATTERN.matcher(query)
if (pidMatcher.find()) {
try {
pid = pidMatcher.group(1).toInt()
query.replace(pidMatcher.start(), pidMatcher.end(), "") // detach
// from
// search
// string
} catch (ignore: NumberFormatException) {
}
}
// check for the "tag" keyword
val tagMatcher = TAG_PATTERN.matcher(query)
if (tagMatcher.find()) {
tag = tagMatcher.group(1)
tag?.let {
if (it.startsWith("\"") && it.endsWith("\"")) {
tag = it.substring(1, it.length - 1) // detach quotes
}
}
query.replace(tagMatcher.start(), tagMatcher.end(), "") // detach
}
// everything else becomes a search term
searchText = query.toString().trim { it <= ' ' }
try {
searchTextAsInt = searchText.toInt()
} catch (ignore: NumberFormatException) {
}
}
}

View File

@@ -0,0 +1,68 @@
package com.mogo.eagle.core.function.hmi.ui.utils
import android.content.Context
import android.util.Log
import android.util.SparseIntArray
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.function.hmi.R
object TagColorUtil {
private val TEXT_COLOR = SparseIntArray(6)
private val TEXT_COLOR_EXPAND = SparseIntArray(6)
private val LEVEL_COLOR = SparseIntArray(6)
private val LEVEL_BG_COLOR = SparseIntArray(6)
@JvmStatic
fun getTextColor(context: Context?, level: Int, expand: Boolean): Int {
val map = if (expand) TEXT_COLOR_EXPAND else TEXT_COLOR
var result = map[level]
if (result == null) {
result = map[Log.VERBOSE]
}
return ContextCompat.getColor(context!!, result)
}
@JvmStatic
fun getLevelBgColor(context: Context?, level: Int): Int {
var result = LEVEL_BG_COLOR[level]
if (result == null) {
result = LEVEL_BG_COLOR[Log.VERBOSE]
}
return ContextCompat.getColor(context!!, result)
}
@JvmStatic
fun getLevelColor(context: Context?, level: Int): Int {
var result = LEVEL_COLOR[level]
if (result == null) {
result = LEVEL_COLOR[Log.VERBOSE]
}
return ContextCompat.getColor(context!!, result)
}
init {
TEXT_COLOR.put(Log.DEBUG, R.color.color_000000)
TEXT_COLOR.put(Log.INFO, R.color.color_000000)
TEXT_COLOR.put(Log.VERBOSE, R.color.color_000000)
TEXT_COLOR.put(Log.ASSERT, R.color.color_8F0005)
TEXT_COLOR.put(Log.ERROR, R.color.color_FF0006)
TEXT_COLOR.put(Log.WARN, R.color.color_0099dd)
TEXT_COLOR_EXPAND.put(Log.DEBUG, R.color.color_FFFFFF)
TEXT_COLOR_EXPAND.put(Log.INFO, R.color.color_FFFFFF)
TEXT_COLOR_EXPAND.put(Log.VERBOSE, R.color.color_FFFFFF)
TEXT_COLOR_EXPAND.put(Log.ASSERT, R.color.color_8F0005)
TEXT_COLOR_EXPAND.put(Log.ERROR, R.color.color_FF0006)
TEXT_COLOR_EXPAND.put(Log.WARN, R.color.color_0099dd)
LEVEL_BG_COLOR.put(Log.DEBUG, R.color.background_debug)
LEVEL_BG_COLOR.put(Log.ERROR, R.color.background_error)
LEVEL_BG_COLOR.put(Log.INFO, R.color.background_info)
LEVEL_BG_COLOR.put(Log.VERBOSE, R.color.background_verbose)
LEVEL_BG_COLOR.put(Log.WARN, R.color.background_warn)
LEVEL_BG_COLOR.put(Log.ASSERT, R.color.background_wtf)
LEVEL_COLOR.put(Log.DEBUG, R.color.foreground_debug)
LEVEL_COLOR.put(Log.ERROR, R.color.foreground_error)
LEVEL_COLOR.put(Log.INFO, R.color.foreground_info)
LEVEL_COLOR.put(Log.VERBOSE, R.color.foreground_verbose)
LEVEL_COLOR.put(Log.WARN, R.color.foreground_warn)
LEVEL_COLOR.put(Log.ASSERT, R.color.foreground_wtf)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:width="2dp"/>
<solid android:color="#CCCCCC"/>
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="4dp" />
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/radio_button_checked_background" android:state_checked="true" />
<item android:drawable="@drawable/radio_button_normal_background" android:state_checked="false" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/radio_button_checked_background_left" android:state_checked="true" />
<item android:drawable="@drawable/radio_button_normal_background_left" android:state_checked="false" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/radio_button_checked_background_middle" android:state_checked="true" />
<item android:drawable="@drawable/radio_button_normal_background_middle" android:state_checked="false" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/radio_button_checked_background_right" android:state_checked="true" />
<item android:drawable="@drawable/radio_button_normal_background_right" android:state_checked="false" />
</selector>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#337CC4"/>
<stroke
android:width="1px"
android:color="#337CC4"/>
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px"/>
</shape>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#337CC4" />
<stroke
android:width="1px"
android:color="#337CC4" />
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px" />
<corners android:topLeftRadius="4dp" android:bottomLeftRadius="4dp" />
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#337CC4" />
<stroke
android:width="1px"
android:color="#337CC4" />
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px" />
</shape>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#337CC4" />
<stroke
android:width="1px"
android:color="#337CC4" />
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px" />
<corners android:topRightRadius="4dp" android:bottomRightRadius="4dp" />
</shape>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1px"
android:color="#337CC4" />
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px" />
</shape>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1px"
android:color="#337CC4" />
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px" />
<corners android:topLeftRadius="4dp" android:bottomLeftRadius="4dp" />
</shape>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1px"
android:color="#337CC4" />
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px" />
</shape>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1px"
android:color="#337CC4" />
<padding
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="1px" />
<corners android:topRightRadius="4dp" android:bottomRightRadius="4dp" />
</shape>

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="3dp"
android:paddingTop="2dp"
android:paddingRight="3dp"
android:paddingBottom="1dp">
<TextView
android:id="@+id/pid_text"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:paddingEnd="2dp"
android:paddingRight="2dp"
android:singleLine="true"
android:textColor="@color/color_FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/timestamp_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@+id/pid_text"
android:layout_toRightOf="@+id/pid_text"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:singleLine="true"
android:textColor="@color/color_FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/tag_text"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_below="@+id/pid_text"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:ellipsize="end"
android:paddingEnd="2dp"
android:paddingRight="2dp"
android:singleLine="true"
android:textColor="@color/color_000000"
android:textSize="12sp" />
<TextView
android:id="@+id/log_level_text"
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_below="@+id/pid_text"
android:layout_toEndOf="@+id/tag_text"
android:layout_toRightOf="@+id/tag_text"
android:gravity="center_horizontal"
android:singleLine="true"
android:textSize="12sp" />
<TextView
android:id="@+id/log_output_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/pid_text"
android:layout_toEndOf="@+id/log_level_text"
android:layout_toRightOf="@+id/log_level_text"
android:ellipsize="end"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:singleLine="true"
android:textSize="12sp" />
</RelativeLayout>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|left"
android:layout_marginLeft="15dp"
android:textColor="#337CC4"
android:textSize="14sp" />
<TextView
android:id="@+id/title"
style="@style/TitleBig"
android:layout_gravity="center" />
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="15dp"
android:scaleType="centerInside" />
</merge>

View File

@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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">
<RelativeLayout
android:id="@+id/log_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical">
<com.mogo.eagle.core.function.hmi.ui.logcatch.LogTitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="68dp"
android:layout_alignParentTop="true"
android:background="#ffffff"
app:Back="@string/log_min"
app:Icon="@drawable/close_icon"
app:Title="@string/log_info" />
<View
android:id="@+id/view_divider"
android:layout_width="match_parent"
android:layout_height="1px"
style="@style/Bottom"
android:layout_below="@id/title_bar" />
<EditText
android:id="@+id/log_filter"
style="@style/Input"
android:layout_height="50dp"
android:layout_below="@id/view_divider"
android:layout_marginLeft="16dp"
android:layout_marginTop="15dp"
android:layout_marginRight="16dp"
android:background="@drawable/log_filter_background"
android:elevation="1dp"
android:hint="@string/log_info_edt_hint"
android:inputType="text"
android:paddingLeft="15dp"
android:paddingRight="15dp" />
<LinearLayout
android:id="@+id/button_wrap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/log_filter"
android:layout_marginTop="16dp"
android:layout_marginBottom="6dp"
android:orientation="vertical">
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<RadioButton
android:id="@+id/verbose"
style="@style/RadioButton.Left"
android:text="@string/log_info_verbose" />
<RadioButton
android:id="@+id/debug"
style="@style/RadioButton"
android:text="@string/log_info_debug" />
<RadioButton
android:id="@+id/info"
style="@style/RadioButton"
android:text="@string/log_info_info" />
<RadioButton
android:id="@+id/warn"
style="@style/RadioButton"
android:text="@string/log_info_warn" />
<RadioButton
android:id="@+id/error"
style="@style/RadioButton.Right"
android:text="@string/log_info_error" />
</RadioGroup>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<Button
android:id="@+id/btn_clean"
style="@style/RadioButton.Left"
android:text="@string/log_btn_clean" />
<Button
android:id="@+id/btn_export"
style="@style/RadioButton.Middle"
android:text="@string/log_btn_export" />
<Button
android:id="@+id/btn_top"
style="@style/RadioButton.Middle"
android:text="@string/log_btn_back_top" />
<Button
android:id="@+id/btn_bottom"
style="@style/RadioButton.Right"
android:text="@string/log_btn_to_bottom" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_loading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal">
<ProgressBar
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:text="@string/log_text_loading"
android:textColor="#666666"
android:textSize="14sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/log_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/ll_loading"
android:layout_below="@id/button_wrap"
android:scrollbars="vertical"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/log_hint"
style="@style/White"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#337CC4"
android:singleLine="true"
android:text="@string/log_info"
android:visibility="gone" />
</FrameLayout>

View File

@@ -330,6 +330,16 @@
android:textOn="停止抓取全量日志"
android:textSize="@dimen/dp_34" />
<ToggleButton
android:id="@+id/tbLogDebugView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="center"
android:textOff="展示日志过滤面板"
android:textOn="关闭日志过滤面板"
android:textSize="@dimen/dp_34" />
</com.google.android.flexbox.FlexboxLayout>
</LinearLayout>
<!--地图呈现数据源控制-->

View File

@@ -32,4 +32,10 @@
<attr name="keyBackground" format="reference" />
</declare-styleable>
</declare-styleable>
<declare-styleable name="LogTitleBar">
<attr name="Back" format="integer" />
<attr name="Title" format="string" />
<attr name="Icon" format="string" />
</declare-styleable>
</resources>

View File

@@ -7,4 +7,27 @@
<color name="notice_traffic_line">#555C7E</color>
<color name="notice_dialog_back">#3B4577</color>
<color name="notice_video_progressbar_loading_color">#256BFF</color>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="color_000000">#000000</color>
<color name="color_8F0005">#8F0005</color>
<color name="color_FF0006">#FF0006</color>
<color name="color_0099dd">#0099dd</color>
<color name="color_FFFFFF">#FFFFFF</color>
<color name="background_wtf">#FF999900</color>
<color name="background_error">#FFCC0000</color>
<color name="background_verbose">#FF666666</color>
<color name="background_debug">#FFFFFF00</color>
<color name="background_info">#FF00CC00</color>
<color name="background_warn">#FF0066CC</color>
<color name="foreground_wtf">#FFFFFFFF</color>
<color name="foreground_error">#FFFFFFFF</color>
<color name="foreground_verbose">#FFCCCCCC</color>
<color name="foreground_debug">#FF333333</color>
<color name="foreground_info">#FF333333</color>
<color name="foreground_warn">#FFCCCCCC</color>
</resources>

View File

@@ -1,4 +1,21 @@
<resources>
<string name="app_name">mogo-module-push</string>
<string name="motice_push_check">查看</string>
<string name="log_min">最小化</string>
<string name="log_info">日志</string>
<string name="log_info_edt_hint">输入想要过滤的关键字</string>
<string name="log_info_verbose">Verbose</string>
<string name="log_info_debug">Debug</string>
<string name="log_info_info">Info</string>
<string name="log_info_warn">Warn</string>
<string name="log_info_error">Error</string>
<!--日志-->
<string name="log_btn_clean">清空日志</string>
<string name="log_btn_export">导出</string>
<string name="log_btn_back_top">回到顶部</string>
<string name="log_btn_to_bottom">滚至底部</string>
<string name="log_text_loading">日志加载中...</string>
</resources>

View File

@@ -6,4 +6,80 @@
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
<item name="android:windowBackground">@drawable/module_push_message_background</item>
</style>
<style name="TitleBig">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">24px</item>
<item name="android:textColor">#324456</item>
<item name="android:gravity">center</item>
<item name="android:textStyle">bold</item>
</style>
<style name="Bottom">
<item name="android:background">@drawable/shadow_bottom</item>
</style>
<style name="Input">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">center_vertical|left</item>
<item name="android:textColor">#333333</item>
<item name="android:textColorHint">#CCCCCC</item>
<item name="android:textSize">16sp</item>
<item name="android:background">@null</item>
<item name="android:textCursorDrawable">@drawable/input_cursor</item>
</style>
<style name="RadioButton">
<item name="android:gravity">center</item>
<item name="android:textSize">14px</item>
<item name="android:textColor">#131313</item>
<item name="android:layout_height">34dp</item>
<item name="android:layout_width">70dp</item>
<item name="android:button">@null</item>
<item name="android:background">@drawable/radio_button_background</item>
</style>
<style name="RadioButton.Left">
<item name="android:gravity">center</item>
<item name="android:textSize">14px</item>
<item name="android:textColor">#131313</item>
<item name="android:layout_height">34dp</item>
<item name="android:layout_width">70dp</item>
<item name="android:button">@null</item>
<item name="android:background">@drawable/radio_button_background_left</item>
</style>
<style name="RadioButton.Middle">
<item name="android:gravity">center</item>
<item name="android:textSize">14px</item>
<item name="android:textColor">#131313</item>
<item name="android:layout_height">34dp</item>
<item name="android:layout_width">70dp</item>
<item name="android:button">@null</item>
<item name="android:background">@drawable/radio_button_background_middle</item>
</style>
<style name="RadioButton.Right">
<item name="android:gravity">center</item>
<item name="android:textSize">14px</item>
<item name="android:textColor">#131313</item>
<item name="android:layout_height">34dp</item>
<item name="android:layout_width">70dp</item>
<item name="android:button">@null</item>
<item name="android:background">@drawable/radio_button_background_right</item>
</style>
<style name="Text">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">14sp</item>
<item name="android:gravity">center</item>
</style>
<style name="White" parent="Text">
<item name="android:textColor">#FFFFFF</item>
</style>
</resources>