package com.lowlevel.lowholotheme;

import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class ProgressDialogHolo extends ProgressDialog {
	/*
	 * Private variables
	 */
	private TextView mTitle;
	private ImageView mIcon;
	
	public ProgressDialogHolo(Context context) {
		super(context);

		final View title = View.inflate(context, R.layout.alert_dialog_title, null);
		
		mTitle = (TextView)title.findViewById(R.id.alertTitle);
		mIcon = (ImageView)title.findViewById(R.id.icon);
		
		setCustomTitle(title);
	}
		
	@Override
	public void show() {
		super.show();
		
		final Button positive = getButton(ProgressDialog.BUTTON_POSITIVE);
		final Button negative = getButton(ProgressDialog.BUTTON_NEGATIVE);
		final Button neutral = getButton(ProgressDialog.BUTTON_NEUTRAL);
		
		if (positive != null)
			positive.setBackgroundResource(R.drawable.button_holo);
		if (negative != null)
			negative.setBackgroundResource(R.drawable.button_holo);
		if (neutral != null)
			neutral.setBackgroundResource(R.drawable.button_holo);
	}

	@Override
	public void setTitle(int textResId) {
		mTitle.setText(textResId);
	}

	@Override
	public void setTitle(CharSequence text) {
		mTitle.setText(text);
	}

	@Override
	public void setIcon(int drawableResId) {
		mIcon.setImageResource(drawableResId);
	}

	@Override
	public void setIcon(Drawable icon) {
		mIcon.setImageDrawable(icon);
	}
}

@@ -100,16 +100,55 @@
 ntext;%0D%0A
+import android.content.res.Resources;%0D%0A
 import a
@@ -402,16 +402,44 @@
 %0D%0A%09 */%0D%0A
+%09private Context mContext;%0D%0A
 %09private
@@ -552,16 +552,43 @@
 ntext);%0D
+%0A%09%09%0D%0A%09%09mContext = context;%0D
 %0A%0D%0A%09%09fin
@@ -1708,12 +1708,329 @@
 n);%0D%0A%09%7D%0D
+%0A%0D%0A%09@Override%0D%0A%09public void setProgressStyle(int style) %7B%0D%0A%09%09super.setProgressStyle(style);%0D%0A%09%09%0D%0A%09%09switch (style) %7B%0D%0A%09%09case ProgressDialog.STYLE_HORIZONTAL:%0D%0A%09%09%09final Resources res = mContext.getResources();%0D%0A%09%09%09%0D%0A%09%09%09setProgressDrawable(res.getDrawable(R.drawable.progress_horizontal_holo_dark));%0D%0A%09%09%09break;%0D%0A%09%09%7D%0D%0A%09%7D%0D
 %0A%7D%0D%0A

Set progressbar drawable in progress dialog.