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