//custom progress dialog
public static class JKProgressDialog extends Dialog {
public static Context mContext;
AppCompatActivity mActivity;
public JKProgressDialog(final Context mContext, final AppCompatActivity mActivity) {

super(mContext, R.style.JkDialog);

this.mContext = mContext;
this.mActivity = mActivity;

WindowManager.LayoutParams wlmp = getWindow().getAttributes();
wlmp.gravity = Gravity.CENTER_HORIZONTAL;
getWindow().setAttributes(wlmp);
setTitle(null);
setCancelable(true);

LinearLayout layout = new LinearLayout(mContext);
layout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
ProgressBar dialog = new ProgressBar(mContext);

//프로그래스 색상 변경
PorterDuffColorFilter commColor = new PorterDuffColorFilter(mContext.getResources().getColor(R.color.black), PorterDuff.Mode.SRC_ATOP);
dialog.getIndeterminateDrawable().setColorFilter(commColor);

layout.addView(dialog, params);
addContentView(layout, params);
}

@Override
public void show() {
try{
super.show();
} catch (Exception e){
e.printStackTrace();
}

}

@Override
public void dismiss(){
try{
super.dismiss();
} catch (Exception e){
e.printStackTrace();
}
}
}


'android' 카테고리의 다른 글

문자열 숫자 콤마 붙이기  (0) 2017.12.02
문자열 전화번호 포맷  (0) 2017.12.02
안드로이드 실행 지연  (0) 2017.12.02
웹 뷰 테스트  (0) 2017.11.29
CallBack만들기  (0) 2017.11.29

+ Recent posts