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);
}
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]);
}
}
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;
}
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;
}
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();
}
}
Aggregations