@@ -131,29 +131,29 @@ public boolean onCreateOptionsMenu(Menu menu) {
131
131
@ Override
132
132
public boolean onOptionsItemSelected (MenuItem item ) {
133
133
switch (item .getItemId ()) {
134
- case R .id .info_action :
135
- // Show the Play Store information dialog
136
- showInfo (false );
134
+ case R .id .info_action :
135
+ // Show the Play Store information dialog
136
+ showInfo (false );
137
+ break ;
138
+
139
+ case R .id .storage_action :
140
+ // Open the scoped storage selector in scoped mode
141
+ if (scoped ) {
142
+ startActivityForResult (new Intent (Intent .ACTION_OPEN_DOCUMENT_TREE ), 2 );
137
143
break ;
144
+ }
138
145
139
- case R .id .storage_action :
140
- // Open the scoped storage selector in scoped mode
141
- if (scoped ) {
142
- startActivityForResult (new Intent (Intent .ACTION_OPEN_DOCUMENT_TREE ), 2 );
143
- break ;
144
- }
145
-
146
- // Switch to the next storage device
147
- curStorage = (curStorage + 1 ) % storagePaths .size ();
148
- path = storagePaths .get (curStorage );
149
- curDepth = 0 ;
150
- update ();
151
- break ;
146
+ // Switch to the next storage device
147
+ curStorage = (curStorage + 1 ) % storagePaths .size ();
148
+ path = storagePaths .get (curStorage );
149
+ curDepth = 0 ;
150
+ update ();
151
+ break ;
152
152
153
- case R .id .settings_action :
154
- // Open the settings menu
155
- startActivity (new Intent (this , SettingsMenu .class ));
156
- return true ;
153
+ case R .id .settings_action :
154
+ // Open the settings menu
155
+ startActivity (new Intent (this , SettingsMenu .class ));
156
+ return true ;
157
157
}
158
158
return super .onOptionsItemSelected (item );
159
159
}
@@ -178,34 +178,34 @@ public void onBackPressed() {
178
178
@ Override
179
179
public void onActivityResult (int requestCode , int resultCode , Intent resultData ) {
180
180
switch (requestCode ) {
181
- case 1 : // Manage files permission
182
- // Fall back to scoped storage if permission wasn't granted
183
- if (checkPermissions ())
184
- initialize ();
185
- else
186
- openScoped ();
187
- return ;
188
-
189
- case 2 : // Scoped directory selection
190
- // Reload if nothing was selected
191
- if (resultData == null ) {
192
- openScoped ();
193
- return ;
194
- }
195
-
196
- // Save the returned URI with persistent permissions so it can be restored next time
197
- SharedPreferences .Editor editor = PreferenceManager .getDefaultSharedPreferences (this ).edit ();
198
- int flags = Intent .FLAG_GRANT_READ_URI_PERMISSION | Intent .FLAG_GRANT_WRITE_URI_PERMISSION ;
199
- getContentResolver ().takePersistableUriPermission (resultData .getData (), flags );
200
- editor .putString ("scoped_uri" , resultData .getData ().toString ());
201
- editor .commit ();
202
-
203
- // Initialize for scoped storage mode
204
- pathUris = new Stack <Uri >();
205
- pathUris .push (resultData .getData ());
206
- scoped = true ;
181
+ case 1 : // Manage files permission
182
+ // Fall back to scoped storage if permission wasn't granted
183
+ if (checkPermissions ())
207
184
initialize ();
185
+ else
186
+ openScoped ();
187
+ return ;
188
+
189
+ case 2 : // Scoped directory selection
190
+ // Reload if nothing was selected
191
+ if (resultData == null ) {
192
+ openScoped ();
208
193
return ;
194
+ }
195
+
196
+ // Save the returned URI with persistent permissions so it can be restored next time
197
+ SharedPreferences .Editor editor = PreferenceManager .getDefaultSharedPreferences (this ).edit ();
198
+ int flags = Intent .FLAG_GRANT_READ_URI_PERMISSION | Intent .FLAG_GRANT_WRITE_URI_PERMISSION ;
199
+ getContentResolver ().takePersistableUriPermission (resultData .getData (), flags );
200
+ editor .putString ("scoped_uri" , resultData .getData ().toString ());
201
+ editor .commit ();
202
+
203
+ // Initialize for scoped storage mode
204
+ pathUris = new Stack <Uri >();
205
+ pathUris .push (resultData .getData ());
206
+ scoped = true ;
207
+ initialize ();
208
+ return ;
209
209
}
210
210
}
211
211
@@ -357,22 +357,22 @@ private void tryStartCore() {
357
357
358
358
// Inform the user of the error if loading wasn't successful
359
359
switch (result ) {
360
- case 1 : // Missing BIOS files
361
- builder .setTitle ("Error Loading BIOS" );
362
- builder .setMessage ("Make sure the path settings point to valid BIOS files and try again. " +
363
- "You can modify path settings in " + getExternalFilesDir (null ).getPath () + "/noods.ini." );
364
- break ;
365
-
366
- case 2 : // Non-bootable firmware file
367
- builder .setTitle ("Error Loading Firmware" );
368
- builder .setMessage ("Make sure the path settings point to a bootable firmware file or try another boot method. " +
369
- "You can modify path settings in " + getExternalFilesDir (null ).getPath () + "/noods.ini." );
370
- break ;
371
-
372
- case 3 : // Unreadable ROM file
373
- builder .setTitle ("Error Loading ROM" );
374
- builder .setMessage ("Make sure the ROM file is accessible and try again." );
375
- break ;
360
+ case 1 : // Missing BIOS files
361
+ builder .setTitle ("Error Loading BIOS" );
362
+ builder .setMessage ("Make sure the path settings point to valid BIOS files and try again. " +
363
+ "You can modify path settings in " + getExternalFilesDir (null ).getPath () + "/noods.ini." );
364
+ break ;
365
+
366
+ case 2 : // Non-bootable firmware file
367
+ builder .setTitle ("Error Loading Firmware" );
368
+ builder .setMessage ("Make sure the path settings point to a bootable firmware file or try another boot method. " +
369
+ "You can modify path settings in " + getExternalFilesDir (null ).getPath () + "/noods.ini." );
370
+ break ;
371
+
372
+ case 3 : // Unreadable ROM file
373
+ builder .setTitle ("Error Loading ROM" );
374
+ builder .setMessage ("Make sure the ROM file is accessible and try again." );
375
+ break ;
376
376
}
377
377
378
378
builder .create ().show ();
0 commit comments