Skip to content

Commit

Permalink
add some custom dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
leguang committed Sep 1, 2017
1 parent 3e9460c commit 337f2d2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import cn.itsite.adialog.BaseViewHolder;
import cn.itsite.adialog.demo.R;
import cn.itsite.adialog.dialog.BaseDialog;
import cn.itsite.adialog.dialog.LoadingDialog;
import cn.itsite.adialog.dialog.SelectorDialog;
import cn.itsite.adialog.dialogfragment.BaseDialogFragment;


public class DialogActivity extends AppCompatActivity implements View.OnClickListener {
Expand Down Expand Up @@ -151,11 +151,9 @@ public void onClick(View view) {
.show();
break;
case R.id.loading:
new BaseDialogFragment()
.setLayoutId(R.layout.loading_layout)
.setWidth(100)
.setHeight(100)
.show(getSupportFragmentManager());

new LoadingDialog(this).setDimAmount(0).show();

break;
case R.id.tips:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cn.itsite.adialog.dialog;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
Expand All @@ -17,7 +18,7 @@
*/
public class LoadingDialog extends BaseDialog {
private TextView tvLoading;
private String text;
private String text = "玩命加载中…";

public LoadingDialog(@NonNull Context context) {
super(context);
Expand All @@ -36,6 +37,12 @@ public int getLayoutId() {
return R.layout.adialog_loading;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setCancelable(false);
}

@Override
public void convertView(BaseViewHolder holder, BaseDialog dialog) {
super.convertView(holder, dialog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- rounded corner -->
<corners android:radius="5dp" />

<solid android:color="#77000000" />
<solid android:color="#99000000" />
<stroke
android:width="1dp"
android:color="#00000000" />
Expand Down
12 changes: 6 additions & 6 deletions library/src/main/res/layout/adialog_loading.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:background="@drawable/shape_bg_loading"
android:background="@drawable/shape_bg_adialog_loading"
android:gravity="center"
android:orientation="vertical">

<ProgressBar
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:clickable="false"
android:gravity="center" />
Expand All @@ -23,5 +23,5 @@
android:lineSpacingExtra="3dp"
android:text="玩命加载中…"
android:textColor="#FFFF"
android:textSize="15sp" />
android:textSize="13sp" />
</LinearLayout>
2 changes: 1 addition & 1 deletion library/src/main/res/layout/adialog_selector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_bg_selector"
android:background="@drawable/shape_bg_adialog_selector"
android:orientation="vertical">

<FrameLayout
Expand Down

0 comments on commit 337f2d2

Please sign in to comment.