diff --git a/Logcat.apk b/Logcat.apk index 00c6068..585e266 100644 Binary files a/Logcat.apk and b/Logcat.apk differ diff --git a/README.md b/README.md index 9530d18..348247b 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,19 @@ #### 集成步骤 dependencies { - debugImplementation 'com.hjq:logcat:3.2' + debugImplementation 'com.hjq:logcat:5.0' } #### 使用方式 -* 在 debug 模式下运行即可,在 release 正式打包的时不会自动集成 +* 无需调用,直接运行,然后授予悬浮窗权限即可 + +* 在 debug 模式下运行即可,在 release 正式打包的时不会集成本库,尽管放心 #### 截图欣赏 +![](picture/0.jpg) + ![](picture/1.jpg) ![](picture/2.jpg) @@ -47,6 +51,8 @@ * 日志长按可复制分享 +* 支持将日志保存到本地 + * 长日志点击可收缩展开显示 * 日志搜索结果支持文本高亮 diff --git a/app/build.gradle b/app/build.gradle index c8669d6..5513cb4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.hjq.logcat.demo" minSdkVersion 14 targetSdkVersion 28 - versionCode 32 - versionName "3.2" + versionCode 50 + versionName "5.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fdb02c1..e9a4cc5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..647f632 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..def6957 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..d3f78e9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/library/build.gradle b/library/build.gradle index 3a64995..d86fece 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -10,14 +10,14 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 26 - versionCode 32 - versionName "3.2" + versionCode 50 + versionName "5.0" } } dependencies { // 权限请求框架:https://github.com/getActivity/XXPermissions - implementation 'com.hjq:xxpermissions:6.0' + implementation 'com.hjq:xxpermissions:6.2' // 悬浮窗框架:https://github.com/getActivity/XToast implementation 'com.hjq:xtoast:3.5' } @@ -26,7 +26,7 @@ publish { userOrg = 'getactivity' groupId = 'com.hjq' artifactId = 'logcat' - version = '3.2' + version = '5.0' description = 'This is to help developers quickly see the logging framework they want' website = "https://github.com/getActivity/Logcat" } diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index a5fcc27..d20b494 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -4,6 +4,10 @@ + + + + granted, boolean all) { - LogcatConfig.init(getApplication()); FloatingLifecycle.with(getApplication(), new FloatingWindow(getApplication()).show()); finish(); } @Override public void noPermission(List denied, boolean quick) { - Toast.makeText(getApplicationContext(), "权限申请失败,无法显示弹窗", Toast.LENGTH_LONG).show(); + Toast.makeText(getApplicationContext(), "权限申请失败,无法显示 Logcat", Toast.LENGTH_LONG).show(); finish(); } } \ No newline at end of file diff --git a/library/src/main/java/com/hjq/logcat/InitProvider.java b/library/src/main/java/com/hjq/logcat/InitProvider.java index f9fac43..1b8b693 100644 --- a/library/src/main/java/com/hjq/logcat/InitProvider.java +++ b/library/src/main/java/com/hjq/logcat/InitProvider.java @@ -6,6 +6,10 @@ import android.content.Intent; import android.database.Cursor; import android.net.Uri; +import android.widget.Toast; + +import com.hjq.permissions.Permission; +import com.hjq.permissions.XXPermissions; /** * author : Android 轮子哥 @@ -19,6 +23,17 @@ public final class InitProvider extends ContentProvider { public boolean onCreate() { Context context = getContext(); if (context != null) { + LogcatConfig.init(context.getApplicationContext()); + if (!XXPermissions.isHasPermission(context, Permission.SYSTEM_ALERT_WINDOW)) { + int count = LogcatConfig.getPermissionsCount(); + if (count >= 3) { + Toast.makeText(context, "需要显示 Logcat 请先自行授予悬浮权限", Toast.LENGTH_LONG).show(); + return true; + } + LogcatConfig.setPermissionsCount(++count); + } else { + LogcatConfig.setPermissionsCount(0); + } Intent intent = new Intent(context, InitActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); diff --git a/library/src/main/java/com/hjq/logcat/LogcatActivity.java b/library/src/main/java/com/hjq/logcat/LogcatActivity.java index ef5b769..e39be6a 100644 --- a/library/src/main/java/com/hjq/logcat/LogcatActivity.java +++ b/library/src/main/java/com/hjq/logcat/LogcatActivity.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.os.Environment; import android.text.Editable; import android.text.TextWatcher; import android.view.Gravity; @@ -18,10 +19,22 @@ import android.widget.ListView; import android.widget.TextView; +import com.hjq.permissions.OnPermission; +import com.hjq.permissions.Permission; +import com.hjq.permissions.XXPermissions; import com.hjq.xtoast.XToast; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.nio.charset.Charset; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Locale; /** * author : Android 轮子哥 @@ -39,8 +52,10 @@ public final class LogcatActivity extends Activity private List mLogData = new ArrayList<>(); private CheckBox mSwitchView; + private View mSaveView; private TextView mLevelView; private EditText mSearchView; + private View mEmptyView; private View mCleanView; private View mCloseView; private ListView mListView; @@ -57,8 +72,10 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.logcat_window_logcat); mSwitchView = findViewById(R.id.iv_log_switch); + mSaveView = findViewById(R.id.iv_log_save); mLevelView = findViewById(R.id.tv_log_level); mSearchView = findViewById(R.id.et_log_search); + mEmptyView = findViewById(R.id.iv_log_empty); mCleanView = findViewById(R.id.iv_log_clean); mCloseView = findViewById(R.id.iv_log_close); mListView = findViewById(R.id.lv_log_list); @@ -73,18 +90,20 @@ protected void onCreate(Bundle savedInstanceState) { mSearchView.setText(LogcatConfig.getLogcatText()); setLogLevel(LogcatConfig.getLogcatLevel()); + mSaveView.setOnClickListener(this); mLevelView.setOnClickListener(this); + mEmptyView.setOnClickListener(this); mCleanView.setOnClickListener(this); mCloseView.setOnClickListener(this); + mSaveView.setOnLongClickListener(this); mSwitchView.setOnLongClickListener(this); mLevelView.setOnLongClickListener(this); mCleanView.setOnLongClickListener(this); mCloseView.setOnLongClickListener(this); // 开始捕获 - LogcatManager.setListener(this); - LogcatManager.start(); + LogcatManager.start(this); mListView.postDelayed(new Runnable() { @Override @@ -95,8 +114,8 @@ public void run() { } @Override - public void onReceiveLog(String line) { - mListView.post(new LogRunnable(new LogcatInfo(line))); + public void onReceiveLog(LogcatInfo info) { + mListView.post(new LogRunnable(info)); } @Override @@ -107,7 +126,7 @@ public void onItemClick(AdapterView parent, View view, int position, long id) @Override public boolean onItemLongClick(AdapterView parent, View view, final int location, long id) { new ChooseWindow(this) - .setList("复制日志", "分享日志") + .setList("复制日志", "分享日志", "删除日志") .setListener(new ChooseWindow.OnListener() { @Override public void onSelected(int position) { @@ -117,13 +136,19 @@ public void onSelected(int position) { if (manager != null) { manager.setPrimaryClip(ClipData.newPlainText("log", mAdapter.getItem(location).getLog())); toast("日志复制成功"); + } else { + toast("日志复制失败"); } break; case 1: Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, mAdapter.getItem(location).getLog()); - startActivity(Intent.createChooser(intent, "分享文本")); + startActivity(Intent.createChooser(intent, "分享日志")); + break; + case 2: + mLogData.remove(mAdapter.getItem(location)); + mAdapter.removeItem(location); break; default: break; @@ -138,7 +163,9 @@ public void onSelected(int position) { public boolean onLongClick(View v) { if (v == mSwitchView) { toast("日志捕获开关"); - } else if (v == mLevelView) { + } else if (v == mSaveView) { + toast("保存日志"); + }else if (v == mLevelView) { toast("日志等级过滤"); } else if (v == mCleanView) { toast("清空日志"); @@ -149,8 +176,20 @@ public boolean onLongClick(View v) { } @Override - public void onClick(View view) { - if (view == mLevelView) { + public void onClick(View v) { + if (v == mSaveView) { + XXPermissions.with(this) + .permission(Permission.Group.STORAGE) + .request(new OnPermission() { + @Override + public void hasPermission(List granted, boolean isAll) { + saveLogToFile(); + } + + @Override + public void noPermission(List denied, boolean quick) {} + }); + } else if (v == mLevelView) { new ChooseWindow(this) .setList(ARRAY_LOG_LEVEL) .setListener(new ChooseWindow.OnListener() { @@ -178,10 +217,12 @@ public void onSelected(int position) { } }) .show(); - } else if (view == mCleanView) { + } else if (v == mEmptyView) { + mSearchView.setText(""); + }else if (v == mCleanView) { LogcatManager.clear(); mAdapter.clearData(); - } else if (view == mCloseView) { + } else if (v == mCloseView) { onBackPressed(); } } @@ -190,9 +231,9 @@ public void onSelected(int position) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { toast("日志捕捉已暂停"); - LogcatManager.stop(); + LogcatManager.pause(); } else { - LogcatManager.start(); + LogcatManager.resume(); } } @@ -224,6 +265,7 @@ public void afterTextChanged(Editable s) { } } mListView.setSelection(mAdapter.getCount() - 1); + mEmptyView.setVisibility("".equals(keyword) ? View.GONE : View.VISIBLE); } private void setLogLevel(String level) { @@ -289,6 +331,46 @@ public void run() { } } + /** + * 保存日志到本地 + */ + private void saveLogToFile() { + BufferedWriter writer = null; + try { + + File directory = new File(Environment.getExternalStorageDirectory(), "Logcat" + File.separator + getPackageName()); + if (!directory.isDirectory()) { + directory.delete(); + } + if (!directory.exists()) { + directory.mkdirs(); + } + File file = new File(directory, new SimpleDateFormat("yyyyMMdd_kkmmss", Locale.getDefault()).format(new Date()) + ".txt"); + if (!file.isFile()) { + file.delete(); + } + if (!file.exists()) { + file.createNewFile(); + } + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, false), Charset.forName("UTF-8"))); + List data = mAdapter.getData(); + for (LogcatInfo info : data) { + writer.write(info.toString().replace("\n", "\r\n") + "\r\n\r\n"); + } + writer.flush(); + + toast("保存成功:" + file.getPath()); + } catch (IOException e) { + toast("保存失败"); + } finally { + if (writer != null) { + try { + writer.close(); + } catch (IOException ignored) {} + } + } + } + /** * 吐司提示 */ diff --git a/library/src/main/java/com/hjq/logcat/LogcatAdapter.java b/library/src/main/java/com/hjq/logcat/LogcatAdapter.java index 9b15f56..329c66b 100644 --- a/library/src/main/java/com/hjq/logcat/LogcatAdapter.java +++ b/library/src/main/java/com/hjq/logcat/LogcatAdapter.java @@ -21,7 +21,7 @@ * author : Android 轮子哥 * github : https://github.com/getActivity/Logcat * time : 2020/01/24 - * desc : + * desc : 日志列表适配器 */ final class LogcatAdapter extends BaseAdapter { @@ -72,6 +72,14 @@ void addItem(LogcatInfo item) { notifyDataSetChanged(); } + /** + * 删除某条数据 + */ + void removeItem(int position) { + mDataSet.remove(position); + notifyDataSetChanged(); + } + /** * 清空当前数据 */ @@ -105,15 +113,10 @@ private ViewHolder(View view) { mLineView = view.findViewById(R.id.v_log_line); } - private void onBindView(LogcatInfo bean, int position) { - String level = bean.getLevel(); - String time = bean.getTime(); - String tag = bean.getTag(); - String log = bean.getLog(); - - String content = String.format("%s %s %s", time, tag, log); + private void onBindView(LogcatInfo info, int position) { + String content = info.toString(); CharSequence text = content; - if (mKeyword.length() > 0) { + if (mKeyword != null && mKeyword.length() > 0) { int index = content.indexOf(mKeyword); if (index == -1) { index = content.toLowerCase().indexOf(mKeyword.toLowerCase()); @@ -134,7 +137,7 @@ private void onBindView(LogcatInfo bean, int position) { mContentView.setText(text); final int resourceId; - switch (level) { + switch (info.getLevel()) { case "D": resourceId = R.color.logcat_level_debug_color; break; @@ -165,22 +168,35 @@ private void onBindView(LogcatInfo bean, int position) { if (mContentView.getLineCount() - MAX_LINE > 1) { if (mExpandSet.get(position)) { - mContentView.setMaxLines(Integer.MAX_VALUE); - mExpandView.setImageResource(R.drawable.logcat_ic_arrows_up); - mExpandView.setVisibility(View.VISIBLE); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + if (mContentView.getMaxLines() != Integer.MAX_VALUE) { + mContentView.setMaxLines(Integer.MAX_VALUE); + mExpandView.setImageResource(R.drawable.logcat_ic_arrows_up); + } + } else { + mContentView.setMaxLines(Integer.MAX_VALUE); + mExpandView.setImageResource(R.drawable.logcat_ic_arrows_up); + } } else { - mContentView.setMaxLines(MAX_LINE); - mExpandView.setImageResource(R.drawable.logcat_ic_arrows_down); - mExpandView.setVisibility(View.VISIBLE); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + if (mContentView.getMaxLines() != MAX_LINE) { + mContentView.setMaxLines(MAX_LINE); + mExpandView.setImageResource(R.drawable.logcat_ic_arrows_down); + } + } else { + mContentView.setMaxLines(MAX_LINE); + mExpandView.setImageResource(R.drawable.logcat_ic_arrows_down); + } } + mExpandView.setVisibility(View.VISIBLE); mIndexView.setVisibility(View.GONE); } else { mContentView.setMaxLines(Integer.MAX_VALUE); - mExpandView.setVisibility(View.GONE); + mIndexView.setText(String.valueOf(position + 1)); + mExpandView.setVisibility(View.GONE); mIndexView.setVisibility(View.VISIBLE); - mIndexView.setText(String.valueOf(position + 1)); } } } diff --git a/library/src/main/java/com/hjq/logcat/LogcatConfig.java b/library/src/main/java/com/hjq/logcat/LogcatConfig.java index e124516..68c3f3c 100644 --- a/library/src/main/java/com/hjq/logcat/LogcatConfig.java +++ b/library/src/main/java/com/hjq/logcat/LogcatConfig.java @@ -1,6 +1,5 @@ package com.hjq.logcat; -import android.app.Application; import android.content.Context; import android.content.SharedPreferences; @@ -17,8 +16,21 @@ final class LogcatConfig { /** * 初始化 */ - static void init(Application application) { - sConfig = application.getSharedPreferences("logcat", Context.MODE_PRIVATE); + static void init(Context context) { + sConfig = context.getSharedPreferences("logcat", Context.MODE_PRIVATE); + } + + /** + * 申请权限次数 + */ + private static final String PERMISSIONS_COUNT = "permissions_count"; + + static int getPermissionsCount() { + return sConfig.getInt(PERMISSIONS_COUNT, 0); + } + + static void setPermissionsCount(int count) { + sConfig.edit().putInt(PERMISSIONS_COUNT, count).apply(); } /** diff --git a/library/src/main/java/com/hjq/logcat/LogcatInfo.java b/library/src/main/java/com/hjq/logcat/LogcatInfo.java index 734361b..8f2a1d4 100644 --- a/library/src/main/java/com/hjq/logcat/LogcatInfo.java +++ b/library/src/main/java/com/hjq/logcat/LogcatInfo.java @@ -12,6 +12,8 @@ */ final class LogcatInfo { + private static final String LINE_SPACE = "\n "; + private static final Pattern PATTERN = Pattern.compile( "([0-9^-]+-[0-9^ ]+ [0-9^:]+:[0-9^:]+\\.[0-9]+) +([0-9]+) +([0-9]+) ([VDIWEF]) ([^ ]*) *: (.*)"); @@ -22,13 +24,13 @@ final class LogcatInfo { }}; /** 时间 */ - private String time; + private String mTime; /** 等级 */ - private String level; + private String mLevel; /** 标记 */ - private String tag; + private String mTag; /** 内容 */ - private String log; + private String mLog; LogcatInfo(String line) { Matcher matcher = PATTERN.matcher(line); @@ -36,29 +38,34 @@ final class LogcatInfo { throw new IllegalStateException("logcat pattern not match: " + line); } - time = matcher.group(1); - level = matcher.group(4); - tag = matcher.group(5); - log = matcher.group(6); + mTime = matcher.group(1); + mLevel = matcher.group(4); + mTag = matcher.group(5); + mLog = matcher.group(6); } String getTime() { - return time; + return mTime; } String getLevel() { - return level; + return mLevel; } String getTag() { - return tag; + return mTag; } String getLog() { - return log; + return mLog; } void addLog(String text) { - log = (log.startsWith("\n\t\t\t\t") ? "" : "\n\t\t\t\t") + log + "\n\t\t\t\t" + text; + mLog = (mLog.startsWith(LINE_SPACE) ? "" : LINE_SPACE) + mLog + LINE_SPACE + text; + } + + @Override + public String toString() { + return String.format("%s %s %s", mTime, mTag, mLog); } } \ No newline at end of file diff --git a/library/src/main/java/com/hjq/logcat/LogcatManager.java b/library/src/main/java/com/hjq/logcat/LogcatManager.java index a5d8b31..bc2fa1f 100644 --- a/library/src/main/java/com/hjq/logcat/LogcatManager.java +++ b/library/src/main/java/com/hjq/logcat/LogcatManager.java @@ -3,6 +3,8 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; /** * author : Android 轮子哥 @@ -13,68 +15,89 @@ */ final class LogcatManager { - private static Listener sListener; - private static boolean FLAG_WORK; + private static volatile Listener sListener; + /** 日志捕捉标记 */ + private static volatile boolean FLAG_WORK; + /** 备用存放集合 */ + private static final List LOG_BACKUP = new ArrayList<>(); - static void setListener(Listener listener) { + /** + * 开始捕捉 + */ + static void start(Listener listener) { + if (sListener == null) { + FLAG_WORK = true; + new Thread(new LogRunnable()).start(); + } sListener = listener; } - static void start() { - if (!FLAG_WORK) { - FLAG_WORK = true; - - new Thread(new Runnable() { - @Override - public void run() { - BufferedReader reader = null; - try { - Process process = new ProcessBuilder("logcat", "-v", "threadtime").start(); - reader = new BufferedReader(new InputStreamReader(process.getInputStream())); - String line; - while (FLAG_WORK && (line = reader.readLine()) != null) { - if (LogcatInfo.IGNORED_LOG.contains(line)) { - continue; - } - try { - if (sListener != null) { - sListener.onReceiveLog(line); - } - } catch (NumberFormatException | IllegalStateException e) { - e.printStackTrace(); - } - } - stop(); - } catch (IOException e) { - e.printStackTrace(); - stop(); - } - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - }).start(); + /** + * 继续捕捉 + */ + static void resume() { + FLAG_WORK = true; + if (sListener != null && !LOG_BACKUP.isEmpty()) { + for (LogcatInfo info : LOG_BACKUP) { + sListener.onReceiveLog(info); + } } + LOG_BACKUP.clear(); } - static void stop() { + /** + * 暂停捕捉 + */ + static void pause() { FLAG_WORK = false; } + /** + * 清空日志 + */ static void clear() { try { new ProcessBuilder("logcat", "-c").start(); - start(); - } catch (IOException e) { - e.printStackTrace(); + FLAG_WORK = true; + new Thread(new LogRunnable()).start(); + } catch (IOException ignored) {} + } + + private static class LogRunnable implements Runnable { + + @Override + public void run() { + BufferedReader reader = null; + try { + Process process = new ProcessBuilder("logcat", "-v", "threadtime").start(); + reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + String line; + while ((line = reader.readLine()) != null) { + if (LogcatInfo.IGNORED_LOG.contains(line)) { + continue; + } + if (FLAG_WORK) { + if (sListener != null) { + sListener.onReceiveLog(new LogcatInfo(line)); + } + } else { + LOG_BACKUP.add(new LogcatInfo(line)); + } + } + pause(); + } catch (IOException ignored) { + pause(); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException ignored) {} + } + } } } public interface Listener { - void onReceiveLog(String line); + void onReceiveLog(LogcatInfo line); } } \ No newline at end of file diff --git a/library/src/main/res/drawable/logcat_floating_normal.xml b/library/src/main/res/drawable/logcat_floating_normal.xml new file mode 100644 index 0000000..ff758f5 --- /dev/null +++ b/library/src/main/res/drawable/logcat_floating_normal.xml @@ -0,0 +1,29 @@ + + + + + \ No newline at end of file diff --git a/library/src/main/res/drawable/logcat_floating_pressed.xml b/library/src/main/res/drawable/logcat_floating_pressed.xml new file mode 100644 index 0000000..0c00a4f --- /dev/null +++ b/library/src/main/res/drawable/logcat_floating_pressed.xml @@ -0,0 +1,31 @@ + + + + + \ No newline at end of file diff --git a/library/src/main/res/drawable/logcat_ic_empty.xml b/library/src/main/res/drawable/logcat_ic_empty.xml new file mode 100644 index 0000000..a9359d7 --- /dev/null +++ b/library/src/main/res/drawable/logcat_ic_empty.xml @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/library/src/main/res/drawable/logcat_ic_log.xml b/library/src/main/res/drawable/logcat_ic_log.xml deleted file mode 100644 index 30a74bd..0000000 --- a/library/src/main/res/drawable/logcat_ic_log.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/library/src/main/res/drawable/logcat_ic_save.xml b/library/src/main/res/drawable/logcat_ic_save.xml new file mode 100644 index 0000000..96d1381 --- /dev/null +++ b/library/src/main/res/drawable/logcat_ic_save.xml @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/library/src/main/res/drawable/logcat_selector_floating.xml b/library/src/main/res/drawable/logcat_selector_floating.xml new file mode 100644 index 0000000..4ad3ca2 --- /dev/null +++ b/library/src/main/res/drawable/logcat_selector_floating.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/library/src/main/res/layout/logcat_item_logcat.xml b/library/src/main/res/layout/logcat_item_logcat.xml index 9cf7092..563a0f9 100644 --- a/library/src/main/res/layout/logcat_item_logcat.xml +++ b/library/src/main/res/layout/logcat_item_logcat.xml @@ -12,8 +12,10 @@ android:layout_height="wrap_content" android:background="@color/logcat_item_background_color" android:lineSpacingExtra="5dp" + android:paddingStart="10dp" android:paddingLeft="10dp" android:paddingTop="5dp" + android:paddingEnd="40dp" android:paddingRight="40dp" android:paddingBottom="5dp" android:textColor="@android:color/white" @@ -24,23 +26,25 @@ android:id="@+id/iv_log_expand" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="right" + android:layout_gravity="end" android:layout_marginTop="8dp" + android:layout_marginEnd="10dp" android:layout_marginRight="10dp" android:src="@drawable/logcat_ic_arrows_down" android:visibility="gone" /> \ No newline at end of file + android:layout_width="45dp" + android:layout_height="45dp" + android:src="@drawable/logcat_selector_floating" /> \ No newline at end of file diff --git a/library/src/main/res/layout/logcat_window_logcat.xml b/library/src/main/res/layout/logcat_window_logcat.xml index a6e2382..a25c671 100644 --- a/library/src/main/res/layout/logcat_window_logcat.xml +++ b/library/src/main/res/layout/logcat_window_logcat.xml @@ -24,6 +24,14 @@ android:button="@drawable/logcat_bg_log_check" android:checked="false" /> + + - + android:layout_weight="1"> + + + + + +