Search in sources :

Example 41 with CallSuper

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);
}
Also used : Bundle(android.os.Bundle) CallSuper(androidx.annotation.CallSuper)

Example 42 with CallSuper

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));
        }
    }
}
Also used : CircularProgressButtonUtil.setSpinning(org.thoughtcrime.securesms.util.CircularProgressButtonUtil.setSpinning) Bundle(android.os.Bundle) NonNull(androidx.annotation.NonNull) LifecycleDisposable(org.thoughtcrime.securesms.util.LifecycleDisposable) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder) ViewUtil(org.thoughtcrime.securesms.util.ViewUtil) R(org.thoughtcrime.securesms.R) Toast(android.widget.Toast) View(android.view.View) ServiceUtil(org.thoughtcrime.securesms.util.ServiceUtil) CircularProgressButton(com.dd.CircularProgressButton) CircularProgressButtonUtil.cancelSpinning(org.thoughtcrime.securesms.util.CircularProgressButtonUtil.cancelSpinning) PinKeyboardType(org.thoughtcrime.securesms.lock.v2.PinKeyboardType) RegistrationViewDelegate.setDebugLogSubmitMultiTapView(org.thoughtcrime.securesms.registration.fragments.RegistrationViewDelegate.setDebugLogSubmitMultiTapView) InputType(android.text.InputType) BaseRegistrationViewModel(org.thoughtcrime.securesms.registration.viewmodel.BaseRegistrationViewModel) CallSuper(androidx.annotation.CallSuper) TokenData(org.thoughtcrime.securesms.pin.TokenData) TimeUnit(java.util.concurrent.TimeUnit) Log(org.signal.core.util.logging.Log) AndroidSchedulers(io.reactivex.rxjava3.android.schedulers.AndroidSchedulers) StringRes(androidx.annotation.StringRes) TextView(android.widget.TextView) Nullable(androidx.annotation.Nullable) Disposable(io.reactivex.rxjava3.disposables.Disposable) LoggingFragment(org.thoughtcrime.securesms.LoggingFragment) EditorInfo(android.view.inputmethod.EditorInfo) EditText(android.widget.EditText) Resources(android.content.res.Resources) PinKeyboardType(org.thoughtcrime.securesms.lock.v2.PinKeyboardType) TokenData(org.thoughtcrime.securesms.pin.TokenData) MaterialAlertDialogBuilder(com.google.android.material.dialog.MaterialAlertDialogBuilder) CallSuper(androidx.annotation.CallSuper)

Example 43 with CallSuper

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;
// }
}
Also used : Intent(android.content.Intent) CallSuper(androidx.annotation.CallSuper)

Example 44 with CallSuper

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;
}
Also used : BasePreferenceController(com.android.settings.core.BasePreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) PreferenceControllerMixin(com.android.settings.core.PreferenceControllerMixin) ArrayList(java.util.ArrayList) CallSuper(androidx.annotation.CallSuper)

Example 45 with CallSuper

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();
    }
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) CallSuper(androidx.annotation.CallSuper)

Aggregations

CallSuper (androidx.annotation.CallSuper)45 BasePreferenceController (com.android.settings.core.BasePreferenceController)8 PreferenceControllerMixin (com.android.settings.core.PreferenceControllerMixin)8 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)8 ArrayList (java.util.ArrayList)8 Bundle (android.os.Bundle)6 Nullable (androidx.annotation.Nullable)6 View (android.view.View)4 TextView (android.widget.TextView)4 FragmentActivity (androidx.fragment.app.FragmentActivity)4 BaseRegistrationViewModel (org.thoughtcrime.securesms.registration.viewmodel.BaseRegistrationViewModel)4 SuppressLint (android.annotation.SuppressLint)3 TypedArray (android.content.res.TypedArray)3 SearchIndexableRaw (com.android.settingslib.search.SearchIndexableRaw)3 Intent (android.content.Intent)2 IntentFilter (android.content.IntentFilter)2 Resources (android.content.res.Resources)2 Paint (android.graphics.Paint)2 InputType (android.text.InputType)2 EditorInfo (android.view.inputmethod.EditorInfo)2