Example usage for android.app ActionBar NAVIGATION_MODE_LIST

List of usage examples for android.app ActionBar NAVIGATION_MODE_LIST

Introduction

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

Prototype

int NAVIGATION_MODE_LIST

To view the source code for android.app ActionBar NAVIGATION_MODE_LIST.

Click Source Link

Document

List navigation mode.

Usage

From source file:org.openmidaas.app.activities.MainTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    setContentView(R.layout.activity_main_tab);

    //Get the text
    tabProfile = getResources().getString(R.string.profileTabtext);
    tabScan = getResources().getString(R.string.scanTabtext);
    tabInputURL = getResources().getString(R.string.urlTabtext);

    //Enabling action bar
    ActionBar actionBar = getActionBar();
    actionBar.setTitle(null);//from w  w  w. j a v  a2  s  . c  o m
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.show();
    getOverflowMenu();

    mActivity = this;
    mProgressDialog = new ProgressDialog(mActivity);

    mAttributeListFragment = new AttributeListFragment();
    mUrlInputFragment = new EnterURLDialogFragment();
    mScanFragment = new ScanFragment();

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setOnTabChangedListener(listener);
    mTabHost.setup();
    mTabHost.getTabWidget().setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    //initializing tabs
    initializeTab();
    //Check for updates
    checkForUpdates();
    //See if its being called to process URL from push message. 
    //MainAcivity not being killed to be consistent with what happens when the URL taken via QR code etc.
    if ((getIntent().getExtras() != null) && !getIntent().getExtras().isEmpty()) {
        if (getIntent().getAction().equals(Constants.IntentActionMessages.PROCESS_URL)) {
            processUrl(getIntent().getExtras().getString("url"));
        }
    }
}

From source file:com.nks.nksmod.otaupdater.DownloadsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String extState = Environment.getExternalStorageState();
    if (!extState.equals(Environment.MEDIA_MOUNTED) && !extState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
        Toast.makeText(this, extState.equals(Environment.MEDIA_SHARED) ? R.string.toast_nosd_shared
                : R.string.toast_nosd_error, Toast.LENGTH_LONG).show();
        finish();//from   w ww  .j a  v a2 s  .  com
    }

    setContentView(R.layout.downloads);

    dlFragment = (DownloadListFragment) getFragmentManager().findFragmentById(R.id.download_list);

    bar = getActionBar();
    assert bar != null;

    bar.setDisplayHomeAsUpEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    bar.setListNavigationCallbacks(ArrayAdapter.createFromResource(this, R.array.download_types,
            android.R.layout.simple_spinner_dropdown_item), this);

    int state = -1;
    String action = getIntent().getAction();
    if (action != null) {
        if (action.equals(FLASH_ROM_ACTION)) {
            state = GOTO_TYPE_ROM;
            showFlashDialog(RomInfo.FACTORY.fromIntent(getIntent()));
            /* } else if (action.equals(FLASH_KERNEL_ACTION)) {
                state = GOTO_TYPE_KERNEL;
                showFlashDialog(KernelInfo.FACTORY.fromIntent(getIntent())); */
        } else {
            state = getIntent().getIntExtra(EXTRA_GOTO_TYPE, state);
        }
    }

    if (savedInstanceState != null) {
        if (state == -1)
            state = savedInstanceState.getInt("state", dlFragment.getState());
    }
    bar.setSelectedNavigationItem(state);
}

From source file:com.eftimoff.viewpagertransformers.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int selectedPage = 0;
    if (savedInstanceState != null) {
        mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS);
        selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE);
    }//ww w.  j ava2s  .co  m

    final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>(
            getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1,
            TRANSFORM_CLASSES);

    final ActionBar actionBar = getActionBar();
    actionBar.setListNavigationCallbacks(actionBarAdapter, this);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);

    setContentView(R.layout.activity_main);

    mAdapter = new PageAdapter(getSupportFragmentManager());

    mPager = (ViewPager) findViewById(R.id.container);
    mPager.setAdapter(mAdapter);
    mPager.setCurrentItem(selectedPage);

    actionBar.setSelectedNavigationItem(mSelectedItem);
}

