Example usage for android.app ActionBar setNavigationMode

List of usage examples for android.app ActionBar setNavigationMode

Introduction

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

Prototype

@Deprecated
public abstract void setNavigationMode(@NavigationMode int mode);

Source Link

Document

Set the current navigation mode.

Usage

From source file:com.cashout.paperless.fintech_paperless_cashout.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.//from  w w w  . j a v  a 2s .c om
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

}

From source file:com.aknowledge.v1.automation.RemoteActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_remote);
    myApp = (PyHomeController) getApplication();

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1, new String[] { "All" }),
            this);

}

From source file:com.hardcopy.arduinonavi.MainActivity.java

/*****************************************************
 *    Overrided methods//w  w w  .  j a  v a  2s . c o  m
 ******************************************************/

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

    //----- System, Context
    mContext = this; //.getApplicationContext();
    mActivityHandler = new ActivityHandler();
    AppSettings.initializeAppSettings(mContext);

    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Create the adapter that will return a fragment for each of the primary sections of the app.
    mFragmentManager = getSupportFragmentManager();
    mSectionsPagerAdapter = new FragmentAdapter(mFragmentManager, mContext, this, mActivityHandler);

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

    // Setup views

    mNaviInfo = (TextView) findViewById(R.id.status_navi_info);
    mNaviInfo.setText(getResources().getString(R.string.title_destination) + ": ");
    mNaviMode = (Button) findViewById(R.id.btn_mode);
    mNaviMode.setOnClickListener(this);
    showUnitTypeButton();

    mImageBT = (ImageView) findViewById(R.id.status_title);
    mImageBT.setImageDrawable(getResources().getDrawable(android.R.drawable.presence_invisible));
    mTextStatus = (TextView) findViewById(R.id.status_text);
    mTextStatus.setText(getResources().getString(R.string.bt_state_init));

    // Do data initialization after service started and binded
    doStartService();
}

From source file:dk.bearware.gui.AudioCodecActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_audiocodec);

    audiocodec = Utils.getAudioCodec(this.getIntent());

    int tab_index = 0;
    switch (audiocodec.nCodec) {
    case Codec.OPUS_CODEC:
        opuscodec = audiocodec.opus;/*from   w  w  w  . ja va  2  s.  com*/
        tab_index = TAB_OPUS;
        break;
    case Codec.SPEEX_CODEC:
        speexcodec = audiocodec.speex;
        tab_index = TAB_SPEEX;
        break;
    case Codec.SPEEX_VBR_CODEC:
        speexvbrcodec = audiocodec.speex_vbr;
        tab_index = TAB_SPEEXVBR;
        break;
    case Codec.NO_CODEC:
        tab_index = TAB_NOAUDIO;
        break;
    }

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter. Also specify this Activity object, which implements
        // the TabListener interface, as the callback (listener) for when
        // this tab is selected.
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }

    mViewPager.setCurrentItem(tab_index);
}

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);/*from w w w  . j  a v  a2s. co  m*/
    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.project.binbinfu.the_city.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.

    //mHotPagerAdapter = new HotPagerAdapter(getSupportFragmentManager());
    fragmentmanager = getSupportFragmentManager();
    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.//from  w ww .  j  a v a2s . c om
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // For each of the sections in the app, add a tab to the action bar.

    actionBar.addTab(actionBar.newTab().setText(R.string.title_section1).setTabListener(this));
    actionBar.addTab(actionBar.newTab().setText(R.string.title_section2).setTabListener(this));
    actionBar.addTab(actionBar.newTab().setText(R.string.title_section3).setTabListener(this));
}

From source file:com.vurf.vurfx.view.Place_template.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_place_template);

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    final String TitleNames[] = new String[] { "About", "Main", "Photos" };

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent./*from  ww  w .ja  va 2 s . c o m*/
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });
    // TODO swipy tabs 
    //PagerTitleStrip  mPagerTitleStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(actionBar.newTab().setText(TitleNames[i]).setTabListener(this));
    }
    actionBar.hide();
    //mViewPager.setCurrentItem(tab.getPosition())
    mViewPager.setCurrentItem(1);
}

From source file:org.floens.chan.ui.activity.BoardActivity.java

private void setActionBarListMode() {
    ActionBar actionBar = getActionBar();
    if (actionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_LIST)
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
}

