Example usage for android.app ActionBar setSubtitle

List of usage examples for android.app ActionBar setSubtitle

Introduction

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

Prototype

public abstract void setSubtitle(@StringRes int resId);

Source Link

Document

Set the action bar's subtitle.

Usage

From source file:com.anand.bluetoothsample.BluetoothChatFragment.java

private void setStatus(int resId) {
    FragmentActivity activity = getActivity();
    if (null == activity) {
        return;/*w w w.jav a 2  s . co m*/
    }
    final ActionBar actionBar = activity.getActionBar();
    if (null == actionBar) {
        return;
    }
    actionBar.setSubtitle(resId);
}

From source file:com.anand.bluetoothsample.BluetoothChatFragment.java

private void setStatus(CharSequence subTitle) {
    FragmentActivity activity = getActivity();
    if (null == activity) {
        return;/*from w  w w  . j a  va 2 s. c  om*/
    }
    final ActionBar actionBar = activity.getActionBar();
    if (null == actionBar) {
        return;
    }
    actionBar.setSubtitle(subTitle);
}

From source file:com.application.treasurehunt.ScanQRCodeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scan_qrcode);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar actionBar = getActionBar();
        actionBar.setTitle("Treasure Hunt");
        actionBar.setSubtitle("Scan a QR code");
    }/* w  w w  .j  a va  2  s . c  o m*/

    mScanButton = (Button) findViewById(R.id.scan_qr_code_button);
    mQuestionReturned = (TextView) findViewById(R.id.scan_content_received);

    mMapManager = MapManager.get(this);
    mLocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

    mMapDataSource = MapDataDAO.getInstance(this);
    mMapDataSource.open();

    mSettings = getSharedPreferences("UserPreferencesFile", 0);
    mEditor = mSettings.edit();

    //http://developer.android.com/guide/topics/data/data-storage.html#pref
    mCurrentHuntId = mSettings.getInt("currentHuntId", 0);
    mCurrentParticipantId = mSettings.getInt("huntParticipantId", 0);

    Log.i("ScanQRCode", "The hunt retrieved from the editor is: " + mCurrentHuntId);

    if (savedInstanceState == null) {
        checkLocationServices();
    }

    ScanQRCodeActivity.this.registerReceiver(mLocationReceiver, new IntentFilter(MapManager.ACTION_LOCATION));

    mScanButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mQuestionReturned.setText("");
            Intent intent = new Intent(ScanQRCodeActivity.this, ZBarScannerActivity.class);
            startActivityForResult(intent, 1);
        }
    });
}

From source file:com.example.android.BluetoothChat.BluetoothChat.java

private final void setStatus(int resId) {
    final ActionBar actionBar = getActionBar();
    actionBar.setSubtitle(resId);
}

From source file:com.example.android.BluetoothChat.BluetoothChat.java

private final void setStatus(CharSequence subTitle) {
    final ActionBar actionBar = getActionBar();
    actionBar.setSubtitle(subTitle);
}

From source file:fm.krui.kruifm.KRUIScheduleActivity.java

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

    // Enable back button in this activity
    ActionBar actionbar = getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setSubtitle("Our 7 Day Program Schedule");

    showLoadingScreen(true);/*www. j a  v  a 2s .c om*/
    cal = new GregorianCalendar();

    // Download show data
    downloadShowData();
}

