我有以下对话进度。此对话框进度正在根据需要注入到活动/片段中。当我在 Activity 中显示它时,它工作得很好。但是,当我尝试在活动的片段中显示它时,它会显示在对话框下方。
修复此类以正确显示进度对话框的任何方法,without having to manually pass the context to this class?
进度对话框类
public class ProgressBuilder implements IProgressBuilder {
private ProgressDialog progressDialog;
@Inject
public ProgressBuilder(Provider<Context> contextProvider) {
this.progressDialog = new ProgressDialog(contextProvider.get());
}
public void show() {
this.show("Loading...", null);
}
public void show(String message) {
this.show(null, message);
}
public void show(String title, String message) {
this.progressDialog.setTitle(title);
this.progressDialog.setMessage(message);
this.progressDialog.show();
}
public void dismiss() {
this.progressDialog.dismiss();
}
}
活动课
public class MyActivity extends RoboFragmentActivity {
@Inject IProgressBuilder progress
}
这个片段显示在 MainActivity
public class MyActivity extends RoboDialogFragment {
@Inject IProgressBuilder progress
}