use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.
the class BaseItemIntroductionFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(mToolbar);
TintHelper.onSetSupportActionBar(mToolbar);
activity.setTitle(mItem.title);
mIntroductionText.setText(!TextUtils.isEmpty(mItem.introduction) ? mItem.getPrettyIntroduction() : activity.getString(R.string.item_introduction_empty));
List<Pair<String, String>> informationData = makeInformationData();
boolean hasInformationData = !informationData.isEmpty();
ViewUtils.setVisibleOrGone(mInformationLayout, hasInformationData);
if (hasInformationData) {
ItemIntroductionPairListAdapter informationAdapter = new ItemIntroductionPairListAdapter();
informationAdapter.replace(informationData);
mInformationLayout.setColumnCount(2);
// HACK: Disabled for looking weird; anyway we always have the space from word break.
// mInformationLayout.setHorizontalDivider(R.drawable.transparent_divider_vertical_16dp);
mInformationLayout.setAdapter(informationAdapter);
}
}
use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.
the class HomeFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(mToolbar);
mTabAdapter = new TabFragmentPagerAdapter(this);
mTabAdapter.addTab(HomeBroadcastListFragment::newInstance, getString(R.string.home_broadcast));
mTabAdapter.addTab(NotYetImplementedFragment::newInstance, getString(R.string.home_discover));
mTabAdapter.addTab(NotYetImplementedFragment::newInstance, getString(R.string.home_topic));
mTabAdapter.addTab(NotYetImplementedFragment::newInstance, getString(R.string.home_online));
mViewPager.setOffscreenPageLimit(mTabAdapter.getCount() - 1);
mViewPager.setAdapter(mTabAdapter);
mTabLayout.setupWithViewPager(mViewPager);
}
use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.
the class GalleryFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(mToolbar);
mSystemUiHelper = new SystemUiHelper(activity, SystemUiHelper.LEVEL_IMMERSIVE, SystemUiHelper.FLAG_IMMERSIVE_STICKY, visible -> {
if (visible) {
mToolbar.animate().alpha(1).translationY(0).setDuration(mToolbarHideDuration).setInterpolator(new FastOutSlowInInterpolator()).start();
} else {
mToolbar.animate().alpha(0).translationY(-mToolbar.getBottom()).setDuration(mToolbarHideDuration).setInterpolator(new FastOutSlowInInterpolator()).start();
}
});
// This will set up window flags.
mSystemUiHelper.show();
mAdapter = new GalleryAdapter(mImageList, new GalleryAdapter.Listener() {
@Override
public void onTap() {
mSystemUiHelper.toggle();
}
@Override
public void onFileDownloaded(int position) {
if (position == mViewPager.getCurrentItem()) {
updateOptionsMenu();
}
}
});
mViewPager.setAdapter(mAdapter);
mViewPager.setCurrentItem(mInitialPosition);
mViewPager.setPageTransformer(true, ViewPagerTransformers.DEPTH);
mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
updateTitle();
updateOptionsMenu();
}
});
updateTitle();
}
use of androidx.appcompat.app.AppCompatActivity in project Douya by DreaminginCodeZH.
the class TableOfContentsFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
AppCompatActivity activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(mToolbar);
TintHelper.onSetSupportActionBar(mToolbar);
mTableOfContentsText.setText(mBook.tableOfContents);
}
use of androidx.appcompat.app.AppCompatActivity in project IITB-App by wncc.
the class ComplaintsAdapter method getComplaint.
private void getComplaint(Venter.Complaint detailedComplaint) {
Bundle bundle = new Bundle();
bundle.putString("id", detailedComplaint.getComplaintID());
bundle.putString("userId", userID);
bundle.putString("userProfileUrl", userProfileUrl);
ComplaintFragment complaintFragment = new ComplaintFragment();
complaintFragment.setArguments(bundle);
AppCompatActivity activity = (AppCompatActivity) context;
activity.getSupportFragmentManager().beginTransaction().replace(R.id.framelayout_for_fragment, complaintFragment).addToBackStack(TAG).commit();
}
Aggregations