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);
}
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);
}
}
}
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);
}
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);
}
}
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;
}
Aggregations