This commit is contained in:
parent
834d96c837
commit
cf6d6a6638
3 changed files with 35 additions and 20 deletions
|
@ -327,12 +327,10 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(MenuItem item) {
|
||||
// Handle navigation view item clicks here.
|
||||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.nav_new) {
|
||||
OnFileNew();
|
||||
} else if (id == R.id.nav_open) {
|
||||
|
@ -390,7 +388,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
}
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
|
@ -546,19 +544,25 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||
ensureDocumentSaved(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final String[] kmlScriptTitles = new String[kmlScripts.size()];
|
||||
final int lastIndex = kmlScripts.size();
|
||||
final String[] kmlScriptTitles = new String[lastIndex + 1];
|
||||
for (int i = 0; i < kmlScripts.size(); i++)
|
||||
kmlScriptTitles[i] = kmlScripts.get(i).title;
|
||||
kmlScriptTitles[lastIndex] = getResources().getString(R.string.load_custom_kml);
|
||||
new AlertDialog.Builder(MainActivity.this)
|
||||
.setTitle("Pick a calculator")
|
||||
.setTitle(getResources().getString(R.string.pick_calculator))
|
||||
.setItems(kmlScriptTitles, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String kmlScriptFilename = kmlScripts.get(which).filename;
|
||||
NativeLib.onFileNew(kmlScriptFilename);
|
||||
displayFilename("");
|
||||
showKMLLog();
|
||||
updateNavigationDrawerItems();
|
||||
if(which == lastIndex) {
|
||||
|
||||
} else {
|
||||
String kmlScriptFilename = kmlScripts.get(which).filename;
|
||||
NativeLib.onFileNew(kmlScriptFilename);
|
||||
displayFilename("");
|
||||
showKMLLog();
|
||||
updateNavigationDrawerItems();
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
|
|
@ -124,39 +124,39 @@ info *action
|
|||
<item
|
||||
android:id="@+id/nav_reset_calculator"
|
||||
android:icon="@drawable/ic_refresh_black_24dp"
|
||||
android:title="Reset Calculator" />
|
||||
android:title="@string/nav_reset_calculator" />
|
||||
<item
|
||||
android:id="@+id/nav_backup_save"
|
||||
android:icon="@drawable/ic_playlist_add_black_24dp"
|
||||
android:title="Save Backup" />
|
||||
android:title="@string/nav_save_backup" />
|
||||
<item
|
||||
android:id="@+id/nav_backup_restore"
|
||||
android:icon="@drawable/ic_playlist_play_black_24dp"
|
||||
android:title="Restore Backup" />
|
||||
android:title="@string/nav_restore_backup" />
|
||||
<item
|
||||
android:id="@+id/nav_backup_delete"
|
||||
android:icon="@drawable/ic_remove_black_24dp"
|
||||
android:title="Delete Backup" />
|
||||
android:title="@string/nav_delete_backup" />
|
||||
</menu>
|
||||
</item>
|
||||
<item android:title="View">
|
||||
<item android:title="@string/nav_view">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/nav_change_kml_script"
|
||||
android:icon="@drawable/ic_wallpaper_black_24dp"
|
||||
android:title="Change KML Script..." />
|
||||
android:title="@string/nav_change_kml_script" />
|
||||
</menu>
|
||||
</item>
|
||||
<item android:title="Help">
|
||||
<item android:title="@string/nav_help">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/nav_help"
|
||||
android:icon="@drawable/ic_help_black_24dp"
|
||||
android:title="Help" />
|
||||
android:title="@string/nav_item_help" />
|
||||
<item
|
||||
android:id="@+id/nav_about"
|
||||
android:icon="@drawable/ic_info_black_24dp"
|
||||
android:title="About Emu48..." />
|
||||
android:title="@string/nav_about" />
|
||||
</menu>
|
||||
</item>
|
||||
</menu>
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
<!-- PaintByNumber Activity -->
|
||||
|
||||
<string name="app_name">Emu48 for Android</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="nav_header_title">Emu48 for Android</string>
|
||||
<string name="nav_header_subtitle">android.studio@android.com</string>
|
||||
<string name="nav_header_desc">Navigation header</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="nav_new">New...</string>
|
||||
<string name="nav_open">Open...</string>
|
||||
<string name="nav_save">Save</string>
|
||||
|
@ -34,6 +34,17 @@
|
|||
<string name="nav_recents">Recent</string>
|
||||
<string name="nav_edit">Edit</string>
|
||||
<string name="nav_paste_stack">Paste Stack</string>
|
||||
<string name="nav_reset_calculator">Reset Calculator</string>
|
||||
<string name="nav_save_backup">Save Backup</string>
|
||||
<string name="nav_restore_backup">Restore Backup</string>
|
||||
<string name="nav_delete_backup">Delete Backup</string>
|
||||
<string name="nav_view">View</string>
|
||||
<string name="nav_change_kml_script">Change KML Script...</string>
|
||||
<string name="nav_help">Help</string>
|
||||
<string name="nav_item_help">Help</string>
|
||||
<string name="nav_about">About Emu48...</string>
|
||||
<string name="load_custom_kml">Custom KML script...</string>
|
||||
<string name="pick_calculator">Pick a calculator</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue