summaryrefslogtreecommitdiffstats
path: root/docs/html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/html')
-rw-r--r--docs/html/google/play-services/setup.jd13
-rw-r--r--docs/html/sdk/installing/studio.jd59
-rw-r--r--docs/html/training/displaying-bitmaps/cache-bitmap.jd5
-rw-r--r--docs/html/training/displaying-bitmaps/load-bitmap.jd27
-rw-r--r--docs/html/training/displaying-bitmaps/manage-memory.jd60
5 files changed, 100 insertions, 64 deletions
diff --git a/docs/html/google/play-services/setup.jd b/docs/html/google/play-services/setup.jd
index 4d38850..a7de709 100644
--- a/docs/html/google/play-services/setup.jd
+++ b/docs/html/google/play-services/setup.jd
@@ -81,6 +81,19 @@ both phones and tablets.</p>
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
+
+-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
+ public static final *** NULL;
+}
+
+-keepnames &#64;com.google.android.gms.common.annotation.KeepName class *
+-keepclassmembernames class * {
+ &#64;ccom.google.android.gms.common.annotation.KeepName *;
+}
+
+-keepnames class * implements android.os.Parcelable {
+ public static final ** CREATOR;
+}
</pre>
</ol>
diff --git a/docs/html/sdk/installing/studio.jd b/docs/html/sdk/installing/studio.jd
index 3399ee8..f2fd79b 100644
--- a/docs/html/sdk/installing/studio.jd
+++ b/docs/html/sdk/installing/studio.jd
@@ -253,36 +253,36 @@ download (or continue to use) the
<td>Windows</td>
<td>
<a onclick="return onDownload(this)" id="win-studio"
- href="http://dl.google.com/android/studio/android-studio-bundle-130.737825-windows.exe">
- android-studio-bundle-130.737825-windows.exe
+ href="http://dl.google.com/android/studio/android-studio-bundle-132.883541-windows.exe">
+ android-studio-bundle-132.883541-windows.exe
</a>
</td>
- <td>396091268 bytes</td>
- <td>6da1bc8effa048c8ff669e4c484eb11f</td>
+ <td>448245492 bytes</td>
+ <td>ca5f5c4d21b4350ddf3bda7021a6ee5e</td>
</tr>
<tr>
<td><nobr>Mac OS X</nobr></td>
<td>
<a onclick="return onDownload(this)" id="mac-studio"
- href="http://dl.google.com/android/studio/android-studio-bundle-130.737825-mac.dmg">
- android-studio-bundle-130.737825-mac.dmg
+ href="http://dl.google.com/android/studio/android-studio-bundle-132.883541-mac.dmg">
+ android-studio-bundle-132.883541-mac.dmg
</a>
</td>
- <td>383326582 bytes</td>
- <td>2959bc5039238d286670cc6225342b89</td>
+ <td>427317993 bytes</td>
+ <td>67831af6e7896a0a146d43423fabb542</td>
</tr>
<tr>
<td>Linux</td>
<td>
<a onclick="return onDownload(this)" id="linux-studio"
- href="http://dl.google.com/android/studio/android-studio-bundle-130.737825-linux.tgz">
- android-studio-bundle-130.737825-linux.tgz
+ href="http://dl.google.com/android/studio/android-studio-bundle-132.883541-linux.tgz">
+ android-studio-bundle-132.883541-linux.tgz
</a>
</td>
- <td>409935592 bytes</td>
- <td>dcd13922f7cf577e3c852b224205d843</td>
+ <td>451652493 bytes</td>
+ <td>7a6f9b12b2cd5321ab0818b51306e01c</td>
</tr>
</table>
@@ -290,9 +290,13 @@ download (or continue to use) the
-<h2 id="Updating">Updating to 0.2.x</h2>
+<h2 id="Updating">Updating from older versions</h2>
-<p>To update from Android Studio 0.1.x to 0.2.x,
+<p>If you already have Android Studio installed, in most cases, you can upgrade to the latest
+version by installing a patch. From within Android Studio, select
+<strong>Help &gt; Check for updates</strong> to see whether an update is available.</p>
+
+<p>If an update is not available,
follow the <a href="#Installing">installation instructions</a> below and replace your existing
installation.</p>
@@ -304,13 +308,10 @@ SDK directory under Android Studio to a temporary location
before installing the update. Then move them back once the update is complete.
If you fail to copy these packages, then you can instead download them again through
the Android SDK Manager.</p>
-<p><strong>Windows users:</strong> Do not install Android Studio 0.2.x in the same
-location as 0.1.x. Doing so may cause errors such as ClassCastException or other unexpected
-behaviors. It's best if you remove your previous version of Android Studio 0.1.x.</p>
</div>
-<p>Also note that due to the update to Gradle 0.5, you will encounter errors when opening
+<p>Also note that due to the update to Android Gradle Plugin 0.6, you will encounter errors when opening
existing projects. See the <a href="#Troubleshooting">Troubleshooting</a> notes below for
information about how to resolve them.</p>
@@ -419,16 +420,22 @@ style="vertical-align:bottom;margin:0;height:19px" /> in the toolbar.</p>
<h2 id="Revisions">Revisions</h2>
-<p class="note"><strong>Note:</strong> <strong>There is not a patch update available from
-0.1.9 to 0.2</strong>. To update from Android Studio 0.1.x to 0.2.x, you must
-install a new Android Studio bundle from this page. The reason for that is that we have made
-changes to the bundled SDK such that it includes a pre-configured local Maven repository
-which can serve up the v4 support library and which is required for creating new projects.</p>
-
-
<div class="toggle-content opened">
<p><a href="#" onclick="return toggleContent(this)">
<img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
+ alt=""/>Android Studio v0.3.1</a> <em>(Oct 2013)</em>
+ </p>
+
+ <div class="toggle-content-toggleme">
+ <ul>
+ <li>See <a href="http://tools.android.com/recent">tools.android.com</a> for a full list of changes.</li>
+ </ul>
+ </div>
+</div>
+
+<div class="toggle-content closed">
+ <p><a href="#" onclick="return toggleContent(this)">
+ <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
alt=""/>Android Studio v0.2.x</a> <em>(July 2013)</em>
</p>
@@ -610,7 +617,7 @@ for possible resolutions to known issues: <a href="http://tools.android.com/know
if (os) {
/* set up primary ACE download button */
$('#download-ide-button').show();
- $('#download-ide-button').append("Download Android Studio <span class='small'>v0.2.x</span>"
+ $('#download-ide-button').append("Download Android Studio <span class='small'>v0.3.1</span>"
+ "<br/> <span class='small'>for " + os + "</span>");
$('#download-ide-button').click(function() {return onDownload(this,true);}).attr('href', bundlename);
diff --git a/docs/html/training/displaying-bitmaps/cache-bitmap.jd b/docs/html/training/displaying-bitmaps/cache-bitmap.jd
index 25efe1e..ff9c3a0 100644
--- a/docs/html/training/displaying-bitmaps/cache-bitmap.jd
+++ b/docs/html/training/displaying-bitmaps/cache-bitmap.jd
@@ -188,8 +188,8 @@ appropriate place to store cached images if they are accessed more frequently, f
image gallery application.</p>
<p>The sample code of this class uses a {@code DiskLruCache} implementation that is pulled from the
-<a href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/io/DiskLruCache.java">Android source</a>. Here’s updated example code that adds a disk cache in addition
-to the existing memory cache:</p>
+<a href="https://android.googlesource.com/platform/libcore/+/jb-mr2-release/luni/src/main/java/libcore/io/DiskLruCache.java">Android source</a>.
+Here’s updated example code that adds a disk cache in addition to the existing memory cache:</p>
<pre>
private DiskLruCache mDiskLruCache;
@@ -346,6 +346,7 @@ class RetainFragment extends Fragment {
RetainFragment fragment = (RetainFragment) fm.findFragmentByTag(TAG);
if (fragment == null) {
fragment = new RetainFragment();
+ fm.beginTransaction().add(fragment, TAG).commit();
}
return fragment;
}
diff --git a/docs/html/training/displaying-bitmaps/load-bitmap.jd b/docs/html/training/displaying-bitmaps/load-bitmap.jd
index 633ffd2..938901f 100644
--- a/docs/html/training/displaying-bitmaps/load-bitmap.jd
+++ b/docs/html/training/displaying-bitmaps/load-bitmap.jd
@@ -97,7 +97,8 @@ android.graphics.BitmapFactory.Options} object. For example, an image with resol
is decoded with an {@link android.graphics.BitmapFactory.Options#inSampleSize} of 4 produces a
bitmap of approximately 512x384. Loading this into memory uses 0.75MB rather than 12MB for the full
image (assuming a bitmap configuration of {@link android.graphics.Bitmap.Config ARGB_8888}). Here’s
-a method to calculate a the sample size value based on a target width and height:</p>
+a method to calculate a sample size value that is a power of two based on a target width and
+height:</p>
<pre>
public static int calculateInSampleSize(
@@ -107,26 +108,26 @@ public static int calculateInSampleSize(
final int width = options.outWidth;
int inSampleSize = 1;
- if (height > reqHeight || width > reqWidth) {
+ if (height &gt; reqHeight || width &gt; reqWidth) {
- // Calculate ratios of height and width to requested height and width
- final int heightRatio = Math.round((float) height / (float) reqHeight);
- final int widthRatio = Math.round((float) width / (float) reqWidth);
+ final int halfHeight = height / 2;
+ final int halfWidth = width / 2;
- // Choose the smallest ratio as inSampleSize value, this will guarantee
- // a final image with both dimensions larger than or equal to the
- // requested height and width.
- inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
+ // Calculate the largest inSampleSize value that is a power of 2 and keeps both
+ // height and width larger than the requested height and width.
+ while ((halfHeight / inSampleSize) &gt; reqHeight
+ && (halfWidth / inSampleSize) &gt; reqWidth) {
+ inSampleSize *= 2;
+ }
}
return inSampleSize;
}
</pre>
-<p class="note"><strong>Note:</strong> Using powers of 2 for {@link
-android.graphics.BitmapFactory.Options#inSampleSize} values is faster and more efficient for the
-decoder. However, if you plan to cache the resized versions in memory or on disk, it’s usually still
-worth decoding to the most appropriate image dimensions to save space.</p>
+<p class="note"><strong>Note:</strong> A power of two value is calculated because the decoder uses
+a final value by rounding down to the nearest power of two, as per the {@link
+android.graphics.BitmapFactory.Options#inSampleSize} documentation.</p>
<p>To use this method, first decode with {@link
android.graphics.BitmapFactory.Options#inJustDecodeBounds} set to {@code true}, pass the options
diff --git a/docs/html/training/displaying-bitmaps/manage-memory.jd b/docs/html/training/displaying-bitmaps/manage-memory.jd
index 60ac2e6..0e1279e 100644
--- a/docs/html/training/displaying-bitmaps/manage-memory.jd
+++ b/docs/html/training/displaying-bitmaps/manage-memory.jd
@@ -56,7 +56,7 @@ bitmap is stored in native memory. It is separate from the bitmap itself,
which is stored in the Dalvik heap. The pixel data in native memory is
not released in a predictable manner, potentially causing an application
to briefly exceed its memory limits and crash.
-<strong>As of Android 3.0 (API Level 11), the pixel data is stored on the
+<strong>As of Android 3.0 (API level 11), the pixel data is stored on the
Dalvik heap along with the associated bitmap.</strong></li>
</ul>
@@ -140,27 +140,16 @@ private synchronized boolean hasValidBitmap() {
<h2 id="inBitmap">Manage Memory on Android 3.0 and Higher</h2>
-<p>Android 3.0 (API Level 11) introduces the
+<p>Android 3.0 (API level 11) introduces the
{@link android.graphics.BitmapFactory.Options#inBitmap BitmapFactory.Options.inBitmap}
field. If this option is set, decode methods that take the
{@link android.graphics.BitmapFactory.Options Options} object
will attempt to reuse an existing bitmap when loading content. This means
that the bitmap's memory is reused, resulting in improved performance, and
-removing both memory allocation and de-allocation. There are some caveats in using
-{@link android.graphics.BitmapFactory.Options#inBitmap}:</p>
-<ul>
- <li>The reused bitmap must be of the same size as the source content (to make
-sure that the same amount of memory is used), and in JPEG or PNG format
-(whether as a resource or as a stream).</li>
-
-
-<li>The {@link android.graphics.Bitmap.Config configuration} of the reused bitmap
-overrides the setting of
-{@link android.graphics.BitmapFactory.Options#inPreferredConfig}, if set. </li>
-
- <li>You should always use the returned bitmap of the decode method,
-because you can't assume that reusing the bitmap worked (for example, if there is
-a size mismatch).</li>
+removing both memory allocation and de-allocation. However, there are certain restrictions with how
+{@link android.graphics.BitmapFactory.Options#inBitmap} can be used. In particular, before Android
+4.4 (API level 19), only equal sized bitmaps are supported. For details, please see the
+{@link android.graphics.BitmapFactory.Options#inBitmap} documentation.
<h3>Save a bitmap for later use</h3>
@@ -283,14 +272,39 @@ protected Bitmap getBitmapFromReusableSet(BitmapFactory.Options options) {
satisfies the size criteria to be used for
{@link android.graphics.BitmapFactory.Options#inBitmap}:</p>
-<pre>private static boolean canUseForInBitmap(
+<pre>static boolean canUseForInBitmap(
Bitmap candidate, BitmapFactory.Options targetOptions) {
- int width = targetOptions.outWidth / targetOptions.inSampleSize;
- int height = targetOptions.outHeight / targetOptions.inSampleSize;
- // Returns true if "candidate" can be used for inBitmap re-use with
- // "targetOptions".
- return candidate.getWidth() == width && candidate.getHeight() == height;
+ if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
+ // From Android 4.4 (KitKat) onward we can re-use if the byte size of
+ // the new bitmap is smaller than the reusable bitmap candidate
+ // allocation byte count.
+ int width = targetOptions.outWidth / targetOptions.inSampleSize;
+ int height = targetOptions.outHeight / targetOptions.inSampleSize;
+ int byteCount = width * height * getBytesPerPixel(candidate.getConfig());
+ return byteCount &lt;= candidate.getAllocationByteCount();
+ }
+
+ // On earlier versions, the dimensions must match exactly and the inSampleSize must be 1
+ return candidate.getWidth() == targetOptions.outWidth
+ && candidate.getHeight() == targetOptions.outHeight
+ && targetOptions.inSampleSize == 1;
+}
+
+/**
+ * A helper function to return the byte usage per pixel of a bitmap based on its configuration.
+ */
+static int getBytesPerPixel(Config config) {
+ if (config == Config.ARGB_8888) {
+ return 4;
+ } else if (config == Config.RGB_565) {
+ return 2;
+ } else if (config == Config.ARGB_4444) {
+ return 2;
+ } else if (config == Config.ALPHA_8) {
+ return 1;
+ }
+ return 1;
}</pre>
</body>