From source file:com.otaupdater.DownloadsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String extState = Environment.getExternalStorageState();
    if (!extState.equals(Environment.MEDIA_MOUNTED) && !extState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
        Toast.makeText(this, extState.equals(Environment.MEDIA_SHARED) ? R.string.toast_nosd_shared
                : R.string.toast_nosd_error, Toast.LENGTH_LONG).show();
        finish();/*from   www .  ja  v  a  2s .c  om*/
    }

    setContentView(R.layout.downloads);

    dlFragment = (DownloadListFragment) getFragmentManager().findFragmentById(R.id.download_list);

    Fragment adFragment = getFragmentManager().findFragmentById(R.id.ads);
    if (adFragment != null)
        getFragmentManager().beginTransaction().hide(adFragment).commit();

    bar = getActionBar();
    assert bar != null;

    bar.setDisplayHomeAsUpEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    bar.setListNavigationCallbacks(ArrayAdapter.createFromResource(this, R.array.download_types,
            android.R.layout.simple_spinner_dropdown_item), this);

    int state = -1;
    String action = getIntent().getAction();
    if (action != null) {
        if (action.equals(FLASH_ROM_ACTION)) {
            state = GOTO_TYPE_ROM;
            showFlashDialog(RomInfo.FACTORY.fromIntent(getIntent()));
        } else if (action.equals(FLASH_KERNEL_ACTION)) {
            state = GOTO_TYPE_KERNEL;
            showFlashDialog(KernelInfo.FACTORY.fromIntent(getIntent()));
        } else {
            state = getIntent().getIntExtra(EXTRA_GOTO_TYPE, state);
        }
    }

    if (savedInstanceState != null) {
        if (state == -1)
            state = savedInstanceState.getInt("state", dlFragment.getState());
    }
    bar.setSelectedNavigationItem(state);
}

From source file:com.btmura.android.reddit.app.BrowserActivity.java

@Override
protected void doSetup(Bundle savedInstanceState) {
    if (drawerLayout != null) {
        if (hasLeftFragment || !showDrawer) {
            drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        } else {/*from  w w  w .  j  a  v  a2s .  c  om*/
            drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
            drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, ThemePrefs.getDrawerIcon(this),
                    R.string.drawer_open, R.string.drawer_close);
            drawerLayout.setDrawerListener(drawerToggle);
            drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
            bar.setHomeButtonEnabled(true);
            bar.setDisplayHomeAsUpEnabled(true);
        }
    }

    filterAdapter = new FilterAdapter(this);
    bar.setDisplayShowTitleEnabled(false);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    if (savedInstanceState == null) {
        setBrowserFragments(requestedSubreddit, requestedThingBundle);
    }
}

From source file:com.btmura.android.reddit.app.UserProfileActivity.java

@Override
protected void doSetup(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        currentFilter = savedInstanceState.getInt(STATE_FILTER);
    }//from   www  .j  a v a2 s  .  co  m

    adapter = new AccountFilterAdapter(this);

    // Don't show additional account-only profile filters.
    adapter.addProfileFilters(this, false);

    // Set the only account option to the user we are viewing not us.
    adapter.setAccountInfo(Array.of(currentUser), null, null, null);

    if (currentFilter == -1) {
        currentFilter = Filter.PROFILE_OVERVIEW;
    }
    adapter.setFilter(currentFilter);

    bar.setListNavigationCallbacks(adapter, this);
    bar.setDisplayHomeAsUpEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    getSupportLoaderManager().initLoader(0, null, this);
}

From source file:com.github.riotopsys.malforandroid2.activity.HubActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i(TAG, "onCreate");
    setContentView(R.layout.main);//from w w  w . ja  v  a 2 s .  c  o m

    ActionBar actionBar = getActionBar();

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    actionBar
            .setListNavigationCallbacks(
                    new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                            android.R.id.text1, getResources().getStringArray(R.array.drop_down_nav_options)),
                    this);

    setupAnimeAdapter();
    setupMangaAdapter();

    if (!state.isSyncScheduled()) {
        //somehow we hit this point with out starting the sync, so we'll do it now
        BootReciever.scheduleSync(state, this);
    }

    if (detailFrame != null) {
        transitionDetail(false);
    }

    if (savedInstanceState != null) {
        actionBar.setSelectedNavigationItem(savedInstanceState.getInt("MODE"));
    }

    apprater.onAppOpened(this);
}

