九游游戏中心HD v4.6.8.1版本的 MD5 值为:78c397802cc5ffdcc7f5502ede90502e

以下内容为反编译后的 HobbyGuideFragment.java 源代码,内容仅作参考


package cn.ninegame.sns.user.hobby.pages;

import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import cn.ninegame.gamemanager.BizSubFragmentWraper;
import cn.ninegame.gamemanagerhd.R;
import cn.ninegame.genericframework.basic.IResultListener;
import cn.ninegame.library.imageloader.NGImageView;
import cn.ninegame.library.imageloader.h;
import cn.ninegame.library.network.net.request.r;
import cn.ninegame.library.stat.a.j;
import cn.ninegame.library.stat.f;
import cn.ninegame.library.util.bw;
import cn.ninegame.share.core.g;
import cn.ninegame.sns.user.hobby.model.pojo.UserHobbyTag;
import cn.ninegame.sns.user.hobby.widget.e;
import cn.ninegame.sns.user.homepage.pages.TipsDialogFragment;
import cn.ninegame.sns.user.info.model.pojo.UserHobbyCategory;
import java.util.ArrayList;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@f(a = "用户兴趣引导页")
public class HobbyGuideFragment extends BizSubFragmentWraper implements View.OnClickListener, e.a {
    private LinearLayout c;
    private TextView d;
    private ArrayList<UserHobbyTag> f3282a = new ArrayList<>();
    private ArrayList<UserHobbyCategory> b = new ArrayList<>();
    private int e = 0;

    public static int c(HobbyGuideFragment hobbyGuideFragment) {
        int i = hobbyGuideFragment.e;
        hobbyGuideFragment.e = i + 1;
        return i;
    }

    public static int e(HobbyGuideFragment hobbyGuideFragment) {
        hobbyGuideFragment.e = 0;
        return 0;
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.ar = 1;
    }

    @Override
    public final void a(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        f(R.layout.hobby_guide_layout);
        this.c = (LinearLayout) d(R.id.ll_normal_tag_container);
        View d = d(R.id.btn_fling);
        if (Build.VERSION.SDK_INT >= 19) {
            ((RelativeLayout.LayoutParams) d.getLayoutParams()).topMargin = bw.a(getContext().getResources()) + getContext().getResources().getDimensionPixelSize(R.dimen.margin_5dp);
        }
        d.setOnClickListener(this);
        this.d = (TextView) d(R.id.btn_save);
        this.d.setOnClickListener(this);
        this.d.setEnabled(false);
        ((NGImageView) d(R.id.img_hobby_guide)).a("http://image.uc.cn/s/uae/g/0h/webres/hobby_guide_bg.jpg", h.j());
    }

    @Override
    public final void a(cn.ninegame.library.uilib.adapter.template.subfragment.b bVar) {
        bVar.a(new a(this));
    }

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        f();
        super.onViewCreated(view, bundle);
    }

    @Override
    public final void a(cn.ninegame.library.uilib.adapter.template.subfragment.a aVar) {
    }

    public void b(Bundle bundle) {
        c(bundle);
        w();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_fling:
                if (!k()) {
                    b((Bundle) null);
                } else {
                    Bundle bundle = new Bundle();
                    bundle.putString("bundle_data", getResources().getString(R.string.text_is_need_save));
                    this.v.c(TipsDialogFragment.class.getName(), bundle, new IResultListener() {
                        @Override
                        public void onResult(Bundle bundle2) {
                            if (bundle2.getInt("bundle_data") == 1) {
                                HobbyGuideFragment.this.a(false);
                            } else {
                                HobbyGuideFragment.this.b((Bundle) null);
                            }
                        }
                    });
                    j.b().a("dlg_closeguild", "grzx_all-xqyd", "", "");
                }
                j.b().a("btn_closeguild", "grzx_all-xqyd", "", "");
                return;
            case R.id.title_container:
            default:
                return;
            case R.id.btn_save:
                a(true);
                return;
        }
    }

    @Override
    public final void a(UserHobbyTag userHobbyTag) {
        String string;
        int color;
        if (userHobbyTag.isChecked) {
            this.f3282a.add(userHobbyTag);
            j.b().a("btn_recommendinterest", "grzx_all-xqyd", userHobbyTag.tag, "");
        } else {
            this.f3282a.remove(userHobbyTag);
        }
        if (k()) {
            this.d.setEnabled(true);
            string = this.o.getResources().getString(R.string.text_hobby_guide_save, Integer.valueOf(this.f3282a.size()));
            color = this.o.getResources().getColor(R.color.mygame_upgrade_btn_stroke);
        } else {
            this.d.setEnabled(false);
            string = this.o.getResources().getString(R.string.text_hobby_guide_save_disable);
            color = this.o.getResources().getColor(R.color.disable_txt_color);
        }
        this.d.setText(string);
        this.d.setTextColor(color);
    }

    public void a(boolean z) {
        try {
            cn.ninegame.library.network.net.d.c.a().a(new r(h()), new c(this, z));
            this.at.g();
        } catch (JSONException e) {
        }
    }

    private JSONObject h() {
        JSONArray jSONArray = new JSONArray();
        Iterator<UserHobbyTag> it = this.f3282a.iterator();
        while (it.hasNext()) {
            UserHobbyTag next = it.next();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(UserHobbyTag.PARAM_KEY_CONTENT, next.tag);
            jSONObject.put(UserHobbyTag.PARAM_KEY_TYPE, next.type);
            jSONArray.put(jSONObject);
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put(g.FLEX_PARAMS_ALLOW_LIST, jSONArray);
        return jSONObject2;
    }

    private boolean k() {
        return this.f3282a.size() > 0;
    }

    @Override
    public final boolean e_() {
        getActivity().finish();
        return true;
    }

    public void f() {
        this.at.g();
        cn.ninegame.library.network.net.d.c.a().a(new cn.ninegame.library.network.net.request.h(0), new b(this));
    }

    public static void b(HobbyGuideFragment hobbyGuideFragment) {
        Iterator<UserHobbyCategory> it = hobbyGuideFragment.b.iterator();
        while (it.hasNext()) {
            UserHobbyCategory next = it.next();
            String str = next.categoryName;
            View inflate = LayoutInflater.from(hobbyGuideFragment.getActivity()).inflate(R.layout.recommend_tag_title, (ViewGroup) null);
            ((TextView) inflate.findViewById(R.id.tv_normal_tag_title)).setText(str);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
            layoutParams.bottomMargin = hobbyGuideFragment.o.getResources().getDimensionPixelSize(R.dimen.margin_15dp);
            hobbyGuideFragment.c.addView(inflate, layoutParams);
            cn.ninegame.sns.user.hobby.widget.e eVar = new cn.ninegame.sns.user.hobby.widget.e(hobbyGuideFragment.getActivity());
            eVar.f = 17;
            LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
            layoutParams2.setMargins(hobbyGuideFragment.o.getResources().getDimensionPixelSize(R.dimen.margin_10dp), 0, hobbyGuideFragment.o.getResources().getDimensionPixelSize(R.dimen.margin_10dp), hobbyGuideFragment.o.getResources().getDimensionPixelSize(R.dimen.margin_22dp));
            eVar.a(next.categoryTags);
            eVar.i = hobbyGuideFragment;
            hobbyGuideFragment.c.addView(eVar, layoutParams2);
        }
    }
}