Apply the main stream ratio 16:9, here are the screen sizes:
- mdpi: ~160dpi, 640 x 360 px
- hdpi: ~240dpi, 960 x 540 px
- xhdpi: ~320dpi, 1280 x 720 px
- xxhdpi: ~higher, 1920 x 1080 px
| public void DisplayImage(final Namespace ns, String key, final ImageView imageView) { | |
| Bitmap bitmap = getBitmap(ns, key); | |
| if (bitmap != null) { | |
| Log.d(TAG, "BITMAP ALREADY DOWNLOWDED"); | |
| imageView.setImageBitmap(bitmap); | |
| } | |
| else { | |
| imageView.setImageResource(R.drawable.stub); | |
| ns.load(key, new Namespace.LoadListener() { |
| /** | |
| * Common view components such as ListView and GridView recycle child views | |
| * as users scrolls. If each child view triggers an load task, there is no | |
| * guarantee when it completes, the associated view has not already been | |
| * recycled for use in another child view, either for the order in which | |
| * asynchronous tasks are started is the order that they complete. | |
| * | |
| * This custom Drawable that will be attached to the imageView while the | |
| * work is in progress. Contains a reference to the actual loading image, | |
| * a.k.a the uid of the image being loading. |
| public void BackgroundThreadExecutionMethod() { | |
| synchronized (mPauseWorkLock) { | |
| while (mPauseWork) { | |
| try { | |
| mPauseWorkLock.wait(); | |
| } catch (InterruptedException e) {} | |
| } | |
| } | |
| } |
| long startTime = System.currentTimeMillis(); | |
| long endTime = System.currentTimeMillis(); | |
| Log.d("Benchmark", "Json decode execution time: " + (endTime - startTime) + "ms"); |
| fullpath = "/Users/bonbon/image/cover.jpg" | |
| dirpath, file = os.path.split(fullpath) | |
| name = os.path.splitext(file)[0] | |
| print file # "cover.jpg" | |
| print name # "cover" |
| <?xml version="1.0" encoding="utf-8"?> | |
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| android:id="@+id/item_cell" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" > | |
| <!-- xml layout --> | |
| </LinearLayout> |
| import android.content.Context; | |
| import android.util.AttributeSet; | |
| import android.widget.ImageView; | |
| public class SquaredImageView extends ImageView { | |
| public SquaredImageView(Context context) { | |
| super(context); | |
| } |
| // MIXPANEL send a open scanner event | |
| JSONObject properties = new JSONObject(); | |
| try { | |
| properties.put("merchant", c.getMerchant()); | |
| properties.put("catalog name", c.getName()); | |
| properties.put("hour of the day", hourOfTheDay()); | |
| } catch (JSONException e) { | |
| e.printStackTrace(); | |
| } | |
| mMixpanel.track("open a scanner", properties); |
| private void preloadImages() { | |
| final Namespace images = mWinch.getNamespace("images"); | |
| Iterator it1 = new Iterator() { | |
| public int next() { | |
| try { | |
| images.get(key); | |
| } catch (WinchError e) { | |
| if (e.getErrorCode() == WinchError.Code.EWEAKVAL) { | |
| try { | |
| mWinch.load("images", key); |