Fix su open e close del dialog progress
This commit is contained in:
parent
6071b3eb44
commit
0a6d01628f
@ -21,6 +21,8 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
@Inject
|
@Inject
|
||||||
public DialogProgressView mCurrentProgress;
|
public DialogProgressView mCurrentProgress;
|
||||||
|
|
||||||
|
private boolean progressOpened;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attrs) {
|
public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attrs) {
|
||||||
@ -56,22 +58,24 @@ public class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
runOnUiThread(() -> {
|
|
||||||
BarcodeManager.disable();
|
BarcodeManager.disable();
|
||||||
if (!this.mCurrentProgress.isVisible() && !this.mCurrentProgress.isAdded()) {
|
if (!progressOpened) {
|
||||||
|
this.progressOpened = true;
|
||||||
|
runOnUiThread(() -> {
|
||||||
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
this.mCurrentProgress.show(getSupportFragmentManager(), "tag");
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
runOnUiThread(() -> {
|
|
||||||
BarcodeManager.enable();
|
BarcodeManager.enable();
|
||||||
if (mCurrentProgress.isVisible()) {
|
if (progressOpened) {
|
||||||
|
this.progressOpened = false;
|
||||||
|
runOnUiThread(() -> {
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onLoadingStarted() {
|
public void onLoadingStarted() {
|
||||||
|
|||||||
@ -29,6 +29,7 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
protected ElevatedToolbar mToolbar;
|
protected ElevatedToolbar mToolbar;
|
||||||
|
|
||||||
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
protected final List<Runnable> mOnPreDestroyList = new ArrayList<>();
|
||||||
|
private boolean progressOpened;
|
||||||
|
|
||||||
|
|
||||||
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
public void setScrollToolbar(ElevatedToolbar toolbar) {
|
||||||
@ -81,20 +82,22 @@ public abstract class BaseFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void openProgress() {
|
protected void openProgress() {
|
||||||
|
if (!progressOpened) {
|
||||||
|
this.progressOpened = true;
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
if (!this.mCurrentProgress.isVisible() && !this.mCurrentProgress.isAdded()) {
|
|
||||||
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
this.mCurrentProgress.show(requireActivity().getSupportFragmentManager(), "tag");
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void closeProgress() {
|
protected void closeProgress() {
|
||||||
|
if (progressOpened) {
|
||||||
|
this.progressOpened = false;
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
if (mCurrentProgress.isVisible()) {
|
|
||||||
mCurrentProgress.dismiss();
|
mCurrentProgress.dismiss();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void popMe() {
|
protected void popMe() {
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user