Example usage for android.app ActionBar setIcon

List of usage examples for android.app ActionBar setIcon

Introduction

In this page you can find the example usage for android.app ActionBar setIcon.

Prototype

public abstract void setIcon(Drawable icon);

Source Link

Document

Set the icon to display in the 'home' section of the action bar.

Usage

From source file:com.yattatech.dbtc.activity.MainScreen.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_main_screen);
    final int color = getResources().getColor(R.color.grey2);
    final ActionBar actionBar = getActionBar();
    mFilter = new IntentFilter();
    mLocaleChangedFilter = new IntentFilter();
    mTaskList = (DragSortListView) findViewById(R.id.taskList);
    mTaskListAdapter = new TaskListAdapter(this);
    final String appKey = getString(R.string.dropbox_key);
    final String appSecret = getString(R.string.dropbox_secret);
    final AppKeyPair pair = new AppKeyPair(appKey, appSecret);
    final AndroidAuthSession session = new AndroidAuthSession(pair);
    mDropboxAPI = new DropboxAPI<AndroidAuthSession>(session);
    mToken = FACADE.getDropBoxToken();//from w  ww  .  java 2s. c  om
    mTaskList.setAdapter(mTaskListAdapter);
    mTaskList.setOnItemClickListener(mTaskListListener);
    mTaskList.setDropListener(mDropListener);
    mTaskList.setDragScrollProfile(mScrollProfile);
    mTaskList.setFloatViewManager(new MainViewManager(mTaskList));
    mFilter.addAction(ADD_NEW_TASK_ACTION);
    mFilter.addAction(EDIT_TASK_ACTION);
    mFilter.addAction(REMOVE_TASK_ACTION);
    mFilter.addAction(BACKUP_RESTORE_ACTION);
    mLocaleChangedFilter.addAction(Intent.ACTION_LOCALE_CHANGED);
    actionBar.setIcon(R.drawable.ic_task);
    actionBar.setTitle(R.string.app_name);
    actionBar.setBackgroundDrawable(new ColorDrawable(color));
    Broadcaster.registerLocalReceiver(mReceiver, mFilter);
    registerReceiver(mLocaleChangedReceiver, mLocaleChangedFilter);
    registerForContextMenu(mTaskList);
    final List<Task> tasks = FACADE.getTasks();
    mTaskListAdapter.setElements(FACADE.restoreDataOrder(tasks));
}

From source file:dev.dworks.apps.anexplorer.DocumentsActivity.java

public void updateActionBar() {
    final ActionBar actionBar = getActionBar();

    actionBar.setDisplayShowHomeEnabled(true);

    final boolean showIndicator = !mShowAsDialog && (mState.action != ACTION_MANAGE);
    actionBar.setDisplayHomeAsUpEnabled(showIndicator);
    if (mDrawerToggle != null) {
        mDrawerToggle.setDrawerIndicatorEnabled(showIndicator);
    }//  w w w  .  ja v  a  2s .co m

    if (isRootsDrawerOpen()) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setIcon(new ColorDrawable());

        if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT
                || mState.action == ACTION_BROWSE) {
            actionBar.setTitle(R.string.app_name);
            actionBar.setIcon(R.drawable.ic_launcher);
        } else if (mState.action == ACTION_CREATE) {
            actionBar.setTitle(R.string.title_save);
        }
    } else {
        final RootInfo root = getCurrentRoot();
        //actionBar.setIcon(root != null ? root.loadIcon(this) : null);

        if (mState.stack.size() <= 1) {
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            actionBar.setTitle(root.title);
        } else {
            mIgnoreNextNavigation = true;
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
            actionBar.setTitle(null);
            actionBar.setListNavigationCallbacks(mStackAdapter, mStackListener);
            actionBar.setSelectedNavigationItem(mStackAdapter.getCount() - 1);
        }
    }
}

From source file:com.bernard.beaconportal.activities.activity.MessageList.java

