List of usage examples for android.util SparseArray SparseArray
public SparseArray()
From source file:com.facebook.reactnative.androidsdk.FBGraphRequestModule.java
public FBGraphRequestModule(ReactApplicationContext reactContext) { super(reactContext); mResponses = new SparseArray<WritableMap>(); }
From source file:android.support.v7.content.res.AppCompatResources.java
private static void addColorStateListToCache(@NonNull Context context, @ColorRes int resId, @NonNull ColorStateList value) { synchronized (sColorStateCacheLock) { SparseArray<ColorStateListCacheEntry> entries = sColorStateCaches.get(context); if (entries == null) { entries = new SparseArray<>(); sColorStateCaches.put(context, entries); }/*from ww w . ja v a 2 s . c om*/ entries.append(resId, new ColorStateListCacheEntry(value, context.getResources().getConfiguration())); } }
From source file:org.chromium.chrome.browser.media.router.cast.CastMessageHandler.java
/** * Initializes a new {@link CastMessageHandler} instance. * @param session The {@link CastSession} for communicating with the Cast SDK. * @param provider The {@link CastMediaRouteProvider} for communicating with the page. *///from w w w .j a v a2 s . co m public CastMessageHandler(CastMediaRouteProvider provider) { mRouteProvider = provider; mRequests = new SparseArray<RequestRecord>(); mStopRequests = new ArrayMap<String, Queue<Integer>>(); mVolumeRequests = new ArrayDeque<RequestRecord>(); mHandler = new Handler(); synchronized (INIT_LOCK) { if (sMediaOverloadedMessageTypes == null) { sMediaOverloadedMessageTypes = new HashMap<String, String>(); sMediaOverloadedMessageTypes.put("STOP_MEDIA", "STOP"); sMediaOverloadedMessageTypes.put("MEDIA_SET_VOLUME", "SET_VOLUME"); sMediaOverloadedMessageTypes.put("MEDIA_GET_STATUS", "GET_STATUS"); } } }
From source file:com.quectel.presentationtest.PresentationTest.java
/** * Initialization of the Activity after it is first created. Must at least * call {@link android.app.Activity#setContentView setContentView()} to * describe what is to be displayed in the screen. *//*from w w w . ja va 2 s .com*/ @Override protected void onCreate(Bundle savedInstanceState) { // Be sure to call the super class. super.onCreate(savedInstanceState); // Restore saved instance state. if (savedInstanceState != null) { mSavedPresentationContents = savedInstanceState.getSparseParcelableArray(PRESENTATION_KEY); } else { mSavedPresentationContents = new SparseArray<DemoPresentationContents>(); } // Get the display manager service. mDisplayManager = (DisplayManager) getSystemService(Context.DISPLAY_SERVICE); // See assets/res/any/layout/presentation_activity.xml for this // view layout definition, which is being set here as // the content of our screen. setContentView(R.layout.presentation_activity); mDetector = new GestureDetectorCompat(this, new MyGestureListener()); // Set up checkbox to toggle between showing all displays or only presentation displays. mShowAllDisplaysCheckbox = (CheckBox) findViewById(R.id.show_all_displays); mShowAllDisplaysCheckbox.setOnCheckedChangeListener(this); // Set up the list of displays. mDisplayListAdapter = new DisplayListAdapter(this); mListView = (ListView) findViewById(R.id.display_list); mListView.setAdapter(mDisplayListAdapter); }
From source file:poche.fm.potunes.utils.TintManager.java
@Nullable public ColorStateList getColorStateList(@ColorRes int resId) { if (resId == 0) return null; final Context context = mContextRef.get(); if (context == null) return null; ColorStateList colorStateList = mCacheTintList != null ? mCacheTintList.get(resId) : null; Log.d(TAG, "getColorStateList: " + colorStateList); if (colorStateList == null) { Log.d(TAG, "getColorStateList: ?"); colorStateList = ColorStateListUtils.createColorStateList(context, resId); if (colorStateList != null) { if (mCacheTintList == null) { mCacheTintList = new SparseArray<>(); }/*from w ww. java2 s . c o m*/ mCacheTintList.append(resId, colorStateList); } } return colorStateList; }
From source file:net.wequick.small.webkit.WebActivity.java
private void cacheTitle(String url, CharSequence title) { if (sUrlTitles == null) { sUrlTitles = new SparseArray<CharSequence>(); }// www. j av a2s. c o m sUrlTitles.put(url.hashCode(), title); }
From source file:com.bilibili.magicasakura.utils.TintManager.java
@Nullable public ColorStateList getColorStateList(@ColorRes int resId) { if (resId == 0) return null; final Context context = mContextRef.get(); if (context == null) return null; ColorStateList colorStateList = mCacheTintList != null ? mCacheTintList.get(resId) : null; if (colorStateList == null) { colorStateList = ColorStateListUtils.createColorStateList(context, resId); if (colorStateList != null) { if (mCacheTintList == null) { mCacheTintList = new SparseArray<>(); }/*from www . jav a2 s. co m*/ mCacheTintList.append(resId, colorStateList); } } return colorStateList; }
From source file:fr.cph.chicago.task.GlobalConnectTask.java
/** * Constructor// w w w . j ava 2 s .co m * * @param instance * Instance of the object * @param classe * The class * @param requestType * the request type * @param params * the params * @param requestType2 * the request type * @param params2 * the params * @throws ParserException * the parser exception */ public GlobalConnectTask(final Object instance, final Class<?> classe, final CtaRequestType requestType, final MultiMap<String, String> params, final CtaRequestType requestType2, final MultiMap<String, String> params2, boolean loadTrains, boolean loadBuses, boolean loadBikes) throws ParserException { this.mInstance = instance; this.mClasse = classe; this.mRequestType = requestType; this.mParams = params; this.mData = DataHolder.getInstance().getTrainData(); this.mRequestType2 = requestType2; this.mParams2 = params2; this.mTrainArrivals = new SparseArray<TrainArrival>(); this.mBusArrivals = new ArrayList<BusArrival>(); this.mBikeStations = new ArrayList<BikeStation>(); this.mXml = new Xml(); this.mJson = new Json(); this.mLoadTrains = loadTrains; this.mLoadBuses = loadBuses; this.mLoadBikes = loadBikes; }
From source file:org.openmrs.mobile.activities.dashboard.DashboardFragment.java
/** * Binds drawable resource to ImageView//from w w w . ja va 2 s .c o m * @param imageView ImageView to bind resource to * @param drawableId id of drawable resource (for example R.id.somePicture); */ private void bindDrawableResource(ImageView imageView, int drawableId) { mBitmapCache = new SparseArray<>(); if (getView() != null) { createImageBitmap(drawableId, imageView.getLayoutParams()); imageView.setImageBitmap(mBitmapCache.get(drawableId)); } }
From source file:com.ti.omap.android.multidispapp.photo.PhotoGalleryCtrl.java
public PhotoGalleryCtrl(ViewPager viewPager, PhotoChangeListener listener) { mWeakPhotos = new SparseArray<WeakReference<TPhoto>>(); mListener = listener;// w ww. ja va2s .co m mViewPager = viewPager; mAdapter = new PreviewsAdapter(); viewPager.setOffscreenPageLimit(1); viewPager.setAdapter(mAdapter); viewPager.setPageMarginDrawable(new ColorDrawable(Color.WHITE)); viewPager.setPageMargin(3); viewPager.setOnPageChangeListener(this); }