Search in sources :

Example 6 with CallSuper

use of androidx.annotation.CallSuper in project ExoPlayer by google.

the class MatroskaExtractor method startMasterElement.

/**
 * Called when the start of a master element is encountered.
 *
 * @see EbmlProcessor#startMasterElement(int, long, long)
 */
@CallSuper
protected void startMasterElement(int id, long contentPosition, long contentSize) throws ParserException {
    assertInitialized();
    switch(id) {
        case ID_SEGMENT:
            if (segmentContentPosition != C.POSITION_UNSET && segmentContentPosition != contentPosition) {
                throw ParserException.createForMalformedContainer("Multiple Segment elements not supported", /* cause= */
                null);
            }
            segmentContentPosition = contentPosition;
            segmentContentSize = contentSize;
            break;
        case ID_SEEK:
            seekEntryId = UNSET_ENTRY_ID;
            seekEntryPosition = C.POSITION_UNSET;
            break;
        case ID_CUES:
            cueTimesUs = new LongArray();
            cueClusterPositions = new LongArray();
            break;
        case ID_CUE_POINT:
            seenClusterPositionForCurrentCuePoint = false;
            break;
        case ID_CLUSTER:
            if (!sentSeekMap) {
                // We need to build cues before parsing the cluster.
                if (seekForCuesEnabled && cuesContentPosition != C.POSITION_UNSET) {
                    // We know where the Cues element is located. Seek to request it.
                    seekForCues = true;
                } else {
                    // We don't know where the Cues element is located. It's most likely omitted. Allow
                    // playback, but disable seeking.
                    extractorOutput.seekMap(new SeekMap.Unseekable(durationUs));
                    sentSeekMap = true;
                }
            }
            break;
        case ID_BLOCK_GROUP:
            blockHasReferenceBlock = false;
            break;
        case ID_CONTENT_ENCODING:
            // TODO: check and fail if more than one content encoding is present.
            break;
        case ID_CONTENT_ENCRYPTION:
            getCurrentTrack(id).hasContentEncryption = true;
            break;
        case ID_TRACK_ENTRY:
            currentTrack = new Track();
            break;
        case ID_MASTERING_METADATA:
            getCurrentTrack(id).hasColorInfo = true;
            break;
        default:
            break;
    }
}
Also used : LongArray(com.google.android.exoplayer2.util.LongArray) SeekMap(com.google.android.exoplayer2.extractor.SeekMap) CallSuper(androidx.annotation.CallSuper)

Example 7 with CallSuper

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

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

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

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

use of androidx.annotation.CallSuper in project FlexibleAdapter by davideas.

the class FlexibleAdapter method onViewDetachedFromWindow.

@CallSuper
@Override
public void onViewDetachedFromWindow(@NonNull RecyclerView.ViewHolder holder) {
    int position = holder.getAdapterPosition();
    // log.v("onViewDetached Holder=%s position=%s", getClassName(holder), position);
    T item = getItem(position);
    if (item != null) {
        item.onViewDetached(this, holder, position);
    }
}
Also used : SuppressLint(android.annotation.SuppressLint) CallSuper(androidx.annotation.CallSuper)

Example 10 with CallSuper

use of androidx.annotation.CallSuper in project FlexibleAdapter by davideas.

the class FlexibleAdapter method onViewRecycled.

@CallSuper
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
    super.onViewRecycled(holder);
    if (areHeadersSticky()) {
        // #297 - Empty (Invisible) Header Item when Using Sticky Headers
        holder.itemView.setVisibility(View.VISIBLE);
    }
    int position = holder.getAdapterPosition();
    T item = getItem(position);
    if (item != null) {
        item.unbindViewHolder(this, holder, position);
    }
}
Also used : SuppressLint(android.annotation.SuppressLint) 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