Search in sources :

Example 11 with VisibleForTesting

use of androidx.annotation.VisibleForTesting in project fresco by facebook.

the class BasePool method trimToNothing.

/**
 * Gets rid of all free values in the pool At the end of this method, mFreeSpace will be zero
 * (reflecting that there are no more free values in the pool). mUsedSpace will however not be
 * reset, since that's a reflection of the values that were allocated via the pool, but are in use
 * elsewhere
 */
@VisibleForTesting
void trimToNothing() {
    final List<Bucket<V>> bucketsToTrim;
    synchronized (this) {
        if (mPoolParams.fixBucketsReinitialization) {
            bucketsToTrim = refillBuckets();
        } else {
            bucketsToTrim = new ArrayList<>(mBuckets.size());
            final SparseIntArray inUseCounts = new SparseIntArray();
            for (int i = 0; i < mBuckets.size(); ++i) {
                final Bucket<V> bucket = Preconditions.checkNotNull(mBuckets.valueAt(i));
                if (bucket.getFreeListSize() > 0) {
                    bucketsToTrim.add(bucket);
                }
                inUseCounts.put(mBuckets.keyAt(i), bucket.getInUseCount());
            }
            legacyInitBuckets(inUseCounts);
        }
        // free up the stats
        mFree.reset();
        logStats();
    }
    // the pool parameters 'may' have changed.
    onParamsChanged();
    // This is true even for a concurrent trim() call
    for (int i = 0; i < bucketsToTrim.size(); ++i) {
        final Bucket<V> bucket = bucketsToTrim.get(i);
        while (true) {
            // what happens if we run into an exception during the recycle. I'm going to ignore
            // these exceptions for now, and let the GC handle the rest of the to-be-recycled-bitmaps
            // in its usual fashion
            V item = bucket.pop();
            if (item == null) {
                break;
            }
            free(item);
        }
    }
}
Also used : SparseIntArray(android.util.SparseIntArray) SuppressLint(android.annotation.SuppressLint) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 12 with VisibleForTesting

use of androidx.annotation.VisibleForTesting in project ETSMobile-Android2 by ApplETS.

the class MoodleViewModel method filterAssignmentCourses.

/**
 * Filter courses by removing the courses with no assignment
 *
 * @param assignmentCourses
 * @return filtered courses
 */
@VisibleForTesting
List<MoodleAssignmentCourse> filterAssignmentCourses(List<MoodleAssignmentCourse> assignmentCourses) {
    List<MoodleAssignmentCourse> filteredCourses = new ArrayList<>();
    for (MoodleAssignmentCourse course : assignmentCourses) {
        int nbAssignments = course.getAssignments().size();
        if (nbAssignments != 0) {
            /*
                 Si les devoirs antérieurs ne doivent pas être affichés, ceux-ci ne doivent pas être
                 pris en compte.
                 */
            if (!isDisplayPastAssignments()) {
                for (MoodleAssignment assignment : course.getAssignments()) {
                    Date dueDate = assignment.getDueDateObj();
                    Date currentDate = new Date();
                    if (dueDate.before(currentDate))
                        nbAssignments--;
                }
            }
            // Ajout du cours si celui-ci contient des devoirs
            if (nbAssignments != 0)
                filteredCourses.add(course);
        }
    }
    return filteredCourses;
}
Also used : MoodleAssignmentCourse(ca.etsmtl.applets.etsmobile.model.moodle.MoodleAssignmentCourse) ArrayList(java.util.ArrayList) MoodleAssignment(ca.etsmtl.applets.etsmobile.model.moodle.MoodleAssignment) Date(java.util.Date) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 13 with VisibleForTesting

use of androidx.annotation.VisibleForTesting in project android-testing by googlesamples.

the class ContactsActivity method createResultData.

@VisibleForTesting
static Intent createResultData(String phoneNumber) {
    final Intent resultData = new Intent();
    resultData.putExtra(KEY_PHONE_NUMBER, phoneNumber);
    return resultData;
}
Also used : Intent(android.content.Intent) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 14 with VisibleForTesting

