├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml └── runConfigurations.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── behavior │ │ └── bottombehaviormaster │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── behavior │ │ │ └── bottombehaviormaster │ │ │ ├── MyApplication.java │ │ │ ├── activity │ │ │ ├── MainActivity.java │ │ │ └── TestActivity.java │ │ │ ├── dialog │ │ │ ├── BaseBottomSheetDialog.java │ │ │ └── BottomSheetDialog.java │ │ │ └── view │ │ │ └── CustomerVideoView.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_test.xml │ │ ├── view_comment_item.xml │ │ └── view_dialog_comment.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── behavior │ └── bottombehaviormaster │ └── ExampleUnitTest.java ├── build.gradle ├── gif └── 21134244-7e7a289febb2f094.gif ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── mybehavior ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── behavior │ │ └── mybehavior │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ ├── drawable │ │ ├── icon_comment_close.png │ │ ├── icon_comment_zan.png │ │ └── shape_dialog_send_comment_btn.xml │ │ ├── raw │ │ └── test.mp4 │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── behavior │ └── mybehavior │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | xmlns:android 11 | 12 | ^$ 13 | 14 | 15 | 16 |
17 |
18 | 19 | 20 | 21 | xmlns:.* 22 | 23 | ^$ 24 | 25 | 26 | BY_NAME 27 | 28 |
29 |
30 | 31 | 32 | 33 | .*:id 34 | 35 | http://schemas.android.com/apk/res/android 36 | 37 | 38 | 39 |
40 |
41 | 42 | 43 | 44 | .*:name 45 | 46 | http://schemas.android.com/apk/res/android 47 | 48 | 49 | 50 |
51 |
52 | 53 | 54 | 55 | name 56 | 57 | ^$ 58 | 59 | 60 | 61 |
62 |
63 | 64 | 65 | 66 | style 67 | 68 | ^$ 69 | 70 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | .* 78 | 79 | ^$ 80 | 81 | 82 | BY_NAME 83 | 84 |
85 |
86 | 87 | 88 | 89 | .* 90 | 91 | http://schemas.android.com/apk/res/android 92 | 93 | 94 | ANDROID_ATTRIBUTE_ORDER 95 | 96 |
97 |
98 | 99 | 100 | 101 | .* 102 | 103 | .* 104 | 105 | 106 | BY_NAME 107 | 108 |
109 |
110 |
111 |
112 |
113 |
-------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # behavior 2 | 3 | ### gif 4 | 5 | 6 | 7 | 简书:https://www.jianshu.com/p/5986aec86f87 8 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.behavior.bottombehaviormaster" 7 | minSdkVersion 21 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | compileOptions { 20 | sourceCompatibility = 1.8 21 | targetCompatibility = 1.8 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation project(':mybehavior') 28 | } 29 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/behavior/bottombehaviormaster/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.behavior.bottombehaviormaster; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 23 | 24 | assertEquals("com.behavior.bottombehaviormaster", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/behavior/bottombehaviormaster/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.behavior.bottombehaviormaster; 2 | 3 | import android.app.Application; 4 | 5 | import com.blankj.utilcode.util.Utils; 6 | 7 | /** 8 | * @author Lix 9 | * @date 2020-02-01 21:30 10 | */ 11 | public class MyApplication extends Application { 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | //工具类初始化 16 | Utils.init(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/behavior/bottombehaviormaster/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.behavior.bottombehaviormaster.activity; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | 8 | import com.behavior.bottombehaviormaster.R; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | findViewById(R.id.btn1).setOnClickListener(new View.OnClickListener() { 17 | @Override 18 | public void onClick(View view) { 19 | startActivity( new Intent(MainActivity.this,TestActivity.class)); 20 | } 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/behavior/bottombehaviormaster/activity/TestActivity.java: -------------------------------------------------------------------------------- 1 | package com.behavior.bottombehaviormaster.activity; 2 | 3 | import android.net.Uri; 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.design.widget.BottomSheetBehavior; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.RelativeLayout; 13 | import android.widget.TextView; 14 | import android.widget.VideoView; 15 | 16 | import com.behavior.bottombehaviormaster.R; 17 | import com.behavior.bottombehaviormaster.dialog.BaseBottomSheetDialog; 18 | import com.behavior.bottombehaviormaster.dialog.BottomSheetDialog; 19 | import com.blankj.utilcode.util.BarUtils; 20 | import com.blankj.utilcode.util.LogUtils; 21 | import com.blankj.utilcode.util.ScreenUtils; 22 | import com.chad.library.adapter.base.BaseQuickAdapter; 23 | import com.chad.library.adapter.base.BaseViewHolder; 24 | 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | 28 | public class TestActivity extends AppCompatActivity { 29 | VideoView videoView; 30 | 31 | @Override 32 | protected void onCreate(Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | BarUtils.setStatusBarVisibility(this, false); 35 | setContentView(R.layout.activity_test); 36 | videoView = findViewById(R.id.videoView); 37 | String uri = "android.resource://" + getPackageName() + "/" + R.raw.test; 38 | videoView.setVideoURI(Uri.parse(uri)); 39 | videoView.start(); 40 | findViewById(R.id.floatBtn).setOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View view) { 43 | final View[] views = new View[1]; 44 | BottomSheetDialog mBottomCommentSheetDialog = new BottomSheetDialog(); 45 | mBottomCommentSheetDialog.setFragmentManager(getSupportFragmentManager()) 46 | .setLayoutRes(R.layout.view_dialog_comment) 47 | .setCancelOutside(true) 48 | .setViewListener(v1 -> { 49 | views[0] = findCommentView(v1); 50 | }) 51 | .show(); 52 | mBottomCommentSheetDialog.setBehaviorChanged(new BaseBottomSheetDialog.IBehaviorChanged() { 53 | @Override 54 | public void changedState(View bottomSheet, int state) { 55 | float width = ScreenUtils.getScreenWidth(); 56 | float height = ScreenUtils.getScreenHeight(); 57 | if (state == BottomSheetBehavior.STATE_EXPANDED) { 58 | float x = width / 2f; 59 | views[0].post(() -> { 60 | float scale = height - (views[0].getHeight()); 61 | videoView.setScaleX(scale / height); 62 | videoView.setScaleY(scale / height); 63 | videoView.setPivotX(x); 64 | videoView.setPivotY(0); 65 | }); 66 | } else if (state == BottomSheetBehavior.STATE_COLLAPSED) { 67 | videoView.setScaleX(1.0f); 68 | videoView.setScaleY(1.0f); 69 | videoView.setPivotX(0); 70 | videoView.setPivotY(0); 71 | } 72 | } 73 | 74 | @Override 75 | public void changedOffset(View bottomSheet, float slideOffset) { 76 | startAnimator(bottomSheet); 77 | } 78 | }); 79 | } 80 | }); 81 | } 82 | 83 | /** 84 | * @param parent 85 | */ 86 | private void startAnimator(View parent) { 87 | float width = ScreenUtils.getScreenWidth(); 88 | float height = ScreenUtils.getScreenHeight(); 89 | float x = width / 2f; 90 | float py = parent.getY() / height; 91 | LogUtils.e(parent.getY()); 92 | LogUtils.e(parent.getY() + BarUtils.getStatusBarHeight()); 93 | videoView.setScaleX(py); 94 | videoView.setScaleY(py); 95 | videoView.setPivotX(x); 96 | videoView.setPivotY(0); 97 | } 98 | 99 | /** 100 | * 评论 101 | * 绑定View 102 | * 103 | * @param contentView 104 | */ 105 | private View findCommentView(View contentView) { 106 | List list = new ArrayList<>(); 107 | for (int i = 0; i < 10; i++) { 108 | list.add("i" + i); 109 | } 110 | RelativeLayout mCommentParent = contentView.findViewById(R.id.dialog_comments_layout); 111 | mCommentParent.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (ScreenUtils.getScreenHeight() / 1.5))); 112 | RecyclerView mCommentRecycle = contentView.findViewById(R.id.dialog_comment_recycle); 113 | RelativeLayout mCloseCommentBtn = contentView.findViewById(R.id.dialog_close_comment); 114 | TextView mCommentNum = contentView.findViewById(R.id.dialog_comments_num); 115 | RelativeLayout mSendCommentLayout = contentView.findViewById(R.id.dialog_send_comment); 116 | RelativeLayout mCommentNull = contentView.findViewById(R.id.dialog_comment_null); 117 | mCommentNum.setText(list.size() + "条评论"); 118 | mCommentRecycle.setLayoutManager(new LinearLayoutManager(this)); 119 | mCommentRecycle.setAdapter(new BaseQuickAdapter(R.layout.view_comment_item, list) { 120 | @Override 121 | protected void convert(BaseViewHolder helper, Object item) { 122 | 123 | } 124 | 125 | @Override 126 | public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { 127 | 128 | } 129 | }); 130 | 131 | mCloseCommentBtn.setOnClickListener(v -> { 132 | }); 133 | 134 | mSendCommentLayout.setOnClickListener(v -> { 135 | 136 | }); 137 | return mCommentParent; 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /app/src/main/java/com/behavior/bottombehaviormaster/dialog/BaseBottomSheetDialog.java: -------------------------------------------------------------------------------- 1 | package com.behavior.bottombehaviormaster.dialog; 2 | 3 | import android.content.DialogInterface; 4 | import android.os.Bundle; 5 | import android.support.annotation.LayoutRes; 6 | import android.support.annotation.NonNull; 7 | import android.support.design.widget.BottomSheetBehavior; 8 | import android.support.design.widget.BottomSheetDialog; 9 | import android.support.design.widget.BottomSheetDialogFragment; 10 | import android.support.v4.app.FragmentManager; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | import android.view.WindowManager; 15 | import android.widget.FrameLayout; 16 | 17 | import com.behavior.bottombehaviormaster.R; 18 | import com.blankj.utilcode.util.BarUtils; 19 | 20 | 21 | public abstract class BaseBottomSheetDialog extends BottomSheetDialogFragment { 22 | private static final String TAG = "base_bottom_sheet_dialog"; 23 | 24 | private IBehaviorChanged mBehaviorChanged; 25 | 26 | 27 | @LayoutRes 28 | public abstract int getLayoutRes(); 29 | 30 | public abstract void bindView(View v); 31 | 32 | @Override 33 | public void onStart() { 34 | super.onStart(); 35 | // 设置软键盘不自动弹出 36 | //设置 dialog 的宽高 37 | getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, getDialog().getWindow().getAttributes().height); 38 | //设置 dialog 的背景为 null 39 | getDialog().getWindow().setBackgroundDrawableResource(R.color.colorTransparent); 40 | getDialog().getWindow().setDimAmount(0f); 41 | getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); 42 | getDialog().setOnDismissListener(new DialogInterface.OnDismissListener() { 43 | @Override 44 | public void onDismiss(DialogInterface dialogInterface) { 45 | if (mBehaviorChanged != null) 46 | mBehaviorChanged.changedState(null, BottomSheetBehavior.STATE_COLLAPSED); 47 | } 48 | }); 49 | BarUtils.setStatusBarVisibility(getDialog().getWindow(), false); 50 | BottomSheetDialog dialog = (BottomSheetDialog) getDialog(); 51 | FrameLayout bottomSheet = dialog.getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet); 52 | if (bottomSheet != null) { 53 | BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet); 54 | // 初始为展开状态 55 | behavior.setState(BottomSheetBehavior.STATE_EXPANDED); 56 | behavior.setPeekHeight(0); 57 | if (mBehaviorChanged != null) 58 | mBehaviorChanged.changedState(null, BottomSheetBehavior.STATE_EXPANDED); 59 | behavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { 60 | @Override 61 | public void onStateChanged(@NonNull View bottomSheet, int newState) { 62 | if (newState == BottomSheetBehavior.STATE_HIDDEN || newState == BottomSheetBehavior.STATE_COLLAPSED) { 63 | dismiss(); 64 | } 65 | if (mBehaviorChanged != null) 66 | mBehaviorChanged.changedState(bottomSheet, newState); 67 | } 68 | 69 | @Override 70 | public void onSlide(@NonNull View bottomSheet, float slideOffset) { 71 | if (mBehaviorChanged != null) 72 | mBehaviorChanged.changedOffset(bottomSheet, slideOffset); 73 | } 74 | }); 75 | } 76 | } 77 | 78 | @Override 79 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 80 | Bundle savedInstanceState) { 81 | getDialog().setCanceledOnTouchOutside(getCancelOutside()); 82 | View v = inflater.inflate(getLayoutRes(), container, false); 83 | bindView(v); 84 | return v; 85 | } 86 | 87 | public IBehaviorChanged getBehaviorChanged() { 88 | return mBehaviorChanged; 89 | } 90 | 91 | public void setBehaviorChanged(IBehaviorChanged behaviorChanged) { 92 | mBehaviorChanged = behaviorChanged; 93 | } 94 | 95 | public interface IBehaviorChanged { 96 | void changedState(View bottomSheet, int state); 97 | 98 | void changedOffset(View bottomSheet, float slideOffset); 99 | } 100 | 101 | public boolean getCancelOutside() { 102 | return true; 103 | } 104 | 105 | public String getFragmentTag() { 106 | return TAG; 107 | } 108 | 109 | public void show(FragmentManager fragmentManager) { 110 | show(fragmentManager, getFragmentTag()); 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /app/src/main/java/com/behavior/bottombehaviormaster/dialog/BottomSheetDialog.java: -------------------------------------------------------------------------------- 1 | package com.behavior.bottombehaviormaster.dialog; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.LayoutRes; 5 | import android.support.v4.app.FragmentManager; 6 | import android.view.View; 7 | 8 | public class BottomSheetDialog extends BaseBottomSheetDialog { 9 | 10 | private static final String KEY_LAYOUT_RES = "bottom_layout_res"; 11 | private static final String KEY_CANCEL_OUTSIDE = "bottom_cancel_outside"; 12 | 13 | private FragmentManager mFragmentManager; 14 | 15 | private boolean mIsCancelOutside = super.getCancelOutside(); 16 | 17 | private String mTag = super.getFragmentTag(); 18 | 19 | 20 | @LayoutRes 21 | private int mLayoutRes; 22 | 23 | private ViewListener mViewListener; 24 | 25 | public static BottomSheetDialog create(FragmentManager manager) { 26 | BottomSheetDialog dialog = new BottomSheetDialog(); 27 | dialog.setFragmentManager(manager); 28 | return dialog; 29 | } 30 | 31 | @Override 32 | public void onCreate(Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | if (savedInstanceState != null) { 35 | mLayoutRes = savedInstanceState.getInt(KEY_LAYOUT_RES); 36 | mIsCancelOutside = savedInstanceState.getBoolean(KEY_CANCEL_OUTSIDE); 37 | } 38 | } 39 | 40 | @Override 41 | public void onSaveInstanceState(Bundle outState) { 42 | outState.putInt(KEY_LAYOUT_RES, mLayoutRes); 43 | outState.putBoolean(KEY_CANCEL_OUTSIDE, mIsCancelOutside); 44 | super.onSaveInstanceState(outState); 45 | } 46 | 47 | @Override 48 | public void bindView(View v) { 49 | if (mViewListener != null) { 50 | mViewListener.bindView(v); 51 | } 52 | } 53 | 54 | @Override 55 | public int getLayoutRes() { 56 | return mLayoutRes; 57 | } 58 | 59 | public BottomSheetDialog setFragmentManager(FragmentManager manager) { 60 | mFragmentManager = manager; 61 | return this; 62 | } 63 | 64 | public BottomSheetDialog setViewListener(ViewListener listener) { 65 | mViewListener = listener; 66 | return this; 67 | } 68 | 69 | public BottomSheetDialog setLayoutRes(@LayoutRes int layoutRes) { 70 | mLayoutRes = layoutRes; 71 | return this; 72 | } 73 | 74 | public BottomSheetDialog setCancelOutside(boolean cancel) { 75 | mIsCancelOutside = cancel; 76 | return this; 77 | } 78 | 79 | public BottomSheetDialog setTag(String tag) { 80 | mTag = tag; 81 | return this; 82 | } 83 | 84 | @Override 85 | public boolean getCancelOutside() { 86 | return mIsCancelOutside; 87 | } 88 | 89 | @Override 90 | public String getFragmentTag() { 91 | return mTag; 92 | } 93 | 94 | public interface ViewListener { 95 | void bindView(View v); 96 | } 97 | 98 | public BaseBottomSheetDialog show() { 99 | show(mFragmentManager); 100 | return this; 101 | } 102 | } -------------------------------------------------------------------------------- /app/src/main/java/com/behavior/bottombehaviormaster/view/CustomerVideoView.java: -------------------------------------------------------------------------------- 1 | package com.behavior.bottombehaviormaster.view; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.VideoView; 6 | 7 | /** 8 | * @author Lix 9 | * @date 2020-02-01 21:00 10 | */ 11 | public class CustomerVideoView extends VideoView { 12 | 13 | public CustomerVideoView(Context context) { 14 | super(context); 15 | } 16 | 17 | public CustomerVideoView(Context context, AttributeSet attrs) { 18 | super(context, attrs); 19 | } 20 | 21 | public CustomerVideoView(Context context, AttributeSet attrs, int defStyleAttr) { 22 | super(context, attrs, defStyleAttr); 23 | } 24 | 25 | @Override 26 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 27 | int width = getDefaultSize(0, widthMeasureSpec); 28 | int height = getDefaultSize(0, heightMeasureSpec); 29 | setMeasuredDimension(width, height); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |