Search in sources :

Example 51 with TabLayout

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);
}
Also used : TabLayout(android.support.design.widget.TabLayout) SearchFragment(com.lapism.searchview.sample.view.SearchFragment) ViewPager(android.support.v4.view.ViewPager) FragmentAdapter(com.lapism.searchview.sample.view.FragmentAdapter)

Example 52 with TabLayout

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;
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) TabLayout(android.support.design.widget.TabLayout) AppCompatActivity(android.support.v7.app.AppCompatActivity) TextView(android.widget.TextView) BaseStackBarChartView(com.db.chart.view.BaseStackBarChartView) View(android.view.View) AdapterView(android.widget.AdapterView) BaseBarChartView(com.db.chart.view.BaseBarChartView) BarChartView(com.db.chart.view.BarChartView) ChartView(com.db.chart.view.ChartView) TextView(android.widget.TextView) HorizontalBarChartView(com.db.chart.view.HorizontalBarChartView) StackBarChartView(com.db.chart.view.StackBarChartView) LineChartView(com.db.chart.view.LineChartView) HorizontalStackBarChartView(com.db.chart.view.HorizontalStackBarChartView)

Example 53 with TabLayout

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;
        }
    });
}
Also used : WindowInsetsCompat(android.support.v4.view.WindowInsetsCompat) HeaderView(eu.davidea.samples.flexibleadapter.views.HeaderView) OnApplyWindowInsetsListener(android.support.v4.view.OnApplyWindowInsetsListener) TabLayout(android.support.design.widget.TabLayout) View(android.view.View) HeaderView(eu.davidea.samples.flexibleadapter.views.HeaderView) Toolbar(android.support.v7.widget.Toolbar)

Example 54 with TabLayout

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);
    }
}
Also used : TabLayout(android.support.design.widget.TabLayout)

Example 55 with TabLayout

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());
}
Also used : TabLayout(android.support.design.widget.TabLayout) NonNull(android.support.annotation.NonNull) Intent(android.content.Intent) TestItem(io.github.hidroh.materialistic.test.TestItem) SlowTest(io.github.hidroh.materialistic.test.suite.SlowTest) Test(org.junit.Test)

Aggregations

TabLayout (android.support.design.widget.TabLayout)82 View (android.view.View)36 ViewPager (android.support.v4.view.ViewPager)31 Toolbar (android.support.v7.widget.Toolbar)19 Intent (android.content.Intent)16 TextView (android.widget.TextView)15 ActionBar (android.support.v7.app.ActionBar)12 RecyclerView (android.support.v7.widget.RecyclerView)12 ImageView (android.widget.ImageView)11 Fragment (android.support.v4.app.Fragment)10 NavigationView (android.support.design.widget.NavigationView)8 Test (org.junit.Test)8 Bundle (android.os.Bundle)7 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 UiController (android.support.test.espresso.UiController)7 ViewAction (android.support.test.espresso.ViewAction)7 ViewGroup (android.view.ViewGroup)7 AppBarLayout (android.support.design.widget.AppBarLayout)6 MenuItem (android.view.MenuItem)6 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)5