Search in sources :

Example 1 with CirclePageIndicator

use of com.viewpagerindicator.CirclePageIndicator in project ViewPagerIndicator by JakeWharton.

the class SampleCirclesSnap method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_circles);
    mAdapter = new TestFragmentAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    CirclePageIndicator indicator = (CirclePageIndicator) findViewById(R.id.indicator);
    mIndicator = indicator;
    indicator.setViewPager(mPager);
    indicator.setSnap(true);
}
Also used : CirclePageIndicator(com.viewpagerindicator.CirclePageIndicator)

Example 2 with CirclePageIndicator

use of com.viewpagerindicator.CirclePageIndicator in project AntennaPod by AntennaPod.

the class MediaplayerInfoActivity method setupGUI.

@Override
protected void setupGUI() {
    super.setupGUI();
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        findViewById(R.id.shadow).setVisibility(View.GONE);
        AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appBar);
        float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
        appBarLayout.setElevation(px);
    }
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    navList = (ListView) findViewById(R.id.nav_list);
    navDrawer = findViewById(R.id.nav_layout);
    drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close);
    drawerToggle.setDrawerIndicatorEnabled(false);
    drawerLayout.setDrawerListener(drawerToggle);
    navAdapter = new NavListAdapter(itemAccess, this);
    navList.setAdapter(navAdapter);
    navList.setOnItemClickListener((parent, view, position, id) -> {
        int viewType = parent.getAdapter().getItemViewType(position);
        if (viewType != NavListAdapter.VIEW_TYPE_SECTION_DIVIDER) {
            Intent intent = new Intent(MediaplayerInfoActivity.this, MainActivity.class);
            intent.putExtra(MainActivity.EXTRA_NAV_TYPE, viewType);
            intent.putExtra(MainActivity.EXTRA_NAV_INDEX, position);
            startActivity(intent);
        }
        drawerLayout.closeDrawer(navDrawer);
    });
    navList.setOnItemLongClickListener((parent, view, position, id) -> {
        if (position < navAdapter.getTags().size()) {
            showDrawerPreferencesDialog();
            return true;
        } else {
            mPosition = position;
            return false;
        }
    });
    registerForContextMenu(navList);
    drawerToggle.syncState();
    findViewById(R.id.nav_settings).setOnClickListener(v -> {
        drawerLayout.closeDrawer(navDrawer);
        startActivity(new Intent(MediaplayerInfoActivity.this, PreferenceController.getPreferenceActivity()));
    });
    butPlaybackSpeed = (Button) findViewById(R.id.butPlaybackSpeed);
    butCastDisconnect = (ImageButton) findViewById(R.id.butCastDisconnect);
    pager = (ViewPager) findViewById(R.id.pager);
    pagerAdapter = new MediaplayerInfoPagerAdapter(getSupportFragmentManager(), media);
    pagerAdapter.setController(controller);
    pager.setAdapter(pagerAdapter);
    CirclePageIndicator pageIndicator = (CirclePageIndicator) findViewById(R.id.page_indicator);
    pageIndicator.setViewPager(pager);
    loadLastFragment();
    pager.onSaveInstanceState();
}
Also used : NavListAdapter(de.danoeh.antennapod.adapter.NavListAdapter) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) Intent(android.content.Intent) AppBarLayout(android.support.design.widget.AppBarLayout) CirclePageIndicator(com.viewpagerindicator.CirclePageIndicator) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with CirclePageIndicator

use of com.viewpagerindicator.CirclePageIndicator in project ViewPagerIndicator by JakeWharton.

the class SampleCirclesStyledMethods method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_circles);
    mAdapter = new TestFragmentAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);
    CirclePageIndicator indicator = (CirclePageIndicator) findViewById(R.id.indicator);
    mIndicator = indicator;
    indicator.setViewPager(mPager);
    final float density = getResources().getDisplayMetrics().density;
    indicator.setBackgroundColor(0xFFCCCCCC);
    indicator.setRadius(10 * density);
    indicator.setPageColor(0x880000FF);
    indicator.setFillColor(0xFF888888);
    indicator.setStrokeColor(0xFF000000);
    indicator.setStrokeWidth(2 * density);
}
Also used : CirclePageIndicator(com.viewpagerindicator.CirclePageIndicator)

Aggregations

CirclePageIndicator (com.viewpagerindicator.CirclePageIndicator)3 Intent (android.content.Intent)1 AppBarLayout (android.support.design.widget.AppBarLayout)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 Toolbar (android.support.v7.widget.Toolbar)1 NavListAdapter (de.danoeh.antennapod.adapter.NavListAdapter)1