api: colors.isSimilar, colors.equals

fix: circular menu icon is not circular when recording
feat: splash ui for built apk
docs: update to latest docs
fix: floating menu not showing automatically
This commit is contained in:
hyb1996
2018-02-02 18:30:08 +08:00
parent d1221d530e
commit c75337a767
25 changed files with 343 additions and 146 deletions

View File

@@ -18,6 +18,12 @@
android:theme="@style/AppTheme"
tools:replace="android:label, android:allowBackup">
<activity android:name=".MainActivity">
</activity>
<activity
android:name=".SplashActivity"
android:theme="@style/AppTheme.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Binary file not shown.

View File

@@ -9,6 +9,7 @@ import android.preference.PreferenceManager;
public class Pref {
private static final String KEY_FIRST_USING = "key_first_using";
private static SharedPreferences sPreferences;
public static SharedPreferences getPreferences() {
@@ -36,4 +37,12 @@ public class Pref {
public static boolean shouldStopAllScriptsWhenVolumeUp() {
return getPreferences().getBoolean(getString(R.string.key_use_volume_control_running), true);
}
public static boolean isFirstUsing() {
boolean firstUsing = getPreferences().getBoolean(KEY_FIRST_USING, true);
if (firstUsing) {
getPreferences().edit().putBoolean(KEY_FIRST_USING, false).apply();
}
return firstUsing;
}
}

View File

@@ -28,8 +28,8 @@ public class SettingsActivity extends AppCompatActivity {
getFragmentManager().beginTransaction().replace(R.id.fragment_setting, new PreferenceFragment()).commit();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(R.string.text_settings);
toolbar.setNavigationOnClickListener(v -> finish());
setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(v -> finish());
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

View File

@@ -0,0 +1,36 @@
package com.stardust.auojs.inrt;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
/**
* Created by Stardust on 2018/2/2.
*/
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!Pref.isFirstUsing()) {
main();
return;
}
setContentView(R.layout.activity_splash);
TextView slug = (TextView) findViewById(R.id.slug);
slug.setTypeface(Typeface.createFromAsset(getAssets(), "roboto_medium.ttf"));
new Handler().postDelayed(this::main, 2500);
}
private void main() {
startActivity(new Intent(this, MainActivity.class));
finish();
}
}

View File

@@ -10,12 +10,14 @@
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>

View File

@@ -10,12 +10,14 @@
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:src="@drawable/autojs_material"/>
<TextView
android:id="@+id/slug"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="12dp"
android:text="@string/powered_by_autojs"
android:textColor="#dd000000"
android:textSize="14sp"/>
</FrameLayout>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@@ -19,4 +19,5 @@
<string name="key_dont_show_main_activity">key_dont_show_main_activity</string>
<string name="summary_dont_show_main_activity">打开应用后直接运行脚本</string>
<string name="text_others">其他</string>
<string name="powered_by_autojs">Powered by Auto.js</string>
</resources>

View File

@@ -8,4 +8,15 @@
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.Splash" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
</resources>