Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18de9f01 authored by Jing Ji's avatar Jing Ji
Browse files

Update Kotlin sample code for CountDownTimer and Parcelable

Also fixed a typo in the javadoc of android.os.Debug

Bug: 155869891
Bug: 152033307
Bug: 177360175
Test: m -j ds-docs
Change-Id: I52da37d24ab224344f931fed558df86f250bf86f
parent 0b8ff8e0
Loading
Loading
Loading
Loading
+18 −3
Original line number Original line Diff line number Diff line
@@ -22,7 +22,22 @@ package android.os;
 *
 *
 * Example of showing a 30 second countdown in a text field:
 * Example of showing a 30 second countdown in a text field:
 *
 *
 * <pre class="prettyprint">
 * <div>
 * <div class="ds-selector-tabs"><section><h3 id="kotlin">Kotlin</h3>
 * <pre class="prettyprint lang-kotlin">
 * object : CountDownTimer(30000, 1000) {
 *
 *     override fun onTick(millisUntilFinished: Long) {
 *         mTextField.setText("seconds remaining: " + millisUntilFinished / 1000)
 *     }
 *
 *     override fun onFinish() {
 *         mTextField.setText("done!")
 *     }
 * }.start()
 * </pre>
 * </section><section><h3 id="java">Java</h3>
 * <pre class="prettyprint lang-java">
 * new CountDownTimer(30000, 1000) {
 * new CountDownTimer(30000, 1000) {
 *
 *
 *     public void onTick(long millisUntilFinished) {
 *     public void onTick(long millisUntilFinished) {
@@ -33,7 +48,7 @@ package android.os;
 *         mTextField.setText("done!");
 *         mTextField.setText("done!");
 *     }
 *     }
 * }.start();
 * }.start();
 * </pre>
 * </pre></section></div></div>
 *
 *
 * The calls to {@link #onTick(long)} are synchronized to this object so that
 * The calls to {@link #onTick(long)} are synchronized to this object so that
 * one call to {@link #onTick(long)} won't ever occur before the previous
 * one call to {@link #onTick(long)} won't ever occur before the previous
+1 −1
Original line number Original line Diff line number Diff line
@@ -623,7 +623,7 @@ public final class Debug
       *         </tr>
       *         </tr>
       *         <tr>
       *         <tr>
       *             <td>summary.total-pss</td>
       *             <td>summary.total-pss</td>
       *             <td>Total PPS memory usage in kB.</td>
       *             <td>Total PSS memory usage in kB.</td>
       *             <td>{@code 1442}</td>
       *             <td>{@code 1442}</td>
       *             <td>23</td>
       *             <td>23</td>
       *         </tr>
       *         </tr>
+34 −5
Original line number Original line Diff line number Diff line
@@ -30,7 +30,36 @@ import java.lang.annotation.RetentionPolicy;
 *
 *
 * <p>A typical implementation of Parcelable is:</p>
 * <p>A typical implementation of Parcelable is:</p>
 *
 *
 * <pre>
 * <div>
 * <div class="ds-selector-tabs"><section><h3 id="kotlin">Kotlin</h3>
 * <pre class="prettyprint lang-kotlin">
 * class MyParcelable private constructor(`in`: Parcel) : Parcelable {
 *     private val mData: Int = `in`.readInt()
 *
 *     override fun describeContents(): Int {
 *         return 0
 *     }
 *
 *     override fun writeToParcel(out: Parcel, flags: Int) {
 *         out.writeInt(mData)
 *     }
 *
 *     companion object {
 *         val CREATOR: Parcelable.Creator&lt;MyParcelable?&gt;
 *                 = object : Parcelable.Creator&lt;MyParcelable?&gt; {
 *             override fun createFromParcel(`in`: Parcel): MyParcelable? {
 *                 return MyParcelable(`in`)
 *             }
 *
 *             override fun newArray(size: Int): Array&lt;MyParcelable?&gt; {
 *                 return arrayOfNulls(size)
 *             }
 *         }
 *     }
 * }
 * </pre>
 * </section><section><h3 id="java">Java</h3>
 * <pre class="prettyprint lang-java">
 * public class MyParcelable implements Parcelable {
 * public class MyParcelable implements Parcelable {
 *     private int mData;
 *     private int mData;
 *
 *
@@ -56,7 +85,7 @@ import java.lang.annotation.RetentionPolicy;
 *     private MyParcelable(Parcel in) {
 *     private MyParcelable(Parcel in) {
 *         mData = in.readInt();
 *         mData = in.readInt();
 *     }
 *     }
 * }</pre>
 * }</pre></section></div></div>
 */
 */
public interface Parcelable {
public interface Parcelable {
    /** @hide */
    /** @hide */