fix: linear.showDividers, text.ellipsize
This commit is contained in:
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@@ -21,7 +21,7 @@ android {
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
abiFilters 'armeabi-v7a'
|
||||
abiFilters 'armeabi-v7a', 'x86'
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.stardust.autojs.core.ui.inflater.ImageLoader;
|
||||
import com.stardust.autojs.core.ui.inflater.util.Drawables;
|
||||
import com.stardust.theme.ThemeColor;
|
||||
import com.stardust.theme.ThemeColorManager;
|
||||
import com.tencent.bugly.Bugly;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
|
||||
import org.autojs.autojs.autojs.AutoJs;
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Build;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CommunityFragment extends ViewPagerFragment implements BackPressedH
|
||||
@AfterViews
|
||||
void setUpViews() {
|
||||
mWebView = mEWebView.getWebView();
|
||||
String url = "http://www.autojs.org/";
|
||||
String url = "https://www.autojs.org/";
|
||||
Bundle savedWebViewState = getArguments().getBundle("savedWebViewState");
|
||||
if (savedWebViewState != null) {
|
||||
mWebView.restoreState(savedWebViewState);
|
||||
|
||||
@@ -3,19 +3,16 @@ package org.autojs.autojs.ui.splash;
|
||||
import android.Manifest;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.stardust.autojs.core.image.OpenCVHelper;
|
||||
import com.xcy8.ads.listener.LoadAdListener;
|
||||
import com.xcy8.ads.view.FullScreenAdView;
|
||||
import com.xcy8.ads.view.skipview.OnFullScreenListener;
|
||||
|
||||
import org.androidannotations.annotations.AfterViews;
|
||||
import org.androidannotations.annotations.EActivity;
|
||||
import org.androidannotations.annotations.ViewById;
|
||||
import org.autojs.autojs.Constants;
|
||||
import org.autojs.autojs.Pref;
|
||||
import org.autojs.autojs.R;
|
||||
@@ -33,6 +30,7 @@ public class SplashActivity extends BaseActivity {
|
||||
public static final String FORCE_SHOW_AD = "forceShowAd";
|
||||
|
||||
private static final String LOG_TAG = SplashActivity.class.getSimpleName();
|
||||
private static final long INIT_TIMEOUT = 1500;
|
||||
|
||||
|
||||
private boolean mCanEnterNextActivity = false;
|
||||
@@ -47,19 +45,31 @@ public class SplashActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mHandler = new Handler();
|
||||
mNotStartMainActivity = getIntent().getBooleanExtra(NOT_START_MAIN_ACTIVITY, false);
|
||||
init();
|
||||
boolean forceShowAd = getIntent().getBooleanExtra(FORCE_SHOW_AD, false);
|
||||
setContentView(R.layout.activity_splash);
|
||||
mFullScreenAdView = findViewById(R.id.full_screen_view);
|
||||
final long millis = SystemClock.uptimeMillis();
|
||||
if (!forceShowAd && !Pref.shouldShowAd()) {
|
||||
mFullScreenAdView.setVisibility(View.INVISIBLE);
|
||||
mHandler.postDelayed(this::enterNextActivity, 1500);
|
||||
} else {
|
||||
if(checkPermission(Manifest.permission.READ_PHONE_STATE)){
|
||||
if (checkPermission(Manifest.permission.READ_PHONE_STATE)) {
|
||||
fetchSplashAD();
|
||||
}
|
||||
}
|
||||
OpenCVHelper.initIfNeeded(this, () -> {
|
||||
long delay = INIT_TIMEOUT - (SystemClock.uptimeMillis() - millis);
|
||||
if (delay <= 0) {
|
||||
enterNextActivity();
|
||||
return;
|
||||
}
|
||||
mHandler.postDelayed(SplashActivity.this::enterNextActivity, delay);
|
||||
});
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setContentView(R.layout.activity_splash);
|
||||
mFullScreenAdView = findViewById(R.id.full_screen_view);
|
||||
mHandler = new Handler();
|
||||
mNotStartMainActivity = getIntent().getBooleanExtra(NOT_START_MAIN_ACTIVITY, false);
|
||||
}
|
||||
|
||||
void enterNextActivity() {
|
||||
@@ -116,7 +126,7 @@ public class SplashActivity extends BaseActivity {
|
||||
});
|
||||
mHandler.postDelayed(() -> {
|
||||
if (mAdLoading) {
|
||||
enterNextActivity();
|
||||
enterNextActivity();
|
||||
}
|
||||
}, 2000);
|
||||
mFullScreenAdView.loadAd(getAdId(), false);
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/fragment_drawer"
|
||||
android:name="org.autojs.autojs.ui.main.drawer.DrawerFragment_"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:showDividers=""
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.stardust.app.SimpleActivityLifecycleCallbacks;
|
||||
import com.stardust.autojs.core.accessibility.AccessibilityBridge;
|
||||
import com.stardust.autojs.core.console.GlobalStardustConsole;
|
||||
import com.stardust.autojs.core.console.StardustConsole;
|
||||
import com.stardust.autojs.core.image.OpenCVHelper;
|
||||
import com.stardust.autojs.core.image.capture.ScreenCaptureRequestActivity;
|
||||
import com.stardust.autojs.core.image.capture.ScreenCaptureRequester;
|
||||
import com.stardust.autojs.core.record.accessibility.AccessibilityActionRecorder;
|
||||
@@ -76,8 +77,6 @@ public abstract class AutoJs {
|
||||
protected void init() {
|
||||
addAccessibilityServiceDelegates();
|
||||
registerActivityLifecycleCallbacks();
|
||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_13, mContext, new BaseLoaderCallback(mContext) {
|
||||
});
|
||||
}
|
||||
|
||||
public abstract void ensureAccessibilityServiceEnabled();
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.stardust.autojs.core.image;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import org.opencv.android.InstallCallbackInterface;
|
||||
import org.opencv.android.LoaderCallbackInterface;
|
||||
import org.opencv.android.OpenCVLoader;
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
/**
|
||||
@@ -11,8 +17,12 @@ import org.opencv.core.Mat;
|
||||
|
||||
public class OpenCVHelper {
|
||||
|
||||
public interface InitializeCallback {
|
||||
void onInitFinish();
|
||||
}
|
||||
|
||||
private static final String LOG_TAG = "OpenCv";
|
||||
private static final String LOG_TAG = "OpenCVHelper";
|
||||
private static boolean mInitialized = false;
|
||||
|
||||
public static void release(@Nullable Mat mat) {
|
||||
if (mat == null)
|
||||
@@ -20,4 +30,100 @@ public class OpenCVHelper {
|
||||
mat.release();
|
||||
}
|
||||
|
||||
public static void initIfNeeded(Activity activity, InitializeCallback callback) {
|
||||
if(mInitialized){
|
||||
callback.onInitFinish();
|
||||
return;
|
||||
}
|
||||
mInitialized = true;
|
||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_13, activity.getApplicationContext(), new LoaderCallback(activity) {
|
||||
|
||||
@Override
|
||||
protected void finish() {
|
||||
callback.onInitFinish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static class LoaderCallback implements LoaderCallbackInterface {
|
||||
private Activity mActivity;
|
||||
|
||||
public LoaderCallback(Activity activity) {
|
||||
this.mActivity = activity;
|
||||
}
|
||||
|
||||
public void onManagerConnected(int status) {
|
||||
switch (status) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
Log.e(LOG_TAG, "OpenCV loading failed!");
|
||||
new MaterialDialog.Builder(mActivity)
|
||||
.title("OpenCV error")
|
||||
.content("OpenCV was not initialised correctly. Application will be shut down")
|
||||
.cancelable(false)
|
||||
.positiveText("OK")
|
||||
.onPositive((dialog, which) -> finish())
|
||||
.show();
|
||||
break;
|
||||
case 2:
|
||||
Log.e(LOG_TAG, "Package installation failed!");
|
||||
new MaterialDialog.Builder(mActivity)
|
||||
.title("OpenCV Manager")
|
||||
.content("Package installation failed!")
|
||||
.cancelable(false)
|
||||
.positiveText("OK")
|
||||
.onPositive((dialog, which) -> finish())
|
||||
.show();
|
||||
break;
|
||||
case 3:
|
||||
Log.d(LOG_TAG, "OpenCV library instalation was canceled by user");
|
||||
finish();
|
||||
break;
|
||||
case 4:
|
||||
Log.d(LOG_TAG, "OpenCV Manager Service is uncompatible with this app!");
|
||||
new MaterialDialog.Builder(mActivity)
|
||||
.title("OpenCV Manager")
|
||||
.content("OpenCV Manager service is incompatible with this app. Try to update it via Google Play.")
|
||||
.cancelable(false)
|
||||
.positiveText("OK")
|
||||
.onPositive((dialog, which) -> finish())
|
||||
.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onPackageInstall(int operation, final InstallCallbackInterface callback) {
|
||||
switch (operation) {
|
||||
case 0:
|
||||
new MaterialDialog.Builder(mActivity)
|
||||
.title("Package not found")
|
||||
.content(callback.getPackageName() + " package was not found! Try to install it?")
|
||||
.cancelable(false)
|
||||
.positiveText("Yes")
|
||||
.onPositive((dialog, which) -> callback.install())
|
||||
.negativeText("No")
|
||||
.onNegative(((dialog, which) -> callback.cancel()))
|
||||
.show();
|
||||
break;
|
||||
case 1:
|
||||
new MaterialDialog.Builder(mActivity)
|
||||
.title("OpenCV is not ready")
|
||||
.content("Installation is in progress. Wait or exit?")
|
||||
.cancelable(false)
|
||||
.positiveText("Wait")
|
||||
.onPositive((dialog, which) -> callback.wait_install())
|
||||
.negativeText("Exit")
|
||||
.onNegative(((dialog, which) -> callback.cancel()))
|
||||
.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void finish() {
|
||||
mActivity.finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ public class LinearLayoutInflater<V extends LinearLayout> extends ViewGroupInfla
|
||||
.map("vertical", LinearLayout.VERTICAL)
|
||||
.map("horizontal", LinearLayout.HORIZONTAL);
|
||||
|
||||
static final ValueMapper<Integer> SHOW_DIVIDERS = new ValueMapper<Integer>("showDividers")
|
||||
.map("beginning", LinearLayout.SHOW_DIVIDER_BEGINNING)
|
||||
.map("middle", LinearLayout.SHOW_DIVIDER_MIDDLE)
|
||||
.map("end", LinearLayout.SHOW_DIVIDER_END)
|
||||
.map("none", LinearLayout.SHOW_DIVIDER_NONE);
|
||||
|
||||
public LinearLayoutInflater(ResourceParser resourceParser) {
|
||||
super(resourceParser);
|
||||
}
|
||||
@@ -44,6 +50,9 @@ public class LinearLayoutInflater<V extends LinearLayout> extends ViewGroupInfla
|
||||
case "orientation":
|
||||
view.setOrientation(ORIENTATIONS.get(value));
|
||||
break;
|
||||
case "showDividers":
|
||||
view.setShowDividers(SHOW_DIVIDERS.split(value));
|
||||
break;
|
||||
case "weightSum":
|
||||
view.setWeightSum(Float.valueOf(value));
|
||||
break;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TextViewInflater<V extends TextView> extends BaseViewInflater<V> {
|
||||
.map("web", Linkify.WEB_URLS);
|
||||
private static final ValueMapper<TextUtils.TruncateAt> ELLIPSIZE = new ValueMapper<TextUtils.TruncateAt>("ellipsize")
|
||||
.map("end", TextUtils.TruncateAt.END)
|
||||
.map("marquee", TextUtils.TruncateAt.MIDDLE)
|
||||
.map("marquee", TextUtils.TruncateAt.MARQUEE)
|
||||
.map("none", null)
|
||||
.map("start", TextUtils.TruncateAt.START)
|
||||
.map("middle", TextUtils.TruncateAt.MIDDLE);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.stardust.autojs.core.ui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
@@ -4,7 +4,9 @@ import android.content.Context;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
|
||||
import com.stardust.autojs.runtime.api.UI;
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ public class LogActivity extends AppCompatActivity {
|
||||
|
||||
private void setupView() {
|
||||
setContentView(R.layout.activity_main);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
ConsoleView consoleView = (ConsoleView) findViewById(R.id.console);
|
||||
ConsoleView consoleView = findViewById(R.id.console);
|
||||
consoleView.setConsole((StardustConsole) AutoJs.getInstance().getGlobalConsole());
|
||||
consoleView.findViewById(R.id.input_container).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.RequiresApi;
|
||||
@@ -14,6 +15,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.stardust.auojs.inrt.launch.AssetsProjectLauncher;
|
||||
import com.stardust.auojs.inrt.launch.GlobalProjectLauncher;
|
||||
import com.stardust.autojs.core.image.OpenCVHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -29,18 +31,24 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
public class SplashActivity extends AppCompatActivity {
|
||||
|
||||
private static final int PERMISSION_REQUEST_CODE = 11186;
|
||||
private static final long INIT_TIMEOUT = 2500;
|
||||
|
||||
@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);
|
||||
TextView slug = findViewById(R.id.slug);
|
||||
slug.setTypeface(Typeface.createFromAsset(getAssets(), "roboto_medium.ttf"));
|
||||
new Handler().postDelayed(this::main, 2500);
|
||||
final long millis = SystemClock.uptimeMillis();
|
||||
OpenCVHelper.initIfNeeded(this, () -> {
|
||||
long delay = INIT_TIMEOUT - (SystemClock.uptimeMillis() - millis);
|
||||
if (!Pref.isFirstUsing() || delay <= 0) {
|
||||
main();
|
||||
return;
|
||||
}
|
||||
new Handler().postDelayed(SplashActivity.this::main, delay);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void main() {
|
||||
|
||||
Reference in New Issue
Block a user