Search in sources :

Example 6 with TabLayout

use of android.support.design.widget.TabLayout in project Signal-Android by WhisperSystems.

the class GiphyActivity method initializeResources.

private void initializeResources() {
    ViewPager viewPager = ViewUtil.findById(this, R.id.giphy_pager);
    TabLayout tabLayout = ViewUtil.findById(this, R.id.tab_layout);
    this.gifFragment = new GiphyGifFragment();
    this.stickerFragment = new GiphyStickerFragment();
    this.forMms = getIntent().getBooleanExtra(EXTRA_IS_MMS, false);
    gifFragment.setClickListener(this);
    stickerFragment.setClickListener(this);
    viewPager.setAdapter(new GiphyFragmentPagerAdapter(this, getSupportFragmentManager(), gifFragment, stickerFragment));
    tabLayout.setupWithViewPager(viewPager);
}
Also used : TabLayout(android.support.design.widget.TabLayout) ViewPager(android.support.v4.view.ViewPager)

Example 7 with TabLayout

use of android.support.design.widget.TabLayout in project Signal-Android by WhisperSystems.

the class StickerSelectActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.scribble_select_sticker_activity);
    ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(new StickerPagerAdapter(getSupportFragmentManager(), this));
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
    for (int i = 0; i < tabLayout.getTabCount(); i++) {
        tabLayout.getTabAt(i).setIcon(TAB_TITLES[i]);
    }
}
Also used : TabLayout(android.support.design.widget.TabLayout) ViewPager(android.support.v4.view.ViewPager)

Example 8 with TabLayout

use of android.support.design.widget.TabLayout in project remusic by aa112901.

the class TabPagerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_tab, container, false);
    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) mContext).setSupportActionBar(toolbar);
    toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
    ab = ((AppCompatActivity) mContext).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
    ab.setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mContext.onBackPressed();
        }
    });
    ImageView search = (ImageView) rootView.findViewById(R.id.bar_search);
    search.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(mContext, LocalSearchActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            mContext.startActivity(intent);
        }
    });
    viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
        viewPager.setOffscreenPageLimit(3);
    }
    final TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
    tabLayout.setTabTextColors(R.color.text_color, ThemeUtils.getThemeColorStateList(mContext, R.color.theme_color_primary).getDefaultColor());
    //        tabLayout.setTabTextColors(ThemeUtils.getThemeColorStateList(mContext,R.color.theme_color_primary));
    //                try {
    //            Field mField = TableLayout.class.getDeclaredField("mTabTextColors");
    //            mField.setAccessible(true);
    //            mField.set(tabLayout,ThemeUtils.getThemeColorStateList(mContext,R.color.theme_color_primary));
    //        } catch (NoSuchFieldException e) {
    //            e.printStackTrace();
    //        } catch (IllegalArgumentException e) {
    //            e.printStackTrace();
    //        } catch (IllegalAccessException e) {
    //            e.printStackTrace();
    //        }
    tabLayout.setSelectedTabIndicatorColor(ThemeUtils.getThemeColorStateList(mContext, R.color.theme_color_primary).getDefaultColor());
    return rootView;
}
Also used : TabLayout(android.support.design.widget.TabLayout) AppCompatActivity(android.support.v7.app.AppCompatActivity) Intent(android.content.Intent) LocalSearchActivity(com.wm.remusic.activity.LocalSearchActivity) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 9 with TabLayout

use of android.support.design.widget.TabLayout in project remusic by aa112901.

the class TabNetPagerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_net_tab, container, false);
    viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
        viewPager.setOffscreenPageLimit(2);
    }
    final TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tabs);
    tabLayout.setTabTextColors(R.color.text_color, ThemeUtils.getThemeColorStateList(mContext, R.color.theme_color_primary).getDefaultColor());
    tabLayout.setSelectedTabIndicatorColor(ThemeUtils.getThemeColorStateList(mContext, R.color.theme_color_primary).getDefaultColor());
    tabLayout.setupWithViewPager(viewPager);
    return rootView;
}
Also used : TabLayout(android.support.design.widget.TabLayout) View(android.view.View)

