mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-12 21:01:32 +08:00
优化 夜间模式的显示
This commit is contained in:
parent
385f9a4336
commit
e15d5a2f07
@ -13,10 +13,10 @@
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:theme="@style/ToolBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ToolBarStyle"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
@ -29,7 +29,9 @@
|
||||
<com.stardust.autojs.core.console.ConsoleView
|
||||
android:id="@+id/console"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
app:color_debug="@color/console_debug"
|
||||
app:color_verbose="@color/console_verbose"/>
|
||||
|
||||
<com.stardust.theme.widget.ThemeColorFloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/apps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/white"/>
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
@ -37,7 +37,6 @@
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:cardBackgroundColor="@android:color/white"
|
||||
app:cardCornerRadius="2dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
@ -125,7 +124,7 @@
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#202020"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
@ -154,7 +153,7 @@
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="#202020"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="16sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@ -13,4 +13,7 @@
|
||||
<color name="tab_text">#3A3A3C</color>
|
||||
<color name="toolbar">#8D8D8E</color>
|
||||
<color name="toolbar_disabled">#3A3A3C</color>
|
||||
<color name="console_debug">#dfc0c0c0</color>
|
||||
<color name="console_verbose">#7F7F80</color>
|
||||
|
||||
</resources>
|
||||
@ -6,7 +6,5 @@
|
||||
<item name="actionMenuTextColor">@color/toolbar</item>
|
||||
</style>
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
<item name="android:textColorPrimary">@color/toolbar</item>
|
||||
<item name="actionMenuTextColor">@color/toolbar</item>
|
||||
</style>
|
||||
</resources>
|
||||
@ -27,6 +27,9 @@
|
||||
<color name="tab_text">#a0ffffff</color>
|
||||
<color name="toolbar">@android:color/white</color>
|
||||
<color name="toolbar_disabled">#77e0e0e0</color>
|
||||
<color name="console_debug">#cc000000</color>
|
||||
<color name="console_verbose">#dfc0c0c0</color>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@ -63,8 +63,11 @@
|
||||
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.ActionBar"/>
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.ActionBar">
|
||||
<item name="android:textColorPrimary">#212121</item>
|
||||
<item name="android:textColorSecondary">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
android:title="@string/text_script_record"
|
||||
android:widgetLayout="@layout/preference_custom">
|
||||
|
||||
|
||||
<com.stardust.theme.preference.ThemeColorSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_use_volume_control_record"
|
||||
@ -90,27 +89,6 @@
|
||||
/>
|
||||
</com.stardust.theme.preference.ThemeColorPreferenceCategory>
|
||||
|
||||
<com.stardust.theme.preference.ThemeColorPreferenceCategory
|
||||
android:layout="@layout/preference_category_custom"
|
||||
android:title="@string/text_ad">
|
||||
<com.afollestad.materialdialogs.prefs.MaterialListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/ad_types_keys"
|
||||
android:entryValues="@array/ad_types_values"
|
||||
android:key="@string/key_ad_type"
|
||||
android:layout="@layout/preference_custom"
|
||||
android:title="@string/text_ad_type_settings"
|
||||
/>
|
||||
<com.afollestad.materialdialogs.prefs.MaterialListPreference
|
||||
android:defaultValue="@string/text_default"
|
||||
android:entries="@array/ad_showing_mode_keys"
|
||||
android:entryValues="@array/ad_showing_mode_values"
|
||||
android:key="@string/key_ad_showing_mode"
|
||||
android:layout="@layout/preference_custom"
|
||||
android:title="@string/text_ad_showing_settings"
|
||||
/>
|
||||
</com.stardust.theme.preference.ThemeColorPreferenceCategory>
|
||||
|
||||
<com.stardust.theme.preference.ThemeColorPreferenceCategory
|
||||
android:layout="@layout/preference_category_custom"
|
||||
android:title="@string/text_others">
|
||||
@ -124,14 +102,14 @@
|
||||
/>
|
||||
|
||||
<org.autojs.autojs.ui.settings.ScriptDirPathPreference
|
||||
android:defaultValue="@string/default_value_script_dir_path"
|
||||
android:entries="@array/keys_documentation_source"
|
||||
android:entryValues="@array/values_documentation_source"
|
||||
android:key="@string/key_script_dir_path"
|
||||
android:defaultValue="@string/default_value_script_dir_path"
|
||||
android:layout="@layout/preference_custom"
|
||||
android:title="@string/text_change_script_dir"
|
||||
/>
|
||||
android:
|
||||
android:
|
||||
</com.stardust.theme.preference.ThemeColorPreferenceCategory>
|
||||
|
||||
<com.stardust.theme.preference.ThemeColorPreferenceCategory
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.stardust.autojs.core.console;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -17,11 +18,12 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.stardust.autojs.R;
|
||||
import com.stardust.concurrent.ConcurrentArrayList;
|
||||
import com.stardust.enhancedfloaty.ResizableExpandableFloatyWindow;
|
||||
import com.stardust.util.MapBuilder;
|
||||
import com.stardust.util.SparseArrayEntries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/5/2.
|
||||
@ -30,6 +32,15 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class ConsoleView extends FrameLayout implements StardustConsole.LogListener {
|
||||
|
||||
private static final Map<Integer, Integer> ATTRS = new MapBuilder<Integer, Integer>()
|
||||
.put(R.styleable.ConsoleView_color_verbose, Log.VERBOSE)
|
||||
.put(R.styleable.ConsoleView_color_debug, Log.DEBUG)
|
||||
.put(R.styleable.ConsoleView_color_info, Log.INFO)
|
||||
.put(R.styleable.ConsoleView_color_warn, Log.WARN)
|
||||
.put(R.styleable.ConsoleView_color_error, Log.ERROR)
|
||||
.put(R.styleable.ConsoleView_color_assert, Log.ASSERT)
|
||||
.build();
|
||||
|
||||
static final SparseArray<Integer> COLORS = new SparseArrayEntries<Integer>()
|
||||
.entry(Log.VERBOSE, 0xdfc0c0c0)
|
||||
.entry(Log.DEBUG, 0xdfffffff)
|
||||
@ -40,7 +51,7 @@ public class ConsoleView extends FrameLayout implements StardustConsole.LogListe
|
||||
.sparseArray();
|
||||
|
||||
private static final int REFRESH_INTERVAL = 100;
|
||||
private SparseArray<Integer> mColors = COLORS;
|
||||
private SparseArray<Integer> mColors = COLORS.clone();
|
||||
private StardustConsole mConsole;
|
||||
private RecyclerView mLogListRecyclerView;
|
||||
private EditText mEditText;
|
||||
@ -51,25 +62,33 @@ public class ConsoleView extends FrameLayout implements StardustConsole.LogListe
|
||||
|
||||
public ConsoleView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
init(null);
|
||||
}
|
||||
|
||||
public ConsoleView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
public ConsoleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
public void setColors(SparseArray<Integer> colors) {
|
||||
mColors = colors;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
private void init(AttributeSet attrs) {
|
||||
inflate(getContext(), R.layout.console_view, this);
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ConsoleView);
|
||||
for (Map.Entry<Integer, Integer> attr : ATTRS.entrySet()) {
|
||||
int styleable = attr.getKey();
|
||||
int logLevel = attr.getValue();
|
||||
mColors.put(logLevel, typedArray.getColor(styleable, mColors.get(logLevel)));
|
||||
}
|
||||
}
|
||||
mLogListRecyclerView = findViewById(R.id.log_list);
|
||||
LinearLayoutManager manager = new LinearLayoutManager(getContext());
|
||||
mLogListRecyclerView.setLayoutManager(manager);
|
||||
|
||||
@ -15,18 +15,8 @@ import java.util.Locale;
|
||||
public class GlobalStardustConsole extends StardustConsole {
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault());
|
||||
|
||||
private final SparseArray<Integer> mColors;
|
||||
|
||||
public GlobalStardustConsole(UiHandler uiHandler) {
|
||||
super(uiHandler);
|
||||
mColors = ConsoleView.COLORS.clone();
|
||||
mColors.put(android.util.Log.DEBUG, 0xcc000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConsoleView(ConsoleView consoleView) {
|
||||
super.setConsoleView(consoleView);
|
||||
consoleView.setColors(mColors);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,8 +2,6 @@ package com.stardust.autojs.core.ui.inflater.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.InflateException;
|
||||
import android.view.View;
|
||||
|
||||
11
autojs/src/main/res/values/attrs.xml
Normal file
11
autojs/src/main/res/values/attrs.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="ConsoleView">
|
||||
<attr name="color_debug" format="reference|color"/>
|
||||
<attr name="color_verbose" format="reference|color"/>
|
||||
<attr name="color_info" format="reference|color"/>
|
||||
<attr name="color_warn" format="reference|color"/>
|
||||
<attr name="color_error" format="reference|color"/>
|
||||
<attr name="color_assert" format="reference|color"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":437,"versionName":"4.0.4 Alpha8","enabled":true,"outputFile":"commonRelease-4.0.4 Alpha8.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.4 Alpha8.apk","properties":{}}]
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":438,"versionName":"4.0.4 Alpha9","enabled":true,"outputFile":"commonRelease-4.0.4 Alpha9.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.4 Alpha9.apk","properties":{}}]
|
||||
@ -1,11 +1,7 @@
|
||||
package com.stardust.auojs.inrt;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
@ -13,20 +9,10 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import com.stardust.auojs.inrt.autojs.AutoJs;
|
||||
import com.stardust.auojs.inrt.launch.AssetsProjectLauncher;
|
||||
import com.stardust.auojs.inrt.launch.GlobalProjectLauncher;
|
||||
import com.stardust.autojs.core.console.ConsoleView;
|
||||
import com.stardust.autojs.core.console.StardustConsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL;
|
||||
|
||||
import static android.content.pm.PackageManager.PERMISSION_DENIED;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
public class LogActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
|
||||
@ -24,5 +24,7 @@
|
||||
<com.stardust.autojs.core.console.ConsoleView
|
||||
android:id="@+id/console"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
android:layout_height="match_parent"
|
||||
app:color_debug="#cc000000"
|
||||
app:color_verbose="#dfc0c0c0"/>
|
||||
</LinearLayout>
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"appVersionCode": 437,
|
||||
"appVersionName": "4.0.4 Alpha8",
|
||||
"appVersionCode": 438,
|
||||
"appVersionName": "4.0.4 Alpha9",
|
||||
"target": 28,
|
||||
"mini": 17,
|
||||
"compile": 28,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user