导航菜单

页面标题

页面副标题

Mantra Counter v25.01 - GroupInfoPage.java 源代码

正在查看: Mantra Counter v25.01 应用的 GroupInfoPage.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.sweetedge.mantracounter.group;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.bumptech.glide.Glide;
import com.google.firebase.crashlytics.buildtools.reloc.org.apache.commons.io.IOUtils;
import com.sweetedge.mantracounter.Authentication.UserDataPref;
import com.sweetedge.mantracounter.MainActivity;
import com.sweetedge.mantracounter.R;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import save_data.Const;
import sweetedge.extra.PLog;
import sweetedge.popup.PToast;
import sweetedge.preference.PSharedPreference;

public class GroupInfoPage extends AppCompatActivity {
    public static String GroupCreated;
    public static String GroupId;
    public static String GroupImage;
    public static String GroupInfo;
    public static String GroupName;
    public static String GroupTarget;
    public static Drawable groupImageDrawable;
    ImageView AdminImage;
    TextView AdminJapa;
    TextView AdminName;
    TextView AdminPhone;
    ProgressBar AdminprogressBar;
    TextView AdminprogressText;
    ImageView BackClose;
    RelativeLayout GroupInfoLayout;
    RecyclerView MemberListView;
    TextView TotalJapa;
    TextView groupCreate;
    ImageView groupImage;
    TextView groupInfo;
    TextView groupName;
    TextView group_target;
    MyMemberlistAdapter memAdapter;
    int memberTotal;
    int member_Pending;
    int member_completed;
    int member_ok;
    long totalCounterofAllMembersofGroup = 0;
    ArrayList<MyGroupMemberPojo> memberlist = new ArrayList<>();

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        MainActivity.setLanguage(this);
        setContentView(R.layout.group_info_page);
        this.BackClose = (ImageView) findViewById(R.id.back_close);
        this.groupName = (TextView) findViewById(R.id.groupname);
        this.groupInfo = (TextView) findViewById(R.id.groupInfo);
        this.TotalJapa = (TextView) findViewById(R.id.totalJapa);
        this.groupCreate = (TextView) findViewById(R.id.groupcreated);
        this.group_target = (TextView) findViewById(R.id.group_target);
        this.MemberListView = findViewById(R.id.memberList);
        this.GroupInfoLayout = (RelativeLayout) findViewById(R.id.groupInfoLayout);
        this.groupImage = (ImageView) findViewById(R.id.groupImage);
        this.AdminImage = (ImageView) findViewById(R.id.admin_img);
        this.AdminName = (TextView) findViewById(R.id.admin_name);
        this.AdminPhone = (TextView) findViewById(R.id.admin_Number);
        this.AdminJapa = (TextView) findViewById(R.id.admin_Japa);
        this.AdminprogressBar = (ProgressBar) findViewById(R.id.adminprogressBar);
        this.AdminprogressText = (TextView) findViewById(R.id.adminprogressText);
        FetchGroupInfo(this, GroupId);
        this.group_target.setText(getResources().getString(R.string.target_txt) + ": " + GroupTarget);
        this.BackClose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                GroupInfoPage.this.finish();
            }
        });
        TextView textView = this.groupCreate;
        StringBuilder sb = new StringBuilder();
        sb.append(getResources().getString(R.string.created));
        sb.append(IOUtils.LINE_SEPARATOR_UNIX);
        String str = GroupCreated;
        sb.append(str.substring(0, str.indexOf("[")));
        textView.setText(sb.toString());
        Drawable drawable = groupImageDrawable;
        if (drawable == null) {
            Glide.with(this).load(GroupImage).into(this.groupImage);
        } else {
            this.groupImage.setImageDrawable(drawable);
        }
        this.groupName.setText(GroupName);
    }

    private void FetchGroupInfo(final Context context, final String str) {
        LoadingDialog.showD(context);
        PLog.print("Getting Group Data for " + str);
        Volley.newRequestQueue(context).add(new StringRequest(1, GroupConst.groupInfobyGID, new Response.Listener<String>() {
            public void onResponse(String str2) {
                PLog.print("Info " + str2);
                try {
                    LoadingDialog.hideD();
                    GroupInfoPage.this.memberlist.clear();
                    JSONObject jSONObject = new JSONObject(str2);
                    if (jSONObject.has("MyMember")) {
                        int i = 0;
                        GroupInfoPage.this.member_Pending = 0;
                        GroupInfoPage.this.member_ok = 0;
                        GroupInfoPage.this.member_completed = 0;
                        GroupInfoPage.this.memberTotal = 0;
                        GroupInfoPage.this.totalCounterofAllMembersofGroup = 0L;
                        if (jSONObject.get("MyMember").toString().equals("null")) {
                            PLog.print("No Groups");
                        } else {
                            JSONArray jSONArray = jSONObject.getJSONArray("MyMember");
                            if (jSONArray.length() > 0) {
                                GroupInfoPage.this.memberTotal = jSONArray.length();
                                int i2 = 0;
                                while (i2 < jSONArray.length()) {
                                    String string = jSONArray.getJSONObject(i2).getString("Name");
                                    String string2 = jSONArray.getJSONObject(i2).getString("Img");
                                    String string3 = jSONArray.getJSONObject(i2).getString("Gmail");
                                    String string4 = jSONArray.getJSONObject(i2).getString("Info");
                                    String string5 = jSONArray.getJSONObject(i2).getString("Mantra");
                                    String string6 = jSONArray.getJSONObject(i2).getString("Completed");
                                    String string7 = jSONArray.getJSONObject(i2).getString("Status");
                                    GroupInfoPage.this.totalCounterofAllMembersofGroup += Long.parseLong(string5);
                                    if (string4.equals("Admin")) {
                                        if (UserDataPref.get(GroupInfoPage.this, Const.GMAIL).equals(string3)) {
                                            GroupInfoPage.this.AdminName.setText(string + " (You)");
                                        } else {
                                            GroupInfoPage.this.AdminName.setText(string);
                                        }
                                        GroupInfoPage.this.AdminPhone.setText(string3);
                                        GroupInfoPage.this.AdminJapa.setText(string5);
                                        GroupInfoPage groupInfoPage = GroupInfoPage.this;
                                        groupInfoPage.SetProgress(groupInfoPage.AdminprogressBar, GroupInfoPage.GroupTarget, string5, GroupInfoPage.this.AdminprogressText);
                                        PLog.print("Memeber Image = " + string2);
                                        if (string2.length() > 1) {
                                            if (string2.startsWith("https")) {
                                                Glide.with(GroupInfoPage.this).load(string2).into(GroupInfoPage.this.AdminImage);
                                            } else {
                                                Glide.with(GroupInfoPage.this).load(Base64.decode(string2, i)).into(GroupInfoPage.this.AdminImage);
                                            }
                                        } else {
                                            Glide.with(GroupInfoPage.this).load(Integer.valueOf(R.drawable.user)).into(GroupInfoPage.this.AdminImage);
                                        }
                                        if (string6.equals("1")) {
                                            ContextCompat.getDrawable(GroupInfoPage.this, R.drawable.completed).setBounds(i, i, 60, 60);
                                        }
                                    } else {
                                        GroupInfoPage.this.memberlist.add(new MyGroupMemberPojo(string, string2, GroupInfoPage.GroupId, string3, string4, string5, string7, string6));
                                    }
                                    if (string6.equals("1")) {
                                        GroupInfoPage.this.member_completed++;
                                    }
                                    if (string7.equals(GroupConst.GroupPendind)) {
                                        GroupInfoPage.this.member_Pending++;
                                    } else if (string7.equals(GroupConst.GroupJoin)) {
                                        GroupInfoPage.this.member_ok++;
                                    }
                                    i2++;
                                    i = 0;
                                }
                            }
                        }
                    }
                    Collections.sort(GroupInfoPage.this.memberlist, new Comparator<MyGroupMemberPojo>() {
                        @Override
                        public int compare(MyGroupMemberPojo myGroupMemberPojo, MyGroupMemberPojo myGroupMemberPojo2) {
                            return myGroupMemberPojo.status.compareTo(myGroupMemberPojo2.status);
                        }
                    });
                    if (GroupInfoPage.this.member_Pending == 0) {
                        GroupInfoPage.this.groupInfo.setText(GroupInfoPage.this.member_completed + "/" + GroupInfoPage.this.memberTotal + " Completed\n" + GroupInfoPage.this.member_ok + " approved");
                    } else {
                        GroupInfoPage.this.groupInfo.setText(GroupInfoPage.this.member_completed + "/" + GroupInfoPage.this.memberTotal + " Completed\n" + GroupInfoPage.this.member_ok + " approved\n" + GroupInfoPage.this.member_Pending + " pending");
                    }
                    if (GroupInfoPage.this.totalCounterofAllMembersofGroup != 0) {
                        GroupInfoPage.this.TotalJapa.setText(GroupInfoPage.this.totalCounterofAllMembersofGroup + "");
                    }
                    GroupInfoPage.this.MemberListView.setHasFixedSize(true);
                    GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 1);
                    GroupInfoPage.this.MemberListView.addItemDecoration(new DividerItemDecoration(GroupInfoPage.this, 1));
                    GroupInfoPage.this.MemberListView.setLayoutManager(gridLayoutManager);
                    GroupInfoPage groupInfoPage2 = GroupInfoPage.this;
                    GroupInfoPage groupInfoPage3 = GroupInfoPage.this;
                    groupInfoPage2.memAdapter = groupInfoPage3.new MyMemberlistAdapter(context, groupInfoPage3.memberlist);
                    GroupInfoPage.this.MemberListView.setAdapter(GroupInfoPage.this.memAdapter);
                } catch (JSONException e) {
                    throw new RuntimeException(e);
                }
            }
        }, new Response.ErrorListener() {
            public void onErrorResponse(VolleyError volleyError) {
                PToast.showT(context, "The server is down, Please try after some time!");
                PLog.print("Response Error" + volleyError + " = " + volleyError.getMessage());
            }
        }) {
            protected Map<String, String> getParams() {
                HashMap hashMap = new HashMap();
                hashMap.put("U_gmail", PSharedPreference.getString(context, Const.GMAIL, "null"));
                hashMap.put("GroupID", str);
                hashMap.put("isPublic", "false");
                return hashMap;
            }
        });
    }

    public void SetProgress(ProgressBar progressBar, String str, String str2, TextView textView) {
        try {
            this.AdminprogressBar.setMax(Integer.parseInt(GroupTarget));
        } catch (Exception e) {
            PToast.showT(this, "Error " + e.getMessage());
        }
        int parseInt = (Integer.parseInt(str2) * 100) / Integer.parseInt(str);
        progressBar.setProgress(parseInt);
        if (parseInt <= 20) {
            progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#FF5722")));
        } else if (parseInt <= 40) {
            progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#FF9800")));
        } else if (parseInt <= 60) {
            progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#FFC107")));
        } else if (parseInt <= 80) {
            progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#CDDC39")));
        } else {
            progressBar.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#8BC34A")));
        }
        textView.setText(parseInt + " %");
    }

    public class MyMemberlistAdapter extends RecyclerView.Adapter<ViewHolder> {
        ArrayList<MyGroupMemberPojo> _data;
        Context c;

        public MyMemberlistAdapter(Context context, ArrayList<MyGroupMemberPojo> arrayList) {
            this._data = arrayList;
            this.c = context;
        }

        public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
            View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.group_member_listitem, (ViewGroup) null, false);
            inflate.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
            return new ViewHolder(inflate);
        }

        public void onBindViewHolder(ViewHolder viewHolder, int i) {
            MyGroupMemberPojo myGroupMemberPojo = this._data.get(i);
            if (myGroupMemberPojo.member_img.length() > 1) {
                if (myGroupMemberPojo.member_img.startsWith("https")) {
                    Glide.with(GroupInfoPage.this).load(myGroupMemberPojo.member_img).into(viewHolder.TV_memberImg);
                } else {
                    Glide.with(GroupInfoPage.this).load(Base64.decode(myGroupMemberPojo.member_img, 0)).into(viewHolder.TV_memberImg);
                }
            } else {
                Glide.with(GroupInfoPage.this).load(Integer.valueOf(R.drawable.user)).into(viewHolder.TV_memberImg);
            }
            if (UserDataPref.get(GroupInfoPage.this, "U_phone").equals(myGroupMemberPojo.gmail)) {
                viewHolder.TV_Mname.setText(myGroupMemberPojo.membername + " (You)");
            } else {
                viewHolder.TV_Mname.setText(myGroupMemberPojo.membername);
            }
            if (myGroupMemberPojo.completed.equals("1")) {
                Drawable drawable = ContextCompat.getDrawable(GroupInfoPage.this, R.drawable.completed);
                drawable.setBounds(0, 0, 50, 50);
                viewHolder.TV_Mname.setCompoundDrawables(null, null, drawable, null);
            } else {
                viewHolder.TV_Mname.setCompoundDrawables(null, null, null, null);
            }
            if (GroupInfoPage.GroupInfo.equals("Admin") || UserDataPref.get(GroupInfoPage.this, "U_phone").equals(myGroupMemberPojo.gmail)) {
                viewHolder.TV_Mnumber.setText(myGroupMemberPojo.gmail);
            } else {
                viewHolder.TV_Mnumber.setText(myGroupMemberPojo.gmail);
            }
            viewHolder.TV_Mjapa.setText(myGroupMemberPojo.mantra);
            if (myGroupMemberPojo.status.equals(GroupConst.GroupPendind)) {
                viewHolder.TV_Mstatus.setTextColor(ContextCompat.getColor(this.c, R.color.pending));
                viewHolder.TV_Mstatus.setVisibility(0);
                viewHolder.memberProgress.setVisibility(8);
            } else if (myGroupMemberPojo.status.equals(GroupConst.GroupDel)) {
                viewHolder.TV_Mstatus.setTextColor(ContextCompat.getColor(this.c, R.color.red));
                viewHolder.TV_Mstatus.setVisibility(0);
                viewHolder.memberProgress.setVisibility(8);
            } else {
                viewHolder.TV_Mstatus.setTextColor(ContextCompat.getColor(this.c, R.color.green));
                viewHolder.TV_Mstatus.setVisibility(8);
                viewHolder.memberProgress.setVisibility(0);
                GroupInfoPage.this.SetProgress(viewHolder.memberProgress, GroupInfoPage.GroupTarget, myGroupMemberPojo.mantra, viewHolder.memberprogressTxt);
            }
            viewHolder.TV_Mstatus.setText(myGroupMemberPojo.status);
        }

        public int getItemCount() {
            return this._data.size();
        }

        public class ViewHolder extends RecyclerView.ViewHolder {
            public TextView TV_Mjapa;
            public TextView TV_Mname;
            public TextView TV_Mnumber;
            public TextView TV_Mstatus;
            public ImageView TV_memberImg;
            RelativeLayout layout;
            ProgressBar memberProgress;
            public TextView memberprogressTxt;

            public ViewHolder(View view) {
                super(view);
                this.layout = (RelativeLayout) view.findViewById(R.id.relativeLayout_g);
                this.TV_memberImg = (ImageView) view.findViewById(R.id.member_img_m);
                this.TV_Mname = (TextView) view.findViewById(R.id.textView_name_m);
                this.TV_Mnumber = (TextView) view.findViewById(R.id.textView_number_m);
                this.TV_Mjapa = (TextView) view.findViewById(R.id.textView_counter_m);
                this.TV_Mstatus = (TextView) view.findViewById(R.id.textview_status_m);
                this.memberProgress = (ProgressBar) view.findViewById(R.id.memberprogressBar);
                this.memberprogressTxt = (TextView) view.findViewById(R.id.memberprogressText);
            }
        }
    }
}