From source file:itkach.aard2.ArticleCollectionActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_PROGRESS);
    setContentView(R.layout.activity_article_collection_loading);
    final Application app = (Application) getApplication();
    app.push(this);
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setSubtitle("...");
    final Intent intent = getIntent();
    final int position = intent.getIntExtra("position", 0);

    AsyncTask<Void, Void, ArticleCollectionPagerAdapter> createAdapterTask = new AsyncTask<Void, Void, ArticleCollectionPagerAdapter>() {

        @Override/* w  ww. j av  a2 s  .  c o m*/
        protected ArticleCollectionPagerAdapter doInBackground(Void... params) {
            ArticleCollectionPagerAdapter result;
            Uri articleUrl = intent.getData();
            if (articleUrl != null) {
                result = createFromUri(app, articleUrl);
            } else {
                String action = intent.getAction();
                if (action == null) {
                    result = createFromLastResult(app);
                } else if (action.equals("showRandom")) {
                    result = createFromRandom(app);
                } else if (action.equals("showBookmarks")) {
                    result = createFromBookmarks(app);
                } else if (action.equals("showHistory")) {
                    result = createFromHistory(app);
                } else {
                    result = createFromIntent(app, intent);
                }
            }
            return result;
        }

        @Override
        protected void onPostExecute(ArticleCollectionPagerAdapter adapter) {
            if (isFinishing() || onDestroyCalled) {
                return;
            }
            articleCollectionPagerAdapter = adapter;
            if (articleCollectionPagerAdapter == null || articleCollectionPagerAdapter.getCount() == 0) {
                Toast.makeText(ArticleCollectionActivity.this, R.string.article_collection_nothing_found,
                        Toast.LENGTH_SHORT).show();
                finish();
                return;
            }

            if (position > articleCollectionPagerAdapter.getCount() - 1) {
                Toast.makeText(ArticleCollectionActivity.this,
                        R.string.article_collection_selected_not_available, Toast.LENGTH_SHORT).show();
                finish();
                return;
            }

            setContentView(R.layout.activity_article_collection);

            findViewById(R.id.pager_title_strip).setVisibility(
                    articleCollectionPagerAdapter.getCount() == 1 ? ViewGroup.GONE : ViewGroup.VISIBLE);

            viewPager = (ViewPager) findViewById(R.id.pager);
            viewPager.setAdapter(articleCollectionPagerAdapter);
            viewPager.setOnPageChangeListener(new OnPageChangeListener() {

                @Override
                public void onPageScrollStateChanged(int arg0) {
                }

                @Override
                public void onPageScrolled(int arg0, float arg1, int arg2) {
                }

                @Override
                public void onPageSelected(final int position) {
                    updateTitle(position);
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            ArticleFragment fragment = (ArticleFragment) articleCollectionPagerAdapter
                                    .getItem(position);
                            fragment.applyTextZoomPref();
                        }
                    });

                }
            });
            viewPager.setCurrentItem(position);

            PagerTitleStrip titleStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
            titleStrip.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
            updateTitle(position);
            articleCollectionPagerAdapter.registerDataSetObserver(new DataSetObserver() {
                @Override
                public void onChanged() {
                    if (articleCollectionPagerAdapter.getCount() == 0) {
                        finish();
                    }
                }
            });
        }
    };

    createAdapterTask.execute();

}

From source file:com.richtodd.android.quiltdesign.app.BlockEditActivity.java

@Override
public void onEditNamePositiveClick(DialogFragment dialog, String name) throws Exception {

    Repository repository = Repository.getDefaultRepository(this);
    BlockContainer blocks = repository.getBlocks();
    if (blocks.blockExists(name)) {
        AlertDialogFragment alertDialog = AlertDialogFragment.create(KEY_FILE_EXISTS,
                getString(R.string.alert_message_blockAlreadyExists),
                getString(R.string.alert_button_acknowledge), null);
        alertDialog.show(getFragmentManager(), null);
    } else {//w  w  w.  j  a va 2  s  .c o  m
        m_saveAsBlockName = name;
        getBlockEditFragment().setSaveAsBlockName(m_saveAsBlockName);
    }

    ActionBar ab = getActionBar();
    ab.setSubtitle(getCurrentBlockName());
}

