android: MainActivity: Fix crash when game directory button is not present.
This commit is contained in:
parent
04152c3a1f
commit
cf8da5978d
@ -186,7 +186,9 @@ public final class MainActivity extends AppCompatActivity implements MainView {
|
|||||||
.commit();
|
.commit();
|
||||||
|
|
||||||
// Immediately prompt user to select a game directory on first boot
|
// Immediately prompt user to select a game directory on first boot
|
||||||
findViewById(R.id.button_add_directory).callOnClick();
|
if (mPresenter != null) {
|
||||||
|
mPresenter.launchFileListActivity();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, R.string.write_permission_needed, Toast.LENGTH_SHORT)
|
Toast.makeText(this, R.string.write_permission_needed, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
|
@ -27,6 +27,12 @@ public final class MainPresenter {
|
|||||||
refeshGameList();
|
refeshGameList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void launchFileListActivity() {
|
||||||
|
if (mView != null) {
|
||||||
|
mView.launchFileListActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean handleOptionSelection(int itemId) {
|
public boolean handleOptionSelection(int itemId) {
|
||||||
// Double-click prevention, using threshold of 500 ms
|
// Double-click prevention, using threshold of 500 ms
|
||||||
if (SystemClock.elapsedRealtime() - mLastClickTime < 500) {
|
if (SystemClock.elapsedRealtime() - mLastClickTime < 500) {
|
||||||
@ -40,7 +46,7 @@ public final class MainPresenter {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.button_add_directory:
|
case R.id.button_add_directory:
|
||||||
mView.launchFileListActivity();
|
launchFileListActivity();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.button_premium:
|
case R.id.button_premium:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user