@SuppressLint("ResourceAsColor")
@Override/*www  . j ava2s  .  c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_PROGRESS);

    if (!K9.isHideSpecialAccounts()) {
        createSpecialAccounts();
    }

    Account[] accounts = Preferences.getPreferences(this).getAccounts();
    Intent intent = getIntent();
    // onNewIntent(intent);

    // see if we should show the welcome message
    if (ACTION_IMPORT_SETTINGS.equals(intent.getAction())) {
        mAccounts.onImport();
    } else if (accounts.length < 1) {
        WelcomeMessage.showWelcomeMessage(this);
        finish();
        return;
    }

    if (UpgradeDatabases.actionUpgradeDatabases(this, intent)) {
        finish();
        return;
    }

    Log.d(TAG, "onCreate()");

    String packageName = "com.bernard.beaconportal.activities";

    counterss = "0";

    int versionNumber = 0;

    try {
        PackageInfo pi = getApplicationContext().getPackageManager().getPackageInfo(packageName,
                PackageManager.GET_META_DATA);
        versionNumber = pi.versionCode;
        String versionName = pi.versionName;

        Log.d(TAG, "K-9 is installed - " + versionNumber + " " + versionName);

    } catch (NameNotFoundException e) {
        Log.d(TAG, "K-9 not found");
    }

    if (versionNumber <= 1) {
        // Register a listener for broadcasts (needed for the older versions
        // of k9)
        Log.d(TAG, "Initialising BroadcastReceiver for old K-9 version");
        receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                Log.d(TAG, "receiver.onReceive()");
                doRefresh();
            }
        };

        filter = new IntentFilter();
        filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_RECEIVED");
        filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_DELETED");
        filter.addDataScheme("email");
        registerReceiver(receiver, filter);
    } else {
        // Register our own content observer, rather than using
        // addWatchContentUris()
        // since DashClock might not have permission to access the database
        Log.d(TAG, "Initialising ContentObserver for new K-9 version");
        contentObserver = new ContentObserver(null) {
            @Override
            public void onChange(boolean selfChange) {
                Log.d(TAG, "contentResolver.onChange()");
                doRefresh();
            }
        };
        getContentResolver().registerContentObserver(Uri.parse(k9UnreadUri), true, contentObserver);
    }

    doRefresh();

    if (UpgradeDatabases.actionUpgradeDatabases(this, getIntent())) {
        finish();
        return;
    }

    if (useSplitView()) {
        setContentView(R.layout.split_drawer_main);
    } else {
        setContentView(R.layout.drawermain1);
        mViewSwitcher = (ViewSwitcher) findViewById(R.id.container);
        mViewSwitcher.setFirstInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_left));
        mViewSwitcher.setFirstOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_right));
        mViewSwitcher.setSecondInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_right));
        mViewSwitcher.setSecondOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_left));
        mViewSwitcher.setOnSwitchCompleteListener(this);
    }

    mergeadapter = new MergeAdapter();

    LayoutInflater inflater = getLayoutInflater();

    accounts_view = inflater.inflate(R.layout.accounts_list, null);

    portals_view = inflater.inflate(R.layout.portal_list, null);

    folders_view = inflater.inflate(R.layout.folders_list, null);

    header_folders = inflater.inflate(R.layout.header_folders, null);

    header_drawer = inflater.inflate(R.layout.header_drawer, null);

    initializeActionBar();

    mListView = (ListView) findViewById(android.R.id.list);
    // mListView.addHeaderView(header_folders, null, false);

    mListView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    mListView.setLongClickable(true);
    mListView.setFastScrollEnabled(true);
    mListView.setScrollingCacheEnabled(false);
    // mListView.setOnItemClickListener(new OnItemClickListener() {
    // public void onItemClick(AdapterView<?> parent, View view,
    // int position, long id) {
    //
    // onOpenFolder(((FolderInfoHolder) mAdapter.getItem(position)).name);
    //
    // Log.d("Folder Click Listener", "clicked");
    //
    // }
    // });

    setResult(RESULT_CANCELED);

    // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox);
    //
    // View header_inbox = (View) inflater
    // .inflate(R.layout.header_inbox, null);
    //
    // mDrawerList_Inbox.setOnItemClickListener(this);
    //
    // mDrawerList_Inbox.setItemsCanFocus(false);
    //
    // mDrawerList_Inbox.setLongClickable(true);

    mListView.setSaveEnabled(true);

    mInflater = getLayoutInflater();

    onNewIntent(getIntent());

    context = this;

    SharedPreferences sharedpre = getSharedPreferences("show_view", Context.MODE_PRIVATE);

    Show_View = sharedpre.getString("show_view", "");

    SharedPreferences Today_Homework = getApplicationContext().getSharedPreferences("due_today",
            Context.MODE_PRIVATE);

    SharedPreferences counts = getSharedPreferences("due_today", Context.MODE_PRIVATE);

    if (counts.contains("homeworkdue")) {
        counterss = counts.getString("homeworkdue", null);
    } else {

        counterss = null;
    }

    title_Inbox = new String[] { "Inbox" };

    icon_Inbox = new int[] { R.drawable.ic_action_email };

    count_Inbox = new String[] { K9counts };

    if (Show_View.equals("Homework Due")) {

        title = new String[] { "Homework Due", "Schedule", "Resources", "Options", "Logout" };

        icon = new int[] { R.drawable.ic_action_duehomework, R.drawable.ic_action_go_to_today,
                R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout };

        if (counterss == null && counterss.isEmpty()) {

            count = new String[] { "", "", "", "", "" };

        } else {

            count = new String[] { counterss, "", "", "", "" };

        }

    } else {

        if (counterss == null && counterss.isEmpty()) {

            count = new String[] { "", "", "", "", "" };

        } else {

            count = new String[] { "", counterss, "", "", "" };

        }

        title = new String[] { "Schedule", "Homework Due", "Resources", "Options", "Logout" };

        icon = new int[] { R.drawable.ic_action_go_to_today, R.drawable.ic_action_duehomework,
                R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout };

    }

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    mDrawerLinear = (LinearLayout) findViewById(R.id.left_drawer);

    // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox);

    // mDrawerList = (ListView) findViewById(R.id.listview_drawer);

    // mDrawer_Scroll = (ScrollView)
    // findViewById(R.id.left_drawer_scrollview);

    // mDrawerList.addHeaderView(header_drawer, null, false);

    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    // mMenuAdapter_Inbox = new MenuListAdapter(MessageList.this,
    // title_Inbox,
    // icon_Inbox, count_Inbox);

    // mDrawerList_Inbox.setAdapter(mMenuAdapter_Inbox);

    // mDrawerList_Inbox
    // .setOnItemClickListener(new DrawerItemClickListener_Inbox());

    mMenuAdapter = new MenuListAdapter(MessageList.this, title, icon, count);

    // mDrawerList.setAdapter(mMenuAdapter);

    // mergeadapter.addView(header_drawer);
    //
    // mergeadapter.addAdapter(mMenuAdapter);
    //
    // mergeadapter.addadapter(AccountsAdapter);
    //
    // mDrawerList.setAdapter(mergeadapter);

    getListView().setOnItemClickListener(new DrawerItemClickListener());

    // mDrawerList_Inbox.setOnItemClickListener(new
    // DrawerItemClickListener());

    //
    // if (savedInstanceState == null) {
    // selectItem_Inbox(1);
    // }

    SharedPreferences sharedpref = getSharedPreferences("actionbar_color", Context.MODE_PRIVATE);

    final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android");
    final View splitActionBar = findViewById(splitBarId);

    if (!sharedpref.contains("actionbar_color")) {

        getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4")));

        if (splitActionBar != null) {

            splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4")));

        }

    } else {

        actionbar_colors = sharedpref.getString("actionbar_color", null);

        getActionBar().setBackgroundDrawable(

                new ColorDrawable(Color.parseColor(actionbar_colors)));

        if (splitActionBar != null) {

            splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionbar_colors)));

        }

    }

    android.app.ActionBar bar = getActionBar();

    bar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
    // Enable gesture detection for MessageLists
    // setupGestureDetector(this);

    if (!decodeExtras(getIntent())) {
        return;
    }

    findFragments();
    initializeDisplayMode(savedInstanceState);
    initializeLayout();
    initializeFragments();
    displayViews();
    // registerForContextMenu(mDrawerList_Inbox);
    registerForContextMenu(mListView);

    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open,
            R.string.drawer_close) {

        @Override
        public void onDrawerClosed(View view) {
            // TODO Auto-generated method stub
            super.onDrawerClosed(view);
        }

        @Override
        public void onDrawerOpened(View drawerView) {
            // TODO Auto-generated method stub

            super.onDrawerOpened(drawerView);
        }
    };

    mDrawerLayout.setDrawerListener(mDrawerToggle);

}

From source file:com.polychrom.cordova.ActionBarPlugin.java

@Override
public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext)
        throws JSONException {
    if (!plugin_actions.contains(action)) {
        return false;
    }//from   w ww .j a va 2  s  .  co  m

    final Activity ctx = (Activity) cordova;

    if ("isAvailable".equals(action)) {
        JSONObject result = new JSONObject();
        result.put("value", ctx.getWindow().hasFeature(Window.FEATURE_ACTION_BAR));
        callbackContext.success(result);
        return true;
    }

    final ActionBar bar = ctx.getActionBar();
    if (bar == null) {
        Window window = ctx.getWindow();
        if (!window.hasFeature(Window.FEATURE_ACTION_BAR)) {
            callbackContext
                    .error("ActionBar feature not available, Window.FEATURE_ACTION_BAR must be enabled!");
        } else {
            callbackContext.error("Failed to get ActionBar");
        }

        return true;
    }

    if (menu == null) {
        callbackContext.error("Options menu not initialised");
        return true;
    }

    final StringBuffer error = new StringBuffer();
    JSONObject result = new JSONObject();

    if ("isShowing".equals(action)) {
        result.put("value", bar.isShowing());
    } else if ("getHeight".equals(action)) {
        result.put("value", bar.getHeight());
    } else if ("getDisplayOptions".equals(action)) {
        result.put("value", bar.getDisplayOptions());
    } else if ("getNavigationMode".equals(action)) {
        result.put("value", bar.getNavigationMode());
    } else if ("getSelectedNavigationItem".equals(action)) {
        result.put("value", bar.getSelectedNavigationIndex());
    } else if ("getSubtitle".equals(action)) {
        result.put("value", bar.getSubtitle());
    } else if ("getTitle".equals(action)) {
        result.put("value", bar.getTitle());
    } else {
        try {
            JSONException exception = new Runnable() {
                public JSONException exception = null;

                public void run() {
                    try {
                        // This is a bit of a hack (should be specific to the request, not global)
                        bases = new String[] { removeFilename(webView.getOriginalUrl()),
                                removeFilename(webView.getUrl()) };

                        if ("show".equals(action)) {
                            bar.show();
                        } else if ("hide".equals(action)) {
                            bar.hide();
                        } else if ("setMenu".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("menu can not be null");
                                return;
                            }

                            menu_definition = args.getJSONArray(0);

                            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                                ctx.invalidateOptionsMenu();
                            }
                        } else if ("setTabs".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("menu can not be null");
                                return;
                            }

                            bar.removeAllTabs();
                            tab_callbacks.clear();

                            if (!buildTabs(bar, args.getJSONArray(0))) {
                                error.append("Invalid tab bar definition");
                            }
                        } else if ("setDisplayHomeAsUpEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("showHomeAsUp can not be null");
                                return;
                            }

                            bar.setDisplayHomeAsUpEnabled(args.getBoolean(0));
                        } else if ("setDisplayOptions".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("options can not be null");
                                return;
                            }

                            final int options = args.getInt(0);
                            bar.setDisplayOptions(options);
                        } else if ("setDisplayShowHomeEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("showHome can not be null");
                                return;
                            }

                            bar.setDisplayShowHomeEnabled(args.getBoolean(0));
                        } else if ("setDisplayShowTitleEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("showTitle can not be null");
                                return;
                            }

                            bar.setDisplayShowTitleEnabled(args.getBoolean(0));
                        } else if ("setDisplayUseLogoEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("useLogo can not be null");
                                return;
                            }

                            bar.setDisplayUseLogoEnabled(args.getBoolean(0));
                        } else if ("setHomeButtonEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("enabled can not be null");
                                return;
                            }

                            bar.setHomeButtonEnabled(args.getBoolean(0));
                        } else if ("setIcon".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("icon can not be null");
                                return;
                            }

                            Drawable drawable = getDrawableForURI(args.getString(0));
                            bar.setIcon(drawable);
                        } else if ("setListNavigation".equals(action)) {
                            JSONArray items = null;
                            if (args.isNull(0) == false) {
                                items = args.getJSONArray(0);
                            }

                            navigation_adapter.setItems(items);
                            bar.setListNavigationCallbacks(navigation_adapter, navigation_listener);
                        } else if ("setLogo".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("logo can not be null");
                                return;
                            }

                            Drawable drawable = getDrawableForURI(args.getString(0));
                            bar.setLogo(drawable);
                        } else if ("setNavigationMode".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("mode can not be null");
                                return;
                            }

                            final int mode = args.getInt(0);
                            bar.setNavigationMode(mode);
                        } else if ("setSelectedNavigationItem".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("position can not be null");
                                return;
                            }

                            bar.setSelectedNavigationItem(args.getInt(0));
                        } else if ("setSubtitle".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("subtitle can not be null");
                                return;
                            }

                            bar.setSubtitle(args.getString(0));
                        } else if ("setTitle".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("title can not be null");
                                return;
                            }

                            bar.setTitle(args.getString(0));
                        }
                    } catch (JSONException e) {
                        exception = e;
                    } finally {
                        synchronized (this) {
                            this.notify();
                        }
                    }
                }

                // Run task synchronously
                {
                    synchronized (this) {
                        ctx.runOnUiThread(this);
                        this.wait();
                    }
                }
            }.exception;

            if (exception != null) {
                throw exception;
            }
        } catch (InterruptedException e) {
            error.append("Function interrupted on UI thread");
        }
    }

    if (error.length() == 0) {
        if (result.length() > 0) {
            callbackContext.success(result);
        } else {
            callbackContext.success();
        }
    } else {
        callbackContext.error(error.toString());
    }

    return true;
}

From source file:com.native5.plugins.ActionBarPlugin.java

@Override
public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext)
        throws JSONException {
    if (!plugin_actions.contains(action)) {
        return false;
    }//from   www . ja  v a2 s. c o  m

    final Activity ctx = (Activity) cordova;

    if ("isAvailable".equals(action)) {
        JSONObject result = new JSONObject();
        result.put("value", ctx.getWindow().hasFeature(Window.FEATURE_ACTION_BAR));
        callbackContext.success(result);
        return true;
    }

    final ActionBar bar = ctx.getActionBar();
    if (bar == null) {
        Window window = ctx.getWindow();
        if (!window.hasFeature(Window.FEATURE_ACTION_BAR)) {
            callbackContext
                    .error("ActionBar feature not available, Window.FEATURE_ACTION_BAR must be enabled!");
        } else {
            callbackContext.error("Failed to get ActionBar");
        }

        return true;
    }

    if (menu == null) {
        callbackContext.error("Options menu not initialised");
        return true;
    }

    final StringBuffer error = new StringBuffer();
    JSONObject result = new JSONObject();

    if ("isShowing".equals(action)) {
        result.put("value", bar.isShowing());
    } else if ("getHeight".equals(action)) {
        result.put("value", bar.getHeight());
    } else if ("getDisplayOptions".equals(action)) {
        result.put("value", bar.getDisplayOptions());
    } else if ("getNavigationMode".equals(action)) {
        result.put("value", bar.getNavigationMode());
    } else if ("getSelectedNavigationItem".equals(action)) {
        result.put("value", bar.getSelectedNavigationIndex());
    } else if ("getSubtitle".equals(action)) {
        result.put("value", bar.getSubtitle());
    } else if ("getTitle".equals(action)) {
        result.put("value", bar.getTitle());
    } else {
        try {
            JSONException exception = new Runnable() {
                public JSONException exception = null;

                public void run() {
                    try {
                        // This is a bit of a hack (should be specific to the request, not global)
                        bases = new String[] { removeFilename(webView.getOriginalUrl()),
                                removeFilename(webView.getUrl()) };

                        if ("show".equals(action)) {
                            LOG.d("native5-action-bar", "Showing Action Bar");
                            bar.show();
                        } else if ("hide".equals(action)) {
                            bar.hide();
                        } else if ("setMenu".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("menu can not be null");
                                return;
                            }

                            menu_definition = args.getJSONArray(0);

                            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                                ctx.invalidateOptionsMenu();
                            }
                        } else if ("setTabs".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("menu can not be null");
                                return;
                            }

                            bar.removeAllTabs();
                            tab_callbacks.clear();

                            if (!buildTabs(bar, args.getJSONArray(0))) {
                                error.append("Invalid tab bar definition");
                            }
                        } else if ("setDisplayHomeAsUpEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("showHomeAsUp can not be null");
                                return;
                            }

                            bar.setDisplayHomeAsUpEnabled(args.getBoolean(0));
                        } else if ("setDisplayOptions".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("options can not be null");
                                return;
                            }

                            final int options = args.getInt(0);
                            bar.setDisplayOptions(options);
                        } else if ("setDisplayShowHomeEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("showHome can not be null");
                                return;
                            }

                            bar.setDisplayShowHomeEnabled(args.getBoolean(0));
                        } else if ("setDisplayShowTitleEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("showTitle can not be null");
                                return;
                            }

                            bar.setDisplayShowTitleEnabled(args.getBoolean(0));
                        } else if ("setDisplayUseLogoEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("useLogo can not be null");
                                return;
                            }

                            bar.setDisplayUseLogoEnabled(args.getBoolean(0));
                        } else if ("setHomeButtonEnabled".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("enabled can not be null");
                                return;
                            }

                            bar.setHomeButtonEnabled(args.getBoolean(0));
                        } else if ("setIcon".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("icon can not be null");
                                return;
                            }

                            Drawable drawable = getDrawableForURI(args.getString(0));
                            bar.setIcon(drawable);
                        } else if ("setListNavigation".equals(action)) {
                            JSONArray items = null;
                            if (args.isNull(0) == false) {
                                items = args.getJSONArray(0);
                            }

                            navigation_adapter.setItems(items);
                            bar.setListNavigationCallbacks(navigation_adapter, navigation_listener);
                        } else if ("setLogo".equals(action)) {
                            String uri = args.getString(0);
                            if (args.isNull(0)) {
                                error.append("logo can not be null");
                                return;
                            }

                            //                        try {
                            //                           InputStream ims = ctx.getAssets().open(uri);
                            Drawable drawable = getDrawableForURI(uri);
                            //                                 Drawable.createFromStream(ims, null);
                            bar.setLogo(drawable);
                            bar.setBackgroundDrawable(getDrawableForURI("images/logo-bg.png"));
                            //                        } catch (IOException e) {
                            //                           e.printStackTrace();
                            //                        }
                        } else if ("setNavigationMode".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("mode can not be null");
                                return;
                            }

                            final int mode = args.getInt(0);
                            bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
                        } else if ("setSelectedNavigationItem".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("position can not be null");
                                return;
                            }
                            bar.setSelectedNavigationItem(args.getInt(0));
                        } else if ("setSelectedTab".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("position can not be null");
                                return;
                            }
                            LOG.d("setSelectedTab", bar.getTabCount() + "");
                            bar.selectTab(bar.getTabAt(args.getInt(0)));
                        } else if ("setSubtitle".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("subtitle can not be null");
                                return;
                            }

                            bar.setSubtitle(args.getString(0));
                        } else if ("setTitle".equals(action)) {
                            if (args.isNull(0)) {
                                error.append("title can not be null");
                                return;
                            }

                            bar.setTitle(args.getString(0));
                        }
                    } catch (JSONException e) {
                        exception = e;
                    } finally {
                        synchronized (this) {
                            this.notify();
                        }
                    }
                }

                // Run task synchronously
                {
                    synchronized (this) {
                        ctx.runOnUiThread(this);
                        this.wait();
                    }
                }
            }.exception;

            if (exception != null) {
                throw exception;
            }
        } catch (InterruptedException e) {
            error.append("Function interrupted on UI thread");
        }
    }

    if (error.length() == 0) {
        if (result.length() > 0) {
            callbackContext.success(result);
        } else {
            callbackContext.success();
        }
    } else {
        callbackContext.error(error.toString());
    }

    return true;
}