use of androidx.fragment.app.FragmentActivity in project Douya by DreaminginCodeZH.
the class UserReviewListResource method attachTo.
public static UserReviewListResource attachTo(String userIdOrUid, Fragment fragment, String tag, int requestCode) {
FragmentActivity activity = fragment.getActivity();
UserReviewListResource instance = FragmentUtils.findByTag(activity, tag);
if (instance == null) {
instance = newInstance(userIdOrUid);
FragmentUtils.add(instance, activity, tag);
}
instance.setTarget(fragment, requestCode);
return instance;
}
use of androidx.fragment.app.FragmentActivity in project Douya by DreaminginCodeZH.
the class ItemReviewListResource method attachTo.
public static ItemReviewListResource attachTo(CollectableItem.Type itemType, long itemId, Fragment fragment, String tag, int requestCode) {
FragmentActivity activity = fragment.getActivity();
ItemReviewListResource instance = FragmentUtils.findByTag(activity, tag);
if (instance == null) {
instance = newInstance(itemType, itemId);
FragmentUtils.add(instance, activity, tag);
}
instance.setTarget(fragment, requestCode);
return instance;
}
use of androidx.fragment.app.FragmentActivity in project Gadgetbridge by Freeyourgadget.
the class LiveActivityFragment method startActivityPulse.
private ScheduledExecutorService startActivityPulse() {
ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
service.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
FragmentActivity activity = LiveActivityFragment.this.getActivity();
if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
pulse();
}
});
}
}
}, 0, getPulseIntervalMillis(), TimeUnit.MILLISECONDS);
return service;
}
use of androidx.fragment.app.FragmentActivity in project Signal-Android by WhisperSystems.
the class StoragePreferenceFragment method onCreate.
@Override
public void onCreate(@Nullable Bundle paramBundle) {
super.onCreate(paramBundle);
findPreference("pref_storage_clear_message_history").setOnPreferenceClickListener(new ClearMessageHistoryClickListener());
trimLength = findPreference(SettingsValues.THREAD_TRIM_LENGTH);
trimLength.setOnPreferenceClickListener(p -> {
updateToolbarTitle(R.string.preferences__conversation_length_limit);
pushFragment(BaseSettingsFragment.create(new ConversationLengthLimitConfiguration()));
return true;
});
keepMessages = findPreference(SettingsValues.KEEP_MESSAGES_DURATION);
keepMessages.setOnPreferenceClickListener(p -> {
updateToolbarTitle(R.string.preferences__keep_messages);
pushFragment(BaseSettingsFragment.create(new KeepMessagesConfiguration()));
return true;
});
StoragePreferenceCategory storageCategory = (StoragePreferenceCategory) findPreference("pref_storage_category");
FragmentActivity activity = requireActivity();
ApplicationPreferencesViewModel viewModel = ApplicationPreferencesViewModel.getApplicationPreferencesViewModel(activity);
storageCategory.setOnFreeUpSpace(() -> activity.startActivity(MediaOverviewActivity.forAll(activity)));
viewModel.getStorageBreakdown().observe(activity, storageCategory::setStorage);
}
use of androidx.fragment.app.FragmentActivity in project Signal-Android by WhisperSystems.
the class RegistrationCompleteFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
FragmentActivity activity = requireActivity();
RegistrationViewModel viewModel = new ViewModelProvider(activity).get(RegistrationViewModel.class);
if (SignalStore.storageService().needsAccountRestore()) {
Log.i(TAG, "Performing pin restore");
activity.startActivity(new Intent(activity, PinRestoreActivity.class));
} else if (!viewModel.isReregister()) {
boolean needsProfile = Recipient.self().getProfileName().isEmpty() || !AvatarHelper.hasAvatar(activity, Recipient.self().getId());
boolean needsPin = !SignalStore.kbsValues().hasPin();
Log.i(TAG, "Pin restore flow not required." + " profile name: " + Recipient.self().getProfileName().isEmpty() + " profile avatar: " + !AvatarHelper.hasAvatar(activity, Recipient.self().getId()) + " needsPin:" + needsPin);
Intent startIntent = MainActivity.clearTop(activity);
if (needsPin) {
startIntent = chainIntents(CreateKbsPinActivity.getIntentForPinCreate(requireContext()), startIntent);
}
if (needsProfile) {
startIntent = chainIntents(EditProfileActivity.getIntentForUserProfile(activity), startIntent);
}
if (!needsProfile && !needsPin) {
ApplicationDependencies.getJobManager().startChain(new ProfileUploadJob()).then(Arrays.asList(new MultiDeviceProfileKeyUpdateJob(), new MultiDeviceProfileContentUpdateJob())).enqueue();
RegistrationUtil.maybeMarkRegistrationComplete(requireContext());
}
activity.startActivity(startIntent);
}
activity.finish();
ActivityNavigator.applyPopAnimationsToPendingTransition(activity);
}
Aggregations