mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
* Replace showInfoAlert with available DialogUtil method * Remove test case that is no longer relevant
This commit is contained in:
parent
1a8a068552
commit
f56ee50c60
2 changed files with 7 additions and 35 deletions
|
|
@ -225,9 +225,13 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
|
|||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.filter(result -> result)
|
||||
.subscribe(result -> showInfoAlert(R.string.block_notification_title,
|
||||
R.string.block_notification, UploadActivity.this::finish)
|
||||
));
|
||||
.subscribe(result -> DialogUtil.showAlertDialog(
|
||||
this,
|
||||
getString(R.string.block_notification_title),
|
||||
getString(R.string.block_notification),
|
||||
getString(R.string.ok),
|
||||
this::finish,
|
||||
true)));
|
||||
}
|
||||
|
||||
private void checkStoragePermissions() {
|
||||
|
|
@ -457,18 +461,6 @@ public class UploadActivity extends BaseActivity implements UploadContract.View,
|
|||
finish();
|
||||
}
|
||||
|
||||
private void showInfoAlert(int titleStringID, int messageStringId, Runnable positive, String... formatArgs) {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(titleStringID)
|
||||
.setMessage(getString(messageStringId, (Object[]) formatArgs))
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, id) -> {
|
||||
positive.run();
|
||||
dialog.cancel();
|
||||
})
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAlertDialog(int messageResourceId, Runnable onPositiveClick) {
|
||||
|
|
|
|||
|
|
@ -233,26 +233,6 @@ class UploadActivityUnitTests {
|
|||
method.invoke(activity)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testShowInfoAlert() {
|
||||
val method: Method = UploadActivity::class.java.getDeclaredMethod(
|
||||
"showInfoAlert",
|
||||
Int::class.java,
|
||||
Int::class.java,
|
||||
Runnable::class.java,
|
||||
Array<String>::class.java
|
||||
)
|
||||
method.isAccessible = true
|
||||
method.invoke(
|
||||
activity,
|
||||
R.string.block_notification_title,
|
||||
R.string.block_notification,
|
||||
mock(Runnable::class.java),
|
||||
arrayOf("")
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testOnNextButtonClicked() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue