size = DisplayUtils.getScreenSize(this);
- layoutParams.width = size.first;
- layoutParams.height = psize.first;
- mBinding.inputH.setVisibility(View.VISIBLE);
- mBinding.checkout.setVisibility(View.GONE);
- }
- mBinding.videoView.setLayoutParams(layoutParams);
- }
-
- private void checkoutSystemUIMode(boolean isP){
- if(isP){
- getWindow().getDecorView().setSystemUiVisibility(0); //重置
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- StatusbarHelper.setStatusBarColor(this, Color.BLACK);
- }else{
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- Window window = getWindow();
- getWindow().getDecorView().setSystemUiVisibility(0);
- window.getDecorView().setSystemUiVisibility(
- window.getDecorView().getSystemUiVisibility() |
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION|
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
- }
- }
- }
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
- if(hasFocus && !DisplayUtil.isPortrait(this)){
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- Window window = getWindow();
- getWindow().getDecorView().setSystemUiVisibility(0);
- window.getDecorView().setSystemUiVisibility(
- window.getDecorView().getSystemUiVisibility() |
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION|
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION|
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
- }
- }
- }
-}
diff --git a/app/src/main/java/com/example/demo/systemui/QMUIDeviceHelper.java b/app/src/main/java/com/example/demo/systemui/QMUIDeviceHelper.java
deleted file mode 100644
index 6f221e0..0000000
--- a/app/src/main/java/com/example/demo/systemui/QMUIDeviceHelper.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package com.example.demo.systemui;
-
-import android.annotation.TargetApi;
-import android.app.AppOpsManager;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.os.Binder;
-import android.os.Build;
-import android.os.Environment;
-import android.support.annotation.Nullable;
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-
-/**
- * @author cginechen
- * @date 2016-08-11
- */
-public class QMUIDeviceHelper {
- private final static String TAG = "QMUIDeviceHelper";
- private final static String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name";
- private static final String KEY_FLYME_VERSION_NAME = "ro.build.display.id";
- private final static String FLYME = "flyme";
- private final static String ZTEC2016 = "zte c2016";
- private final static String ZUKZ1 = "zuk z1";
- private final static String MEIZUBOARD[] = {"m9", "M9", "mx", "MX"};
- private static String sMiuiVersionName;
- private static String sFlymeVersionName;
- private static boolean sIsTabletChecked = false;
- private static boolean sIsTabletValue = false;
-
- static {
- Properties properties = new Properties();
-
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
- // android 8.0,读取 /system/uild.prop 会报 permission denied
- FileInputStream fileInputStream = null;
- try {
- fileInputStream = new FileInputStream(new File(Environment.getRootDirectory(), "build.prop"));
- properties.load(fileInputStream);
- } catch (Exception e) {
- Log.e(TAG, e.getMessage());
- } finally {
- if (fileInputStream != null) {
- try {
- fileInputStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- Class> clzSystemProperties = null;
- try {
- clzSystemProperties = Class.forName("android.os.SystemProperties");
- Method getMethod = clzSystemProperties.getDeclaredMethod("get", String.class);
- // miui
- sMiuiVersionName = getLowerCaseName(properties, getMethod, KEY_MIUI_VERSION_NAME);
- //flyme
- sFlymeVersionName = getLowerCaseName(properties, getMethod, KEY_FLYME_VERSION_NAME);
- } catch (Exception e) {
- Log.e(TAG, e.getMessage());
- }
- }
-
- private static boolean _isTablet(Context context) {
- return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >=
- Configuration.SCREENLAYOUT_SIZE_LARGE;
- }
-
- /**
- * 判断是否为平板设备
- */
- public static boolean isTablet(Context context) {
- if (sIsTabletChecked) {
- return sIsTabletValue;
- }
- sIsTabletValue = _isTablet(context);
- sIsTabletChecked = true;
- return sIsTabletValue;
- }
-
- /**
- * 判断是否是flyme系统
- */
- public static boolean isFlyme() {
- return !TextUtils.isEmpty(sFlymeVersionName) && sFlymeVersionName.contains(FLYME);
- }
-
- /**
- * 判断是否是MIUI系统
- */
- public static boolean isMIUI() {
- return !TextUtils.isEmpty(sMiuiVersionName);
- }
-
- public static boolean isMIUIV5() {
- return "v5".equals(sMiuiVersionName);
- }
-
- public static boolean isMIUIV6() {
- return "v6".equals(sMiuiVersionName);
- }
-
- public static boolean isMIUIV7() {
- return "v7".equals(sMiuiVersionName);
- }
-
- public static boolean isMIUIV8() {
- return "v8".equals(sMiuiVersionName);
- }
-
- public static boolean isMIUIV9() {
- return "v9".equals(sMiuiVersionName);
- }
-
- public static boolean isFlymeVersionHigher5_2_4() {
- //查不到默认高于5.2.4
- boolean isHigher = true;
- if (sFlymeVersionName != null && !sFlymeVersionName.equals("")) {
- Pattern pattern = Pattern.compile("(\\d+\\.){2}\\d");
- Matcher matcher = pattern.matcher(sFlymeVersionName);
- if (matcher.find()) {
- String versionString = matcher.group();
- if (versionString != null && !versionString.equals("")) {
- String[] version = versionString.split("\\.");
- if (version.length == 3) {
- if (Integer.valueOf(version[0]) < 5) {
- isHigher = false;
- } else if (Integer.valueOf(version[0]) > 5) {
- isHigher = true;
- } else {
- if (Integer.valueOf(version[1]) < 2) {
- isHigher = false;
- } else if (Integer.valueOf(version[1]) > 2) {
- isHigher = true;
- } else {
- if (Integer.valueOf(version[2]) < 4) {
- isHigher = false;
- } else if (Integer.valueOf(version[2]) >= 5) {
- isHigher = true;
- }
- }
- }
- }
-
- }
- }
- }
- return isMeizu() && isHigher;
- }
-
- /**
- * 判断是否为魅族
- */
- public static boolean isMeizu() {
- return isPhone(MEIZUBOARD) || isFlyme();
- }
-
- /**
- * 判断是否为小米
- * https://dev.mi.com/doc/?p=254
- */
- public static boolean isXiaomi() {
- return Build.MANUFACTURER.toLowerCase().equals("xiaomi");
- }
-
-
- /**
- * 判断是否为 ZUK Z1 和 ZTK C2016。
- * 两台设备的系统虽然为 android 6.0,但不支持状态栏icon颜色改变,因此经常需要对它们进行额外判断。
- */
- public static boolean isZUKZ1() {
- final String board = Build.MODEL;
- return board != null && board.toLowerCase().contains(ZUKZ1);
- }
-
- public static boolean isZTKC2016() {
- final String board = Build.MODEL;
- return board != null && board.toLowerCase().contains(ZTEC2016);
- }
-
- private static boolean isPhone(String[] boards) {
- final String board = Build.BOARD;
- if (board == null) {
- return false;
- }
- for (String board1 : boards) {
- if (board.equals(board1)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * 判断悬浮窗权限(目前主要用户魅族与小米的检测)。
- */
- public static boolean isFloatWindowOpAllowed(Context context) {
- final int version = Build.VERSION.SDK_INT;
- if (version >= 19) {
- return checkOp(context, 24); // 24 是AppOpsManager.OP_SYSTEM_ALERT_WINDOW 的值,该值无法直接访问
- } else {
- try {
- return (context.getApplicationInfo().flags & 1 << 27) == 1 << 27;
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- }
- }
-
- @TargetApi(19)
- private static boolean checkOp(Context context, int op) {
- final int version = Build.VERSION.SDK_INT;
- if (version >= Build.VERSION_CODES.KITKAT) {
- AppOpsManager manager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
- try {
- Method method = manager.getClass().getDeclaredMethod("checkOp", int.class, int.class, String.class);
- int property = (Integer) method.invoke(manager, op,
- Binder.getCallingUid(), context.getPackageName());
- return AppOpsManager.MODE_ALLOWED == property;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return false;
- }
-
- @Nullable
- private static String getLowerCaseName(Properties p, Method get, String key) {
- String name = p.getProperty(key);
- if (name == null) {
- try {
- name = (String) get.invoke(null, key);
- } catch (Exception ignored) {
- }
- }
- if (name != null) name = name.toLowerCase();
- return name;
- }
-}
-
diff --git a/app/src/main/java/com/example/demo/systemui/QMUIDisplayHelper.java b/app/src/main/java/com/example/demo/systemui/QMUIDisplayHelper.java
deleted file mode 100644
index fc17082..0000000
--- a/app/src/main/java/com/example/demo/systemui/QMUIDisplayHelper.java
+++ /dev/null
@@ -1,358 +0,0 @@
-package com.example.demo.systemui;
-
-import android.Manifest;
-import android.app.Activity;
-import android.content.Context;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Point;
-import android.net.ConnectivityManager;
-import android.os.Build;
-import android.os.Environment;
-import android.support.annotation.RequiresPermission;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.Display;
-import android.view.KeyCharacterMap;
-import android.view.KeyEvent;
-import android.view.ViewConfiguration;
-import android.view.WindowManager;
-
-import java.lang.reflect.Field;
-import java.util.Locale;
-
-
-/**
- * @author cginechen
- * @date 2016-03-17
- */
-public class QMUIDisplayHelper {
-
- /**
- * 屏幕密度,系统源码注释不推荐使用
- */
- public static final float DENSITY = Resources.getSystem()
- .getDisplayMetrics().density;
- private static final String TAG = "Devices";
- /**
- * 屏幕密度
- */
- public static float sDensity = 0f;
- /**
- * 是否有摄像头
- */
- private static Boolean sHasCamera = null;
-
- /**
- * 获取 DisplayMetrics
- *
- * @return
- */
- public static DisplayMetrics getDisplayMetrics(Context context) {
- DisplayMetrics displayMetrics = new DisplayMetrics();
- ((WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE))
- .getDefaultDisplay().getMetrics(displayMetrics);
- return displayMetrics;
- }
-
- /**
- * 把以 dp 为单位的值,转化为以 px 为单位的值
- *
- * @param dpValue 以 dp 为单位的值
- * @return px value
- */
- public static int dpToPx(int dpValue) {
- return (int) (dpValue * DENSITY + 0.5f);
- }
-
- /**
- * 把以 px 为单位的值,转化为以 dp 为单位的值
- *
- * @param pxValue 以 px 为单位的值
- * @return dp值
- */
- public static int pxToDp(float pxValue) {
- return (int) (pxValue / DENSITY + 0.5f);
- }
-
- public static float getDensity(Context context) {
- if (sDensity == 0f) {
- sDensity = getDisplayMetrics(context).density;
- }
- return sDensity;
- }
-
- /**
- * 获取屏幕宽度
- *
- * @return
- */
- public static int getScreenWidth(Context context) {
- return getDisplayMetrics(context).widthPixels;
- }
-
- /**
- * 获取屏幕高度
- *
- * @return
- */
- public static int getScreenHeight(Context context) {
- return getDisplayMetrics(context).heightPixels;
- }
-
- /**
- * 获取屏幕的真实宽高
- *
- * @param context
- * @return
- */
- public static int[] getRealScreenSize(Context context) {
- int[] size = new int[2];
- int widthPixels = 0, heightPixels = 0;
- WindowManager w = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
- Display d = w.getDefaultDisplay();
- DisplayMetrics metrics = new DisplayMetrics();
- d.getMetrics(metrics);
- // since SDK_INT = 1;
- widthPixels = metrics.widthPixels;
- heightPixels = metrics.heightPixels;
- try {
- // used when 17 > SDK_INT >= 14; includes window decorations (statusbar bar/menu bar)
- widthPixels = (Integer) Display.class.getMethod("getRawWidth").invoke(d);
- heightPixels = (Integer) Display.class.getMethod("getRawHeight").invoke(d);
- } catch (Exception ignored) {
- }
- try {
- // used when SDK_INT >= 17; includes window decorations (statusbar bar/menu bar)
- Point realSize = new Point();
- d.getRealSize(realSize);
-
-
- Display.class.getMethod("getRealSize", Point.class).invoke(d, realSize);
- widthPixels = realSize.x;
- heightPixels = realSize.y;
- } catch (Exception ignored) {
- }
-
- size[0] = widthPixels;
- size[1] = heightPixels;
- return size;
-
- }
-
- public static boolean isNavMenuExist(Context context) {
- //通过判断设备是否有返回键、菜单键(不是虚拟键,是手机屏幕外的按键)来确定是否有navigation bar
- boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
- boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
-
- if (!hasMenuKey && !hasBackKey) {
- // 做任何你需要做的,这个设备有一个导航栏
- return true;
- }
- return false;
- }
-
- /**
- * 单位转换: dp -> px
- *
- * @param dp
- * @return
- */
- public static int dp2px(Context context, int dp) {
- return (int) (getDensity(context) * dp + 0.5);
- }
-
- /**
- * 单位转换:px -> dp
- *
- * @param px
- * @return
- */
- public static int px2dp(Context context, int px) {
- return (int) (px / getDensity(context) + 0.5);
- }
-
- /**
- * 判断是否有状态栏
- *
- * @param context
- * @return
- */
- public static boolean hasStatusBar(Context context) {
- if (context instanceof Activity) {
- Activity activity = (Activity) context;
- WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
- return (attrs.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != WindowManager.LayoutParams.FLAG_FULLSCREEN;
- }
- return true;
- }
-
- /**
- * 获取ActionBar高度
- *
- * @param context
- * @return
- */
- public static int getActionBarHeight(Context context) {
- int actionBarHeight = 0;
- TypedValue tv = new TypedValue();
- if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
- actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,
- context.getResources().getDisplayMetrics());
- }
- return actionBarHeight;
- }
-
- /**
- * 获取状态栏高度
- *
- * @param context
- * @return
- */
- public static int getStatusBarHeight(Context context) {
- Class> c;
- Object obj;
- Field field;
- int x;
- try {
- c = Class.forName("com.android.internal.R$dimen");
- obj = c.newInstance();
- field = c.getField("status_bar_height");
- x = Integer.parseInt(field.get(obj).toString());
- return context.getResources()
- .getDimensionPixelSize(x);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return 0;
- }
-
- /**
- * 获取虚拟菜单的高度,若无则返回0
- *
- * @param context
- * @return
- */
- public static int getNavMenuHeight(Context context) {
- if(!isNavMenuExist(context)){
- return 0;
- }
- // 小米4没有nav bar, 而 navigation_bar_height 有值
- int resourceId = context.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
- if (resourceId > 0) {
- return context.getResources().getDimensionPixelSize(resourceId);
- }
-
- // 小米 MIX 有nav bar, 而 getRealScreenSize(context)[1] - getScreenHeight(context) = 0
- return getRealScreenSize(context)[1] - getScreenHeight(context);
- }
-
- public static final boolean hasCamera(Context context) {
- if (sHasCamera == null) {
- PackageManager pckMgr = context.getPackageManager();
- boolean flag = pckMgr
- .hasSystemFeature("android.hardware.camera.front");
- boolean flag1 = pckMgr.hasSystemFeature("android.hardware.camera");
- boolean flag2;
- flag2 = flag || flag1;
- sHasCamera = flag2;
- }
- return sHasCamera;
- }
-
- /**
- * 是否有硬件menu
- *
- * @param context
- * @return
- */
- @SuppressWarnings("SimplifiableIfStatement")
- public static boolean hasHardwareMenuKey(Context context) {
- boolean flag;
- if (Build.VERSION.SDK_INT < 11)
- flag = true;
- else if (Build.VERSION.SDK_INT >= 14) {
- flag = ViewConfiguration.get(context).hasPermanentMenuKey();
- } else
- flag = false;
- return flag;
- }
-
-
- /**
- * 判断是否存在pckName包
- *
- * @param pckName
- * @return
- */
- public static boolean isPackageExist(Context context, String pckName) {
- try {
- PackageInfo pckInfo = context.getPackageManager()
- .getPackageInfo(pckName, 0);
- if (pckInfo != null)
- return true;
- } catch (PackageManager.NameNotFoundException ignored) {
- }
- return false;
- }
-
- /**
- * 判断 SD Card 是否 ready
- *
- * @return
- */
- public static boolean isSdcardReady() {
- return Environment.MEDIA_MOUNTED.equals(Environment
- .getExternalStorageState());
- }
-
-
- /**
- * 设置全屏
- *
- * @param context
- */
- public static void setFullScreen(Context context) {
- if (context instanceof Activity) {
- Activity activity = (Activity) context;
- WindowManager.LayoutParams params = activity.getWindow().getAttributes();
- params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
- activity.getWindow().setAttributes(params);
- activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
- }
-
- }
-
- /**
- * 取消全屏
- *
- * @param context
- */
- public static void cancelFullScreen(Context context) {
- if (context instanceof Activity) {
- Activity activity = (Activity) context;
- WindowManager.LayoutParams params = activity.getWindow().getAttributes();
- params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
- activity.getWindow().setAttributes(params);
- activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
- }
- }
-
- /**
- * 判断是否全屏
- *
- * @param activity
- * @return
- */
- public static boolean isFullScreen(Activity activity) {
- WindowManager.LayoutParams params = activity.getWindow().getAttributes();
- return (params.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN;
- }
-
-
- public static boolean isElevationSupported() {
- return Build.VERSION.SDK_INT >= 21;
- }
-}
diff --git a/app/src/main/java/com/example/demo/systemui/QMUIStatusBarHelper.java b/app/src/main/java/com/example/demo/systemui/QMUIStatusBarHelper.java
deleted file mode 100644
index 330358f..0000000
--- a/app/src/main/java/com/example/demo/systemui/QMUIStatusBarHelper.java
+++ /dev/null
@@ -1,423 +0,0 @@
-package com.example.demo.systemui;
-
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.content.Context;
-import android.os.Build;
-import android.support.annotation.ColorInt;
-import android.support.annotation.IntDef;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-
-/**
- * @author cginechen
- * @date 2016-03-27
- */
-public class QMUIStatusBarHelper {
-
- private final static int STATUSBAR_TYPE_DEFAULT = 0;
- private final static int STATUSBAR_TYPE_MIUI = 1;
- private final static int STATUSBAR_TYPE_FLYME = 2;
- private final static int STATUSBAR_TYPE_ANDROID6 = 3; // Android 6.0
- private final static int STATUS_BAR_DEFAULT_HEIGHT_DP = 25; // 大部分状态栏都是25dp
- // 在某些机子上存在不同的density值,所以增加两个虚拟值
- public static float sVirtualDensity = -1;
- public static float sVirtualDensityDpi = -1;
- private static int sStatusbarHeight = -1;
- private static @StatusBarType
- int mStatuBarType = STATUSBAR_TYPE_DEFAULT;
- private static Integer sTransparentValue;
-
- public static void translucent(Activity activity) {
- translucent(activity, 0x40000000);
- }
-
- /**
- * 沉浸式状态栏。
- * 支持 4.4 以上版本的 MIUI 和 Flyme,以及 5.0 以上版本的其他 Android。
- *
- * @param activity 需要被设置沉浸式状态栏的 Activity。
- */
- @TargetApi(19)
- public static void translucent(Activity activity, @ColorInt int colorOn5x) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
- // 版本小于4.4,绝对不考虑沉浸式
- return;
- }
- // 小米和魅族4.4 以上版本支持沉浸式
- if (QMUIDeviceHelper.isMeizu() || QMUIDeviceHelper.isMIUI()) {
- Window window = activity.getWindow();
- window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
- WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- return;
- }
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- Window window = activity.getWindow();
- window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && supportTransclentStatusBar6()) {
- // android 6以后可以改状态栏字体颜色,因此可以自行设置为透明
- // ZUK Z1是个另类,自家应用可以实现字体颜色变色,但没开放接口
- window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- window.setStatusBarColor(colorOn5x);
- } else {
- // android 5不能修改状态栏字体颜色,因此直接用FLAG_TRANSLUCENT_STATUS,nexus表现为半透明
- // 魅族和小米的表现如何?
- // update: 部分手机运用FLAG_TRANSLUCENT_STATUS时背景不是半透明而是没有背景了。。。。。
-// window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
-
- // 采取setStatusBarColor的方式,部分机型不支持,那就纯黑了,保证状态栏图标可见
- window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- window.setStatusBarColor(colorOn5x);
- }
-// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-// // android4.4的默认是从上到下黑到透明,我们的背景是白色,很难看,因此只做魅族和小米的
-// } else if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1){
-// // 如果app 为白色,需要更改状态栏颜色,因此不能让19一下支持透明状态栏
-// Window window = activity.getWindow();
-// Integer transparentValue = getStatusBarAPITransparentValue(activity);
-// if(transparentValue != null) {
-// window.getDecorView().setSystemUiVisibility(transparentValue);
-// }
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- Window mWindow = activity.getWindow();
- mWindow.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- SystemBarTintManager mTintManager = new SystemBarTintManager(activity);
- mTintManager.setStatusBarTintEnabled(true);
- mTintManager.setStatusBarTintColor(colorOn5x);
- }
- }
-
- /**
- * 设置状态栏黑色字体图标,
- * 支持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android
- *
- * @param activity 需要被处理的 Activity
- */
- public static boolean setStatusBarLightMode(Activity activity) {
- if (activity == null) return false;
- // 无语系列:ZTK C2016只能时间和电池图标变色。。。。
- if (QMUIDeviceHelper.isZTKC2016()) {
- return false;
- }
-
- if (mStatuBarType != STATUSBAR_TYPE_DEFAULT) {
- return setStatusBarLightMode(activity, mStatuBarType);
- }
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- if (isMIUICustomStatusBarLightModeImpl() && MIUISetStatusBarLightMode(activity.getWindow(), true)) {
- mStatuBarType = STATUSBAR_TYPE_MIUI;
- return true;
- } else if (FlymeSetStatusBarLightMode(activity.getWindow(), true)) {
- mStatuBarType = STATUSBAR_TYPE_FLYME;
- return true;
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- Android6SetStatusBarLightMode(activity.getWindow(), true);
- mStatuBarType = STATUSBAR_TYPE_ANDROID6;
- return true;
- }
- }
- return false;
- }
-
- /**
- * 已知系统类型时,设置状态栏黑色字体图标。
- * 支持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android
- *
- * @param activity 需要被处理的 Activity
- * @param type StatusBar 类型,对应不同的系统
- */
- private static boolean setStatusBarLightMode(Activity activity, @StatusBarType int type) {
- if (type == STATUSBAR_TYPE_MIUI) {
- return MIUISetStatusBarLightMode(activity.getWindow(), true);
- } else if (type == STATUSBAR_TYPE_FLYME) {
- return FlymeSetStatusBarLightMode(activity.getWindow(), true);
- } else if (type == STATUSBAR_TYPE_ANDROID6) {
- return Android6SetStatusBarLightMode(activity.getWindow(), true);
- }
- return false;
- }
-
-
- /**
- * 设置状态栏白色字体图标
- * 支持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android
- */
- public static boolean setStatusBarDarkMode(Activity activity) {
- if (activity == null) return false;
- if (mStatuBarType == STATUSBAR_TYPE_DEFAULT) {
- // 默认状态,不需要处理
- return true;
- }
-
- if (mStatuBarType == STATUSBAR_TYPE_MIUI) {
- return MIUISetStatusBarLightMode(activity.getWindow(), false);
- } else if (mStatuBarType == STATUSBAR_TYPE_FLYME) {
- return FlymeSetStatusBarLightMode(activity.getWindow(), false);
- } else if (mStatuBarType == STATUSBAR_TYPE_ANDROID6) {
- return Android6SetStatusBarLightMode(activity.getWindow(), false);
- }
- return true;
- }
-
- @TargetApi(23)
- private static int changeStatusBarModeRetainFlag(Window window, int out) {
- out = retainSystemUiFlag(window, out, View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
- out = retainSystemUiFlag(window, out, View.SYSTEM_UI_FLAG_FULLSCREEN);
- out = retainSystemUiFlag(window, out, View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
- out = retainSystemUiFlag(window, out, View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
- out = retainSystemUiFlag(window, out, View.SYSTEM_UI_FLAG_IMMERSIVE);
- out = retainSystemUiFlag(window, out, View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
- out = retainSystemUiFlag(window, out, View.SYSTEM_UI_FLAG_LOW_PROFILE);
- return out;
- }
-
- public static int retainSystemUiFlag(Window window, int out, int type) {
- int now = window.getDecorView().getSystemUiVisibility();
- if ((now & type) == type) {
- out |= type;
- }
- return out;
- }
-
-
- /**
- * 设置状态栏字体图标为深色,Android 6
- *
- * @param window 需要设置的窗口
- * @param light 是否把状态栏字体及图标颜色设置为深色
- * @return boolean 成功执行返回true
- */
- @TargetApi(23)
- private static boolean Android6SetStatusBarLightMode(Window window, boolean light) {
- View decorView = window.getDecorView();
- int systemUi = light ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
- systemUi = changeStatusBarModeRetainFlag(window, systemUi);
- decorView.setSystemUiVisibility(systemUi);
- if (QMUIDeviceHelper.isMIUIV9()) {
- // MIUI 9 低于 6.0 版本依旧只能回退到以前的方案
- // https://github.com/QMUI/QMUI_Android/issues/160
- MIUISetStatusBarLightMode(window, light);
- }
- return true;
- }
-
- /**
- * 设置状态栏字体图标为深色,需要 MIUIV6 以上
- *
- * @param window 需要设置的窗口
- * @param dark 是否把状态栏字体及图标颜色设置为深色
- * @return boolean 成功执行返回 true
- */
- @SuppressWarnings("unchecked")
- public static boolean MIUISetStatusBarLightMode(Window window, boolean dark) {
- boolean result = false;
- if (window != null) {
- Class clazz = window.getClass();
- try {
- int darkModeFlag;
- Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
- Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
- darkModeFlag = field.getInt(layoutParams);
- Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
- if (dark) {
- extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
- } else {
- extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
- }
- result = true;
- } catch (Exception ignored) {
-
- }
- }
- return result;
- }
-
- /**
- * 更改状态栏图标、文字颜色的方案是否是MIUI自家的, MIUI9之后用回Android原生实现
- * 见小米开发文档说明:https://dev.mi.com/console/doc/detail?pId=1159
- */
- private static boolean isMIUICustomStatusBarLightModeImpl() {
- if (QMUIDeviceHelper.isMIUIV9() && Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
- return true;
- }
- return QMUIDeviceHelper.isMIUIV5() || QMUIDeviceHelper.isMIUIV6() ||
- QMUIDeviceHelper.isMIUIV7() || QMUIDeviceHelper.isMIUIV8();
- }
-
- /**
- * 设置状态栏图标为深色和魅族特定的文字风格
- * 可以用来判断是否为 Flyme 用户
- *
- * @param window 需要设置的窗口
- * @param dark 是否把状态栏字体及图标颜色设置为深色
- * @return boolean 成功执行返回true
- */
- public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
-
- // flyme 在 6.2.0.0A 支持了 Android 官方的实现方案,旧的方案失效
- Android6SetStatusBarLightMode(window, dark);
-
- boolean result = false;
- if (window != null) {
- try {
- WindowManager.LayoutParams lp = window.getAttributes();
- Field darkFlag = WindowManager.LayoutParams.class
- .getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
- Field meizuFlags = WindowManager.LayoutParams.class
- .getDeclaredField("meizuFlags");
- darkFlag.setAccessible(true);
- meizuFlags.setAccessible(true);
- int bit = darkFlag.getInt(null);
- int value = meizuFlags.getInt(lp);
- if (dark) {
- value |= bit;
- } else {
- value &= ~bit;
- }
- meizuFlags.setInt(lp, value);
- window.setAttributes(lp);
- result = true;
- } catch (Exception ignored) {
-
- }
- }
- return result;
- }
-
- /**
- * 获取是否全屏
- *
- * @return 是否全屏
- */
- public static boolean isFullScreen(Activity activity) {
- boolean ret = false;
- try {
- WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
- ret = (attrs.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return ret;
- }
-
- /**
- * API19之前透明状态栏:获取设置透明状态栏的system ui visibility的值,这是部分有提供接口的rom使用的
- * http://stackoverflow.com/questions/21865621/transparent-status-bar-before-4-4-kitkat
- */
- public static Integer getStatusBarAPITransparentValue(Context context) {
- if (sTransparentValue != null) {
- return sTransparentValue;
- }
- String[] systemSharedLibraryNames = context.getPackageManager()
- .getSystemSharedLibraryNames();
- String fieldName = null;
- for (String lib : systemSharedLibraryNames) {
- if ("touchwiz".equals(lib)) {
- fieldName = "SYSTEM_UI_FLAG_TRANSPARENT_BACKGROUND";
- } else if (lib.startsWith("com.sonyericsson.navigationbar")) {
- fieldName = "SYSTEM_UI_FLAG_TRANSPARENT";
- }
- }
-
- if (fieldName != null) {
- try {
- Field field = View.class.getField(fieldName);
- if (field != null) {
- Class> type = field.getType();
- if (type == int.class) {
- sTransparentValue = field.getInt(null);
- }
- }
- } catch (Exception ignored) {
- }
- }
- return sTransparentValue;
- }
-
- /**
- * 检测 Android 6.0 是否可以启用 window.setStatusBarColor(Color.TRANSPARENT)。
- */
- public static boolean supportTransclentStatusBar6() {
- return !(QMUIDeviceHelper.isZUKZ1() || QMUIDeviceHelper.isZTKC2016());
- }
-
- /**
- * 获取状态栏的高度。
- */
- public static int getStatusbarHeight(Context context) {
- if (sStatusbarHeight == -1) {
- initStatusBarHeight(context);
- }
- return sStatusbarHeight;
- }
-
- private static void initStatusBarHeight(Context context) {
- Class> clazz;
- Object obj = null;
- Field field = null;
- try {
- clazz = Class.forName("com.android.internal.R$dimen");
- obj = clazz.newInstance();
- if (QMUIDeviceHelper.isMeizu()) {
- try {
- field = clazz.getField("status_bar_height_large");
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
- if (field == null) {
- field = clazz.getField("status_bar_height");
- }
- } catch (Throwable t) {
- t.printStackTrace();
- }
- if (field != null && obj != null) {
- try {
- int id = Integer.parseInt(field.get(obj).toString());
- sStatusbarHeight = context.getResources().getDimensionPixelSize(id);
- } catch (Throwable t) {
- t.printStackTrace();
- }
- }
- if (QMUIDeviceHelper.isTablet(context)
- && sStatusbarHeight > QMUIDisplayHelper.dp2px(context, STATUS_BAR_DEFAULT_HEIGHT_DP)) {
- //状态栏高度大于25dp的平板,状态栏通常在下方
- sStatusbarHeight = 0;
- } else {
- if (sStatusbarHeight <= 0
- || sStatusbarHeight > QMUIDisplayHelper.dp2px(context, STATUS_BAR_DEFAULT_HEIGHT_DP * 2)) {
- //安卓默认状态栏高度为25dp,如果获取的状态高度大于2倍25dp的话,这个数值可能有问题,用回桌面定义的值从新获取。出现这种可能性较低,只有小部分手机出现
- if (sVirtualDensity == -1) {
- sStatusbarHeight = QMUIDisplayHelper.dp2px(context, STATUS_BAR_DEFAULT_HEIGHT_DP);
- } else {
- sStatusbarHeight = (int) (STATUS_BAR_DEFAULT_HEIGHT_DP * sVirtualDensity + 0.5f);
- }
- }
- }
- }
-
- public static void setVirtualDensity(float density) {
- sVirtualDensity = density;
- }
-
- public static void setVirtualDensityDpi(float densityDpi) {
- sVirtualDensityDpi = densityDpi;
- }
-
- @IntDef({STATUSBAR_TYPE_DEFAULT, STATUSBAR_TYPE_MIUI, STATUSBAR_TYPE_FLYME, STATUSBAR_TYPE_ANDROID6})
- @Retention(RetentionPolicy.SOURCE)
- private @interface StatusBarType {
- }
-
-}
diff --git a/app/src/main/java/com/example/demo/systemui/StatusBarView.java b/app/src/main/java/com/example/demo/systemui/StatusBarView.java
deleted file mode 100644
index d32bcb0..0000000
--- a/app/src/main/java/com/example/demo/systemui/StatusBarView.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.example.demo.systemui;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.os.Build;
-import android.support.annotation.ColorRes;
-import android.support.annotation.Nullable;
-import android.support.v4.content.ContextCompat;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.LinearLayout;
-
-import com.effective.R;
-
-import java.lang.reflect.Field;
-
-/**
- * 状态栏view
- * Created by yummylau on 2017/9/09.
- */
-
-public class StatusBarView extends LinearLayout {
-
- @ColorRes
- private int mStatusBarColor;
-
- public StatusBarView(Context context) {
- this(context, null);
- }
-
- public StatusBarView(Context context, @Nullable AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public StatusBarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- initView(attrs, defStyleAttr);
- }
-
- private void initView(AttributeSet attrs, int defStyle) {
- View view = LayoutInflater.from(getContext()).inflate(R.layout.view_status_bar_layout, this, true);
- final TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.StatusBarView, defStyle, 0);
- if (typedArray != null) {
- mStatusBarColor = typedArray.getResourceId(R.styleable.StatusBarView_status_bar_color, R.color.colorPrimary);
- } else {
- mStatusBarColor = R.color.colorPrimary;
- }
- setBackgroundColor(ContextCompat.getColor(getContext(), mStatusBarColor));
- view.findViewById(R.id.status_bar).setMinimumHeight(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? getStatusBarHeight(getContext()) : 0);
- }
-
- public void setColor(@ColorRes int statusBarColor) {
- mStatusBarColor = statusBarColor;
- setBackgroundColor(ContextCompat.getColor(getContext(), mStatusBarColor));
- }
-
-
- public static int getStatusBarHeight(Context context) {
- int sbar = 0;
- try {
- Class c = Class.forName("com.android.internal.R$dimen");
- Object obj = c.newInstance();
- Field field = c.getField("status_bar_height");
- int x = Integer.parseInt(field.get(obj).toString());
- sbar = context.getResources().getDimensionPixelSize(x);
- } catch (Exception var7) {
- var7.printStackTrace();
- }
- return sbar;
- }
-}
diff --git a/app/src/main/java/com/example/demo/systemui/StatusbarHelper.java b/app/src/main/java/com/example/demo/systemui/StatusbarHelper.java
deleted file mode 100644
index 1774414..0000000
--- a/app/src/main/java/com/example/demo/systemui/StatusbarHelper.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.example.demo.systemui;
-
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.graphics.Color;
-import android.os.Build;
-import android.support.annotation.ColorInt;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
-
-
-/**
- * 状态栏 统一处理入口
- * 第三方库持续更新,作为与应用层交互类
- * 沉浸式策略:支持 4.4 以上版本的 MIUI 和 Flyme,以及 5.0 以上版本的其他 Android
- * 设置状态栏黑色字体图标:支持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android
- * 设置状态栏白色字体图标:支持 4.4 以上版本 MIUI 和 Flyme,以及 6.0 以上版本的其他 Android
- *
- * 分离主题色和状态栏颜色,主题色主要用于控制状态栏字体是否发生变化,比如说状态栏透明情况下,主题色由其页面底色决定,可以通过场景理解。
- *
- * 业务场景场景设置:
- * 1. 状态栏和标题栏都为纯色,技术上实现可分为两种,一种是状态栏透明,标题栏的高度增加状态栏高度,第二种是状态栏着色,标题栏与状态栏同色,高度为业务高度,此时 themeColor 和 statusBarColor一样
- * 2. 状态栏和标题栏不为纯色(比如是一张背景图),技术上实现为状态栏透明,底色用一张图处理,是否改变状态栏字体由图片的颜色来决定themeColor
- *
- * Email yummyl.lau@gmail.com
- * Created by yummylau on 2018/01/25.
- */
-
-public class StatusbarHelper {
-
- public static void translucentStatusBar(Activity activity) {
- QMUIStatusBarHelper.translucent(activity);
- }
-
- public static void setStatusBarColor(Activity activity,
- int statusBarColor, @ColorInt int themeColor) {
- colorStatusBar(activity, statusBarColor);
- if (isNearWhiteColor(themeColor)) {
- QMUIStatusBarHelper.setStatusBarLightMode(activity);
- } else {
- QMUIStatusBarHelper.setStatusBarDarkMode(activity);
- }
- }
-
- public static void setStatusBarColor(Activity activity, @ColorInt int statusBarColor, boolean isNearWhiteColor) {
- colorStatusBar(activity, statusBarColor);
- if (isNearWhiteColor) {
- QMUIStatusBarHelper.setStatusBarLightMode(activity);
- } else {
- QMUIStatusBarHelper.setStatusBarDarkMode(activity);
- }
- }
-
- public static void setStatusBarColor(Activity activity, @ColorInt int statusBarColor) {
- if (isNearWhiteColor(statusBarColor)) {
- if (QMUIStatusBarHelper.setStatusBarLightMode(activity)) {
- colorStatusBar(activity, statusBarColor);
- }
- } else {
- if (QMUIStatusBarHelper.setStatusBarDarkMode(activity)) {
- colorStatusBar(activity, statusBarColor);
- }
- }
- }
-
- @TargetApi(19)
- private static void colorStatusBar(Activity activity, @ColorInt int statusBarColor) {
- // 部分三星机型在window.getDecorView() NPE 崩溃,可能是此时Activity onCreate,部分drawable为空
- try {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
- // 版本小于4.4,绝对不考虑沉浸式
- return;
- }
- // 小米和魅族4.4 以上版本支持沉浸式
- if (QMUIDeviceHelper.isMeizu() || QMUIDeviceHelper.isMIUI()) {
- Window window = activity.getWindow();
- window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
- WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- return;
- }
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- Window window = activity.getWindow();
- window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && QMUIStatusBarHelper.supportTransclentStatusBar6()) {
- // android 6以后可以改状态栏字体颜色,因此可以自行设置为透明
- // ZUK Z1是个另类,自家应用可以实现字体颜色变色,但没开放接口
- window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- window.setStatusBarColor(statusBarColor);
- } else {
- window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- window.setStatusBarColor(statusBarColor);
- }
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- Window mWindow = activity.getWindow();
- mWindow.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
- SystemBarTintManager mTintManager = new SystemBarTintManager(activity);
- mTintManager.setStatusBarTintEnabled(true);
- mTintManager.setStatusBarTintColor(statusBarColor);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- public static boolean isNearWhiteColor(@ColorInt int color) {
- int alpha = Color.alpha(color);
- int red = Color.red(color);
- int green = Color.green(color);
- int blue = Color.blue(color);
- return alpha >= 255 * 0.7
- && red >= 255 * 0.7
- && green >= 255 * 0.7
- && blue >= 255 * 0.7;
- }
-
-}
diff --git a/app/src/main/java/com/example/demo/systemui/SystemBarTintManager.java b/app/src/main/java/com/example/demo/systemui/SystemBarTintManager.java
deleted file mode 100755
index 43a6249..0000000
--- a/app/src/main/java/com/example/demo/systemui/SystemBarTintManager.java
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * Copyright (C) 2013 readyState Software Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.demo.systemui;
-
-import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
-import android.widget.FrameLayout.LayoutParams;
-
-import java.lang.reflect.Method;
-
-/**
- * Class to manage status and navigation bar tint effects when using KitKat
- * translucent system UI modes.
- */
-@SuppressWarnings("unchecked")
-public class SystemBarTintManager {
-
- static {
- // Android allows a system property to override the presence of the navigation bar.
- // Used by the emulator.
- // See https://github.com/android/platform_frameworks_base/blob/master/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java#L1076
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- try {
- Class c = Class.forName("android.os.SystemProperties");
- Method m = c.getDeclaredMethod("get", String.class);
- m.setAccessible(true);
- sNavBarOverride = (String) m.invoke(null, "qemu.hw.mainkeys");
- } catch (Throwable e) {
- sNavBarOverride = null;
- }
- }
- }
-
- /**
- * The default system bar tint color value.
- */
- public static final int DEFAULT_TINT_COLOR = 0x99000000;
-
- private static String sNavBarOverride;
-
- private final SystemBarConfig mConfig;
- private boolean mStatusBarAvailable;
- private boolean mNavBarAvailable;
- private boolean mStatusBarTintEnabled;
- private boolean mNavBarTintEnabled;
- private View mStatusBarTintView;
- private View mNavBarTintView;
-
- /**
- * Constructor. Call this in the host activity onCreate method after its
- * content view has been set. You should always create new instances when
- * the host activity is recreated.
- *
- * @param activity The host activity.
- */
- @SuppressLint("ResourceType")
- @TargetApi(19)
- public SystemBarTintManager(Activity activity) {
-
- Window win = activity.getWindow();
- ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- // check theme attrs
- int[] attrs = {android.R.attr.windowTranslucentStatus, android.R.attr.windowTranslucentNavigation};
- TypedArray a = activity.obtainStyledAttributes(attrs);
- try {
- mStatusBarAvailable = a.getBoolean(0, false);
- mNavBarAvailable = a.getBoolean(1, false);
- } finally {
- a.recycle();
- }
-
- // check window flags
- WindowManager.LayoutParams winParams = win.getAttributes();
- int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
- if ((winParams.flags & bits) != 0) {
- mStatusBarAvailable = true;
- }
- bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
- if ((winParams.flags & bits) != 0) {
- mNavBarAvailable = true;
- }
- }
-
- mConfig = new SystemBarConfig(activity, mStatusBarAvailable, mNavBarAvailable);
- // device might not have virtual navigation keys
- if (!mConfig.hasNavigtionBar()) {
- mNavBarAvailable = false;
- }
-
- if (mStatusBarAvailable) {
- setupStatusBarView(activity, decorViewGroup);
- }
- if (mNavBarAvailable) {
- setupNavBarView(activity, decorViewGroup);
- }
-
- }
-
- /**
- * Enable tinting of the system status bar.
- * If the platform is running Jelly Bean or earlier, or translucent system
- * UI modes have not been enabled in either the theme or via window flags,
- * then this method does nothing.
- *
- * @param enabled True to enable tinting, false to disable it (default).
- */
- public void setStatusBarTintEnabled(boolean enabled) {
- mStatusBarTintEnabled = enabled;
- if (mStatusBarAvailable) {
- mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
- }
- }
-
- /**
- * Enable tinting of the system navigation bar.
- * If the platform does not have soft navigation keys, is running Jelly Bean
- * or earlier, or translucent system UI modes have not been enabled in either
- * the theme or via window flags, then this method does nothing.
- *
- * @param enabled True to enable tinting, false to disable it (default).
- */
- public void setNavigationBarTintEnabled(boolean enabled) {
- mNavBarTintEnabled = enabled;
- if (mNavBarAvailable) {
- mNavBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
- }
- }
-
- /**
- * Apply the specified color tint to all system UI bars.
- *
- * @param color The color of the background tint.
- */
- public void setTintColor(int color) {
- setStatusBarTintColor(color);
- setNavigationBarTintColor(color);
- }
-
- /**
- * Apply the specified drawable or color resource to all system UI bars.
- *
- * @param res The identifier of the resource.
- */
- public void setTintResource(int res) {
- setStatusBarTintResource(res);
- setNavigationBarTintResource(res);
- }
-
- /**
- * Apply the specified drawable to all system UI bars.
- *
- * @param drawable The drawable to use as the background, or null to remove it.
- */
- public void setTintDrawable(Drawable drawable) {
- setStatusBarTintDrawable(drawable);
- setNavigationBarTintDrawable(drawable);
- }
-
- /**
- * Apply the specified alpha to all system UI bars.
- *
- * @param alpha The alpha to use
- */
- public void setTintAlpha(float alpha) {
- setStatusBarAlpha(alpha);
- setNavigationBarAlpha(alpha);
- }
-
- /**
- * Apply the specified color tint to the system status bar.
- *
- * @param color The color of the background tint.
- */
- public void setStatusBarTintColor(int color) {
- if (mStatusBarAvailable) {
- mStatusBarTintView.setBackgroundColor(color);
- }
- }
-
- /**
- * Apply the specified drawable or color resource to the system status bar.
- *
- * @param res The identifier of the resource.
- */
- public void setStatusBarTintResource(int res) {
- if (mStatusBarAvailable) {
- mStatusBarTintView.setBackgroundResource(res);
- }
- }
-
- /**
- * Apply the specified drawable to the system status bar.
- *
- * @param drawable The drawable to use as the background, or null to remove it.
- */
- @SuppressWarnings("deprecation")
- public void setStatusBarTintDrawable(Drawable drawable) {
- if (mStatusBarAvailable) {
- mStatusBarTintView.setBackgroundDrawable(drawable);
- }
- }
-
- /**
- * Apply the specified alpha to the system status bar.
- *
- * @param alpha The alpha to use
- */
- @TargetApi(11)
- public void setStatusBarAlpha(float alpha) {
- if (mStatusBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- mStatusBarTintView.setAlpha(alpha);
- }
- }
-
- /**
- * Apply the specified color tint to the system navigation bar.
- *
- * @param color The color of the background tint.
- */
- public void setNavigationBarTintColor(int color) {
- if (mNavBarAvailable) {
- mNavBarTintView.setBackgroundColor(color);
- }
- }
-
- /**
- * Apply the specified drawable or color resource to the system navigation bar.
- *
- * @param res The identifier of the resource.
- */
- public void setNavigationBarTintResource(int res) {
- if (mNavBarAvailable) {
- mNavBarTintView.setBackgroundResource(res);
- }
- }
-
- /**
- * Apply the specified drawable to the system navigation bar.
- *
- * @param drawable The drawable to use as the background, or null to remove it.
- */
- @SuppressWarnings("deprecation")
- public void setNavigationBarTintDrawable(Drawable drawable) {
- if (mNavBarAvailable) {
- mNavBarTintView.setBackgroundDrawable(drawable);
- }
- }
-
- /**
- * Apply the specified alpha to the system navigation bar.
- *
- * @param alpha The alpha to use
- */
- @TargetApi(11)
- public void setNavigationBarAlpha(float alpha) {
- if (mNavBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- mNavBarTintView.setAlpha(alpha);
- }
- }
-
- /**
- * Get the system bar configuration.
- *
- * @return The system bar configuration for the current device configuration.
- */
- public SystemBarConfig getConfig() {
- return mConfig;
- }
-
- /**
- * Is tinting enabled for the system status bar?
- *
- * @return True if enabled, False otherwise.
- */
- public boolean isStatusBarTintEnabled() {
- return mStatusBarTintEnabled;
- }
-
- /**
- * Is tinting enabled for the system navigation bar?
- *
- * @return True if enabled, False otherwise.
- */
- public boolean isNavBarTintEnabled() {
- return mNavBarTintEnabled;
- }
-
- private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
- mStatusBarTintView = new View(context);
- LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
- params.gravity = Gravity.TOP;
- if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
- params.rightMargin = mConfig.getNavigationBarWidth();
- }
- mStatusBarTintView.setLayoutParams(params);
- mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
- mStatusBarTintView.setVisibility(View.GONE);
- decorViewGroup.addView(mStatusBarTintView);
- }
-
- private void setupNavBarView(Context context, ViewGroup decorViewGroup) {
- mNavBarTintView = new View(context);
- LayoutParams params;
- if (mConfig.isNavigationAtBottom()) {
- params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getNavigationBarHeight());
- params.gravity = Gravity.BOTTOM;
- } else {
- params = new LayoutParams(mConfig.getNavigationBarWidth(), LayoutParams.MATCH_PARENT);
- params.gravity = Gravity.RIGHT;
- }
- mNavBarTintView.setLayoutParams(params);
- mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
- mNavBarTintView.setVisibility(View.GONE);
- decorViewGroup.addView(mNavBarTintView);
- }
-
- /**
- * Class which describes system bar sizing and other characteristics for the current
- * device configuration.
- */
- public static class SystemBarConfig {
-
- private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";
- private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height";
- private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape";
- private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width";
- private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";
-
- private final boolean mTranslucentStatusBar;
- private final boolean mTranslucentNavBar;
- private final int mStatusBarHeight;
- private final int mActionBarHeight;
- private final boolean mHasNavigationBar;
- private final int mNavigationBarHeight;
- private final int mNavigationBarWidth;
- private final boolean mInPortrait;
- private final float mSmallestWidthDp;
-
- private SystemBarConfig(Activity activity, boolean translucentStatusBar, boolean traslucentNavBar) {
- Resources res = activity.getResources();
- mInPortrait = (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
- mSmallestWidthDp = getSmallestWidthDp(activity);
- mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME);
- mActionBarHeight = getActionBarHeight(activity);
- mNavigationBarHeight = getNavigationBarHeight(activity);
- mNavigationBarWidth = getNavigationBarWidth(activity);
- mHasNavigationBar = (mNavigationBarHeight > 0);
- mTranslucentStatusBar = translucentStatusBar;
- mTranslucentNavBar = traslucentNavBar;
- }
-
- @TargetApi(14)
- private int getActionBarHeight(Context context) {
- int result = 0;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- TypedValue tv = new TypedValue();
- context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
- result = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
- }
- return result;
- }
-
- @TargetApi(14)
- private int getNavigationBarHeight(Context context) {
- Resources res = context.getResources();
- int result = 0;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- if (hasNavBar(context)) {
- String key;
- if (mInPortrait) {
- key = NAV_BAR_HEIGHT_RES_NAME;
- } else {
- key = NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME;
- }
- return getInternalDimensionSize(res, key);
- }
- }
- return result;
- }
-
- @TargetApi(14)
- private int getNavigationBarWidth(Context context) {
- Resources res = context.getResources();
- int result = 0;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- if (hasNavBar(context)) {
- return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);
- }
- }
- return result;
- }
-
- @TargetApi(14)
- private boolean hasNavBar(Context context) {
- Resources res = context.getResources();
- int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android");
- if (resourceId != 0) {
- boolean hasNav = res.getBoolean(resourceId);
- // check override flag (see static block)
- if ("1".equals(sNavBarOverride)) {
- hasNav = false;
- } else if ("0".equals(sNavBarOverride)) {
- hasNav = true;
- }
- return hasNav;
- } else { // fallback
- return !ViewConfiguration.get(context).hasPermanentMenuKey();
- }
- }
-
- private int getInternalDimensionSize(Resources res, String key) {
- int result = 0;
- int resourceId = res.getIdentifier(key, "dimen", "android");
- if (resourceId > 0) {
- result = res.getDimensionPixelSize(resourceId);
- }
- return result;
- }
-
- @SuppressLint("NewApi")
- private float getSmallestWidthDp(Activity activity) {
- DisplayMetrics metrics = new DisplayMetrics();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
- } else {
- // TODO this is not correct, but we don't really care pre-kitkat
- activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
- }
- float widthDp = metrics.widthPixels / metrics.density;
- float heightDp = metrics.heightPixels / metrics.density;
- return Math.min(widthDp, heightDp);
- }
-
- /**
- * Should a navigation bar appear at the bottom of the screen in the current
- * device configuration? A navigation bar may appear on the right side of
- * the screen in certain configurations.
- *
- * @return True if navigation should appear at the bottom of the screen, False otherwise.
- */
- public boolean isNavigationAtBottom() {
- return (mSmallestWidthDp >= 600 || mInPortrait);
- }
-
- /**
- * Get the height of the system status bar.
- *
- * @return The height of the status bar (in pixels).
- */
- public int getStatusBarHeight() {
- return mStatusBarHeight;
- }
-
- /**
- * Get the height of the action bar.
- *
- * @return The height of the action bar (in pixels).
- */
- public int getActionBarHeight() {
- return mActionBarHeight;
- }
-
- /**
- * Does this device have a system navigation bar?
- *
- * @return True if this device uses soft key navigation, False otherwise.
- */
- public boolean hasNavigtionBar() {
- return mHasNavigationBar;
- }
-
- /**
- * Get the height of the system navigation bar.
- *
- * @return The height of the navigation bar (in pixels). If the device does not have
- * soft navigation keys, this will always return 0.
- */
- public int getNavigationBarHeight() {
- return mNavigationBarHeight;
- }
-
- /**
- * Get the width of the system navigation bar when it is placed vertically on the screen.
- *
- * @return The width of the navigation bar (in pixels). If the device does not have
- * soft navigation keys, this will always return 0.
- */
- public int getNavigationBarWidth() {
- return mNavigationBarWidth;
- }
-
- /**
- * Get the layout inset for any system UI that appears at the top of the screen.
- *
- * @param withActionBar True to include the height of the action bar, False otherwise.
- * @return The layout inset (in pixels).
- */
- public int getPixelInsetTop(boolean withActionBar) {
- return (mTranslucentStatusBar ? mStatusBarHeight : 0) + (withActionBar ? mActionBarHeight : 0);
- }
-
- /**
- * Get the layout inset for any system UI that appears at the bottom of the screen.
- *
- * @return The layout inset (in pixels).
- */
- public int getPixelInsetBottom() {
- if (mTranslucentNavBar && isNavigationAtBottom()) {
- return mNavigationBarHeight;
- } else {
- return 0;
- }
- }
-
- /**
- * Get the layout inset for any system UI that appears at the right of the screen.
- *
- * @return The layout inset (in pixels).
- */
- public int getPixelInsetRight() {
- if (mTranslucentNavBar && !isNavigationAtBottom()) {
- return mNavigationBarWidth;
- } else {
- return 0;
- }
- }
-
- }
-
-}
diff --git a/app/src/main/java/com/example/demo/util/DisplayUtils.java b/app/src/main/java/com/example/demo/util/DisplayUtils.java
deleted file mode 100644
index d59c27c..0000000
--- a/app/src/main/java/com/example/demo/util/DisplayUtils.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.example.demo.util;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.pm.ActivityInfo;
-import android.content.res.Configuration;
-import android.support.v4.content.ContextCompat;
-import android.util.DisplayMetrics;
-import android.util.Pair;
-import android.util.Size;
-
-import java.lang.reflect.Field;
-
-/**
- * Created by yummyLau on 18-7-11
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-public class DisplayUtils {
-
- public static int dip2px(Context context, float dipValue) {
- final float scale = context.getResources().getDisplayMetrics().density;
- return (int) (dipValue * scale + 0.5f);
- }
-
- public static Pair getScreenSize(Context context) {
- DisplayMetrics dm = context.getResources().getDisplayMetrics();
- return new Pair(dm.widthPixels, dm.heightPixels);
- }
-
- public static boolean isPortrait(Context context){
- return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
-
- }
-
- public static void checkoutOrientation(Activity activity) {
- activity.setRequestedOrientation(isPortrait(activity) ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
- }
-
- public static int getStatusBarHeight(Context context) {
- int result = 0;
- try {
- Class> c = Class.forName("com.android.internal.R$dimen");
- Object o = c.newInstance();
- Field field = c.getField("status_bar_height");
- int x = (Integer)field.get(o);
- result = context.getResources().getDimensionPixelSize(x);
- } catch (Exception var6) {
- var6.printStackTrace();
- }
-
- if (result == 0) {
- result = dip2px(context, 25.0F);
- }
-
- return result;
- }
-}
diff --git a/app/src/main/kotlin/com/example/demo/scene/api/ContentActivity.kt b/app/src/main/kotlin/com/example/demo/scene/api/ContentActivity.kt
deleted file mode 100644
index 20ed7e4..0000000
--- a/app/src/main/kotlin/com/example/demo/scene/api/ContentActivity.kt
+++ /dev/null
@@ -1,183 +0,0 @@
-package com.example.demo.scene.api
-
-import android.content.Context
-import android.content.Intent
-import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import android.support.v7.widget.LinearLayoutManager
-import android.text.TextUtils
-import android.util.Log
-import android.view.View
-import android.view.Window
-import android.view.WindowManager
-import android.widget.EditText
-import android.widget.TextView
-import android.widget.Toast
-import com.effective.R
-import com.effective.android.panel.PanelSwitchHelper
-import com.effective.android.panel.view.panel.PanelView
-import com.example.demo.Constants
-import com.example.demo.anno.ApiContentType
-import com.example.demo.scene.chat.adapter.ChatAdapter
-import com.example.demo.scene.chat.adapter.ChatInfo
-import com.example.demo.scene.chat.emotion.EmotionPagerView
-import com.example.demo.scene.chat.emotion.Emotions
-import com.example.demo.scene.chat.view.AutoHidePanelRecyclerView
-import com.example.demo.util.DisplayUtils
-import com.rd.PageIndicatorView
-
-/**
- * 内容区域支持多种布局,不再限定为线性布局
- * 框架提供 ContentLinearContainer,ContentRelativeContainer,ContentFrameContainer ,可供开发者替换对应的原生布局类
- * 同时还可自主实现 IContentContainer 接口自定义业务的 Container,[CusContentContainer] 提供了约束布局实现
- * Created by yummyLau on 2020/05/07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class ContentActivity : AppCompatActivity() {
- private var mHelper: PanelSwitchHelper? = null
- private lateinit var mAdapter: ChatAdapter
- private var mLinearLayoutManager: LinearLayoutManager? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
- when (intent.getIntExtra(Constants.KEY_CONTENT_TYPE, ApiContentType.CUS)) {
- ApiContentType.Linear -> {
- setContentView(R.layout.activity_api_content_linear_layout)
- findViewById(R.id.title).text = "线性布局"
- }
- ApiContentType.Frame -> {
- setContentView(R.layout.activity_api_content_frame_layout)
- findViewById(R.id.title).text = "帧布局"
- }
- ApiContentType.Relative -> {
- setContentView(R.layout.activity_api_content_relative_layout)
- findViewById(R.id.title).text = "相对布局"
- }
- else -> {
- setContentView(R.layout.activity_api_content_cus_layout)
- findViewById(R.id.title).text = "自定义布局"
- }
- }
- initView()
- }
-
- private val recyclerView: AutoHidePanelRecyclerView
- get() = findViewById(R.id.recycler_view) as AutoHidePanelRecyclerView
-
- private val sendView: View
- get() = findViewById(R.id.send)
-
- private val editView: EditText
- get() = findViewById(R.id.edit_text)
-
- private val emotionView: View
- get() = findViewById(R.id.emotion_btn)
-
- private fun initView() {
- mLinearLayoutManager = LinearLayoutManager(this)
- recyclerView.layoutManager = mLinearLayoutManager
- mAdapter = ChatAdapter(this, 50)
- recyclerView.adapter = mAdapter
- sendView.setOnClickListener(View.OnClickListener {
- val content = editView.text.toString()
- if (TextUtils.isEmpty(content)) {
- Toast.makeText(this@ContentActivity, "当前没有输入", Toast.LENGTH_SHORT).show()
- return@OnClickListener
- }
- mAdapter.insertInfo(ChatInfo.CREATE(content))
- editView.text = null
- scrollToBottom()
- })
- }
-
- private fun scrollToBottom() {
- editView.post{ mLinearLayoutManager?.scrollToPosition(mAdapter.itemCount - 1) }
- }
-
- override fun onStart() {
- super.onStart()
- if (mHelper == null) {
- mHelper = PanelSwitchHelper.Builder(this) //可选
- .addKeyboardStateListener {
- onKeyboardChange { visible, height ->
- Log.d(TAG, "系统键盘是否可见 : $visible ,高度为:$height")
- }
- }
- .addEditTextFocusChangeListener {
- onFocusChange { _, hasFocus ->
- Log.d(TAG, "输入框是否获得焦点 : $hasFocus")
- if (hasFocus) {
- scrollToBottom()
- }
- }
- }
- .addViewClickListener {
- onClickBefore {
- when (it!!.id) {
- R.id.edit_text, R.id.add_btn, R.id.emotion_btn -> {
- scrollToBottom()
- }
- }
- Log.d(TAG, "点击了View : $it")
- }
- }
- .addPanelChangeListener {
- onKeyboard {
- Log.d(TAG, "唤起系统输入法")
- emotionView.isSelected = false
- scrollToBottom()
- }
- onNone {
- Log.d(TAG, "隐藏所有面板")
- emotionView.isSelected = false
- }
- onPanel {
- Log.d(TAG, "唤起面板 : $it")
- if (it is PanelView) {
- emotionView.isSelected = it.id == R.id.panel_emotion
- scrollToBottom()
- }
- }
- onPanelSizeChange { panelView, _, _, _, width, height ->
- if (panelView is PanelView) {
- when (panelView.id) {
- R.id.panel_emotion -> {
- val pagerView: EmotionPagerView = findViewById(R.id.view_pager)
- val viewPagerSize = height - DisplayUtils.dip2px(this@ContentActivity, 30f)
- pagerView.buildEmotionViews(
- findViewById(R.id.pageIndicatorView) as PageIndicatorView,
- editView,
- Emotions.getEmotions(), width, viewPagerSize)
- }
- R.id.panel_addition -> {
- }
- }
- }
- }
- }
- .logTrack(true) //output log
- .build()
- }
- findViewById(R.id.recycler_view).setPanelSwitchHelper(mHelper)
- }
-
- override fun onBackPressed() {
- if (mHelper != null && mHelper!!.hookSystemBackByPanelSwitcher()) {
- return
- }
- super.onBackPressed()
- }
-
- companion object {
- @JvmStatic
- fun start(context: Context, @ApiContentType type: Int) {
- val intent = Intent(context, ContentActivity::class.java)
- intent.putExtra(Constants.KEY_CONTENT_TYPE, type)
- context.startActivity(intent)
- }
-
- private const val TAG = "ContentActivity"
- }
-}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/example/demo/scene/api/CusContentContainer.kt b/app/src/main/kotlin/com/example/demo/scene/api/CusContentContainer.kt
deleted file mode 100644
index 1f2d433..0000000
--- a/app/src/main/kotlin/com/example/demo/scene/api/CusContentContainer.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.example.demo.scene.api
-
-import android.content.Context
-import android.support.annotation.IdRes
-import android.support.constraint.ConstraintLayout
-import android.util.AttributeSet
-import android.view.MotionEvent
-import android.view.View
-import com.effective.R
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-import com.effective.android.panel.view.content.ContentContainerImpl
-import com.effective.android.panel.view.content.IContentContainer
-import com.effective.android.panel.view.content.IInputAction
-import com.effective.android.panel.view.content.IResetAction
-
-/**
- * 实现IContentContainer接口,可参考
- * [com.effective.android.panel.view.content.FrameContentContainer] 等库提供的模版实现基础的container容器
- * demo已约束布局为例子,使用者按需扩展就可以了
- * Created by yummyLau on 2020/05/07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class CusContentContainer @JvmOverloads constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : ConstraintLayout(context, attrs, defStyleAttr), IContentContainer {
- @IdRes
- private var editTextId = 0
-
- @IdRes
- private var resetViewId = 0
- private var autoResetByOnTouch: Boolean = true
- private lateinit var contentContainer: ContentContainerImpl
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {
- val typedArray = context.obtainStyledAttributes(attrs, R.styleable.CusContentContainer, defStyleAttr, 0)
- editTextId = typedArray.getResourceId(R.styleable.CusContentContainer_edit_view, -1)
- resetViewId = typedArray.getResourceId(R.styleable.CusContentContainer_auto_reset_area, -1)
- autoResetByOnTouch = typedArray.getBoolean(R.styleable.CusContentContainer_auto_reset_enable, autoResetByOnTouch)
- typedArray.recycle()
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- contentContainer = ContentContainerImpl(this, autoResetByOnTouch, editTextId, resetViewId)
- val editText = getInputActionImpl().getFullScreenPixelInputView()
- addView(editText, 0, LayoutParams(1, 1))
- }
-
- override fun layoutContainer(l: Int, t: Int, r: Int, b: Int,
- contentScrollMeasurers: MutableList, defaultScrollHeight: Int, canScrollOutsize: Boolean,
- reset: Boolean) {
- contentContainer.layoutContainer(l, t, r, b, contentScrollMeasurers, defaultScrollHeight, canScrollOutsize, reset)
- }
-
- override fun findTriggerView(id: Int): View? {
- return contentContainer.findTriggerView(id)
- }
-
- override fun changeContainerHeight(targetHeight: Int) {
- contentContainer.changeContainerHeight(targetHeight)
- }
-
- override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
- val onTouchTrue = super.dispatchTouchEvent(ev)
- val hookResult = getResetActionImpl().hookDispatchTouchEvent(ev, onTouchTrue)
- return hookResult or onTouchTrue
- }
-
- override fun onTouchEvent(event: MotionEvent?): Boolean {
- val onTouchBySelf = super.onTouchEvent(event)
- val hookResult = getResetActionImpl().hookOnTouchEvent(event)
- return onTouchBySelf or hookResult
- }
-
- override fun getInputActionImpl(): IInputAction = contentContainer.getInputActionImpl()
-
- override fun getResetActionImpl(): IResetAction = contentContainer.getResetActionImpl()
-
- init {
- initView(attrs, defStyleAttr, 0)
- }
-}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/example/demo/scene/api/CusPanelActivity.kt b/app/src/main/kotlin/com/example/demo/scene/api/CusPanelActivity.kt
deleted file mode 100644
index 836b43d..0000000
--- a/app/src/main/kotlin/com/example/demo/scene/api/CusPanelActivity.kt
+++ /dev/null
@@ -1,125 +0,0 @@
-package com.example.demo.scene.api
-
-import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import android.text.TextUtils
-import android.util.Log
-import android.view.View
-import android.view.Window
-import android.widget.EditText
-import android.widget.TextView
-import android.widget.Toast
-import com.effective.R
-import com.effective.android.panel.PanelSwitchHelper
-import com.effective.android.panel.view.panel.PanelView
-import com.example.demo.scene.chat.emotion.EmotionPagerView
-import com.example.demo.scene.chat.emotion.Emotions
-import com.example.demo.scene.chat.view.AutoHidePanelRecyclerView
-import com.example.demo.util.DisplayUtils
-import com.rd.PageIndicatorView
-
-/**
- * 处理可以使用默认的 PanelView,也可以通过继承 IPanelView 来实现自己的 PanelView。
- * 使用自定义面板
- * created by yummylau on 2020/06/06
- */
-class CusPanelActivity : AppCompatActivity() {
- private var mHelper: PanelSwitchHelper? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
- setContentView(R.layout.activity_api_cus_panel_layout)
- findViewById(R.id.title).text = "继承 IPanelView 实现 PanelView,点击左下角 + 试试吧"
- initView()
- }
-
- private val sendView: View
- get() = findViewById(R.id.send)
-
- private val editView: EditText
- get() = findViewById(R.id.edit_text)
-
- private val emotionView: View
- get() = findViewById(R.id.emotion_btn)
-
- private fun initView() {
- sendView.setOnClickListener(View.OnClickListener {
- val content = editView.text.toString()
- if (TextUtils.isEmpty(content)) {
- Toast.makeText(this@CusPanelActivity, "当前没有输入", Toast.LENGTH_SHORT).show()
- return@OnClickListener
- }
- editView.text = null
- })
- }
-
- override fun onStart() {
- super.onStart()
- if (mHelper == null) {
- mHelper = PanelSwitchHelper.Builder(this) //可选
- .addKeyboardStateListener {
- onKeyboardChange { visible, height ->
- Log.d(TAG, "系统键盘是否可见 : $visible ,高度为:$height")
- }
- }
- .addEditTextFocusChangeListener {
- onFocusChange { _, hasFocus ->
- Log.d(TAG, "输入框是否获得焦点 : $hasFocus")
- }
- }
- .addViewClickListener {
- onClickBefore {
- Log.d(TAG, "点击了View : $it")
- }
- }
- .addPanelChangeListener {
- onKeyboard {
- Log.d(TAG, "唤起系统输入法")
- emotionView.isSelected = false
- }
- onNone {
- Log.d(TAG, "隐藏所有面板")
- emotionView.isSelected = false
- }
- onPanel {
- Log.d(TAG, "唤起面板 : $it")
- if (it is PanelView) {
- emotionView.isSelected = it.id == R.id.panel_emotion
- }
- }
- onPanelSizeChange { panelView, _, _, _, width, height ->
- if (panelView is PanelView) {
- when (panelView.id) {
- R.id.panel_emotion -> {
- val pagerView: EmotionPagerView = findViewById(R.id.view_pager)
- val viewPagerSize = height - DisplayUtils.dip2px(this@CusPanelActivity, 30f)
- pagerView.buildEmotionViews(
- findViewById(R.id.pageIndicatorView) as PageIndicatorView,
- editView,
- Emotions.getEmotions(), width, viewPagerSize)
- }
- R.id.panel_addition -> {
- }
- }
- }
- }
- }
- .logTrack(true) //output log
- .build()
- }
- findViewById(R.id.recycler_view).setPanelSwitchHelper(mHelper)
- }
-
- override fun onBackPressed() {
- if (mHelper != null && mHelper!!.hookSystemBackByPanelSwitcher()) {
- return
- }
- super.onBackPressed()
- }
-
- companion object {
- private const val TAG = "PanelActivity"
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/example/demo/scene/api/CusPanelView.kt b/app/src/main/kotlin/com/example/demo/scene/api/CusPanelView.kt
deleted file mode 100644
index 4cc7938..0000000
--- a/app/src/main/kotlin/com/example/demo/scene/api/CusPanelView.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.example.demo.scene.api
-
-import android.content.Context
-import android.graphics.Color
-import android.support.v7.widget.AppCompatTextView
-import android.util.AttributeSet
-import android.view.Gravity
-import com.effective.R
-import com.effective.android.panel.view.panel.IPanelView
-
-class CusPanelView : IPanelView, AppCompatTextView {
-
- private var triggerViewId = 0
- private var isToggle = true
-
- constructor(context: Context?) : this(context, null)
- constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
- initView(attrs, defStyleAttr, 0)
- }
-
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {
- val typedArray = context.obtainStyledAttributes(attrs, R.styleable.CusPanelView, defStyleAttr, defStyleRes)
- triggerViewId = typedArray.getResourceId(R.styleable.CusPanelView_cus_panel_trigger, -1)
- isToggle = typedArray.getBoolean(R.styleable.CusPanelView_cus_panel_toggle, isToggle)
- typedArray.recycle()
- setBackgroundColor(Color.BLACK)
- text = "自定义面板"
- gravity = Gravity.CENTER
- setTextColor(Color.WHITE)
- textSize = 20f
- }
-
- override fun getBindingTriggerViewId(): Int = triggerViewId
-
- override fun isTriggerViewCanToggle(): Boolean = isToggle
-
- override fun isShowing(): Boolean = isShown
-
- override fun assertView() {
- if (triggerViewId == -1) {
- throw RuntimeException("PanelView -- you must set 'panel_layout' and panel_trigger by Integer id")
- }
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- assertView()
- }
-}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/example/demo/scene/api/DefaultHeightPanelActivity.kt b/app/src/main/kotlin/com/example/demo/scene/api/DefaultHeightPanelActivity.kt
deleted file mode 100644
index b8062f3..0000000
--- a/app/src/main/kotlin/com/example/demo/scene/api/DefaultHeightPanelActivity.kt
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.example.demo.scene.api
-
-import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import android.text.TextUtils
-import android.util.Log
-import android.view.View
-import android.view.Window
-import android.widget.EditText
-import android.widget.TextView
-import android.widget.Toast
-import com.effective.R
-import com.effective.android.panel.PanelSwitchHelper
-import com.effective.android.panel.utils.PanelUtil.clearData
-import com.effective.android.panel.view.panel.PanelView
-import com.example.demo.scene.chat.emotion.EmotionPagerView
-import com.example.demo.scene.chat.emotion.Emotions
-import com.example.demo.scene.chat.view.AutoHidePanelRecyclerView
-import com.example.demo.util.DisplayUtils
-import com.rd.PageIndicatorView
-
-/**
- * 设置面板默认高度
- * created by yummylau on 2020/07/13
- */
-class DefaultHeightPanelActivity : AppCompatActivity() {
- private var mHelper: PanelSwitchHelper? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
- setContentView(R.layout.activity_api_default_panel_height_layout)
- findViewById(R.id.title).text = "设置面板默认高度,点击切换下面面板进行体验,如果曾拉起过输入法,则需要点击此标题清除高度缓存。"
- findViewById(R.id.title).setOnClickListener {
- clearData(this@DefaultHeightPanelActivity)
- Toast.makeText(this@DefaultHeightPanelActivity, "已清除面板高度缓存,可拉起功能面板测试默认高度", Toast.LENGTH_SHORT).show()
- }
- initView()
- }
-
- private val sendView: View
- get() = findViewById(R.id.send)
-
- private val editView: EditText
- get() = findViewById(R.id.edit_text)
-
- private val emotionView: View
- get() = findViewById(R.id.emotion_btn)
-
- private fun initView() {
- sendView.setOnClickListener(View.OnClickListener {
- val content = editView.text.toString()
- if (TextUtils.isEmpty(content)) {
- Toast.makeText(this@DefaultHeightPanelActivity, "当前没有输入", Toast.LENGTH_SHORT).show()
- return@OnClickListener
- }
- editView.text = null
- })
- }
-
- override fun onStart() {
- super.onStart()
- if (mHelper == null) {
- mHelper = PanelSwitchHelper.Builder(this) //可选
- .addKeyboardStateListener {
- onKeyboardChange { visible, height ->
- Log.d(TAG, "系统键盘是否可见 : $visible ,高度为:$height")
- }
- }
- .addEditTextFocusChangeListener {
- onFocusChange { _, hasFocus ->
- Log.d(TAG, "输入框是否获得焦点 : $hasFocus")
- }
- }
- .addViewClickListener {
- onClickBefore {
- Log.d(TAG, "点击了View : $it")
- }
- }
- .addPanelChangeListener {
- onKeyboard {
- Log.d(TAG, "唤起系统输入法")
- emotionView.isSelected = false
- }
- onNone {
- Log.d(TAG, "隐藏所有面板")
- emotionView.isSelected = false
- }
- onPanel {
- Log.d(TAG, "唤起面板 : $it")
- if (it is PanelView) {
- emotionView.isSelected = it.id == R.id.panel_emotion
- }
- }
- onPanelSizeChange { panelView, _, _, _, width, height ->
- if (panelView is PanelView) {
- when (panelView.id) {
- R.id.panel_emotion -> {
- val pagerView: EmotionPagerView = findViewById(R.id.view_pager)
- val viewPagerSize = height - DisplayUtils.dip2px(this@DefaultHeightPanelActivity, 30f)
- pagerView.buildEmotionViews(
- findViewById(R.id.pageIndicatorView) as PageIndicatorView,
- editView,
- Emotions.getEmotions(), width, viewPagerSize)
- }
- R.id.panel_addition -> {
- }
- }
- }
- }
- }
- .addPanelHeightMeasurer {
- getTargetPanelDefaultHeight { DisplayUtils.dip2px(this@DefaultHeightPanelActivity,400f)}
- getPanelTriggerId { R.id.add_btn }
- }
- .addPanelHeightMeasurer {
- getTargetPanelDefaultHeight { DisplayUtils.dip2px(this@DefaultHeightPanelActivity,200f)}
- getPanelTriggerId { R.id.emotion_btn }
- }
- .logTrack(true) //output log
- .build()
- }
- findViewById(R.id.recycler_view).setPanelSwitchHelper(mHelper)
- }
-
- override fun onBackPressed() {
- if (mHelper != null && mHelper!!.hookSystemBackByPanelSwitcher()) {
- return
- }
- super.onBackPressed()
- }
-
- companion object {
- private const val TAG = "PanelActivity"
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/example/demo/scene/api/PanelActivity.kt b/app/src/main/kotlin/com/example/demo/scene/api/PanelActivity.kt
deleted file mode 100644
index b48ef51..0000000
--- a/app/src/main/kotlin/com/example/demo/scene/api/PanelActivity.kt
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.example.demo.scene.api
-
-import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import android.text.TextUtils
-import android.util.Log
-import android.view.View
-import android.view.Window
-import android.widget.EditText
-import android.widget.TextView
-import android.widget.Toast
-import com.effective.R
-import com.effective.android.panel.PanelSwitchHelper
-import com.effective.android.panel.view.panel.PanelView
-import com.example.demo.scene.chat.emotion.EmotionPagerView
-import com.example.demo.scene.chat.emotion.Emotions
-import com.example.demo.util.DisplayUtils
-import com.rd.PageIndicatorView
-
-/**
- * 处理可以使用默认的 PanelView,也可以通过继承 IPanelView 来实现自己的 PanelView。
- * 使用自定义面板
- * created by yummylau on 2020/06/06
- */
-class PanelActivity : AppCompatActivity() {
- private var mHelper: PanelSwitchHelper? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
- setContentView(R.layout.activity_api_cus_panel_layout)
- findViewById(R.id.title).text = "继承 IPanelView 实现 PanelView,点击左下角 + 试试吧"
- initView()
- }
-
- private val sendView: View
- get() = findViewById(R.id.send)
-
- private val editView: EditText
- get() = findViewById(R.id.edit_text)
-
- private val emotionView: View
- get() = findViewById(R.id.emotion_btn)
-
- private fun initView() {
- sendView.setOnClickListener(View.OnClickListener {
- val content = editView.text.toString()
- if (TextUtils.isEmpty(content)) {
- Toast.makeText(this@PanelActivity, "当前没有输入", Toast.LENGTH_SHORT).show()
- return@OnClickListener
- }
- editView.text = null
- })
- }
-
- override fun onStart() {
- super.onStart()
- if (mHelper == null) {
- mHelper = PanelSwitchHelper.Builder(this) //可选
- .addKeyboardStateListener {
- onKeyboardChange { visible, height ->
- Log.d(TAG, "系统键盘是否可见 : $visible ,高度为:$height")
- }
- }
- .addEditTextFocusChangeListener {
- onFocusChange { _, hasFocus ->
- Log.d(TAG, "输入框是否获得焦点 : $hasFocus")
- }
- }
- .addViewClickListener {
- onClickBefore {
- Log.d(TAG, "点击了View : $it")
- }
- }
- .addPanelChangeListener {
- onKeyboard {
- Log.d(TAG, "唤起系统输入法")
- emotionView.isSelected = false
- }
- onNone {
- Log.d(TAG, "隐藏所有面板")
- emotionView.isSelected = false
- }
- onPanel {
- Log.d(TAG, "唤起面板 : $it")
- if (it is PanelView) {
- emotionView.isSelected = it.id == R.id.panel_emotion
- }
- }
- onPanelSizeChange { panelView, _, _, _, width, height ->
- if (panelView is PanelView) {
- when (panelView.id) {
- R.id.panel_emotion -> {
- val pagerView: EmotionPagerView = findViewById(R.id.view_pager)
- val viewPagerSize = height - DisplayUtils.dip2px(this@PanelActivity, 30f)
- pagerView.buildEmotionViews(
- findViewById(R.id.pageIndicatorView) as PageIndicatorView,
- editView,
- Emotions.getEmotions(), width, viewPagerSize)
- }
- R.id.panel_addition -> {
- }
- }
- }
- }
- }
- .logTrack(true) //output log
- .build()
- }
- }
-
- override fun onBackPressed() {
- if (mHelper != null && mHelper!!.hookSystemBackByPanelSwitcher()) {
- return
- }
- super.onBackPressed()
- }
-
- companion object {
- private const val TAG = "PanelActivity"
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/example/demo/scene/api/ResetActivity.kt b/app/src/main/kotlin/com/example/demo/scene/api/ResetActivity.kt
deleted file mode 100644
index e651433..0000000
--- a/app/src/main/kotlin/com/example/demo/scene/api/ResetActivity.kt
+++ /dev/null
@@ -1,199 +0,0 @@
-package com.example.demo.scene.api
-
-import android.content.Context
-import android.content.Intent
-import android.os.Bundle
-import android.support.v7.app.AppCompatActivity
-import android.support.v7.widget.LinearLayoutManager
-import android.support.v7.widget.RecyclerView
-import android.text.TextUtils
-import android.util.Log
-import android.view.View
-import android.view.Window
-import android.widget.EditText
-import android.widget.TextView
-import android.widget.Toast
-import com.effective.R
-import com.effective.android.panel.PanelSwitchHelper
-import com.effective.android.panel.view.panel.PanelView
-import com.example.demo.Constants
-import com.example.demo.anno.ApiResetType
-import com.example.demo.scene.chat.adapter.ChatAdapter
-import com.example.demo.scene.chat.adapter.ChatInfo
-import com.example.demo.scene.chat.emotion.EmotionPagerView
-import com.example.demo.scene.chat.emotion.Emotions
-import com.example.demo.scene.chat.view.AutoHidePanelRecyclerView
-import com.example.demo.util.DisplayUtils
-import com.rd.PageIndicatorView
-
-/**
- * 演示如何正确使用 auto_reset (点击内容区域自动隐藏面板) 的功能
- * auto_reset 可以被定义在 container 的扩展属性内,包含
- * 1. auto_reset_enable 表示是否支持点击内容区域内隐藏面板,默认打开。
- * 打开时,当区域内子view没有消费事件时,则会默认消费该事件并自动隐藏。
- * 2. auto_reset_area,当且仅当 auto_reset_enable 为 true 才有效,指定一个 view 的id,为 1 的消费事件限定区域。
- * 比如场景一,指定了空白透明 view ,view 没有消费事件时,则才会自动隐藏面板;
- * 比如场景二,指定了列表的 recyclerview ,则recyclerview 没有消费事件时,则才会自动隐藏面板;
- * 比如场景三,场景二 recyclerview 时显然很难不消费事件,如果 holder 被点击(比如聊天项),则应该被正常消费,
- * 如果点击 recyclerview 内的空白,recyclerview 也会默认消费,因为可能需要滑动、
- * 为了解决这种下层应该消费点击滑动事件,而上层容器应该获取点击并自动隐藏,HookActionUpRecyclerView 就是该场景的 DEMO
- * 需要把下层消费完之后的 ACTION_UP 返回 false 让上层有机会处理。 ContentContainerImpl 内的实现预留了这种可能,用于处理该复杂场景。
- *
- * 可参考自定义 [CusContentContainer] 或库提供的多种Container实现类
- * created by yummylau on 2020/06/06
- */
-class ResetActivity : AppCompatActivity() {
- private var mHelper: PanelSwitchHelper? = null
- private lateinit var mAdapter: ChatAdapter
- private var mLinearLayoutManager: LinearLayoutManager? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
- when (intent.getIntExtra(Constants.KEY_CONTENT_TYPE, ApiResetType.DISABLE)) {
- ApiResetType.DISABLE -> {
- setContentView(R.layout.activity_api_auto_reset_disable_layout)
- findViewById(R.id.title).text = "关闭自动隐藏面板,点击空白处无法隐藏面板"
- }
- ApiResetType.ENABLE -> {
- setContentView(R.layout.activity_api_auto_reset_enable_layout)
- findViewById(R.id.title).text = "打开自动隐藏面板,点击空白处即可隐藏面板"
- }
- ApiResetType.ENABLE_EmptyView -> {
- setContentView(R.layout.activity_api_auto_reset_enable_on_empty_view_layout)
- findViewById(R.id.title).text = "打开自动隐藏面板-自定义EmptyView,不消费事件,点击可隐藏面板"
- }
- ApiResetType.ENABLE_RecyclerView -> {
- setContentView(R.layout.activity_api_auto_reset_enable_on_recyclerview_layout)
- findViewById(R.id.title).text = "打开自动隐藏面板-原生RecyclerView,默认消费事件,点击无法隐藏面板"
- }
- ApiResetType.ENABLE_HookActionUpRecyclerview -> {
- setContentView(R.layout.activity_api_auto_reset_enbale_on_cus_recyclerview_layout)
- findViewById(R.id.title).text = "打开自动隐藏面板-HookActionUpRecyclerView,重写消费逻辑,点击非空白可隐藏面板,列表可滑动,holder可点击"
- }
- }
- initView()
- }
-
- private val recyclerView: RecyclerView
- get() = findViewById(R.id.recycler_view) as RecyclerView
-
- private val sendView: View
- get() = findViewById(R.id.send)
-
- private val editView: EditText
- get() = findViewById(R.id.edit_text)
-
- private val emotionView: View
- get() = findViewById(R.id.emotion_btn)
-
- private fun initView() {
- mLinearLayoutManager = LinearLayoutManager(this)
- recyclerView.layoutManager = mLinearLayoutManager
- mAdapter = ChatAdapter(this, 50)
- recyclerView.adapter = mAdapter
- sendView.setOnClickListener(View.OnClickListener {
- val content = editView.text.toString()
- if (TextUtils.isEmpty(content)) {
- Toast.makeText(this@ResetActivity, "当前没有输入", Toast.LENGTH_SHORT).show()
- return@OnClickListener
- }
- mAdapter.insertInfo(ChatInfo.CREATE(content))
- editView.text = null
- scrollToBottom()
- })
- }
-
- private fun scrollToBottom() {
- recyclerView.post { mLinearLayoutManager?.scrollToPosition(mAdapter.itemCount - 1) }
- }
-
- override fun onStart() {
- super.onStart()
- if (mHelper == null) {
- mHelper = PanelSwitchHelper.Builder(this) //可选
- .addKeyboardStateListener {
- onKeyboardChange { visible, height ->
- Log.d(TAG, "系统键盘是否可见 : $visible ,高度为:$height")
- }
- }
- .addEditTextFocusChangeListener {
- onFocusChange { _, hasFocus ->
- Log.d(TAG, "输入框是否获得焦点 : $hasFocus")
- if (hasFocus) {
- scrollToBottom()
- }
- }
- }
- .addViewClickListener {
- onClickBefore {
- when (it!!.id) {
- R.id.edit_text, R.id.add_btn, R.id.emotion_btn -> {
- scrollToBottom()
- }
- }
- Log.d(TAG, "点击了View : $it")
- }
- }
- .addPanelChangeListener {
- onKeyboard {
- Log.d(TAG, "唤起系统输入法")
- emotionView.isSelected = false
- scrollToBottom()
- }
- onNone {
- Log.d(TAG, "隐藏所有面板")
- emotionView.isSelected = false
- }
- onPanel {
- Log.d(TAG, "唤起面板 : $it")
- if (it is PanelView) {
- emotionView.isSelected = it.id == R.id.panel_emotion
- scrollToBottom()
- }
- }
- onPanelSizeChange { panelView, _, _, _, width, height ->
- if (panelView is PanelView) {
- when (panelView.id) {
- R.id.panel_emotion -> {
- val pagerView: EmotionPagerView = findViewById(R.id.view_pager)
- val viewPagerSize = height - DisplayUtils.dip2px(this@ResetActivity, 30f)
- pagerView.buildEmotionViews(
- findViewById(R.id.pageIndicatorView) as PageIndicatorView,
- editView,
- Emotions.getEmotions(), width, viewPagerSize)
- }
- R.id.panel_addition -> {
- }
- }
- }
- }
- }
- .logTrack(true) //output log
- .build()
- }
- if (findViewById(R.id.recycler_view) is AutoHidePanelRecyclerView) {
- findViewById(R.id.recycler_view).setPanelSwitchHelper(mHelper)
- }
- }
-
- override fun onBackPressed() {
- if (mHelper != null && mHelper!!.hookSystemBackByPanelSwitcher()) {
- return
- }
- super.onBackPressed()
- }
-
- companion object {
-
- @JvmStatic
- fun start(context: Context, @ApiResetType type: Int) {
- val intent = Intent(context, ResetActivity::class.java)
- intent.putExtra(Constants.KEY_CONTENT_TYPE, type)
- context.startActivity(intent)
- }
-
- private const val TAG = "ResetActivity"
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/res/anim/anim_feed_pop_hide.xml b/app/src/main/res/anim/anim_feed_pop_hide.xml
deleted file mode 100644
index 79bb6fe..0000000
--- a/app/src/main/res/anim/anim_feed_pop_hide.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/anim/anim_feed_pop_show.xml b/app/src/main/res/anim/anim_feed_pop_show.xml
deleted file mode 100644
index c786884..0000000
--- a/app/src/main/res/anim/anim_feed_pop_show.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/color/color_send_btn.xml b/app/src/main/res/color/color_send_btn.xml
deleted file mode 100644
index 495aec5..0000000
--- a/app/src/main/res/color/color_send_btn.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable-xxhdpi/avatar_android.png b/app/src/main/res/drawable-xxhdpi/avatar_android.png
deleted file mode 100644
index 8e6ed75..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/avatar_android.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/avatar_cat.jpeg b/app/src/main/res/drawable-xxhdpi/avatar_cat.jpeg
deleted file mode 100644
index 6712611..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/avatar_cat.jpeg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/bg_gradient.jpeg b/app/src/main/res/drawable-xxhdpi/bg_gradient.jpeg
deleted file mode 100644
index 6273491..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/bg_gradient.jpeg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/chat_left_bg.9.png b/app/src/main/res/drawable-xxhdpi/chat_left_bg.9.png
deleted file mode 100644
index 726e200..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/chat_left_bg.9.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/chat_right_bg.9.png b/app/src/main/res/drawable-xxhdpi/chat_right_bg.9.png
deleted file mode 100644
index 85f35aa..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/chat_right_bg.9.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_1.png b/app/src/main/res/drawable-xxhdpi/expression_1.png
deleted file mode 100644
index d1683ad..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_1.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_10.png b/app/src/main/res/drawable-xxhdpi/expression_10.png
deleted file mode 100644
index 00c525c..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_10.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_101.png b/app/src/main/res/drawable-xxhdpi/expression_101.png
deleted file mode 100644
index 4749f85..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_101.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_102.png b/app/src/main/res/drawable-xxhdpi/expression_102.png
deleted file mode 100644
index fff6360..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_102.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_103.png b/app/src/main/res/drawable-xxhdpi/expression_103.png
deleted file mode 100644
index 7f17bdc..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_103.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_104.png b/app/src/main/res/drawable-xxhdpi/expression_104.png
deleted file mode 100644
index c616b42..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_104.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_105.png b/app/src/main/res/drawable-xxhdpi/expression_105.png
deleted file mode 100644
index 71d3863..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_105.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_106.png b/app/src/main/res/drawable-xxhdpi/expression_106.png
deleted file mode 100644
index 0622d53..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_106.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_107.png b/app/src/main/res/drawable-xxhdpi/expression_107.png
deleted file mode 100644
index d71da78..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_107.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_108.png b/app/src/main/res/drawable-xxhdpi/expression_108.png
deleted file mode 100644
index 4995047..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_108.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_109.png b/app/src/main/res/drawable-xxhdpi/expression_109.png
deleted file mode 100644
index 4e71097..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_109.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_11.png b/app/src/main/res/drawable-xxhdpi/expression_11.png
deleted file mode 100644
index 4cde82c..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_11.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_111.png b/app/src/main/res/drawable-xxhdpi/expression_111.png
deleted file mode 100644
index de8953d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_111.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_113.png b/app/src/main/res/drawable-xxhdpi/expression_113.png
deleted file mode 100644
index 0f7b2bd..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_113.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_114.png b/app/src/main/res/drawable-xxhdpi/expression_114.png
deleted file mode 100644
index 85a28c3..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_114.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_115.png b/app/src/main/res/drawable-xxhdpi/expression_115.png
deleted file mode 100644
index 95b1152..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_115.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_116.png b/app/src/main/res/drawable-xxhdpi/expression_116.png
deleted file mode 100644
index e0fd80a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_116.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_117.png b/app/src/main/res/drawable-xxhdpi/expression_117.png
deleted file mode 100644
index 70fa1e5..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_117.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_118.png b/app/src/main/res/drawable-xxhdpi/expression_118.png
deleted file mode 100644
index 99dcd04..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_118.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_119.png b/app/src/main/res/drawable-xxhdpi/expression_119.png
deleted file mode 100644
index cd5707a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_119.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_12.png b/app/src/main/res/drawable-xxhdpi/expression_12.png
deleted file mode 100644
index e9860ae..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_12.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_13.png b/app/src/main/res/drawable-xxhdpi/expression_13.png
deleted file mode 100644
index 5f8b837..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_13.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_14.png b/app/src/main/res/drawable-xxhdpi/expression_14.png
deleted file mode 100644
index ea301eb..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_14.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_15.png b/app/src/main/res/drawable-xxhdpi/expression_15.png
deleted file mode 100644
index 130092a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_15.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_16.png b/app/src/main/res/drawable-xxhdpi/expression_16.png
deleted file mode 100644
index ed16f43..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_16.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_18.png b/app/src/main/res/drawable-xxhdpi/expression_18.png
deleted file mode 100644
index c6e3d60..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_18.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_19.png b/app/src/main/res/drawable-xxhdpi/expression_19.png
deleted file mode 100644
index 708f598..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_19.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_2.png b/app/src/main/res/drawable-xxhdpi/expression_2.png
deleted file mode 100644
index 5c0bc81..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_2.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_20.png b/app/src/main/res/drawable-xxhdpi/expression_20.png
deleted file mode 100644
index 3374de0..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_20.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_21.png b/app/src/main/res/drawable-xxhdpi/expression_21.png
deleted file mode 100644
index 7cdf30d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_21.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_22.png b/app/src/main/res/drawable-xxhdpi/expression_22.png
deleted file mode 100644
index d38af6c..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_22.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_23.png b/app/src/main/res/drawable-xxhdpi/expression_23.png
deleted file mode 100644
index 54d60f2..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_23.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_24.png b/app/src/main/res/drawable-xxhdpi/expression_24.png
deleted file mode 100644
index f9f3274..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_24.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_26.png b/app/src/main/res/drawable-xxhdpi/expression_26.png
deleted file mode 100644
index d00bcca..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_26.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_27.png b/app/src/main/res/drawable-xxhdpi/expression_27.png
deleted file mode 100644
index 74d7367..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_27.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_28.png b/app/src/main/res/drawable-xxhdpi/expression_28.png
deleted file mode 100644
index 1bd1d8d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_28.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_29.png b/app/src/main/res/drawable-xxhdpi/expression_29.png
deleted file mode 100644
index fba8e42..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_29.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_3.png b/app/src/main/res/drawable-xxhdpi/expression_3.png
deleted file mode 100644
index 6666d24..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_3.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_30.png b/app/src/main/res/drawable-xxhdpi/expression_30.png
deleted file mode 100644
index 6930c1f..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_30.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_31.png b/app/src/main/res/drawable-xxhdpi/expression_31.png
deleted file mode 100644
index 4c8b210..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_31.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_32.png b/app/src/main/res/drawable-xxhdpi/expression_32.png
deleted file mode 100644
index c866a78..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_32.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_33.png b/app/src/main/res/drawable-xxhdpi/expression_33.png
deleted file mode 100644
index 8efeae2..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_33.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_34.png b/app/src/main/res/drawable-xxhdpi/expression_34.png
deleted file mode 100644
index 9a77988..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_34.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_35.png b/app/src/main/res/drawable-xxhdpi/expression_35.png
deleted file mode 100644
index 1ec5395..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_35.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_37.png b/app/src/main/res/drawable-xxhdpi/expression_37.png
deleted file mode 100644
index 51a909d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_37.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_38.png b/app/src/main/res/drawable-xxhdpi/expression_38.png
deleted file mode 100644
index 35b1502..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_38.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_39.png b/app/src/main/res/drawable-xxhdpi/expression_39.png
deleted file mode 100644
index 58963aa..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_39.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_4.png b/app/src/main/res/drawable-xxhdpi/expression_4.png
deleted file mode 100644
index a88ed87..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_4.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_40.png b/app/src/main/res/drawable-xxhdpi/expression_40.png
deleted file mode 100644
index b14391c..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_40.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_41.png b/app/src/main/res/drawable-xxhdpi/expression_41.png
deleted file mode 100644
index f0cc76b..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_41.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_42.png b/app/src/main/res/drawable-xxhdpi/expression_42.png
deleted file mode 100644
index a5cba11..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_42.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_43.png b/app/src/main/res/drawable-xxhdpi/expression_43.png
deleted file mode 100644
index b3d735a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_43.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_45.png b/app/src/main/res/drawable-xxhdpi/expression_45.png
deleted file mode 100644
index 9d3b66d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_45.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_46.png b/app/src/main/res/drawable-xxhdpi/expression_46.png
deleted file mode 100644
index 8488d4e..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_46.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_47.png b/app/src/main/res/drawable-xxhdpi/expression_47.png
deleted file mode 100644
index f21b136..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_47.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_48.png b/app/src/main/res/drawable-xxhdpi/expression_48.png
deleted file mode 100644
index 2dc0d2b..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_48.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_49.png b/app/src/main/res/drawable-xxhdpi/expression_49.png
deleted file mode 100644
index e325cc7..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_49.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_5.png b/app/src/main/res/drawable-xxhdpi/expression_5.png
deleted file mode 100644
index 5cf5d2a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_5.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_50.png b/app/src/main/res/drawable-xxhdpi/expression_50.png
deleted file mode 100644
index f2885b0..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_50.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_51.png b/app/src/main/res/drawable-xxhdpi/expression_51.png
deleted file mode 100644
index 0e86351..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_51.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_52.png b/app/src/main/res/drawable-xxhdpi/expression_52.png
deleted file mode 100644
index 29e18fb..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_52.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_53.png b/app/src/main/res/drawable-xxhdpi/expression_53.png
deleted file mode 100644
index 3413b29..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_53.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_55.png b/app/src/main/res/drawable-xxhdpi/expression_55.png
deleted file mode 100644
index 2d7cc1a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_55.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_56.png b/app/src/main/res/drawable-xxhdpi/expression_56.png
deleted file mode 100644
index 3cc6c19..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_56.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_57.png b/app/src/main/res/drawable-xxhdpi/expression_57.png
deleted file mode 100644
index 23c6030..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_57.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_58.png b/app/src/main/res/drawable-xxhdpi/expression_58.png
deleted file mode 100644
index de8aa32..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_58.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_6.png b/app/src/main/res/drawable-xxhdpi/expression_6.png
deleted file mode 100644
index ebb6f9a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_6.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_61.png b/app/src/main/res/drawable-xxhdpi/expression_61.png
deleted file mode 100644
index 04aa040..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_61.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_63.png b/app/src/main/res/drawable-xxhdpi/expression_63.png
deleted file mode 100644
index 67c8d5d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_63.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_64.png b/app/src/main/res/drawable-xxhdpi/expression_64.png
deleted file mode 100644
index e8c595d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_64.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_65.png b/app/src/main/res/drawable-xxhdpi/expression_65.png
deleted file mode 100644
index 9520cd4..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_65.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_66.png b/app/src/main/res/drawable-xxhdpi/expression_66.png
deleted file mode 100644
index 6bc0010..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_66.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_67.png b/app/src/main/res/drawable-xxhdpi/expression_67.png
deleted file mode 100644
index ba289ed..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_67.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_68.png b/app/src/main/res/drawable-xxhdpi/expression_68.png
deleted file mode 100644
index 3180af0..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_68.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_69.png b/app/src/main/res/drawable-xxhdpi/expression_69.png
deleted file mode 100644
index cdc7e26..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_69.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_7.png b/app/src/main/res/drawable-xxhdpi/expression_7.png
deleted file mode 100644
index e17176f..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_7.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_71.png b/app/src/main/res/drawable-xxhdpi/expression_71.png
deleted file mode 100644
index 0440f78..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_71.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_75.png b/app/src/main/res/drawable-xxhdpi/expression_75.png
deleted file mode 100644
index 6395b58..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_75.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_76.png b/app/src/main/res/drawable-xxhdpi/expression_76.png
deleted file mode 100644
index 1d8de0f..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_76.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_77.png b/app/src/main/res/drawable-xxhdpi/expression_77.png
deleted file mode 100644
index 5a23833..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_77.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_79.png b/app/src/main/res/drawable-xxhdpi/expression_79.png
deleted file mode 100644
index 3dd0eab..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_79.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_8.png b/app/src/main/res/drawable-xxhdpi/expression_8.png
deleted file mode 100644
index 038fc76..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_8.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_80.png b/app/src/main/res/drawable-xxhdpi/expression_80.png
deleted file mode 100644
index 9b8e03f..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_80.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_81.png b/app/src/main/res/drawable-xxhdpi/expression_81.png
deleted file mode 100644
index 58aba10..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_81.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_82.png b/app/src/main/res/drawable-xxhdpi/expression_82.png
deleted file mode 100644
index 9550767..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_82.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_83.png b/app/src/main/res/drawable-xxhdpi/expression_83.png
deleted file mode 100644
index 0ceabba..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_83.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_84.png b/app/src/main/res/drawable-xxhdpi/expression_84.png
deleted file mode 100644
index ef83fa0..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_84.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_85.png b/app/src/main/res/drawable-xxhdpi/expression_85.png
deleted file mode 100644
index 7113916..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_85.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_86.png b/app/src/main/res/drawable-xxhdpi/expression_86.png
deleted file mode 100644
index 4913254..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_86.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_9.png b/app/src/main/res/drawable-xxhdpi/expression_9.png
deleted file mode 100644
index 5c0ae24..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_9.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_90.png b/app/src/main/res/drawable-xxhdpi/expression_90.png
deleted file mode 100644
index 30df439..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_90.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_93.png b/app/src/main/res/drawable-xxhdpi/expression_93.png
deleted file mode 100644
index d05e520..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_93.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_94.png b/app/src/main/res/drawable-xxhdpi/expression_94.png
deleted file mode 100644
index 15cfec7..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_94.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_95.png b/app/src/main/res/drawable-xxhdpi/expression_95.png
deleted file mode 100644
index 7e0d258..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_95.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_96.png b/app/src/main/res/drawable-xxhdpi/expression_96.png
deleted file mode 100644
index c2604ad..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_96.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_97.png b/app/src/main/res/drawable-xxhdpi/expression_97.png
deleted file mode 100644
index a3a223f..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_97.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_98.png b/app/src/main/res/drawable-xxhdpi/expression_98.png
deleted file mode 100644
index 84e3d8e..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_98.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/expression_99.png b/app/src/main/res/drawable-xxhdpi/expression_99.png
deleted file mode 100644
index 97202a5..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/expression_99.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_send.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_send.png
deleted file mode 100644
index 232b11d..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_send.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_send_select.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_send_select.png
deleted file mode 100644
index 6736bcd..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_send_select.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_tip.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_tip.png
deleted file mode 100644
index 9a83637..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_input_tip.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key.png
deleted file mode 100644
index 50a1667..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key_l.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key_l.png
deleted file mode 100644
index 7560c6e..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key_l.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key_select.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key_select.png
deleted file mode 100644
index 48f14fd..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_panel_key_select.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_video_back.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_video_back.png
deleted file mode 100644
index 6fee8c4..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_video_back.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_bilibili_video_checkout.png b/app/src/main/res/drawable-xxhdpi/ic_bilibili_video_checkout.png
deleted file mode 100644
index 97c0c9f..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_bilibili_video_checkout.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_douyin_close.png b/app/src/main/res/drawable-xxhdpi/ic_douyin_close.png
deleted file mode 100644
index ec768d3..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_douyin_close.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_douyin_gift.png b/app/src/main/res/drawable-xxhdpi/ic_douyin_gift.png
deleted file mode 100644
index fb1c5ae..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_douyin_gift.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_douyin_live_user.jpg b/app/src/main/res/drawable-xxhdpi/ic_douyin_live_user.jpg
deleted file mode 100644
index 3f81fd1..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_douyin_live_user.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_douyin_love.png b/app/src/main/res/drawable-xxhdpi/ic_douyin_love.png
deleted file mode 100644
index 8d350e2..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_douyin_love.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_douyin_more.png b/app/src/main/res/drawable-xxhdpi/ic_douyin_more.png
deleted file mode 100644
index 6b0ae32..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_douyin_more.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_douyin_send.png b/app/src/main/res/drawable-xxhdpi/ic_douyin_send.png
deleted file mode 100644
index a4bdcfe..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_douyin_send.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_feed_action_comment.png b/app/src/main/res/drawable-xxhdpi/ic_feed_action_comment.png
deleted file mode 100644
index a9c1886..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_feed_action_comment.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_feed_action_like.png b/app/src/main/res/drawable-xxhdpi/ic_feed_action_like.png
deleted file mode 100644
index 1d9c75a..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_feed_action_like.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_feed_avatar.jpg b/app/src/main/res/drawable-xxhdpi/ic_feed_avatar.jpg
deleted file mode 100644
index b04fc1c..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_feed_avatar.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_feed_cover.jpeg b/app/src/main/res/drawable-xxhdpi/ic_feed_cover.jpeg
deleted file mode 100644
index 71693ff..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_feed_cover.jpeg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_icon.png b/app/src/main/res/drawable-xxhdpi/ic_icon.png
deleted file mode 100644
index d97794b..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_icon.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_0.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_0.jpg
deleted file mode 100644
index a115754..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_0.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_1.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_1.jpg
deleted file mode 100644
index 14b1402..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_1.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_2.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_2.jpg
deleted file mode 100644
index 89a8945..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_2.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_3.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_3.jpg
deleted file mode 100644
index 9917090..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_3.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_4.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_4.jpg
deleted file mode 100644
index 7056a12..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_4.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_5.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_5.jpg
deleted file mode 100644
index 60eb1c5..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_5.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_6.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_6.jpg
deleted file mode 100644
index 1602f78..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_6.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_7.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_7.jpg
deleted file mode 100644
index 7d228c0..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_7.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_8.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_8.jpg
deleted file mode 100644
index 7e66672..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_8.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_uzi_9.jpg b/app/src/main/res/drawable-xxhdpi/ic_uzi_9.jpg
deleted file mode 100644
index d7c1257..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/ic_uzi_9.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index d5fccc5..0000000
--- a/app/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/icon_account.xml b/app/src/main/res/drawable/icon_account.xml
deleted file mode 100644
index da0263f..0000000
--- a/app/src/main/res/drawable/icon_account.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_add.xml b/app/src/main/res/drawable/icon_add.xml
deleted file mode 100644
index b7e2161..0000000
--- a/app/src/main/res/drawable/icon_add.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_camera.xml b/app/src/main/res/drawable/icon_camera.xml
deleted file mode 100644
index 44fc1f4..0000000
--- a/app/src/main/res/drawable/icon_camera.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/app/src/main/res/drawable/icon_emotion.xml b/app/src/main/res/drawable/icon_emotion.xml
deleted file mode 100644
index 033bd7f..0000000
--- a/app/src/main/res/drawable/icon_emotion.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_image.xml b/app/src/main/res/drawable/icon_image.xml
deleted file mode 100644
index 72309cd..0000000
--- a/app/src/main/res/drawable/icon_image.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_keyboard.xml b/app/src/main/res/drawable/icon_keyboard.xml
deleted file mode 100644
index 55038f3..0000000
--- a/app/src/main/res/drawable/icon_keyboard.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_location.xml b/app/src/main/res/drawable/icon_location.xml
deleted file mode 100644
index 15ad224..0000000
--- a/app/src/main/res/drawable/icon_location.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_video.xml b/app/src/main/res/drawable/icon_video.xml
deleted file mode 100644
index 9ed5882..0000000
--- a/app/src/main/res/drawable/icon_video.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/icon_voice.xml b/app/src/main/res/drawable/icon_voice.xml
deleted file mode 100644
index af1edb3..0000000
--- a/app/src/main/res/drawable/icon_voice.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/se_bilibili_input_send.xml b/app/src/main/res/drawable/se_bilibili_input_send.xml
deleted file mode 100644
index 2d61e0e..0000000
--- a/app/src/main/res/drawable/se_bilibili_input_send.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/se_bilibili_panel_key_l.xml b/app/src/main/res/drawable/se_bilibili_panel_key_l.xml
deleted file mode 100644
index 3549e8f..0000000
--- a/app/src/main/res/drawable/se_bilibili_panel_key_l.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/se_bilibili_panel_key_p.xml b/app/src/main/res/drawable/se_bilibili_panel_key_p.xml
deleted file mode 100644
index 2886e43..0000000
--- a/app/src/main/res/drawable/se_bilibili_panel_key_p.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/se_douyin_action_btn.xml b/app/src/main/res/drawable/se_douyin_action_btn.xml
deleted file mode 100644
index 090900b..0000000
--- a/app/src/main/res/drawable/se_douyin_action_btn.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/se_huya_comment_send_p.xml b/app/src/main/res/drawable/se_huya_comment_send_p.xml
deleted file mode 100644
index 69eb4fd..0000000
--- a/app/src/main/res/drawable/se_huya_comment_send_p.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/se_wechat_comment_send.xml b/app/src/main/res/drawable/se_wechat_comment_send.xml
deleted file mode 100644
index 9f42b7c..0000000
--- a/app/src/main/res/drawable/se_wechat_comment_send.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/selector_edit_focus.xml b/app/src/main/res/drawable/selector_edit_focus.xml
deleted file mode 100644
index 956756c..0000000
--- a/app/src/main/res/drawable/selector_edit_focus.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_emotion_btn.xml b/app/src/main/res/drawable/selector_emotion_btn.xml
deleted file mode 100644
index 1440936..0000000
--- a/app/src/main/res/drawable/selector_emotion_btn.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector_send_btn.xml b/app/src/main/res/drawable/selector_send_btn.xml
deleted file mode 100644
index 0d86229..0000000
--- a/app/src/main/res/drawable/selector_send_btn.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/sh_activity_btn.xml b/app/src/main/res/drawable/sh_activity_btn.xml
deleted file mode 100644
index 0422ada..0000000
--- a/app/src/main/res/drawable/sh_activity_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_bilibili_input_l.xml b/app/src/main/res/drawable/sh_bilibili_input_l.xml
deleted file mode 100644
index d1e280b..0000000
--- a/app/src/main/res/drawable/sh_bilibili_input_l.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_bilibili_input_l_but_white.xml b/app/src/main/res/drawable/sh_bilibili_input_l_but_white.xml
deleted file mode 100644
index dde15a2..0000000
--- a/app/src/main/res/drawable/sh_bilibili_input_l_but_white.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_bilibili_input_p.xml b/app/src/main/res/drawable/sh_bilibili_input_p.xml
deleted file mode 100644
index eedc4b2..0000000
--- a/app/src/main/res/drawable/sh_bilibili_input_p.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_bilibili_panel_item_bg.xml b/app/src/main/res/drawable/sh_bilibili_panel_item_bg.xml
deleted file mode 100644
index e50e964..0000000
--- a/app/src/main/res/drawable/sh_bilibili_panel_item_bg.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_bilibili_panel_item_select_bg.xml b/app/src/main/res/drawable/sh_bilibili_panel_item_select_bg.xml
deleted file mode 100644
index 67a280d..0000000
--- a/app/src/main/res/drawable/sh_bilibili_panel_item_select_bg.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_content_btn.xml b/app/src/main/res/drawable/sh_content_btn.xml
deleted file mode 100644
index 3ce63c3..0000000
--- a/app/src/main/res/drawable/sh_content_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_douyin_follow_bg.xml b/app/src/main/res/drawable/sh_douyin_follow_bg.xml
deleted file mode 100644
index 4e32250..0000000
--- a/app/src/main/res/drawable/sh_douyin_follow_bg.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_douyin_time_bg.xml b/app/src/main/res/drawable/sh_douyin_time_bg.xml
deleted file mode 100644
index d05aeb3..0000000
--- a/app/src/main/res/drawable/sh_douyin_time_bg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_douyin_user_bg.xml b/app/src/main/res/drawable/sh_douyin_user_bg.xml
deleted file mode 100644
index 6da4e34..0000000
--- a/app/src/main/res/drawable/sh_douyin_user_bg.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_feed_action.xml b/app/src/main/res/drawable/sh_feed_action.xml
deleted file mode 100644
index 815dff9..0000000
--- a/app/src/main/res/drawable/sh_feed_action.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_fragment_btn.xml b/app/src/main/res/drawable/sh_fragment_btn.xml
deleted file mode 100644
index 555f632..0000000
--- a/app/src/main/res/drawable/sh_fragment_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_huya_edit_cursor.xml b/app/src/main/res/drawable/sh_huya_edit_cursor.xml
deleted file mode 100644
index 51777bf..0000000
--- a/app/src/main/res/drawable/sh_huya_edit_cursor.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_panel_btn.xml b/app/src/main/res/drawable/sh_panel_btn.xml
deleted file mode 100644
index 8b4b229..0000000
--- a/app/src/main/res/drawable/sh_panel_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_pop_feed_action.xml b/app/src/main/res/drawable/sh_pop_feed_action.xml
deleted file mode 100644
index 22adaa9..0000000
--- a/app/src/main/res/drawable/sh_pop_feed_action.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_reset_btn.xml b/app/src/main/res/drawable/sh_reset_btn.xml
deleted file mode 100644
index 81a6d1e..0000000
--- a/app/src/main/res/drawable/sh_reset_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_special_page_btn.xml b/app/src/main/res/drawable/sh_special_page_btn.xml
deleted file mode 100644
index 2bf8099..0000000
--- a/app/src/main/res/drawable/sh_special_page_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_tip_btn.xml b/app/src/main/res/drawable/sh_tip_btn.xml
deleted file mode 100644
index 3b39254..0000000
--- a/app/src/main/res/drawable/sh_tip_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_video_btn.xml b/app/src/main/res/drawable/sh_video_btn.xml
deleted file mode 100644
index e8bb672..0000000
--- a/app/src/main/res/drawable/sh_video_btn.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sh_wechat_comment_input.xml b/app/src/main/res/drawable/sh_wechat_comment_input.xml
deleted file mode 100644
index 01cefe1..0000000
--- a/app/src/main/res/drawable/sh_wechat_comment_input.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_edit_cursor.xml b/app/src/main/res/drawable/shape_edit_cursor.xml
deleted file mode 100644
index 7e15349..0000000
--- a/app/src/main/res/drawable/shape_edit_cursor.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_edit_selected.xml b/app/src/main/res/drawable/shape_edit_selected.xml
deleted file mode 100644
index f16b27c..0000000
--- a/app/src/main/res/drawable/shape_edit_selected.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- -
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_edit_unselected.xml b/app/src/main/res/drawable/shape_edit_unselected.xml
deleted file mode 100644
index 459b704..0000000
--- a/app/src/main/res/drawable/shape_edit_unselected.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- -
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_input_layout.xml b/app/src/main/res/drawable/shape_input_layout.xml
deleted file mode 100644
index 2fae6e9..0000000
--- a/app/src/main/res/drawable/shape_input_layout.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_video_input_text.xml b/app/src/main/res/drawable/shape_video_input_text.xml
deleted file mode 100644
index 49af1f5..0000000
--- a/app/src/main/res/drawable/shape_video_input_text.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_auto_reset_disable_layout.xml b/app/src/main/res/layout/activity_api_auto_reset_disable_layout.xml
deleted file mode 100644
index b2a6c15..0000000
--- a/app/src/main/res/layout/activity_api_auto_reset_disable_layout.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_auto_reset_enable_layout.xml b/app/src/main/res/layout/activity_api_auto_reset_enable_layout.xml
deleted file mode 100644
index 45402ba..0000000
--- a/app/src/main/res/layout/activity_api_auto_reset_enable_layout.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_auto_reset_enable_on_empty_view_layout.xml b/app/src/main/res/layout/activity_api_auto_reset_enable_on_empty_view_layout.xml
deleted file mode 100644
index 0dc2413..0000000
--- a/app/src/main/res/layout/activity_api_auto_reset_enable_on_empty_view_layout.xml
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_auto_reset_enable_on_recyclerview_layout.xml b/app/src/main/res/layout/activity_api_auto_reset_enable_on_recyclerview_layout.xml
deleted file mode 100644
index 53ecb9c..0000000
--- a/app/src/main/res/layout/activity_api_auto_reset_enable_on_recyclerview_layout.xml
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_auto_reset_enbale_on_cus_recyclerview_layout.xml b/app/src/main/res/layout/activity_api_auto_reset_enbale_on_cus_recyclerview_layout.xml
deleted file mode 100644
index 743af11..0000000
--- a/app/src/main/res/layout/activity_api_auto_reset_enbale_on_cus_recyclerview_layout.xml
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_content_cus_layout.xml b/app/src/main/res/layout/activity_api_content_cus_layout.xml
deleted file mode 100644
index b328793..0000000
--- a/app/src/main/res/layout/activity_api_content_cus_layout.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_content_frame_layout.xml b/app/src/main/res/layout/activity_api_content_frame_layout.xml
deleted file mode 100644
index 2c90782..0000000
--- a/app/src/main/res/layout/activity_api_content_frame_layout.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_content_linear_layout.xml b/app/src/main/res/layout/activity_api_content_linear_layout.xml
deleted file mode 100644
index d86576f..0000000
--- a/app/src/main/res/layout/activity_api_content_linear_layout.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_content_relative_layout.xml b/app/src/main/res/layout/activity_api_content_relative_layout.xml
deleted file mode 100644
index f6c4213..0000000
--- a/app/src/main/res/layout/activity_api_content_relative_layout.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_cus_panel_layout.xml b/app/src/main/res/layout/activity_api_cus_panel_layout.xml
deleted file mode 100644
index c781c4f..0000000
--- a/app/src/main/res/layout/activity_api_cus_panel_layout.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_api_default_panel_height_layout.xml b/app/src/main/res/layout/activity_api_default_panel_height_layout.xml
deleted file mode 100644
index 39cb3bd..0000000
--- a/app/src/main/res/layout/activity_api_default_panel_height_layout.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_bilibili_video_layout.xml b/app/src/main/res/layout/activity_bilibili_video_layout.xml
deleted file mode 100644
index 7edc46f..0000000
--- a/app/src/main/res/layout/activity_bilibili_video_layout.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_chat_fragment_layout.xml b/app/src/main/res/layout/activity_chat_fragment_layout.xml
deleted file mode 100644
index 761f19d..0000000
--- a/app/src/main/res/layout/activity_chat_fragment_layout.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_douyin_live_layout.xml b/app/src/main/res/layout/activity_douyin_live_layout.xml
deleted file mode 100644
index 4e2f7ba..0000000
--- a/app/src/main/res/layout/activity_douyin_live_layout.xml
+++ /dev/null
@@ -1,248 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_feed_dialog_layout.xml b/app/src/main/res/layout/activity_feed_dialog_layout.xml
deleted file mode 100644
index 7c98ff3..0000000
--- a/app/src/main/res/layout/activity_feed_dialog_layout.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_feed_layout.xml b/app/src/main/res/layout/activity_feed_layout.xml
deleted file mode 100644
index 65220ce..0000000
--- a/app/src/main/res/layout/activity_feed_layout.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_huya_live_layout.xml b/app/src/main/res/layout/activity_huya_live_layout.xml
deleted file mode 100644
index 6ba6dcf..0000000
--- a/app/src/main/res/layout/activity_huya_live_layout.xml
+++ /dev/null
@@ -1,214 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main_layout.xml b/app/src/main/res/layout/activity_main_layout.xml
deleted file mode 100644
index fc401eb..0000000
--- a/app/src/main/res/layout/activity_main_layout.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_super_chat_layout.xml b/app/src/main/res/layout/activity_super_chat_layout.xml
deleted file mode 100644
index 1d92e54..0000000
--- a/app/src/main/res/layout/activity_super_chat_layout.xml
+++ /dev/null
@@ -1,231 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/common_chat_layout.xml b/app/src/main/res/layout/common_chat_layout.xml
deleted file mode 100644
index 1f2452f..0000000
--- a/app/src/main/res/layout/common_chat_layout.xml
+++ /dev/null
@@ -1,214 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/common_chat_with_titlebar_layout.xml b/app/src/main/res/layout/common_chat_with_titlebar_layout.xml
deleted file mode 100644
index 8e759ca..0000000
--- a/app/src/main/res/layout/common_chat_with_titlebar_layout.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_feed_comment_layout.xml b/app/src/main/res/layout/dialog_feed_comment_layout.xml
deleted file mode 100644
index 902bb58..0000000
--- a/app/src/main/res/layout/dialog_feed_comment_layout.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/holder_douyin_chat_item.xml b/app/src/main/res/layout/holder_douyin_chat_item.xml
deleted file mode 100644
index 043834b..0000000
--- a/app/src/main/res/layout/holder_douyin_chat_item.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/holder_feed_cover_layout.xml b/app/src/main/res/layout/holder_feed_cover_layout.xml
deleted file mode 100644
index 17164dc..0000000
--- a/app/src/main/res/layout/holder_feed_cover_layout.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/holder_feed_item_layout.xml b/app/src/main/res/layout/holder_feed_item_layout.xml
deleted file mode 100644
index e2a500a..0000000
--- a/app/src/main/res/layout/holder_feed_item_layout.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/holder_huya_chat_item.xml b/app/src/main/res/layout/holder_huya_chat_item.xml
deleted file mode 100644
index 4f8ed54..0000000
--- a/app/src/main/res/layout/holder_huya_chat_item.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_parent_title_layout.xml b/app/src/main/res/layout/list_parent_title_layout.xml
deleted file mode 100644
index 1d0fae8..0000000
--- a/app/src/main/res/layout/list_parent_title_layout.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/list_sub_title_layout.xml b/app/src/main/res/layout/list_sub_title_layout.xml
deleted file mode 100644
index 90be0bc..0000000
--- a/app/src/main/res/layout/list_sub_title_layout.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/panel_add_layout.xml b/app/src/main/res/layout/panel_add_layout.xml
deleted file mode 100644
index 74f1dd2..0000000
--- a/app/src/main/res/layout/panel_add_layout.xml
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/panel_bilibili_layout.xml b/app/src/main/res/layout/panel_bilibili_layout.xml
deleted file mode 100644
index e71c0ca..0000000
--- a/app/src/main/res/layout/panel_bilibili_layout.xml
+++ /dev/null
@@ -1,337 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/panel_emotion_layout.xml b/app/src/main/res/layout/panel_emotion_layout.xml
deleted file mode 100644
index db9310b..0000000
--- a/app/src/main/res/layout/panel_emotion_layout.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/panel_include_edit_layout.xml b/app/src/main/res/layout/panel_include_edit_layout.xml
deleted file mode 100644
index 3f19b59..0000000
--- a/app/src/main/res/layout/panel_include_edit_layout.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/pop_bilibili_video_comment_layout.xml b/app/src/main/res/layout/pop_bilibili_video_comment_layout.xml
deleted file mode 100644
index b47c8d9..0000000
--- a/app/src/main/res/layout/pop_bilibili_video_comment_layout.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/pop_feed_action_layout.xml b/app/src/main/res/layout/pop_feed_action_layout.xml
deleted file mode 100644
index f22e04f..0000000
--- a/app/src/main/res/layout/pop_feed_action_layout.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/pop_huya_live_comment_layout.xml b/app/src/main/res/layout/pop_huya_live_comment_layout.xml
deleted file mode 100644
index d39b767..0000000
--- a/app/src/main/res/layout/pop_huya_live_comment_layout.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/vh_chat_left_layout.xml b/app/src/main/res/layout/vh_chat_left_layout.xml
deleted file mode 100644
index 582d0d6..0000000
--- a/app/src/main/res/layout/vh_chat_left_layout.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/vh_chat_right_layout.xml b/app/src/main/res/layout/vh_chat_right_layout.xml
deleted file mode 100644
index 381614a..0000000
--- a/app/src/main/res/layout/vh_chat_right_layout.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/vh_emotion_item_layout.xml b/app/src/main/res/layout/vh_emotion_item_layout.xml
deleted file mode 100644
index ef4b13f..0000000
--- a/app/src/main/res/layout/vh_emotion_item_layout.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_status_bar_layout.xml b/app/src/main/res/layout/view_status_bar_layout.xml
deleted file mode 100644
index 8f8b894..0000000
--- a/app/src/main/res/layout/view_status_bar_layout.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/raw/uzi.mp4 b/app/src/main/res/raw/uzi.mp4
deleted file mode 100644
index 2c27f0a..0000000
Binary files a/app/src/main/res/raw/uzi.mp4 and /dev/null differ
diff --git a/app/src/main/res/raw/yexiaoma.mp4 b/app/src/main/res/raw/yexiaoma.mp4
deleted file mode 100644
index c6a733f..0000000
Binary files a/app/src/main/res/raw/yexiaoma.mp4 and /dev/null differ
diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml
deleted file mode 100644
index 225a8b6..0000000
--- a/app/src/main/res/values/attr.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
deleted file mode 100644
index b2da5c1..0000000
--- a/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
- #3F51B5
- #303F9F
- #FF4081
-
- #FAFAFA
- #F5F5F5
- #EEEEEE
- #E0E0E0
- #BDBDBD
- #9E9E9E
- #757575
- #616161
- #424242
- #212121
-
- #ebebeb
- @android:color/white
- #2196F3
- #009688
- #FFC107
- #FF5722
- #673AB7
- #8BC34A
- #E91E63
- #212121
- #00BCD4
-
- #5FFFFFFF
-
-
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 316eead..0000000
--- a/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
- -1dp
- 1dp
- 3dp
- 5dp
- 7.5dp
- 10dp
- 15dp
- 20dp
- 30dp
- 35dp
- 40dp
- 50dp
- 60dp
- 80dp
- 200dp
- 250dp
-
-
- 10sp
- 12sp
- 14sp
- 16sp
- 20sp
- 15sp
-
- 1px
- -1px
-
- 25dp
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
deleted file mode 100644
index 594a0ba..0000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
- 切换面板框架演示
- 我是一个dialog
- 我是一个pupupwindow
- 我是一个dialogfragment
- 发送
- 提示信息:\n框架支持任何页面的沉浸,基本满足绝大部分 app 页面 UI 涉及。完全全屏的页面接入请参考视频场景下的横屏处理。框架 Demo 提供 聊天/视频/信息流/直播 等主流场景方案,如遇到疑惑请备注\n \"机型-版本-框架版本-场景简述\" 作为标题提交 issue 并附上伪代码或者代码进行详细描述。所有问题都会第一时间得到作者回应。
-
- 相册
- 拍摄
- 视频通话
- 位置
- 语音输入
- 名片
-
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
deleted file mode 100644
index 35353f5..0000000
--- a/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/build.gradle b/build.gradle
index bf16a2b..c41ad29 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,11 +9,11 @@ buildscript {
repositories {
google()
jcenter()
+ maven { url 'https://jitpack.io' }
}
dependencies {
classpath deps.android_gradle_plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'com.novoda:bintray-release:0.9.1'
}
}
@@ -21,7 +21,7 @@ allprojects {
repositories {
google()
jcenter()
- maven { url 'https://dl.bintray.com/yummylau/maven' }
+ maven { url 'https://jitpack.io' }
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
diff --git a/gradle.properties b/gradle.properties
index 3a1e71f..31fd5b3 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -13,7 +13,7 @@
#Fri Jun 12 11:17:21 CST 2020
android.enableJetifier=true
android.useAndroidX=true
-android_gradle_plugin=3.4.0
+android_gradle_plugin=3.6.0
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
# mac 升级到 BigSur java 环境发生改变,主动申明
-#org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
+#org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index b68b17d..ab02fb6 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/panel-androidx/build.gradle b/panel-androidx/build.gradle
index 2b2ea4b..f6c6974 100644
--- a/panel-androidx/build.gradle
+++ b/panel-androidx/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
-apply plugin: 'com.novoda.bintray-release'
+apply plugin: 'maven-publish'
android {
compileSdkVersion config.compile_sdk_version
@@ -31,11 +31,30 @@ dependencies {
implementation deps.androidx.appcompat
}
-publish {
- userOrg = 'yummylau'
- groupId = 'com.effective.android'
- artifactId = 'panelSwitchHelper-androidx'
- publishVersion = '1.3.13'
- desc = 'the helper that is used to checkout panel when we are chatting'
- website = 'https://github.com/YummyLau/Anchors'
+task generateSourcesJar(type: Jar) {
+ from android.sourceSets.main.java.srcDirs
+ classifier 'sources'
}
+
+def versionName = "1.4.0"
+
+// Because the components are created only during the afterEvaluate phase, you must
+// configure your publications using the afterEvaluate() lifecycle method.
+afterEvaluate {
+ publishing {
+ publications {
+ Production(MavenPublication) {
+ // Creates a Maven publication called "release".
+ // Applies the component for the release build variant.
+ from components.release
+ // You can then customize attributes of the publication as shown below.
+ groupId = 'com.github.Yummylau'
+ artifactId = 'panelSwitchHelper-androidx'
+ version = versionName
+ // 上传source,这样使用放可以看到方法注释
+ artifact generateSourcesJar
+ }
+ }
+ }
+}
+
diff --git a/panel-androidx/src/main/java/com/effective/android/panel/Constants.kt b/panel-androidx/src/main/java/com/effective/android/panel/Constants.kt
index 919134f..c37af66 100644
--- a/panel-androidx/src/main/java/com/effective/android/panel/Constants.kt
+++ b/panel-androidx/src/main/java/com/effective/android/panel/Constants.kt
@@ -18,6 +18,8 @@ object Constants {
const val NAVIGATION_BAR_HEIGHT_RES_NAME = "navigation_bar_height"
const val DIMEN = "dimen"
const val ANDROID = "android"
+ const val SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar"
+
/**
* panel id, custom panel (PanelView) id is panelView's triggerViewId
* [PanelView.getTriggerViewId]
diff --git a/panel-androidx/src/main/java/com/effective/android/panel/PanelSwitchHelper.kt b/panel-androidx/src/main/java/com/effective/android/panel/PanelSwitchHelper.kt
index 9290dd3..34f14b0 100644
--- a/panel-androidx/src/main/java/com/effective/android/panel/PanelSwitchHelper.kt
+++ b/panel-androidx/src/main/java/com/effective/android/panel/PanelSwitchHelper.kt
@@ -9,10 +9,7 @@ import android.widget.EditText
import androidx.annotation.IdRes
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-import com.effective.android.panel.interfaces.ContentScrollMeasurerBuilder
-import com.effective.android.panel.interfaces.PanelHeightMeasurer
-import com.effective.android.panel.interfaces.PanelHeightMeasurerBuilder
+import com.effective.android.panel.interfaces.*
import com.effective.android.panel.interfaces.listener.*
import com.effective.android.panel.log.LogTracker
import com.effective.android.panel.view.PanelSwitchLayout
@@ -40,6 +37,7 @@ class PanelSwitchHelper private constructor(builder: Builder, showKeyboard: Bool
builder.editFocusChangeListeners.add(LogTracker)
}
mPanelSwitchLayout = builder.panelSwitchLayout!!
+ mPanelSwitchLayout.setTriggerViewClickInterceptor(builder.triggerViewClickInterceptor)
mPanelSwitchLayout.setContentScrollOutsizeEnable(builder.contentScrollOutsideEnable)
mPanelSwitchLayout.setScrollMeasurers(builder.contentScrollMeasurers)
mPanelSwitchLayout.setPanelHeightMeasurers(builder.panelHeightMeasurers)
@@ -50,11 +48,11 @@ class PanelSwitchHelper private constructor(builder: Builder, showKeyboard: Bool
}
}
- fun addSecondaryInputView(editText: EditText){
+ fun addSecondaryInputView(editText: EditText) {
mPanelSwitchLayout.getContentContainer().getInputActionImpl().addSecondaryInputView(editText)
}
- fun removeSecondaryInputView(editText: EditText){
+ fun removeSecondaryInputView(editText: EditText) {
mPanelSwitchLayout.getContentContainer().getInputActionImpl().removeSecondaryInputView(editText)
}
@@ -111,6 +109,7 @@ class PanelSwitchHelper private constructor(builder: Builder, showKeyboard: Bool
internal var editFocusChangeListeners: MutableList = mutableListOf()
internal var contentScrollMeasurers: MutableList = mutableListOf()
internal var panelHeightMeasurers: MutableList = mutableListOf()
+ internal var triggerViewClickInterceptor: TriggerViewClickInterceptor? = null
internal var panelSwitchLayout: PanelSwitchLayout? = null
internal var window: Window
internal var rootView: View
@@ -128,6 +127,11 @@ class PanelSwitchHelper private constructor(builder: Builder, showKeyboard: Bool
this.rootView = root
}
+ fun setTriggerViewClickInterceptor(interceptor: TriggerViewClickInterceptor): Builder {
+ this.triggerViewClickInterceptor = interceptor;
+ return this;
+ }
+
/**
* note: helper will set view's onClickListener to View ,so you should add OnViewClickListener for your project.
*
diff --git a/panel-androidx/src/main/java/com/effective/android/panel/interfaces/TriggerViewClickInterceptor.kt b/panel-androidx/src/main/java/com/effective/android/panel/interfaces/TriggerViewClickInterceptor.kt
new file mode 100644
index 0000000..92cc9cf
--- /dev/null
+++ b/panel-androidx/src/main/java/com/effective/android/panel/interfaces/TriggerViewClickInterceptor.kt
@@ -0,0 +1,5 @@
+package com.effective.android.panel.interfaces
+
+interface TriggerViewClickInterceptor {
+ fun intercept(triggerId: Int): Boolean
+}
\ No newline at end of file
diff --git a/panel-androidx/src/main/java/com/effective/android/panel/utils/DisplayUtil.kt b/panel-androidx/src/main/java/com/effective/android/panel/utils/DisplayUtil.kt
index ef308ef..cde00ee 100644
--- a/panel-androidx/src/main/java/com/effective/android/panel/utils/DisplayUtil.kt
+++ b/panel-androidx/src/main/java/com/effective/android/panel/utils/DisplayUtil.kt
@@ -10,10 +10,7 @@ import android.graphics.Rect
import android.os.Build
import android.provider.Settings
import android.util.DisplayMetrics
-import android.view.View
-import android.view.ViewGroup
-import android.view.Window
-import android.view.WindowManager
+import android.view.*
import com.effective.android.panel.Constants
import com.effective.android.panel.R
@@ -180,15 +177,14 @@ object DisplayUtil {
* @param window
* @return
*/
- @JvmStatic
fun isNavBarVisible(context: Context, window: Window): Boolean {
var isVisible = false
- var viewGroup: ViewGroup? = window.decorView as ViewGroup?
+ val viewGroup: ViewGroup? = window.decorView as ViewGroup?
viewGroup?.let {
for (i in 0 until it.childCount) {
- var id: Int = it.getChildAt(i).id
+ val id: Int = it.getChildAt(i).id
if (id != android.view.View.NO_ID) {
- var resourceEntryName: String? = context.resources.getResourceEntryName(id)
+ val resourceEntryName: String? = context.resources.getResourceEntryName(id)
if ((("navigationBarBackground" == resourceEntryName) && it.getChildAt(i).visibility == android.view.View.VISIBLE)) {
isVisible = true
}
@@ -203,16 +199,23 @@ object DisplayUtil {
}
}
}
+ val manufacturer = if (Build.MANUFACTURER == null) "" else Build.MANUFACTURER.trim { it <= ' ' }
+ val isSamsung = manufacturer.toLowerCase().contains("samsung")
+ if((viewGroup == null || !isVisible) && isSamsung){
+ isVisible = hasNavBar(context)
+ }
if (isVisible) {
// 对于三星手机,android10以下非OneUI2的版本,比如 s8,note8 等设备上,导航栏显示存在bug:"当用户隐藏导航栏时显示输入法的时候导航栏会跟随显示",会导致隐藏输入之后判断错误
// 这个问题在 OneUI 2 & android 10 版本已修复,
- val manufacturer = if (Build.MANUFACTURER == null) "" else Build.MANUFACTURER.trim { it <= ' ' }
- if (manufacturer.toLowerCase().contains("samsung")
- && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
+ if (isSamsung && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
try {
- return Settings.Global.getInt(context.contentResolver, "navigationbar_hide_bar_enabled") == 0
+ isVisible = Settings.Global.getInt(
+ context.contentResolver,
+ "navigationbar_hide_bar_enabled"
+ ) == 0
+ if (isVisible) return true
} catch (e: Exception) {
- //nothing to do
+ e.printStackTrace()
}
}
isVisible = !hasSystemUIFlag(window, View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)
@@ -220,11 +223,64 @@ object DisplayUtil {
return isVisible
}
+ private fun hasNavBar(context: Context): Boolean {
+ val res = context.resources
+ val resourceId = res.getIdentifier(
+ Constants.SHOW_NAV_BAR_RES_NAME,
+ "bool",
+ "android"
+ )
+ return if (resourceId != 0) {
+ var hasNav = res.getBoolean(resourceId)
+ // check override flag (see static block)
+
+ // Android allows a system property to override the presence of the navigation bar.
+ // Used by the emulator.
+ // See https://github.com/android/platform_frameworks_base/blob/master/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java#L1076
+ var sNavBarOverride:String? = null
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ try {
+ val c = Class.forName("android.os.SystemProperties")
+ val m = c.getDeclaredMethod("get", String::class.java)
+ m.isAccessible = true
+ sNavBarOverride = m.invoke(null, "qemu.hw.mainkeys") as? String
+ } catch (e: Throwable) {
+ sNavBarOverride = null
+ }
+ }
+ if ("1" == sNavBarOverride) {
+ hasNav = false
+ } else if ("0" == sNavBarOverride) {
+ hasNav = true
+ }
+ hasNav
+ } else { // fallback
+ !ViewConfiguration.get(context).hasPermanentMenuKey()
+ }
+ }
+
@JvmStatic
fun dip2px(context: Context, dipValue: Float): Int {
+ compatSizeProxy?.let {
+ return it.dip2px(context, dipValue)
+ }
val scale: Float = context.resources.displayMetrics.density
return (dipValue * scale + 0.5f).toInt()
}
fun hasSystemUIFlag(window: Window, flag: Int): Boolean = window.decorView.systemUiVisibility and flag == flag
+
+ interface CompatSizeProxy {
+ fun dip2px(context: Context, dipValue: Float): Int
+ }
+
+ private var compatSizeProxy: CompatSizeProxy? = null
+
+ /**
+ * 兼容autoSize
+ */
+ @JvmStatic
+ fun setCompatSizeProxy(proxy: CompatSizeProxy) {
+ this.compatSizeProxy = compatSizeProxy
+ }
}
diff --git a/panel-androidx/src/main/java/com/effective/android/panel/view/PanelSwitchLayout.kt b/panel-androidx/src/main/java/com/effective/android/panel/view/PanelSwitchLayout.kt
index b27eaff..ec7ec0a 100644
--- a/panel-androidx/src/main/java/com/effective/android/panel/view/PanelSwitchLayout.kt
+++ b/panel-androidx/src/main/java/com/effective/android/panel/view/PanelSwitchLayout.kt
@@ -19,6 +19,7 @@ import com.effective.android.panel.device.DeviceInfo
import com.effective.android.panel.device.DeviceRuntime
import com.effective.android.panel.interfaces.ContentScrollMeasurer
import com.effective.android.panel.interfaces.PanelHeightMeasurer
+import com.effective.android.panel.interfaces.TriggerViewClickInterceptor
import com.effective.android.panel.interfaces.ViewAssertion
import com.effective.android.panel.interfaces.listener.*
import com.effective.android.panel.log.LogFormatter
@@ -64,6 +65,7 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
private lateinit var contentContainer: IContentContainer
private lateinit var panelContainer: PanelContainer
private lateinit var window: Window
+ private var triggerViewClickInterceptor: TriggerViewClickInterceptor? = null
private val contentScrollMeasurers = mutableListOf()
private val panelHeightMeasurers = HashMap()
@@ -116,6 +118,10 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
TAG = "${PanelSwitchLayout::class.java.simpleName}(${hashCode()})"
}
+ internal fun setTriggerViewClickInterceptor(interceptor: TriggerViewClickInterceptor?) {
+ this.triggerViewClickInterceptor = interceptor
+ }
+
internal fun setContentScrollOutsizeEnable(enable: Boolean) {
this.contentScrollOutsizeEnable = enable
}
@@ -182,6 +188,11 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
val keyView = contentContainer.findTriggerView(panelView.getBindingTriggerViewId())
keyView?.setOnClickListener(object : OnClickListener {
override fun onClick(v: View) {
+ triggerViewClickInterceptor?.let {
+ if (it.intercept(v.id)) {
+ return
+ }
+ }
val currentTime = System.currentTimeMillis()
if (currentTime - preClickTime <= Constants.PROTECT_KEY_CLICK_DURATION) {
LogTracker.log("$TAG#initListener", "panelItem invalid click! preClickTime: $preClickTime currentClickTime: $currentTime")
@@ -628,7 +639,7 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
//模仿系统输入法隐藏,如果直接掉 checkoutPanel(Constants.PANEL_NONE),可能导致隐藏时上层 recyclerview 因为 layout 导致界面出现短暂卡顿。
if (isKeyboardState()) {
if (isKeyboardShowing) {
- contentContainer.getInputActionImpl().hideKeyboard(true)
+ contentContainer.getInputActionImpl().hideKeyboard(isKeyboardShowing, true)
} else {
checkoutPanel(Constants.PANEL_NONE)
return false
@@ -670,7 +681,7 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
when (panelId) {
Constants.PANEL_NONE -> {
- contentContainer.getInputActionImpl().hideKeyboard(true)
+ contentContainer.getInputActionImpl().hideKeyboard(isKeyboardShowing, true)
contentContainer.getResetActionImpl().enableReset(false)
}
@@ -690,7 +701,7 @@ class PanelSwitchLayout : LinearLayout, ViewAssertion {
if (size.first != oldSize.first || size.second != oldSize.second) {
notifyPanelSizeChange(panelContainer.getPanelView(panelId), isPortrait(context), oldSize.first, oldSize.second, size.first, size.second)
}
- contentContainer.getInputActionImpl().hideKeyboard(false)
+ contentContainer.getInputActionImpl().hideKeyboard(isKeyboardShowing, false)
contentContainer.getResetActionImpl().enableReset(true)
}
}
diff --git a/panel-androidx/src/main/java/com/effective/android/panel/view/content/ContentContainerImpl.kt b/panel-androidx/src/main/java/com/effective/android/panel/view/content/ContentContainerImpl.kt
index bdb39dd..a3bf2d8 100644
--- a/panel-androidx/src/main/java/com/effective/android/panel/view/content/ContentContainerImpl.kt
+++ b/panel-androidx/src/main/java/com/effective/android/panel/view/content/ContentContainerImpl.kt
@@ -296,9 +296,11 @@ class ContentContainerImpl(private val mViewGroup: ViewGroup, private val autoRe
}
}
- override fun hideKeyboard(clearFocus: Boolean) {
+ override fun hideKeyboard(isKeyboardShowing: Boolean, clearFocus: Boolean) {
val targetView = if (realEditViewAttach) mainInputView else mPixelInputView
- PanelUtil.hideKeyboard(context, targetView)
+ if (isKeyboardShowing) {
+ PanelUtil.hideKeyboard(context, targetView)
+ }
if (clearFocus) {
targetView.clearFocus()
}
diff --git a/panel-androidx/src/main/java/com/effective/android/panel/view/content/IContentContainer.kt b/panel-androidx/src/main/java/com/effective/android/panel/view/content/IContentContainer.kt
index f7ecca8..690e1ea 100644
--- a/panel-androidx/src/main/java/com/effective/android/panel/view/content/IContentContainer.kt
+++ b/panel-androidx/src/main/java/com/effective/android/panel/view/content/IContentContainer.kt
@@ -29,7 +29,7 @@ interface IInputAction {
fun setEditTextClickListener(l: View.OnClickListener)
fun setEditTextFocusChangeListener(l: OnFocusChangeListener)
fun requestKeyboard()
- fun hideKeyboard(clearFocus : Boolean)
+ fun hideKeyboard(isKeyboardShowing : Boolean,clearFocus : Boolean)
fun showKeyboard() : Boolean
fun getFullScreenPixelInputView(): EditText
fun updateFullScreenParams(isFullScreen : Boolean, panelId : Int, panelHeight : Int)
diff --git a/panel/.gitignore b/panel/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/panel/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/panel/build.gradle b/panel/build.gradle
deleted file mode 100644
index ccde96a..0000000
--- a/panel/build.gradle
+++ /dev/null
@@ -1,41 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'com.novoda.bintray-release'
-
-android {
- compileSdkVersion config.compile_sdk_version
-
- defaultConfig {
- multiDexEnabled true
- minSdkVersion config.min_sdk_version
- targetSdkVersion config.target_sdk_version
- versionCode config.version_code
- versionName config.version_name
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation deps.support.annotations
- implementation deps.support.v7
-}
-
-publish {
- userOrg = 'yummylau'
- groupId = 'com.effective.android'
- artifactId = 'panelSwitchHelper'
- publishVersion = '1.3.13'
- desc = 'the helper that is used to checkout panel when we are chatting'
- website = 'https://github.com/YummyLau/Anchors'
-}
diff --git a/panel/consumer-rules.pro b/panel/consumer-rules.pro
deleted file mode 100644
index e69de29..0000000
diff --git a/panel/proguard-rules.pro b/panel/proguard-rules.pro
deleted file mode 100644
index f1b4245..0000000
--- a/panel/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/panel/src/main/AndroidManifest.xml b/panel/src/main/AndroidManifest.xml
deleted file mode 100644
index 80b704c..0000000
--- a/panel/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/panel/src/main/java/com/effective/android/panel/Constants.kt b/panel/src/main/java/com/effective/android/panel/Constants.kt
deleted file mode 100644
index 8def705..0000000
--- a/panel/src/main/java/com/effective/android/panel/Constants.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.effective.android.panel
-
-/**
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-object Constants {
-
- const val LOG_TAG = "Panel"
- //输入法高度
- const val KB_PANEL_PREFERENCE_NAME = "ky_panel_name"
- const val KEYBOARD_HEIGHT_FOR_L = "keyboard_height_for_l"
- const val KEYBOARD_HEIGHT_FOR_P = "keyboard_height_for_p"
- const val DEFAULT_KEYBOARD_HEIGHT_FOR_L = 198f
- const val DEFAULT_KEYBOARD_HEIGHT_FOR_P = 290f
- const val STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height"
- const val NAVIGATION_BAR_HEIGHT_RES_NAME = "navigation_bar_height"
- const val DIMEN = "dimen"
- const val ANDROID = "android"
- /**
- * panel id, custom panel (PanelView) id is panelView's triggerViewId
- * [PanelView.getTriggerViewId]
- */
- const val PANEL_NONE = -1
- const val PANEL_KEYBOARD = 0
- const val PROTECT_KEY_CLICK_DURATION = 500L
-
- @JvmField
- var DEBUG = false
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/PanelSwitchHelper.kt b/panel/src/main/java/com/effective/android/panel/PanelSwitchHelper.kt
deleted file mode 100644
index 7e19d3f..0000000
--- a/panel/src/main/java/com/effective/android/panel/PanelSwitchHelper.kt
+++ /dev/null
@@ -1,237 +0,0 @@
-package com.effective.android.panel
-
-import android.R
-import android.app.Activity
-import android.support.annotation.IdRes
-import android.support.v4.app.DialogFragment
-import android.support.v4.app.Fragment
-import android.view.View
-import android.view.ViewGroup
-import android.view.Window
-import android.widget.EditText
-import com.effective.android.panel.interfaces.*
-import com.effective.android.panel.interfaces.listener.*
-import com.effective.android.panel.log.LogTracker
-import com.effective.android.panel.view.PanelSwitchLayout
-
-/**
- * the helper of panel switching
- * Created by yummyLau on 2018-6-21.
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- *
- *
- * updated by yummyLau on 20/03/18
- * 重构整个输入法切换框架,移除旧版使用 weight+Runnable延迟切换,使用新版 layout+动画无缝衔接!
- */
-class PanelSwitchHelper private constructor(builder: Builder, showKeyboard: Boolean) {
-
- private val mPanelSwitchLayout: PanelSwitchLayout
-
- init {
- Constants.DEBUG = builder.logTrack
- if (builder.logTrack) {
- builder.viewClickListeners.add(LogTracker)
- builder.panelChangeListeners.add(LogTracker)
- builder.keyboardStatusListeners.add(LogTracker)
- builder.editFocusChangeListeners.add(LogTracker)
- }
- mPanelSwitchLayout = builder.panelSwitchLayout!!
- mPanelSwitchLayout.setContentScrollOutsizeEnable(builder.contentScrollOutsideEnable)
- mPanelSwitchLayout.setScrollMeasurers(builder.contentScrollMeasurers)
- mPanelSwitchLayout.setPanelHeightMeasurers(builder.panelHeightMeasurers)
- mPanelSwitchLayout.bindListener(builder.viewClickListeners, builder.panelChangeListeners, builder.keyboardStatusListeners, builder.editFocusChangeListeners)
- mPanelSwitchLayout.bindWindow(builder.window)
- if (showKeyboard) {
- mPanelSwitchLayout.toKeyboardState(true)
- }
- }
-
- fun addSecondaryInputView(editText: EditText){
- mPanelSwitchLayout.getContentContainer().getInputActionImpl().addSecondaryInputView(editText)
- }
-
- fun removeSecondaryInputView(editText: EditText){
- mPanelSwitchLayout.getContentContainer().getInputActionImpl().removeSecondaryInputView(editText)
- }
-
- fun hookSystemBackByPanelSwitcher(): Boolean {
- return mPanelSwitchLayout.hookSystemBackByPanelSwitcher()
- }
-
- fun isPanelState() = mPanelSwitchLayout.isPanelState()
-
- fun isKeyboardState() = mPanelSwitchLayout.isKeyboardState()
-
- fun isResetState() = mPanelSwitchLayout.isResetState()
-
- /**
- * 设置内容滑动
- */
- fun setContentScrollOutsideEnable(enable: Boolean) {
- mPanelSwitchLayout.setContentScrollOutsizeEnable(enable)
- }
-
- /**
- * 判断内容是否允许滑动
- */
- fun isContentScrollOutsizeEnable() = mPanelSwitchLayout.isContentScrollOutsizeEnable()
-
- /**
- * 外部显示输入框
- */
- @JvmOverloads
- fun toKeyboardState(async: Boolean = false) {
- mPanelSwitchLayout.toKeyboardState(async)
- }
-
- /**
- * 外部显示面板
- */
- fun toPanelState(@IdRes triggerViewId: Int) {
- mPanelSwitchLayout.findViewById(triggerViewId).let {
- it.performClick()
- }
- }
-
- /**
- * 隐藏输入法或者面板
- */
- fun resetState() {
- mPanelSwitchLayout.checkoutPanel(Constants.PANEL_NONE)
- }
-
- class Builder(window: Window?, root: View?) {
- internal var viewClickListeners: MutableList = mutableListOf()
- internal var panelChangeListeners: MutableList = mutableListOf()
- internal var keyboardStatusListeners: MutableList = mutableListOf()
- internal var editFocusChangeListeners: MutableList = mutableListOf()
- internal var contentScrollMeasurers: MutableList = mutableListOf()
- internal var panelHeightMeasurers: MutableList = mutableListOf()
- internal var panelSwitchLayout: PanelSwitchLayout? = null
- internal var window: Window
- internal var rootView: View
- internal var logTrack = false
- internal var contentScrollOutsideEnable = true
-
- constructor(activity: Activity) : this(activity.window, activity.window.decorView.findViewById(R.id.content))
- constructor(fragment: Fragment) : this(fragment.activity?.window, fragment.view)
- constructor(dialogFragment: DialogFragment) : this(dialogFragment.activity?.window, dialogFragment.view)
-
- init {
- requireNotNull(window) { "PanelSwitchHelper\$Builder#build : window can't be null!please set value by call #Builder" }
- this.window = window
- requireNotNull(root) { "PanelSwitchHelper\$Builder#build : rootView can't be null!please set value by call #Builder" }
- this.rootView = root
- }
-
- /**
- * note: helper will set view's onClickListener to View ,so you should add OnViewClickListener for your project.
- *
- * @param listener
- * @return
- */
- fun addViewClickListener(listener: OnViewClickListener): Builder {
- if (!viewClickListeners.contains(listener)) {
- viewClickListeners.add(listener)
- }
- return this
- }
-
- fun addViewClickListener(function: OnViewClickListenerBuilder.() -> Unit): Builder {
- viewClickListeners.add(OnViewClickListenerBuilder().also(function))
- return this
- }
-
- fun addPanelChangeListener(listener: OnPanelChangeListener): Builder {
- if (!panelChangeListeners.contains(listener)) {
- panelChangeListeners.add(listener)
- }
- return this
- }
-
- fun addPanelChangeListener(function: OnPanelChangeListenerBuilder.() -> Unit): Builder {
- panelChangeListeners.add(OnPanelChangeListenerBuilder().also(function))
- return this
- }
-
- fun addKeyboardStateListener(listener: OnKeyboardStateListener): Builder {
- if (!keyboardStatusListeners.contains(listener)) {
- keyboardStatusListeners.add(listener)
- }
- return this
- }
-
- fun addKeyboardStateListener(function: OnKeyboardStateListenerBuilder.() -> Unit): Builder {
- keyboardStatusListeners.add(OnKeyboardStateListenerBuilder().also(function))
- return this
- }
-
- fun addEditTextFocusChangeListener(listener: OnEditFocusChangeListener): Builder {
- if (!editFocusChangeListeners.contains(listener)) {
- editFocusChangeListeners.add(listener)
- }
- return this
- }
-
- fun addEditTextFocusChangeListener(function: OnEditFocusChangeListenerBuilder.() -> Unit): Builder {
- editFocusChangeListeners.add(OnEditFocusChangeListenerBuilder().also(function))
- return this
- }
-
- fun addContentScrollMeasurer(function: ContentScrollMeasurerBuilder.() -> Unit): Builder {
- contentScrollMeasurers.add(ContentScrollMeasurerBuilder().also(function))
- return this
- }
-
- fun addContentScrollMeasurer(scrollMeasurer: ContentScrollMeasurer): Builder {
- if (!contentScrollMeasurers.contains(scrollMeasurer)) {
- contentScrollMeasurers.add(scrollMeasurer)
- }
- return this
- }
-
- fun addPanelHeightMeasurer(function: PanelHeightMeasurerBuilder.() -> Unit): Builder {
- panelHeightMeasurers.add(PanelHeightMeasurerBuilder().also(function))
- return this
- }
-
- fun addPanelHeightMeasurer(panelHeightMeasurer: PanelHeightMeasurer): Builder {
- if (!panelHeightMeasurers.contains(panelHeightMeasurer)) {
- panelHeightMeasurers.add(panelHeightMeasurer)
- }
- return this
- }
-
- fun contentScrollOutsideEnable(contentScrollOutsideEnable: Boolean): Builder {
- this.contentScrollOutsideEnable = contentScrollOutsideEnable
- return this
- }
-
- fun logTrack(logTrack: Boolean): Builder {
- this.logTrack = logTrack
- return this
- }
-
- @JvmOverloads
- fun build(showKeyboard: Boolean = false): PanelSwitchHelper {
- findSwitchLayout(rootView)
- requireNotNull(panelSwitchLayout) { "PanelSwitchHelper\$Builder#build : not found PanelSwitchLayout!" }
- return PanelSwitchHelper(this, showKeyboard)
- }
-
- private fun findSwitchLayout(view: View) {
- if (view is PanelSwitchLayout) {
- require(panelSwitchLayout == null) { "PanelSwitchHelper\$Builder#build : rootView has one more panelSwitchLayout!" }
- panelSwitchLayout = view
- return
- }
- if (view is ViewGroup) {
- val childCount = view.childCount
- for (i in 0 until childCount) {
- findSwitchLayout(view.getChildAt(i))
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/device/DeviceInfo.kt b/panel/src/main/java/com/effective/android/panel/device/DeviceInfo.kt
deleted file mode 100644
index e93e88a..0000000
--- a/panel/src/main/java/com/effective/android/panel/device/DeviceInfo.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.effective.android.panel.device
-
-import android.view.Window
-
-/**
- * 保存当前设备信息不变的信息
- * Created by yummyLau on 2020-05-24
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-data class DeviceInfo(val window:Window,
- val isPortrait: Boolean,
- val statusBarH: Int,
- val navigationBarH: Int,
- val toolbarH: Int,
- val screenH: Int,
- val screenWithoutSystemUiH: Int,
- val screenWithoutNavigationH: Int) {
-
- /**
- * 由于pad的导航栏无论是横屏还是竖屏,都是在当前界面的底部
- * 而普通的手机,横屏状态下导航栏是在界面的两侧
- * 故需要做区分
- */
- fun getCurrentNavigationBarHeightWhenVisible(isPortrait: Boolean, isPad: Boolean): Int {
- return if (isPortrait) {
- navigationBarH
- } else {
- if (isPad) {
- navigationBarH
- } else {
- 0
- }
- }
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/device/DeviceRuntime.kt b/panel/src/main/java/com/effective/android/panel/device/DeviceRuntime.kt
deleted file mode 100644
index ddb1b2e..0000000
--- a/panel/src/main/java/com/effective/android/panel/device/DeviceRuntime.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.effective.android.panel.device
-
-import android.content.Context
-import android.content.res.Configuration
-import android.view.Window
-import com.effective.android.panel.utils.DisplayUtil
-
-/**
- * 保存当前设备信息跟随用户操作更改信息
- * Created by yummyLau on 2020-05-24
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class DeviceRuntime(val context: Context, val window: Window) {
-
- var deviceInfoP: DeviceInfo? = null
- var deviceInfoL: DeviceInfo? = null
-
- var isNavigationBarShow: Boolean = false
- var isPortrait: Boolean = false
- var isPad: Boolean = false
- var isFullScreen: Boolean = false;
-
- init {
- isPad = (context.resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
- isPortrait = DisplayUtil.isPortrait(context)
- isNavigationBarShow = DisplayUtil.isNavigationBarShow(context, window)
- isFullScreen = DisplayUtil.isFullScreen(window)
- }
-
- fun getDeviceInfoByOrientation(cache: Boolean = false): DeviceInfo {
- isPortrait = DisplayUtil.isPortrait(context)
- isNavigationBarShow = DisplayUtil.isNavigationBarShow(context, window)
- isFullScreen = DisplayUtil.isFullScreen(window)
-
- if (cache) {
- if (isPortrait && deviceInfoP != null) {
- return deviceInfoP!!
- } else if (!isPortrait && deviceInfoL != null) {
- return deviceInfoL!!
- }
- }
-
- val navigationBarHeight = DisplayUtil.getNavigationBarHeight(context,window)
- val statusBarHeight = DisplayUtil.getStatusBarHeight(window)
- //以这种方式计算出来的toolbar,如果和statusBarHeight一样,则实际上就是statusBar的高度,大于statusBar的才是toolBar的高度。
- var toolbarH = DisplayUtil.getToolbarHeight(window)
- if (toolbarH == statusBarHeight) {
- toolbarH = 0
- }
- val screenHeight = DisplayUtil.getScreenRealHeight(window)
- val screenWithoutSystemUIHeight = DisplayUtil.getScreenHeightWithoutSystemUI(window)
- val screenWithoutNavigationHeight = DisplayUtil.getScreenHeightWithoutNavigationBar(context)
-
- return if (isPortrait) {
- deviceInfoP = DeviceInfo(window, true,
- statusBarHeight, navigationBarHeight, toolbarH,
- screenHeight, screenWithoutSystemUIHeight, screenWithoutNavigationHeight)
- deviceInfoP!!
- } else {
- deviceInfoL = DeviceInfo(window, false,
- statusBarHeight, navigationBarHeight, toolbarH,
- screenHeight, screenWithoutSystemUIHeight, screenWithoutNavigationHeight)
- deviceInfoL!!
- }
-
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/interfaces/ContentScrollMeasurer.kt b/panel/src/main/java/com/effective/android/panel/interfaces/ContentScrollMeasurer.kt
deleted file mode 100644
index 11ce565..0000000
--- a/panel/src/main/java/com/effective/android/panel/interfaces/ContentScrollMeasurer.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.effective.android.panel.interfaces
-
-/**
- * 当内容允许滑动时,即[com.effective.android.panel.view.PanelSwitchLayout.isContentScrollOutsizeEnable] 返回true,则默认内容区域会向上 layout 一个面板距离
- * 默认 getScrollDistance 为软键盘/面板的距离
- * Created by yummyLau on 2020-07-08
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-interface ContentScrollMeasurer {
- fun getScrollDistance(defaultDistance: Int): Int
- fun getScrollViewId(): Int
-}
-
-private typealias GetScrollDistance = (defaultDistance: Int) -> Int
-private typealias GetScrollViewId = () -> Int
-
-class ContentScrollMeasurerBuilder : ContentScrollMeasurer {
-
- private var getScrollDistance: GetScrollDistance? = null
- private var getScrollViewId: GetScrollViewId? = null
-
- override fun getScrollDistance(defaultDistance: Int): Int = getScrollDistance?.invoke(defaultDistance) ?: 0
- override fun getScrollViewId(): Int = getScrollViewId?.invoke() ?: -1
-
- fun getScrollDistance(getScrollDistance: GetScrollDistance) {
- this.getScrollDistance = getScrollDistance
- }
-
- fun getScrollViewId(getScrollViewId: GetScrollViewId) {
- this.getScrollViewId = getScrollViewId
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/interfaces/PanelHeightMeasurer.kt b/panel/src/main/java/com/effective/android/panel/interfaces/PanelHeightMeasurer.kt
deleted file mode 100644
index 90ef41c..0000000
--- a/panel/src/main/java/com/effective/android/panel/interfaces/PanelHeightMeasurer.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.effective.android.panel.interfaces
-
-interface PanelHeightMeasurer{
- fun synchronizeKeyboardHeight() : Boolean
- fun getTargetPanelDefaultHeight(): Int
- fun getPanelTriggerId(): Int
-}
-
-private typealias GetTargetPanelDefaultHeight = () -> Int
-private typealias GetPanelId = () -> Int
-private typealias SynchronizeKeyboardHeight = () -> Boolean
-
-class PanelHeightMeasurerBuilder : PanelHeightMeasurer {
-
- private var getPanelDefaultHeight: GetTargetPanelDefaultHeight? = null
- private var getPanelId: GetPanelId? = null
- private var synchronizeKeyboardHeight: SynchronizeKeyboardHeight? = null
-
- override fun getTargetPanelDefaultHeight(): Int = getPanelDefaultHeight?.invoke() ?: 0
-
- override fun getPanelTriggerId(): Int = getPanelId?.invoke() ?: -1
-
- override fun synchronizeKeyboardHeight(): Boolean = synchronizeKeyboardHeight?.invoke() ?: true
-
- fun getTargetPanelDefaultHeight(getPanelDefaultHeight: GetTargetPanelDefaultHeight) {
- this.getPanelDefaultHeight = getPanelDefaultHeight
- }
-
- fun getPanelTriggerId(getPanelId: GetPanelId) {
- this.getPanelId = getPanelId
- }
-
- fun synchronizeKeyboardHeight(synchronizeKeyboardHeight: SynchronizeKeyboardHeight) {
- this.synchronizeKeyboardHeight = synchronizeKeyboardHeight
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/interfaces/ViewAssertion.kt b/panel/src/main/java/com/effective/android/panel/interfaces/ViewAssertion.kt
deleted file mode 100644
index aef9b19..0000000
--- a/panel/src/main/java/com/effective/android/panel/interfaces/ViewAssertion.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.effective.android.panel.interfaces
-
-/**
- * --------------------
- * | PanelSwitchLayout |
- * | ---------------- |
- * | | | |
- * | |ContentContainer| |
- * | | | |
- * | ---------------- |
- * | ---------------- |
- * | | PanelContainer | |
- * | ---------------- |
- * --------------------
- * There are some rules that must be processed:
- *
- * 1. [com.effective.android.panel.view.PanelSwitchLayout] must have only two children
- * [com.effective.android.panel.view.content.IContentContainer] and [com.effective.android.panel.view.PanelContainer]
- *
- * 2. [com.effective.android.panel.view.content.IContentContainer] must set "edit_view" value to provide [android.widget.EditText]
- *
- * 3. [com.effective.android.panel.view.PanelContainer] has some Children that are [com.effective.android.panel.view.PanelView]
- * [com.effective.android.panel.view.PanelView] must set "panel_layout" value to provide panelView and set "panel_trigger" value to
- * specify layout for click to checkout panelView
- *
- * Created by yummyLau on 18-7-10
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-interface ViewAssertion {
- fun assertView()
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnEditFocusChangeListener.kt b/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnEditFocusChangeListener.kt
deleted file mode 100644
index 15f311d..0000000
--- a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnEditFocusChangeListener.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.effective.android.panel.interfaces.listener
-
-import android.view.View
-
-/**
- * listen to [android.widget.EditText] focus change
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- * update 2020/05/08 支持 dsl
- */
-interface OnEditFocusChangeListener {
- fun onFocusChange(view: View?, hasFocus: Boolean)
-}
-private typealias OnFocusChange = (view: View?, hasFocus: Boolean) -> Unit
-
-class OnEditFocusChangeListenerBuilder : OnEditFocusChangeListener {
-
- private var onFocusChange: OnFocusChange? = null
-
- override fun onFocusChange(view: View?, hasFocus: Boolean) {
- onFocusChange?.invoke(view, hasFocus)
- }
-
- fun onFocusChange(onFocusChange: OnFocusChange) {
- this.onFocusChange = onFocusChange
- }
-}
diff --git a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnKeyboardStateListener.kt b/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnKeyboardStateListener.kt
deleted file mode 100644
index 515805f..0000000
--- a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnKeyboardStateListener.kt
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.effective.android.panel.interfaces.listener
-
-
-/**
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- * update 2020/05/08 支持 dsl
- */
-interface OnKeyboardStateListener {
- fun onKeyboardChange(visible: Boolean, height: Int)
-}
-private typealias OnKeyboardChange = (visible: Boolean, height: Int) -> Unit
-
-class OnKeyboardStateListenerBuilder : OnKeyboardStateListener {
-
- private var onKeyboardChange: OnKeyboardChange? = null
-
- override fun onKeyboardChange(visible: Boolean, height: Int) {
- onKeyboardChange?.invoke(visible, height)
- }
-
- fun onKeyboardChange(onKeyboardChange: OnKeyboardChange) {
- this.onKeyboardChange = onKeyboardChange
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnPanelChangeListener.kt b/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnPanelChangeListener.kt
deleted file mode 100644
index a3f02fd..0000000
--- a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnPanelChangeListener.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.effective.android.panel.interfaces.listener
-import com.effective.android.panel.view.panel.IPanelView
-
-/**
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- * update 2020/05/08 支持 dsl
- * update 2020/06/01 不再直接回调可空的panelView,IPanelView 提供更开放的能力
- */
-interface OnPanelChangeListener {
- fun onKeyboard()
- fun onNone()
- fun onPanel(panel: IPanelView?)
- fun onPanelSizeChange(panel: IPanelView?, portrait: Boolean, oldWidth: Int, oldHeight: Int, width: Int, height: Int)
-}
-
-private typealias OnKeyboard = () -> Unit
-private typealias OnNone = () -> Unit
-private typealias OnPanel = (view: IPanelView?) -> Unit
-private typealias OnPanelSizeChange = (panelView: IPanelView?, portrait: Boolean, oldWidth: Int, oldHeight: Int, width: Int, height: Int) -> Unit
-
-class OnPanelChangeListenerBuilder : OnPanelChangeListener {
-
- private var onKeyboard: OnKeyboard? = null
- private var onNone: OnNone? = null
- private var onPanel: OnPanel? = null
- private var onPanelSizeChange: OnPanelSizeChange? = null
-
- override fun onKeyboard() {
- onKeyboard?.invoke()
- }
-
- override fun onNone() {
- onNone?.invoke()
- }
-
- override fun onPanel(panel: IPanelView?) {
- onPanel?.invoke(panel)
- }
-
- override fun onPanelSizeChange(panel: IPanelView?, portrait: Boolean, oldWidth: Int, oldHeight: Int, width: Int, height: Int) {
- onPanelSizeChange?.invoke(panel, portrait, oldWidth, oldHeight, width, height)
- }
-
- fun onKeyboard(onKeyboard: OnKeyboard) {
- this.onKeyboard = onKeyboard
- }
-
- fun onNone(onNone: OnNone) {
- this.onNone = onNone
- }
-
- fun onPanel(onPanel: OnPanel) {
- this.onPanel = onPanel
- }
-
- fun onPanelSizeChange(onPanelSizeChange: OnPanelSizeChange) {
- this.onPanelSizeChange = onPanelSizeChange
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnViewClickListener.kt b/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnViewClickListener.kt
deleted file mode 100644
index de1d925..0000000
--- a/panel/src/main/java/com/effective/android/panel/interfaces/listener/OnViewClickListener.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.effective.android.panel.interfaces.listener
-
-import android.view.View
-
-/**
- * preventing listeners that [com.effective.android.panel.PanelSwitchHelper] set these to view from being overwritten
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- * update 2020/05/08 支持 dsl
- */
-interface OnViewClickListener {
- fun onClickBefore(view: View?)
-}
-
-private typealias OnClickBefore = (view: View?) -> Unit
-
-class OnViewClickListenerBuilder : OnViewClickListener {
-
- private var onClickBefore: OnClickBefore? = null
-
- override fun onClickBefore(view: View?) {
- onClickBefore?.invoke(view)
- }
-
- fun onClickBefore(onClickBefore: OnClickBefore) {
- this.onClickBefore = onClickBefore
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/log/LogFormatter.kt b/panel/src/main/java/com/effective/android/panel/log/LogFormatter.kt
deleted file mode 100644
index 828eee5..0000000
--- a/panel/src/main/java/com/effective/android/panel/log/LogFormatter.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.effective.android.panel.log
-
-
-class LogFormatter {
-
- private val stringBuilder = StringBuilder()
- private val defaultKey = " "
- private var keyLength: Int = 0
-
- constructor(keyLength: Int) {
- this.keyLength = keyLength
- }
-
- companion object {
- fun setUp(int: Int = 50): LogFormatter {
- return LogFormatter(int)
- }
- }
-
- fun addContent(key: String = "", value: String): LogFormatter {
- if (key.isEmpty()) {
- stringBuilder.append("$value \n")
- } else {
- if (key.length < keyLength) {
- stringBuilder.append("$key${defaultKey.subSequence(0, keyLength - key.length)} = $value \n")
- } else {
- stringBuilder.append("$key = $value \n")
- }
- }
- return this
- }
-
- fun log(tag: String) {
- LogTracker.log(tag, stringBuilder.toString())
- stringBuilder.clear()
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/log/LogTracker.kt b/panel/src/main/java/com/effective/android/panel/log/LogTracker.kt
deleted file mode 100644
index 920b200..0000000
--- a/panel/src/main/java/com/effective/android/panel/log/LogTracker.kt
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.effective.android.panel.log
-
-import android.text.TextUtils
-import android.util.Log
-import android.view.View
-import com.effective.android.panel.Constants
-import com.effective.android.panel.interfaces.listener.OnEditFocusChangeListener
-import com.effective.android.panel.interfaces.listener.OnKeyboardStateListener
-import com.effective.android.panel.interfaces.listener.OnPanelChangeListener
-import com.effective.android.panel.interfaces.listener.OnViewClickListener
-import com.effective.android.panel.view.panel.IPanelView
-
-/**
- * single logTracker
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-object LogTracker : OnEditFocusChangeListener, OnKeyboardStateListener, OnPanelChangeListener, OnViewClickListener {
-
- private val TAG = LogTracker::class.java.simpleName
-
- @JvmStatic
- fun log(methodName: String, message: String) {
- if (TextUtils.isEmpty(methodName) || TextUtils.isEmpty(message)) {
- return
- }
- if (Constants.DEBUG) {
- Log.d(TAG, "$methodName => $message")
- }
- }
-
- override fun onFocusChange(view: View?, hasFocus: Boolean) {
- log("OnEditFocusChangeListener#onFocusChange", "EditText has focus ( $hasFocus )")
- }
-
- override fun onKeyboardChange(show: Boolean,height: Int) {
- log("OnKeyboardStateListener#onKeyboardChange", "Keyboard is showing ( $show ),height is $height")
- }
-
- override fun onKeyboard() {
- log("OnPanelChangeListener#onKeyboard", "panel: keyboard")
- }
-
- override fun onNone() {
- log("OnPanelChangeListener#onNone", "panel: none")
- }
-
- override fun onPanel(panel: IPanelView?) {
- log("OnPanelChangeListener#onPanel", "panel:" + (panel?.toString()
- ?: "null"))
- }
-
- override fun onPanelSizeChange(panel: IPanelView?, portrait: Boolean, oldWidth: Int, oldHeight: Int, width: Int, height: Int) {
- log("OnPanelChangeListener#onPanelSizeChange", "panelView is " + (panel?.toString()
- ?: "null" +
- " portrait : " + portrait +
- " oldWidth : " + oldWidth + " oldHeight : " + oldHeight +
- " width : " + width + " height : " + height))
- }
-
- override fun onClickBefore(view: View?) {
- log("OnViewClickListener#onViewClick", "view is " + (view?.toString()
- ?: " null "))
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/utils/DisplayUtil.kt b/panel/src/main/java/com/effective/android/panel/utils/DisplayUtil.kt
deleted file mode 100644
index a96ee1f..0000000
--- a/panel/src/main/java/com/effective/android/panel/utils/DisplayUtil.kt
+++ /dev/null
@@ -1,231 +0,0 @@
-package com.effective.android.panel.utils
-
-import android.annotation.TargetApi
-import android.app.Activity
-import android.content.Context
-import android.content.res.Configuration
-import android.content.res.Resources
-import android.graphics.Point
-import android.graphics.Rect
-import android.os.Build
-import android.provider.Settings
-import android.util.DisplayMetrics
-import android.view.View
-import android.view.ViewGroup
-import android.view.Window
-import android.view.WindowManager
-import com.effective.android.panel.Constants
-import com.effective.android.panel.R
-import java.lang.Exception
-
-
-object DisplayUtil {
-
- /**
- * 获取toolar的高度,但是这个方法仅仅在非沉浸下才有用。
- *
- * @param window
- * @return
- */
- @JvmStatic
- fun getToolbarHeight(window: Window): Int {
- return window.decorView.findViewById(Window.ID_ANDROID_CONTENT).top
- }
-
- @JvmStatic
- fun getLocationOnScreen(view: View): IntArray {
- val contentViewLocationInScreen = IntArray(2)
- view.getLocationOnScreen(contentViewLocationInScreen)
- return contentViewLocationInScreen
- }
-
- @JvmStatic
- fun contentViewCanDrawStatusBarArea(window: Window): Boolean {
- return getLocationOnScreen(window.decorView.findViewById(Window.ID_ANDROID_CONTENT))[1] == 0
- }
-
- /**
- * 对应 id 为 @Android:id/content 的 FrameLayout 所加载的布局。
- * 也就是我们 setContentView 的布局高度
- *
- * @param window
- * @return
- */
- @JvmStatic
- fun getContentViewHeight(window: Window): Int {
- return window.decorView.findViewById(Window.ID_ANDROID_CONTENT).height
- }
-
- /**
- * 获取设备真实高度,包含可能存在的虚拟导航栏,未显示的刘海区域,状态栏等
- */
- fun getScreenRealHeight(window: Window): Int {
- return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- val wm = window.context
- .getSystemService(Context.WINDOW_SERVICE) as WindowManager
- val outMetrics = DisplayMetrics()
- wm.defaultDisplay.getRealMetrics(outMetrics)
- return outMetrics.heightPixels
- } else {
- getScreenHeightWithSystemUI(window)
- }
- }
-
-
- /**
- * 实际上获取的是DecorView的布局高度,是一个 FrameLayout,其内置布局 id 为 com.android.internal.R.layout.screen_simple 的 LinearLayout
- * 包含 id为 @+id/action_mode_bar_stub_ViewStub 的 ViewStub 还有 id 为 @Android:id/content 的 FrameLayout。
- * 如果系统设置刘海留空,则 该高度不包含刘海高度
- *
- * @param window
- * @return
- */
- @JvmStatic
- fun getScreenHeightWithSystemUI(window: Window): Int {
- return window.decorView.height
- }
-
- @JvmStatic
- fun getScreenHeightWithoutNavigationBar(context: Context): Int {
- return context.resources.displayMetrics.heightPixels
- }
-
- @JvmStatic
- fun getScreenHeightWithoutSystemUI(window: Window): Int {
- val r = Rect()
- window.decorView.getWindowVisibleDisplayFrame(r)
- return r.bottom - r.top
- }
-
-
- @JvmStatic
- fun isFullScreen(activity: Activity): Boolean {
- return (activity.window.attributes.flags and WindowManager.LayoutParams.FLAG_FULLSCREEN
- == WindowManager.LayoutParams.FLAG_FULLSCREEN)
- }
-
- @JvmStatic
- fun isFullScreen(window: Window): Boolean {
- return (window.attributes.flags and WindowManager.LayoutParams.FLAG_FULLSCREEN
- == WindowManager.LayoutParams.FLAG_FULLSCREEN)
- }
-
- @JvmStatic
- fun getStatusBarHeight(window: Window): Int {
- val frame = Rect()
- window.decorView.getWindowVisibleDisplayFrame(frame)
- return frame.top
- }
-
-
- @JvmStatic
- fun getNavigationBarHeight(context: Context, window: Window): Int {
- val deviceNavigationHeight = getInternalDimensionSize(context.resources, Constants.NAVIGATION_BAR_HEIGHT_RES_NAME)
- //三星android9 OneUI2.0一下打开全面屏手势,导航栏实际高度比 deviceHeight 小,需要做兼容
- val manufacturer = if (Build.MANUFACTURER == null) "" else Build.MANUFACTURER.trim { it <= ' ' }
- if (manufacturer.toLowerCase().contains("samsung") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
- val stableBottom = window.decorView.rootWindowInsets.stableInsetBottom
- if (stableBottom < deviceNavigationHeight) {
- return stableBottom;
- }
- }
- return deviceNavigationHeight;
- }
-
- private fun getInternalDimensionSize(res: Resources, key: String): Int {
- var result = 0
- val resourceId = res.getIdentifier(key, Constants.DIMEN, Constants.ANDROID)
- if (resourceId > 0) {
- result = res.getDimensionPixelSize(resourceId)
- }
- return result
- }
-
- @JvmStatic
- fun isPortrait(context: Context): Boolean {
- return when (context.resources.configuration.orientation) {
- Configuration.ORIENTATION_PORTRAIT -> {
- true
- }
- Configuration.ORIENTATION_LANDSCAPE -> {
- false
- }
- else -> {
- val display = (context.getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay
- val point = Point()
- display.getSize(point)
- point.x <= point.y
- }
- }
- }
-
- /**
- *
- */
- @JvmStatic
- @TargetApi(14)
- fun isNavigationBarShow(context: Context, window: Window): Boolean {
- return isNavBarVisible(context, window)
- }
-
- /**
- * Decorview 源码
- * public static final ColorViewAttributes NAVIGATION_BAR_COLOR_VIEW_ATTRIBUTES =
- * new ColorViewAttributes(
- * SYSTEM_UI_FLAG_HIDE_NAVIGATION, FLAG_TRANSLUCENT_NAVIGATION,
- * Gravity.BOTTOM, Gravity.RIGHT, Gravity.LEFT,
- * Window.NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME,
- * com.android.internal.R.id.navigationBarBackground,
- *
- * @param context
- * @param window
- * @return
- */
- @JvmStatic
- fun isNavBarVisible(context: Context, window: Window): Boolean {
- var isVisible = false
- var viewGroup: ViewGroup? = window.decorView as ViewGroup?
- viewGroup?.let {
- for (i in 0 until it.childCount) {
- var id: Int = it.getChildAt(i).id
- if (id != android.view.View.NO_ID) {
- var resourceEntryName: String? = context.resources.getResourceEntryName(id)
- if ((("navigationBarBackground" == resourceEntryName) && it.getChildAt(i).visibility == android.view.View.VISIBLE)) {
- isVisible = true
- }
- }
- }
- if (!isVisible) {
- val navigationBarView: View? = it.findViewById(R.id.immersion_navigation_bar_view)
- navigationBarView?.let { navigationBar ->
- if (navigationBar.visibility == View.VISIBLE) {
- isVisible = true
- }
- }
- }
- }
- if (isVisible) {
- // 对于三星手机,android10以下非OneUI2的版本,比如 s8,note8 等设备上,导航栏显示存在bug:"当用户隐藏导航栏时显示输入法的时候导航栏会跟随显示",会导致隐藏输入之后判断错误
- // 这个问题在 OneUI 2 & android 10 版本已修复,
- val manufacturer = if (Build.MANUFACTURER == null) "" else Build.MANUFACTURER.trim { it <= ' ' }
- if (manufacturer.toLowerCase().contains("samsung")
- && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
- try {
- return Settings.Global.getInt(context.contentResolver, "navigationbar_hide_bar_enabled") == 0
- } catch (e: Exception) {
- //nothing to do
- }
- }
- isVisible = !hasSystemUIFlag(window, View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)
- }
- return isVisible
- }
-
- @JvmStatic
- fun dip2px(context: Context, dipValue: Float): Int {
- val scale: Float = context.resources.displayMetrics.density
- return (dipValue * scale + 0.5f).toInt()
- }
-
- fun hasSystemUIFlag(window: Window, flag: Int): Boolean = window.decorView.systemUiVisibility and flag == flag
-}
diff --git a/panel/src/main/java/com/effective/android/panel/utils/PanelUtil.kt b/panel/src/main/java/com/effective/android/panel/utils/PanelUtil.kt
deleted file mode 100644
index 7796119..0000000
--- a/panel/src/main/java/com/effective/android/panel/utils/PanelUtil.kt
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.effective.android.panel.utils
-
-import android.content.Context
-import android.view.View
-import android.view.inputmethod.InputMethodManager
-import com.effective.android.panel.Constants
-import com.effective.android.panel.log.LogTracker
-import com.effective.android.panel.utils.DisplayUtil.dip2px
-import com.effective.android.panel.utils.DisplayUtil.isPortrait
-
-/**
- * panel helper
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-object PanelUtil {
-
- private var pHeight: Int = -1
- private var lHeight: Int = -1
-
- @JvmStatic
- fun clearData(context: Context) {
- pHeight = -1
- lHeight = -1
- val sp = context.getSharedPreferences(Constants.KB_PANEL_PREFERENCE_NAME, Context.MODE_PRIVATE)
- sp.edit().clear().apply()
- }
-
- @JvmStatic
- fun showKeyboard(context: Context, view: View): Boolean {
- view.requestFocus()
- val mInputManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
- return mInputManager.showSoftInput(view, 0)
- }
-
- @JvmStatic
- fun hideKeyboard(context: Context, view: View): Boolean {
- val mInputManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
- return mInputManager.hideSoftInputFromWindow(view.windowToken, 0)
- }
-
- @JvmStatic
- fun getKeyBoardHeight(context: Context): Int {
- val isPortrait = isPortrait(context)
- if (isPortrait && pHeight != -1) {
- return pHeight
- }
- if (!isPortrait && lHeight != -1) {
- return lHeight
- }
- val sp = context.getSharedPreferences(Constants.KB_PANEL_PREFERENCE_NAME, Context.MODE_PRIVATE)
- val key = if (isPortrait) Constants.KEYBOARD_HEIGHT_FOR_P else Constants.KEYBOARD_HEIGHT_FOR_L
- val defaultHeight = dip2px(context, if (isPortrait) Constants.DEFAULT_KEYBOARD_HEIGHT_FOR_P else Constants.DEFAULT_KEYBOARD_HEIGHT_FOR_L)
- val result = sp.getInt(key, defaultHeight)
- if (result != defaultHeight) {
- if (isPortrait) {
- pHeight = result
- } else {
- lHeight = result
- }
- }
- return result
- }
-
- @JvmStatic
- fun isPanelHeightBelowKeyboardHeight(context: Context, curPanelHeight: Int): Boolean = hasMeasuredKeyboard(context) && getKeyBoardHeight(context) > curPanelHeight
-
- @JvmStatic
- fun setKeyBoardHeight(context: Context, height: Int): Boolean {
-
- if (getKeyBoardHeight(context) == height) {
- LogTracker.log("PanelUtil#onGlobalLayout", "current KeyBoardHeight is equal,just ignore!")
- return false
- }
- val isPortrait = isPortrait(context)
- if (isPortrait && pHeight == height) {
- LogTracker.log("PanelUtil#onGlobalLayout", "current KeyBoardHeight is equal,just ignore!")
- return false
- }
- if (!isPortrait && lHeight == height) {
- LogTracker.log("PanelUtil#onGlobalLayout", "current KeyBoardHeight is equal,just ignore!")
- return false
- }
- val sp = context.getSharedPreferences(Constants.KB_PANEL_PREFERENCE_NAME, Context.MODE_PRIVATE)
- val key = if (isPortrait) Constants.KEYBOARD_HEIGHT_FOR_P else Constants.KEYBOARD_HEIGHT_FOR_L
- val result = sp.edit().putInt(key, height).commit()
- if (result) {
- if (isPortrait) {
- pHeight = height
- } else {
- lHeight = height
- }
- }
- return result
- }
-
- internal fun hasMeasuredKeyboard(context: Context): Boolean {
- getKeyBoardHeight(context)
- return pHeight != -1 || lHeight != -1
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/PanelSwitchLayout.kt b/panel/src/main/java/com/effective/android/panel/view/PanelSwitchLayout.kt
deleted file mode 100644
index 539966a..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/PanelSwitchLayout.kt
+++ /dev/null
@@ -1,710 +0,0 @@
-package com.effective.android.panel.view
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.graphics.Rect
-import android.os.Build
-import android.transition.ChangeBounds
-import android.transition.TransitionManager
-import android.util.AttributeSet
-import android.util.Pair
-import android.view.View
-import android.view.ViewTreeObserver
-import android.view.Window
-import android.view.WindowManager
-import android.widget.LinearLayout
-import com.effective.android.panel.Constants
-import com.effective.android.panel.R
-import com.effective.android.panel.device.DeviceInfo
-import com.effective.android.panel.device.DeviceRuntime
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-import com.effective.android.panel.interfaces.PanelHeightMeasurer
-import com.effective.android.panel.interfaces.ViewAssertion
-import com.effective.android.panel.interfaces.listener.OnEditFocusChangeListener
-import com.effective.android.panel.interfaces.listener.OnKeyboardStateListener
-import com.effective.android.panel.interfaces.listener.OnPanelChangeListener
-import com.effective.android.panel.interfaces.listener.OnViewClickListener
-import com.effective.android.panel.log.LogFormatter
-import com.effective.android.panel.log.LogTracker
-import com.effective.android.panel.utils.DisplayUtil
-import com.effective.android.panel.utils.DisplayUtil.getLocationOnScreen
-import com.effective.android.panel.utils.DisplayUtil.getScreenHeightWithSystemUI
-import com.effective.android.panel.utils.DisplayUtil.getScreenHeightWithoutSystemUI
-import com.effective.android.panel.utils.DisplayUtil.getScreenRealHeight
-import com.effective.android.panel.utils.DisplayUtil.isPortrait
-import com.effective.android.panel.utils.PanelUtil
-import com.effective.android.panel.utils.PanelUtil.getKeyBoardHeight
-import com.effective.android.panel.utils.PanelUtil.hideKeyboard
-import com.effective.android.panel.utils.PanelUtil.showKeyboard
-import com.effective.android.panel.view.content.IContentContainer
-import com.effective.android.panel.view.panel.IPanelView
-import com.effective.android.panel.view.panel.PanelContainer
-
-/**
- * --------------------
- * | PanelSwitchLayout |
- * | ---------------- |
- * | | | |
- * | |ContentContainer| |
- * | | | |
- * | ---------------- |
- * | ---------------- |
- * | | PanelContainer | |
- * | ---------------- |
- * --------------------
- * Created by yummyLau on 18-7-10
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- *
- *
- * updated by yummyLau on 20/03/18
- * 重构整个输入法切换框架,移除旧版使用 weight+Runnable延迟切换,使用新版 layout+动画无缝衔接!
- */
-class PanelSwitchLayout : LinearLayout, ViewAssertion {
-
- private var viewClickListeners: MutableList? = null
- private var panelChangeListeners: MutableList? = null
- private var keyboardStatusListeners: MutableList? = null
- private var editFocusChangeListeners: MutableList? = null
-
- private lateinit var contentContainer: IContentContainer
- private lateinit var panelContainer: PanelContainer
- private lateinit var window: Window
- private val contentScrollMeasurers = mutableListOf()
- private val panelHeightMeasurers = HashMap()
-
- private var isKeyboardShowing = false
- private var panelId = Constants.PANEL_NONE
- private var lastPanelId = Constants.PANEL_NONE
- private var lastPanelHeight = -1;
- private var animationSpeed = 200 //standard
- private var contentScrollOutsizeEnable = true
-
- private var deviceRuntime: DeviceRuntime? = null
- private var realBounds: Rect? = null
- private var keyboardStateRunnable = Runnable { toKeyboardState(false) }
-
- private var doingCheckout = false
- lateinit var TAG: String
-
- private val retryCheckoutKbRunnable = CheckoutKbRunnable()
-
- internal fun getContentContainer() = contentContainer
-
- inner class CheckoutKbRunnable : Runnable {
- var retry = false
- var delay: Long = 0L
- override fun run() {
- val result = checkoutPanel(Constants.PANEL_KEYBOARD)
- if (!result && panelId != Constants.PANEL_KEYBOARD && retry) {
- this@PanelSwitchLayout.postDelayed(this, delay)
- }
- retry = false
- }
- }
-
-
- @JvmOverloads
- constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context, attrs, defStyleAttr) {
- initView(attrs, defStyleAttr, 0)
- }
-
- @TargetApi(21)
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
- initView(attrs, defStyleAttr, defStyleRes)
- }
-
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {
- val typedArray = context.obtainStyledAttributes(attrs, R.styleable.PanelSwitchLayout, defStyleAttr, 0)
- animationSpeed = typedArray.getInteger(R.styleable.PanelSwitchLayout_animationSpeed, animationSpeed)
- typedArray.recycle()
- TAG = "${PanelSwitchLayout::class.java.simpleName}(${hashCode()})"
- }
-
- internal fun setContentScrollOutsizeEnable(enable: Boolean) {
- this.contentScrollOutsizeEnable = enable
- }
-
- internal fun isContentScrollOutsizeEnable() = contentScrollOutsizeEnable
-
- override fun onDetachedFromWindow() {
- super.onDetachedFromWindow()
- recycle()
- }
-
- override fun onAttachedToWindow() {
- super.onAttachedToWindow()
- if (!hasAttachLister) {
- globalLayoutListener?.let {
- window.decorView.rootView.viewTreeObserver.addOnGlobalLayoutListener(it)
- hasAttachLister = true
- }
- }
- }
-
- fun recycle() {
- removeCallbacks(retryCheckoutKbRunnable)
- removeCallbacks(keyboardStateRunnable)
- contentContainer.getInputActionImpl().recycler()
- if (hasAttachLister) {
- globalLayoutListener?.let {
- window.decorView.rootView.viewTreeObserver.removeOnGlobalLayoutListener(it)
- hasAttachLister = false
- }
- }
- }
-
- private fun checkoutKeyboard(retry: Boolean = true, delay: Long = 200L) {
- this@PanelSwitchLayout.removeCallbacks(retryCheckoutKbRunnable)
- retryCheckoutKbRunnable.retry = retry
- retryCheckoutKbRunnable.delay = delay
- retryCheckoutKbRunnable.run()
- }
-
- private fun initListener() {
- /**
- * 1. if current currentPanelId is None,should show keyboard
- * 2. current currentPanelId is not None or KeyBoard that means some panel is showing,hide it and show keyboard
- */
- contentContainer.getInputActionImpl().setEditTextClickListener(OnClickListener { v ->
- notifyViewClick(v)
- checkoutKeyboard()
- })
- contentContainer.getInputActionImpl().setEditTextFocusChangeListener(OnFocusChangeListener { v, hasFocus ->
- notifyEditFocusChange(v, hasFocus)
- checkoutKeyboard()
- })
- contentContainer.getResetActionImpl().setResetCallback(Runnable {
- hookSystemBackByPanelSwitcher()
- })
-
- /**
- * save panel that you want to use these to checkout
- */
- val array = panelContainer.panelSparseArray
- for (i in 0 until array.size()) {
- val panelView = array[array.keyAt(i)]
- val keyView = contentContainer.findTriggerView(panelView.getBindingTriggerViewId())
- keyView?.setOnClickListener(object : OnClickListener {
- override fun onClick(v: View) {
- val currentTime = System.currentTimeMillis()
- if (currentTime - preClickTime <= Constants.PROTECT_KEY_CLICK_DURATION) {
- LogTracker.log("$TAG#initListener", "panelItem invalid click! preClickTime: $preClickTime currentClickTime: $currentTime")
- return
- }
- notifyViewClick(v)
- val targetId = panelContainer.getPanelId(panelView)
- if (panelId == targetId && panelView.isTriggerViewCanToggle() && panelView.isShowing()) {
- checkoutKeyboard(false)
- } else {
- checkoutPanel(targetId)
- }
- preClickTime = currentTime
- }
- })
- }
- }
-
- internal fun bindListener(viewClickListeners: MutableList, panelChangeListeners: MutableList,
- keyboardStatusListeners: MutableList, editFocusChangeListeners: MutableList) {
- this.viewClickListeners = viewClickListeners
- this.panelChangeListeners = panelChangeListeners
- this.keyboardStatusListeners = keyboardStatusListeners
- this.editFocusChangeListeners = editFocusChangeListeners
- }
-
- internal fun setScrollMeasurers(mutableList: MutableList) {
- contentScrollMeasurers.addAll(mutableList)
- }
-
- internal fun setPanelHeightMeasurers(mutableList: MutableList) {
- for (panelHeightMeasurer in mutableList) {
- panelHeightMeasurers[panelHeightMeasurer.getPanelTriggerId()] = panelHeightMeasurer
- }
- }
-
- private var globalLayoutListener: ViewTreeObserver.OnGlobalLayoutListener? = null
- private var hasAttachLister = false
-
-
- /**
- * 针对 Android Q 场景判断,
- * 设备开启虚拟手势导航栏如 MIUI12时,正常情况下使用 navigationBarBackground 判断可见时是正确的
- * 如果同时采用 SYSTEM_UL_FLAG_LAYOUT_HIDE_NAVIGATION 绘制到导航栏下面,那么在 Layout Inspector 上 navigationBarBackground 布局是不存在的,但是 getWindowVisibleDisplayFrame 并没有包含这部分高度。
- * 所以针对 AndroidQ 采用 rootWindowInsets 来获取这部分可视导航栏的高度并在计算软键盘高度的时候需要加回去。
- */
- private fun getAndroidQNavHIfNavIsInvisible(runtime: DeviceRuntime, window: Window): Int {
- return if (!runtime.isNavigationBarShow && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && DisplayUtil.hasSystemUIFlag(window, View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)) {
- val inset = window.decorView.rootView.rootWindowInsets
- LogTracker.log("$TAG#onGlobalLayout", " -> Android Q takes windowInset into calculation When nav is not shown and SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION flag is existed <-")
- LogTracker.log("$TAG#onGlobalLayout", "stableInsetTop is : ${inset.stableInsetTop}")
- LogTracker.log("$TAG#onGlobalLayout", "stableInsetBottom is : ${inset.stableInsetBottom}")
- LogTracker.log("$TAG#onGlobalLayout", "androidQCompatNavH is ${inset.stableInsetBottom}")
- inset.stableInsetBottom
- } else 0
- }
-
- /**
- * 常规导航栏显示或者全屏手势虚拟导航栏显示且不通过 SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 让界面绘制到全屏手势导航栏下时有值
- */
- private fun getCurrentNavigationHeight(deviceRuntime: DeviceRuntime, deviceInfo: DeviceInfo): Int {
- return if (deviceRuntime.isNavigationBarShow)
- deviceInfo.getCurrentNavigationBarHeightWhenVisible(deviceRuntime.isPortrait, deviceRuntime.isPad)
- else 0
- }
-
- /**
- * 历史从 fullScreen api 控制上看,该属性决定状态栏行为。
- * 对于有导航栏的机型,使用该属性进行全屏显示不可取。
- */
- private fun getCurrentStatusBarHeight(deviceInfo: DeviceInfo): Int {
- return deviceInfo.statusBarH
- }
-
- private var lastContentHeight: Int? = null
- private var lastNavigationBarShow: Boolean? = null
- private var lastKeyboardHeight: Int = 0;
- private var minLimitOpenKeyboardHeight = 300
- private var minLimitCloseKeyboardHeight: Int = 0;
-
- internal fun bindWindow(window: Window) {
- this.window = window
- window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN or WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
- deviceRuntime = DeviceRuntime(context, window)
- deviceRuntime?.let {
- contentContainer.getInputActionImpl().updateFullScreenParams(it.isFullScreen, panelId, getCompatPanelHeight(panelId))
- globalLayoutListener = ViewTreeObserver.OnGlobalLayoutListener {
- val logFormatter = LogFormatter.setUp()
- logFormatter.addContent(value = "界面每一次变化的信息回调")
- logFormatter.addContent("windowSoftInputMode", "${window.attributes.softInputMode}")
- logFormatter.addContent("currentPanelSwitchLayoutVisible", "${this@PanelSwitchLayout.visibility == View.VISIBLE}")
- if (this@PanelSwitchLayout.visibility != View.VISIBLE) {
- logFormatter.addContent(value = "skip cal keyboard Height When window is invisible!")
- }
- val screenHeight = getScreenRealHeight(window)
- var contentHeight = getScreenHeightWithoutSystemUI(window)
- val info = it.getDeviceInfoByOrientation(true)
- val curStatusHeight = getCurrentStatusBarHeight(info)
- val cusNavigationHeight = getCurrentNavigationHeight(it, info)
- val androidQCompatNavH = getAndroidQNavHIfNavIsInvisible(it, window)
- val systemUIHeight = curStatusHeight + cusNavigationHeight + androidQCompatNavH
- logFormatter.addContent("screenHeight", "$screenHeight")
- logFormatter.addContent("contentHeight", "$contentHeight")
- logFormatter.addContent("isFullScreen", "${it.isFullScreen}")
- logFormatter.addContent("isNavigationBarShown", "${it.isNavigationBarShow}")
- logFormatter.addContent("deviceStatusBarH", "${info.statusBarH}")
- logFormatter.addContent("deviceNavigationBarH", "${info.navigationBarH}")
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- val inset = window.decorView.rootWindowInsets
- logFormatter.addContent("systemInset", "left(${inset.systemWindowInsetTop}) top(${inset.systemWindowInsetLeft}) right(${inset.systemWindowInsetRight}) bottom(${inset.systemWindowInsetBottom})")
- logFormatter.addContent("inset", "left(${inset.stableInsetLeft}) top(${inset.stableInsetTop}) right(${inset.stableInsetRight}) bottom(${inset.stableInsetBottom})")
- }
- logFormatter.addContent("currentSystemInfo", "statusBarH : $curStatusHeight, navigationBarH : $cusNavigationHeight 全面屏手势虚拟栏H : $androidQCompatNavH")
- logFormatter.addContent("currentSystemH", "$systemUIHeight")
-
- lastNavigationBarShow = it.isNavigationBarShow
- val keyboardHeight = screenHeight - contentHeight - systemUIHeight
- //输入法拉起时,需要追加 "悬浮在界面之上的全屏手势虚拟导航栏" 高度
- val realHeight = keyboardHeight + androidQCompatNavH
- minLimitCloseKeyboardHeight = if (info.navigationBarH > androidQCompatNavH) info.navigationBarH else androidQCompatNavH
- logFormatter.addContent("minLimitCloseKeyboardH", "$minLimitCloseKeyboardHeight")
- logFormatter.addContent("minLimitOpenKeyboardH", "$minLimitOpenKeyboardHeight")
- logFormatter.addContent("lastKeyboardH", "$lastKeyboardHeight")
- logFormatter.addContent("currentKeyboardInfo", "keyboardH : $keyboardHeight, realKeyboardH : $realHeight, isShown : $isKeyboardShowing")
- if (isKeyboardShowing) {
- if (keyboardHeight <= minLimitOpenKeyboardHeight) {
- isKeyboardShowing = false
- if (isKeyboardState()) {
- checkoutPanel(Constants.PANEL_NONE)
- }
- notifyKeyboardState(false)
- } else {
- /**
- * 拉起输入法的时候递增,隐藏输入法的时候递减,机型较差的手机需要 requestLayout() 动态更新布局
- */
- if (keyboardHeight != lastKeyboardHeight) {
- LogTracker.log("$TAG#onGlobalLayout", "try to set KeyBoardHeight : $realHeight,isShow $isKeyboardShowing")
- PanelUtil.setKeyBoardHeight(context, realHeight)
- requestLayout()
- }
- }
- } else {
- if (keyboardHeight > minLimitOpenKeyboardHeight) {
- isKeyboardShowing = true
- if (keyboardHeight > lastKeyboardHeight) {
- LogTracker.log("$TAG#onGlobalLayout", "try to set KeyBoardHeight : $realHeight,isShow $isKeyboardShowing")
- PanelUtil.setKeyBoardHeight(context, realHeight)
- requestLayout()
- }
- if (!isKeyboardState()) {
- checkoutPanel(Constants.PANEL_KEYBOARD, false)
- }
- notifyKeyboardState(true)
- } else {
- //1.3.5 实时兼容导航栏动态隐藏调整布局
- lastContentHeight?.let { lastHeight ->
- lastNavigationBarShow?.let { lastShow ->
- if (lastHeight != contentHeight && lastShow != it.isNavigationBarShow) {
- requestLayout()
- LogTracker.log("$TAG#onGlobalLayout", "update layout by navigation visibility State change")
- }
- }
- }
- }
- }
- lastKeyboardHeight = keyboardHeight
- lastContentHeight = contentHeight
- logFormatter.log("$TAG#onGlobalLayout")
- }
- window.decorView.rootView.viewTreeObserver.addOnGlobalLayoutListener(globalLayoutListener)
- hasAttachLister = true
- }
- }
-
- private fun notifyViewClick(view: View) {
- viewClickListeners?.let {
- for (listener in it) {
- listener.onClickBefore(view)
- }
- }
- }
-
- private fun notifyKeyboardState(visible: Boolean) {
- keyboardStatusListeners?.let {
- for (listener in it) {
- listener.onKeyboardChange(visible, if (visible) getKeyBoardHeight(context) else 0)
- }
- }
- }
-
- private fun notifyEditFocusChange(view: View, hasFocus: Boolean) {
- editFocusChangeListeners?.let {
- for (listener in it) {
- listener.onFocusChange(view, hasFocus)
- }
- }
- }
-
- private fun notifyPanelChange(panelId: Int) {
- panelChangeListeners?.let {
- for (listener in it) {
- when (panelId) {
- Constants.PANEL_NONE -> {
- listener.onNone()
- }
- Constants.PANEL_KEYBOARD -> {
- listener.onKeyboard()
- }
- else -> {
- listener.onPanel(panelContainer.getPanelView(panelId))
- }
- }
- }
- }
- }
-
- private fun notifyPanelSizeChange(panelView: IPanelView?, portrait: Boolean, oldWidth: Int, oldHeight: Int, width: Int, height: Int) {
- panelChangeListeners?.let {
- for (listener in it) {
- listener.onPanelSizeChange(panelView, portrait, oldWidth, oldHeight, width, height)
- }
- }
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- assertView()
- initListener()
- }
-
- override fun assertView() {
- if (childCount != 2) {
- throw RuntimeException("PanelSwitchLayout -- PanelSwitchLayout should has two children,the first is ContentContainer,the other is PanelContainer!")
- }
- val firstView = getChildAt(0)
- val secondView = getChildAt(1)
- if (firstView !is IContentContainer) {
- throw RuntimeException("PanelSwitchLayout -- the first view isn't a IContentContainer")
- }
- contentContainer = firstView
- if (secondView !is PanelContainer) {
- throw RuntimeException("PanelSwitchLayout -- the second view is a ContentContainer, but the other isn't a PanelContainer!")
- }
- panelContainer = secondView
- }
-
- private fun getContentContainerTop(scrollOutsideHeight: Int): Int {
- val result = if (contentScrollOutsizeEnable) {
- if (isResetState()) 0 else -scrollOutsideHeight
- } else 0
- LogTracker.log("$TAG#onLayout", " getContentContainerTop :$result")
- return result;
- }
-
- private fun getContentContainerHeight(allHeight: Int, paddingTop: Int, scrollOutsideHeight: Int): Int {
- return allHeight - paddingTop -
- if (!contentScrollOutsizeEnable && !isResetState()) scrollOutsideHeight else 0
- }
-
- private fun getCompatPanelHeight(panelId: Int): Int {
- if (isPanelState(panelId)) {
- val panelHeightMeasurer = panelHeightMeasurers[panelId]
- panelHeightMeasurer?.let {
- //如果输入法还没有测量或者不同步输入法高度,则是有默认高度
- if (!PanelUtil.hasMeasuredKeyboard(context) || !it.synchronizeKeyboardHeight()) {
- val result = it.getTargetPanelDefaultHeight()
- LogTracker.log("$TAG#onLayout", " getCompatPanelHeight by default panel :$result")
- return result
- }
- }
- }
- val result = getKeyBoardHeight(context);
- LogTracker.log("$TAG#onLayout", " getCompatPanelHeight :$result")
- return result
- }
-
- /**
- * @param changed
- * @param l
- * @param t
- * @param r
- * @param b
- */
- override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
- val visibility = visibility
- if (visibility != View.VISIBLE) {
- LogTracker.log("$TAG#onLayout", "isGone,skip")
- return
- }
-
- deviceRuntime?.let {
- val logFormatter = LogFormatter.setUp()
- val deviceInfo = it.getDeviceInfoByOrientation()
-
- /**
- * 当还没有进行输入法高度获取时,由于兼容性测试之后设置的默认高度无法兼容所有机型
- * 为了业务能100%兼容,开放设置每个面板的默认高度,待输入法高度获取之后统一高度。
- */
- val compatPanelHeight = getCompatPanelHeight(panelId);
- val paddingTop = paddingTop
- var allHeight = deviceInfo.screenH
-
- if (it.isNavigationBarShow) {
- /**
- * 1.1.0 使用 screenWithoutNavigationHeight + navigationBarHeight ,结合 navigationBarShow 来动态计算高度,但是部分特殊机型
- * 比如水滴屏,刘海屏,等存在刘海区域,甚至华为,小米支持动态切换刘海模式(不隐藏刘海,隐藏后状态栏在刘海内,隐藏后状态栏在刘海外)
- * 同时还存在全面屏,挖孔屏,这套方案存在兼容问题。
- * CusShortUtil 支持计算绝大部分机型的刘海高度,但是考虑到动态切换的模式计算太过于复杂,且不能完全兼容所有场景。
- * 1.1.1 使用 screenHeight - navigationBarHeight,结合 navigationBarShow 来动态计算告诉,原因是:
- * 无论现不现实刘海区域,只需要记住应用的绘制区域以 getDecorView 的绘制区域为准,我们只需要关注一个关系:
- * 刘海区域与状态栏区域的是否重叠。
- * 如果状态栏与刘海不重叠,则 screenHeight 不包含刘海
- * 如果状态栏与刘海重叠,则 screenHeight 包含刘海
- * 这样抽象逻辑变得更加简单。
- */
- allHeight -= deviceInfo.getCurrentNavigationBarHeightWhenVisible(it.isPortrait, it.isPad)
- }
-
- val localLocation = getLocationOnScreen(this)
- allHeight -= localLocation[1]
- var contentContainerTop = getContentContainerTop(compatPanelHeight)
- contentContainerTop += paddingTop
- val contentContainerHeight = getContentContainerHeight(allHeight, paddingTop, compatPanelHeight)
- val panelContainerTop = contentContainerTop + contentContainerHeight
-
- if (Constants.DEBUG) {
- logFormatter.addContent(value = "界面每一次 layout 的信息回调")
- logFormatter.addContent("layoutInfo", "onLayout(changed : $changed , l : $l , t : $t , r : $r , b : $b)")
- val state = when (panelId) {
- Constants.PANEL_NONE -> "收起所有输入源"
- Constants.PANEL_KEYBOARD -> "显示键盘输入"
- else -> "显示面板输入"
- }
- logFormatter.addContent("currentPanelState", "$state")
- logFormatter.addContent("isPad", "${it.isPad}")
- logFormatter.addContent("isFullScreen", "${it.isFullScreen}")
- logFormatter.addContent("isPortrait", "${it.isPortrait}")
- logFormatter.addContent("isNavigationShown", "${it.isNavigationBarShow}")
- logFormatter.addContent("screenH (static,include SystemUI)", "${deviceInfo.screenH}")
- logFormatter.addContent("screenH (static,exclude SystemUI)", "${deviceInfo.screenWithoutNavigationH}")
- logFormatter.addContent("screenH (dynamic,exclude SystemUI)", "${deviceInfo.screenWithoutSystemUiH}")
- logFormatter.addContent("localLocation[y]", "${localLocation[1]}")
- logFormatter.addContent("toolbarH", "${deviceInfo.toolbarH}")
- logFormatter.addContent("StatusBarH", "${deviceInfo.statusBarH}")
- logFormatter.addContent("NavigationBarH", "${deviceInfo.navigationBarH}")
- logFormatter.addContent("layout Location", "(${localLocation[0]},${localLocation[1]})")
- logFormatter.addContent("paddingTop", "$paddingTop")
- logFormatter.addContent("keyboardH", "${getKeyBoardHeight(context)}")
- logFormatter.addContent("ContentContainerTop", "$contentContainerTop")
- logFormatter.addContent("ContentContainerH", "$contentContainerHeight")
- logFormatter.addContent("PanelContainerTop", "$panelContainerTop")
- logFormatter.addContent("PanelContainerH", "$compatPanelHeight")
- }
-
- //计算实际bounds
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
- val changeBounds = isBoundChange(l, contentContainerTop, r, panelContainerTop + compatPanelHeight)
- logFormatter.addContent("changeBounds", "$changeBounds")
- if (changeBounds) {
- val reverseResetState = reverseResetState()
- logFormatter.addContent("reverseResetState", "$reverseResetState")
- if (reverseResetState) {
- setTransition(animationSpeed.toLong(), panelId)
- }
- } else {
- //如果功能面板的互相切换,则需要判断是否存在高度不一致,如果不一致则需要过渡
- if (lastPanelHeight != -1 && lastPanelHeight != compatPanelHeight) {
- setTransition(animationSpeed.toLong(), panelId)
- }
- }
- }
-
- //处理第一个view contentContainer
- run {
- contentContainer.layoutContainer(l, contentContainerTop, r, contentContainerTop + contentContainerHeight,
- contentScrollMeasurers, compatPanelHeight, contentScrollOutsizeEnable, isResetState())
- logFormatter.addContent("contentContainer Layout", "($l,$contentContainerTop,$r,${contentContainerTop + contentContainerHeight})")
- contentContainer.changeContainerHeight(contentContainerHeight)
- }
-
- //处理第二个view panelContainer
- run {
- panelContainer.layout(l, panelContainerTop, r, panelContainerTop + compatPanelHeight)
- logFormatter.addContent("panelContainer Layout", "($l,$panelContainerTop,$r,${panelContainerTop + compatPanelHeight})")
- panelContainer.changeContainerHeight(compatPanelHeight)
- }
- this.lastPanelHeight = compatPanelHeight;
- contentContainer.getInputActionImpl().updateFullScreenParams(it.isFullScreen, panelId, compatPanelHeight)
- logFormatter.log("$TAG#onLayout")
- return
- }
-
- //预览的时候由于 helper 还没有初始化导致可能为 null
- super.onLayout(changed, l, t, r, b)
- }
-
-
- private fun isBoundChange(l: Int, t: Int, r: Int, b: Int): Boolean {
- val change = realBounds == null || realBounds!!.run {
- this.left != l || this.top != top || this.right != r || this.bottom != b
- }
- realBounds = Rect(l, t, r, b)
- return change
- }
-
- internal fun isPanelState() = isPanelState(panelId)
-
- internal fun isKeyboardState() = isKeyboardState(panelId)
-
- internal fun isResetState() = isResetState(panelId)
-
- private fun isPanelState(panelId: Int) = !isResetState(panelId) && !isKeyboardState(panelId)
-
- private fun isKeyboardState(panelId: Int) = panelId == Constants.PANEL_KEYBOARD
-
- private fun isResetState(panelId: Int) = panelId == Constants.PANEL_NONE
-
- private fun reverseResetState(): Boolean = (isResetState(lastPanelId) && !isResetState(panelId))
- || (!isResetState(lastPanelId) && isResetState(panelId))
-
-
- @TargetApi(19)
- private fun setTransition(duration: Long, panelId: Int) {
- val changeBounds = ChangeBounds()
- changeBounds.duration = duration
- TransitionManager.beginDelayedTransition(this, changeBounds)
- }
-
-
- /**
- * This will be called when User press System Back Button.
- * 1. if keyboard is showing, should be hide;
- * 2. if you want to hide panel(exclude keyboard),you should call it before [android.support.v7.app.AppCompatActivity.onBackPressed] to hook it.
- *
- * @return if need hook
- */
- internal fun hookSystemBackByPanelSwitcher(): Boolean {
- if (!isResetState()) {
- //模仿系统输入法隐藏,如果直接掉 checkoutPanel(Constants.PANEL_NONE),可能导致隐藏时上层 recyclerview 因为 layout 导致界面出现短暂卡顿。
- if (isKeyboardState()) {
- if (isKeyboardShowing) {
- contentContainer.getInputActionImpl().hideKeyboard(true)
- } else {
- checkoutPanel(Constants.PANEL_NONE)
- return false
- }
- } else {
- checkoutPanel(Constants.PANEL_NONE)
- }
- return true
- }
- return false
- }
-
- @JvmOverloads
- internal fun toKeyboardState(async: Boolean = false) {
- if (async) {
- post(keyboardStateRunnable)
- } else {
- contentContainer.getInputActionImpl().requestKeyboard()
- }
- }
-
-
- /**
- * @param panelId
- * @return
- */
- internal fun checkoutPanel(panelId: Int, checkoutKeyboard: Boolean = true): Boolean {
- if (doingCheckout) {
- LogTracker.log("$TAG#checkoutPanel", "is checkouting,just ignore!")
- return false
- }
- doingCheckout = true
-
- if (panelId == this.panelId) {
- LogTracker.log("$TAG#checkoutPanel", "current panelId is $panelId ,just ignore!")
- doingCheckout = false
- return false
- }
-
- when (panelId) {
- Constants.PANEL_NONE -> {
- contentContainer.getInputActionImpl().hideKeyboard(true)
- contentContainer.getResetActionImpl().enableReset(false)
- }
-
- Constants.PANEL_KEYBOARD -> {
- if (checkoutKeyboard) {
- if (!contentContainer.getInputActionImpl().showKeyboard()) {
- LogTracker.log("$TAG#checkoutPanel", "system show keyboard fail, just ignore!")
- doingCheckout = false
- return false
- }
- }
- contentContainer.getResetActionImpl().enableReset(true)
- }
- else -> {
- val size = Pair(measuredWidth - paddingLeft - paddingRight, getCompatPanelHeight(panelId))
- val oldSize = panelContainer.showPanel(panelId, size)
- if (size.first != oldSize.first || size.second != oldSize.second) {
- notifyPanelSizeChange(panelContainer.getPanelView(panelId), isPortrait(context), oldSize.first, oldSize.second, size.first, size.second)
- }
- contentContainer.getInputActionImpl().hideKeyboard(false)
- contentContainer.getResetActionImpl().enableReset(true)
- }
- }
- this.lastPanelId = this.panelId
- this.panelId = panelId
- LogTracker.log("$TAG#checkoutPanel", "checkout success ! lastPanel's id : $lastPanelId , panel's id :$panelId")
- requestLayout()
- notifyPanelChange(this.panelId)
- doingCheckout = false
- return true
- }
-
- companion object {
- val TAG = PanelSwitchLayout::class.java.simpleName
- private var preClickTime: Long = 0
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/content/ContentContainerImpl.kt b/panel/src/main/java/com/effective/android/panel/view/content/ContentContainerImpl.kt
deleted file mode 100644
index efc3fad..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/content/ContentContainerImpl.kt
+++ /dev/null
@@ -1,417 +0,0 @@
-package com.effective.android.panel.view.content
-
-import android.graphics.Rect
-import android.support.annotation.IdRes
-import android.text.Editable
-import android.text.TextWatcher
-import android.view.MotionEvent
-import android.view.View
-import android.view.View.*
-import android.view.ViewGroup
-import android.view.accessibility.AccessibilityEvent
-import android.view.inputmethod.EditorInfo
-import android.widget.EditText
-import com.effective.android.panel.Constants
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-import com.effective.android.panel.interfaces.ViewAssertion
-import com.effective.android.panel.log.LogTracker
-import com.effective.android.panel.utils.PanelUtil
-import com.effective.android.panel.view.PanelSwitchLayout
-import java.util.*
-import kotlin.collections.HashMap
-
-/**
- * 内容区域代理
- * --------------------
- * Created by yummyLau on 2020/05/07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class ContentContainerImpl(private val mViewGroup: ViewGroup, private val autoReset: Boolean, @IdRes private val editTextId: Int, @IdRes private val resetId: Int) : IContentContainer, ViewAssertion {
- private val mEditText: EditText? = mViewGroup.findViewById(editTextId)
- private val context = mViewGroup.context;
- private val mResetView: View? = mViewGroup.findViewById(resetId)
- private val mInputAction: IInputAction
- private val mResetAction: IResetAction
- private val tag = ContentContainerImpl::class.java.simpleName
- private val mPixelInputView = EditText(mEditText?.context)
-
- init {
- assertView()
- var imeOptions = mEditText?.imeOptions
- if (imeOptions != null) {
- imeOptions = imeOptions or EditorInfo.IME_FLAG_NO_EXTRACT_UI
- mEditText?.imeOptions = imeOptions
- mPixelInputView.imeOptions = imeOptions
- }
- mResetAction = object : IResetAction {
-
- private var enableReset: Boolean = false
- private var action: Runnable? = null
-
- /**
- * 当子类不处理事件时,则 hookOnTouchEvent 会尝试消费 DOWN 。
- * 当子类处理事件时,则没有机会 hookOnTouchEvent。 这是时候有两种做法
- * 1. 寻找一个在子 View 的 hook 点,在不影响可滑动的场景先,拦截 ACTION_UP 就可以了.(Demo中)
- * 2. 如果不想在子 View 处理,则需要在点击的区域构建一个透明view盖住,监听点击之后调用 PanelSwitchHelper#resetState 手动隐藏。
- * hookDispatchTouchEvent 为第一种方案预留可能
- */
- override fun hookDispatchTouchEvent(ev: MotionEvent?, consume: Boolean): Boolean {
- ev?.let { event ->
- if (event.action == MotionEvent.ACTION_UP) {
- action?.let {
- if (autoReset && enableReset && !consume) {
- if (mResetView == null || eventInViewArea(mResetView, event)) {
- it.run()
- LogTracker.log("$tag#hookDispatchTouchEvent", "hook ACTION_UP")
- return true
- }
- }
- }
-
- }
- }
- return false
- }
-
- /**
- * 子view不消费事件时,则默认会自己处理。
- * 当不需要指定reset区域时,捕获 ACTION_DOWN 进行消费。
- * 当指定reset区域时,则需要匹配事件发生的位置是否在区域内
- */
- override fun hookOnTouchEvent(ev: MotionEvent?): Boolean {
- ev?.let { event ->
- if (event.action == MotionEvent.ACTION_DOWN) {
- action?.let {
- if (autoReset && enableReset) {
- if (mResetView == null || eventInViewArea(mResetView, event)) {
- it.run()
- LogTracker.log("$tag#hookOnTouchEvent", "hook ACTION_DOWN")
- }
- }
- }
- }
- }
- return true
- }
-
- override fun enableReset(enable: Boolean) {
- enableReset = enable
- }
-
- override fun setResetCallback(runnable: Runnable) {
- action = runnable
- }
-
- fun eventInViewArea(view: View, ev: MotionEvent?): Boolean {
- ev?.let {
- val x: Float = ev.rawX
- val y: Float = ev.rawY
- val rect = Rect()
- view.getGlobalVisibleRect(rect)
- return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom
- }
- return false
- }
- }
- mInputAction = object : IInputAction {
-
- private val mainInputView: EditText = mEditText!!
- private var mainFocusIndex = -1
-
- private val secondaryViews = WeakHashMap()
- private var secondaryViewRequestFocus = false
- private var onClickListener: OnClickListener? = null
- private var realEditViewAttach: Boolean = true
- private var curPanelId = Int.MAX_VALUE
- private var checkoutInputRight = true
- private val requestFocusRunnable = RequestFocusRunnable()
- private val resetSelectionRunnable = ResetSelectionRunnable()
-
- inner class RequestFocusRunnable : Runnable {
- var resetSelection = false
- override fun run() {
- mainInputView.requestFocus()
- if (resetSelection) {
- mainInputView.postDelayed(resetSelectionRunnable, 100)
- } else {
- checkoutInputRight = false
- }
- }
- }
-
- inner class ResetSelectionRunnable : Runnable {
- override fun run() {
- if (mainFocusIndex != -1 && mainFocusIndex <= mainInputView.text.length) {
- mainInputView.setSelection(mainFocusIndex)
- } else {
- mainInputView.setSelection(mainInputView.text.length)
- }
- checkoutInputRight = false
- }
- }
-
- init {
- mainInputView.addTextChangedListener(object : TextWatcher {
- override fun afterTextChanged(s: Editable?) {
- if (realEditViewAttach && mainInputView.hasFocus() && !checkoutInputRight) {
- mainFocusIndex = mainInputView.selectionStart
- }
- }
-
- override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
- }
-
- override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
- }
- })
- mainInputView.accessibilityDelegate = object : View.AccessibilityDelegate() {
- override fun sendAccessibilityEvent(host: View?, eventType: Int) {
- super.sendAccessibilityEvent(host, eventType)
- if (eventType == AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED) {
- if (realEditViewAttach && mainInputView.hasFocus() && !checkoutInputRight) {
- mainFocusIndex = mainInputView.selectionStart
- }
- }
- }
- }
- }
-
- private fun giveUpFocusRight() {
- checkoutInputRight = true
- realEditViewAttach = false
- if (mPixelInputView.hasFocus()) {
- mPixelInputView.clearFocus()
- }
- checkoutInputRight = false
- }
-
- override fun getFullScreenPixelInputView(): EditText {
- mPixelInputView.background = null
- return mPixelInputView
- }
-
- override fun recycler() {
- mainInputView.removeCallbacks(requestFocusRunnable)
- mainInputView.removeCallbacks(resetSelectionRunnable)
- }
-
- /**
- * 对于全屏模式:
- * 1. 如果拉起的是输入法,焦点权利归属到 realEditView,重新获取焦点及重置光标
- * 2. 如果拉起的面板且面板高度大于输入法,焦点权利也归属到 realEditView,
- * 3. 其他比如隐藏面板或者面板比输入法低,焦点权利让给 mPixelInputView
- * 非全屏模式下:
- * 所有焦点权利都在 realEditView
- */
- override fun updateFullScreenParams(isFullScreen: Boolean, panelId: Int, panelHeight: Int) {
- if (panelId == curPanelId) {
- return
- }
- curPanelId = panelId
- if (secondaryViewRequestFocus) {
- secondaryViewRequestFocus = false
- return
- }
- //解决部分手机抢占焦点,可能出现重复显示/隐藏输入法
- mPixelInputView.visibility = if (isFullScreen) VISIBLE else GONE
- if (mPixelInputView.parent is ViewGroup) {
- (mPixelInputView.parent as ViewGroup).isFocusableInTouchMode = true
- (mPixelInputView.parent as ViewGroup).isFocusable = true
- }
- if (isFullScreen) {
- if (panelId == Constants.PANEL_KEYBOARD) {
- retrieveFocusRight(requestFocus = true, resetSelection = true)
- } else if (panelId != Constants.PANEL_NONE && !PanelUtil.isPanelHeightBelowKeyboardHeight(context, panelHeight)) {
- retrieveFocusRight(requestFocus = false, resetSelection = true)
- } else {
- giveUpFocusRight()
- }
- } else {
- retrieveFocusRight()
- }
- }
-
- override fun addSecondaryInputView(editText: EditText) {
- val key = editText.hashCode()
- if (!secondaryViews.containsKey(key)) {
- editText.setOnFocusChangeListener { v, hasFocus ->
- secondaryViewRequestFocus = hasFocus
- }
- secondaryViews[key] = editText
- }
- }
-
- override fun removeSecondaryInputView(editText: EditText) {
- val key = editText.hashCode()
- if (secondaryViews.containsKey(key)) {
- secondaryViews.remove(key)
- }
- }
-
- private fun retrieveFocusRight(requestFocus: Boolean = false, resetSelection: Boolean = false) {
- checkoutInputRight = true
- realEditViewAttach = true
- if (mPixelInputView.hasFocus()) {
- mPixelInputView.clearFocus()
- }
- recycler()
- if (requestFocus) {
- requestFocusRunnable.resetSelection = resetSelection
- mainInputView.postDelayed(requestFocusRunnable, 200L)
- } else {
- if (resetSelection) {
- resetSelectionRunnable.run()
- } else {
- checkoutInputRight = false
- }
- }
- }
-
- override fun setEditTextClickListener(l: OnClickListener) {
- onClickListener = l
- mainInputView.setOnClickListener { v ->
- if (realEditViewAttach) {
- onClickListener?.onClick(v)
- } else {
- mPixelInputView.requestFocus()
- }
- }
- }
-
- override fun setEditTextFocusChangeListener(l: OnFocusChangeListener) {
- mainInputView.setOnFocusChangeListener { v, hasFocus ->
- if (hasFocus) {
- if (realEditViewAttach) {
- l.onFocusChange(v, hasFocus)
- } else {
- mPixelInputView.requestFocus()
- }
- }
- }
- mPixelInputView.setOnFocusChangeListener { v, hasFocus ->
- if (hasFocus) {
- l.onFocusChange(v, hasFocus)
- }
- }
- }
-
- override fun hideKeyboard(clearFocus: Boolean) {
- val targetView = if (realEditViewAttach) mainInputView else mPixelInputView
- PanelUtil.hideKeyboard(context, targetView)
- if (clearFocus) {
- targetView.clearFocus()
- }
- }
-
- override fun showKeyboard(): Boolean {
- val targetView = if (realEditViewAttach) mainInputView else mPixelInputView
- return PanelUtil.showKeyboard(context, targetView)
- }
-
- override fun requestKeyboard() {
- val targetView = if (realEditViewAttach) mainInputView else mPixelInputView
- if (targetView.hasFocus()) {
- targetView.performClick()
- } else {
- targetView.requestFocus()
- }
- }
- }
- }
-
-
- override fun getInputActionImpl(): IInputAction = mInputAction
-
- override fun getResetActionImpl(): IResetAction = mResetAction
-
- override fun findTriggerView(id: Int): View? {
- return mViewGroup.findViewById(id)
- }
-
- private data class ViewPosition(val id: Int, val l: Int, val t: Int, val r: Int, val b: Int) {
- var changeL: Int = l
- var changeT: Int = t
- var changeR: Int = r
- var changeB: Int = b
-
- fun hasChange() = changeL != l || changeT != t || changeR != r || changeB != b
-
- fun change(newL: Int, newT: Int, newR: Int, newB: Int) {
- changeL = newL
- changeT = newT
- changeR = newR
- changeB = newB
- }
-
- fun reset() {
- changeL = l
- changeT = t
- changeR = r
- changeB = b
- }
- }
-
- private val map = HashMap()
-
- override fun layoutContainer(l: Int, t: Int, r: Int, b: Int,
- contentScrollMeasurers: MutableList, defaultScrollHeight: Int, canScrollOutsize: Boolean,
- reset: Boolean) {
- mViewGroup.layout(l, t, r, b)
- if (!canScrollOutsize) {
- return
- }
- for (contentScrollMeasurer in contentScrollMeasurers) {
- val viewId = contentScrollMeasurer.getScrollViewId()
- if (viewId != -1) {
- val view = (mViewGroup).findViewById(viewId)
- view.let {
- var viewPosition = map[viewId]
- if (viewPosition == null) {
- viewPosition = ViewPosition(viewId, view.left, view.top, view.right, view.bottom)
- map[viewId] = viewPosition
- }
-
- var willScrollDistance = 0;
- if (reset) {
- if (viewPosition.hasChange()) {
- val viewLeft = viewPosition.l
- val viewTop = viewPosition.t
- val viewRight = viewPosition.r
- var viewBottom = viewPosition.b
- view.layout(viewLeft, viewTop, viewRight, viewBottom)
- viewPosition.reset();
- }
- } else {
- willScrollDistance = contentScrollMeasurer.getScrollDistance(defaultScrollHeight)
- if (willScrollDistance > defaultScrollHeight) {
- return
- }
- if (willScrollDistance < 0) {
- willScrollDistance = 0
- }
- val diffY = defaultScrollHeight - willScrollDistance;
- viewPosition.change(viewPosition.l, viewPosition.t + diffY, viewPosition.r, viewPosition.b + diffY);
- view.layout(viewPosition.changeL, viewPosition.changeT, viewPosition.changeR, viewPosition.changeB)
- }
- LogTracker.log("${PanelSwitchLayout.TAG}#onLayout", "ContentScrollMeasurer(id $viewId , defaultScrollHeight $defaultScrollHeight , scrollDistance $willScrollDistance reset $reset) origin (l ${viewPosition.l},t ${viewPosition.t},r ${viewPosition.l}, b ${viewPosition.b})")
- LogTracker.log("${PanelSwitchLayout.TAG}#onLayout", "ContentScrollMeasurer(id $viewId , defaultScrollHeight $defaultScrollHeight , scrollDistance $willScrollDistance reset $reset) layout parent(l $l,t $t,r $r,b $b) self(l ${viewPosition.changeL},t ${viewPosition.changeT},r ${viewPosition.changeR}, b${viewPosition.changeB})")
- }
- }
- }
- }
-
- override fun changeContainerHeight(targetHeight: Int) {
- val layoutParams = mViewGroup.layoutParams
- if (layoutParams != null && layoutParams.height != targetHeight) {
- layoutParams.height = targetHeight
- mViewGroup.layoutParams = layoutParams
- }
- }
-
- override fun assertView() {
- if (mEditText == null) {
- throw RuntimeException("ContentContainer should set edit_view to get the editText!")
- }
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/content/FrameContentContainer.kt b/panel/src/main/java/com/effective/android/panel/view/content/FrameContentContainer.kt
deleted file mode 100644
index 9e529fe..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/content/FrameContentContainer.kt
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.effective.android.panel.view.content
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.support.annotation.IdRes
-import android.util.AttributeSet
-import android.view.MotionEvent
-import android.view.View
-import android.widget.FrameLayout
-import com.effective.android.panel.R
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-
-/**
- * --------------------
- * | PanelSwitchLayout |
- * | ---------------- |
- * | | | |
- * | |ContentContainer| |
- * | | | |
- * | ---------------- |
- * | ---------------- |
- * | | PanelContainer | |
- * | ---------------- |
- * --------------------
- * Created by yummyLau on 2020/05/07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class FrameContentContainer : FrameLayout, IContentContainer {
- @IdRes
- private var editTextId = 0
-
- @IdRes
- private var autoResetId = 0
-
- private var autoResetByOnTouch :Boolean = true
- private lateinit var contentContainer: ContentContainerImpl
-
- @JvmOverloads
- constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context!!, attrs, defStyleAttr) {
- initView(attrs, defStyleAttr, 0)
- }
-
- @TargetApi(21)
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context!!, attrs, defStyleAttr, defStyleRes) {
- initView(attrs, defStyleAttr, defStyleRes)
- }
-
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {
- val typedArray = context.obtainStyledAttributes(attrs, R.styleable.FrameContentContainer, defStyleAttr, 0)
- editTextId = typedArray.getResourceId(R.styleable.FrameContentContainer_edit_view, -1)
- autoResetId = typedArray.getResourceId(R.styleable.FrameContentContainer_auto_reset_area, -1)
- autoResetByOnTouch = typedArray.getBoolean(R.styleable.FrameContentContainer_auto_reset_enable, autoResetByOnTouch)
- typedArray.recycle()
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- contentContainer = ContentContainerImpl(this,autoResetByOnTouch, editTextId, autoResetId)
- val editText = getInputActionImpl().getFullScreenPixelInputView()
- addView(editText, 0,LayoutParams(1, 1))
- }
-
- override fun layoutContainer(l: Int, t: Int, r: Int, b: Int,
- contentScrollMeasurers: MutableList, defaultScrollHeight: Int, canScrollOutsize: Boolean,
- reset: Boolean) {
- contentContainer.layoutContainer(l, t, r, b, contentScrollMeasurers, defaultScrollHeight, canScrollOutsize,reset)
- }
-
- override fun findTriggerView(id: Int): View? {
- return contentContainer.findTriggerView(id)
- }
-
- override fun changeContainerHeight(targetHeight: Int) {
- contentContainer.changeContainerHeight(targetHeight)
- }
-
- override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
- val onTouchTrue = super.dispatchTouchEvent(ev)
- val hookResult = getResetActionImpl().hookDispatchTouchEvent(ev, onTouchTrue)
- return hookResult or onTouchTrue
- }
-
- override fun onTouchEvent(event: MotionEvent?): Boolean {
- val onTouchBySelf = super.onTouchEvent(event)
- val hookResult = getResetActionImpl().hookOnTouchEvent(event)
- return onTouchBySelf or hookResult
- }
-
- override fun getInputActionImpl(): IInputAction = contentContainer.getInputActionImpl()
-
- override fun getResetActionImpl(): IResetAction = contentContainer.getResetActionImpl()
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/content/IContentContainer.kt b/panel/src/main/java/com/effective/android/panel/view/content/IContentContainer.kt
deleted file mode 100644
index 714a431..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/content/IContentContainer.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.effective.android.panel.view.content
-
-import android.support.annotation.IdRes
-import android.view.MotionEvent
-import android.view.View
-import android.view.View.OnFocusChangeListener
-import android.widget.EditText
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-
-interface IContentContainer {
- //容器行为
- fun findTriggerView(@IdRes id: Int): View?
- fun layoutContainer(l: Int, t: Int, r: Int, b: Int,
- contentScrollMeasurer: MutableList, defaultScrollHeight: Int, canScrollOutsize: Boolean,
- reset: Boolean)
-
- fun changeContainerHeight(targetHeight: Int)
-
- //输入相关
- fun getInputActionImpl(): IInputAction
-
- //隐藏相关
- fun getResetActionImpl(): IResetAction
-}
-
-interface IInputAction {
- fun addSecondaryInputView(editText: EditText)
- fun removeSecondaryInputView(editText: EditText)
- fun setEditTextClickListener(l: View.OnClickListener)
- fun setEditTextFocusChangeListener(l: OnFocusChangeListener)
- fun requestKeyboard()
- fun hideKeyboard(clearFocus : Boolean)
- fun showKeyboard() : Boolean
- fun getFullScreenPixelInputView(): EditText
- fun updateFullScreenParams(isFullScreen : Boolean, panelId : Int, panelHeight : Int)
- fun recycler()
-}
-
-interface IResetAction {
- fun enableReset(enable: Boolean)
- fun setResetCallback(runnable: Runnable)
- fun hookDispatchTouchEvent(ev: MotionEvent?, consume: Boolean): Boolean
- fun hookOnTouchEvent(ev: MotionEvent?): Boolean
-}
diff --git a/panel/src/main/java/com/effective/android/panel/view/content/LinearContentContainer.kt b/panel/src/main/java/com/effective/android/panel/view/content/LinearContentContainer.kt
deleted file mode 100644
index 5c6ea06..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/content/LinearContentContainer.kt
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.effective.android.panel.view.content
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.support.annotation.IdRes
-import android.util.AttributeSet
-import android.view.MotionEvent
-import android.view.View
-import android.widget.LinearLayout
-import com.effective.android.panel.R
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-
-/**
- * --------------------
- * | PanelSwitchLayout |
- * | ---------------- |
- * | | | |
- * | |ContentContainer| |
- * | | | |
- * | ---------------- |
- * | ---------------- |
- * | | PanelContainer | |
- * | ---------------- |
- * --------------------
- * Created by yummyLau on 2020/05/07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class LinearContentContainer : LinearLayout, IContentContainer {
- @IdRes
- private var editTextId = 0
-
- @IdRes
- private var autoResetId = 0
- private var autoResetByOnTouch: Boolean = true
- private lateinit var contentContainer: ContentContainerImpl
-
- @JvmOverloads
- constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context, attrs, defStyleAttr) {
- initView(attrs, defStyleAttr, 0)
- }
-
- @TargetApi(21)
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
- initView(attrs, defStyleAttr, defStyleRes)
- }
-
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {
- val typedArray = context.obtainStyledAttributes(attrs, R.styleable.LinearContentContainer, defStyleAttr, 0)
- editTextId = typedArray.getResourceId(R.styleable.LinearContentContainer_edit_view, -1)
- autoResetId = typedArray.getResourceId(R.styleable.LinearContentContainer_auto_reset_area, -1)
- autoResetByOnTouch = typedArray.getBoolean(R.styleable.LinearContentContainer_auto_reset_enable, autoResetByOnTouch)
- typedArray.recycle()
- orientation = VERTICAL
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- contentContainer = ContentContainerImpl(this, autoResetByOnTouch, editTextId, autoResetId)
- val editText = getInputActionImpl().getFullScreenPixelInputView()
- val layoutParams = LayoutParams(1, 1)
- layoutParams.topMargin = -1
- addView(editText,0,layoutParams)
- }
-
- override fun layoutContainer(l: Int, t: Int, r: Int, b: Int,
- contentScrollMeasurers: MutableList, defaultScrollHeight: Int, canScrollOutsize: Boolean,
- reset: Boolean) {
- contentContainer.layoutContainer(l, t, r, b, contentScrollMeasurers, defaultScrollHeight, canScrollOutsize,reset)
- }
-
- override fun findTriggerView(id: Int): View? {
- return contentContainer.findTriggerView(id)
- }
-
- override fun changeContainerHeight(targetHeight: Int) {
- contentContainer.changeContainerHeight(targetHeight)
- }
-
- override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
- val onTouchTrue = super.dispatchTouchEvent(ev)
- val hookResult = getResetActionImpl().hookDispatchTouchEvent(ev, onTouchTrue)
- return hookResult or onTouchTrue
- }
-
- override fun onTouchEvent(event: MotionEvent?): Boolean {
- val onTouchBySelf = super.onTouchEvent(event)
- val hookResult = getResetActionImpl().hookOnTouchEvent(event)
- return onTouchBySelf or hookResult
- }
-
- override fun getInputActionImpl(): IInputAction = contentContainer.getInputActionImpl()
-
- override fun getResetActionImpl(): IResetAction = contentContainer.getResetActionImpl()
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/content/RelativeContentContainer.kt b/panel/src/main/java/com/effective/android/panel/view/content/RelativeContentContainer.kt
deleted file mode 100644
index 0b32396..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/content/RelativeContentContainer.kt
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.effective.android.panel.view.content
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.support.annotation.IdRes
-import android.util.AttributeSet
-import android.view.MotionEvent
-import android.view.View
-import android.widget.RelativeLayout
-import com.effective.android.panel.R
-import com.effective.android.panel.interfaces.ContentScrollMeasurer
-
-/**
- * --------------------
- * | PanelSwitchLayout |
- * | ---------------- |
- * | | | |
- * | |ContentContainer| |
- * | | | |
- * | ---------------- |
- * | ---------------- |
- * | | PanelContainer | |
- * | ---------------- |
- * --------------------
- * Created by yummyLau on 2020/05/07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class RelativeContentContainer : RelativeLayout, IContentContainer {
- @IdRes
- private var editTextId = 0
-
- @IdRes
- private var autoResetId = 0
- private var autoResetByOnTouch: Boolean = true
- private lateinit var contentContainer: ContentContainerImpl
-
- @JvmOverloads
- constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context, attrs, defStyleAttr) {
- initView(attrs, defStyleAttr, 0)
- }
-
- @TargetApi(21)
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
- initView(attrs, defStyleAttr, defStyleRes)
- }
-
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {
- val typedArray = context.obtainStyledAttributes(attrs, R.styleable.RelativeContentContainer, defStyleAttr, 0)
- editTextId = typedArray.getResourceId(R.styleable.RelativeContentContainer_edit_view, -1)
- autoResetId = typedArray.getResourceId(R.styleable.RelativeContentContainer_auto_reset_area, -1)
- autoResetByOnTouch = typedArray.getBoolean(R.styleable.RelativeContentContainer_auto_reset_enable, autoResetByOnTouch)
- typedArray.recycle()
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- contentContainer = ContentContainerImpl(this, autoResetByOnTouch, editTextId, autoResetId)
- val editText = getInputActionImpl().getFullScreenPixelInputView()
- addView(editText, 0,LayoutParams(1, 1))
- }
-
- override fun layoutContainer(l: Int, t: Int, r: Int, b: Int,
- contentScrollMeasurers: MutableList, defaultScrollHeight: Int, canScrollOutsize: Boolean,
- reset: Boolean) {
- contentContainer.layoutContainer(l, t, r, b, contentScrollMeasurers, defaultScrollHeight, canScrollOutsize, reset)
- }
-
- override fun findTriggerView(id: Int): View? {
- return contentContainer.findTriggerView(id)
- }
-
- override fun changeContainerHeight(targetHeight: Int) {
- contentContainer.changeContainerHeight(targetHeight)
- }
-
- override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
- val onTouchTrue = super.dispatchTouchEvent(ev)
- val hookResult = getResetActionImpl().hookDispatchTouchEvent(ev, onTouchTrue)
- return hookResult or onTouchTrue
- }
-
- override fun onTouchEvent(event: MotionEvent?): Boolean {
- val onTouchBySelf = super.onTouchEvent(event)
- val hookResult = getResetActionImpl().hookOnTouchEvent(event)
- return onTouchBySelf or hookResult
- }
-
- override fun getInputActionImpl(): IInputAction = contentContainer.getInputActionImpl()
-
- override fun getResetActionImpl(): IResetAction = contentContainer.getResetActionImpl()
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/panel/IPanelView.kt b/panel/src/main/java/com/effective/android/panel/view/panel/IPanelView.kt
deleted file mode 100644
index b5752b0..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/panel/IPanelView.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.effective.android.panel.view.panel
-
-import android.support.annotation.IdRes
-import com.effective.android.panel.interfaces.ViewAssertion
-
-/**
- * 扩展panelView
- * 同时需要实现 ViewAssertion 校验 trigger 绑定的有效性,实现 IPanelView 应该是一个 ViewGroup
- * created by yummylau on 2020/06/01 🧒儿童节
- */
-interface IPanelView : ViewAssertion {
-
- @IdRes
- fun getBindingTriggerViewId(): Int
-
- fun isTriggerViewCanToggle(): Boolean
-
- fun isShowing():Boolean
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/panel/PanelContainer.kt b/panel/src/main/java/com/effective/android/panel/view/panel/PanelContainer.kt
deleted file mode 100644
index 6ac3bc5..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/panel/PanelContainer.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.effective.android.panel.view.panel
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.util.AttributeSet
-import android.util.Pair
-import android.util.SparseArray
-import android.view.View
-import android.widget.FrameLayout
-import com.effective.android.panel.Constants
-import com.effective.android.panel.interfaces.ViewAssertion
-
-/**
- * --------------------
- * | PanelSwitchLayout |
- * | ---------------- |
- * | | | |
- * | |ContentContainer| |
- * | | | |
- * | ---------------- |
- * | ---------------- |
- * | | PanelContainer | |
- * | ---------------- |
- * --------------------
- * Created by yummyLau on 18-7-10
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class PanelContainer : FrameLayout, ViewAssertion {
- var panelSparseArray = SparseArray()
- private set
-
- @JvmOverloads
- constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context!!, attrs, defStyleAttr) {
- initView(attrs, defStyleAttr, 0)
- }
-
- @TargetApi(21)
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context!!, attrs, defStyleAttr, defStyleRes) {
- initView(attrs, defStyleAttr, defStyleRes)
- }
-
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {}
-
- override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
- super.onLayout(changed, left, top, right, bottom)
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- assertView()
- }
-
- override fun assertView() {
- panelSparseArray = SparseArray()
- for (i in 0 until childCount) {
- val panel = getChildAt(i) as? IPanelView
- ?: throw RuntimeException("PanelContainer -- PanelContainer's child should be IPanelView")
- panelSparseArray.put(panel.getBindingTriggerViewId(), panel)
- (panel as View).visibility = View.GONE
- }
- }
-
- fun getPanelView(panelId: Int): IPanelView? {
- return panelSparseArray[panelId]
- }
-
- fun getPanelId(panel: IPanelView?): Int {
- return panel?.getBindingTriggerViewId() ?: Constants.PANEL_KEYBOARD
- }
-
- fun showPanel(panelId: Int, size: Pair): Pair {
- val panel = panelSparseArray[panelId]
- for (i in 0 until panelSparseArray.size()) {
- val panelView = panelSparseArray[panelSparseArray.keyAt(i)]
- if (panelView is View)
- panelView.visibility = if (panelView != panel) View.GONE else View.VISIBLE
- }
- val layoutParams = (panel as View).layoutParams
- val curSize = Pair(layoutParams.width, layoutParams.height)
- if (curSize.first != size.first || curSize.second != size.second) {
- layoutParams.width = size.first
- layoutParams.height = size.second
- (panel as View).layoutParams = layoutParams
- }
- return curSize
- }
-
- fun changeContainerHeight(targetHeight: Int) {
- if (layoutParams != null && layoutParams.height != targetHeight) {
- layoutParams.height = targetHeight
- }
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/view/panel/PanelView.kt b/panel/src/main/java/com/effective/android/panel/view/panel/PanelView.kt
deleted file mode 100644
index f2e6904..0000000
--- a/panel/src/main/java/com/effective/android/panel/view/panel/PanelView.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.effective.android.panel.view.panel
-
-import android.annotation.TargetApi
-import android.content.Context
-import android.util.AttributeSet
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.FrameLayout
-import com.effective.android.panel.R
-import com.effective.android.panel.view.panel.IPanelView
-
-/**
- * interface, everyPanel should implements
- * Created by yummyLau on 18-7-07
- * Email: yummyl.lau@gmail.com
- * blog: yummylau.com
- */
-class PanelView : FrameLayout, IPanelView {
- private var panelLayoutId = 0
- private var triggerViewId = 0
- private var isToggle = true
-
- @JvmOverloads
- constructor(context: Context?, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(context!!, attrs, defStyleAttr) {
- initView(attrs, defStyleAttr, 0)
- }
-
- @TargetApi(21)
- constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context!!, attrs, defStyleAttr, defStyleRes) {
- initView(attrs, defStyleAttr, defStyleRes)
- }
-
- private fun initView(attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) {
- val typedArray = context.obtainStyledAttributes(attrs, R.styleable.PanelView, defStyleAttr, 0)
- panelLayoutId = typedArray.getResourceId(R.styleable.PanelView_panel_layout, -1)
- triggerViewId = typedArray.getResourceId(R.styleable.PanelView_panel_trigger, -1)
- isToggle = typedArray.getBoolean(R.styleable.PanelView_panel_toggle, isToggle)
- typedArray.recycle()
- }
-
- override fun getBindingTriggerViewId(): Int = triggerViewId
-
- override fun isTriggerViewCanToggle(): Boolean = isToggle
-
- override fun isShowing(): Boolean = isShown
-
- override fun assertView() {
- if (panelLayoutId == -1 || triggerViewId == -1) {
- throw RuntimeException("PanelView -- you must set 'panel_layout' and panel_trigger by Integer id")
- }
- if (childCount > 0) {
- throw RuntimeException("PanelView -- you can't have any child!")
- }
- //默认实现 FrameLayout 恒为false,这里只是强调申明而已,可以不写。
- if (this !is View) {
- throw RuntimeException("PanelView -- should be a view!")
- }
- LayoutInflater.from(context).inflate(panelLayoutId, this, true)
- }
-
- override fun onFinishInflate() {
- super.onFinishInflate()
- assertView()
- }
-
-}
\ No newline at end of file
diff --git a/panel/src/main/java/com/effective/android/panel/window/PanelDialog.kt b/panel/src/main/java/com/effective/android/panel/window/PanelDialog.kt
deleted file mode 100644
index 773aef9..0000000
--- a/panel/src/main/java/com/effective/android/panel/window/PanelDialog.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.effective.android.panel.window
-
-import android.app.Dialog
-import android.content.Context
-import android.content.DialogInterface
-import android.graphics.Color
-import android.graphics.drawable.ColorDrawable
-import android.support.annotation.LayoutRes
-import android.view.Gravity
-import android.view.LayoutInflater
-import android.view.View
-import android.view.WindowManager
-import com.effective.android.panel.PanelSwitchHelper
-
-/**
- * 提供给外部使用的dialog,场景用于类 微博评论/微信朋友圈
- * created by yummylau on 2020/06/04
- */
-abstract class PanelDialog : Dialog {
-
- @JvmField
- protected val rootView: View
-
- @JvmField
- protected var helper: PanelSwitchHelper? = null
-
- constructor(context: Context) : super(context)
- constructor(context: Context, themeResId: Int) : super(context, themeResId)
- constructor(context: Context, cancelable: Boolean, cancelListener: DialogInterface.OnCancelListener?) : super(context, cancelable, cancelListener)
-
- @LayoutRes
- abstract fun getDialogLayout(): Int
-
- init {
- rootView = LayoutInflater.from(context).inflate(getDialogLayout(), null, false)
- setContentView(rootView)
- window?.let {
- it.setGravity(Gravity.CENTER)
- it.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
- val lp = it.attributes
- lp.width = WindowManager.LayoutParams.MATCH_PARENT
- lp.height = WindowManager.LayoutParams.MATCH_PARENT
- it.attributes = lp
- it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
- it.setDimAmount(0f)
- it.setType(WindowManager.LayoutParams.TYPE_APPLICATION_PANEL)
- }
- }
-}
\ No newline at end of file
diff --git a/panel/src/main/res/values/attr.xml b/panel/src/main/res/values/attr.xml
deleted file mode 100644
index 6e9b555..0000000
--- a/panel/src/main/res/values/attr.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/panel/src/main/res/values/ids.xml b/panel/src/main/res/values/ids.xml
deleted file mode 100644
index 84f599a..0000000
--- a/panel/src/main/res/values/ids.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/source/demo.apk b/source/demo.apk
index aee963d..55a148c 100644
Binary files a/source/demo.apk and b/source/demo.apk differ
diff --git a/versions.gradle b/versions.gradle
index 1d5f006..ee9999d 100644
--- a/versions.gradle
+++ b/versions.gradle
@@ -3,8 +3,7 @@ def versions = [:]
versions.android_gradle_plugin = android_gradle_plugin
versions.support = "27.1.1"
versions.pageindicator = "1.0.1"
-versions.panelSwitchHelper = "1.3.13"
-versions.panelSwitchHelper_androidx = "1.3.13"
+versions.panelSwitchHelper = "1.4.0"
versions.multidex = "1.0.1"
versions.constraint = "1.1.2"
versions.circleimageview = "3.1.0"
@@ -30,6 +29,7 @@ ext.deps.androidx = androidx
ext.deps.pageindicator = "com.romandanylyk:pageindicatorview:$versions.pageindicator"
ext.deps.android_gradle_plugin = "com.android.tools.build:gradle:$versions.android_gradle_plugin"
+ext.deps.panelSwitchHelper_androidx = "com.github.YummyLau:PanelSwitchHelper:$versions.panelSwitchHelper"
ext.deps.circleimageview = "de.hdodenhof:circleimageview:$versions.circleimageview"
def config = [:]