-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from bugyun/develop
Develop
- Loading branch information
Showing
19 changed files
with
613 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
MissPermissionHelper/src/main/java/vip/ruoyun/permission/helper/ui/AgainRequestDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package vip.ruoyun.permission.helper.ui; | ||
|
||
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.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.view.View; | ||
import android.view.Window; | ||
|
||
public class AgainRequestDialog extends Dialog { | ||
private MissPermissionAlwaysDeniedView contentView; | ||
|
||
public AgainRequestDialog(@NonNull Context context) { | ||
super(context); | ||
init(); | ||
} | ||
|
||
public AgainRequestDialog(@NonNull Context context, int themeResId) { | ||
super(context, themeResId); | ||
init(); | ||
} | ||
|
||
public AgainRequestDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) { | ||
super(context, cancelable, cancelListener); | ||
init(); | ||
} | ||
|
||
private void init() { | ||
contentView = new MissPermissionAlwaysDeniedView(getContext()); | ||
contentView.setCancelClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (isShowing()) { | ||
dismiss(); | ||
} | ||
} | ||
}); | ||
requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
setContentView(contentView); | ||
setCanceledOnTouchOutside(false); | ||
if (getWindow() != null) { | ||
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | ||
} | ||
setOnCancelListener(new OnCancelListener() { | ||
@Override | ||
public void onCancel(DialogInterface dialog) { | ||
dialog.dismiss(); | ||
} | ||
}); | ||
} | ||
|
||
public void setSettingClickListener(String name, View.OnClickListener listener) { | ||
contentView.setBtSettingName(name); | ||
contentView.setSettingClickListener(listener); | ||
} | ||
|
||
public void setStyleId(int styleId) { | ||
contentView.setStyleId(styleId); | ||
} | ||
|
||
public void setTitleAndMsg(String title, String msg) { | ||
contentView.setTitle(title); | ||
contentView.setMsg(msg); | ||
} | ||
|
||
public MissPermissionAlwaysDeniedView getContentView() { | ||
return contentView; | ||
} | ||
|
||
|
||
public static AgainRequestDialog getAlwaysDeniedDialog(Context context) { | ||
AgainRequestDialog alwaysDialog = new AgainRequestDialog(context); | ||
return alwaysDialog; | ||
} | ||
|
||
|
||
} |
76 changes: 76 additions & 0 deletions
76
MissPermissionHelper/src/main/java/vip/ruoyun/permission/helper/ui/AlwaysDeniedDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package vip.ruoyun.permission.helper.ui; | ||
|
||
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.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.view.View; | ||
import android.view.Window; | ||
|
||
public class AlwaysDeniedDialog extends Dialog { | ||
private MissPermissionAlwaysDeniedView contentView; | ||
|
||
public AlwaysDeniedDialog(@NonNull Context context) { | ||
super(context); | ||
init(); | ||
} | ||
|
||
public AlwaysDeniedDialog(@NonNull Context context, int themeResId) { | ||
super(context, themeResId); | ||
init(); | ||
} | ||
|
||
public AlwaysDeniedDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) { | ||
super(context, cancelable, cancelListener); | ||
init(); | ||
} | ||
|
||
private void init() { | ||
contentView = new MissPermissionAlwaysDeniedView(getContext()); | ||
contentView.setCancelClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (isShowing()) { | ||
dismiss(); | ||
} | ||
} | ||
}); | ||
requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
setContentView(contentView); | ||
setCanceledOnTouchOutside(false); | ||
if (getWindow() != null) { | ||
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | ||
} | ||
setOnCancelListener(new DialogInterface.OnCancelListener() { | ||
@Override | ||
public void onCancel(DialogInterface dialog) { | ||
dialog.dismiss(); | ||
} | ||
}); | ||
} | ||
|
||
public void setSettingClickListener(View.OnClickListener listener) { | ||
contentView.setSettingClickListener(listener); | ||
} | ||
|
||
public void setStyleId(int styleId) { | ||
contentView.setStyleId(styleId); | ||
} | ||
|
||
public void setTitleAndMsg(String title, String msg) { | ||
contentView.setTitle(title); | ||
contentView.setMsg(msg); | ||
} | ||
|
||
public MissPermissionAlwaysDeniedView getContentView() { | ||
return contentView; | ||
} | ||
|
||
public static AlwaysDeniedDialog getAlwaysDeniedDialog(Context context) { | ||
return new AlwaysDeniedDialog(context); | ||
} | ||
|
||
} |
Oops, something went wrong.