use of androidx.fragment.app.Fragment in project android by owncloud.
the class FolderPickerActivity method getListOfFilesFragment.
protected OCFileListFragment getListOfFilesFragment() {
Fragment listOfFiles = getSupportFragmentManager().findFragmentByTag(FolderPickerActivity.TAG_LIST_OF_FOLDERS);
if (listOfFiles != null) {
return (OCFileListFragment) listOfFiles;
}
Timber.e("Access to unexisting list of files fragment!!");
return null;
}
use of androidx.fragment.app.Fragment in project android by owncloud.
the class BaseActivity method dismissLoadingDialog.
/**
* Dismiss loading dialog
*/
public void dismissLoadingDialog() {
Fragment frag = getSupportFragmentManager().findFragmentByTag(DIALOG_WAIT_TAG);
if (frag == null) {
return;
}
Timber.d("dismiss loading dialog");
LoadingDialog loading = (LoadingDialog) frag;
loading.dismiss();
}
use of androidx.fragment.app.Fragment in project android by owncloud.
the class FileMenuFilter method anyFileVideoPreviewing.
private boolean anyFileVideoPreviewing() {
final FragmentActivity activity = (FragmentActivity) mContext;
Fragment secondFragment = activity.getSupportFragmentManager().findFragmentByTag(TAG_SECOND_FRAGMENT);
boolean videoPreviewing = false;
if (secondFragment instanceof PreviewVideoFragment) {
for (int i = 0; !videoPreviewing && i < mFiles.size(); i++) {
videoPreviewing = ((PreviewVideoFragment) secondFragment).getFile().equals(mFiles.get(i));
}
}
return videoPreviewing;
}
use of androidx.fragment.app.Fragment in project banner by youth5201314.
the class Vp2FragmentRecyclerviewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vp2_fragment_recyclerview);
ButterKnife.bind(this);
viewPager2.setAdapter(new FragmentStateAdapter(this) {
@NonNull
@Override
public Fragment createFragment(int position) {
if (position == 0) {
return BannerListFragment.newInstance(position);
} else if (position == 1) {
return BlankFragment.newInstance();
} else {
return BannerFragment.newInstance();
}
}
@Override
public int getItemCount() {
return 3;
}
});
new TabLayoutMediator(mTabLayout, viewPager2, (tab, position) -> {
tab.setText("页面" + position);
}).attach();
mBanner.addBannerLifecycleObserver(this).setAdapter(new ImageAdapter(DataBean.getTestData())).setIntercept(false).setIndicator(new CircleIndicator(this));
}
use of androidx.fragment.app.Fragment in project kdeconnect-android by KDE.
the class MprisNowPlayingFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (activityMprisBinding == null) {
activityMprisBinding = MprisNowPlayingBinding.inflate(inflater);
mprisControlBinding = activityMprisBinding.mprisControl;
String targetPlayerName = "";
Intent activityIntent = requireActivity().getIntent();
activityIntent.getStringExtra("player");
activityIntent.removeExtra("player");
if (TextUtils.isEmpty(targetPlayerName)) {
if (savedInstanceState != null) {
targetPlayerName = savedInstanceState.getString("targetPlayer");
}
}
deviceId = requireArguments().getString(MprisPlugin.DEVICE_ID_KEY);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(requireContext());
String interval_time_str = prefs.getString(getString(R.string.mpris_time_key), getString(R.string.mpris_time_default));
final int interval_time = Integer.parseInt(interval_time_str);
BackgroundService.RunCommand(requireContext(), service -> service.addConnectionListener(connectionReceiver));
connectToPlugin(targetPlayerName);
performActionOnClick(mprisControlBinding.loopButton, p -> {
switch(p.getLoopStatus()) {
case "None":
p.setLoopStatus("Track");
break;
case "Track":
p.setLoopStatus("Playlist");
break;
case "Playlist":
p.setLoopStatus("None");
break;
}
});
performActionOnClick(mprisControlBinding.playButton, MprisPlugin.MprisPlayer::playPause);
performActionOnClick(mprisControlBinding.shuffleButton, p -> p.setShuffle(!p.getShuffle()));
performActionOnClick(mprisControlBinding.prevButton, MprisPlugin.MprisPlayer::previous);
performActionOnClick(mprisControlBinding.rewButton, p -> targetPlayer.seek(interval_time * -1));
performActionOnClick(mprisControlBinding.ffButton, p -> p.seek(interval_time));
performActionOnClick(mprisControlBinding.nextButton, MprisPlugin.MprisPlayer::next);
performActionOnClick(mprisControlBinding.stopButton, MprisPlugin.MprisPlayer::stop);
mprisControlBinding.volumeSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(final SeekBar seekBar) {
BackgroundService.RunCommand(requireContext(), service -> {
if (targetPlayer == null)
return;
targetPlayer.setVolume(seekBar.getProgress());
});
}
});
positionSeekUpdateRunnable = () -> {
Context context = getContext();
// Fragment was already detached
if (context == null)
return;
BackgroundService.RunCommand(context, service -> {
if (targetPlayer != null) {
mprisControlBinding.positionSeek.setProgress((int) (targetPlayer.getPosition()));
}
positionSeekUpdateHandler.removeCallbacks(positionSeekUpdateRunnable);
positionSeekUpdateHandler.postDelayed(positionSeekUpdateRunnable, 1000);
});
};
positionSeekUpdateHandler.postDelayed(positionSeekUpdateRunnable, 200);
mprisControlBinding.positionSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean byUser) {
mprisControlBinding.progressTextview.setText(milisToProgress(progress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
positionSeekUpdateHandler.removeCallbacks(positionSeekUpdateRunnable);
}
@Override
public void onStopTrackingTouch(final SeekBar seekBar) {
BackgroundService.RunCommand(requireContext(), service -> {
if (targetPlayer != null) {
targetPlayer.setPosition(seekBar.getProgress());
}
positionSeekUpdateHandler.postDelayed(positionSeekUpdateRunnable, 200);
});
}
});
mprisControlBinding.nowPlayingTextview.setSelected(true);
}
return activityMprisBinding.getRoot();
}
Aggregations