Example 10 with TabLayout

use of android.support.design.widget.TabLayout in project materialistic by hidroh.

the class UserActivity method onCreate.

@SuppressWarnings("ConstantConditions")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mUsername = getIntent().getStringExtra(EXTRA_USERNAME);
    if (TextUtils.isEmpty(mUsername)) {
        mUsername = AppUtils.getDataUriId(getIntent(), PARAM_ID);
    }
    if (TextUtils.isEmpty(mUsername)) {
        finish();
        return;
    }
    setTaskTitle(mUsername);
    AppUtils.setStatusBarDim(getWindow(), true);
    setContentView(R.layout.activity_user);
    findViewById(R.id.touch_outside).setOnClickListener(v -> finish());
    mBottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.bottom_sheet));
    mBottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {

        @Override
        public void onStateChanged(@NonNull View bottomSheet, int newState) {
            switch(newState) {
                case BottomSheetBehavior.STATE_HIDDEN:
                    finish();
                    break;
                case BottomSheetBehavior.STATE_EXPANDED:
                    AppUtils.setStatusBarDim(getWindow(), false);
                    mRecyclerView.setLayoutFrozen(false);
                    break;
                default:
                    AppUtils.setStatusBarDim(getWindow(), true);
                    break;
            }
        }

        @Override
        public void onSlide(@NonNull View bottomSheet, float slideOffset) {
        // no op
        }
    });
    mTitle = (TextView) findViewById(R.id.title);
    mTitle.setText(mUsername);
    mInfo = (TextView) findViewById(R.id.user_info);
    mAbout = (TextView) findViewById(R.id.about);
    mEmpty = findViewById(R.id.empty);
    mTabLayout = (TabLayout) findViewById(R.id.tab_layout);
    mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {

        @Override
        public void onTabSelected(TabLayout.Tab tab) {
        // no op
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {
        // no op
        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {
            scrollToTop();
        }
    });
    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new SnappyLinearLayoutManager(this, true));
    mRecyclerView.addItemDecoration(new CommentItemDecoration(this));
    mScrollableHelper = new KeyDelegate.RecyclerViewHelper(mRecyclerView, KeyDelegate.RecyclerViewHelper.SCROLL_ITEM);
    if (savedInstanceState != null) {
        mUser = savedInstanceState.getParcelable(STATE_USER);
    }
    if (mUser == null) {
        load();
    } else {
        bind();
    }
    if (!AppUtils.hasConnection(this)) {
        Snackbar.make(findViewById(R.id.content_frame), R.string.offline_notice, Snackbar.LENGTH_LONG).show();
    }
}
Also used : CommentItemDecoration(io.github.hidroh.materialistic.widget.CommentItemDecoration) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) BottomSheetBehavior(android.support.design.widget.BottomSheetBehavior) TabLayout(android.support.design.widget.TabLayout) SnappyLinearLayoutManager(io.github.hidroh.materialistic.widget.SnappyLinearLayoutManager)

Aggregations

TabLayout (android.support.design.widget.TabLayout)75 View (android.view.View)33 ViewPager (android.support.v4.view.ViewPager)28 Toolbar (android.support.v7.widget.Toolbar)17 TextView (android.widget.TextView)13 Intent (android.content.Intent)12 ActionBar (android.support.v7.app.ActionBar)10 RecyclerView (android.support.v7.widget.RecyclerView)10 Fragment (android.support.v4.app.Fragment)8 ImageView (android.widget.ImageView)8 Test (org.junit.Test)8 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 UiController (android.support.test.espresso.UiController)7 ViewAction (android.support.test.espresso.ViewAction)7 AppBarLayout (android.support.design.widget.AppBarLayout)6 NavigationView (android.support.design.widget.NavigationView)6 ViewGroup (android.view.ViewGroup)6 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)5 SlowTest (io.github.hidroh.materialistic.test.suite.SlowTest)5 PagerAdapter (android.support.v4.view.PagerAdapter)4