// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/EmojiDownloader.java
// public interface EmojiDownloader {
//     /**
//      * 开始下载指定的表情包
//      * @param emojiPackage
//      */
//     void startDownloadEmoji(EmojiPackage emojiPackage);
// 
//     /**
//      * 设置监听器.
//      * @param listener
//      */
//     void setEmojiDownloadListener(EmojiDownloadListener listener);
// 
//     /**
//      * 这里定义回调相关的接口. 不是我们要讨论的重点.
//      * 这里的定义用于完整演示.
//      */
// 
//     interface EmojiDownloadListener {
//         /**
//          * 表情包下载成功回调.
//          * @param emojiPackage
//          */
//         void emojiDownloadSuccess(EmojiPackage emojiPackage);
// 
//         /**
//          * 表情包下载失败回调.
//          * @param emojiPackage
//          * @param errorCode 为简单起见, 这里的值复用{@link com.zhangtielei.demos.async.programming.callback.download.v3.DownloadListener}中的错误码定义.
//          * @param errorMessage
//          */
//         void emojiDownloadFailed(EmojiPackage emojiPackage, int errorCode, String errorMessage);
// 
//         /**
//          * 表情包下载进度回调. 每次下载完一个图片文件后回调一次.
//          * @param emojiPackage
//          * @param downloadEmojiUrl 当前刚下载完的图片文件URL
//          */
//         void emojiDownloadProgress(EmojiPackage emojiPackage, String downloadEmojiUrl);
//     }
// 
// }
// 
// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/EmojiPackage.java
// public class EmojiPackage {
//     /**
//      * 表情包ID
//      */
//     public long emojiId;
//     /**
//      * 表情包图片列表
//      */
//     public List<String> emojiUrls;
// }
// 
// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/common/utils/TextLogUtil.java
// public class TextLogUtil {
//     /**
//      * 在一个TextView上追加一行日志.
//      * @param logTextView
//      * @param log
//      */
//     public static void println(TextView logTextView, CharSequence log) {
//         SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
//         String timestamp = sdf.format(new Date());
// 
//         CharSequence newText = timestamp + ": " + log;
//         CharSequence oldText = logTextView.getText();
//         if (oldText == null || oldText.length() <= 0) {
//             logTextView.setText(newText);
//         }
//         else {
//             logTextView.setText(oldText + "\n" + newText);
//         }
//     }
// }


import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.zhangtielei.demos.async.programming.R;
import com.zhangtielei.demos.async.programming.callback.emoji.EmojiDownloader;
import com.zhangtielei.demos.async.programming.callback.emoji.EmojiPackage;
import com.zhangtielei.demos.async.programming.common.utils.TextLogUtil;
import java.util.ArrayList;
/*
 * Copyright (C) 2016 Tielei Zhang (zhangtielei.com).
 *
 * 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.zhangtielei.demos.async.programming.callback.emoji.v3;



/**
 * 通过为每一个异步任务创建一个接口实例的方式来传递上下文的表情包下载演示页面.
 */
public class EmojiDownloadDemoActivity extends AppCompatActivity {
    private TextView description;
    private TextView logTextView;

// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/EmojiDownloader.java
// public interface EmojiDownloader {
//     /**
//      * 开始下载指定的表情包
//      * @param emojiPackage
//      */
//     void startDownloadEmoji(EmojiPackage emojiPackage);
// 
//     /**
//      * 设置监听器.
//      * @param listener
//      */
//     void setEmojiDownloadListener(EmojiDownloadListener listener);
// 
//     /**
//      * 这里定义回调相关的接口. 不是我们要讨论的重点.
//      * 这里的定义用于完整演示.
//      */
// 
//     interface EmojiDownloadListener {
//         /**
//          * 表情包下载成功回调.
//          * @param emojiPackage
//          */
//         void emojiDownloadSuccess(EmojiPackage emojiPackage);
// 
//         /**
//          * 表情包下载失败回调.
//          * @param emojiPackage
//          * @param errorCode 为简单起见, 这里的值复用{@link com.zhangtielei.demos.async.programming.callback.download.v3.DownloadListener}中的错误码定义.
//          * @param errorMessage
//          */
//         void emojiDownloadFailed(EmojiPackage emojiPackage, int errorCode, String errorMessage);
// 
//         /**
//          * 表情包下载进度回调. 每次下载完一个图片文件后回调一次.
//          * @param emojiPackage
//          * @param downloadEmojiUrl 当前刚下载完的图片文件URL
//          */
//         void emojiDownloadProgress(EmojiPackage emojiPackage, String downloadEmojiUrl);
//     }
// 
// }
// 
// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/EmojiPackage.java
// public class EmojiPackage {
//     /**
//      * 表情包ID
//      */
//     public long emojiId;
//     /**
//      * 表情包图片列表
//      */
//     public List<String> emojiUrls;
// }
// 
// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/common/utils/TextLogUtil.java
// public class TextLogUtil {
//     /**
//      * 在一个TextView上追加一行日志.
//      * @param logTextView
//      * @param log
//      */
//     public static void println(TextView logTextView, CharSequence log) {
//         SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
//         String timestamp = sdf.format(new Date());
// 
//         CharSequence newText = timestamp + ": " + log;
//         CharSequence oldText = logTextView.getText();
//         if (oldText == null || oldText.length() <= 0) {
//             logTextView.setText(newText);
//         }
//         else {
//             logTextView.setText(oldText + "\n" + newText);
//         }
//     }
// }


// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/v3/EmojiDownloadDemoActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import com.zhangtielei.demos.async.programming.R;
import com.zhangtielei.demos.async.programming.callback.emoji.EmojiDownloader;
import com.zhangtielei.demos.async.programming.callback.emoji.EmojiPackage;
import com.zhangtielei.demos.async.programming.common.utils.TextLogUtil;
import java.util.ArrayList;

/*
 * Copyright (C) 2016 Tielei Zhang (zhangtielei.com).
 *
 * 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.zhangtielei.demos.async.programming.callback.emoji.v3;



/**
 * 通过为每一个异步任务创建一个接口实例的方式来传递上下文的表情包下载演示页面.
 */
public class EmojiDownloadDemoActivity extends AppCompatActivity {
    private TextView description;
    private TextView logTextView;

    private EmojiDownloader emojiDownloader;