// Path: app/src/main/java/studio/uphie/one/utils/TextToast.java
// public class TextToast {
// 
//     private static Context context;
// 
//     public static void init(Context ctx){
//         context=ctx;
//     }
// 
//     public static void shortShow(String content){
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_SHORT);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
//     public static void shortShow(int resId){
//         String content=context.getResources().getString(resId);
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_SHORT);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
//     public static void longShow(String content){
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_LONG);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
//     public static void longShow(int resId){
//         String content=context.getResources().getString(resId);
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_LONG);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
// }


import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.umeng.analytics.MobclickAgent;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import studio.uphie.one.R;
import studio.uphie.one.utils.TextToast;
    }

    @OnClick({R.id.item_about, R.id.item_share_app, R.id.item_feedback, R.id.item_comment})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.item_about:
                intent = new Intent(getActivity(), AboutActivity.class);
                startActivity(intent);
                break;
            case R.id.item_share_app:
                intent = new Intent(Intent.ACTION_SEND);
                intent.putExtra(Intent.EXTRA_TEXT, "我发现一个不错的应用，ONE（非官方版），每天给你一个新心情：）\n Github: https://github.com/Uphie/ONE-Unofficial");
                intent.setType("text/plain");
                startActivity(intent);
                break;
            case R.id.item_feedback:
                intent = new Intent(getActivity(), FeedbackActivity.class);
                startActivity(intent);
                break;
            case R.id.item_comment:
                //跳转到应用商店，官方ONE的详情页
                intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("market://details?id=one.hh.oneclient"));
                //必须先检查是否有应用商店安装，否则可能会崩溃
                if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
                    //有应用商店
                    startActivity(intent);
                }else {
                    //无应用商店
// Path: app/src/main/java/studio/uphie/one/utils/TextToast.java
// public class TextToast {
// 
//     private static Context context;
// 
//     public static void init(Context ctx){
//         context=ctx;
//     }
// 
//     public static void shortShow(String content){
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_SHORT);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
//     public static void shortShow(int resId){
//         String content=context.getResources().getString(resId);
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_SHORT);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
//     public static void longShow(String content){
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_LONG);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
//     public static void longShow(int resId){
//         String content=context.getResources().getString(resId);
//         if (context==null){
//             throw new IllegalStateException("TextToast was not initialized");
//         }
//         Toast toast= Toast.makeText(context, content, Toast.LENGTH_LONG);
//         toast.setGravity(Gravity.CENTER, 0, 0);
//         toast.show();
//     }
// }


// Path: app/src/main/java/studio/uphie/one/ui/personal/PersonalFragment.java
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.umeng.analytics.MobclickAgent;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import studio.uphie.one.R;
import studio.uphie.one.utils.TextToast;

    }

    @OnClick({R.id.item_about, R.id.item_share_app, R.id.item_feedback, R.id.item_comment})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.item_about:
                intent = new Intent(getActivity(), AboutActivity.class);
                startActivity(intent);
                break;
            case R.id.item_share_app:
                intent = new Intent(Intent.ACTION_SEND);
                intent.putExtra(Intent.EXTRA_TEXT, "我发现一个不错的应用，ONE（非官方版），每天给你一个新心情：）\n Github: https://github.com/Uphie/ONE-Unofficial");
                intent.setType("text/plain");
                startActivity(intent);
                break;
            case R.id.item_feedback:
                intent = new Intent(getActivity(), FeedbackActivity.class);
                startActivity(intent);
                break;
            case R.id.item_comment:
                //跳转到应用商店，官方ONE的详情页
                intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("market://details?id=one.hh.oneclient"));
                //必须先检查是否有应用商店安装，否则可能会崩溃
                if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
                    //有应用商店
                    startActivity(intent);
                }else {
                    //无应用商店
                    TextToast.longShow(R.string.non_market_app);