Search in sources :

Example 16 with CallSuper

use of androidx.annotation.CallSuper in project android-oss by kickstarter.

the class BaseFragment method onResume.

@CallSuper
@Override
public void onResume() {
    super.onResume();
    Timber.d("onResume %s", this.toString());
    this.lifecycle.onNext(FragmentEvent.RESUME);
    assignViewModel(null);
    if (this.viewModel != null) {
        this.viewModel.onResume(this);
        final FragmentActivity activity = getActivity();
        if (activity != null) {
            activity.registerReceiver(this.optimizelyReadyReceiver, new IntentFilter(ExperimentsClientTypeKt.EXPERIMENTS_CLIENT_READY));
        }
    }
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) IntentFilter(android.content.IntentFilter) CallSuper(androidx.annotation.CallSuper)

Example 17 with CallSuper

use of androidx.annotation.CallSuper in project android-oss by kickstarter.

the class BaseFragment 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 18 with CallSuper

use of androidx.annotation.CallSuper in project Signal-Android by signalapp.

the class BaseAccountLockedFragment method onViewCreated.

@Override
@CallSuper
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    TextView description = view.findViewById(R.id.account_locked_description);
    BaseRegistrationViewModel viewModel = getViewModel();
    viewModel.getLockedTimeRemaining().observe(getViewLifecycleOwner(), t -> description.setText(getString(R.string.AccountLockedFragment__your_account_has_been_locked_to_protect_your_privacy, durationToDays(t))));
    view.findViewById(R.id.account_locked_next).setOnClickListener(v -> onNext());
    view.findViewById(R.id.account_locked_learn_more).setOnClickListener(v -> learnMore());
    requireActivity().getOnBackPressedDispatcher().addCallback(getViewLifecycleOwner(), new OnBackPressedCallback(true) {

        @Override
        public void handleOnBackPressed() {
            onNext();
        }
    });
}
Also used : BaseRegistrationViewModel(org.thoughtcrime.securesms.registration.viewmodel.BaseRegistrationViewModel) OnBackPressedCallback(androidx.activity.OnBackPressedCallback) TextView(android.widget.TextView) CallSuper(androidx.annotation.CallSuper)

Example 19 with CallSuper

use of androidx.annotation.CallSuper in project android_packages_apps_Settings by omnirom.

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 20 with CallSuper

use of androidx.annotation.CallSuper in project android_packages_apps_Settings by omnirom.

the class BaseSearchIndexProvider method getDynamicRawDataToIndex.

@Override
@CallSuper
public List<SearchIndexableRaw> getDynamicRawDataToIndex(Context context, boolean enabled) {
    final List<SearchIndexableRaw> dynamicRaws = new ArrayList<>();
    if (!isPageSearchEnabled(context)) {
        // Entire page should be suppressed, do not add dynamic raw data.
        return dynamicRaws;
    }
    final List<AbstractPreferenceController> controllers = getPreferenceControllers(context);
    if (controllers == null || controllers.isEmpty()) {
        return dynamicRaws;
    }
    for (AbstractPreferenceController controller : controllers) {
        if (controller instanceof PreferenceControllerMixin) {
            ((PreferenceControllerMixin) controller).updateDynamicRawDataToIndex(dynamicRaws);
        } else if (controller instanceof BasePreferenceController) {
            ((BasePreferenceController) controller).updateDynamicRawDataToIndex(dynamicRaws);
        } else {
            Log.e(TAG, controller.getClass().getName() + " must implement " + PreferenceControllerMixin.class.getName() + " treating the dynamic indexable");
        }
    }
    return dynamicRaws;
}
Also used : BasePreferenceController(com.android.settings.core.BasePreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) PreferenceControllerMixin(com.android.settings.core.PreferenceControllerMixin) ArrayList(java.util.ArrayList) SearchIndexableRaw(com.android.settingslib.search.SearchIndexableRaw) 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