use of android.support.v7.app.ActionBar in project PhotoPicker by donglua.
the class PhotoPickerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
boolean showCamera = getIntent().getBooleanExtra(EXTRA_SHOW_CAMERA, true);
boolean showGif = getIntent().getBooleanExtra(EXTRA_SHOW_GIF, false);
boolean previewEnabled = getIntent().getBooleanExtra(EXTRA_PREVIEW_ENABLED, true);
setShowGif(showGif);
setContentView(R.layout.__picker_activity_photo_picker);
Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
setTitle(R.string.__picker_title);
ActionBar actionBar = getSupportActionBar();
assert actionBar != null;
actionBar.setDisplayHomeAsUpEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
actionBar.setElevation(25);
}
maxCount = getIntent().getIntExtra(EXTRA_MAX_COUNT, DEFAULT_MAX_COUNT);
columnNumber = getIntent().getIntExtra(EXTRA_GRID_COLUMN, DEFAULT_COLUMN_NUMBER);
originalPhotos = getIntent().getStringArrayListExtra(EXTRA_ORIGINAL_PHOTOS);
pickerFragment = (PhotoPickerFragment) getSupportFragmentManager().findFragmentByTag("tag");
if (pickerFragment == null) {
pickerFragment = PhotoPickerFragment.newInstance(showCamera, showGif, previewEnabled, columnNumber, maxCount, originalPhotos);
getSupportFragmentManager().beginTransaction().replace(R.id.container, pickerFragment, "tag").commit();
getSupportFragmentManager().executePendingTransactions();
}
pickerFragment.getPhotoGridAdapter().setOnItemCheckListener(new OnItemCheckListener() {
@Override
public boolean onItemCheck(int position, Photo photo, final int selectedItemCount) {
menuDoneItem.setEnabled(selectedItemCount > 0);
if (maxCount <= 1) {
List<String> photos = pickerFragment.getPhotoGridAdapter().getSelectedPhotos();
if (!photos.contains(photo.getPath())) {
photos.clear();
pickerFragment.getPhotoGridAdapter().notifyDataSetChanged();
}
return true;
}
if (selectedItemCount > maxCount) {
Toast.makeText(getActivity(), getString(R.string.__picker_over_max_count_tips, maxCount), LENGTH_LONG).show();
return false;
}
menuDoneItem.setTitle(getString(R.string.__picker_done_with_count, selectedItemCount, maxCount));
return true;
}
});
}
use of android.support.v7.app.ActionBar in project barcodescanner by dm77.
the class BaseScannerActivity method setupToolbar.
public void setupToolbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
}
use of android.support.v7.app.ActionBar in project V2HOT by djyde.
the class ContentActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(false);
}
setContentView(R.layout.activity_content);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
ImageLoader.getInstance().init(config);
Intent intent = getIntent();
String id = intent.getStringExtra("id");
String content = intent.getStringExtra("content");
String username = intent.getStringExtra("username");
title = intent.getStringExtra("title");
url = intent.getStringExtra("url");
final RepliesAdapter repliesAdapter = new RepliesAdapter(this, username);
ListView repliesView = (ListView) findViewById(R.id.replies);
View headerView = getLayoutInflater().inflate(R.layout.topic_header, repliesView, false);
((TextView) headerView.findViewById(R.id.header_title)).setText(title);
((TextView) headerView.findViewById(R.id.header_content)).setText(content);
((TextView) headerView.findViewById(R.id.header_username)).setText(username);
repliesView.addHeaderView(headerView);
repliesView.setAdapter(repliesAdapter);
RequestQueue queue = Volley.newRequestQueue(ContentActivity.this);
//获取回复
queue.add(new GsonRequest<ReplyList>(Request.Method.GET, "https://www.v2ex.com/api/replies/show.json?topic_id=" + id, ReplyList.class, new Response.Listener<ReplyList>() {
@Override
public void onResponse(ReplyList response) {
repliesAdapter.addAll(response);
repliesAdapter.notifyDataSetChanged();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(ContentActivity.this, "请检查网络", Toast.LENGTH_LONG).show();
}
}));
}
use of android.support.v7.app.ActionBar in project UltimateAndroid by cymcsg.
the class TwoWayViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.two_way_view_activity_main);
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
mSelectedLayoutId = DEFAULT_LAYOUT;
if (savedInstanceState != null) {
mSelectedLayoutId = savedInstanceState.getInt(ARG_SELECTED_LAYOUT_ID);
}
addLayoutTab(actionBar, R.layout.two_way_view_layout_list, R.drawable.two_way_view_ic_list, "list");
addLayoutTab(actionBar, R.layout.two_way_view_layout_grid, R.drawable.two_way_view_ic_grid, "grid");
addLayoutTab(actionBar, R.layout.two_way_view_layout_staggered_grid, R.drawable.two_way_view_ic_staggered, "staggered");
addLayoutTab(actionBar, R.layout.two_way_view_layout_spannable_grid, R.drawable.two_way_view_ic_spannable, "spannable");
}
use of android.support.v7.app.ActionBar in project DesignLibrary by StylingAndroid.
the class MainActivity method setupToolbar.
private void setupToolbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
Aggregations