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

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


package com.excelliance.game.collection.mine;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.excelliance.game.collection.R;
import com.excelliance.game.collection.b.c;
import com.excelliance.game.collection.b.d;
import com.excelliance.game.collection.b.e;
import com.excelliance.game.collection.base.BaseMultiListAdapter;
import com.excelliance.game.collection.base.GSBaseActivity;
import com.excelliance.game.collection.bean.CollectionMineBean;
import com.excelliance.game.collection.bus.Subscribe;
import com.excelliance.game.collection.bus.ThreadMode;
import com.excelliance.game.collection.c.a;
import com.excelliance.game.collection.c.b;
import com.excelliance.game.collection.detail.ActivityCollectionDetail;
import com.excelliance.game.collection.edit.ActivityCollectionEdit;
import com.excelliance.game.collection.mine.a;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ActivityMyCollection extends GSBaseActivity<b> implements a.b {
    final BaseMultiListAdapter.a e = new BaseMultiListAdapter.a() {
        @Override
        public void a(int i, View view) {
            if (view.getId() == R.id.iv_add) {
                ActivityMyCollection.this.p();
            }
            if (view.getId() == R.id.iv_share) {
                ActivityMyCollection.this.a(i);
            } else if (view.getId() == R.id.iv_more) {
                ActivityMyCollection.this.b(i);
            }
        }
    };
    final BaseMultiListAdapter.c f = new BaseMultiListAdapter.c() {
        @Override
        public void a(View view, int i) {
            switch (ActivityMyCollection.this.j.getItemViewType(i)) {
                case 0:
                    ActivityMyCollection.this.j.a();
                    return;
                case 1:
                    ActivityCollectionDetail.a(ActivityMyCollection.this.f1738b, ActivityMyCollection.this.j.c().get(i - 1).cid);
                    return;
                case 2:
                    ActivityMyCollection.this.j.b();
                    return;
                case 3:
                    ActivityCollectionDetail.a(ActivityMyCollection.this.f1738b, ActivityMyCollection.this.j.d().get((i - 2) - ActivityMyCollection.this.j.c().size()).cid);
                    return;
                default:
                    return;
            }
        }
    };
    private ImageView g;
    private TextView h;
    private RecyclerView i;
    private AdapterMyCollection j;
    private com.excelliance.game.collection.c.a k;
    private com.excelliance.game.collection.c.b l;

    @Override
    public boolean f() {
        return true;
    }

    @Override
    public boolean i() {
        return false;
    }

    public static void a(Context context) {
        context.startActivity(new Intent(context, (Class<?>) ActivityMyCollection.class));
    }

    @Override
    protected int h() {
        return R.layout.collection_activity_my_collections;
    }

    @Override
    public void singleClick(View view) {
        if (((Integer) view.getTag()).intValue() != 1) {
            return;
        }
        finish();
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        n();
        com.excelliance.game.collection.bus.b.a().a(this);
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        com.excelliance.game.collection.bus.b.a().b(this);
    }

    @Override
    protected void g() {
        this.g = (ImageView) findViewById(R.id.iv_back);
        this.h = (TextView) findViewById(R.id.tv_title);
        this.i = (RecyclerView) findViewById(R.id.rv_collection);
        this.g.setTag(1);
        this.g.setOnClickListener(this);
        this.h.setText(R.string.collection_mine_title);
        this.i.setLayoutManager(new LinearLayoutManager(this.f1738b));
    }

    private void n() {
        this.j = new AdapterMyCollection(this.f1738b, null, null);
        this.j.a(this.f);
        this.j.a(this.e);
        this.i.setAdapter(this.j);
        ((b) this.c).b();
        ((b) this.c).c();
    }

    private void o() {
        this.j.b((List<CollectionMineBean>) null);
        this.j.a((List<CollectionMineBean>) null);
        ((b) this.c).b();
        ((b) this.c).c();
    }

    @Override
    public b j() {
        return new b(this.f1738b, this);
    }

    @Override
    public void a(boolean z, List<CollectionMineBean> list) {
        if (z) {
            this.j.a(list);
        }
    }

    @Override
    public void b(boolean z, List<CollectionMineBean> list) {
        if (z) {
            this.j.b(list);
        }
    }

    @Override
    public void a(boolean z, long j) {
        l();
        if (z) {
            Toast.makeText(this.f1738b, R.string.collection_mine_delete_success, 0).show();
            if (this.j.c() == null) {
                return;
            }
            int i = -1;
            for (CollectionMineBean collectionMineBean : this.j.c()) {
                i++;
                if (collectionMineBean.cid == j) {
                    this.j.c().remove(collectionMineBean);
                    int a2 = this.j.a(i);
                    this.j.notifyItemRemoved(a2);
                    this.j.notifyItemRangeChanged(a2, this.j.getItemCount() - a2);
                    this.j.notifyItemChanged(this.j.e());
                    return;
                }
            }
            return;
        }
        Toast.makeText(this.f1738b, R.string.collection_mine_delete_failed, 0).show();
    }

    @Override
    public void b(boolean z, long j) {
        l();
        if (z) {
            Toast.makeText(this.f1738b, R.string.collection_mine_delete_success, 0).show();
            if (this.j.d() == null) {
                return;
            }
            int i = -1;
            for (CollectionMineBean collectionMineBean : this.j.d()) {
                i++;
                if (collectionMineBean.cid == j) {
                    this.j.d().remove(collectionMineBean);
                    int b2 = this.j.b(i);
                    this.j.notifyItemRemoved(b2);
                    this.j.notifyItemRangeChanged(b2, this.j.getItemCount() - b2);
                    this.j.notifyItemChanged(this.j.f());
                    return;
                }
            }
            return;
        }
        Toast.makeText(this.f1738b, R.string.collection_mine_delete_failed, 0).show();
    }

    public void p() {
        com.excelliance.game.collection.dialog.a.a(this);
    }

    public void a(int i) {
        CollectionMineBean collectionMineBean;
        if (this.l == null) {
            this.l = new com.excelliance.game.collection.c.b(this);
        }
        if (i <= this.j.c().size()) {
            collectionMineBean = this.j.c().get(i - 1);
        } else {
            collectionMineBean = this.j.d().get((i - 2) - this.j.c().size());
        }
        if (collectionMineBean != null) {
            b.a aVar = new b.a();
            aVar.f1775a = "http://h5.ourplay.com.cn/opsinglegame?id=" + collectionMineBean.cid;
            aVar.f1776b = collectionMineBean.iconUrl;
            aVar.c = com.excelliance.game.collection.d.a.a(collectionMineBean.title);
            aVar.d = "来OurPlay创作游戏单,玩转全球好游戏及好应用~";
            this.l.a(aVar);
        }
    }

    public void b(int i) {
        if (this.k == null) {
            this.k = new com.excelliance.game.collection.c.a(this);
        }
        if (i <= this.j.c().size()) {
            final CollectionMineBean collectionMineBean = this.j.c().get(i - 1);
            this.k.a(new ArrayList<a.C0065a>() {
                {
                    add(ActivityMyCollection.this.a(collectionMineBean));
                    add(ActivityMyCollection.this.a(collectionMineBean, true));
                }
            });
        } else {
            final CollectionMineBean collectionMineBean2 = this.j.d().get((i - 2) - this.j.c().size());
            this.k.a(new ArrayList<a.C0065a>() {
                {
                    add(ActivityMyCollection.this.a(collectionMineBean2, false));
                }
            });
        }
    }

    public a.C0065a a(final CollectionMineBean collectionMineBean) {
        return new a.C0065a(getString(R.string.collection_mine_edit), getResources().getColor(R.color.collection_main_color), 16.0f, new Runnable() {
            @Override
            public void run() {
                ActivityCollectionEdit.a(ActivityMyCollection.this, collectionMineBean.cid);
            }
        }, true);
    }

    public a.C0065a a(final CollectionMineBean collectionMineBean, final boolean z) {
        return new a.C0065a(getString(R.string.collection_mine_delete), getResources().getColor((z && collectionMineBean.isDefault()) ? R.color.collection_grey_color : R.color.collection_red_color), 16.0f, new Runnable() {
            @Override
            public void run() {
                ActivityMyCollection.this.b(collectionMineBean, z);
            }
        }, true);
    }

    public void b(final CollectionMineBean collectionMineBean, final boolean z) {
        if (z && collectionMineBean.isDefault()) {
            Toast.makeText(this, R.string.collection_mine_cannot_delete_default, 0).show();
        } else {
            com.excelliance.game.collection.dialog.b.a(this.f1738b, getString(R.string.collection_mine_confirm_delete), collectionMineBean.title, new Runnable() {
                @Override
                public void run() {
                    ActivityMyCollection.this.a(ActivityMyCollection.this.getString(R.string.collection_loading_please_wait));
                    if (z) {
                        ((b) ActivityMyCollection.this.c).a(collectionMineBean.cid);
                    } else {
                        ((b) ActivityMyCollection.this.c).b(collectionMineBean.cid);
                    }
                }
            });
        }
    }

    @Subscribe(threadMode = ThreadMode.MainThread)
    public void onZmEvent(com.excelliance.game.collection.b.b bVar) {
        o();
        try {
            ActivityCollectionDetail.a(this.f1738b, Long.valueOf(bVar.f1726a).longValue());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Subscribe(threadMode = ThreadMode.MainThread)
    public void onZmEvent(e eVar) {
        int i = -1;
        for (CollectionMineBean collectionMineBean : this.j.c()) {
            i++;
            if (collectionMineBean.cid == eVar.f1731a) {
                collectionMineBean.count = eVar.f1732b.size();
                this.j.notifyItemChanged(this.j.a(i));
                return;
            }
        }
    }

    @Subscribe(threadMode = ThreadMode.MainThread)
    public void onZmEvent(com.excelliance.game.collection.b.a aVar) {
        if (aVar != null) {
            int i = -1;
            for (CollectionMineBean collectionMineBean : this.j.c()) {
                i++;
                if (collectionMineBean.cid == aVar.f1724a) {
                    if (TextUtils.isEmpty(collectionMineBean.iconUrl)) {
                        collectionMineBean.iconUrl = aVar.f1725b;
                    }
                    collectionMineBean.count++;
                    this.j.notifyItemChanged(this.j.a(i));
                    return;
                }
            }
        }
    }

    @Subscribe(threadMode = ThreadMode.MainThread)
    public void onZmEvent(d dVar) {
        if (dVar == null) {
            return;
        }
        if (dVar.f1729a) {
            int i = -1;
            Iterator<CollectionMineBean> it = this.j.d().iterator();
            while (it.hasNext()) {
                i++;
                if (it.next().cid == dVar.f1730b) {
                    int b2 = this.j.b(i);
                    this.j.d().remove(i);
                    this.j.notifyItemRemoved(b2);
                    this.j.notifyItemRangeChanged(b2, this.j.getItemCount() - b2);
                    this.j.notifyItemChanged(this.j.f());
                    return;
                }
            }
            return;
        }
        o();
    }

    @Subscribe(threadMode = ThreadMode.MainThread)
    public void onZmEvent(c cVar) {
        if (cVar == null) {
            return;
        }
        int i = -1;
        for (CollectionMineBean collectionMineBean : this.j.c()) {
            i++;
            if (collectionMineBean.cid == cVar.f1727a) {
                if (!TextUtils.isEmpty(cVar.f1728b)) {
                    collectionMineBean.iconUrl = cVar.f1728b;
                }
                collectionMineBean.title = cVar.c;
                collectionMineBean.isPrivate = cVar.e ? 1 : 0;
                this.j.notifyItemChanged(this.j.a(i));
                return;
            }
        }
    }
}