use of androidx.annotation.CallSuper in project android-oss by kickstarter.
the class BaseBottomSheetDialogFragment method onSaveInstanceState.
@CallSuper
@Override
public void onSaveInstanceState(@NonNull final Bundle outState) {
super.onSaveInstanceState(outState);
final Bundle viewModelEnvelope = new Bundle();
if (this.viewModel != null) {
FragmentViewModelManager.getInstance().save(this.viewModel, viewModelEnvelope);
}
outState.putBundle(VIEW_MODEL_KEY, viewModelEnvelope);
}
use of androidx.annotation.CallSuper in project Signal-Android by signalapp.
the class BaseRegistrationLockFragment method onViewCreated.
@Override
@CallSuper
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setDebugLogSubmitMultiTapView(view.findViewById(R.id.kbs_lock_pin_title));
pinEntry = view.findViewById(R.id.kbs_lock_pin_input);
pinButton = view.findViewById(R.id.kbs_lock_pin_confirm);
errorLabel = view.findViewById(R.id.kbs_lock_pin_input_label);
keyboardToggle = view.findViewById(R.id.kbs_lock_keyboard_toggle);
forgotPin = view.findViewById(R.id.kbs_lock_forgot_pin);
RegistrationLockFragmentArgs args = RegistrationLockFragmentArgs.fromBundle(requireArguments());
timeRemaining = args.getTimeRemaining();
forgotPin.setVisibility(View.GONE);
forgotPin.setOnClickListener(v -> handleForgottenPin(timeRemaining));
pinEntry.setImeOptions(EditorInfo.IME_ACTION_DONE);
pinEntry.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
ViewUtil.hideKeyboard(requireContext(), v);
handlePinEntry();
return true;
}
return false;
});
enableAndFocusPinEntry();
pinButton.setOnClickListener((v) -> {
ViewUtil.hideKeyboard(requireContext(), pinEntry);
handlePinEntry();
});
keyboardToggle.setOnClickListener((v) -> {
PinKeyboardType keyboardType = getPinEntryKeyboardType();
updateKeyboard(keyboardType.getOther());
keyboardToggle.setText(resolveKeyboardToggleText(keyboardType));
});
PinKeyboardType keyboardType = getPinEntryKeyboardType().getOther();
keyboardToggle.setText(resolveKeyboardToggleText(keyboardType));
disposables.bindTo(getViewLifecycleOwner().getLifecycle());
viewModel = getViewModel();
viewModel.getLockedTimeRemaining().observe(getViewLifecycleOwner(), t -> timeRemaining = t);
TokenData keyBackupCurrentToken = viewModel.getKeyBackupCurrentToken();
if (keyBackupCurrentToken != null) {
int triesRemaining = keyBackupCurrentToken.getTriesRemaining();
if (triesRemaining <= 3) {
int daysRemaining = getLockoutDays(timeRemaining);
new MaterialAlertDialogBuilder(requireContext()).setTitle(R.string.RegistrationLockFragment__not_many_tries_left).setMessage(getTriesRemainingDialogMessage(triesRemaining, daysRemaining)).setPositiveButton(android.R.string.ok, null).setNeutralButton(R.string.PinRestoreEntryFragment_contact_support, (dialog, which) -> sendEmailToSupport()).show();
}
if (triesRemaining < 5) {
errorLabel.setText(requireContext().getResources().getQuantityString(R.plurals.RegistrationLockFragment__d_attempts_remaining, triesRemaining, triesRemaining));
}
}
}
use of androidx.annotation.CallSuper in project BaseProject by feer921.
the class TheActivityLifeCycleCallback method onActivityFinish.
// /**
// * 获取app当前在栈顶的Activity
// * @return
// */
// public Activity getTheAppTopActivity() {
// return theAppTopActivity;
// }
/**
* added by fee 2019-05-16:由于{#android.app.Application.ActivityLifecycleCallbacks}该接口中没有finish()
* 的回调,则主动加一个
* 另由于Activity的onDestroy()方法回调不及时,会导致本类统计的existActivityCount 不准确,所以在finish()方法中统计
* 更准确一点
*/
// 基类有逻辑处理,则需要调用本基类
@CallSuper
public void onActivityFinish(Activity activity) {
// 一般不为null
Intent intentFlag = activity.getIntent();
boolean needAdd = false;
if (intentFlag == null) {
intentFlag = new Intent();
needAdd = true;
}
intentFlag.putExtra("onActivityFinish", true);
if (needAdd) {
activity.setIntent(intentFlag);
}
existActivityCount--;
if (LIFE_CIRCLE_DEBUG) {
CommonLog.i(TAG, "-->onActivityFinish() activity = " + activity);
}
// if (activity == theAppTopActivity) {
// theAppTopActivity = null;
// }
}
use of androidx.annotation.CallSuper in project android_packages_apps_Settings by SudaMod.
the class BaseSearchIndexProvider method getNonIndexableKeys.
@Override
@CallSuper
public List<String> getNonIndexableKeys(Context context) {
if (!isPageSearchEnabled(context)) {
// Entire page should be suppressed, mark all keys from this page as non-indexable.
return getNonIndexableKeysFromXml(context, true);
}
final List<String> nonIndexableKeys = new ArrayList<>();
nonIndexableKeys.addAll(getNonIndexableKeysFromXml(context, false));
final List<AbstractPreferenceController> controllers = getPreferenceControllers(context);
if (controllers != null && !controllers.isEmpty()) {
for (AbstractPreferenceController controller : controllers) {
if (controller instanceof PreferenceControllerMixin) {
((PreferenceControllerMixin) controller).updateNonIndexableKeys(nonIndexableKeys);
} else if (controller instanceof BasePreferenceController) {
((BasePreferenceController) controller).updateNonIndexableKeys(nonIndexableKeys);
} else {
Log.e(TAG, controller.getClass().getName() + " must implement " + PreferenceControllerMixin.class.getName() + " treating the key non-indexable");
nonIndexableKeys.add(controller.getPreferenceKey());
}
}
}
return nonIndexableKeys;
}
use of androidx.annotation.CallSuper in project Auto.js by hyb1996.
the class ViewPagerFragment method onPageShow.
@CallSuper
public void onPageShow() {
mShown = true;
if (mFabRotation == ROTATION_GONE) {
if (mFab.getVisibility() == View.VISIBLE) {
mFab.hide();
}
mFab.setOnClickListener(null);
return;
}
mFab.setOnClickListener(mOnFabClickListener);
if (mFab.getVisibility() != View.VISIBLE) {
mFab.setRotation(mFabRotation);
mFab.show();
} else if (Math.abs(mFab.getRotation() - mFabRotation) > 0.1f) {
mFab.animate().rotation(mFabRotation).setDuration(300).setInterpolator(new FastOutSlowInInterpolator()).start();
}
}
Aggregations