Search in sources :

Example 46 with AppCompatActivity

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);
    }
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) Pair(androidx.core.util.Pair)

Example 47 with AppCompatActivity

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);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity) HomeBroadcastListFragment(me.zhanghai.android.douya.broadcast.ui.HomeBroadcastListFragment) TabFragmentPagerAdapter(me.zhanghai.android.douya.ui.TabFragmentPagerAdapter) NotYetImplementedFragment(me.zhanghai.android.douya.ui.NotYetImplementedFragment)

Example 48 with AppCompatActivity

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();
}
Also used : EffortlessPermissions(me.zhanghai.android.effortlesspermissions.EffortlessPermissions) ToastUtils(me.zhanghai.android.douya.util.ToastUtils) Bundle(android.os.Bundle) ButterKnife(butterknife.ButterKnife) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) ViewPager(androidx.viewpager.widget.ViewPager) FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) SaveImageService(me.zhanghai.android.douya.gallery.app.SaveImageService) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) BindView(butterknife.BindView) FragmentUtils(me.zhanghai.android.douya.util.FragmentUtils) Manifest(android.Manifest) MenuInflater(android.view.MenuInflater) Fragment(androidx.fragment.app.Fragment) Menu(android.view.Menu) View(android.view.View) IntentUtils(me.zhanghai.android.douya.util.IntentUtils) AppUtils(me.zhanghai.android.douya.util.AppUtils) AfterPermissionDenied(me.zhanghai.android.effortlesspermissions.AfterPermissionDenied) LayoutInflater(android.view.LayoutInflater) BindInt(butterknife.BindInt) ViewGroup(android.view.ViewGroup) File(java.io.File) R(me.zhanghai.android.douya.R) FileUtils(me.zhanghai.android.douya.util.FileUtils) AfterPermissionGranted(pub.devrel.easypermissions.AfterPermissionGranted) OpenAppDetailsDialogFragment(me.zhanghai.android.effortlesspermissions.OpenAppDetailsDialogFragment) Nullable(androidx.annotation.Nullable) SystemUiHelper(me.zhanghai.android.systemuihelper.SystemUiHelper) Toolbar(androidx.appcompat.widget.Toolbar) Activity(android.app.Activity) ViewPagerTransformers(me.zhanghai.android.douya.ui.ViewPagerTransformers) SystemUiHelper(me.zhanghai.android.systemuihelper.SystemUiHelper) FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ViewPager(androidx.viewpager.widget.ViewPager)

Example 49 with AppCompatActivity

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);
}
Also used : AppCompatActivity(androidx.appcompat.app.AppCompatActivity)

Example 50 with AppCompatActivity

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();
}
Also used : ComplaintFragment(app.insti.fragment.ComplaintFragment) Bundle(android.os.Bundle) AppCompatActivity(androidx.appcompat.app.AppCompatActivity)

Aggregations

AppCompatActivity (androidx.appcompat.app.AppCompatActivity)74 ActionBar (androidx.appcompat.app.ActionBar)22 Toolbar (androidx.appcompat.widget.Toolbar)19 View (android.view.View)18 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)10 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 Intent (android.content.Intent)6 TextView (android.widget.TextView)6 Fragment (androidx.fragment.app.Fragment)6 Activity (android.app.Activity)5 Bundle (android.os.Bundle)5 BindView (butterknife.BindView)5 LayoutInflater (android.view.LayoutInflater)4 ImageView (android.widget.ImageView)4 ScrollView (android.widget.ScrollView)4 List (java.util.List)4 Nullable (androidx.annotation.Nullable)3 TargetApi (android.annotation.TargetApi)2 Dialog (android.app.Dialog)2 SharedPreferences (android.content.SharedPreferences)2