Search in sources :

Example 1 with ExecutableString

use of ee.ioc.phon.android.speak.ExecutableString in project K6nele by Kaljurand.

the class RewritesActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case android.R.id.home:
            Intent upIntent = NavUtils.getParentActivityIntent(this);
            if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
                // This activity is NOT part of this app's task, so create a new task
                // when navigating up, with a synthesized back stack.
                TaskStackBuilder.create(this).addNextIntentWithParentStack(upIntent).startActivities();
            } else {
                // This activity is part of this app's task, so simply
                // navigate up to the logical parent activity.
                NavUtils.navigateUpTo(this, upIntent);
            }
            return true;
        case R.id.menuRewritesShare:
            startActivity(Intent.createChooser(mRewrites.getSendIntent(), getResources().getText(R.string.labelRewritesShare)));
            return true;
        case R.id.menuRewritesTest:
            startActivity(mRewrites.getK6neleIntent());
            return true;
        case R.id.menuRewritesRename:
            Utils.getTextEntryDialog(this, getString(R.string.confirmRename), mRewrites.getId(), new ExecutableString() {

                public void execute(String newName) {
                    if (!newName.isEmpty()) {
                        mRewrites.rename(newName);
                        setRewrites(newName, null);
                    }
                }
            }).show();
            return true;
        case R.id.menuRewritesDelete:
            Utils.getYesNoDialog(this, String.format(getString(R.string.confirmDelete), mRewrites.getId()), new Executable() {

                public void execute() {
                    mRewrites.delete();
                    toast(String.format(getString(R.string.toastDeleted), mRewrites.getId()));
                    finish();
                }
            }).show();
            return true;
        default:
            return super.onContextItemSelected(item);
    }
}
Also used : ExecutableString(ee.ioc.phon.android.speak.ExecutableString) Intent(android.content.Intent) ExecutableString(ee.ioc.phon.android.speak.ExecutableString) Executable(ee.ioc.phon.android.speak.Executable)

Aggregations

Intent (android.content.Intent)1 Executable (ee.ioc.phon.android.speak.Executable)1 ExecutableString (ee.ioc.phon.android.speak.ExecutableString)1