提交 103b7e7f 编写于 作者: B Blankj

see 04/24 log

上级 964cebde
......@@ -44,7 +44,7 @@ ext {
support_fragment: "com.squareup.leakcanary:leakcanary-support-fragment:$leakcanary_version"
],
free_proguard: "com.blankj:free-proguard:1.0.0",
adapt_screen : "com.blankj:adapt-screen:0.0.3",
swipe_panel: "com.blankj:swipe-panel:1.0",
gson : "com.google.code.gson:gson:2.8.2",
glide : "com.github.bumptech.glide:glide:4.7.1",
......
......@@ -13,7 +13,6 @@
android:name="com.blankj.launcher.pkg.MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="user"
android:theme="@style/MainActivityTheme"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -6,7 +6,6 @@
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="user"
android:theme="@style/MainActivityTheme"
android:windowSoftInputMode="stateHidden" />
</application>
......
......@@ -6,9 +6,8 @@ import android.support.v7.app.ActionBarDrawerToggle
import android.view.View
import android.widget.ImageView
import com.blankj.lib.base.BaseDrawerActivity
import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.BusUtils
import com.blankj.utilcode.constant.PermissionConstants
import com.blankj.utilcode.util.*
import kotlinx.android.synthetic.main.activity_main.*
......@@ -22,7 +21,19 @@ import kotlinx.android.synthetic.main.activity_main.*
*/
class MainActivity : BaseDrawerActivity() {
override fun initData(bundle: Bundle?) {}
override fun initData(bundle: Bundle?) {
PermissionUtils.permission(PermissionConstants.CALENDAR)
.callback(object : PermissionUtils.SimpleCallback {
override fun onGranted() {
LogUtils.e()
}
override fun onDenied() {
LogUtils.e()
}
})
}
override fun bindLayout(): Int {
return R.layout.activity_main
......
......@@ -13,7 +13,7 @@ dependencies {
api dep.constraint
api dep.kotlin
api dep.free_proguard
api 'com.r0adkll:slidableactivity:2.0.6'
api dep.swipe_panel
compileOnly dep.leakcanary.android_no_op
// api 'com.blankj:utilcode:1.23.7'
}
\ No newline at end of file
package com.blankj.lib.base;
/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/03/14
* desc :
* </pre>
*/
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
......@@ -16,11 +7,11 @@ import android.support.annotation.LayoutRes;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.blankj.lib.base.slideBack.SlideBackLayout;
import com.blankj.swipepanel.SwipePanel;
import com.blankj.utilcode.util.AntiShakeUtils;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.SizeUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.blankj.utilcode.util.Utils;
......@@ -91,26 +82,18 @@ public abstract class BaseActivity extends AppCompatActivity
private void initSwipeBack() {
if (isSwipeBack()) {
SlideBackLayout slideBackLayout = new SlideBackLayout(this);
ViewGroup decorView = (ViewGroup) getWindow().getDecorView();
View oldScreen = decorView.getChildAt(0);
decorView.removeViewAt(0);
slideBackLayout.addView(oldScreen);
decorView.addView(slideBackLayout, 0);
slideBackLayout.setSwipeBackListener(new SlideBackLayout.OnSwipeBackListener() {
final SwipePanel swipeLayout = new SwipePanel(this);
swipeLayout.setLeftDrawable(R.drawable.base_back);
swipeLayout.setLeftEdgeSize(SizeUtils.dp2px(100));
swipeLayout.wrapView(mContentView);
swipeLayout.setOnFullSwipeListener(new SwipePanel.OnFullSwipeListener() {
@Override
public void completeSwipeBack() {
// finish();
ToastUtils.showLong("haha");
public void onFullSwipe(int direction) {
finish();
swipeLayout.close(direction);
}
});
}
}
}
package com.blankj.lib.base.slideBack;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewParent;
import android.widget.FrameLayout;
/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/03/20
* desc :
* </pre>
*/
public class SlideBackLayout extends FrameLayout {
private static final String TAG = "SlideBackLayout";
private float mStartX;
private float mStartY;
private float mCurrentX;
private boolean mHasJudged = false;
private float progress;
private Paint mPaint;
private Paint mPaintWhite;
private Path mPath;
private int mHalfScreenWidth;
private boolean mDrawBack = false;
private boolean mIsAccept = false;
private boolean mIsLeftStart = false;
private boolean mIsRightStart = false;
private OnSwipeBackListener mSwipeBackListener;
private boolean mIsRightSwipeEnable = true;
private boolean mIsLeftSwipeEnable = true;
private final float mSwipeMaximum = 0.6665f;
private Context mContext;
private int mStartMarginDP = 100;//dp
private int mAmplitudeDP = 90;
private float mAmplitude;
private float mHeight;
private float mSineWidth;
private float mSineIndex;
private float mSineTheta;
private float valueSineStart;
private float sineLineStartY;
public SlideBackLayout(@NonNull Context context) {
this(context, null);
}
public SlideBackLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public SlideBackLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
initDrawTool();
}
private void initDrawTool() {
mPaint = new Paint();
mPaint.setColor(Color.BLACK);
mPaint.setStrokeWidth(8);
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.FILL);
mPaintWhite = new Paint();
mPaintWhite.setColor(Color.WHITE);
mPaintWhite.setStrokeWidth(4);
mPaintWhite.setAntiAlias(true);
mPaintWhite.setStrokeCap(Paint.Cap.ROUND);
mPath = new Path();
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
super.dispatchTouchEvent(ev);
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN: {
mHasJudged = false;
mStartX = ev.getX();
mStartY = ev.getY();
mIsLeftStart = isLeftStart(mStartX);
mIsRightStart = isRightStart(mStartX);
return true;
}
}
if (mIsLeftStart || mIsRightStart) {
switch (ev.getAction()) {
case MotionEvent.ACTION_MOVE: {
mCurrentX = ev.getX();
if (!mHasJudged) {
float distanceX = Math.abs(mCurrentX - mStartX);
if (distanceX > 30) {
// allowParentsInterceptTouchEvent(getParent());
mHasJudged = true;
}
}
// 大于30开始画图
if (mHasJudged) {
cancelChildViewTouch();
postInvalidateDelayed(0);
}
break;
}
case MotionEvent.ACTION_UP: {
progress = calculateProgress();
if (progress > 0.9 * 0.665 && (mIsLeftStart || mIsRightStart)) {
Log.d(TAG, "onTouchEvent: action up");
mIsAccept = true;
mSwipeBackListener.completeSwipeBack();
}
mDrawBack = true;
postInvalidateDelayed(0);
break;
}
}
}
if (mHasJudged) {
return true;
}
return super.dispatchTouchEvent(ev);
}
void cancelChildViewTouch() {
// Cancel child touches
final long now = SystemClock.uptimeMillis();
final MotionEvent cancelEvent = MotionEvent.obtain(now, now,
MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0);
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
getChildAt(i).dispatchTouchEvent(cancelEvent);
}
cancelEvent.recycle();
}
// @Override
// public boolean onInterceptTouchEvent(MotionEvent ev) {
// return mIsLeftStart || mIsRightStart || super.onInterceptTouchEvent(ev);
// }
// @Override
// public boolean onTouchEvent(MotionEvent event) {
//// disallowParentsInterceptTouchEvent(getParent());
// switch (event.getAction()) {
// case MotionEvent.ACTION_MOVE: {
// mCurrentX = event.getX();
// if (!mHasJudged) {
// float distanceX = Math.abs(mCurrentX - mStartX);
// if (distanceX > 30) {
//// allowParentsInterceptTouchEvent(getParent());
// mHasJudged = true;
// }
// }
// // 大于30开始画图
// if (mHasJudged) {
// postInvalidateDelayed(0);
// }
// break;
// }
// case MotionEvent.ACTION_UP: {
// progress = calculateProgress();
// if (progress > 0.9 * 0.665 && (mIsLeftStart || mIsRightStart)) {
// Log.d(TAG, "onTouchEvent: action up");
// mIsAccept = true;
// mSwipeBackListener.completeSwipeBack();
// }
// mDrawBack = true;
// postInvalidateDelayed(0);
// break;
// }
// }
// return true;
// }
private boolean isLeftStart(float startX) {
return mIsLeftSwipeEnable && startX < dip2px(mStartMarginDP);
}
private boolean isRightStart(float startX) {
return mIsRightSwipeEnable && startX > getWidth() - dip2px(mStartMarginDP);
}
private void disallowParentsInterceptTouchEvent(ViewParent parent) {
if (parent == null) {
return;
}
parent.requestDisallowInterceptTouchEvent(true);
disallowParentsInterceptTouchEvent(parent.getParent());
}
private void allowParentsInterceptTouchEvent(ViewParent parent) {
if (parent == null) {
return;
}
parent.requestDisallowInterceptTouchEvent(false);
allowParentsInterceptTouchEvent(parent.getParent());
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
drawSinLine(canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mHalfScreenWidth = getMeasuredWidth() / 2;
}
private void drawSinLine(Canvas canvas) {
if (!mIsRightStart && !mIsLeftStart) {
resetAll();
return;
}
if (!mDrawBack) {
progress = calculateProgress();
} else if (mIsAccept) {
resetAll();
} else {
progress -= 0.1;
if (progress < 0) {
resetAll();
}
}
int initAmplitude = dip2px(12);
mAmplitude = initAmplitude * progress * 1.5f;
mHeight = initAmplitude * 2 * progress * 1.5f;
mSineWidth = dip2px(135);
mSineIndex = 0;
mSineTheta = 30;
valueSineStart = 0;
sineLineStartY = mStartY - 1.9f / 3f * mSineWidth;
if (mIsRightStart) {
valueSineStart += getWidth();
}
mPath.reset();
mPath.moveTo(valueSineStart, sineLineStartY);
float valueSine;
while (mSineIndex <= mSineWidth * 4 / 3) {
valueSine = (float) (Math.sin(mSineIndex / mSineWidth * 1.5f * Math.PI + mSineTheta)
* mAmplitude + mHeight - mAmplitude);
if (mIsRightStart) {
valueSine *= -1;
valueSine += getWidth();
}
mPath.lineTo(valueSine, sineLineStartY + mSineIndex);
mSineIndex++;
}
mPath.lineTo(valueSineStart, sineLineStartY);
mPath.close();
mPaint.setAlpha((int) (190 * progress * 1.5f));
canvas.drawPath(mPath, mPaint);
float midBackX = mAmplitude * 1.25f;
float midBackY = mStartY;
mPaintWhite.setAlpha((int) (255 * progress * 1.5f));
float lineLength = dip2px(5) * progress * 1.5f;
if (mIsRightStart) {
midBackX *= -1;
midBackX += getWidth() + lineLength;
canvas.drawLine(midBackX - lineLength, midBackY, midBackX, midBackY - lineLength, mPaintWhite);
canvas.drawLine(midBackX - lineLength, midBackY, midBackX, midBackY + lineLength, mPaintWhite);
} else {
canvas.drawLine(midBackX - lineLength, midBackY, midBackX, midBackY + lineLength, mPaintWhite);
canvas.drawLine(midBackX - lineLength, midBackY, midBackX, midBackY - lineLength, mPaintWhite);
}
// 慢回弹
if (mDrawBack) {
postInvalidateDelayed(0);
}
}
private void resetAll() {
mCurrentX = 0;
mHasJudged = false;
mStartY = 0;
mStartX = 0;
mDrawBack = false;
progress = 0;
allowParentsInterceptTouchEvent(getParent());
}
private float calculateProgress() {
float distance = Math.abs(mCurrentX - mStartX);
if (distance > mHalfScreenWidth) {
return mSwipeMaximum;
}
float temp = distance / mHalfScreenWidth;
if (temp > mSwipeMaximum) {
return mSwipeMaximum;
}
return temp;
}
private int dip2px(float dipValue) {
float scale = mContext.getResources().getDisplayMetrics().scaledDensity;
return (int) (dipValue * scale + 0.5f);
}
public void setRightSwipeEnable(boolean enable) {
this.mIsRightSwipeEnable = enable;
}
public void setLeftSwipeEnable(boolean enable) {
this.mIsLeftSwipeEnable = enable;
}
public void setSwipeBackListener(OnSwipeBackListener onSwipeBackListener) {
this.mSwipeBackListener = onSwipeBackListener;
}
public interface OnSwipeBackListener {
void completeSwipeBack();
}
}
package com.blankj.lib.base.slideBack;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import android.widget.FrameLayout;
/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/03/22
* desc :
* </pre>
*/
public class SwipeLayout extends FrameLayout {
private static final int DIRECTION_LEFT = 1;
private static final int DIRECTION_UP = 2;
private static final int DIRECTION_RIGHT = 4;
private static final int DIRECTION_DOWN = 8;
private int mEdgeSlop;
private int mTouchSlop;
private float mDownX;
private float mDownY;
private float mCurrentX;
private float mCurrentY;
private boolean mIsLeftStart;
private boolean mIsUpStart;
private boolean mIsRightStart;
private boolean mIsDownStart;
private boolean mIsEdgeStart;
private int mMovedDirection;
private boolean mIsLeftSwipeEnable = true;
private boolean mIsRightSwipeEnable = true;
private boolean mIsUpSwipeEnable = true;
private boolean mIsDownSwipeEnable = true;
private Paint mPaint;
private Paint mPaintWhite;
private Path mPath;
private float progress;
private float preProgress;
private boolean mAvailable;
private boolean mDrawBack;
private int mWidth;
private int mHeight;
private float mAlphaLimit = 0.75f;
private float mStartSpeed;
private int mLimit;
private static final float HALF_SIZE = 400;
private OnSwipeListener mListener;
public SwipeLayout(@NonNull Context context) {
super(context);
}
public SwipeLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context);
}
private void init(final Context context) {
mEdgeSlop = 2000;
// mEdgeSlop = ViewConfiguration.get(context).getScaledEdgeSlop();
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
mPaint.setColor(0x90000000);
mPaint.setStyle(Paint.Style.FILL);
mPaintWhite = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
mPaintWhite.setColor(Color.WHITE);
mPaintWhite.setStrokeWidth(4);
mPaintWhite.setStrokeCap(Paint.Cap.ROUND);
mPath = new Path();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mWidth = getMeasuredWidth();
mHeight = getMeasuredHeight();
mLimit = Math.min(mWidth, mHeight) / 3;
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
drawSinLine(canvas);
}
private void drawSinLine(Canvas canvas) {
if (!mIsEdgeStart) return;
if (mDrawBack) {
if (progress <= 0) return;
progress -= mStartSpeed;
mStartSpeed += 0.01;
postInvalidateDelayed(0);
}
mPath.reset();
if (mMovedDirection == DIRECTION_RIGHT) {
float p = 5;
mPath.moveTo(0, mDownY - HALF_SIZE);
float preX = 0;
float preY = mDownY - HALF_SIZE;
float curX = preX;
float curY = preY + HALF_SIZE / p;
mPath.quadTo(preX, preY, (preX + curX) / 2, (preY + curY) / 2);
preX = curX;
preY = curY;
curX = preX + HALF_SIZE / p;
curY = preY + HALF_SIZE / p;
mPath.quadTo(preX, preY, (preX + curX) / 2, (preY + curY) / 2);
preX = curX;
preY = curY;
curX = HALF_SIZE * 2 / 3;
curY = mDownY;
mPath.quadTo(preX, preY, (preX + curX) / 2, (preY + curY) / 2);
preX = curX;
preY = curY;
curX = HALF_SIZE / p;
curY = mDownY + HALF_SIZE - HALF_SIZE / p;
mPath.quadTo(preX, preY, (preX + curX) / 2, (preY + curY) / 2);
preX = curX;
preY = curY;
curX = 0;
curY = mDownY + HALF_SIZE;
mPath.quadTo(preX, preY, (preX + curX) / 2, (preY + curY) / 2);
preX = curX;
preY = curY;
curX = 0;
curY = mDownY + HALF_SIZE;
mPath.quadTo(preX, preY, (preX + curX) / 2, (preY + curY) / 2);
mPath.close();
canvas.drawPath(mPath, mPaint);
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
super.dispatchTouchEvent(ev);
int action = ev.getAction();
if (action == MotionEvent.ACTION_DOWN) {
mIsLeftStart = mIsLeftSwipeEnable && mDownX <= mEdgeSlop;
mIsUpStart = mIsUpSwipeEnable && mDownY <= mEdgeSlop;
mIsRightStart = mIsRightSwipeEnable && mDownX >= getWidth() - mEdgeSlop;
mIsDownStart = mIsDownSwipeEnable && mDownY >= getHeight() - mEdgeSlop;
mIsEdgeStart = mIsLeftStart || mIsUpStart || mIsRightStart || mIsDownStart;
if (mIsEdgeStart) {
mDownX = ev.getX();
mDownY = ev.getY();
mMovedDirection = 0;
progress = preProgress = -1;
mDrawBack = false;
mAvailable = false;
mStartSpeed = 0.01f;
}
return true;
}
if (mIsEdgeStart) {
if (action == MotionEvent.ACTION_MOVE) {
mCurrentX = ev.getX();
mCurrentY = ev.getY();
if (mMovedDirection == 0) {
float deltaX = mCurrentX - mDownX;
float deltaY = mCurrentY - mDownY;
float disX = Math.abs(deltaX);
float disY = Math.abs(deltaY);
if (disX > mTouchSlop || disY > mTouchSlop) {
if (disX >= disY) {
if (mIsLeftStart && deltaX > 0) {
decideDirection(DIRECTION_RIGHT);
} else if (mIsRightStart && deltaX < 0) {
decideDirection(DIRECTION_LEFT);
}
} else {
if (mIsUpStart && deltaY > 0) {
decideDirection(DIRECTION_DOWN);
} else if (mIsDownStart && deltaY < 0) {
decideDirection(DIRECTION_UP);
}
}
}
}
if (mMovedDirection != 0) {
progress = calculateProgress();
if (Math.abs(preProgress - progress) > 0.01) {
preProgress = progress;
postInvalidate();
}
}
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
mCurrentX = ev.getX();
mCurrentY = ev.getY();
progress = calculateProgress();
mDrawBack = true;
if (progress >= 0.95) {
mAvailable = true;
if (mListener != null) {
mListener.onSwipe();
}
}
postInvalidate();
}
}
return true;
}
private void decideDirection(int direction) {
if (direction == DIRECTION_RIGHT || direction == DIRECTION_LEFT) {
if (mDownY < HALF_SIZE) {
mDownY = HALF_SIZE;
} else if (mDownY >= mHeight - HALF_SIZE) {
mDownY = mHeight - HALF_SIZE;
}
} else {
if (mDownX < HALF_SIZE) {
mDownX = HALF_SIZE;
} else if (mDownX >= mWidth - HALF_SIZE) {
mDownX = mWidth - HALF_SIZE;
}
}
mMovedDirection = direction;
cancelChildViewTouch();
requestDisallowInterceptTouchEvent(true);
}
private float calculateProgress() {
if (mMovedDirection == DIRECTION_RIGHT) {
float deltaX = mCurrentX - mDownX;
if (deltaX <= 0) return 0;
return Math.min(deltaX / mLimit, 1);
} else if (mMovedDirection == DIRECTION_DOWN) {
float deltaY = mCurrentY - mDownY;
if (deltaY <= 0) return 0;
return Math.min(deltaY / mLimit, 1);
} else if (mMovedDirection == DIRECTION_LEFT) {
float deltaX = mCurrentX - mDownX;
if (deltaX >= 0) return 0;
return Math.min(-deltaX / mLimit, 1);
} else {
float deltaY = mCurrentY - mDownY;
if (deltaY >= 0) return 0;
return Math.min(-deltaY / mLimit, 1);
}
}
private void cancelChildViewTouch() {
final long now = SystemClock.uptimeMillis();
final MotionEvent cancelEvent = MotionEvent.obtain(now, now,
MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0);
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
getChildAt(i).dispatchTouchEvent(cancelEvent);
}
cancelEvent.recycle();
}
public interface OnSwipeListener {
void onSwipe();
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/baseTitleRootLayout"
android:layout_width="match_parent"
......
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowAnimationStyle">@style/AnimationActivity</item>
<item name="android:windowActionBar">false</item>
<!--slider-->
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowAnimationStyle">@style/AnimationActivity</item>
<item name="android:windowActionBar">false</item>
<!--slider-->
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
......@@ -7,14 +7,6 @@
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowAnimationStyle">@style/AnimationActivity</item>
<item name="android:windowActionBar">false</item>
<!--slider-->
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="MainActivityTheme" parent="AppTheme">
<item name="android:windowIsTranslucent">false</item>
</style>
<style name="TextStyle">
......@@ -33,7 +25,7 @@
</style>
<style name="AnimationActivity" parent="@android:style/Animation.Translucent">
<style name="AnimationActivity" parent="@android:style/Animation">
<item name="android:activityOpenEnterAnimation">@anim/slide_in_left</item>
<item name="android:activityOpenExitAnimation">@anim/slide_out_left</item>
<item name="android:activityCloseEnterAnimation">@anim/slide_in_right</item>
......
......@@ -13,7 +13,6 @@
android:name="com.blankj.subutil.pkg.feature.SubUtilActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="user"
android:theme="@style/MainActivityTheme"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -281,6 +281,8 @@ shutdown : 关机
reboot : 重启
reboot2Recovery : 重启到 recovery
reboot2Bootloader: 重启到 bootloader
isTablet : 判断是否是平板
isEmulator : 判断是否是模拟器
```
* ### 闪光灯相关 -> [FlashlightUtils.java][flashlight.java] -> [Demo][flashlight.demo]
......@@ -729,7 +731,6 @@ screenShot : 截屏
isScreenLock : 判断是否锁屏
setSleepDuration : 设置进入休眠时长
getSleepDuration : 获取进入休眠时长
isTablet : 判断是否是平板
```
* ### SD 卡相关 -> [SDCardUtils.java][sdcard.java] -> [Demo][sdcard.demo]
......
......@@ -13,7 +13,6 @@
android:name="com.blankj.utilcode.pkg.feature.CoreUtilActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="user"
android:theme="@style/MainActivityTheme"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -22,7 +22,7 @@ public final class RegexConstants {
* <p>global star: 1349</p>
* <p>virtual operator: 170</p>
*/
public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(16[6])|(17[0,1,3,5-8])|(18[0-9])|(19[8,9]))\\d{8}$";
public static final String REGEX_MOBILE_EXACT = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(16[6])|(17[0,1,3,5-8])|(18[0-9])|(19[1,8,9]))\\d{8}$";
/**
* Regex of telephone number.
*/
......
......@@ -3,13 +3,17 @@ package com.blankj.utilcode.util;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Debug;
import android.os.PowerManager;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.support.annotation.RequiresPermission;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.io.File;
......@@ -348,4 +352,59 @@ public final class DeviceUtils {
public static void reboot2Bootloader() {
ShellUtils.execCmd("reboot bootloader", true);
}
/**
* Return whether device is tablet.
*
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isTablet() {
return (Utils.getApp().getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
/**
* Return whether device is emulator.
*
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isEmulator() {
boolean checkProperty = Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.toLowerCase().contains("vbox")
|| Build.FINGERPRINT.toLowerCase().contains("test-keys")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
|| Build.SERIAL.equalsIgnoreCase("unknown")
|| Build.SERIAL.equalsIgnoreCase("android")
|| Build.MODEL.contains("Android SDK built for x86")
|| Build.MANUFACTURER.contains("Genymotion")
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|| "google_sdk".equals(Build.PRODUCT);
if (checkProperty) return true;
boolean checkDebuggerConnected = Debug.isDebuggerConnected();
if (checkDebuggerConnected) return true;
String operatorName = "";
TelephonyManager tm = (TelephonyManager) Utils.getApp().getSystemService(Context.TELEPHONY_SERVICE);
if (tm != null) {
String name = tm.getNetworkOperatorName();
if (name != null) {
operatorName = name;
}
}
boolean checkOperatorName = operatorName.toLowerCase().equals("android");
if (checkOperatorName) return true;
String url = "tel:" + "123456";
Intent intent = new Intent();
intent.setData(Uri.parse(url));
intent.setAction(Intent.ACTION_DIAL);
boolean checkDial = intent.resolveActivity(Utils.getApp().getPackageManager()) != null;
if (checkDial) return true;
return false;
}
}
......@@ -75,10 +75,9 @@ public final class PermissionUtils {
public static List<String> getPermissions(final String packageName) {
PackageManager pm = Utils.getApp().getPackageManager();
try {
return Arrays.asList(
pm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS)
.requestedPermissions
);
String[] permissions = pm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS).requestedPermissions;
if (permissions == null) return Collections.emptyList();
return Arrays.asList(permissions);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return Collections.emptyList();
......
......@@ -302,15 +302,4 @@ public final class ScreenUtils {
return -123;
}
}
/**
* Return whether device is tablet.
*
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isTablet() {
return (Utils.getApp().getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
}
......@@ -38,8 +38,8 @@ import java.lang.reflect.Field;
*/
public final class ToastUtils {
private static final int COLOR_DEFAULT = 0xFEFFFFFF;
private static final String NULL = "null";
private static final int COLOR_DEFAULT = 0xFEFFFFFF;
private static final String NULL = "null";
private static IToast iToast;
private static int sGravity = -1;
......@@ -435,7 +435,7 @@ public final class ToastUtils {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
mWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
mParams.type = WindowManager.LayoutParams.TYPE_TOAST;
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1) {
} else {
Context topActivityOrApp = Utils.getTopActivityOrApp();
if (!(topActivityOrApp instanceof Activity)) {
Log.e("ToastUtils", "Couldn't get top Activity.");
......@@ -449,10 +449,11 @@ public final class ToastUtils {
mWM = topActivity.getWindowManager();
mParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
Utils.getActivityLifecycle().addOnActivityDestroyedListener(topActivity, LISTENER);
} else {
mWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
mParams.type = WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + 37;
}
// else {
// mWM = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
// mParams.type = WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW + 37;
// }
final Configuration config = context.getResources().getConfiguration();
final int gravity = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1
......
......@@ -160,7 +160,9 @@ public final class Utils {
if (info == null || info.size() == 0) return false;
for (ActivityManager.RunningAppProcessInfo aInfo : info) {
if (aInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
return aInfo.processName.equals(Utils.getApp().getPackageName());
if (aInfo.processName.equals(Utils.getApp().getPackageName())) {
return true;
}
}
}
return false;
......
package com.blankj.utilcode.util;
import android.support.annotation.NonNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
......@@ -8,9 +10,7 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowLog;
import java.util.Scanner;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.TreeSet;
/**
* <pre>
......@@ -21,7 +21,7 @@ import java.util.concurrent.Future;
* </pre>
*/
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, shadows = {ShadowLog.class})
@Config(manifest = Config.NONE, shadows = {ShadowLog.class}, sdk = 19)
public class BaseTest {
public BaseTest() {
......@@ -32,36 +32,47 @@ public class BaseTest {
@Test
public void test() throws Exception {
final Scanner scanner = new Scanner(System.in);
final CountDownLatch countDownLatch = new CountDownLatch(1);
final Future<?> submit = ThreadUtils.getSinglePool().submit(new Runnable() {
@Override
public void run() {
System.out.println("haha0");
scanner.nextLine();
System.out.println("haha");
if (Thread.currentThread().isInterrupted()) {
System.out.println(1);
}
for (int i = 0; i < 1000000; i++) {
if (Thread.currentThread().isInterrupted()) {
break;
}
// try {
// Thread.sleep(100);
// } catch (InterruptedException e) {
// e.printStackTrace();
TreeSet<Person> people = new TreeSet<>();
people.add(new Person("1", 1, 0));
people.add(new Person("3", 3, 0));
people.add(new Person("3", 3, 1));
people.add(new Person("2", 2, 0));
for (Person person : people) {
System.out.println(person);
}
System.out.println(people);
// final Scanner scanner = new Scanner(System.in);
//
// final CountDownLatch countDownLatch = new CountDownLatch(1);
// final Future<?> submit = ThreadUtils.getSinglePool().submit(new Runnable() {
// @Override
// public void run() {
// System.out.println("haha0");
// scanner.nextLine();
// System.out.println("haha");
// if (Thread.currentThread().isInterrupted()) {
// System.out.println(1);
// }
// for (int i = 0; i < 1000000; i++) {
// if (Thread.currentThread().isInterrupted()) {
// break;
// }
System.out.println(i);
}
}
});
Thread.sleep(500);
scanner.close();
Thread.sleep(500);
submit.cancel(true);
countDownLatch.await();
//// try {
//// Thread.sleep(100);
//// } catch (InterruptedException e) {
//// e.printStackTrace();
//// }
// System.out.println(i);
// }
// }
// });
// Thread.sleep(500);
// scanner.close();
// Thread.sleep(500);
// submit.cancel(true);
// countDownLatch.await();
// final CountDownLatch countDownLatch = new CountDownLatch(1);
// final Scanner scanner = new Scanner(System.in);
......@@ -155,26 +166,34 @@ public class BaseTest {
}
static class Person {
static class Person implements Comparable<Person> {
String name;
int gender;
String address;
int age;
int time;
public Person(String name) {
this.name = name;
}
public Person(String name, int age, int time) {
this.name = name;
this.age = age;
this.time = time;
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (!(obj instanceof Person)) return false;
Person p = (Person) obj;
return equals(name, p.name) && p.gender == gender && equals(address, p.address);
public String toString() {
return name + age + time;
}
private static boolean equals(final Object o1, final Object o2) {
return o1 == o2 || (o1 != null && o1.equals(o2));
@Override
public int compareTo(@NonNull Person o) {
int res = o.age - age;
if (res != 0) {
return res;
}
return time - o.time;
}
}
}
......@@ -6,6 +6,11 @@ import org.junit.Assert;
import org.junit.Test;
import java.io.File;
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Arrays;
import static com.blankj.utilcode.util.TestConfig.PATH_ENCRYPT;
......@@ -520,6 +525,12 @@ public class EncryptUtilsTest extends BaseTest {
@Test
public void encryptDecryptRSA() {
try {
genKeyPair();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
System.out.println(EncodeUtils.base64Decode(publicKey.getBytes()).length);
assertTrue(
Arrays.equals(
EncryptUtils.decryptRSA(
......@@ -527,11 +538,11 @@ public class EncryptUtilsTest extends BaseTest {
dataRSA.getBytes(),
base64Decode(publicKey.getBytes()),
true,
"RSA/ECB/PKCS1Padding"
"RSA/ECB/NoPadding"
),
base64Decode(privateKey.getBytes()),
false,
"RSA/ECB/PKCS1Padding"
"RSA/ECB/NoPadding"
),
dataRSA.getBytes()
)
......@@ -580,4 +591,31 @@ public class EncryptUtilsTest extends BaseTest {
throw new IllegalArgumentException();
}
}
private static void genKeyPair() throws NoSuchAlgorithmException {
SecureRandom secureRandom = new SecureRandom();
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(1024, secureRandom);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
Key publicKey = keyPair.getPublic();
Key privateKey = keyPair.getPrivate();
byte[] publicKeyBytes = publicKey.getEncoded();
byte[] privateKeyBytes = privateKey.getEncoded();
String publicKeyBase64 = EncodeUtils.base64Encode2String(publicKeyBytes);
String privateKeyBase64 = EncodeUtils.base64Encode2String(privateKeyBytes);
System.out.println("publicKeyBase64.length():" + publicKeyBase64.length());
System.out.println("publicKeyBase64:" + publicKeyBase64);
System.out.println("privateKeyBase64.length():" + privateKeyBase64.length());
System.out.println("privateKeyBase64:" + privateKeyBase64);
}
}
\ No newline at end of file
......@@ -93,8 +93,6 @@ public class GsonUtilsTest extends BaseTest {
static class Person {
String name;
int gender;
String address;
Person(String name) {
this.name = name;
......
......@@ -118,10 +118,6 @@
android:name=".feature.bar.BarStatusImageViewActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop" />
<activity
android:name=".feature.bar.BarStatusSwipeBackActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop" />
<activity
android:name=".feature.brightness.BrightnessActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
......@@ -207,7 +203,8 @@
<activity
android:name=".feature.screen.ScreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop" />
android:launchMode="singleTop" >
</activity>
<activity
android:name=".feature.sdcard.SDCardActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
......
......@@ -54,10 +54,6 @@ class CoreUtilActivity : BaseTitleActivity() {
}
}
override fun isSwipeBack(): Boolean {
return false
}
override fun bindTitle(): CharSequence {
return getString(R.string.core_util)
}
......
......@@ -42,7 +42,6 @@ class BarActivity : BaseTitleActivity() {
barStatusSetImageViewBtn.setOnClickListener(this)
barStatusSetCustomBtn.setOnClickListener(this)
barStatusSetFragmentBtn.setOnClickListener(this)
barStatusSetSwipeBackBtn.setOnClickListener(this)
barStatusSetDrawerBtn.setOnClickListener(this)
barNotificationAboutBtn.setOnClickListener(this)
barNavAboutBtn.setOnClickListener(this)
......@@ -58,7 +57,6 @@ class BarActivity : BaseTitleActivity() {
R.id.barStatusSetImageViewBtn -> BarStatusImageViewActivity.start(this)
R.id.barStatusSetCustomBtn -> BarStatusCustomActivity.start(this)
R.id.barStatusSetFragmentBtn -> BarStatusFragmentActivity.start(this)
R.id.barStatusSetSwipeBackBtn -> BarStatusSwipeBackActivity.start(this)
R.id.barStatusSetDrawerBtn -> BarStatusDrawerActivity.start(this)
R.id.barNotificationAboutBtn -> BarNotificationActivity.start(this)
R.id.barNavAboutBtn -> BarNavActivity.start(this)
......
package com.blankj.utilcode.pkg.feature.bar
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.widget.CompoundButton
import android.widget.SeekBar
import com.blankj.lib.base.BaseActivity
import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.ColorUtils
import com.r0adkll.slidr.Slidr
import kotlinx.android.synthetic.main.activity_bar_status_swipe_back.*
/**
* ```
* author: Blankj
* blog : http://blankj.com
* time : 2017/05/27
* desc : demo about BarUtils
* ```
*/
class BarStatusSwipeBackActivity : BaseActivity() {
companion object {
fun start(context: Context) {
val starter = Intent(context, BarStatusSwipeBackActivity::class.java)
context.startActivity(starter)
}
}
private var mColor: Int = 0
private var mAlpha: Int = 0
private val mColorListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
mAlpha = progress
barStatusSwipeBackAboutTv.text = mAlpha.toString()
updateStatusBar()
}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {}
}
private var mCheckedChangeListener: CompoundButton.OnCheckedChangeListener = CompoundButton.OnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
barStatusSwipeBackChangeAlphaSb.visibility = View.VISIBLE
barStatusSwipeBackRandomColorBtn.visibility = View.GONE
barStatusSwipeBackSetTransparentBtn.visibility = View.VISIBLE
barStatusSwipeBackContainerLl.setBackgroundResource(R.drawable.image_lena)
} else {
barStatusSwipeBackChangeAlphaSb.visibility = View.GONE
barStatusSwipeBackRandomColorBtn.visibility = View.VISIBLE
barStatusSwipeBackSetTransparentBtn.visibility = View.GONE
barStatusSwipeBackContainerLl.setBackgroundColor(Color.WHITE)
}
updateStatusBar()
}
override fun isSwipeBack(): Boolean {
return true
}
override fun initData(bundle: Bundle?) {
mColor = ColorUtils.getColor(R.color.colorPrimary)
mAlpha = 112
}
override fun bindLayout(): Int {
return R.layout.activity_bar_status_swipe_back
}
override fun initView(savedInstanceState: Bundle?, contentView: View?) {
Slidr.attach(this)
barStatusSwipeBackAlphaCb.setOnCheckedChangeListener(mCheckedChangeListener)
barStatusSwipeBackChangeAlphaSb.setOnSeekBarChangeListener(mColorListener)
barStatusSwipeBackRandomColorBtn.setOnClickListener(this)
barStatusSwipeBackSetTransparentBtn.setOnClickListener(this)
barStatusSwipeBackSetTransparentBtn.visibility = View.GONE
updateStatusBar()
}
override fun doBusiness() {}
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.barStatusSwipeBackRandomColorBtn -> {
mColor = ColorUtils.getRandomColor()
updateStatusBar()
}
R.id.barStatusSwipeBackSetTransparentBtn -> barStatusSwipeBackChangeAlphaSb.progress = 0
}
}
private fun updateStatusBar() {
if (barStatusSwipeBackAlphaCb.isChecked) {
BarUtils.setStatusBarColor(this, Color.argb(mAlpha, 0, 0, 0))
barStatusSwipeBackAboutTv.text = mAlpha.toString()
} else {
BarUtils.setStatusBarColor(this, mColor)
barStatusSwipeBackAboutTv.text = ColorUtils.int2ArgbString(mColor)
}
BarUtils.addMarginTopEqualStatusBarHeight(barStatusSwipeBackAlphaCb)
}
}
......@@ -8,6 +8,7 @@ import android.view.View
import com.blankj.lib.base.BaseTitleActivity
import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.DeviceUtils
import com.blankj.utilcode.util.ScreenUtils
import com.blankj.utilcode.util.SpanUtils
import kotlinx.android.synthetic.main.activity_device.*
import java.util.*
......@@ -60,7 +61,9 @@ class DeviceActivity : BaseTitleActivity() {
.appendLine("getMacAddress: " + DeviceUtils.getMacAddress())
.appendLine("getManufacturer: " + DeviceUtils.getManufacturer())
.appendLine("getModel: " + DeviceUtils.getModel())
.append("getABIs: " + Arrays.asList(*DeviceUtils.getABIs()))
.appendLine("getABIs: " + Arrays.asList(*DeviceUtils.getABIs()))
.appendLine("isTablet: " + DeviceUtils.isTablet())
.append("isEmulator: " + DeviceUtils.isEmulator())
.create()
}
......
......@@ -104,8 +104,7 @@ class ScreenActivity : BaseTitleActivity() {
.appendLine("isPortrait: " + ScreenUtils.isPortrait())
.appendLine("getScreenRotation: " + ScreenUtils.getScreenRotation(this))
.appendLine("isScreenLock: " + ScreenUtils.isScreenLock())
.appendLine("getSleepDuration: " + ScreenUtils.getSleepDuration())
.append("isTablet: " + ScreenUtils.isTablet())
.append("getSleepDuration: " + ScreenUtils.getSleepDuration())
.create()
}
}
......@@ -56,13 +56,6 @@
android:layout_height="wrap_content"
android:text="@string/bar_status_set_fragment" />
<Button
android:id="@+id/barStatusSetSwipeBackBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bar_status_set_swipe_back" />
<Button
android:id="@+id/barStatusSetDrawerBtn"
style="@style/WideBtnStyle"
......
<?xml version="1.0" encoding="utf-8"?>
<com.blankj.lib.base.slideBack.SwipeLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/slideBackLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingLeft="@dimen/spacing_16"
android:paddingRight="@dimen/spacing_16"
tools:context=".feature.CoreUtilActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingLeft="@dimen/spacing_16"
android:paddingRight="@dimen/spacing_16">
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="activityClick"
android:text="@string/demo_activity" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="adaptScreenClick"
android:text="@string/demo_adapt_screen" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="appClick"
android:text="@string/demo_app" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="barClick"
android:text="@string/demo_bar" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="brightnessClick"
android:text="@string/demo_brightness" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="busClick"
android:text="@string/demo_bus" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="cleanClick"
android:text="@string/demo_clean" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="crashClick"
android:text="@string/demo_crash" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="deviceClick"
android:text="@string/demo_device" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="flashlightClick"
android:text="@string/demo_flashlight" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="fragmentClick"
android:text="@string/demo_fragment" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="imageClick"
android:text="@string/demo_image" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="keyboardClick"
android:text="@string/demo_keyboard" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="logClick"
android:text="@string/demo_log" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="metaDataClick"
android:text="@string/demo_meta_data" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="networkClick"
android:text="@string/demo_network" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="pathClick"
android:text="@string/demo_path" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="permissionClick"
android:text="@string/demo_permission" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="phoneClick"
android:text="@string/demo_phone" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="processClick"
android:text="@string/demo_process" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="reflectClick"
android:text="@string/demo_reflect" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="resourceClick"
android:text="@string/demo_resource" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="romClick"
android:text="@string/demo_rom" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="screenClick"
android:text="@string/demo_screen" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="sdcardClick"
android:text="@string/demo_sdcard" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="snackbarClick"
android:text="@string/demo_snackbar" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="spStaticClick"
android:text="@string/demo_spStatic" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="spannableClick"
android:text="@string/demo_span" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="toastClick"
android:text="@string/demo_toast" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="vibrateClick"
android:text="@string/demo_vibrate" />
</LinearLayout>
</com.blankj.lib.base.slideBack.SwipeLayout>
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="activityClick"
android:text="@string/demo_activity" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="adaptScreenClick"
android:text="@string/demo_adapt_screen" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="appClick"
android:text="@string/demo_app" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="barClick"
android:text="@string/demo_bar" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="brightnessClick"
android:text="@string/demo_brightness" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="busClick"
android:text="@string/demo_bus" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="cleanClick"
android:text="@string/demo_clean" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="crashClick"
android:text="@string/demo_crash" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="deviceClick"
android:text="@string/demo_device" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="flashlightClick"
android:text="@string/demo_flashlight" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="fragmentClick"
android:text="@string/demo_fragment" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="imageClick"
android:text="@string/demo_image" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="keyboardClick"
android:text="@string/demo_keyboard" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="logClick"
android:text="@string/demo_log" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="metaDataClick"
android:text="@string/demo_meta_data" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="networkClick"
android:text="@string/demo_network" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="pathClick"
android:text="@string/demo_path" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="permissionClick"
android:text="@string/demo_permission" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="phoneClick"
android:text="@string/demo_phone" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="processClick"
android:text="@string/demo_process" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="reflectClick"
android:text="@string/demo_reflect" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="resourceClick"
android:text="@string/demo_resource" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="romClick"
android:text="@string/demo_rom" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="screenClick"
android:text="@string/demo_screen" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="sdcardClick"
android:text="@string/demo_sdcard" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="snackbarClick"
android:text="@string/demo_snackbar" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="spStaticClick"
android:text="@string/demo_spStatic" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="spannableClick"
android:text="@string/demo_span" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="toastClick"
android:text="@string/demo_toast" />
<Button
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="vibrateClick"
android:text="@string/demo_vibrate" />
</LinearLayout>
......@@ -93,7 +93,6 @@
<string name="bar_status_set_image_view">Set Image View</string>
<string name="bar_status_set_custom">Set Custom</string>
<string name="bar_status_set_fragment">Set Fragment</string>
<string name="bar_status_set_swipe_back">Set Swipe Back</string>
<string name="bar_status_set_drawer">Set Drawer</string>
<string name="bar_status_random_color">Random Color</string>
<string name="bar_status_set_transparent">Set Transparent</string>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册