OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.excelliance.kxqp.gs.g;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.excean.ggspace.main.R;
import com.excelliance.kxqp.gs.base.b;
import com.excelliance.kxqp.gs.discover.model.ResponseData;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.view.d;
import com.excelliance.kxqp.gs.util.ViewSwitcher;
import com.excelliance.kxqp.gs.util.ad;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bs;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.bz;
import com.excelliance.kxqp.gs.util.ce;
import com.excelliance.kxqp.gs.util.cg;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.util.ai;
import com.google.gson.annotations.SerializedName;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
import org.json.JSONException;
import org.json.JSONObject;

public class b implements com.excelliance.kxqp.gs.i.e {

    private static b f6131b;

    com.excelliance.kxqp.gs.ui.flow.f f6132a = new com.excelliance.kxqp.gs.ui.flow.f() {
        @Override
        public void update(Object obj) {
            if (b.this.h == null || obj == null || !(obj instanceof Long)) {
                return;
            }
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(" HH:mm:ss");
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
            b.this.h.setText(simpleDateFormat.format(new Date(((Long) obj).longValue())));
        }
    };
    private List<c> c = new ArrayList();
    private e d;
    private Handler e;
    private ImageView f;
    private View g;
    private TextView h;
    private boolean i;
    private d j;
    private List<com.excelliance.kxqp.gs.ui.flow.f> k;
    private Activity l;
    private com.excelliance.kxqp.gs.dialog.u m;

    private b(Context context) {
        this.c.add(new c(1, by.a(context, "sp_ascent_task").b("SP_KEY_ASCENT_TASK_ID_1", false).booleanValue()));
        this.c.add(new c(2, by.a(context, "sp_ascent_task").b("SP_KEY_ASCENT_TASK_ID_2", false).booleanValue()));
        this.c.add(new c(3, by.a(context, "sp_ascent_task").b("SP_KEY_ASCENT_TASK_ID_3", false).booleanValue()));
        this.k = new ArrayList();
        this.e = new Handler(Looper.getMainLooper());
    }

    public static b a(Context context) {
        if (f6131b == null) {
            synchronized (b.class) {
                if (f6131b == null) {
                    f6131b = new b(context);
                }
            }
        }
        return f6131b;
    }

    public static boolean b(Context context) {
        Log.d("AscentTaskHelper", "isShow: " + ai.a().b());
        return i(context) <= 0 || by.a(context, "sp_ascent_task").b("sp_key_ascent_task_receive_completed", false).booleanValue() || bs.p(context) || ai.a().b();
    }

    private static long g(Context context) {
        long a2 = by.a(context, "sp_ascent_task").a("sp_key_ascent_task_start_time", (Long) 0L);
        if (a2 != 0) {
            return a2;
        }
        long currentTimeMillis = System.currentTimeMillis();
        by.a(context, "sp_ascent_task").a("sp_key_ascent_task_start_time", currentTimeMillis);
        return currentTimeMillis;
    }

    public boolean h(Context context) {
        return (g(context) - System.currentTimeMillis()) + 21600000 > 0;
    }

    public static long i(Context context) {
        return (g(context) - System.currentTimeMillis()) + 21600000;
    }

