新增 夜间模式
This commit is contained in:
@@ -7,6 +7,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.support.multidex.MultiDexApplication;
|
import android.support.multidex.MultiDexApplication;
|
||||||
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ import org.autojs.autojs.autojs.AutoJs;
|
|||||||
import org.autojs.autojs.autojs.key.GlobalKeyObserver;
|
import org.autojs.autojs.autojs.key.GlobalKeyObserver;
|
||||||
import org.autojs.autojs.external.receiver.DynamicBroadcastReceivers;
|
import org.autojs.autojs.external.receiver.DynamicBroadcastReceivers;
|
||||||
import org.autojs.autojs.network.GlideApp;
|
import org.autojs.autojs.network.GlideApp;
|
||||||
|
import org.autojs.autojs.theme.ThemeColorManagerCompat;
|
||||||
import org.autojs.autojs.timing.IntentTask;
|
import org.autojs.autojs.timing.IntentTask;
|
||||||
import org.autojs.autojs.timing.TimedTaskManager;
|
import org.autojs.autojs.timing.TimedTaskManager;
|
||||||
import org.autojs.autojs.timing.TimedTaskScheduler;
|
import org.autojs.autojs.timing.TimedTaskScheduler;
|
||||||
@@ -99,8 +101,7 @@ public class App extends MultiDexApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
ThemeColorManager.setDefaultThemeColor(new ThemeColor(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorPrimaryDark), getResources().getColor(R.color.colorAccent)));
|
ThemeColorManagerCompat.init(this, new ThemeColor(getResources().getColor(R.color.colorPrimary), getResources().getColor(R.color.colorPrimaryDark), getResources().getColor(R.color.colorAccent)));
|
||||||
ThemeColorManager.init(this);
|
|
||||||
AutoJs.initInstance(this);
|
AutoJs.initInstance(this);
|
||||||
if (Pref.isRunningVolumeControlEnabled()) {
|
if (Pref.isRunningVolumeControlEnabled()) {
|
||||||
GlobalKeyObserver.init();
|
GlobalKeyObserver.init();
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import android.preference.PreferenceManager;
|
|||||||
|
|
||||||
import com.stardust.app.GlobalAppContext;
|
import com.stardust.app.GlobalAppContext;
|
||||||
import com.stardust.autojs.runtime.accessibility.AccessibilityConfig;
|
import com.stardust.autojs.runtime.accessibility.AccessibilityConfig;
|
||||||
|
import com.stardust.theme.ThemeColorManager;
|
||||||
|
|
||||||
import org.autojs.autojs.autojs.key.GlobalKeyObserver;
|
import org.autojs.autojs.autojs.key.GlobalKeyObserver;
|
||||||
|
import org.autojs.autojs.theme.ThemeColorManagerCompat;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -55,6 +57,10 @@ public class Pref {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isNightModeEnabled() {
|
||||||
|
return def().getBoolean(getString(R.string.key_night_mode), false);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isFirstGoToAccessibilitySetting() {
|
public static boolean isFirstGoToAccessibilitySetting() {
|
||||||
return getDisposableBoolean("isFirstGoToAccessibilitySetting", true);
|
return getDisposableBoolean("isFirstGoToAccessibilitySetting", true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
package org.autojs.autojs.theme;
|
package org.autojs.autojs.theme;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
|
|
||||||
import com.stardust.app.GlobalAppContext;
|
import com.stardust.app.GlobalAppContext;
|
||||||
|
|
||||||
import org.autojs.autojs.*;
|
import org.autojs.autojs.*;
|
||||||
import org.autojs.autojs.R;
|
import org.autojs.autojs.R;
|
||||||
|
|
||||||
|
import com.stardust.theme.ThemeColor;
|
||||||
import com.stardust.theme.ThemeColorManager;
|
import com.stardust.theme.ThemeColorManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +20,14 @@ import com.stardust.theme.ThemeColorManager;
|
|||||||
|
|
||||||
public class ThemeColorManagerCompat {
|
public class ThemeColorManagerCompat {
|
||||||
|
|
||||||
|
private static SharedPreferences sSharedPreferences;
|
||||||
|
private static Context sContext;
|
||||||
|
private static SharedPreferences.OnSharedPreferenceChangeListener sPreferenceChangeListener = (sharedPreferences, key) -> {
|
||||||
|
if (key.equals(sContext.getString(R.string.key_night_mode))) {
|
||||||
|
setNightModeEnabled(sharedPreferences.getBoolean(key, false));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static int getColorPrimary() {
|
public static int getColorPrimary() {
|
||||||
int color = ThemeColorManager.getColorPrimary();
|
int color = ThemeColorManager.getColorPrimary();
|
||||||
if (color == 0) {
|
if (color == 0) {
|
||||||
@@ -19,4 +36,29 @@ public class ThemeColorManagerCompat {
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setNightModeEnabled(boolean enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
ThemeColor currentTheme = ThemeColor.fromPreferences(PreferenceManager.getDefaultSharedPreferences(sContext), null);
|
||||||
|
if (currentTheme != null) {
|
||||||
|
currentTheme.saveIn(sSharedPreferences);
|
||||||
|
}
|
||||||
|
ThemeColorManager.setThemeColor(ContextCompat.getColor(sContext, R.color.theme_color_black));
|
||||||
|
} else {
|
||||||
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
ThemeColor previousTheme = ThemeColor.fromPreferences(sSharedPreferences, null);
|
||||||
|
if (previousTheme != null) {
|
||||||
|
ThemeColorManager.setThemeColor(previousTheme.colorPrimary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(Context context, ThemeColor defaultThemeColor) {
|
||||||
|
sContext = context;
|
||||||
|
sSharedPreferences = context.getSharedPreferences("theme_color", Context.MODE_PRIVATE);
|
||||||
|
ThemeColorManager.setDefaultThemeColor(defaultThemeColor);
|
||||||
|
ThemeColorManager.init(context);
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(sPreferenceChangeListener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
package org.autojs.autojs.ui;
|
package org.autojs.autojs.ui;
|
||||||
|
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.CallSuper;
|
import android.support.annotation.CallSuper;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.annotation.RequiresApi;
|
import android.support.annotation.RequiresApi;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.Menu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.SeekBar;
|
|
||||||
|
|
||||||
import org.autojs.autojs.R;
|
|
||||||
import org.autojs.autojs.network.VersionService;
|
|
||||||
|
|
||||||
|
import com.stardust.app.GlobalAppContext;
|
||||||
import com.stardust.theme.ThemeColorManager;
|
import com.stardust.theme.ThemeColorManager;
|
||||||
import com.stardust.util.BackPressedHandler;
|
|
||||||
|
import org.autojs.autojs.Pref;
|
||||||
|
import org.autojs.autojs.R;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -30,14 +34,33 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
|||||||
|
|
||||||
public abstract class BaseActivity extends AppCompatActivity {
|
public abstract class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
protected static final int PERMISSION_REQUEST_CODE = 11186;
|
protected static final int PERMISSION_REQUEST_CODE = 11186;
|
||||||
|
private boolean mShouldApplyDayNightModeForOptionsMenu = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void applyDayNightMode() {
|
||||||
|
GlobalAppContext.post(() -> {
|
||||||
|
if (Pref.isNightModeEnabled()) {
|
||||||
|
setNightModeEnabled(Pref.isNightModeEnabled());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNightModeEnabled(boolean enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
|
} else {
|
||||||
|
getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
|
}
|
||||||
|
if (getDelegate().applyDayNight()) {
|
||||||
|
recreate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
@@ -85,7 +108,7 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setToolbarAsBack(final AppCompatActivity activity, int id, String title) {
|
public static void setToolbarAsBack(final AppCompatActivity activity, int id, String title) {
|
||||||
Toolbar toolbar = (Toolbar) activity.findViewById(id);
|
Toolbar toolbar = activity.findViewById(id);
|
||||||
toolbar.setTitle(title);
|
toolbar.setTitle(title);
|
||||||
activity.setSupportActionBar(toolbar);
|
activity.setSupportActionBar(toolbar);
|
||||||
if (activity.getSupportActionBar() != null) {
|
if (activity.getSupportActionBar() != null) {
|
||||||
@@ -100,4 +123,24 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
if (mShouldApplyDayNightModeForOptionsMenu && Pref.isNightModeEnabled()) {
|
||||||
|
for (int i = 0; i < menu.size(); i++) {
|
||||||
|
Drawable drawable = menu.getItem(i).getIcon();
|
||||||
|
if (drawable != null) {
|
||||||
|
drawable.mutate();
|
||||||
|
drawable.setColorFilter(ContextCompat.getColor(this, R.color.toolbar), PorterDuff.Mode.SRC_ATOP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mShouldApplyDayNightModeForOptionsMenu = false;
|
||||||
|
}
|
||||||
|
return super.onPrepareOptionsMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import org.autojs.autojs.R;
|
|||||||
import org.autojs.autojs.model.indices.AndroidClassIndices;
|
import org.autojs.autojs.model.indices.AndroidClassIndices;
|
||||||
import org.autojs.autojs.model.indices.ClassSearchingItem;
|
import org.autojs.autojs.model.indices.ClassSearchingItem;
|
||||||
import org.autojs.autojs.theme.dialog.ThemeColorMaterialDialogBuilder;
|
import org.autojs.autojs.theme.dialog.ThemeColorMaterialDialogBuilder;
|
||||||
import org.autojs.autojs.tool.MaterialDialogFactory;
|
|
||||||
import org.autojs.autojs.ui.widget.AutoAdapter;
|
import org.autojs.autojs.ui.widget.AutoAdapter;
|
||||||
import org.autojs.autojs.ui.widget.BindableViewHolder;
|
import org.autojs.autojs.ui.widget.BindableViewHolder;
|
||||||
import org.autojs.autojs.ui.widget.SimpleTextWatcher;
|
import org.autojs.autojs.ui.widget.SimpleTextWatcher;
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ public class EditorView extends FrameLayout implements CodeCompletionBar.OnHintC
|
|||||||
|
|
||||||
@AfterViews
|
@AfterViews
|
||||||
void init() {
|
void init() {
|
||||||
setTheme(Theme.getDefault(getContext()));
|
//setTheme(Theme.getDefault(getContext()));
|
||||||
setUpEditor();
|
setUpEditor();
|
||||||
setUpInputMethodEnhancedBar();
|
setUpInputMethodEnhancedBar();
|
||||||
setUpFunctionsKeyboard();
|
setUpFunctionsKeyboard();
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ public class CodeEditor extends HVScrollView {
|
|||||||
mCodeEditText.addTextChangedListener(new AutoIndent(mCodeEditText));
|
mCodeEditText.addTextChangedListener(new AutoIndent(mCodeEditText));
|
||||||
mTextViewRedoUndo = new TextViewUndoRedo(mCodeEditText);
|
mTextViewRedoUndo = new TextViewUndoRedo(mCodeEditText);
|
||||||
mJavaScriptHighlighter = new JavaScriptHighlighter(mTheme, mCodeEditText);
|
mJavaScriptHighlighter = new JavaScriptHighlighter(mTheme, mCodeEditText);
|
||||||
setTheme(Theme.getDefault(getContext()));
|
|
||||||
mJsBeautifier = new JsBeautifier(this, "js/js-beautify");
|
mJsBeautifier = new JsBeautifier(this, "js/js-beautify");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.Single;
|
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import io.reactivex.subjects.PublishSubject;
|
import io.reactivex.subjects.PublishSubject;
|
||||||
|
|
||||||
@@ -25,6 +24,7 @@ public class Themes {
|
|||||||
|
|
||||||
private static final String ASSETS_THEMES_PATH = "editor/theme";
|
private static final String ASSETS_THEMES_PATH = "editor/theme";
|
||||||
private static final String DEFAULT_THEME = "Quiet Light";
|
private static final String DEFAULT_THEME = "Quiet Light";
|
||||||
|
private static final String DARK_THEME = "Dark (Visual Studio)";
|
||||||
|
|
||||||
private static List<Theme> sThemes;
|
private static List<Theme> sThemes;
|
||||||
private static Theme sDefaultTheme;
|
private static Theme sDefaultTheme;
|
||||||
@@ -80,7 +80,7 @@ public class Themes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Observable<Theme> getCurrent(Context context) {
|
public static Observable<Theme> getCurrent(Context context) {
|
||||||
String currentTheme = Pref.getCurrentTheme();
|
String currentTheme = Pref.isNightModeEnabled() ? DARK_THEME : Pref.getCurrentTheme();
|
||||||
if (currentTheme == null)
|
if (currentTheme == null)
|
||||||
return getDefault(context);
|
return getDefault(context);
|
||||||
return getAllThemes(context)
|
return getAllThemes(context)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import com.heinrichreimersoftware.androidissuereporter.model.github.GithubTarget
|
|||||||
import com.heinrichreimersoftware.androidissuereporter.util.ColorUtils;
|
import com.heinrichreimersoftware.androidissuereporter.util.ColorUtils;
|
||||||
import com.heinrichreimersoftware.androidissuereporter.util.ThemeUtils;
|
import com.heinrichreimersoftware.androidissuereporter.util.ThemeUtils;
|
||||||
|
|
||||||
|
import org.autojs.autojs.ui.BaseActivity;
|
||||||
import org.eclipse.egit.github.core.Issue;
|
import org.eclipse.egit.github.core.Issue;
|
||||||
import org.eclipse.egit.github.core.client.GitHubClient;
|
import org.eclipse.egit.github.core.client.GitHubClient;
|
||||||
import org.eclipse.egit.github.core.client.RequestException;
|
import org.eclipse.egit.github.core.client.RequestException;
|
||||||
@@ -64,7 +65,7 @@ import com.stardust.theme.ThemeColorManager;
|
|||||||
* Created by Stardust on 2017/4/3.
|
* Created by Stardust on 2017/4/3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public abstract class AbstractIssueReporterActivity extends AppCompatActivity {
|
public abstract class AbstractIssueReporterActivity extends BaseActivity {
|
||||||
|
|
||||||
private static final String TAG = AbstractIssueReporterActivity.class.getSimpleName();
|
private static final String TAG = AbstractIssueReporterActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
|||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.GridLayoutManager;
|
import android.support.v7.widget.GridLayoutManager;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
@@ -207,6 +208,7 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
Log.d(LOG_TAG, "item bg = " + Integer.toHexString(ContextCompat.getColor(getContext(), R.color.item_background)));
|
||||||
setOnRefreshListener(this);
|
setOnRefreshListener(this);
|
||||||
inflate(getContext(), R.layout.explorer_view, this);
|
inflate(getContext(), R.layout.explorer_view, this);
|
||||||
mExplorerItemListView = findViewById(R.id.explorer_item_list);
|
mExplorerItemListView = findViewById(R.id.explorer_item_list);
|
||||||
@@ -437,7 +439,7 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BindableViewHolder<?> onCreateViewHolder(ViewGroup parent, int viewType) {
|
public BindableViewHolder<?> onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||||
return ExplorerView.this.onCreateViewHolder(inflater, parent, viewType);
|
return ExplorerView.this.onCreateViewHolder(inflater, parent, viewType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.view.ContextThemeWrapper;
|
|||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog;
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
import com.afollestad.materialdialogs.Theme;
|
import com.afollestad.materialdialogs.Theme;
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
package org.autojs.autojs.ui.floating.layoutinspector;
|
package org.autojs.autojs.ui.floating.layoutinspector;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog;
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
import com.afollestad.materialdialogs.Theme;
|
import com.afollestad.materialdialogs.Theme;
|
||||||
import com.stardust.app.DialogUtils;
|
import com.stardust.app.DialogUtils;
|
||||||
import com.stardust.app.GlobalAppContext;
|
|
||||||
import com.stardust.enhancedfloaty.FloatyService;
|
import com.stardust.enhancedfloaty.FloatyService;
|
||||||
import org.autojs.autojs.R;
|
import org.autojs.autojs.R;
|
||||||
import org.autojs.autojs.ui.codegeneration.CodeGenerateDialog;
|
import org.autojs.autojs.ui.codegeneration.CodeGenerateDialog;
|
||||||
import org.autojs.autojs.ui.floating.FloatyWindowManger;
|
import org.autojs.autojs.ui.floating.FloatyWindowManger;
|
||||||
import org.autojs.autojs.ui.floating.FullScreenFloatyWindow;
|
import org.autojs.autojs.ui.floating.FullScreenFloatyWindow;
|
||||||
|
|
||||||
import com.stardust.view.accessibility.LayoutInspector;
|
|
||||||
import com.stardust.view.accessibility.NodeInfo;
|
import com.stardust.view.accessibility.NodeInfo;
|
||||||
import org.autojs.autojs.ui.widget.BubblePopupMenu;
|
import org.autojs.autojs.ui.widget.BubblePopupMenu;
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
package org.autojs.autojs.ui.log;
|
package org.autojs.autojs.ui.log;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.Snackbar;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.stardust.autojs.core.console.ConsoleView;
|
import com.stardust.autojs.core.console.ConsoleView;
|
||||||
import com.stardust.autojs.core.console.StardustConsole;
|
import com.stardust.autojs.core.console.StardustConsole;
|
||||||
import org.autojs.autojs.R;
|
|
||||||
import org.autojs.autojs.autojs.AutoJs;
|
|
||||||
import org.autojs.autojs.ui.BaseActivity;
|
|
||||||
|
|
||||||
import org.androidannotations.annotations.AfterViews;
|
import org.androidannotations.annotations.AfterViews;
|
||||||
import org.androidannotations.annotations.Click;
|
import org.androidannotations.annotations.Click;
|
||||||
import org.androidannotations.annotations.EActivity;
|
import org.androidannotations.annotations.EActivity;
|
||||||
import org.androidannotations.annotations.ViewById;
|
import org.androidannotations.annotations.ViewById;
|
||||||
|
import org.autojs.autojs.R;
|
||||||
|
import org.autojs.autojs.autojs.AutoJs;
|
||||||
|
import org.autojs.autojs.ui.BaseActivity;
|
||||||
|
|
||||||
@EActivity(R.layout.activity_log)
|
@EActivity(R.layout.activity_log)
|
||||||
public class LogActivity extends BaseActivity {
|
public class LogActivity extends BaseActivity {
|
||||||
@@ -26,10 +23,16 @@ public class LogActivity extends BaseActivity {
|
|||||||
|
|
||||||
private StardustConsole mStardustConsole;
|
private StardustConsole mStardustConsole;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
applyDayNightMode();
|
||||||
|
}
|
||||||
|
|
||||||
@AfterViews
|
@AfterViews
|
||||||
void setupViews() {
|
void setupViews() {
|
||||||
setToolbarAsBack(getString(R.string.text_log));
|
setToolbarAsBack(getString(R.string.text_log));
|
||||||
mStardustConsole = (StardustConsole) AutoJs.getInstance().getGlobalConsole();
|
mStardustConsole = AutoJs.getInstance().getGlobalConsole();
|
||||||
mConsoleView.setConsole(mStardustConsole);
|
mConsoleView.setConsole(mStardustConsole);
|
||||||
mConsoleView.findViewById(R.id.input_container).setVisibility(View.GONE);
|
mConsoleView.findViewById(R.id.input_container).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ public class MainActivity extends BaseActivity implements OnActivityResultDelega
|
|||||||
mVersionGuard = new VersionGuard(this);
|
mVersionGuard = new VersionGuard(this);
|
||||||
showAnnunciationIfNeeded();
|
showAnnunciationIfNeeded();
|
||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
|
applyDayNightMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterViews
|
@AfterViews
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.autojs.autojs.external.foreground.ForegroundService;
|
|||||||
import org.autojs.autojs.network.GlideApp;
|
import org.autojs.autojs.network.GlideApp;
|
||||||
import org.autojs.autojs.network.UserService;
|
import org.autojs.autojs.network.UserService;
|
||||||
import org.autojs.autojs.tool.Observers;
|
import org.autojs.autojs.tool.Observers;
|
||||||
|
import org.autojs.autojs.ui.BaseActivity;
|
||||||
import org.autojs.autojs.ui.common.NotAskAgainDialog;
|
import org.autojs.autojs.ui.common.NotAskAgainDialog;
|
||||||
import org.autojs.autojs.ui.floating.CircularMenu;
|
import org.autojs.autojs.ui.floating.CircularMenu;
|
||||||
import org.autojs.autojs.ui.floating.FloatyWindowManger;
|
import org.autojs.autojs.ui.floating.FloatyWindowManger;
|
||||||
@@ -146,7 +147,7 @@ public class DrawerFragment extends android.support.v4.app.Fragment {
|
|||||||
setChecked(mFloatingWindowItem, true);
|
setChecked(mFloatingWindowItem, true);
|
||||||
}
|
}
|
||||||
setChecked(mConnectionItem, DevPluginService.getInstance().isConnected());
|
setChecked(mConnectionItem, DevPluginService.getInstance().isConnected());
|
||||||
if(Pref.isForegroundServiceEnabled()){
|
if (Pref.isForegroundServiceEnabled()) {
|
||||||
ForegroundService.start(GlobalAppContext.get());
|
ForegroundService.start(GlobalAppContext.get());
|
||||||
setChecked(mForegroundServiceItem, true);
|
setChecked(mForegroundServiceItem, true);
|
||||||
}
|
}
|
||||||
@@ -167,6 +168,7 @@ public class DrawerFragment extends android.support.v4.app.Fragment {
|
|||||||
new DrawerMenuGroup(R.string.text_others),
|
new DrawerMenuGroup(R.string.text_others),
|
||||||
mConnectionItem,
|
mConnectionItem,
|
||||||
new DrawerMenuItem(R.drawable.ic_personalize, R.string.text_theme_color, this::openThemeColorSettings),
|
new DrawerMenuItem(R.drawable.ic_personalize, R.string.text_theme_color, this::openThemeColorSettings),
|
||||||
|
new DrawerMenuItem(R.drawable.ic_night_mode, R.string.text_night_mode, R.string.key_night_mode, this::toggleNightMode),
|
||||||
mCheckForUpdatesItem
|
mCheckForUpdatesItem
|
||||||
)));
|
)));
|
||||||
mDrawerMenu.setAdapter(mDrawerMenuAdapter);
|
mDrawerMenu.setAdapter(mDrawerMenuAdapter);
|
||||||
@@ -239,6 +241,10 @@ public class DrawerFragment extends android.support.v4.app.Fragment {
|
|||||||
SettingsActivity.selectThemeColor(getActivity());
|
SettingsActivity.selectThemeColor(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toggleNightMode(DrawerMenuItemViewHolder holder) {
|
||||||
|
((BaseActivity) getActivity()).setNightModeEnabled(holder.getSwitchCompat().isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
private void enableAccessibilityServiceByRootIfNeeded() {
|
private void enableAccessibilityServiceByRootIfNeeded() {
|
||||||
Observable.fromCallable(() -> Pref.shouldEnableAccessibilityServiceByRoot() && !isAccessibilityServiceEnabled())
|
Observable.fromCallable(() -> Pref.shouldEnableAccessibilityServiceByRoot() && !isAccessibilityServiceEnabled())
|
||||||
@@ -264,9 +270,9 @@ public class DrawerFragment extends android.support.v4.app.Fragment {
|
|||||||
|
|
||||||
private void toggleForegroundService(DrawerMenuItemViewHolder holder) {
|
private void toggleForegroundService(DrawerMenuItemViewHolder holder) {
|
||||||
boolean checked = holder.getSwitchCompat().isChecked();
|
boolean checked = holder.getSwitchCompat().isChecked();
|
||||||
if(checked){
|
if (checked) {
|
||||||
ForegroundService.start(GlobalAppContext.get());
|
ForegroundService.start(GlobalAppContext.get());
|
||||||
}else {
|
} else {
|
||||||
ForegroundService.stop(GlobalAppContext.get());
|
ForegroundService.stop(GlobalAppContext.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.widget.ThemeColorRecyclerView;
|
import android.support.v7.widget.ThemeColorRecyclerView;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -62,7 +63,7 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView {
|
|||||||
private ScriptExecutionListener mScriptExecutionListener = new SimpleScriptExecutionListener() {
|
private ScriptExecutionListener mScriptExecutionListener = new SimpleScriptExecutionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onStart(final ScriptExecution execution) {
|
public void onStart(final ScriptExecution execution) {
|
||||||
post(()-> mAdapter.notifyChildInserted(0, mRunningTaskGroup.addTask(execution)));
|
post(() -> mAdapter.notifyChildInserted(0, mRunningTaskGroup.addTask(execution)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -75,8 +76,8 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView {
|
|||||||
onFinish(execution);
|
onFinish(execution);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFinish(ScriptExecution execution){
|
private void onFinish(ScriptExecution execution) {
|
||||||
post(()->{
|
post(() -> {
|
||||||
final int i = mRunningTaskGroup.removeTask(execution);
|
final int i = mRunningTaskGroup.removeTask(execution);
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
mAdapter.notifyChildRemoved(0, i);
|
mAdapter.notifyChildRemoved(0, i);
|
||||||
@@ -105,7 +106,7 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView {
|
|||||||
private void init() {
|
private void init() {
|
||||||
setLayoutManager(new WrapContentLinearLayoutManager(getContext()));
|
setLayoutManager(new WrapContentLinearLayoutManager(getContext()));
|
||||||
addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext())
|
addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext())
|
||||||
.color(0xffEDEEEF)
|
.color(ContextCompat.getColor(getContext(), R.color.divider))
|
||||||
.size(2)
|
.size(2)
|
||||||
.marginResId(R.dimen.script_and_folder_list_divider_left_margin, R.dimen.script_and_folder_list_divider_right_margin)
|
.marginResId(R.dimen.script_and_folder_list_divider_left_margin, R.dimen.script_and_folder_list_divider_right_margin)
|
||||||
.showLastDivider()
|
.showLastDivider()
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package org.autojs.autojs.ui.splash;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ public class SplashActivity extends BaseActivity {
|
|||||||
public static final String FORCE_SHOW_AD = "forceShowAd";
|
public static final String FORCE_SHOW_AD = "forceShowAd";
|
||||||
|
|
||||||
private static final String LOG_TAG = SplashActivity.class.getSimpleName();
|
private static final String LOG_TAG = SplashActivity.class.getSimpleName();
|
||||||
private static final long INIT_TIMEOUT = 1000;
|
private static final long INIT_TIMEOUT = 500;
|
||||||
|
|
||||||
|
|
||||||
private boolean mCanEnterNextActivity = false;
|
private boolean mCanEnterNextActivity = false;
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ public class EWebView extends FrameLayout implements SwipeRefreshLayout.OnRefres
|
|||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
inflate(getContext(), R.layout.ewebview, this);
|
inflate(getContext(), R.layout.ewebview, this);
|
||||||
mWebView = (WebView) findViewById(R.id.web_view);
|
mWebView = findViewById(R.id.web_view);
|
||||||
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
|
mSwipeRefreshLayout = findViewById(R.id.swipe_refresh_layout);
|
||||||
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
|
mProgressBar = findViewById(R.id.progress_bar);
|
||||||
mSwipeRefreshLayout.setOnRefreshListener(this);
|
mSwipeRefreshLayout.setOnRefreshListener(this);
|
||||||
setUpWebView();
|
setUpWebView();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,18 @@ import android.content.res.TypedArray;
|
|||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import com.stardust.theme.ThemeColor;
|
||||||
|
import com.stardust.theme.ThemeColorHelper;
|
||||||
|
import com.stardust.theme.ThemeColorManager;
|
||||||
|
import com.stardust.theme.ThemeColorMutable;
|
||||||
|
|
||||||
import org.autojs.autojs.R;
|
import org.autojs.autojs.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on 2017/8/6.
|
* Created by Stardust on 2017/8/6.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PrefSwitch extends SwitchCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class PrefSwitch extends SwitchCompat implements SharedPreferences.OnSharedPreferenceChangeListener, ThemeColorMutable {
|
||||||
|
|
||||||
private String mPrefKey;
|
private String mPrefKey;
|
||||||
private SharedPreferences mSharedPreferences;
|
private SharedPreferences mSharedPreferences;
|
||||||
@@ -47,6 +52,11 @@ public class PrefSwitch extends SwitchCompat implements SharedPreferences.OnShar
|
|||||||
setChecked(mDefaultChecked, false);
|
setChecked(mDefaultChecked, false);
|
||||||
}
|
}
|
||||||
a.recycle();
|
a.recycle();
|
||||||
|
ThemeColorManager.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThemeColor(ThemeColor color) {
|
||||||
|
ThemeColorHelper.setColorPrimary(this, color.colorPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readInitialState() {
|
private void readInitialState() {
|
||||||
@@ -99,6 +109,7 @@ public class PrefSwitch extends SwitchCompat implements SharedPreferences.OnShar
|
|||||||
if (visibility == VISIBLE) {
|
if (visibility == VISIBLE) {
|
||||||
readInitialState();
|
readInitialState();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,11 @@ public class SwitchCompat extends android.support.v7.widget.SwitchCompat {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnCheckedChangeListener(final OnCheckedChangeListener listener) {
|
public void setOnCheckedChangeListener(final OnCheckedChangeListener listener) {
|
||||||
super.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
super.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
@Override
|
if (mIgnoreCheckedChange) {
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
return;
|
||||||
if (mIgnoreCheckedChange) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
listener.onCheckedChanged(buttonView, isChecked);
|
|
||||||
}
|
}
|
||||||
|
listener.onCheckedChanged(buttonView, isChecked);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.graphics.Color;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@@ -20,24 +21,31 @@ import org.autojs.autojs.R;
|
|||||||
|
|
||||||
public class ToolbarMenuItem extends LinearLayout {
|
public class ToolbarMenuItem extends LinearLayout {
|
||||||
|
|
||||||
private static final int COLOR_DISABLED = 0X77e0e0e0;
|
private final int mColorDisabled;
|
||||||
|
private final int mColorEnabled;
|
||||||
private ImageView mImageView;
|
private ImageView mImageView;
|
||||||
private TextView mTextView;
|
private TextView mTextView;
|
||||||
private Drawable mEnabledDrawable, mDisabledDrawable;
|
private Drawable mEnabledDrawable, mDisabledDrawable;
|
||||||
|
|
||||||
public ToolbarMenuItem(Context context, AttributeSet attrs) {
|
public ToolbarMenuItem(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
mColorDisabled = ContextCompat.getColor(context, R.color.toolbar_disabled);
|
||||||
|
mColorEnabled = ContextCompat.getColor(context, R.color.toolbar);
|
||||||
init(attrs);
|
init(attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToolbarMenuItem(Context context, AttributeSet attrs, int defStyleAttr) {
|
public ToolbarMenuItem(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
|
mColorDisabled = ContextCompat.getColor(context, R.color.toolbar_disabled);
|
||||||
|
mColorEnabled = ContextCompat.getColor(context, R.color.toolbar);
|
||||||
init(attrs);
|
init(attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
public ToolbarMenuItem(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public ToolbarMenuItem(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
mColorDisabled = ContextCompat.getColor(context, R.color.toolbar_disabled);
|
||||||
|
mColorEnabled = ContextCompat.getColor(context, R.color.toolbar);
|
||||||
init(attrs);
|
init(attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,12 +56,13 @@ public class ToolbarMenuItem extends LinearLayout {
|
|||||||
int iconResId = a.getResourceId(R.styleable.ToolbarMenuItem_icon, 0);
|
int iconResId = a.getResourceId(R.styleable.ToolbarMenuItem_icon, 0);
|
||||||
int iconColor = a.getColor(R.styleable.ToolbarMenuItem_icon_color, Color.TRANSPARENT);
|
int iconColor = a.getColor(R.styleable.ToolbarMenuItem_icon_color, Color.TRANSPARENT);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
mImageView = (ImageView) findViewById(R.id.icon);
|
mImageView = findViewById(R.id.icon);
|
||||||
mTextView = (TextView) findViewById(R.id.text);
|
mTextView = findViewById(R.id.text);
|
||||||
mTextView.setText(text);
|
mTextView.setText(text);
|
||||||
|
mTextView.setTextColor(mColorEnabled);
|
||||||
mImageView.setImageResource(iconResId);
|
mImageView.setImageResource(iconResId);
|
||||||
if (iconColor != Color.TRANSPARENT) {
|
if (iconColor != Color.TRANSPARENT) {
|
||||||
mImageView.setImageDrawable(convertDrawableToGrayScale(mImageView.getDrawable(), iconColor));
|
mImageView.setImageDrawable(tintDrawable(mImageView.getDrawable(), iconColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,12 +74,12 @@ public class ToolbarMenuItem extends LinearLayout {
|
|||||||
ensureEnabledDrawable();
|
ensureEnabledDrawable();
|
||||||
ensureDisabledDrawable();
|
ensureDisabledDrawable();
|
||||||
mImageView.setImageDrawable(enabled ? mEnabledDrawable : mDisabledDrawable);
|
mImageView.setImageDrawable(enabled ? mEnabledDrawable : mDisabledDrawable);
|
||||||
mTextView.setTextColor(enabled ? Color.WHITE : COLOR_DISABLED);
|
mTextView.setTextColor(enabled ? mColorEnabled : mColorDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureDisabledDrawable() {
|
private void ensureDisabledDrawable() {
|
||||||
if (mDisabledDrawable == null) {
|
if (mDisabledDrawable == null) {
|
||||||
mDisabledDrawable = convertDrawableToGrayScale(mEnabledDrawable, COLOR_DISABLED);
|
mDisabledDrawable = tintDrawable(mEnabledDrawable, mColorDisabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +89,7 @@ public class ToolbarMenuItem extends LinearLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable convertDrawableToGrayScale(Drawable drawable, int color) {
|
public static Drawable tintDrawable(Drawable drawable, int color) {
|
||||||
if (drawable == null || drawable.getConstantState() == null)
|
if (drawable == null || drawable.getConstantState() == null)
|
||||||
return null;
|
return null;
|
||||||
Drawable res = drawable.getConstantState().newDrawable().mutate();
|
Drawable res = drawable.getConstantState().newDrawable().mutate();
|
||||||
|
|||||||
BIN
app/src/main/res/drawable-xhdpi/ic_night_mode.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_night_mode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
@@ -23,6 +23,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
app:title="@string/text_about"/>
|
app:title="@string/text_about"/>
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
@@ -37,7 +38,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="6dp"
|
android:layout_marginLeft="6dp"
|
||||||
android:layout_marginRight="6dp"
|
android:layout_marginRight="6dp"
|
||||||
app:cardBackgroundColor="@android:color/white"
|
|
||||||
app:cardCornerRadius="2dp"
|
app:cardCornerRadius="2dp"
|
||||||
app:cardElevation="1dp"
|
app:cardElevation="1dp"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<com.stardust.theme.widget.ThemeColorFloatingActionButton
|
||||||
android:id="@+id/fab"
|
android:id="@+id/fab"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:title="@string/text_login"
|
android:title="@string/text_login"
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/text_username"
|
android:hint="@string/text_username"
|
||||||
android:textColor="#dd000000"/>
|
android:textColor="?android:textColorPrimary"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/text_password"
|
android:hint="@string/text_password"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:textColor="#dd000000"/>
|
android:textColor="?android:textColorPrimary"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:title="@string/_app_name"
|
android:title="@string/_app_name"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||||
@@ -34,8 +35,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabIndicatorColor="@android:color/white"
|
app:tabIndicatorColor="@color/tab_indicator"
|
||||||
app:tabMode="scrollable"/>
|
app:tabMode="scrollable"
|
||||||
|
app:tabSelectedTextColor="@color/tab_indicator"
|
||||||
|
app:tabTextColor="@color/tab_text"/>
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<android.support.v4.view.ViewPager
|
<android.support.v4.view.ViewPager
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
@@ -167,7 +168,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="6dp"
|
android:layout_marginLeft="6dp"
|
||||||
android:layout_marginRight="6dp"
|
android:layout_marginRight="6dp"
|
||||||
app:cardBackgroundColor="@android:color/white"
|
|
||||||
app:cardCornerRadius="2dp"
|
app:cardCornerRadius="2dp"
|
||||||
app:cardElevation="1dp"
|
app:cardElevation="1dp"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:title="@string/text_login"
|
android:title="@string/text_login"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/text_email"
|
android:hint="@string/text_email"
|
||||||
android:inputType="textEmailAddress"
|
android:inputType="textEmailAddress"
|
||||||
android:textColor="#dd000000"/>
|
android:textColor="?android:textColorPrimary"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/text_username"
|
android:hint="@string/text_username"
|
||||||
android:textColor="#dd000000"/>
|
android:textColor="?android:textColorPrimary"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/text_password"
|
android:hint="@string/text_password"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:textColor="#dd000000"/>
|
android:textColor="?android:textColorPrimary"/>
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/white"
|
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
@@ -15,6 +14,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:title="@string/_app_name"
|
android:title="@string/_app_name"
|
||||||
app:layout_scrollFlags="scroll|enterAlways"
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
app:popupTheme="@style/AppTheme.PopupOverlay"/>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:title="@string/_app_name"
|
android:title="@string/_app_name"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
<com.stardust.theme.widget.ThemeColorToolbar
|
<com.stardust.theme.widget.ThemeColorToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:title="@string/text_login"
|
android:title="@string/text_login"
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#f0f1f5"
|
android:background="?android:divider"
|
||||||
android:paddingTop="@dimen/divider_drawer_menu_group">
|
android:paddingTop="@dimen/divider_drawer_menu_group">
|
||||||
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="#ffffff"
|
android:background="?android:windowBackground"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:textColor="#999999"
|
android:textColor="?drawer_group_text_color"
|
||||||
android:textSize="12sp">
|
android:textSize="12sp">
|
||||||
|
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_toRightOf="@+id/icon_container"
|
android:layout_toRightOf="@+id/icon_container"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:textColor="#484C4F"
|
android:textColor="?drawer_item_text_color"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:text="@string/text_auto_operate_service"/>
|
tools:text="@string/text_auto_operate_service"/>
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:theme="@style/ToolBarStyle"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
android:title="@string/_app_name"
|
android:title="@string/_app_name"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="304dp"
|
android:layout_width="304dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/white"
|
android:background="?android:windowBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:fitsSystemWindows="false"
|
android:fitsSystemWindows="false"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
@@ -73,7 +72,7 @@
|
|||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="#f2f3f5"/>
|
android:background="?android:divider"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -104,6 +103,7 @@
|
|||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/text_setting"
|
android:text="@string/text_setting"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="15sp"/>
|
android:textSize="15sp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -128,6 +128,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/text_exit"
|
android:text="@string/text_exit"
|
||||||
android:textSize="15sp"/>
|
android:textSize="15sp"/>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:icon="@drawable/ic_play_arrow_white_48dp"
|
app:icon="@drawable/ic_play_arrow_white_48dp"
|
||||||
app:icon_color="@android:color/white"
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_run"/>
|
app:text="@string/text_run"/>
|
||||||
|
|
||||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:icon="@drawable/ic_undo_white_48dp"
|
app:icon="@drawable/ic_undo_white_48dp"
|
||||||
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_undo"/>
|
app:text="@string/text_undo"/>
|
||||||
|
|
||||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||||
@@ -26,6 +27,7 @@
|
|||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:icon="@drawable/ic_redo_white_48dp"
|
app:icon="@drawable/ic_redo_white_48dp"
|
||||||
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_redo"/>
|
app:text="@string/text_redo"/>
|
||||||
|
|
||||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||||
@@ -34,6 +36,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
app:icon="@drawable/ic_save_white_48dp"
|
app:icon="@drawable/ic_save_white_48dp"
|
||||||
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_save"/>
|
app:text="@string/text_save"/>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:icon="@drawable/ic_ali_replace"
|
app:icon="@drawable/ic_ali_replace"
|
||||||
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_replace"/>
|
app:text="@string/text_replace"/>
|
||||||
|
|
||||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:icon="@drawable/ic_ali_up"
|
app:icon="@drawable/ic_ali_up"
|
||||||
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_find_prev"/>
|
app:text="@string/text_find_prev"/>
|
||||||
|
|
||||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||||
@@ -25,6 +27,7 @@
|
|||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:icon="@drawable/ic_ali_down"
|
app:icon="@drawable/ic_ali_down"
|
||||||
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_find_next"/>
|
app:text="@string/text_find_next"/>
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +36,7 @@
|
|||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:icon="@drawable/ic_close_white_48dp"
|
app:icon="@drawable/ic_close_white_48dp"
|
||||||
|
app:icon_color="@color/toolbar"
|
||||||
app:text="@string/text_cancel"/>
|
app:text="@string/text_cancel"/>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="@android:color/white">
|
|
||||||
|
|
||||||
|
|
||||||
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout
|
<org.autojs.autojs.theme.widget.ThemeColorSwipeRefreshLayout
|
||||||
|
|||||||
@@ -8,8 +8,9 @@
|
|||||||
android:layout_marginLeft="3dp"
|
android:layout_marginLeft="3dp"
|
||||||
android:layout_marginRight="3dp"
|
android:layout_marginRight="3dp"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
android:foreground="?selectableItemBackground"
|
android:foreground="?selectableItemBackground"
|
||||||
app:cardBackgroundColor="#ffffff"
|
app:cardBackgroundColor="?android:itemBackground"
|
||||||
app:cardElevation="0.618dp"
|
app:cardElevation="0.618dp"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
@@ -17,8 +18,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingBottom="16dp"
|
android:paddingTop="16dp"
|
||||||
android:paddingTop="16dp">
|
android:paddingBottom="16dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:textColor="#484C4F"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:text="正在运行的服务"/>
|
tools:text="正在运行的服务"/>
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@
|
|||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:src="@drawable/ic_more_vert_black_24dp"
|
android:src="@drawable/ic_more_vert_black_24dp"
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
android:background="#EDEEEF"/>
|
android:background="?android:divider"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/item"
|
android:id="@+id/item"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@android:color/white"
|
android:background="@color/item_background_dark"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:foreground="?selectableItemBackground"
|
android:foreground="?selectableItemBackground"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="#484C4F"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:text="正在运行的服务"/>
|
tools:text="正在运行的服务"/>
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textColor="#9DA0A2"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="11sp"
|
android:textSize="11sp"
|
||||||
tools:text="18 KB"/>
|
tools:text="18 KB"/>
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1px"
|
android:layout_height="1px"
|
||||||
android:background="#EDEEEF"/>
|
android:background="?android:divider"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
16
app/src/main/res/values-night/colors.xml
Normal file
16
app/src/main/res/values-night/colors.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="window_background">#202020</color>
|
||||||
|
<color name="item_background">#333333</color>
|
||||||
|
<color name="item_background_dark">#252525</color>
|
||||||
|
<color name="text_color_primary">#7F7F80</color>
|
||||||
|
<color name="drawer_menu_item_text_color">#9a9a9a</color>
|
||||||
|
<color name="drawer_menu_group_text_color">#808080</color>
|
||||||
|
<color name="divider">#111214</color>
|
||||||
|
<color name="text_color_secondary">#9a9a9a</color>
|
||||||
|
<color name="text_color_thirdly">#808080</color>
|
||||||
|
<color name="tab_indicator">#6D6D6E</color>
|
||||||
|
<color name="tab_text">#3A3A3C</color>
|
||||||
|
<color name="toolbar">#8D8D8E</color>
|
||||||
|
<color name="toolbar_disabled">#3A3A3C</color>
|
||||||
|
</resources>
|
||||||
12
app/src/main/res/values-night/styles.xml
Normal file
12
app/src/main/res/values-night/styles.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="ToolBarStyle" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||||
|
<item name="android:textColorPrimary">@color/toolbar</item>
|
||||||
|
<item name="android:textColorSecondary">@color/toolbar</item>
|
||||||
|
<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>
|
||||||
@@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
<attr name="title" format="string|reference"/>
|
<attr name="title" format="string|reference"/>
|
||||||
<attr name="icon" format="reference"/>
|
<attr name="icon" format="reference"/>
|
||||||
|
<attr name="drawer_item_text_color" format="color|reference"/>
|
||||||
|
<attr name="drawer_group_text_color" format="color|reference"/>
|
||||||
|
<attr name="itemBackgroundDark" format="color|reference"/>
|
||||||
|
|
||||||
<declare-styleable name="ToolbarMenuItem">
|
<declare-styleable name="ToolbarMenuItem">
|
||||||
<attr name="text" format="string|reference"/>
|
<attr name="text" format="string|reference"/>
|
||||||
|
|||||||
@@ -12,4 +12,21 @@
|
|||||||
<color name="divider_functions_keyboard">#f0f0f0</color>
|
<color name="divider_functions_keyboard">#f0f0f0</color>
|
||||||
<color name="color_red">#ef5350</color>
|
<color name="color_red">#ef5350</color>
|
||||||
<color name="project_toolbar_color">#777777</color>
|
<color name="project_toolbar_color">#777777</color>
|
||||||
|
<color name="theme_color_black">#111214</color>
|
||||||
|
|
||||||
|
<color name="window_background">#FFFFFF</color>
|
||||||
|
<color name="item_background">#FFFFFF</color>
|
||||||
|
<color name="item_background_dark">#FFFFFF</color>
|
||||||
|
<color name="text_color_primary">@android:color/primary_text_light</color>
|
||||||
|
<color name="text_color_secondary">#484C4F</color>
|
||||||
|
<color name="text_color_thirdly">#9DA0A2</color>
|
||||||
|
<color name="divider">#f2f3f5</color>
|
||||||
|
<color name="drawer_menu_item_text_color">#484C4F</color>
|
||||||
|
<color name="drawer_menu_group_text_color">#999999</color>
|
||||||
|
<color name="tab_indicator">@android:color/white</color>
|
||||||
|
<color name="tab_text">#a0ffffff</color>
|
||||||
|
<color name="toolbar">@android:color/white</color>
|
||||||
|
<color name="toolbar_disabled">#77e0e0e0</color>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -426,4 +426,6 @@
|
|||||||
<string name="error_cannot_rename">重命名失败</string>
|
<string name="error_cannot_rename">重命名失败</string>
|
||||||
<string name="text_project_save_success">项目已经保存到%s</string>
|
<string name="text_project_save_success">项目已经保存到%s</string>
|
||||||
<string name="text_project_save_error">项目保存失败 %s</string>
|
<string name="text_project_save_error">项目保存失败 %s</string>
|
||||||
|
<string name="text_night_mode">夜间模式</string>
|
||||||
|
<string name="key_night_mode">key_night_mode</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,10 +1,24 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
<item name="android:textColorPrimary">@color/text_color_secondary</item>
|
||||||
|
<item name="android:textColorSecondary">@color/text_color_thirdly</item>
|
||||||
|
<item name="android:windowBackground">@color/window_background</item>
|
||||||
|
<item name="android:itemBackground">@color/item_background</item>
|
||||||
|
<item name="itemBackgroundDark">@color/item_background_dark</item>
|
||||||
|
<item name="android:divider">@color/divider</item>
|
||||||
|
<item name="drawer_item_text_color">@color/drawer_menu_item_text_color</item>
|
||||||
|
<item name="drawer_group_text_color">@color/drawer_menu_group_text_color</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="ToolBarStyle" parent="ThemeOverlay.AppCompat.ActionBar">
|
||||||
|
<item name="android:textColorPrimary">@color/toolbar</item>
|
||||||
|
<item name="android:textColorSecondary">@color/toolbar</item>
|
||||||
|
<item name="actionMenuTextColor">@color/toolbar</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="EditorTheme" parent="AppTheme">
|
<style name="EditorTheme" parent="AppTheme">
|
||||||
@@ -13,15 +27,12 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.FullScreen" parent="AppTheme">
|
<style name="AppTheme.FullScreen" parent="AppTheme">
|
||||||
<!-- Customize your theme here. -->
|
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
|
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.Splash" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
|
<style name="AppTheme.Splash" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
|
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -42,7 +53,6 @@
|
|||||||
<item name="android:backgroundDimEnabled">false</item>
|
<item name="android:backgroundDimEnabled">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<style name="IssueReporterTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="IssueReporterTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
@@ -57,5 +67,4 @@
|
|||||||
|
|
||||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -15,20 +15,20 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".execution.ScriptExecuteActivity"
|
android:name=".execution.ScriptExecuteActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:theme="@style/AppTheme"/>
|
android:theme="@style/ScriptTheme"/>
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.stardust.autojs.core.permission.PermissionRequestActivity"
|
android:name="com.stardust.autojs.core.permission.PermissionRequestActivity"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:taskAffinity="com.stardust.autojs.runtime.api.image.ScreenCaptureRequestActivity"
|
android:taskAffinity="com.stardust.autojs.runtime.api.image.ScreenCaptureRequestActivity"
|
||||||
android:theme="@style/AppTheme.Transparent"/>
|
android:theme="@style/ScriptTheme.Transparent"/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.stardust.autojs.core.image.capture.ScreenCaptureRequestActivity"
|
android:name="com.stardust.autojs.core.image.capture.ScreenCaptureRequestActivity"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:taskAffinity="com.stardust.autojs.runtime.api.image.ScreenCaptureRequestActivity"
|
android:taskAffinity="com.stardust.autojs.runtime.api.image.ScreenCaptureRequestActivity"
|
||||||
android:theme="@style/AppTheme.Transparent"/>
|
android:theme="@style/ScriptTheme.Transparent"/>
|
||||||
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module.exports = function (runtime, global) {
|
|||||||
ui.setContentView(view);
|
ui.setContentView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.layoutFile = layout(file){
|
ui.layoutFile = function(file) {
|
||||||
ui.layout(files.read(file));
|
ui.layout(files.read(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class ConsoleView extends FrameLayout implements StardustConsole.LogListe
|
|||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
inflate(getContext(), R.layout.console_view, this);
|
inflate(getContext(), R.layout.console_view, this);
|
||||||
mLogListRecyclerView = (RecyclerView) findViewById(R.id.log_list);
|
mLogListRecyclerView = findViewById(R.id.log_list);
|
||||||
LinearLayoutManager manager = new LinearLayoutManager(getContext());
|
LinearLayoutManager manager = new LinearLayoutManager(getContext());
|
||||||
mLogListRecyclerView.setLayoutManager(manager);
|
mLogListRecyclerView.setLayoutManager(manager);
|
||||||
mLogListRecyclerView.setAdapter(new Adapter());
|
mLogListRecyclerView.setAdapter(new Adapter());
|
||||||
@@ -79,7 +79,7 @@ public class ConsoleView extends FrameLayout implements StardustConsole.LogListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initSubmitButton() {
|
private void initSubmitButton() {
|
||||||
final Button submit = (Button) findViewById(R.id.submit);
|
final Button submit = findViewById(R.id.submit);
|
||||||
submit.setOnClickListener(v -> {
|
submit.setOnClickListener(v -> {
|
||||||
CharSequence input = mEditText.getText();
|
CharSequence input = mEditText.getText();
|
||||||
submitInput(input);
|
submitInput(input);
|
||||||
@@ -96,9 +96,9 @@ public class ConsoleView extends FrameLayout implements StardustConsole.LogListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initEditText() {
|
private void initEditText() {
|
||||||
mEditText = (EditText) findViewById(R.id.input);
|
mEditText = findViewById(R.id.input);
|
||||||
mEditText.setFocusableInTouchMode(true);
|
mEditText.setFocusableInTouchMode(true);
|
||||||
mInputContainer = (LinearLayout) findViewById(R.id.input_container);
|
mInputContainer = findViewById(R.id.input_container);
|
||||||
OnClickListener listener = v -> {
|
OnClickListener listener = v -> {
|
||||||
if (mWindow != null) {
|
if (mWindow != null) {
|
||||||
mWindow.requestWindowFocus();
|
mWindow.requestWindowFocus();
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import com.stardust.autojs.util.FloatingPermission;
|
|||||||
import com.stardust.enhancedfloaty.FloatyService;
|
import com.stardust.enhancedfloaty.FloatyService;
|
||||||
import com.stardust.util.UiHandler;
|
import com.stardust.util.UiHandler;
|
||||||
import com.stardust.util.ViewUtil;
|
import com.stardust.util.ViewUtil;
|
||||||
import com.stardust.util.ViewUtils;
|
|
||||||
|
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ public class Floaty {
|
|||||||
public Floaty(UiHandler uiHandler, UI ui, ScriptRuntime runtime) {
|
public Floaty(UiHandler uiHandler, UI ui, ScriptRuntime runtime) {
|
||||||
mUiHandler = uiHandler;
|
mUiHandler = uiHandler;
|
||||||
mRuntime = runtime;
|
mRuntime = runtime;
|
||||||
mContext = new ContextThemeWrapper(mUiHandler.getContext(), R.style.AppTheme);
|
mContext = new ContextThemeWrapper(mUiHandler.getContext(), R.style.ScriptTheme);
|
||||||
mLayoutInflater = ui.getLayoutInflater();
|
mLayoutInflater = ui.getLayoutInflater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay"
|
android:theme="@style/ScriptTheme.AppBarOverlay"
|
||||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
app:popupTheme="@style/ScriptTheme.PopupOverlay">
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
@@ -6,19 +6,19 @@
|
|||||||
<item name="colorButtonNormal">#cc181818</item>
|
<item name="colorButtonNormal">#cc181818</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="ScriptTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
<item name="android:popupTheme" tools:ignore="NewApi">@style/AppTheme.PopupOverlay</item>
|
<item name="android:popupTheme" tools:ignore="NewApi">@style/ScriptTheme.PopupOverlay</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
<style name="ScriptTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||||
|
|
||||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
<style name="ScriptTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||||
|
|
||||||
|
|
||||||
<style name="AppTheme.Transparent" parent="AppTheme">
|
<style name="ScriptTheme.Transparent" parent="ScriptTheme">
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
<item name="android:windowContentOverlay">@null</item>
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
|||||||
@@ -8,4 +8,9 @@ public interface BiMap<K, V> extends Map<K, V> {
|
|||||||
K getKey(V value);
|
K getKey(V value);
|
||||||
|
|
||||||
Set<V> valueSet();
|
Set<V> valueSet();
|
||||||
|
|
||||||
|
V getOr(K key, V def);
|
||||||
|
|
||||||
|
K getKeyOr(V value, K def);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,18 @@ public class BiMaps {
|
|||||||
return mVKMap.keySet();
|
return mVKMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public V getOr(K key, V def) {
|
||||||
|
V v = get(key);
|
||||||
|
return v == null ? def : v;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public K getKeyOr(V value, K def) {
|
||||||
|
K key = getKey(value);
|
||||||
|
return key == null ? def : key;
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<V> values() {
|
public Collection<V> values() {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="inrt"
|
android:label="inrt"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/ScriptTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:ignore="GoogleAppIndexingWarning"
|
tools:ignore="GoogleAppIndexingWarning"
|
||||||
tools:replace="android:label, android:allowBackup">
|
tools:replace="android:label, android:allowBackup">
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="AppTheme">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="AppTheme">
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|||||||
Reference in New Issue
Block a user