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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:background="#6a9938" | |
> | |
<TextView | |
android:layout_height="wrap_content" |
public class NetworkTasksTest extends InstrumentationTestCase{ | |
public void testGetMedia() throws Throwable{ | |
final Context context = getInstrumentation().getTargetContext(); | |
final CountDownLatch signal = new CountDownLatch(1); | |
final NetworkTasks networkTasks = new NetworkTasks(context, new GetMediaListener(signal)); | |
runTestOnUiThread(new Runnable() { |
package com.squareup.example; | |
public abstract BaseActivity extends SherlockActivity { | |
private final ScopedBus scopedBus = new ScopedBus(); | |
protected ScopedBus getBus() { | |
return scopedBus; | |
} | |
@Override public void onPause() { |
// Copyright 2012 Pierre-Yves Ricau | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
// use this file except in compliance with the License. You may obtain a copy of | |
// the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
import threading | |
# Based on tornado.ioloop.IOLoop.instance() approach. | |
# See https://github.com/facebook/tornado | |
class SingletonMixin(object): | |
__singleton_lock = threading.Lock() | |
__singleton_instance = None | |
@classmethod |
public class ResizeAnimation extends Animation { | |
final int startWidth; | |
final int targetWidth; | |
View view; | |
public ResizeAnimation(View view, int targetWidth) { | |
this.view = view; | |
this.targetWidth = targetWidth; | |
startWidth = view.getWidth(); | |
} |
import android.view.animation.Interpolator; | |
/** | |
* Created with IntelliJ IDEA, best IDE in the world. User: castorflex Date: 06/06/13 Time: 22:18 | |
*/ | |
public class CustomBounceInterpolator implements Interpolator { | |
@Override | |
public float getInterpolation(float t) { | |
return -(float) Math.abs(Math.sin((float) Math.PI * (t + 1) * (t + 1)) * (1 - t)); |
function dex-method-count() { | |
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"' | |
} | |
function dex-method-count-by-package() { | |
dir=$(mktemp -d -t dex) | |
baksmali $1 -o $dir | |
for pkg in `find $dir/* -type d`; do | |
smali $pkg -o $pkg/classes.dex | |
count=$(dex-method-count $pkg/classes.dex) | |
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.') |
import android.view.View; | |
import android.view.ViewGroup; | |
/** | |
* A {@link ViewGroup.OnHierarchyChangeListener hierarchy change listener} which recursively | |
* monitors an entire tree of views. | |
*/ | |
public final class HierarchyTreeChangeListener implements ViewGroup.OnHierarchyChangeListener { | |
/** | |
* Wrap a regular {@link ViewGroup.OnHierarchyChangeListener hierarchy change listener} with one |