    public void a(final Activity activity, View view) {
        if (com.excean.ab_builder.c.a.Y(activity) || com.excean.ab_builder.c.a.X(activity) || com.excean.ab_builder.c.a.f(activity) || com.excean.ab_builder.c.a.g(activity) || com.excean.ab_builder.c.a.m(activity) || com.excean.ab_builder.c.a.O(activity)) {
            return;
        }
        if ((com.excean.ab_builder.c.a.P(activity) && !t.a().l(activity)) || com.excean.ab_builder.c.a.N(activity) || b(activity)) {
            return;
        }
        Log.d("AscentTaskHelper", "groundView: ");
        this.l = activity;
        if (activity == null) {
            return;
        }
        this.i = com.excelliance.kxqp.gs.util.b.bF(this.l);
        if (this.i) {
            this.g = LayoutInflater.from(activity).inflate(R.layout.bottom_groud_rl, (ViewGroup) null);
            this.g.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view2) {
                    com.excelliance.kxqp.gs.g.c.a().a("启动页", "新手礼包", "主页", "新手礼包", "新手礼包任务弹框");
                    if (b.this.j == null) {
                        b.this.j = new d(activity);
                    }
                    if (!b.this.j.isShowing()) {
                        try {
                            b.this.j.show();
                            com.excelliance.kxqp.gs.g.c.a().b("新手礼包");
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                    bz.a().a(b.this.l, 116000, 1, "点击首日新手礼包人数");
                }
            });
            this.h = (TextView) this.g.findViewById(R.id.counting_tv);
            if (view instanceof RelativeLayout) {
                ((RelativeLayout) view).addView(this.g, l(activity));
            } else if (view instanceof ViewGroup) {
                ((ViewGroup) view).addView(this.g);
            }
        } else {
            this.f = new ImageView(activity);
            this.f.setImageResource(com.excelliance.kxqp.gs.util.w.j(activity, "icon_time_limit"));
            this.f.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view2) {
                    if (b.this.j == null) {
                        b.this.j = new d(activity);
                    }
                    if (!b.this.j.isShowing()) {
                        b.this.j.show();
                        com.excelliance.kxqp.gs.g.c.a().b("新手礼包");
                    }
                    bz.a().a(b.this.l, 116000, 1, "点击首日新手礼包人数");
                }
            });
            if (view instanceof RelativeLayout) {
                ((RelativeLayout) view).addView(this.f, l(activity));
            } else if (view instanceof ViewGroup) {
                ((ViewGroup) view).addView(this.f);
            }
        }
        this.d = new e(activity);
        this.e.postDelayed(this.d, 1000L);
        if (this.d == null || !this.i) {
            return;
        }
        this.d.a(this.f6132a);
    }

    public void b() {
        if (this.d == null || !this.i) {
            return;
        }
        this.d.a(this.f6132a);
    }

    public void c() {
        if (this.d == null || !this.i) {
            return;
        }
        this.d.b(this.f6132a);
    }

    public void a(com.excelliance.kxqp.gs.ui.flow.f fVar) {
        if (this.k != null) {
            this.k.add(fVar);
        }
    }

    public void b(com.excelliance.kxqp.gs.ui.flow.f fVar) {
        if (this.k != null) {
            this.k.remove(fVar);
        }
    }

    public void d() {
        if (com.excelliance.kxqp.gs.util.s.a(this.k)) {
            return;
        }
        Iterator<com.excelliance.kxqp.gs.ui.flow.f> it = this.k.iterator();
        while (it.hasNext()) {
            it.next().update(this.c);
        }
    }

    public void update(final Context context, final c cVar) {
        if (b(context)) {
            return;
        }
        Log.d("AscentTaskHelper", "update: ");
        by.a(context, "sp_ascent_task").a("SP_KEY_ASCENT_TASK_ID_" + cVar.f6159a, cVar.f6160b);
        boolean z = true;
        for (c cVar2 : this.c) {
            if (cVar2.f6159a == cVar.f6159a) {
                cVar2.f6160b = cVar.f6160b;
                d();
            }
            if (!cVar2.f6160b) {
                z = false;
            }
        }
        if (!z || by.a(context, "sp_ascent_task").b("sp_key_ascent_task_dialog_auto_show", false).booleanValue()) {
            return;
        }
        if (this.j == null || !this.j.isShowing()) {
            Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    if (b.this.l == null || ai.a().b()) {
                        return;
                    }
                    if (b.this.j == null) {
                        b.this.j = new d(context);
                        if (!b.this.j.isShowing() && !b.this.l.isFinishing()) {
                            try {
                                b.this.j.show();
                                com.excelliance.kxqp.gs.g.c.a().b("新手礼包");
                            } catch (WindowManager.BadTokenException e2) {
                                e2.printStackTrace();
                            }
                        }
                    }
                    if (cVar.f6159a != 1) {
                        by.a(context, "sp_ascent_task").a("sp_key_ascent_task_dialog_auto_show", true);
                    }
                }
            };
            if (cVar.f6159a == 3) {
                this.e.postDelayed(runnable, 6000L);
            } else {
                this.e.post(runnable);
            }
        }
    }

    public class d extends com.excelliance.kxqp.gs.base.f {

        com.excelliance.kxqp.gs.ui.flow.f f6161a;

        com.excelliance.kxqp.gs.ui.flow.f f6162b;
        private TextView f;

        @Override
        public int d() {
            return 32;
        }

        @Override
        public int e() {
            return 35;
        }

        public d(Context context) {
            super(context);
            this.f6161a = new com.excelliance.kxqp.gs.ui.flow.f() {
                @Override
                public void update(Object obj) {
                    if (d.this.f == null || obj == null || !(obj instanceof Long)) {
                        return;
                    }
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(com.excelliance.kxqp.gs.util.b.aU(d.this.getContext()) ? " HH:  mm:  ss" : "HH:mm:ss");
                    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
                    d.this.f.setText(String.format(com.excelliance.kxqp.gs.util.w.e(d.this.getContext(), "ascent_task_time"), simpleDateFormat.format(new Date(((Long) obj).longValue()))));
                }
            };
            this.f6162b = new com.excelliance.kxqp.gs.ui.flow.f() {
                @Override
                public void update(Object obj) {
                    if (!(obj instanceof List) || d.this.c() == null) {
                        return;
                    }
                    boolean z = true;
                    for (Object obj2 : (List) obj) {
                        if (obj2 instanceof c) {
                            c cVar = (c) obj2;
                            d.this.a(cVar);
                            if (!cVar.f6160b) {
                                z = false;
                            }
                        }
                    }
                    View a2 = com.excelliance.kxqp.ui.util.b.a("btn_receive", d.this.c());
                    if (a2 != null) {
                        a2.setEnabled(z);
                    }
                }
            };
        }

        @Override
        protected void a(View view) {
            Button button = (Button) com.excelliance.kxqp.ui.util.b.a("btn_receive", view);
            TextView textView = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_task_title", view);
            TextView textView2 = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_task_content", view);
            Button button2 = (Button) com.excelliance.kxqp.ui.util.b.a("btn_left", view);
            Button button3 = (Button) com.excelliance.kxqp.ui.util.b.a("btn_right", view);
            View a2 = com.excelliance.kxqp.ui.util.b.a("view_space", view);
            this.f = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_time", view);
            if (com.excelliance.kxqp.gs.newappstore.b.c.a(this.c)) {
                if (textView != null) {
                    textView.setTextColor(com.excelliance.kxqp.gs.newappstore.b.c.f7694a);
                }
                if (this.f != null) {
                    this.f.setTextColor(com.excelliance.kxqp.gs.newappstore.b.c.f7694a);
                }
                if (textView2 != null) {
                    textView2.setTextColor(com.excelliance.kxqp.gs.newappstore.b.c.f7694a);
                }
                if (button2 != null) {
                    com.excelliance.kxqp.gs.newappstore.b.c.a(button2, com.excelliance.kxqp.gs.util.w.k(this.c, "bg_btn_to_import_new_store"));
                }
                if (button2 != null) {
                    button2.setTextColor(com.excelliance.kxqp.gs.newappstore.b.c.f7694a);
                }
                if (button3 != null) {
                    com.excelliance.kxqp.gs.newappstore.b.c.a(button3, com.excelliance.kxqp.gs.util.w.k(this.c, "bg_btn_to_download_new_store"));
                }
            }
            if (textView != null) {
                String e = com.excelliance.kxqp.gs.util.w.e(getContext(), "ascent_task_title");
                Object[] objArr = new Object[1];
                objArr[0] = com.excelliance.kxqp.gs.util.b.aR(getContext()) ? "24h" : "48h";
                textView.setText(String.format(e, objArr));
            }
            if (button != null) {
                button.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view2) {
                        d.this.g();
                    }
                });
            }
            if (com.excelliance.kxqp.gs.util.s.a(b.this.c)) {
                return;
            }
            boolean z = true;
            for (int i = 0; i < b.this.c.size(); i++) {
                c cVar = (c) b.this.c.get(i);
                a(cVar);
                if (!cVar.f6160b) {
                    z = false;
                }
            }
            if (button != null) {
                button.setEnabled(z);
            }
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(com.excelliance.kxqp.gs.util.b.aU(getContext()) ? " HH:  mm:  ss" : "HH:mm:ss");
            simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
            this.f.setText(String.format(com.excelliance.kxqp.gs.util.w.e(getContext(), "ascent_task_time"), simpleDateFormat.format(new Date(b.i(getContext())))));
            if (b.this.d != null) {
                b.this.d.a(this.f6161a);
            }
            b.f6131b.a(this.f6162b);
            if (com.excelliance.kxqp.gs.util.b.aU(getContext())) {
                for (c cVar2 : b.this.c) {
                    if (cVar2.f6159a == 2) {
                        if (cVar2.f6160b) {
                            if (button2 != null) {
                                button2.setVisibility(8);
                            }
                            if (a2 != null) {
                                a2.setVisibility(8);
                            }
                            if (button3 != null) {
                                button3.setVisibility(0);
                                if (b.this.i) {
                                    button3.setText(this.c.getResources().getString(R.string.ascent_to_accelerate));
                                } else {
                                    button3.setText(this.c.getResources().getString(R.string.ascent_to_start));
                                }
                                button3.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view2) {
                                        d.this.dismiss();
                                        v.a().a(b.this.l, "scrollGridView");
                                        String charSequence = view2 instanceof Button ? ((Button) view2).getText().toString() : null;
                                        com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "新手任务弹框-" + charSequence, (String) null);
                                    }
                                });
                            }
                        } else {
                            if (button2 != null) {
                                button2.setText(com.excelliance.kxqp.gs.util.w.e(getContext(), "ascent_to_import"));
                                button2.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view2) {
                                        d.this.dismiss();
                                        v.a().a(b.this.l, "gridItemImportLocal");
                                        com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "新手任务弹框-导入", (String) null);
                                    }
                                });
                            }
                            if (button3 != null) {
                                ViewSwitcher a3 = ViewSwitcher.a(this.c);
                                if (b.this.i && a3.f()) {
                                    button3.setVisibility(0);
                                } else {
                                    button3.setVisibility(8);
                                }
                                button3.setText(com.excelliance.kxqp.gs.util.w.e(getContext(), "ascent_to_download"));
                                button3.setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View view2) {
                                        d.this.dismiss();
                                        if (b.this.i) {
                                            Intent intent = new Intent(b.this.l.getPackageName() + ".action.switch.fragment");
                                            intent.putExtra("index", com.excelliance.kxqp.gs.main.c.e());
                                            b.this.l.sendBroadcast(intent);
                                            com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "新手任务弹框-去下载", "去排行榜");
                                            return;
                                        }
                                        v.a().a(b.this.l, "area_today_recommend");
                                        b.this.e();
                                        com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "新手任务弹框-去下载", (String) null);
                                    }
                                });
                            }
                        }
                    } else if (cVar2.f6159a == 3 && cVar2.f6160b) {
                        if (button2 != null) {
                            button2.setVisibility(8);
                        }
                        if (a2 != null) {
                            a2.setVisibility(8);
                        }
                        if (button3 != null) {
                            button3.setVisibility(0);
                            button3.setText(com.excelliance.kxqp.gs.util.w.e(getContext(), "receive"));
                            button3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View view2) {
                                    d.this.g();
                                }
                            });
                        }
                    }
                }
            }
        }

        public void g() {
            bz.a().a(b.this.l, 116000, 4, "点击领取新手礼包独立用户数");
            if (bx.a().b(getContext())) {
                bz.a().a(b.this.l, 116000, 2, "点击领取新手礼包时处于登陆状态人数");
                b.this.j(getContext());
                com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "新手任务弹框-领取", "领取");
            } else if (b.this.l != null) {
                bz.a().a(b.this.l, 116000, 3, "点击领取新手礼包时处于未登陆状态人数");
                Bundle bundle = new Bundle();
                bundle.putInt("flag", 2);
                com.excelliance.kxqp.gs.router.a.a.f8074a.invokeLoginWithBundle(b.this.l, 1000, bundle);
                com.excelliance.kxqp.gs.g.c.a().a((String) null, (String) null, "弹框页", "新手任务弹框-领取", "去登陆页面");
            } else {
                Log.e("AscentTaskHelper", "onClick exception: mActivity is Null");
            }
            dismiss();
        }

        @Override
        protected int b(WindowManager windowManager) {
            return ad.a(getContext(), com.excelliance.kxqp.gs.util.b.aU(getContext()) ? 300.0f : 293.0f);
        }

        @Override
        public void onWindowFocusChanged(boolean z) {
            super.onWindowFocusChanged(z);
            h();
        }

        private void h() {
            if (b.this.c == null) {
                return;
            }
            int i = 0;
            for (int i2 = 1; i2 <= b.this.c.size(); i2++) {
                TextView textView = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_task_0" + i2, c());
                if (textView != null && textView.getWidth() > i) {
                    i = textView.getWidth();
                }
            }
            for (int i3 = 1; i3 <= b.this.c.size(); i3++) {
                TextView textView2 = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_task_0" + i3, c());
                if (textView2 != null) {
                    textView2.getLayoutParams().width = i;
                    textView2.requestLayout();
                }
            }
        }

        public void a(c cVar) {
            TextView textView = (TextView) com.excelliance.kxqp.ui.util.b.a("tv_task_0" + cVar.f6159a, c());
            if (textView != null) {
                String str = com.excelliance.kxqp.gs.util.b.aU(getContext()) ? "ascent_task_task_with_guide_0" : "ascent_task_task_0";
                textView.setText(String.format(com.excelliance.kxqp.gs.util.w.e(getContext(), str + cVar.f6159a), Integer.valueOf(cVar.f6160b ? 1 : 0)));
                textView.setSelected(cVar.f6160b);
                if (com.excelliance.kxqp.gs.util.b.aU(getContext())) {
                    if (!cVar.f6160b) {
                        if (!com.excelliance.kxqp.gs.util.s.a(b.this.c)) {
                            for (c cVar2 : b.this.c) {
                                if (cVar2.f6159a == cVar.f6159a - 1) {
                                    boolean z = cVar2.f6160b;
                                }
                            }
                        }
                        com.excelliance.kxqp.gs.ui.view.d a2 = new d.a().e(ad.a(getContext(), 24.0f)).f(ad.a(getContext(), 24.0f)).a(Color.parseColor("#F5F5F5")).c(cVar.f6159a).b(Color.parseColor("#333333")).d(ad.c(getContext(), 12.0f)).a(getContext());
                        textView.setTextColor(Color.parseColor("#333333"));
                        a2.setBounds(0, 0, ad.a(getContext(), 24.0f), ad.a(getContext(), 24.0f));
                        textView.setCompoundDrawables(a2, null, null, null);
                        return;
                    }
                    com.excelliance.kxqp.ui.util.b.a(textView, com.excelliance.kxqp.gs.util.w.k(getContext(), "icon_ascent_completed"), null, null, null);
                    if (com.excelliance.kxqp.gs.newappstore.b.c.a(this.c)) {
                        textView.setTextColor(com.excelliance.kxqp.gs.newappstore.b.c.f7694a);
                    }
                }
            }
        }

        @Override
        public String b() {
            return com.excelliance.kxqp.gs.util.b.aU(getContext()) ? "dialog_ascent_task_with_guide" : "dialog_ascent_task";
        }

        @Override
        public void onDetachedFromWindow() {
            super.onDetachedFromWindow();
            if (b.this.d != null) {
                b.this.d.b(this.f6161a);
            }
            if (b.f6131b != null) {
                b.f6131b.b(this.f6162b);
            }
            b.this.j = null;
        }
    }

    public void j(final Context context) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                final ResponseData<C0235b> c2 = b.this.c(context);
                if (context != null && c2 != null && c2.code == 1 && c2.data != null) {
                    SharedPreferences sharedPreferences = context.getSharedPreferences("USERINFO", Build.VERSION.SDK_INT < 11 ? 0 : 4);
                    aa.a(context).a(c2.data.f6157a);
                    bx.a().b(sharedPreferences, "END_TIME", String.valueOf(c2.data.f6158b));
                    bx.a().a(sharedPreferences, "OFFER_VIP", 1);
                    Log.d("AscentTaskHelper", "run before: " + c2.data.f6158b);
                    Log.d("AscentTaskHelper", "run after: " + bx.a().a(sharedPreferences, "END_TIME"));
                    tp.i(new Runnable() {
                        @Override
                        public void run() {
                            Intent intent = new Intent("updata_user_info");
                            intent.putExtra("vip", ((C0235b) c2.data).f6157a);
                            context.sendBroadcast(intent);
                            b.this.k(context);
                            bz.a().a(b.this.l, 116000, 5, "领取成功独立用户数");
                            b.this.g();
                        }
                    });
                } else {
                    tp.a(new Runnable() {
                        @Override
                        public void run() {
                            if (c2 != null && !TextUtils.isEmpty(c2.msg)) {
                                Toast.makeText(context, c2.msg, 0).show();
                            } else {
                                Toast.makeText(context, com.excelliance.kxqp.gs.util.w.e(context, "ascent_task_receive_failure"), 0).show();
                            }
                            b.this.g();
                        }
                    }, 500L);
                }
                by.a(context, "sp_ascent_task").a("sp_key_ascent_task_receive_completed", true);
            }
        });
    }

    public ResponseData<C0235b> c(Context context) {
        return a(context, "");
    }

    public ResponseData<C0235b> a(Context context, String str) {
        com.excelliance.kxqp.gs.discover.bbs.c cVar = new com.excelliance.kxqp.gs.discover.bbs.c(context);
        JSONObject i = cn.i(context);
        if (!TextUtils.isEmpty(str)) {
            try {
                i.put("type", str);
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }
        return cVar.a(i.toString(), "https://api.ourplay.com.cn/goneload/taskvip", new com.excelliance.kxqp.gs.discover.a.c<C0235b>() {
            @Override
            public ResponseData<C0235b> a(String str2) {
                ResponseData<C0235b> responseData = new ResponseData<>();
                try {
                    az.d("AscentTaskHelper", "run: response::" + str2);
                    JSONObject jSONObject = new JSONObject(str2);
                    responseData.code = jSONObject.optInt("code");
                    responseData.msg = jSONObject.optString("msg");
                    JSONObject optJSONObject = jSONObject.optJSONObject("data");
                    if (optJSONObject != null) {
                        responseData.data = new C0235b();
                        responseData.data.f6157a = optJSONObject.optInt("vip");
                        responseData.data.f6158b = optJSONObject.optLong("endTime");
                    }
                    return responseData;
                } catch (JSONException e3) {
                    Log.d("AscentTaskHelper", "receive/run: " + e3.getMessage());
                    e3.printStackTrace();
                    return null;
                }
            }
        });
    }

    public void k(final Context context) {
        tp.a(new Runnable() {
            @Override
            public void run() {
                final com.excelliance.kxqp.gs.dialog.g gVar = new com.excelliance.kxqp.gs.dialog.g(context, com.excelliance.kxqp.gs.util.w.o(context, "theme_dialog_no_title2"));
                gVar.a(new b.InterfaceC0157b() {
                    @Override
                    public void b(int i, Message message, int i2) {
                    }

                    @Override
                    public void a(int i, Message message, int i2) {
                        gVar.dismiss();
                    }
                });
                if (gVar.isShowing()) {
                    return;
                }
                String e2 = com.excelliance.kxqp.gs.util.w.e(context, "confirm");
                String e3 = com.excelliance.kxqp.gs.util.w.e(context, "title");
                String e4 = com.excelliance.kxqp.gs.util.w.e(context, "ascent_task_receive_success");
                gVar.show();
                gVar.b(e3);
                gVar.a(e4);
                gVar.a(true, e2, null);
                if (com.excelliance.kxqp.gs.newappstore.b.c.a(context)) {
                    gVar.a(com.excelliance.kxqp.gs.newappstore.b.c.f7694a);
                }
            }
        }, 1000L);
        cg.a(context, com.excelliance.kxqp.gs.util.w.e(context, "ascent_task_receive_success"));
        context.sendBroadcast(new Intent(context.getPackageName() + ".action.operate.proxy.dialog"));
    }

    @Override
    public void a() {
        if (this.e != null && this.d != null) {
            this.e.removeCallbacks(this.d);
        }
        this.l = null;
        this.c = null;
        this.k = null;
        this.f = null;
        this.h = null;
        this.g = null;
        this.j = null;
        this.d = null;
        f6131b = null;
        this.m = null;
    }

    public static class c {

        int f6159a;

        boolean f6160b;

        public c(int i, boolean z) {
            this.f6159a = i;
            this.f6160b = z;
        }
    }

    public class C0235b {

        @SerializedName("vip")
        public int f6157a;

        @SerializedName("endTime")
        public long f6158b;

        public C0235b() {
        }

        public String toString() {
            return "Prize{vip=" + this.f6157a + ", endTime=" + this.f6158b + '}';
        }
    }

    public class e implements Runnable {

        private Context f6171b;
        private List<com.excelliance.kxqp.gs.ui.flow.f> c = new ArrayList();

        public e(Context context) {
            this.f6171b = context;
        }

        @Override
        public void run() {
            if (!b.this.h(this.f6171b)) {
                b.this.g();
            } else {
                a();
                b.this.e.postDelayed(b.this.d, 1000L);
            }
        }

        public void a(com.excelliance.kxqp.gs.ui.flow.f fVar) {
            if (this.c != null) {
                this.c.add(fVar);
            }
        }

        public void b(com.excelliance.kxqp.gs.ui.flow.f fVar) {
            if (this.c != null) {
                this.c.remove(fVar);
            }
        }

        public void a() {
            Iterator<com.excelliance.kxqp.gs.ui.flow.f> it = this.c.iterator();
            while (it.hasNext()) {
                it.next().update(Long.valueOf(b.i(this.f6171b)));
            }
        }
    }

    public void a(Context context, int i, int i2, Intent intent) {
        Log.d("AscentTaskHelper", "onActivityResult/requestCode: " + i);
        if (i == 1000 && i2 == -1 && intent != null && intent.getExtras() != null && intent.getExtras().getInt("flag", 0) == 2) {
            j(context);
            com.excelliance.kxqp.gs.main.c.a(context);
        } else if (i == 1004 && i2 == -1 && intent != null && intent.getExtras() != null && intent.getExtras().getInt("flag", 0) == 3) {
            com.excelliance.kxqp.bitmap.ui.b.a().a(new a("extended_vip_time"));
        }
    }

    public void d(Context context) {
        if (!(context instanceof Activity) || ((Activity) context).isFinishing()) {
            return;
        }
        e(context);
        if (this.m == null) {
            this.m = new com.excelliance.kxqp.gs.dialog.u(context);
        }
        try {
            this.m.show();
            ((ImageView) this.m.findViewById(R.id.next_day_login_award_icon)).setImageResource(R.drawable.gain_next_day_award_succeed_icon);
            ((TextView) this.m.findViewById(R.id.award_notify_msg)).setText(R.string.k_get_suc);
            TextView textView = (TextView) this.m.findViewById(R.id.btn_confirm);
            textView.setText(R.string.agree_and_continue);
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (b.this.m == null || !b.this.m.isShowing()) {
                        return;
                    }
                    b.this.m.dismiss();
                    b.this.m = null;
                }
            });
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void e(Context context) {
        by.a(context, "sp_config").a("sp_key_next_day_award_show", false);
        if (this.g == null || !(this.g.getParent() instanceof ViewGroup)) {
            return;
        }
        ((ViewGroup) this.g.getParent()).removeView(this.g);
    }

    public void g() {
        if (this.e != null && this.d != null) {
            this.e.removeCallbacks(this.d);
        }
        if (this.f != null && (this.f.getParent() instanceof ViewGroup)) {
            ((ViewGroup) this.f.getParent()).removeView(this.f);
        }
        if (this.g != null && (this.g.getParent() instanceof ViewGroup)) {
            ViewGroup viewGroup = (ViewGroup) this.g.getParent();
            viewGroup.removeView(this.g);
            if (this.l != null) {
                boolean booleanValue = by.a(this.l, "sp_ascent_task").b("sp_key_ascent_task_receive_completed", false).booleanValue();
                if (com.excelliance.kxqp.gs.util.b.cp(this.l) && booleanValue) {
                    by.a(this.l, "sp_config").a("sp_key_next_day_award_show", true);
                    Calendar calendar = Calendar.getInstance();
                    calendar.setTimeInMillis(ce.a(this.l));
                    calendar.set(11, 0);
                    calendar.set(12, 0);
                    calendar.set(13, 0);
                    calendar.add(5, 1);
                    by.a(this.l, "sp_config").a("sp_key_award_time", calendar.getTimeInMillis());
                    b(this.l, viewGroup);
                }
            }
        }
        if (this.j == null || !this.j.isShowing()) {
            return;
        }
        this.j.dismiss();
    }

    public void b(final Activity activity, View view) {
        if (view == null || activity == null) {
            return;
        }
        if (this.g == null) {
            this.g = LayoutInflater.from(activity).inflate(R.layout.bottom_groud_rl, (ViewGroup) null);
        }
        if (view instanceof RelativeLayout) {
            ((RelativeLayout) view).addView(this.g, l(activity));
        } else if (view instanceof ViewGroup) {
            ((ViewGroup) view).addView(this.g);
        }
        final long a2 = by.a(activity, "sp_config").a("sp_key_award_time", (Long) 0L);
        if (a2 == 0) {
            az.d("AscentTaskHelper", "availableTime is 0!");
            return;
        }
        ImageView imageView = (ImageView) this.g.findViewById(R.id.ground_iv);
        this.h = (TextView) this.g.findViewById(R.id.counting_tv);
        imageView.setImageResource(R.drawable.icon_time_limit_v2);
        this.h.setText(ce.a(this.l) < a2 ? R.string.open_tomorrow : R.string.gain_next_day_award);
        if (this.m == null) {
            this.m = new com.excelliance.kxqp.gs.dialog.u(activity);
        }
        this.g.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                if (b.this.m == null || b.this.m.isShowing() || activity.isFinishing()) {
                    return;
                }
                try {
                    b.this.m.show();
                    ImageView imageView2 = (ImageView) b.this.m.findViewById(R.id.next_day_login_award_icon);
                    TextView textView = (TextView) b.this.m.findViewById(R.id.award_notify_msg);
                    TextView textView2 = (TextView) b.this.m.findViewById(R.id.btn_confirm);
                    imageView2.setImageResource(R.drawable.next_day_login_award_icon);
                    if (ce.a(b.this.l) < a2) {
                        textView.setText(R.string.next_day_login_award_text);
                        textView2.setText(R.string.me_login_tips_sure);
                        textView2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view3) {
                                if (b.this.m == null || !b.this.m.isShowing()) {
                                    return;
                                }
                                b.this.m.dismiss();
                            }
                        });
                        bz.a().a(activity, 149000, 1, "第一日点击次日礼包数");
                    } else {
                        textView.setText(R.string.gain_next_day_award_desc);
                        textView2.setText(R.string.gain_next_day_award);
                        textView2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view3) {
                                if (b.this.m != null && b.this.m.isShowing()) {
                                    b.this.m.dismiss();
                                }
                                if (!bx.a().b(activity)) {
                                    Bundle bundle = new Bundle();
                                    bundle.putInt("flag", 3);
                                    com.excelliance.kxqp.gs.router.a.a.f8074a.invokeLoginWithBundle(activity, 1004, bundle);
                                    return;
                                }
                                com.excelliance.kxqp.bitmap.ui.b.a().a(new a("extended_vip_time"));
                            }
                        });
                        bz.a().a(activity, 149000, 2, "第二日礼包点击数");
                    }
                } catch (Exception e2) {
                    Log.d("AscentTaskHelper", "onClick: " + e2.toString());
                    e2.printStackTrace();
                }
            }
        });
    }

    public void a(long j) {
        long a2 = ce.a(this.l);
        long j2 = 86400000 + j;
        if (a2 < j2 && a2 >= j) {
            if (this.h != null) {
                this.h.setText(R.string.gain_next_day_award);
            }
        } else if (a2 > j2) {
            if (this.g != null && this.g.getParent() != null) {
                ((ViewGroup) this.g.getParent()).removeView(this.g);
            }
            by.a(this.l, "sp_config").a("sp_key_next_day_award_show", false);
        }
    }

    private RelativeLayout.LayoutParams l(Context context) {
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams.addRule(11);
        layoutParams.addRule(12);
        layoutParams.bottomMargin = ad.a(context, 67.0f);
        layoutParams.rightMargin = ad.a(context, 23.0f);
        return layoutParams;
    }

    public void e() {
        if (this.f != null) {
            if (this.f.getVisibility() == 0) {
                this.f.setVisibility(8);
            } else {
                this.f.setVisibility(0);
            }
        }
        if (this.g != null) {
            if (this.g.getVisibility() == 0) {
                this.g.setVisibility(8);
            } else {
                this.g.setVisibility(0);
            }
        }
    }

    public static class a {

        private String f6156a;

        public a(String str) {
            this.f6156a = str;
        }

        public String a() {
            return this.f6156a;
        }
    }
}