//BottomDialog
implementation 'me.shaohui:bottomdialog:1.1.9'
BottomDialog dialog = BottomDialog.create(getSupportFragmentManager());
dialog.setViewListener(new BottomDialog.ViewListener(){
@Override
public void bindView(View v) {
TextView xj = v.findViewById(R.id.xj_dialog);
TextView xc = v.findViewById(R.id.xc_dialog);
TextView cancel = v.findViewById(R.id.cancel_dialog);
xj.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//takePhoto();
dialog.dismiss();
}
});
xc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
choosePhoto();
dialog.dismiss();
}
});
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
}
});
dialog.setLayoutRes(R.layout.dialog_layout);
dialog.show();
dialog_layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/colorGray">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_15"
android:background="@drawable/shape15"
android:orientation="vertical">
<TextView
android:id="@+id/xj_dialog"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:gravity="center"
android:text="@string/xj"
android:textColor="@color/colorBlack"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:background="@color/colorGray"/>
<TextView
android:id="@+id/xc_dialog"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:gravity="center"
android:text="@string/xc"
android:textColor="@color/colorBlack"/>
</LinearLayout>
<TextView
android:id="@+id/cancel_dialog"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:background="@drawable/shape15"
android:textColor="@color/colorBlack"
android:gravity="center"
android:text="@string/cancel"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
/>
</LinearLayout>
shape15
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_15"/>
<solid android:color="@color/colorWhite"/>
</shape>
//Dialog
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
implementation 'com.github.mamumu:mmDialog:1.2.0'
endLive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MMAlertDialog.showDialog(StarLiveActivity.this,
"提示",
"却确定要退出本场直播吗?",
"取消",
"确定",
false,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
},
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 如果正在推流,先停止推流,再退出
if (mIsPushing) {
stopRTMPPush();
}
startActivity(new Intent(StarLiveActivity.this, ForLiveActivity.class));
finish();
dialog.dismiss();
}
});
}
});
//加载进度
implementation 'com.wang.avi:library:2.1.3'
<com.wang.avi.AVLoadingIndicatorView
android:id="@+id/avi_excellentPlayback"
style="@style/AVLoadingIndicatorView"
android:layout_width="@dimen/dp_35"
android:layout_height="@dimen/dp_35"
android:layout_centerInParent="true"
android:visibility="visible"
app:indicatorColor="@color/colorBlue"
app:indicatorName="BallSpinFadeLoaderIndicator" />
loadingIndicatorView.hide(); //hide();隐藏 show();显示