Search in sources :

Example 6 with ActionBar

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;
        }
    });
}
Also used : Photo(me.iwf.photopicker.entity.Photo) ArrayList(java.util.ArrayList) List(java.util.List) ActionBar(android.support.v7.app.ActionBar) OnItemCheckListener(me.iwf.photopicker.event.OnItemCheckListener) Toolbar(android.support.v7.widget.Toolbar)

Example 7 with ActionBar

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);
    }
}
Also used : ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 8 with ActionBar

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();
        }
    }));
}
Also used : VolleyError(com.android.volley.VolleyError) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ListView(android.widget.ListView) RequestQueue(com.android.volley.RequestQueue) TextView(android.widget.TextView) ReplyList(com.v2ex.api.ReplyList) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) ActionBar(android.support.v7.app.ActionBar)

Example 9 with ActionBar

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");
}
Also used : ActionBar(android.support.v7.app.ActionBar)

Example 10 with ActionBar

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);
    }
}
Also used : ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

ActionBar (android.support.v7.app.ActionBar)400 View (android.view.View)117 Toolbar (android.support.v7.widget.Toolbar)98 TextView (android.widget.TextView)63 AppCompatActivity (android.support.v7.app.AppCompatActivity)31 ImageView (android.widget.ImageView)31 Intent (android.content.Intent)29 RecyclerView (android.support.v7.widget.RecyclerView)27 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)23 AdapterView (android.widget.AdapterView)21 ViewPager (android.support.v4.view.ViewPager)15 ArrayList (java.util.ArrayList)15 Bundle (android.os.Bundle)14 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)14 SuppressLint (android.annotation.SuppressLint)13 ListView (android.widget.ListView)13 FragmentManager (android.app.FragmentManager)12 Fragment (android.support.v4.app.Fragment)12 ColorDrawable (android.graphics.drawable.ColorDrawable)10 NavigationView (android.support.design.widget.NavigationView)10