use of android.support.design.widget.TabLayout in project SearchView by lapism.
the class BaseActivity method setViewPager.
protected void setViewPager() {
FragmentAdapter adapter = new FragmentAdapter(getSupportFragmentManager());
adapter.addFragment(new SearchFragment(), getString(R.string.installed));
adapter.addFragment(new SearchFragment(), getString(R.string.all));
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(adapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.design.widget.TabLayout in project WilliamChart by diogobernardino.
the class SandboxFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.sandbox, container, false);
((AppCompatActivity) getActivity()).setSupportActionBar((Toolbar) layout.findViewById(R.id.toolbar));
((TextView) layout.findViewById(R.id.title)).setTypeface(Typeface.createFromAsset(getContext().getAssets(), "Ponsi-Regular.otf"));
// Pager
mSectionsPagerAdapter = new SandboxPagerAdapter(this.getChildFragmentManager());
mViewPager = (ViewPager) layout.findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
//getActivity().setupViewPager(viewPager);
TabLayout tabLayout = (TabLayout) layout.findViewById(R.id.tab_layout);
tabLayout.setupWithViewPager(mViewPager);
// Defaults
mChartId = R.id.sandbox_chart_line;
mChartColorId = 1;
mLabelXId = R.id.sandbox_axis_x_outside;
mAxisXId = R.id.sandbox_axis_x_axis;
mLabelYId = R.id.sandbox_axis_y_outside;
mAxisYId = R.id.sandbox_axis_y_axis;
mAxisColorId = DEFAULT_COLOR;
mLabelColorId = DEFAULT_COLOR;
mLabelFormat = "";
mOrderId = R.id.sandbox_anim_ordere;
mEnterId = R.id.sandbox_anim_enterb;
mAlphaId = -1;
mGridTypeId = -1;
mGridLineTypeId = R.id.sandbox_grid_solid;
mGridThicknessId = R.id.sandbox_grid_thickness3;
mLineTypeId = -1;
mLineThicknessTypeId = R.id.sandbox_line_solid;
mLineThicknessId = R.id.sandbox_line_thickness3;
mLineColorId = DEFAULT_COLOR;
mPointColorId = DEFAULT_COLOR;
mBarSpacing = 10;
mBarCornersSize = 0;
mBarColorId = DEFAULT_COLOR;
mHasBarBackground = false;
mBarBackgroundId = -1;
mBarBackgroundColorId = DEFAULT_COLOR;
mBarSpacingId = R.id.sandbox_bar_spacing2;
mBarCornersSizeId = R.id.sandbox_bar_corner1;
mHasYAxis = true;
mYLabelPosition = AxisRenderer.LabelPosition.OUTSIDE;
mHasXAxis = true;
mXLabelPosition = AxisRenderer.LabelPosition.OUTSIDE;
mGridType = null;
mIsGridDashed = false;
mGridDashType = null;
mGridThickness = 1f;
mGridThicknessId = R.id.sandbox_grid_thickness3;
mGridColorId = DEFAULT_COLOR;
mIsLineSmooth = false;
mIsLineDashed = false;
mLineDashType = null;
mLineThickness = 3;
mLineThicknessId = R.id.sandbox_line_thickness3;
mPointsSize = 0;
mPointsSizeId = -1;
mDuration = 1000;
mOverlapFactor = 1;
mOverlapOrder = mEqualOrder;
mEasingId = 0;
mInterpolator = new DecelerateInterpolator();
mStartX = -1;
mStartY = 0;
mAlpha = -1;
return layout;
}
use of android.support.design.widget.TabLayout in project FlexibleAdapter by davideas.
the class ViewPagerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_pager);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
HeaderView headerView = (HeaderView) findViewById(R.id.toolbar_header_view);
headerView.bindTo(getString(R.string.app_name), getString(R.string.viewpager));
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.view_pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
//Coordinatorlayout Status Bar Padding Disappears From Viewpager 2nd-page
//http://stackoverflow.com/questions/31368781/coordinatorlayout-status-bar-padding-disappears-from-viewpager-2nd-page
ViewCompat.setOnApplyWindowInsetsListener(mViewPager, new OnApplyWindowInsetsListener() {
@Override
public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) {
insets = ViewCompat.onApplyWindowInsets(v, insets);
if (insets.isConsumed()) {
return insets;
}
boolean consumed = false;
for (int i = 0, count = mViewPager.getChildCount(); i < count; i++) {
ViewCompat.dispatchApplyWindowInsets(mViewPager.getChildAt(i), insets);
if (insets.isConsumed()) {
consumed = true;
}
}
return consumed ? insets.consumeSystemWindowInsets() : insets;
}
});
}
use of android.support.design.widget.TabLayout in project cw-omnibus by commonsguy.
the class MainActivity method setupPager.
private void setupPager() {
durationInSeconds = preso.duration * 60;
if (rc != null) {
rc.setOverallDuration(durationInSeconds);
}
adapter = new SlidesAdapter(this, preso);
pager.setAdapter(adapter);
if (!isDirectToTV()) {
TabLayout tabs = (TabLayout) findViewById(R.id.tabs);
tabs.setVisibility(View.VISIBLE);
tabs.setupWithViewPager(pager);
tabs.addOnTabSelectedListener(this);
}
}
use of android.support.design.widget.TabLayout in project materialistic by hidroh.
the class ItemActivityTest method testDefaultReadabilityView.
@Test
public void testDefaultReadabilityView() {
PreferenceManager.getDefaultSharedPreferences(activity).edit().putString(activity.getString(R.string.pref_story_display), activity.getString(R.string.pref_story_display_value_readability)).apply();
Intent intent = new Intent();
intent.putExtra(ItemActivity.EXTRA_ITEM, new TestItem() {
@NonNull
@Override
public String getType() {
return STORY_TYPE;
}
@Override
public String getId() {
return "1";
}
@Override
public boolean isStoryType() {
return true;
}
@Override
public int getKidCount() {
return 10;
}
@Override
public String getUrl() {
return "http://example.com";
}
});
controller.withIntent(intent).create().start().resume();
TabLayout tabLayout = (TabLayout) activity.findViewById(R.id.tab_layout);
assertEquals(2, tabLayout.getTabCount());
assertEquals(1, tabLayout.getSelectedTabPosition());
}
Aggregations