From source file:nrec.basil.wimuconsole.SensorSettingsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sensor_settings);

    // Set up the action bar to show a dropdown list which will
    // contain the various sensors that can be configured.  Some
    // sensors are local (camera) some are remote bluetooth devices
    // (IMU, Barometer etc.)
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

    // Set up the dropdown list navigation in the action bar.
    actionBar.setListNavigationCallbacks(
            // Specify a SpinnerAdapter to populate the dropdown list.
            new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1,
                    android.R.id.text1, getResources().getStringArray(R.array.sensors_list)),
            this);

    // Specify a SpinnerAdapter to populate the wIMU list
    ArrayAdapter<CharSequence> imuAdapter = ArrayAdapter.createFromResource(this, R.array.wimu_list,
            android.R.layout.simple_spinner_item);
    imuAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    imuSpinner = (Spinner) findViewById(R.id.wimulist);
    imuSpinner.setAdapter(imuAdapter);//from w ww.j  a  v a2  s .co  m

    // Load the BASIL start/stop/reset commands
    InputStream input = getResources().openRawResource(R.raw.basilstart);
    try {
        input.read(basilStart, 0, 26);
    } catch (IOException e) {
        Log.e(TAG, "Could not read BASIL start command", e);
    }
    input = getResources().openRawResource(R.raw.basilstop);
    try {
        input.read(basilStop, 0, 26);
    } catch (IOException e) {
        Log.e(TAG, "Could not read BASIL stop command", e);
    }
    input = getResources().openRawResource(R.raw.basilreset);
    try {
        input.read(basilReset, 0, 26);
    } catch (IOException e) {
        Log.e(TAG, "Could not read BASIL reset command", e);
    }

    // Get the default filename for logging
    EditText logfilename = (EditText) findViewById(R.id.logfilename);
    mLogFileName = logfilename.toString();

    // Get local Bluetooth adapter
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

    // If the adapter is null, then Bluetooth is not supported
    if (mBluetoothAdapter == null) {
        Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
        finish();
        return;
    }
}

From source file:capsrock.beta.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    timeSheet = new TimeSheet();
    PebbleData = new PebbleDictionary();
    //Set up to Receive messages from the pebble and handle them correctly
    PebbleKit.registerReceivedDataHandler(this, new PebbleKit.PebbleDataReceiver(PEBBLE_APP_UUID) {
        @Override//  w  ww.ja v a2s .  c o m
        public void receiveData(final Context context, final int transactionId, final PebbleDictionary data) {
            String mode = data.getString(1);
            //((TextView)findViewById(R.id.pebbleText)).setText(mode);
            if (mode.substring(9).equals("Break") || mode.substring(9).equals("Work")) {
                ((TimeEntryFragment) getSupportFragmentManager()
                        .findFragmentByTag("android:switcher:" + R.id.pager + ":0"))
                                .onTimeEntry(findViewById(R.id.StartButton), false);
            } else {
                ((TimeEntryFragment) getSupportFragmentManager()
                        .findFragmentByTag("android:switcher:" + R.id.pager + ":0"))
                                .onTimeEntry(findViewById(R.id.StopButton), false);
            }
            PebbleKit.sendAckToPebble(getApplicationContext(), transactionId);
        }
    });
    //Set up the timer thread
    thr = new Thread(new Runnable() {
        @Override
        public void run() {
            while (true) {
                try {
                    Thread.sleep(1000);
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            Message mes = new Message();
                            if (strDate != null) {
                                long seconds = Calendar.getInstance().getTimeInMillis()
                                        - strDate.getTimeInMillis();
                                long minutes = seconds / 1000 / 60;
                                minutes %= 60;

                                long hours = seconds / 1000 / 60 / 60;
                                hours %= 24;

                                seconds /= 1000;
                                seconds %= 60;

                                String sec = hours + ":" + minutes + ":" + seconds;
                                mes.obj = sec;
                                mHandler.sendMessage(mes);
                            } else {
                                mes.obj = "00:00:00";
                                mHandler.sendMessage(mes);
                            }
                        }
                    });
                } catch (Exception e) {

                }
            }
        }
    });

    //Start Login Screen
    Intent intent = new Intent();
    intent.setClassName("capsrock.beta", "capsrock.beta.LoginActivity");
    //startActivity(intent);
    setContentView(R.layout.activity_main);

    // Create the adapter that will return a fragment for each of the three primary sections
    // of the app.
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set up the ViewPager, attaching the adapter and setting up a listener for when the
    // user swipes between sections.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);

        }

    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        actionBar.addTab(
                actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}