use of androidx.annotation.VisibleForTesting in project quickstart-android by firebase.

the class MainActivity method buildDeepLink.

// [END on_create]
/**
 * Build a Firebase Dynamic Link.
 * https://firebase.google.com/docs/dynamic-links/android/create#create-a-dynamic-link-from-parameters
 *
 * @param deepLink the deep link your app will open. This link must be a valid URL and use the
 *                 HTTP or HTTPS scheme.
 * @param minVersion the {@code versionCode} of the minimum version of your app that can open
 *                   the deep link. If the installed app is an older version, the user is taken
 *                   to the Play store to upgrade the app. Pass 0 if you do not
 *                   require a minimum version.
 * @return a {@link Uri} representing a properly formed deep link.
 */
@VisibleForTesting
public Uri buildDeepLink(@NonNull Uri deepLink, int minVersion) {
    String uriPrefix = getString(R.string.dynamic_links_uri_prefix);
    // Set dynamic link parameters:
    // * URI prefix (required)
    // * Android Parameters (required)
    // * Deep link
    // [START build_dynamic_link]
    DynamicLink.Builder builder = FirebaseDynamicLinks.getInstance().createDynamicLink().setDomainUriPrefix(uriPrefix).setAndroidParameters(new DynamicLink.AndroidParameters.Builder().setMinimumVersion(minVersion).build()).setLink(deepLink);
    // Build the dynamic link
    DynamicLink link = builder.buildDynamicLink();
    // Return the dynamic link as a URI
    return link.getUri();
}
Also used : DynamicLink(com.google.firebase.dynamiclinks.DynamicLink) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 15 with VisibleForTesting

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

the class MetadataRetriever method retrieveMetadata.

@VisibleForTesting
static /* package */
ListenableFuture<TrackGroupArray> retrieveMetadata(Context context, MediaItem mediaItem, Clock clock) {
    ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory().setMp4ExtractorFlags(Mp4Extractor.FLAG_READ_MOTION_PHOTO_METADATA | Mp4Extractor.FLAG_READ_SEF_DATA);
    MediaSource.Factory mediaSourceFactory = new DefaultMediaSourceFactory(context, extractorsFactory);
    return retrieveMetadata(mediaSourceFactory, mediaItem, clock);
}
Also used : DefaultExtractorsFactory(com.google.android.exoplayer2.extractor.DefaultExtractorsFactory) MediaSource(com.google.android.exoplayer2.source.MediaSource) ExtractorsFactory(com.google.android.exoplayer2.extractor.ExtractorsFactory) DefaultExtractorsFactory(com.google.android.exoplayer2.extractor.DefaultExtractorsFactory) DefaultMediaSourceFactory(com.google.android.exoplayer2.source.DefaultMediaSourceFactory) VisibleForTesting(androidx.annotation.VisibleForTesting)

Aggregations

VisibleForTesting (androidx.annotation.VisibleForTesting)385 Intent (android.content.Intent)36 ArrayList (java.util.ArrayList)36 Context (android.content.Context)34 Bundle (android.os.Bundle)30 Uri (android.net.Uri)18 View (android.view.View)18 Preference (androidx.preference.Preference)18 TextView (android.widget.TextView)16 SubSettingLauncher (com.android.settings.core.SubSettingLauncher)16 MetricsFeatureProvider (com.android.settingslib.core.instrumentation.MetricsFeatureProvider)16 SuppressLint (android.annotation.SuppressLint)15 Activity (android.app.Activity)14 RemoteException (android.os.RemoteException)14 SubscriptionInfo (android.telephony.SubscriptionInfo)12 ImageView (android.widget.ImageView)12 BluetoothDevice (android.bluetooth.BluetoothDevice)11 ComponentName (android.content.ComponentName)11 Drawable (android.graphics.drawable.Drawable)11 SharedPreferences (android.content.SharedPreferences)10