From source file:com.meetingninja.csse.tasks.TasksFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View v = inflater.inflate(R.layout.fragment_tasks, container, false);
    setHasOptionsMenu(true);//w  ww  .  ja  v  a2s .c o  m

    session = SessionManager.getInstance();
    creator = new CreateTaskTask(this);
    /* Set up the spinner selector */
    List<String> typeNames = new ArrayList<String>();
    typeNames.add(assignedToMe);
    typeNames.add(iAssigned);
    typeNames.add(iCreated);

    typeAdapter = new TaskTypeAdapter(getActivity(), typeNames);
    getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    getActivity().getActionBar().setSelectedNavigationItem(prevSelectedType);
    getActivity().getActionBar().setListNavigationCallbacks(typeAdapter, new OnNavigationListener() {
        @Override
        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            setTaskList(itemPosition);
            return true;
        }
    });

    if (taskLists == null) {
        /* Set up the task list */
        taskLists = new HashMap<String, List<Task>>();
        ArrayList<Task> l1 = new ArrayList<Task>(), l2 = new ArrayList<Task>(), l3 = new ArrayList<Task>();
        taskLists.put(assignedToMe, l1);
        taskLists.put(iAssigned, l2);
        taskLists.put(iCreated, l3);

        refreshTasks();
    }

    ListView lv = (ListView) v.findViewById(R.id.task_list);
    lv.setEmptyView(v.findViewById(android.R.id.empty));
    taskAdpt = new TaskItemAdapter(getActivity(), R.layout.list_item_task, taskLists.get(iAssigned));

    lv.setAdapter(taskAdpt);
    registerForContextMenu(lv);

    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parentAdapter, View v, int position, long id) {
            // Intent viewTask = new Intent(getActivity(),
            // ViewTaskActivity.class);
            // startActivity(viewTask);
            Task t = taskAdpt.getItem(position);
            loadTask(t);
        }
    });

    return v;
}

From source file:cz.urbangaming.galgs.GAlg.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    ArrayList<String> itemList = new ArrayList<String>();
    //TODO:Make static, use String constants strings.xml
    itemList.add(getResources().getString(R.string.workmode_add));
    itemList.add(getResources().getString(R.string.workmode_edit));
    itemList.add(getResources().getString(R.string.workmode_delete));
    this.aAdpt = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1,
            itemList);//w  w w  . j  a  v  a  2 s. c  om
    actionBar.setListNavigationCallbacks(aAdpt, this);
    mGLSurfaceView = new GLSurfaceView(this);

    if (detectOpenGLES20()) {
        // Tell the surface view we want to create an OpenGL ES 2.0-compatible
        // context, and set an OpenGL ES 2.0-compatible renderer.
        mGLSurfaceView.setEGLContextClientVersion(2);
        pointsRenderer = new PointsRenderer(this);
        mGLSurfaceView.setRenderer(pointsRenderer);
    } else {
        // TODO: Handle as an unrecoverable error and leave the activity somehow...
    }

    // External files preparation

    InputStream in = null;
    OutputStream out = null;
    try {
        Log.d(DEBUG_TAG, "Media rady: " + isExternalStorageWritable());

        AssetManager assetManager = getAssets();
        in = assetManager.open(GALGS_CLASS_FILE);
        if (in != null) {
            galgsRubyClassesDirectory = new File(GALGS_CLASS_DIR);
            galgsRubyClassesDirectory.mkdir();
            if (!galgsRubyClassesDirectory.isDirectory()) {
                Log.d(DEBUG_TAG, "Hmm, " + galgsRubyClassesDirectory + " does not exist, trying mkdirs...");
                galgsRubyClassesDirectory.mkdirs();
            }
            File outputFile = new File(galgsRubyClassesDirectory, GALGS_CLASS_FILE);
            if (outputFile.exists()) {
                // Load from what user might have edited
                outputFile = new File(galgsRubyClassesDirectory, GALGS_CLASS_FILE + ".orig");
            }
            out = new FileOutputStream(outputFile);
            copyFile(in, out);
            in.close();
            in = null;
            out.flush();
            out.close();
            out = null;
        } else {
            Log.e("IO HELL", "Asset " + GALGS_CLASS_FILE + " not found...");
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // Stops the thing from trashing the context on pause/resume.
    mGLSurfaceView.setPreserveEGLContextOnPause(true);
    setContentView(mGLSurfaceView);

}

From source file:com.klowerbase.test.ViewpagerAnimationActivity.java

@SuppressWarnings("deprecation")
@Override/*w w  w .  j av a2s  .c  o m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int selectedPage = 0;
    if (savedInstanceState != null) {
        mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS);
        selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE);
    }

    final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>(
            getApplicationContext(), android.R.layout.simple_expandable_list_item_1, android.R.id.text1,
            TRANSFORM_CLASSES);

    setContentView(R.layout.viewpageranimation);

    mAdapter = new PageAdapter(getSupportFragmentManager());

    mPager = (ViewPager) findViewById(R.id.container);
    mPager.setAdapter(mAdapter);
    mPager.setCurrentItem(selectedPage);

    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setListNavigationCallbacks(actionBarAdapter, this);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
        //noinspection ResourceType
        actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE);

        actionBar.setSelectedNavigationItem(mSelectedItem);
    }

}