导航菜单

页面标题

页面副标题

St.John's v1.0.9 - ProfileActivity.java 源代码

正在查看: St.John's v1.0.9 应用的 ProfileActivity.java JAVA 源代码文件

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


package com.mcb.stjohnsemschool.activity;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mcb.stjohnsemschool.adapter.SiblingsAdapter;
import com.mcb.stjohnsemschool.interfaces.ProfileDetailsListener;
import com.mcb.stjohnsemschool.model.LanguageToChangeModel;
import com.mcb.stjohnsemschool.model.StudentInActiveMenusModel;
import com.mcb.stjohnsemschool.model.StudentInfoModel;
import com.mcb.stjohnsemschool.model.StudentSpecificDataModel;
import com.mcb.stjohnsemschool.services.ApiClient;
import com.mcb.stjohnsemschool.services.ApiInterface;
import com.mcb.stjohnsemschool.utils.TransparentProgressDialog;
import com.mcb.stjohnsemschool.utils.Utility;
import java.util.ArrayList;
import java.util.HashMap;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class ProfileActivity extends AppCompatActivity implements AdapterView.OnItemClickListener, View.OnClickListener, ProfileDetailsListener {
    public static final String TAG = "com.mcb.stjohnsemschool.activity.ProfileActivity";
    public static AppCompatActivity mActivityObj;
    private LinearLayout bottom_navigation;
    ImageView branchLogoImg;
    private MenuItem changeLanguageMenuItem;
    private ConnectivityManager conMgr;
    private Context context;
    private ImageButton home_nav;
    private ProfileDetailsListener listener;
    private ImageButton live_nav;
    private TextView mAlertText;
    private String mBranchName;
    private Dialog mDialogAlert;
    private TextView mDialogeAlertYes;
    private SharedPreferences.Editor mEditor;
    private String mOrganisationName;
    private ListView mProfiles;
    private TransparentProgressDialog mProgressbar;
    private SharedPreferences mSharedPref;
    private ImageButton manage_nav;
    private ImageButton notification_nav;
    private String orgId;
    private String notiType = "";
    private String ServiceURL = "";
    private String branchLogo = "";
    private ArrayList<StudentInfoModel> mSiblingsList = new ArrayList<>();
    private Dialog mAppBackDialog = null;
    private String live_classes_url = "";

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_profile);
        FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
        firebaseAnalytics.setCurrentScreen(this, "Profile Screen", null);
        firebaseAnalytics.setAnalyticsCollectionEnabled(true);
        mActivityObj = this;
        this.context = getApplicationContext();
        this.listener = this;
        if (getIntent().hasExtra("type")) {
            this.notiType = getIntent().getStringExtra("type");
        }
        initializations();
    }

    private void initializations() {
        this.mProgressbar = new TransparentProgressDialog(this, R.drawable.spinner_loading_imag);
        ListView listView = (ListView) findViewById(R.id.ltv_profiles);
        this.mProfiles = listView;
        listView.setOnItemClickListener(this);
        this.branchLogoImg = (ImageView) findViewById(R.id.app_logo);
        Dialog dialog = new Dialog(this);
        this.mAppBackDialog = dialog;
        dialog.setContentView(R.layout.dialog_close_app);
        this.mAppBackDialog.setCancelable(false);
        Button button = (Button) this.mAppBackDialog.findViewById(R.id.btn_no);
        Button button2 = (Button) this.mAppBackDialog.findViewById(R.id.btn_yes);
        ImageView imageView = (ImageView) this.mAppBackDialog.findViewById(R.id.alert_branch_logo);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ProfileActivity.this.mAppBackDialog == null || !ProfileActivity.this.mAppBackDialog.isShowing()) {
                    return;
                }
                ProfileActivity.this.mAppBackDialog.dismiss();
            }
        });
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ProfileActivity.this.mAppBackDialog != null && ProfileActivity.this.mAppBackDialog.isShowing()) {
                    ProfileActivity.this.mAppBackDialog.dismiss();
                }
                ProfileActivity.this.finish();
            }
        });
        SharedPreferences sharedPreferences = getSharedPreferences("", 0);
        this.mSharedPref = sharedPreferences;
        this.mEditor = sharedPreferences.edit();
        this.bottom_navigation = (LinearLayout) findViewById(R.id.ll_footer);
        this.ServiceURL = this.mSharedPref.getString("schoolNameURLkey", this.ServiceURL);
        this.live_classes_url = this.mSharedPref.getString("StudentGUID", this.live_classes_url);
        this.mBranchName = this.mSharedPref.getString("branchnameKey", this.mBranchName);
        this.mOrganisationName = this.mSharedPref.getString("OrganisationNameKey", this.mOrganisationName);
        this.orgId = this.mSharedPref.getString("orgnizationIdKey", this.orgId);
        String string = this.mSharedPref.getString("BranchLogo", this.branchLogo);
        this.branchLogo = string;
        if (string != null && !string.equalsIgnoreCase("null") && this.branchLogo.length() > 0) {
            Glide.with(this.context).load(this.branchLogo).into(this.branchLogoImg);
        }
        String str = this.branchLogo;
        if (str != null && !str.equalsIgnoreCase("null") && this.branchLogo.length() > 0) {
            Glide.with(this.context).load(this.branchLogo).into(imageView);
        }
        Dialog dialog2 = new Dialog(this, R.style.Theme_Dialog);
        this.mDialogAlert = dialog2;
        WindowManager.LayoutParams attributes = dialog2.getWindow().getAttributes();
        attributes.dimAmount = 5.0f;
        this.mDialogAlert.getWindow().setAttributes(attributes);
        this.mDialogAlert.getWindow().addFlags(2);
        this.mDialogAlert.setContentView(R.layout.dialog_alert);
        this.mDialogAlert.setCanceledOnTouchOutside(true);
        this.mAlertText = (TextView) this.mDialogAlert.findViewById(R.id.alert_text);
        TextView textView = (TextView) this.mDialogAlert.findViewById(R.id.ok_alert_dialog);
        this.mDialogeAlertYes = textView;
        textView.setOnClickListener(this);
    }

    protected void onResume() {
        String string = this.mSharedPref.getString("usernamekey", "");
        Bundle bundle = new Bundle();
        bundle.putString("user_name", string);
        FirebaseAnalytics.getInstance(this).logEvent("PAGE_SIBLING_LIST", bundle);
        loadLoginUsersData();
        super.onResume();
    }

    public void loadLoginUsersData() {
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService("connectivity");
        this.conMgr = connectivityManager;
        if (connectivityManager.getActiveNetworkInfo() != null && this.conMgr.getActiveNetworkInfo().isAvailable() && this.conMgr.getActiveNetworkInfo().isConnected()) {
            getSiblingAccounts();
        } else {
            Toast.makeText(getApplicationContext(), "Check your Network Connection", 0).show();
        }
    }

    private void getSiblingAccounts() {
        TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
        if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
            this.mProgressbar.show();
        }
        String string = this.mSharedPref.getString("main_user_id", "0");
        ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).getSiblingAccounts(this.mSharedPref.getString("main_student_enrollment_id", "0"), string, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<StudentInfoModel>>() {
            public void onResponse(Call<ArrayList<StudentInfoModel>> call, Response<ArrayList<StudentInfoModel>> response) {
                if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                    ProfileActivity.this.mProgressbar.dismiss();
                }
                if (response != null && response.body() != null) {
                    ProfileActivity.this.mSiblingsList.clear();
                    ProfileActivity.this.mSiblingsList = (ArrayList) response.body();
                    if (!ProfileActivity.this.mSiblingsList.isEmpty()) {
                        ?? r4 = ProfileActivity.this;
                        ProfileActivity.this.mProfiles.setAdapter(new SiblingsAdapter((Context) r4, ((ProfileActivity) r4).mSiblingsList, ProfileActivity.this.listener));
                        ProfileActivity.this.getLanguagesToChange();
                        return;
                    }
                    Toast.makeText(ProfileActivity.this.getApplicationContext(), "No Sibling Found", 1).show();
                    return;
                }
                Utility.showAlertDialog(ProfileActivity.mActivityObj);
            }

            public void onFailure(Call<ArrayList<StudentInfoModel>> call, Throwable th) {
                if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                    ProfileActivity.this.mProgressbar.dismiss();
                }
                Utility.showAlertDialog(ProfileActivity.mActivityObj);
            }
        });
    }

    public void getLanguagesToChange() {
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService("connectivity");
        this.conMgr = connectivityManager;
        if (connectivityManager.getActiveNetworkInfo() != null && this.conMgr.getActiveNetworkInfo().isAvailable() && this.conMgr.getActiveNetworkInfo().isConnected()) {
            getMenuLanguages();
        } else {
            Toast.makeText(getApplicationContext(), "Check your Network Connection", 0).show();
        }
    }

    private void getMenuLanguages() {
        TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
        if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
            this.mProgressbar.show();
        }
        final String string = this.mSharedPref.getString("main_student_enrollment_id", "0");
        ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GetLanguagesToChange(Integer.parseInt(this.orgId), Integer.parseInt(string), Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<LanguageToChangeModel>>() {
            public void onResponse(Call<ArrayList<LanguageToChangeModel>> call, Response<ArrayList<LanguageToChangeModel>> response) {
                if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                    ProfileActivity.this.mProgressbar.dismiss();
                }
                if (response != null && response.body() != null) {
                    new ArrayList();
                    ArrayList arrayList = (ArrayList) response.body();
                    if (ProfileActivity.this.changeLanguageMenuItem != null) {
                        if (arrayList == null || arrayList.size() <= 1) {
                            ProfileActivity.this.changeLanguageMenuItem.setVisible(false);
                        } else {
                            ProfileActivity.this.changeLanguageMenuItem.setVisible(true);
                        }
                    }
                    if (ProfileActivity.this.notiType == null || ProfileActivity.this.notiType.length() <= 0) {
                        return;
                    }
                    int i = 0;
                    for (int i2 = 0; i2 < ProfileActivity.this.mSiblingsList.size(); i2++) {
                        if (((StudentInfoModel) ProfileActivity.this.mSiblingsList.get(i2)).getStudentEnrollmentId().equalsIgnoreCase(string)) {
                            i = i2;
                        }
                    }
                    ProfileActivity.this.navigateToNextScreen((StudentInfoModel) ProfileActivity.this.mSiblingsList.get(i));
                    return;
                }
                Utility.showAlertDialog(ProfileActivity.mActivityObj);
            }

            public void onFailure(Call<ArrayList<LanguageToChangeModel>> call, Throwable th) {
                if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                    ProfileActivity.this.mProgressbar.dismiss();
                }
                Utility.showAlertDialog(ProfileActivity.mActivityObj);
            }
        });
    }

    @Override
    public void onClick(View view) {
        Dialog dialog;
        if (view == this.mDialogeAlertYes && (dialog = this.mDialogAlert) != null && dialog.isShowing()) {
            this.mDialogAlert.dismiss();
            Intent intent = new Intent((Context) this, (Class<?>) FeeActivity.class);
            intent.putExtra("IS_FEE_DUE", true);
            startActivity(intent);
        }
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        navigateToNextScreen(this.mSiblingsList.get(i));
    }

    public void navigateToNextScreen(final StudentInfoModel studentInfoModel) {
        this.mEditor.putString("UseridKey", studentInfoModel.getUserID());
        this.mEditor.putString("studentEnrollmentIdKey", studentInfoModel.getStudentEnrollmentId());
        this.mEditor.putString("academicyearIdKey", studentInfoModel.getAcademicYearID());
        this.mEditor.putString("AcademicYearKey", studentInfoModel.getAcademicYear());
        this.mEditor.putString("ClassidKey", studentInfoModel.getClassID());
        this.mEditor.putString("BranchSectionIDKey", studentInfoModel.getBranchSectionID());
        this.mEditor.putString("branchnameKey", studentInfoModel.getBranchName());
        this.mEditor.putString("Name", studentInfoModel.getFullName());
        this.mEditor.putString("Class", studentInfoModel.getClassName());
        this.mEditor.putString("EnrollmentCode", studentInfoModel.getStudentEnrollmentCode());
        this.mEditor.putString("ProfilePicPath", studentInfoModel.getPhotoUpload());
        this.mEditor.putString("orgnizationIdKey", studentInfoModel.getOrganisationID());
        this.mEditor.putString("BranchIdKey", studentInfoModel.getBranchID());
        this.mEditor.putString("LocIdKey", "" + studentInfoModel.getLocationID());
        this.mEditor.putString("SectionNameKey", studentInfoModel.getSection());
        this.mEditor.putString("OrganisationNameKey", studentInfoModel.getOrganisationName());
        this.mEditor.putString("UserTypeIdKey", studentInfoModel.getUserTypeID());
        this.mEditor.putString("StudentGUID", studentInfoModel.getStudentGUID());
        this.mEditor.putString("BranchGUID", studentInfoModel.getBranchGUID());
        this.mEditor.putString("Parent_address", studentInfoModel.getAddress());
        this.mEditor.putString("Father_name", studentInfoModel.getFatherName());
        this.mEditor.putString("Mother_name", studentInfoModel.getMotherName());
        this.mEditor.putString("Father_phone", studentInfoModel.getFatherPhone());
        this.mEditor.putString("Mother_phone", studentInfoModel.getMotherPhone());
        this.mEditor.putString("Father_email_id", studentInfoModel.getFatherEmailID());
        this.mEditor.putString("Mother_email_id", studentInfoModel.getMotherEmailID());
        this.mEditor.putString("FacebookURL", studentInfoModel.getFacebookURL());
        this.mEditor.putString("LikedInURL", studentInfoModel.getLinkedInURL());
        this.mEditor.putString("InstagramURL", studentInfoModel.getInstagramURL());
        this.mEditor.putString("tumblrUrl", studentInfoModel.getTumblrUrl());
        this.mEditor.putString("TwitterURL", studentInfoModel.getTwitterURL());
        this.mEditor.putString("YouTubeURL", studentInfoModel.getYouTubeURL());
        this.mEditor.putString("BranchWebsiteUrl", studentInfoModel.getBranchWebsiteURL());
        this.mEditor.commit();
        final int status = studentInfoModel.getStatus();
        String message = studentInfoModel.getMessage();
        if (message != null && message.length() > 0 && !message.equalsIgnoreCase("null")) {
            new AlertDialog.Builder(mActivityObj).setMessage(message).setCancelable(false).setTitle("Alert").setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.cancel();
                    if (status == 1) {
                        ProfileActivity.this.pageNavigation(studentInfoModel.getFeeDue());
                    }
                }
            }).show();
        } else {
            getInActiveMenus(Integer.parseInt(studentInfoModel.getStudentEnrollmentId()), studentInfoModel.getFeeDue());
        }
    }

    public void pageNavigation(boolean z) {
        Intent intent;
        if (z) {
            this.mEditor.putInt("siblings_count", this.mSiblingsList.size());
            this.mEditor.commit();
            String str = this.notiType;
            if (str != null && !str.equalsIgnoreCase("null") && this.notiType.length() > 0) {
                if (this.notiType.equalsIgnoreCase("Announcement") || this.notiType.equalsIgnoreCase("Announcements")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "announcements");
                } else if (this.notiType.equalsIgnoreCase("Diary") || this.notiType.equalsIgnoreCase("Class Diary")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "classdiary");
                } else if (this.notiType.equalsIgnoreCase("Event") || this.notiType.equalsIgnoreCase("Events")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "gallery");
                } else if (this.notiType.equalsIgnoreCase("Message") || this.notiType.equalsIgnoreCase("Messages")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "messages");
                } else if (this.notiType.equalsIgnoreCase("Assignments") || this.notiType.equalsIgnoreCase("Assignment")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "assignments");
                } else if (this.notiType.equalsIgnoreCase("StudentConversationAlert")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "conversations");
                } else if (this.notiType.equalsIgnoreCase("Online Classes")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "zoom_online_classes");
                } else if (this.notiType.equalsIgnoreCase("Transport")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) TransportNotificationsActivity.class);
                } else if (this.notiType.equalsIgnoreCase("General")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NotificationsActivity.class);
                } else if (this.notiType.equalsIgnoreCase("Library") || this.notiType.equalsIgnoreCase("Library")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "library");
                } else if (this.notiType.equalsIgnoreCase("chat") || this.notiType.equalsIgnoreCase("Student Wall")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NavigationActivity.class);
                    intent.putExtra("ToActivity", "chat");
                } else if (this.notiType.equalsIgnoreCase("Student Attendance") || this.notiType.equalsIgnoreCase("Attendance")) {
                    intent = new Intent(getApplicationContext(), (Class<?>) NotificationsActivity.class);
                    intent.putExtra("attendance", 1);
                } else {
                    intent = new Intent((Context) this, (Class<?>) NavigationActivity.class);
                }
                intent.setFlags(67108864);
                intent.setFlags(131072);
                startActivity(intent);
                intent.setFlags(268468224);
                this.notiType = null;
                return;
            }
            Intent intent2 = new Intent((Context) this, (Class<?>) NavigationActivity.class);
            intent2.setFlags(67108864);
            intent2.setFlags(131072);
            startActivity(intent2);
            return;
        }
        Intent intent3 = new Intent((Context) this, (Class<?>) FeeActivity.class);
        intent3.setFlags(67108864);
        intent3.setFlags(131072);
        startActivity(intent3);
    }

    private void replaceFragment(Fragment fragment, String str, String str2) {
        if (fragment != null) {
            setTitle(str);
            getSupportFragmentManager().beginTransaction().replace(R.id.content_navigation, fragment, str2).commit();
        }
    }

    public void onBackPressed() {
        backPress();
    }

    private void backPress() {
        Dialog dialog = this.mAppBackDialog;
        if (dialog == null || dialog.isShowing()) {
            return;
        }
        this.mAppBackDialog.show();
    }

    public void onPause() {
        if (this.mProgressbar.isShowing()) {
            this.mProgressbar.dismiss();
        }
        super.onPause();
    }

    protected void onStop() {
        TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
        if (transparentProgressDialog != null && transparentProgressDialog.isShowing()) {
            this.mProgressbar.dismiss();
        }
        super.onStop();
    }

    protected void onDestroy() {
        mActivityObj = null;
        super.onDestroy();
    }

    public void onProfileClickListener(StudentInfoModel studentInfoModel) {
        deleteSiblingData(studentInfoModel.getStudentEnrollmentId());
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.add_account, menu);
        this.changeLanguageMenuItem = menu.findItem(R.id.change_language);
        return super.onCreateOptionsMenu(menu);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        int itemId = menuItem.getItemId();
        if (itemId == 2131362106) {
            startActivity(new Intent(getApplicationContext(), (Class<?>) ChangeLanguageActivity.class));
        } else if (itemId == 2131361853) {
            startActivity(new Intent(getApplicationContext(), (Class<?>) SiblingsListActivity.class));
        }
        return super.onOptionsItemSelected(menuItem);
    }

    private void deleteSiblingData(String str) {
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService("connectivity");
        this.conMgr = connectivityManager;
        if (connectivityManager.getActiveNetworkInfo() != null && this.conMgr.getActiveNetworkInfo().isAvailable() && this.conMgr.getActiveNetworkInfo().isConnected()) {
            removeSibling(str);
        } else {
            Toast.makeText(getApplicationContext(), "Check your Network Connection", 0).show();
        }
    }

    private void removeSibling(String str) {
        TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
        if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
            this.mProgressbar.show();
        }
        String string = this.mSharedPref.getString("main_student_enrollment_id", "0");
        HashMap hashMap = new HashMap();
        hashMap.put("StudentEnrollmentID", string);
        hashMap.put("SiblingStudentEnrollmentID", str);
        hashMap.put("apikey", Utility.getSchoolApiKey(this.context));
        ((ApiInterface) ApiClient.getClient1(getApplicationContext()).create(ApiInterface.class)).removeSibling(hashMap).enqueue(new Callback<String>() {
            public void onResponse(Call<String> call, Response<String> response) {
                if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                    ProfileActivity.this.mProgressbar.dismiss();
                }
                if (response != null && response.body() != null) {
                    Toast.makeText(ProfileActivity.this.getApplicationContext(), (String) response.body(), 0).show();
                    ProfileActivity.this.loadLoginUsersData();
                    return;
                }
                Utility.showAlertDialog(ProfileActivity.mActivityObj);
            }

            public void onFailure(Call<String> call, Throwable th) {
                if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                    ProfileActivity.this.mProgressbar.dismiss();
                }
                Utility.showAlertDialog(ProfileActivity.mActivityObj);
            }
        });
    }

    private void getInActiveMenus(int i, boolean z) {
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService("connectivity");
        this.conMgr = connectivityManager;
        if (connectivityManager.getActiveNetworkInfo() != null && this.conMgr.getActiveNetworkInfo().isAvailable() && this.conMgr.getActiveNetworkInfo().isConnected()) {
            getStudentInActiveMenus(i, z);
        } else {
            Toast.makeText(getApplicationContext(), "Check your Network Connection", 0).show();
        }
    }

    private void getStudentInActiveMenus(final int i, final boolean z) {
        try {
            String string = this.mSharedPref.getString("UseridKey", "0");
            String str = Build.MODEL;
            String str2 = Build.MANUFACTURER;
            String string2 = this.mSharedPref.getString("usernamekey", "");
            String str3 = "Android," + str2 + "," + str;
            String deviceId = Utility.getDeviceId(getApplicationContext());
            final String string3 = this.mSharedPref.getString("RegisterId", "");
            this.context.getPackageName();
            this.mSharedPref.getString("AblyApiKey", "");
            this.mSharedPref.getString("AblyDeviceId", "");
            TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
            if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
                this.mProgressbar.show();
            }
            ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).getChannelsAndInActiveMenusLatest(i, string, string2, string3, "Android", deviceId, str3, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<StudentSpecificDataModel>() {
                public void onResponse(Call<StudentSpecificDataModel> call, Response<StudentSpecificDataModel> response) {
                    if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                        ProfileActivity.this.mProgressbar.dismiss();
                    }
                    if (response != null && response.body() != null) {
                        StudentSpecificDataModel studentSpecificDataModel = (StudentSpecificDataModel) response.body();
                        ArrayList inActiveMenus = studentSpecificDataModel.getInActiveMenus();
                        ArrayList subscribeChannels = studentSpecificDataModel.getSubscribeChannels();
                        ArrayList unsubscribeChannels = studentSpecificDataModel.getUnsubscribeChannels();
                        String str4 = string3;
                        if (str4 != null && str4.length() > 0) {
                            if (subscribeChannels != null && subscribeChannels.size() > 0) {
                                Utility.subscribeFirebaseTopicName(ProfileActivity.this.context, ProfileActivity.mActivityObj, i, subscribeChannels);
                            }
                            if (unsubscribeChannels != null && unsubscribeChannels.size() > 0) {
                                Utility.unsubscribeFirebaseTopicName(ProfileActivity.this.context, ProfileActivity.mActivityObj, i, unsubscribeChannels);
                            }
                        }
                        if (inActiveMenus != null) {
                            ProfileActivity.this.mEditor.putString("InActiveMenus", new Gson().toJson(inActiveMenus, new TypeToken<ArrayList<StudentInActiveMenusModel>>() {
                            }.getType()));
                            ProfileActivity.this.mEditor.commit();
                        }
                        ProfileActivity.this.pageNavigation(z);
                        return;
                    }
                    Utility.showAlertDialog(ProfileActivity.mActivityObj);
                }

                public void onFailure(Call<StudentSpecificDataModel> call, Throwable th) {
                    if (ProfileActivity.this.mProgressbar != null && ProfileActivity.this.mProgressbar.isShowing()) {
                        ProfileActivity.this.mProgressbar.dismiss();
                    }
                    Utility.showAlertDialog(ProfileActivity.mActivityObj);
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}