Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now button can fill space #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.1'
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

Expand Down
6 changes: 2 additions & 4 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ android {
}

dependencies {
compile 'com.pnikosis:materialish-progress:1.0'
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
compile 'com.pnikosis:materialish-progress:1.5'
}
11 changes: 10 additions & 1 deletion library/src/main/java/cn/pedant/SweetAlert/SweetAlertDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
Expand Down Expand Up @@ -56,6 +57,8 @@ public class SweetAlertDialog extends Dialog implements View.OnClickListener {
private OnSweetClickListener mConfirmClickListener;
private boolean mCloseFromCancel;

private ProgressWheel progressWheel;

public static final int NORMAL_TYPE = 0;
public static final int ERROR_TYPE = 1;
public static final int SUCCESS_TYPE = 2;
Expand Down Expand Up @@ -139,6 +142,10 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.alert_dialog);

progressWheel = new ProgressWheel(getContext());
progressWheel.setBarColor(Color.BLUE);
progressWheel.setBarWidth(80);

mDialogView = getWindow().getDecorView().findViewById(android.R.id.content);
mTitleTextView = (TextView)findViewById(R.id.title_text);
mContentTextView = (TextView)findViewById(R.id.content_text);
Expand All @@ -153,7 +160,7 @@ protected void onCreate(Bundle savedInstanceState) {
mWarningFrame = (FrameLayout)findViewById(R.id.warning_frame);
mConfirmButton = (Button)findViewById(R.id.confirm_button);
mCancelButton = (Button)findViewById(R.id.cancel_button);
mProgressHelper.setProgressWheel((ProgressWheel)findViewById(R.id.progressWheel));
mProgressHelper.setProgressWheel(progressWheel);
mConfirmButton.setOnClickListener(this);
mCancelButton.setOnClickListener(this);

Expand All @@ -163,6 +170,8 @@ protected void onCreate(Bundle savedInstanceState) {
setConfirmText(mConfirmText);
changeAlertType(mAlertType, true);

mProgressFrame.addView(progressWheel);

}

private void restore () {
Expand Down
10 changes: 1 addition & 9 deletions library/src/main/res/layout/alert_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,7 @@
android:layout_marginTop="9dp"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone">

<com.pnikosis.materialishprogress.ProgressWheel
android:id="@+id/progressWheel"
android:layout_width="80dp"
android:layout_height="80dp"
wheel:progressIndeterminate="true"
android:layout_gravity="center" />
</FrameLayout>
android:visibility="gone"/>

<TextView
android:id="@+id/title_text"
Expand Down
4 changes: 3 additions & 1 deletion library/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

<style name="dialog_blue_button" parent="android:Widget.Button">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">31dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">match_parent</item>
<item name="android:minHeight">32dp</item>
<item name="android:background">@drawable/blue_button_background</item>
<item name="android:textSize">14sp</item>
<item name="android:paddingLeft">21dp</item>
Expand Down