From source file:com.dictionary.activity.ArticleCollectionActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Application app = (Application) getApplication();
    app.installTheme(this);
    requestWindowFeature(Window.FEATURE_PROGRESS);
    setContentView(R.layout.activity_article_collection_loading);
    app.push(this);
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setSubtitle("...");
    final Intent intent = getIntent();
    final int position = intent.getIntExtra("position", 0);

    AsyncTask<Void, Void, ArticleCollectionPagerAdapter> createAdapterTask = new AsyncTask<Void, Void, ArticleCollectionPagerAdapter>() {

        @Override/* w w w . j ava  2  s .c  om*/
        protected ArticleCollectionPagerAdapter doInBackground(Void... params) {
            ArticleCollectionPagerAdapter result;
            Uri articleUrl = intent.getData();
            if (articleUrl != null) {
                result = createFromUri(app, articleUrl);
            } else {
                String action = intent.getAction();
                if (action == null) {
                    result = createFromLastResult(app);
                } else if (action.equals("showRandom")) {
                    result = createFromRandom(app);
                } else if (action.equals("showBookmarks")) {
                    result = createFromBookmarks(app);
                } else if (action.equals("showHistory")) {
                    result = createFromHistory(app);
                } else {
                    result = createFromIntent(app, intent);
                }
            }
            return result;
        }

        @Override
        protected void onPostExecute(ArticleCollectionPagerAdapter adapter) {
            if (isFinishing() || onDestroyCalled) {
                return;
            }
            articleCollectionPagerAdapter = adapter;
            if (articleCollectionPagerAdapter == null || articleCollectionPagerAdapter.getCount() == 0) {
                int messageId;
                if (articleCollectionPagerAdapter == null) {
                    messageId = R.string.article_collection_invalid_link;
                } else {
                    messageId = R.string.article_collection_nothing_found;
                }
                Toast.makeText(ArticleCollectionActivity.this, messageId, Toast.LENGTH_SHORT).show();
                finish();
                return;
            }

            if (position > articleCollectionPagerAdapter.getCount() - 1) {
                Toast.makeText(ArticleCollectionActivity.this,
                        R.string.article_collection_selected_not_available, Toast.LENGTH_SHORT).show();
                finish();
                return;
            }

            setContentView(R.layout.activity_article_collection);

            findViewById(R.id.pager_title_strip).setVisibility(
                    articleCollectionPagerAdapter.getCount() == 1 ? ViewGroup.GONE : ViewGroup.VISIBLE);

            viewPager = (ViewPager) findViewById(R.id.pager);
            viewPager.setAdapter(articleCollectionPagerAdapter);
            viewPager.setOnPageChangeListener(new OnPageChangeListener() {

                @Override
                public void onPageScrollStateChanged(int arg0) {
                }

                @Override
                public void onPageScrolled(int arg0, float arg1, int arg2) {
                }

                @Override
                public void onPageSelected(final int position) {
                    updateTitle(position);
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            ArticleFragment fragment = (ArticleFragment) articleCollectionPagerAdapter
                                    .getItem(position);
                            fragment.applyTextZoomPref();
                        }
                    });

                }
            });
            viewPager.setCurrentItem(position);

            PagerTitleStrip titleStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
            titleStrip.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
            updateTitle(position);
            articleCollectionPagerAdapter.registerDataSetObserver(new DataSetObserver() {
                @Override
                public void onChanged() {
                    if (articleCollectionPagerAdapter.getCount() == 0) {
                        finish();
                    }
                }
            });
        }
    };

    createAdapterTask.execute();

}

From source file:io.coldstart.android.TrapListActivity.java

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

    BugSenseHandler.initAndStartSession(TrapListActivity.this, "b569cf15");

    setContentView(R.layout.activity_trap_list);

    securityID = API.md5(Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID));

    ActionBar ab = getActionBar();
    ab.setTitle("ColdStart.io");
    ab.setSubtitle("Instant SNMP Trap Alerting");

    //Start the service just in case
    //Gets round http://developer.android.com/reference/android/content/Intent.html#FLAG_INCLUDE_STOPPED_PACKAGES
    startService(new Intent(this, ColdStartService.class));

    //GCM stuff//w  ww  .  j  a  v a2s  .  c o m
    GCMRegistrar.checkDevice(this);
    GCMRegistrar.checkManifest(this);
    regId = GCMRegistrar.getRegistrationId(this);

    if (regId.equals("")) {
        Log.v("GCM", "Registering");
        GCMRegistrar.register(this, API.SENDER_ID);
    } else {
        Log.v("GCM", "Already registered");
    }

    Log.e("GCMID", GCMRegistrar.getRegistrationId(this));

    settings = PreferenceManager.getDefaultSharedPreferences(this);

    if (settings.getBoolean("firstRun", true)) {
        showChooseDialog();
    } else {
        subscribeToMessages();
    }

    if (findViewById(R.id.trap_detail_container) != null) {
        // The detail container view will be present only in the
        // large-screen layouts (res/values-large and
        // res/values-sw600dp). If this view is present, then the
        // activity should be in two-pane mode.
        mTwoPane = true;

        // In two-pane mode, list items should be given the
        // 'activated' state when touched.
        ((TrapListFragment) getSupportFragmentManager().findFragmentById(R.id.trap_list))
                .setActivateOnItemClick(true);

        if (savedInstanceState == null) {
            WelcomeFragment fragment = new WelcomeFragment();
            //fragment.setArguments(arguments);
            getSupportFragmentManager().beginTransaction().replace(R.id.trap_detail_container, fragment)
                    .commit();
        }
    }

    // TODO: If exposing deep links into your app, handle intents here.
}