Search in sources :

Example 41 with ActionBar

use of android.app.ActionBar in project KnowledgeTree by tony-xxw.

the class StatusBarActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT < 16) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        View decoView = getWindow().getDecorView().getRootView();
        int uiOptions = View.SYSTEM_UI_FLAG_LOW_PROFILE;
        decoView.setSystemUiVisibility(uiOptions);
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
    }
    setContentView(R.layout.status_activity);
}
Also used : View(android.view.View) ActionBar(android.app.ActionBar)

Example 42 with ActionBar

use of android.app.ActionBar in project OpenBikeSharing by bparmentier.

the class StationsListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stations_list);
    refreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
    refreshLayout.setColorSchemeResources(R.color.bike_red, R.color.parking_blue_dark);
    refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            executeDownloadTask();
        }
    });
    viewPager = (ViewPager) findViewById(R.id.viewPager);
    viewPager.setOffscreenPageLimit(2);
    viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            /* as explained on
                http://stackoverflow.com/questions/25978462/swiperefreshlayout-viewpager-limit-horizontal-scroll-only
                 */
            refreshLayout.setEnabled(state == ViewPager.SCROLL_STATE_IDLE);
        }
    });
    stationsDataSource = new StationsDataSource(this);
    stations = stationsDataSource.getStations();
    favStations = stationsDataSource.getFavoriteStations();
    nearbyStations = new ArrayList<>();
    tabsPagerAdapter = new TabsPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(tabsPagerAdapter);
    settings = PreferenceManager.getDefaultSharedPreferences(this);
    actionBar = getActionBar();
    int defaultTabIndex = Integer.valueOf(settings.getString(PREF_KEY_DEFAULT_TAB, "0"));
    for (int i = 0; i < 3; i++) {
        ActionBar.Tab tab = actionBar.newTab();
        tab.setTabListener(this);
        tab.setText(tabsPagerAdapter.getPageTitle(i));
        actionBar.addTab(tab, (defaultTabIndex == i));
    }
    actionBar.setHomeButtonEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    boolean firstRun = settings.getString(PREF_KEY_NETWORK_ID, "").isEmpty();
    setDBLastUpdateText();
    if (firstRun) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.welcome_dialog_message);
        builder.setTitle(R.string.welcome_dialog_title);
        builder.setPositiveButton(R.string.welcome_dialog_ok, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                Intent intent = new Intent(StationsListActivity.this, BikeNetworksListActivity.class);
                startActivityForResult(intent, PICK_NETWORK_REQUEST);
            }
        });
        builder.setNegativeButton(R.string.welcome_dialog_cancel, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        AlertDialog dialog = builder.create();
        dialog.show();
    } else {
        if (savedInstanceState != null) {
            bikeNetwork = (BikeNetwork) savedInstanceState.getSerializable(KEY_BIKE_NETWORK);
            stations = (ArrayList<Station>) savedInstanceState.getSerializable(KEY_STATIONS);
            favStations = (ArrayList<Station>) savedInstanceState.getSerializable(KEY_FAV_STATIONS);
            nearbyStations = (ArrayList<Station>) savedInstanceState.getSerializable(KEY_NEARBY_STATIONS);
        } else {
            String networkId = settings.getString(PREF_KEY_NETWORK_ID, "");
            String stationUrl = settings.getString(PREF_KEY_API_URL, DEFAULT_API_URL) + "networks/" + networkId;
            jsonDownloadTask = new JSONDownloadTask();
            jsonDownloadTask.execute(stationUrl);
        }
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) ViewPager(android.support.v4.view.ViewPager) Station(be.brunoparmentier.openbikesharing.app.models.Station) StationsDataSource(be.brunoparmentier.openbikesharing.app.db.StationsDataSource) ActionBar(android.app.ActionBar)

Example 43 with ActionBar

use of android.app.ActionBar in project android_packages_apps_Settings by DirtyUnicorns.

the class UserDictionarySettings method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Show the language as a subtitle of the action bar
    final ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.user_dict_settings_title);
        actionBar.setSubtitle(UserDictionarySettingsUtils.getLocaleDisplayName(getActivity(), mLocale));
    }
    return inflater.inflate(com.android.internal.R.layout.preference_list_fragment, container, false);
}
Also used : ActionBar(android.app.ActionBar)

Example 44 with ActionBar

use of android.app.ActionBar in project android_packages_apps_Settings by DirtyUnicorns.

the class InputMethodAndSubtypeEnablerActivity method onCreate.

@Override
protected void onCreate(final Bundle savedState) {
    super.onCreate(savedState);
    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }
}
Also used : ActionBar(android.app.ActionBar)

Example 45 with ActionBar

use of android.app.ActionBar in project android_packages_apps_Settings by DirtyUnicorns.

the class EntityHeaderController method styleActionBar.

public EntityHeaderController styleActionBar(Activity activity) {
    if (activity == null) {
        Log.w(TAG, "No activity, cannot style actionbar.");
        return this;
    }
    final ActionBar actionBar = activity.getActionBar();
    if (actionBar == null) {
        Log.w(TAG, "No actionbar, cannot style actionbar.");
        return this;
    }
    actionBar.setBackgroundDrawable(new ColorDrawable(Utils.getColorAttr(activity, android.R.attr.colorSecondary)));
    actionBar.setElevation(0);
    if (mRecyclerView != null && mLifecycle != null) {
        ActionBarShadowController.attachToRecyclerView(mActivity, mLifecycle, mRecyclerView);
    }
    return this;
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ActionBar(android.app.ActionBar)

Aggregations

ActionBar (android.app.ActionBar)265 View (android.view.View)58 Intent (android.content.Intent)35 TextView (android.widget.TextView)21 ColorDrawable (android.graphics.drawable.ColorDrawable)20 OnClickListener (android.view.View.OnClickListener)14 AdapterView (android.widget.AdapterView)14 ListView (android.widget.ListView)12 Bundle (android.os.Bundle)10 Test (org.junit.Test)10 SharedPreferences (android.content.SharedPreferences)9 Uri (android.net.Uri)9 Button (android.widget.Button)9 AlertDialog (android.app.AlertDialog)8 DialogInterface (android.content.DialogInterface)8 ViewPager (android.support.v4.view.ViewPager)8 SpannableString (android.text.SpannableString)8 ComponentName (android.content.ComponentName)7 ArrayAdapter (android.widget.ArrayAdapter)7 FrameLayout (android.widget.FrameLayout)7