Open muratti32 opened 6 years ago
@muratti32 Can you show me how did setup DialogPlus? There is a way to access the children views.
The setup of DialogPlus is in a class named utils with the name of showprogress
` public static void showProgress(final Context context){ ProgressAdapter adapter = new ProgressAdapter (context); DialogPlus dialogPlus = DialogPlus.newDialog(context) .setGravity(Gravity.CENTER) .setAdapter(adapter) .setCancelable(false) .setFooter(R.layout.footer_degeri_ogren) .setOnClickListener(new OnClickListener() { @Override public void onClick(DialogPlus dialog, View view) {
switch (view.getId()){
case R.id.footer_evet :
dialog.dismiss();
break;
case R.id.footer_hayir :
dialog.dismiss();
break;
}
}
})
.create();
dialogPlus.show();
}
`
And my adapter
public class ProgressAdapter extends BaseAdapter {
private LayoutInflater layoutInflater;
private ProgressBar progressBar;
public ProgressAdapter(Context context) {
layoutInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return 1;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
ViewHolder viewHolder;
if (view == null) {
view = layoutInflater.inflate(R.layout.veri_cek_progress, parent, false);
}
viewHolder = new ViewHolder();
viewHolder.progressBar = view.findViewById(R.id.number_progress_bar);
progressBar = viewHolder.progressBar;
return view;
}
public void setProgressBarValue(int value){
progressBar.setProgress(value);
}
static class ViewHolder {
public ProgressBar progressBar;
}
}`
I call the showProgress method from the onPreExecute method in the AsyncTask class named getFromCars
` public class getFromCars extends AsyncTask<Void, Void, Bundle> {
String baslik,mesaj,marka,url;
Context context;
SpinnerDialog spinner;
ProgressAdapter dialogPlus;
public getFromCars( String baslik, String mesaj,String url,Context context){
this.baslik = baslik;
this.mesaj = mesaj;
this.url = deAccent( url).toLowerCase();
this.context = context;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
Utils.showProgress(context);
}
@Override
protected Bundle doInBackground(Void... params) {
StringBuilder builder = new StringBuilder();
ArrayList<Float> fiyatlar1 = new ArrayList<>();
Bundle bundle = new Bundle();
try {
//kayıt sayısı almak için
if(kayitSayisi<50){
bundle = tekSayfaliVeriCek(links);
}else{
bundle = cokSayfaliVeriCek(kayitSayisi,url);
}
} catch (Exception e) {
Log.d(TAG, "getFromCars hata: "+e.getMessage());
}
return bundle;
}`
I need to edit progressbar view in DailogPlus from doInBackground and onPostExecute methods. how can I do that
First of all thank you for such a wonderful tool. How do I change the progressbar value on Dialogplus. thanks in advance