@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.viewGithub: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/FilledLineActivity.java")); startActivity(i); break; } } return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.viewGithub: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/PerformanceLineChart.java")); startActivity(i); break; } } return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.viewGithub: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java")); startActivity(i); break; } } return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.viewGithub: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewBarChartActivity.java")); startActivity(i); break; } } return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.viewGithub: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/HalfPieChartActivity.java")); startActivity(i); break; } } return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.viewGithub: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/ListViewMultiChartActivity.java")); startActivity(i); break; } } return true; }
private void loadNet() { Uri uri = Uri.parse("http://www.clker.com/cliparts/u/Z/2/b/a/6/android-toy-h.svg"); requestBuilder.load(uri).into(imageViewNet); } }
private MediaStoreData(Parcel in) { rowId = in.readLong(); uri = Uri.parse(in.readString()); mimeType = in.readString(); dateTaken = in.readLong(); dateModified = in.readLong(); orientation = in.readInt(); type = Type.valueOf(in.readString()); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.viewGithub: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartActivityColored.java")); startActivity(i); break; } } return true; }
@Before public void setUp() { MockitoAnnotations.initMocks(this); fetcher = new TestLocalUriFetcher(RuntimeEnvironment.application, Uri.parse("content://empty")); }
@Test public void testHandlesHttpsUris() throws MalformedURLException { Uri httpsUri = Uri.parse("https://www.google.com"); loader.buildLoadData(httpsUri, IMAGE_SIDE, IMAGE_SIDE, OPTIONS); assertTrue(loader.handles(httpsUri)); verify(urlLoader) .buildLoadData(eq(new GlideUrl(httpsUri.toString())), eq(IMAGE_SIDE), eq(IMAGE_SIDE), eq(OPTIONS)); }
private void runTestUriDefaultLoader() { Uri uri = Uri.parse("content://test/something"); mockUri(uri); requestManager.load(uri).into(target); requestManager.load(uri).into(imageView); verify(target).onResourceReady(notNull(), isA(Transition.class)); verify(target).setRequest((Request) notNull()); assertNotNull(imageView.getDrawable()); }
@Test public void testHandlesHttp() { String url = "http://www.google.com"; Uri expected = Uri.parse(url); when(uriLoader.buildLoadData(eq(expected), eq(IMAGE_SIDE), eq(IMAGE_SIDE), eq(options))) .thenReturn(new ModelLoader.LoadData<>(key, fetcher)); assertTrue(loader.handles(url)); assertEquals( fetcher, Preconditions.checkNotNull( loader.buildLoadData(url, IMAGE_SIDE, IMAGE_SIDE, options)).fetcher); }
@Test public void testHandlesContent() { String content = "content://com.bumptech.glide"; Uri expected = Uri.parse(content); when(uriLoader.buildLoadData(eq(expected), eq(IMAGE_SIDE), eq(IMAGE_SIDE), eq(options))) .thenReturn(new ModelLoader.LoadData<>(key, fetcher)); assertTrue(loader.handles(content)); assertEquals( fetcher, Preconditions.checkNotNull( loader.buildLoadData(content, IMAGE_SIDE, IMAGE_SIDE, options)).fetcher); }
@Test public void testCanHandleId() { int id = android.R.drawable.star_off; Uri contentUri = Uri.parse("android.resource://android/drawable/star_off"); when(uriLoader.buildLoadData(eq(contentUri), anyInt(), anyInt(), any(Options.class))) .thenReturn(new ModelLoader.LoadData<>(key, fetcher)); assertTrue(loader.handles(id)); assertEquals( fetcher, Preconditions.checkNotNull(loader.buildLoadData(id, 100, 100, new Options())).fetcher); }
@Test public void testHandlesAssetUris() { Uri assetUri = Uri.parse("file:///android_asset/assetName"); when(factory.buildFetcher(any(AssetManager.class), eq("assetName"))).thenReturn(fetcher); assertTrue(loader.handles(assetUri)); assertEquals( fetcher, Preconditions.checkNotNull( loader.buildLoadData(assetUri, IMAGE_SIDE, IMAGE_SIDE, new Options())).fetcher); } }
@Test public void testHandlesResourceUris() throws IOException { Uri resourceUri = Uri.parse("android.resource://com.bumptech.glide.tests/raw/ic_launcher"); when(factory.build(eq(resourceUri))).thenReturn(localUriFetcher); assertTrue(loader.handles(resourceUri)); assertEquals( localUriFetcher, Preconditions.checkNotNull( loader.buildLoadData(resourceUri, IMAGE_SIDE, IMAGE_SIDE, options)).fetcher); }
@Test public void testAsBitmapOption() { Uri uri = Uri.parse("content://something/else"); mockUri(uri); requestManager.asBitmap().load(uri).into(target); verify(target).onResourceReady(isA(Bitmap.class), isA(Transition.class)); }
@Test public void testToBytesOption() { Uri uri = Uri.parse("content://something/else"); mockUri(uri); requestManager.as(byte[].class).apply(decodeTypeOf(Bitmap.class)).load(uri).into(target); verify(target).onResourceReady(isA(byte[].class), isA(Transition.class)); }
@Test public void testReceivesGifBytes() { String fakeUri = "content://fake"; InputStream testGifData = openGif(); mockUri(Uri.parse(fakeUri), testGifData); requestManager.as(byte[].class).apply(decodeTypeOf(GifDrawable.class)).load(fakeUri) .into(target); verify(target).onResourceReady(isA(byte[].class), isA(Transition.class)); }