// Path: Android/Sample/jni_plugin/src/main/java/com/example/hellojni/HelloPluginJni.java
// public final class HelloPluginJni
// {
//     /* A native method that is implemented by the
//      * 'hello-jni' native library, which is packaged
//      * with this application.
//      */
//     public static native String stringFromJNI();
// 
//     static {
//         System.loadLibrary("hello-plugin-jni");
//     }
// }
// 
// Path: Android/Sample/lib.utils/src/main/java/net/wequick/example/small/lib/utils/UIUtils.java
// public class UIUtils {
//     public static void showToast(Context context, String tips) {
//         Toast toast = Toast.makeText(context, "lib.utils: " + tips, Toast.LENGTH_SHORT);
//         toast.show();
//     }
// 
//     public static void alert(Context context, String tips) {
//         AlertDialog dlg = new AlertDialog.Builder(context)
//                 .setMessage("lib.utils: " + tips)
//                 .setPositiveButton("OK", new DialogInterface.OnClickListener() {
//                     @Override
//                     public void onClick(DialogInterface dialog, int which) {
//                         dialog.dismiss();
//                     }
//                 })
//                 .create();
//         dlg.show();
//     }
// }


import android.app.Activity;
import android.content.Intent;
import android.support.annotation.Keep;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.example.hellojni.HelloPluginJni;
import com.example.mylib.Greet;
import net.wequick.example.small.lib.utils.UIUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import butterknife.BindView;
import butterknife.ButterKnife;
        try {
            InputStream is = getResources().getAssets().open("greet.txt");
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            String greet = br.readLine();
            is.close();

            TextView tvAssets = (TextView) rootView.findViewById(R.id.assets_label);
            tvAssets.setText("assets/greet.txt: " + greet);

            is = getResources().openRawResource(R.raw.greet);
            br = new BufferedReader(new InputStreamReader(is));
            greet = br.readLine();
            is.close();

            TextView tvRaw = (TextView) rootView.findViewById(R.id.raw_label);
            tvRaw.setText("res/raw/greet.txt: " + greet);

            is = getResources().openRawResource(R.raw.mq_new_message);
            System.out.println("### " + is.available());
            is.close();


        } catch (IOException e) {
            e.printStackTrace();
        }

//        TextView tvLib = (TextView) rootView.findViewById(R.id.lib_label);
        tvLib.setText(Greet.hello() + " (ButterKnife 8)");

        TextView tvJni = (TextView) rootView.findViewById(R.id.jni_label);
// Path: Android/Sample/jni_plugin/src/main/java/com/example/hellojni/HelloPluginJni.java
// public final class HelloPluginJni
// {
//     /* A native method that is implemented by the
//      * 'hello-jni' native library, which is packaged
//      * with this application.
//      */
//     public static native String stringFromJNI();
// 
//     static {
//         System.loadLibrary("hello-plugin-jni");
//     }
// }
// 
// Path: Android/Sample/lib.utils/src/main/java/net/wequick/example/small/lib/utils/UIUtils.java
// public class UIUtils {
//     public static void showToast(Context context, String tips) {
//         Toast toast = Toast.makeText(context, "lib.utils: " + tips, Toast.LENGTH_SHORT);
//         toast.show();
//     }
// 
//     public static void alert(Context context, String tips) {
//         AlertDialog dlg = new AlertDialog.Builder(context)
//                 .setMessage("lib.utils: " + tips)
//                 .setPositiveButton("OK", new DialogInterface.OnClickListener() {
//                     @Override
//                     public void onClick(DialogInterface dialog, int which) {
//                         dialog.dismiss();
//                     }
//                 })
//                 .create();
//         dlg.show();
//     }
// }


// Path: Android/Sample/app.mine/src/main/java/net/wequick/example/small/app/mine/MainFragment.java
import android.app.Activity;
import android.content.Intent;
import android.support.annotation.Keep;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.example.hellojni.HelloPluginJni;
import com.example.mylib.Greet;
import net.wequick.example.small.lib.utils.UIUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import butterknife.BindView;
import butterknife.ButterKnife;

        try {
            InputStream is = getResources().getAssets().open("greet.txt");
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            String greet = br.readLine();
            is.close();

            TextView tvAssets = (TextView) rootView.findViewById(R.id.assets_label);
            tvAssets.setText("assets/greet.txt: " + greet);

            is = getResources().openRawResource(R.raw.greet);
            br = new BufferedReader(new InputStreamReader(is));
            greet = br.readLine();
            is.close();

            TextView tvRaw = (TextView) rootView.findViewById(R.id.raw_label);
            tvRaw.setText("res/raw/greet.txt: " + greet);

            is = getResources().openRawResource(R.raw.mq_new_message);
            System.out.println("### " + is.available());
            is.close();


        } catch (IOException e) {
            e.printStackTrace();
        }

//        TextView tvLib = (TextView) rootView.findViewById(R.id.lib_label);
        tvLib.setText(Greet.hello() + " (ButterKnife 8)");

        TextView tvJni = (TextView) rootView.findViewById(R.id.jni_label);
        tvJni.setText(HelloPluginJni.stringFromJNI());