// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/v1/EmojiDownloadDemoActivity.java
// public class EmojiDownloadDemoActivity extends AppCompatActivity {
//     private TextView description;
//     private TextView logTextView;
// 
//     private EmojiDownloader emojiDownloader;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_log_display);
// 
//         description = (TextView) findViewById(R.id.description);
//         logTextView = (TextView) findViewById(R.id.log_display);
// 
//         description.setText(R.string.emoji_download_demo1_description);
// 
//         emojiDownloader = new MyEmojiDownloader();
//         emojiDownloader.setEmojiDownloadListener(new EmojiDownloader.EmojiDownloadListener() {
//             @Override
//             public void emojiDownloadSuccess(EmojiPackage emojiPackage) {
//                 TextLogUtil.println(logTextView, "emoji package (emojiId: " + emojiPackage.emojiId + ") downloaded success!");
//             }
// 
//             @Override
//             public void emojiDownloadFailed(EmojiPackage emojiPackage, int errorCode, String errorMessage) {
//                 TextLogUtil.println(logTextView, "emoji package (emojiId: " + emojiPackage.emojiId + ") downloaded failed! errorCode: " + errorCode + ", errorMessage: " + errorMessage);
//             }
// 
//             @Override
//             public void emojiDownloadProgress(EmojiPackage emojiPackage, String downloadEmojiUrl) {
//                 TextLogUtil.println(logTextView, "progress: " + downloadEmojiUrl + " downloaded...");
//             }
//         });
// 
//         //构造要下载的表情包
//         EmojiPackage emojiPackage = new EmojiPackage();
//         emojiPackage.emojiId = 1001;
//         emojiPackage.emojiUrls = new ArrayList<String>();
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/1.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/2.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/3.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/4.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/5.png");
// 
//         TextLogUtil.println(logTextView, "Start downloading emoji package (emojiId: " + emojiPackage.emojiId + ") with " + emojiPackage.emojiUrls.size() + " URLs");
//         emojiDownloader.startDownloadEmoji(emojiPackage);
//     }
// 
// }


import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.zhangtielei.demos.async.programming.R;
import com.zhangtielei.demos.async.programming.callback.emoji.v1.EmojiDownloadDemoActivity;
/*
 * 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;


/**
 * 表情包下载演示程序入口列表
 */
public class EmojiDownloadDemoListActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_item_list);

        ListView listView = (ListView) findViewById(R.id.item_list);
        Resources resources = getResources();
        String[] textList = new String[] {
                resources.getString(R.string.emoji_download_demo_1),
                resources.getString(R.string.emoji_download_demo_2),
                resources.getString(R.string.emoji_download_demo_3),
                resources.getString(R.string.emoji_download_demo_4),
        };
        ListAdapter listAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, textList);
        listView.setAdapter(listAdapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position) {
                    case 0:
                    {
                        Intent intent = new Intent(EmojiDownloadDemoListActivity.this, EmojiDownloadDemoActivity.class);
                        startActivity(intent);
// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/v1/EmojiDownloadDemoActivity.java
// public class EmojiDownloadDemoActivity extends AppCompatActivity {
//     private TextView description;
//     private TextView logTextView;
// 
//     private EmojiDownloader emojiDownloader;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_log_display);
// 
//         description = (TextView) findViewById(R.id.description);
//         logTextView = (TextView) findViewById(R.id.log_display);
// 
//         description.setText(R.string.emoji_download_demo1_description);
// 
//         emojiDownloader = new MyEmojiDownloader();
//         emojiDownloader.setEmojiDownloadListener(new EmojiDownloader.EmojiDownloadListener() {
//             @Override
//             public void emojiDownloadSuccess(EmojiPackage emojiPackage) {
//                 TextLogUtil.println(logTextView, "emoji package (emojiId: " + emojiPackage.emojiId + ") downloaded success!");
//             }
// 
//             @Override
//             public void emojiDownloadFailed(EmojiPackage emojiPackage, int errorCode, String errorMessage) {
//                 TextLogUtil.println(logTextView, "emoji package (emojiId: " + emojiPackage.emojiId + ") downloaded failed! errorCode: " + errorCode + ", errorMessage: " + errorMessage);
//             }
// 
//             @Override
//             public void emojiDownloadProgress(EmojiPackage emojiPackage, String downloadEmojiUrl) {
//                 TextLogUtil.println(logTextView, "progress: " + downloadEmojiUrl + " downloaded...");
//             }
//         });
// 
//         //构造要下载的表情包
//         EmojiPackage emojiPackage = new EmojiPackage();
//         emojiPackage.emojiId = 1001;
//         emojiPackage.emojiUrls = new ArrayList<String>();
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/1.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/2.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/3.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/4.png");
//         emojiPackage.emojiUrls.add("http://zhangtielei.com/demourls/5.png");
// 
//         TextLogUtil.println(logTextView, "Start downloading emoji package (emojiId: " + emojiPackage.emojiId + ") with " + emojiPackage.emojiUrls.size() + " URLs");
//         emojiDownloader.startDownloadEmoji(emojiPackage);
//     }
// 
// }


// Path: AndroidDemos/app/src/main/java/com/zhangtielei/demos/async/programming/callback/emoji/EmojiDownloadDemoListActivity.java
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.zhangtielei.demos.async.programming.R;
import com.zhangtielei.demos.async.programming.callback.emoji.v1.EmojiDownloadDemoActivity;

/*
 * 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;


/**
 * 表情包下载演示程序入口列表
 */
public class EmojiDownloadDemoListActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_item_list);

        ListView listView = (ListView) findViewById(R.id.item_list);
        Resources resources = getResources();
        String[] textList = new String[] {
                resources.getString(R.string.emoji_download_demo_1),
                resources.getString(R.string.emoji_download_demo_2),
                resources.getString(R.string.emoji_download_demo_3),
                resources.getString(R.string.emoji_download_demo_4),
        };
        ListAdapter listAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, textList);
        listView.setAdapter(listAdapter);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                switch (position) {
                    case 0:
                    {
                        Intent intent = new Intent(EmojiDownloadDemoListActivity.this, EmojiDownloadDemoActivity.class);
                        startActivity(intent);
                        break;