use of androidx.viewpager.widget.ViewPager in project Phonograph by kabouzeid.
the class NowPlayingScreenPreferenceDialog method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@SuppressLint("InflateParams") View view = LayoutInflater.from(getContext()).inflate(R.layout.preference_dialog_now_playing_screen, null);
ViewPager viewPager = view.findViewById(R.id.now_playing_screen_view_pager);
viewPager.setAdapter(new NowPlayingScreenAdapter(getContext()));
viewPager.addOnPageChangeListener(this);
viewPager.setPageMargin((int) ViewUtil.convertDpToPixel(32, getResources()));
viewPager.setCurrentItem(PreferenceUtil.getInstance(getContext()).getNowPlayingScreen().ordinal());
InkPageIndicator pageIndicator = view.findViewById(R.id.page_indicator);
pageIndicator.setViewPager(viewPager);
pageIndicator.onPageSelected(viewPager.getCurrentItem());
return new MaterialDialog.Builder(getContext()).title(R.string.pref_title_now_playing_screen_appearance).positiveText(android.R.string.ok).negativeText(android.R.string.cancel).onAny(this).customView(view, false).build();
}
use of androidx.viewpager.widget.ViewPager in project MTweaks-KernelAdiutorMOD by morogoku.
the class ViewPagerDialog method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.viewpager_view, container, false);
ViewPager viewPager = rootView.findViewById(R.id.viewpager);
CirclePageIndicator indicator = rootView.findViewById(R.id.indicator);
viewPager.setAdapter(new RecyclerViewFragment.ViewPagerAdapter(getChildFragmentManager(), mFragments));
indicator.setViewPager(viewPager);
return rootView;
}
use of androidx.viewpager.widget.ViewPager in project MTweaks-KernelAdiutorMOD by morogoku.
the class DownloadsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_downloads);
initToolBar();
SupportedDownloads.KernelContent content = new SupportedDownloads.KernelContent(getIntent().getStringExtra(JSON_INTENT));
getSupportActionBar().setTitle(Utils.htmlFrom(content.getName()).toString());
final ViewPager viewPager = findViewById(R.id.viewpager);
LinkedHashMap<String, Fragment> items = new LinkedHashMap<>();
List<SupportedDownloads.KernelContent.Feature> features = content.getFeatures();
List<SupportedDownloads.KernelContent.Download> downloads = content.getDownloads();
if (content.getShortDescription() != null && content.getLongDescription() != null) {
items.put(getString(R.string.about), AboutFragment.newInstance(content));
}
if (features.size() > 0) {
items.put(getString(R.string.features), FeaturesFragment.newInstance(features));
}
if (downloads.size() > 0) {
items.put(getString(R.string.downloads), DownloadKernelFragment.newInstance(downloads));
}
viewPager.setOffscreenPageLimit(items.size());
PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager(), items);
viewPager.setAdapter(pagerAdapter);
TabLayout tabLayout = findViewById(R.id.tablayout);
tabLayout.setupWithViewPager(viewPager);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
}
use of androidx.viewpager.widget.ViewPager in project IITB-App by wncc.
the class ComplaintsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_complaints, container, false);
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("Complaints/Suggestions");
Utils.setSelectedMenuItem(getActivity(), R.id.nav_complaint);
Bundle bundle = getArguments();
userID = bundle.getString(Constants.USER_ID);
userProfileUrl = bundle.getString(Constants.CURRENT_USER_PROFILE_PICTURE);
CollapsingToolbarLayout collapsingToolbarLayout = view.findViewById(R.id.collapsing_toolbar);
collapsingToolbarLayout.setTitleEnabled(false);
ViewPager viewPager = view.findViewById(R.id.tab_viewpager);
slidingTabLayout = view.findViewById(R.id.sliding_tab_layout);
Button buttonVentIssues = view.findViewById(R.id.buttonVentIssues);
buttonVentIssues.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FileComplaintFragment fileComplaintFragment = new FileComplaintFragment();
fileComplaintFragment.setArguments(getArguments());
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.framelayout_for_fragment, fileComplaintFragment, Utils.getTag(fileComplaintFragment));
fragmentTransaction.addToBackStack("Complaint Fragment").commit();
}
});
slidingTabLayout = view.findViewById(R.id.sliding_tab_layout);
if (viewPager != null) {
setupViewPager(viewPager);
}
return view;
}
use of androidx.viewpager.widget.ViewPager in project SmoothRefreshLayout by dkzwm.
the class AutoRefreshUtil method autoRefresh.
public void autoRefresh(boolean atOnce, boolean autoRefreshUseSmoothScroll) {
if (mRefreshLayout != null) {
if (mStatus != SmoothRefreshLayout.SR_STATUS_INIT)
return;
if (mRefreshLayout.isNotYetInEdgeCannotMoveHeader()) {
if (mRefreshLayout.isVerticalOrientation()) {
ScrollCompat.flingCompat(mTargetView, -mMaximumFlingVelocity);
} else {
if (ViewCatcherUtil.isViewPager(mTargetView)) {
final ViewPager pager = (ViewPager) mTargetView;
final PagerAdapter adapter = pager.getAdapter();
if (adapter == null)
return;
if (adapter.getCount() <= 0)
return;
pager.setCurrentItem(0, true);
} else {
HorizontalScrollCompat.flingCompat(mTargetView, -mMaximumFlingVelocity);
}
}
mNeedToTriggerRefresh = true;
mCachedActionAtOnce = atOnce;
mCachedAutoRefreshUseSmoothScroll = autoRefreshUseSmoothScroll;
} else {
mRefreshLayout.autoRefresh(atOnce, autoRefreshUseSmoothScroll);
mNeedToTriggerRefresh = false;
mCachedActionAtOnce = false;
mCachedAutoRefreshUseSmoothScroll = false;
}
ViewCompat.postOnAnimation(mRefreshLayout, this);
}
}
Aggregations