导航菜单

页面标题

页面副标题

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

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

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


package com.mcb.stjohnsemschool.fragment;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.mcb.stjohnsemschool.activity.DesignMateContentActivity;
import com.mcb.stjohnsemschool.activity.DetailAnnouncementActivity;
import com.mcb.stjohnsemschool.activity.FeeActivity;
import com.mcb.stjohnsemschool.activity.NavigationActivity;
import com.mcb.stjohnsemschool.activity.SchoolStoreHomeActivity;
import com.mcb.stjohnsemschool.activity.SoapObjectProvider;
import com.mcb.stjohnsemschool.activity.WebViewActivity;
import com.mcb.stjohnsemschool.adapter.favoriteGridAdapter;
import com.mcb.stjohnsemschool.interfaces.MoveToMenu;
import com.mcb.stjohnsemschool.model.AnnouncementModelClass;
import com.mcb.stjohnsemschool.model.ApiResponse;
import com.mcb.stjohnsemschool.model.DesignMateCoursePacksModel;
import com.mcb.stjohnsemschool.model.DiaryDataModelClass;
import com.mcb.stjohnsemschool.model.DiaryModelClass;
import com.mcb.stjohnsemschool.model.FeeAccountsModelClass;
import com.mcb.stjohnsemschool.model.HomePageAttendanceModel;
import com.mcb.stjohnsemschool.model.MenuModelClass;
import com.mcb.stjohnsemschool.model.ModuleModelClass;
import com.mcb.stjohnsemschool.model.StudentInActiveMenusModel;
import com.mcb.stjohnsemschool.services.ApiClient;
import com.mcb.stjohnsemschool.services.ApiInterface;
import com.mcb.stjohnsemschool.utils.Constants;
import com.mcb.stjohnsemschool.utils.MyGridView;
import com.mcb.stjohnsemschool.utils.RoundedTransformation;
import com.mcb.stjohnsemschool.utils.TransparentProgressDialog;
import com.mcb.stjohnsemschool.utils.Utility;
import com.microsoft.identity.common.java.eststelemetry.SchemaConstants;
import com.squareup.picasso.Picasso;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONObject;
import org.ksoap2.serialization.SoapObject;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class MenuHomeFragment1 extends Fragment implements MoveToMenu {
    public static final String TAG = "com.mcb.stjohnsemschool.fragment.MenuHomeFragment1";
    private TextView AttendanceStatus;
    private int academicYearId_announcement;
    private LinearLayout assignment_l1;
    private String classId;
    private ConnectivityManager conMgr;
    private Context context;
    private RelativeLayout favourite_bg;
    private MenuItem gatePassMenuItem;
    private boolean isHoliday;
    private int isVisitorManagementEnabled;
    private int languageId;
    private TextView mAssignment;
    private CardView mCV1;
    private CardView mCV2;
    private CardView mCV3;
    private CardView mCV4;
    private LinearLayout mClassWork_tx;
    private TextView mClasswork;
    private SharedPreferences.Editor mEditor;
    private RelativeLayout mFavouritesRL;
    private LinearLayout mHomeWork_tx;
    private TextView mHomework;
    private RelativeLayout mMainLL;
    private MyGridView mMenus;
    private TransparentProgressDialog mProgressbar;
    private TextView mProjectWork;
    private ScrollView mScrl;
    private SharedPreferences mSharedPref;
    private TextView mSubject;
    private TextView mTotalBalance;
    private int masterClassId;
    private MoveToMenu moveToMenu;
    private Activity myActivity;
    private String organizationName;
    private LinearLayout project_l1;
    private LinearLayout rel_fav;
    private TextView subject_tx;
    private View view1;
    private String userID = SchemaConstants.Value.FALSE;
    private String studentEnrollmentID = SchemaConstants.Value.FALSE;
    private String orgId = SchemaConstants.Value.FALSE;
    private String userTypeId = SchemaConstants.Value.FALSE;
    private String branchId = SchemaConstants.Value.FALSE;
    private String academicYearId = SchemaConstants.Value.FALSE;
    private String dbName = "";
    private String heading = "";
    private String classwork = "";
    private String homework = "";
    private String assignment = "";
    private String project_work = "";
    private String mdate = "";
    private String mdate1 = "";
    private String mAttendanceStatus = "";
    private String subject = "";
    private long minId = 0;
    private long maxId = 0;
    private ArrayList<ModuleModelClass> modules = new ArrayList<>();
    private ArrayList<MenuModelClass> favouriteMenus = new ArrayList<>();
    private ArrayList<MenuModelClass> favouriteMenusDup = new ArrayList<>();
    private ArrayList<StudentInActiveMenusModel> studentInActiveMenus = new ArrayList<>();
    private Calendar myCalendar = Calendar.getInstance();
    private ArrayList<AnnouncementModelClass> mAnnounsmentsList = new ArrayList<>();
    private ArrayList<AnnouncementModelClass> mAnnounsmentsListDup = new ArrayList<>();
    public ArrayList<DiaryModelClass> mDairyList = new ArrayList<>();
    public ArrayList<DiaryModelClass> mDairyListDup = new ArrayList<>();
    private ArrayList<HomePageAttendanceModel> mAttendanceDetailsList = new ArrayList<>();
    private ArrayList<HomePageAttendanceModel> mAttendanceDetailsListDup = new ArrayList<>();
    private ArrayList<FeeAccountsModelClass> feeAccountsModelClasses = new ArrayList<>();
    private ArrayList<FeeAccountsModelClass> feeAccountsModelClassesDup = new ArrayList<>();

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        return layoutInflater.inflate(2131558728, viewGroup, false);
    }

    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        setHasOptionsMenu(true);
        FragmentActivity activity = getActivity();
        this.myActivity = activity;
        Context applicationContext = activity.getApplicationContext();
        this.context = applicationContext;
        this.moveToMenu = this;
        SharedPreferences sharedPreferences = applicationContext.getSharedPreferences("", 0);
        this.mSharedPref = sharedPreferences;
        this.mEditor = sharedPreferences.edit();
        this.organizationName = this.mSharedPref.getString("OrganisationNameKey", this.organizationName);
        this.userID = this.mSharedPref.getString("UseridKey", this.userID);
        this.studentEnrollmentID = this.mSharedPref.getString("studentEnrollmentIdKey", this.studentEnrollmentID);
        this.academicYearId = this.mSharedPref.getString("academicyearIdKey", this.academicYearId);
        this.academicYearId_announcement = Integer.parseInt(this.mSharedPref.getString("academicyearIdKey", SchemaConstants.Value.FALSE));
        this.orgId = this.mSharedPref.getString("orgnizationIdKey", this.orgId);
        this.userTypeId = this.mSharedPref.getString("UserTypeIdKey", this.userTypeId);
        this.branchId = this.mSharedPref.getString("BranchIdKey", this.branchId);
        this.languageId = this.mSharedPref.getInt("ChangedLanguageId", 0);
        this.classId = this.mSharedPref.getString("ClassidKey", this.classId);
        this.studentInActiveMenus = (ArrayList) new Gson().fromJson(this.mSharedPref.getString("InActiveMenus", "[]"), new TypeToken<ArrayList<StudentInActiveMenusModel>>() {
        }.getType());
    }

    private void initializations() {
        this.mProgressbar = new TransparentProgressDialog(this.myActivity, 2131231479);
        this.mSubject = (TextView) getView().findViewById(2131364373);
        this.mTotalBalance = (TextView) getView().findViewById(2131362003);
        this.subject_tx = (TextView) getView().findViewById(2131363703);
        this.mClassWork_tx = (LinearLayout) getView().findViewById(2131364008);
        this.mHomeWork_tx = (LinearLayout) getView().findViewById(2131364160);
        this.mClasswork = (TextView) getView().findViewById(2131362160);
        this.mHomework = (TextView) getView().findViewById(2131362612);
        this.mAssignment = (TextView) getView().findViewById(2131361967);
        this.mProjectWork = (TextView) getView().findViewById(2131363341);
        this.AttendanceStatus = (TextView) getView().findViewById(2131363295);
        this.favourite_bg = (RelativeLayout) getView().findViewById(2131363464);
        this.mCV1 = getView().findViewById(2131362217);
        this.mCV2 = getView().findViewById(2131362218);
        this.mCV3 = getView().findViewById(2131362219);
        this.mCV4 = getView().findViewById(2131362220);
        LinearLayout linearLayout = (LinearLayout) getView().findViewById(2131361974);
        this.assignment_l1 = linearLayout;
        linearLayout.setVisibility(8);
        LinearLayout linearLayout2 = (LinearLayout) getView().findViewById(2131363342);
        this.project_l1 = linearLayout2;
        linearLayout2.setVisibility(8);
        getActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getActivity().getSupportActionBar().setDisplayShowTitleEnabled(false);
        getActivity().getSupportActionBar().setDisplayShowCustomEnabled(true);
        getActivity().getSupportActionBar().setDisplayOptions(16);
        getActivity().getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(2131231523));
        ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(-1, -1, 3);
        View inflate = this.myActivity.getLayoutInflater().inflate(2131559093, (ViewGroup) null);
        getActivity().getSupportActionBar().setCustomView(inflate, layoutParams);
        ImageView imageView = (ImageView) inflate.findViewById(2131362622);
        TextView textView = (TextView) inflate.findViewById(2131363809);
        TextView textView2 = (TextView) inflate.findViewById(2131362439);
        TextView textView3 = (TextView) inflate.findViewById(2131362159);
        TextView textView4 = (TextView) inflate.findViewById(2131363553);
        String string = this.mSharedPref.getString("ProfilePicPath", "");
        String string2 = this.mSharedPref.getString("Name", "");
        String string3 = this.mSharedPref.getString("Class", "");
        String string4 = this.mSharedPref.getString("EnrollmentCode", "");
        if (string.length() > 0) {
            Picasso.get().load(string).error(2131231345).transform(new RoundedTransformation(100, 2)).resize(100, 100).centerCrop().into(imageView);
        } else {
            Picasso.get().load(2131231345).transform(new RoundedTransformation(100, 2)).resize(100, 100).centerCrop().into(imageView);
        }
        textView.setText(string2);
        textView2.setText(string4);
        textView3.setText(string3 + " >> " + this.mSharedPref.getString("SectionNameKey", ""));
        textView4.setText(this.organizationName);
        this.rel_fav = (LinearLayout) getView().findViewById(2131364474);
        this.mMainLL = (RelativeLayout) getView().findViewById(2131362889);
        this.mFavouritesRL = (RelativeLayout) getView().findViewById(2131363476);
        this.view1 = getView().findViewById(2131364468);
        this.mScrl = (ScrollView) getView().findViewById(2131363557);
        this.mMenus = (MyGridView) getView().findViewById(2131362993);
        this.rel_fav.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MenuHomeFragment1.this.rel_fav.setVisibility(8);
                MenuHomeFragment1.this.view1.setVisibility(8);
                MenuHomeFragment1.this.favouriteMenus.clear();
                MenuHomeFragment1.this.favouriteMenus.addAll(MenuHomeFragment1.this.favouriteMenusDup);
                MenuHomeFragment1.this.mMenus.setAdapter((ListAdapter) new favoriteGridAdapter(MenuHomeFragment1.this.context, MenuHomeFragment1.this.myActivity, MenuHomeFragment1.this.favouriteMenus, MenuHomeFragment1.this.moveToMenu));
            }
        });
        getFavouriteMenuList();
    }

    public void loadData() {
        this.mdate = new SimpleDateFormat("MM/dd/yyyy", Locale.US).format(this.myCalendar.getTime());
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(this.myCalendar.getTimeInMillis());
        Calendar calendar2 = Calendar.getInstance();
        calendar2.setTimeInMillis(this.myCalendar.getTimeInMillis());
        calendar.add(5, -1);
        calendar2.add(5, 1);
        new SimpleDateFormat("MM/dd/yyyy", Locale.US);
        loadDairyData();
    }

    private void getFavouriteMenuList() {
        ConnectivityManager connectivityManager = (ConnectivityManager) this.context.getSystemService("connectivity");
        if (connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isAvailable() && connectivityManager.getActiveNetworkInfo().isConnected()) {
            getFavouriteMenus();
        } else {
            Toast.makeText(this.context, "Check your Network Connection", 0).show();
        }
    }

    private void getFavouriteMenus() {
        ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GetFavouriteMenuList(Integer.parseInt(this.orgId), Integer.parseInt(this.userTypeId), Integer.parseInt(this.branchId), this.languageId, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<MenuModelClass>>() {
            public void onResponse(Call<ArrayList<MenuModelClass>> call, Response<ArrayList<MenuModelClass>> response) {
                if (response == null || response.body() == null) {
                    if (MenuHomeFragment1.this.mProgressbar == null || !MenuHomeFragment1.this.mProgressbar.isShowing()) {
                        return;
                    }
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                    return;
                }
                MenuHomeFragment1.this.favouriteMenus.clear();
                MenuHomeFragment1.this.favouriteMenusDup.clear();
                MenuHomeFragment1.this.favouriteMenusDup = (ArrayList) response.body();
                if (MenuHomeFragment1.this.favouriteMenusDup.size() > 3) {
                    for (int i = 0; i < 3; i++) {
                        MenuModelClass menuModelClass = new MenuModelClass();
                        menuModelClass.setIconURL(((MenuModelClass) MenuHomeFragment1.this.favouriteMenusDup.get(i)).getIconURL());
                        menuModelClass.setMenuName(((MenuModelClass) MenuHomeFragment1.this.favouriteMenusDup.get(i)).getMenuName());
                        menuModelClass.setMenuTitle(((MenuModelClass) MenuHomeFragment1.this.favouriteMenusDup.get(i)).getMenuTitle());
                        MenuHomeFragment1.this.favouriteMenus.add(menuModelClass);
                    }
                    MenuHomeFragment1.this.rel_fav.setVisibility(0);
                    MenuHomeFragment1.this.view1.setVisibility(0);
                } else {
                    MenuHomeFragment1.this.favouriteMenus.addAll(MenuHomeFragment1.this.favouriteMenusDup);
                    MenuHomeFragment1.this.rel_fav.setVisibility(8);
                    MenuHomeFragment1.this.view1.setVisibility(8);
                }
                MenuHomeFragment1.this.mMenus.setAdapter((ListAdapter) new favoriteGridAdapter(MenuHomeFragment1.this.context, MenuHomeFragment1.this.myActivity, MenuHomeFragment1.this.favouriteMenus, MenuHomeFragment1.this.moveToMenu));
                if (MenuHomeFragment1.this.favouriteMenus.size() > 0) {
                    MenuHomeFragment1.this.mMainLL.setVisibility(0);
                } else {
                    MenuHomeFragment1.this.mMainLL.setVisibility(8);
                }
                MenuHomeFragment1.this.loadAlertsData();
            }

            public void onFailure(Call<ArrayList<MenuModelClass>> call, Throwable th) {
                if (MenuHomeFragment1.this.mProgressbar == null || !MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    return;
                }
                MenuHomeFragment1.this.mProgressbar.dismiss();
            }
        });
    }

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

    private void getAnnouncements() {
        TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
        if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
            this.mProgressbar.show();
        }
        ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GetStudentAnnouncements(Integer.parseInt(this.userID), 0L, this.maxId, this.academicYearId_announcement, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<AnnouncementModelClass>>() {
            public void onResponse(Call<ArrayList<AnnouncementModelClass>> call, Response<ArrayList<AnnouncementModelClass>> response) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                if (response == null || response.body() == null) {
                    Utility.showAlertDialog(MenuHomeFragment1.this.myActivity);
                    return;
                }
                MenuHomeFragment1.this.mAnnounsmentsList.clear();
                while (MenuHomeFragment1.this.mAnnounsmentsListDup.size() > 0) {
                    AnnouncementModelClass announcementModelClass = new AnnouncementModelClass();
                    announcementModelClass.setAnnouncementId(((AnnouncementModelClass) MenuHomeFragment1.this.mAnnounsmentsListDup.get(0)).getAnnouncementId());
                    announcementModelClass.setTitle(((AnnouncementModelClass) MenuHomeFragment1.this.mAnnounsmentsListDup.get(0)).getTitle());
                    announcementModelClass.setsDate(((AnnouncementModelClass) MenuHomeFragment1.this.mAnnounsmentsListDup.get(0)).getsDate());
                    MenuHomeFragment1.this.mAnnounsmentsList.add(announcementModelClass);
                }
                final ArrayList arrayList = (ArrayList) response.body();
                if (response.body() != null && arrayList.size() > 0) {
                    MenuHomeFragment1.this.heading = ((AnnouncementModelClass) arrayList.get(0)).getTitle();
                    MenuHomeFragment1.this.mSubject.setText(Html.fromHtml(MenuHomeFragment1.this.heading));
                    if (arrayList != null && arrayList.size() > 0) {
                        Iterator it = arrayList.iterator();
                        while (it.hasNext()) {
                            MenuHomeFragment1.this.mAnnounsmentsList.add((AnnouncementModelClass) it.next());
                        }
                    }
                }
                if (MenuHomeFragment1.this.heading == null || MenuHomeFragment1.this.heading.length() <= 0) {
                    MenuHomeFragment1.this.mSubject.setText("There are no announcements.");
                } else {
                    MenuHomeFragment1.this.mCV1.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent intent = new Intent(MenuHomeFragment1.this.context, (Class<?>) DetailAnnouncementActivity.class);
                            intent.addFlags(268435456);
                            intent.putExtra("AnnouncementId", ((AnnouncementModelClass) arrayList.get(0)).getAnnouncementId());
                            intent.putExtra("Date", ((AnnouncementModelClass) arrayList.get(0)).getsDate());
                            intent.putExtra("Heading", ((AnnouncementModelClass) arrayList.get(0)).getTitle());
                            MenuHomeFragment1.this.context.startActivity(intent);
                        }
                    });
                }
                MenuHomeFragment1.this.loadData();
            }

            public void onFailure(Call<ArrayList<AnnouncementModelClass>> call, Throwable th) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                Log.e("Announcements Response:", String.valueOf(th));
                Utility.showAlertDialog(MenuHomeFragment1.this.myActivity);
            }
        });
    }

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

    private void getDairyData() {
        TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
        if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
            this.mProgressbar.show();
        }
        ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GetDairyByDate(Integer.parseInt(this.userID), this.academicYearId_announcement, this.mdate, Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<DiaryDataModelClass>>() {
            public void onResponse(Call<ArrayList<DiaryDataModelClass>> call, Response<ArrayList<DiaryDataModelClass>> response) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                if (response == null || response.body() == null) {
                    return;
                }
                Iterator it = ((ArrayList) response.body()).iterator();
                while (it.hasNext()) {
                    DiaryDataModelClass diaryDataModelClass = (DiaryDataModelClass) it.next();
                    MenuHomeFragment1.this.subject = diaryDataModelClass.getSubjectName().trim();
                    MenuHomeFragment1.this.classwork = diaryDataModelClass.getClassWork().trim();
                    MenuHomeFragment1.this.homework = diaryDataModelClass.getHomeWork().trim();
                    MenuHomeFragment1.this.assignment = diaryDataModelClass.getAssignment().trim();
                    MenuHomeFragment1.this.project_work = diaryDataModelClass.getProjectWork().trim();
                }
                if (MenuHomeFragment1.this.subject != null || MenuHomeFragment1.this.classwork != null || MenuHomeFragment1.this.homework != null || MenuHomeFragment1.this.assignment != null || MenuHomeFragment1.this.project_work != null) {
                    if (MenuHomeFragment1.this.subject.length() > 0) {
                        MenuHomeFragment1.this.subject_tx.setText(Html.fromHtml(MenuHomeFragment1.this.subject));
                    }
                    if (MenuHomeFragment1.this.classwork.length() > 0) {
                        MenuHomeFragment1.this.mClassWork_tx.setVisibility(0);
                        MenuHomeFragment1.this.mClasswork.setText(Html.fromHtml(MenuHomeFragment1.this.classwork));
                    } else {
                        MenuHomeFragment1.this.mClassWork_tx.setVisibility(8);
                    }
                    if (MenuHomeFragment1.this.homework.length() > 0) {
                        MenuHomeFragment1.this.mHomeWork_tx.setVisibility(0);
                        MenuHomeFragment1.this.mHomework.setText(Html.fromHtml(MenuHomeFragment1.this.homework));
                    } else {
                        MenuHomeFragment1.this.mHomeWork_tx.setVisibility(8);
                    }
                    if (MenuHomeFragment1.this.assignment.length() > 0) {
                        MenuHomeFragment1.this.assignment_l1.setVisibility(0);
                        MenuHomeFragment1.this.mAssignment.setText(Html.fromHtml(MenuHomeFragment1.this.assignment));
                    }
                    if (MenuHomeFragment1.this.project_work.length() > 0) {
                        MenuHomeFragment1.this.project_l1.setVisibility(0);
                        MenuHomeFragment1.this.mProjectWork.setText(Html.fromHtml(MenuHomeFragment1.this.project_work));
                    }
                } else {
                    MenuHomeFragment1.this.mClassWork_tx.setVisibility(0);
                    MenuHomeFragment1.this.mHomeWork_tx.setVisibility(0);
                    MenuHomeFragment1.this.mClasswork.setText("Not Assigned");
                    MenuHomeFragment1.this.mHomework.setText("Not Assigned");
                }
                if ((MenuHomeFragment1.this.classwork == null || MenuHomeFragment1.this.classwork.length() <= 0) && ((MenuHomeFragment1.this.homework == null || MenuHomeFragment1.this.homework.length() <= 0) && ((MenuHomeFragment1.this.assignment == null || MenuHomeFragment1.this.assignment.length() <= 0) && (MenuHomeFragment1.this.project_work == null || MenuHomeFragment1.this.project_work.length() <= 0)))) {
                    MenuHomeFragment1.this.mClasswork.setText("Not Assigned");
                    MenuHomeFragment1.this.mHomework.setText("Not Assigned");
                    MenuHomeFragment1.this.mAssignment.setText("Not Assigned");
                    MenuHomeFragment1.this.mProjectWork.setText("Not Assigned");
                } else {
                    MenuHomeFragment1.this.mCV2.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent intent = new Intent(MenuHomeFragment1.this.context, (Class<?>) NavigationActivity.class);
                            intent.putExtra("ToActivity", Constants.DIARY);
                            intent.putExtra("MenuTitle", "Class Diary");
                            MenuHomeFragment1.this.startActivity(intent);
                        }
                    });
                }
                MenuHomeFragment1.this.getAttendanceDetails();
            }

            public void onFailure(Call<ArrayList<DiaryDataModelClass>> call, Throwable th) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                Log.e("Diary Response:", String.valueOf(th));
            }
        });
    }

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

    private void getAttendance() {
        ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GET_StudentAttendance_Home(Integer.parseInt(this.orgId), this.academicYearId_announcement, Integer.parseInt(this.branchId), Integer.parseInt(this.studentEnrollmentID), Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<HomePageAttendanceModel>>() {
            public void onResponse(Call<ArrayList<HomePageAttendanceModel>> call, Response<ArrayList<HomePageAttendanceModel>> response) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                if (response == null || response.body() == null) {
                    return;
                }
                MenuHomeFragment1.this.mAttendanceDetailsList.clear();
                MenuHomeFragment1.this.mAttendanceDetailsListDup.clear();
                MenuHomeFragment1.this.mAttendanceDetailsList = (ArrayList) response.body();
                if (MenuHomeFragment1.this.mAttendanceDetailsList.size() > 0) {
                    MenuHomeFragment1 menuHomeFragment1 = MenuHomeFragment1.this;
                    menuHomeFragment1.mAttendanceStatus = ((HomePageAttendanceModel) menuHomeFragment1.mAttendanceDetailsList.get(0)).getAttendenceStatus();
                    MenuHomeFragment1 menuHomeFragment12 = MenuHomeFragment1.this;
                    menuHomeFragment12.isHoliday = ((HomePageAttendanceModel) menuHomeFragment12.mAttendanceDetailsList.get(0)).getIsHoliday().booleanValue();
                }
                if (MenuHomeFragment1.this.isHoliday) {
                    MenuHomeFragment1.this.AttendanceStatus.setText("Today is Holiday");
                } else {
                    MenuHomeFragment1.this.AttendanceStatus.setText(Html.fromHtml(MenuHomeFragment1.this.mAttendanceStatus));
                }
                if (MenuHomeFragment1.this.mAttendanceStatus == null || MenuHomeFragment1.this.mAttendanceStatus.length() <= 0 || MenuHomeFragment1.this.mAttendanceStatus.equalsIgnoreCase("Not Given")) {
                    MenuHomeFragment1.this.AttendanceStatus.setText("No Attendance Posted");
                } else {
                    MenuHomeFragment1.this.mCV3.setVisibility(0);
                    MenuHomeFragment1.this.mCV3.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent intent = new Intent(MenuHomeFragment1.this.context, (Class<?>) NavigationActivity.class);
                            intent.putExtra("ToActivity", Constants.ATTENDANCE);
                            intent.putExtra("MenuTitle", Constants.ATTENDANCE_TAB);
                            MenuHomeFragment1.this.startActivity(intent);
                        }
                    });
                }
                MenuHomeFragment1.this.getFeeDuesDetails();
            }

            public void onFailure(Call<ArrayList<HomePageAttendanceModel>> call, Throwable th) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                Log.e("Attenda Response:", String.valueOf(th));
            }
        });
    }

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

    private void getStudentFeeDueDetails() {
        ((ApiInterface) ApiClient.getClient1(this.context).create(ApiInterface.class)).GetStudentFeeDueDetails(Integer.parseInt(this.studentEnrollmentID), this.academicYearId_announcement, Integer.parseInt(this.classId), Utility.getSchoolApiKey(this.context)).enqueue(new Callback<ArrayList<FeeAccountsModelClass>>() {
            public void onResponse(Call<ArrayList<FeeAccountsModelClass>> call, Response<ArrayList<FeeAccountsModelClass>> response) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                if (response == null || response.body() == null) {
                    return;
                }
                MenuHomeFragment1.this.feeAccountsModelClasses.clear();
                MenuHomeFragment1.this.feeAccountsModelClassesDup.clear();
                MenuHomeFragment1.this.feeAccountsModelClasses = (ArrayList) response.body();
                double overAllBalance = MenuHomeFragment1.this.feeAccountsModelClasses.size() > 0 ? ((FeeAccountsModelClass) MenuHomeFragment1.this.feeAccountsModelClasses.get(0)).getOverAllBalance() : 0.0d;
                DecimalFormat decimalFormat = new DecimalFormat("###.##");
                MenuHomeFragment1.this.mTotalBalance.setText("Rs." + decimalFormat.format(overAllBalance));
                if (overAllBalance != 0.0d) {
                    MenuHomeFragment1.this.mCV4.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent intent = new Intent(MenuHomeFragment1.this.context, (Class<?>) FeeActivity.class);
                            intent.addFlags(268435456);
                            MenuHomeFragment1.this.context.startActivity(intent);
                        }
                    });
                } else {
                    MenuHomeFragment1.this.mTotalBalance.setText("No Fee Dues Pending");
                }
            }

            public void onFailure(Call<ArrayList<FeeAccountsModelClass>> call, Throwable th) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                Log.e("Fee Response:", String.valueOf(th));
            }
        });
    }

    public void onResume() {
        initializations();
        String string = this.mSharedPref.getString("usernamekey", "");
        Bundle bundle = new Bundle();
        bundle.putString(Constants.FIREBASE_KEY_USERNAME, string);
        FirebaseAnalytics.getInstance(this.myActivity).logEvent(Constants.FIREBASE_PAGE_MENU_HOME, bundle);
        getFavouriteMenuList();
        super.onResume();
    }

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

    public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
        if (menu != null) {
            MenuItem findItem = menu.findItem(2131361868);
            if (findItem != null) {
                findItem.setVisible(false);
            }
            MenuItem findItem2 = menu.findItem(2131362566);
            this.gatePassMenuItem = findItem2;
            if (findItem2 != null) {
                if (this.isVisitorManagementEnabled == 1) {
                    findItem2.setVisible(true);
                } else {
                    findItem2.setVisible(false);
                }
            }
        }
    }

    @Override
    public void moveToMenu(MenuModelClass menuModelClass) {
        String str;
        boolean z;
        int menuId = menuModelClass.getMenuId();
        Iterator<StudentInActiveMenusModel> it = this.studentInActiveMenus.iterator();
        while (true) {
            if (!it.hasNext()) {
                str = "";
                z = false;
                break;
            } else {
                StudentInActiveMenusModel next = it.next();
                if (menuId == next.getMasterMobileAppMenuId()) {
                    str = next.getMessage();
                    z = true;
                    break;
                }
            }
        }
        if (z) {
            new AlertDialog.Builder(this.myActivity).setMessage(str).setCancelable(false).setTitle("Alert").setIcon(R.drawable.ic_dialog_alert).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.cancel();
                }
            }).show();
            return;
        }
        String redirectURL = menuModelClass.getRedirectURL();
        String webViewURL = menuModelClass.getWebViewURL();
        String menuName = menuModelClass.getMenuName();
        if (menuName.equalsIgnoreCase(Constants.DESIGN_MATE_CONTENT)) {
            if (Utility.hasNetworkConnection(this.context)) {
                new GetStudentDetailsLearning().execute(new String[0]);
                return;
            } else {
                Toast.makeText(this.context, "Check your Network Connection", 0).show();
                return;
            }
        }
        if (menuName != null && menuName.equalsIgnoreCase(Constants.FEEDETAILS)) {
            startActivity(new Intent(this.context, (Class<?>) FeeActivity.class));
            return;
        }
        if (menuName != null && menuName.equalsIgnoreCase(Constants.SCHOOL_STORE)) {
            startActivity(new Intent(this.context, (Class<?>) SchoolStoreHomeActivity.class));
            return;
        }
        if (webViewURL != null && webViewURL.length() > 0 && !webViewURL.equalsIgnoreCase("null")) {
            String formURL = Utility.formURL(this.context, webViewURL);
            Intent intent = new Intent(this.context, (Class<?>) WebViewActivity.class);
            intent.putExtra("URL", formURL);
            intent.putExtra("Title", menuModelClass.getMenuTitle());
            startActivity(intent);
            return;
        }
        if (redirectURL != null && redirectURL.length() > 0 && !redirectURL.equalsIgnoreCase("null")) {
            String formURL2 = Utility.formURL(this.context, redirectURL);
            Intent intent2 = new Intent("android.intent.action.VIEW");
            intent2.setData(Uri.parse(formURL2));
            startActivity(Intent.createChooser(intent2, "Choose"));
            return;
        }
        Intent intent3 = new Intent(this.context, (Class<?>) NavigationActivity.class);
        intent3.putExtra("ToActivity", menuName);
        intent3.putExtra("MenuTitle", menuModelClass.getMenuTitle());
        startActivity(intent3);
        this.myActivity.finish();
    }

    public void getCoursePacks() {
        TransparentProgressDialog transparentProgressDialog = this.mProgressbar;
        if (transparentProgressDialog != null && !transparentProgressDialog.isShowing()) {
            this.mProgressbar.show();
        }
        ((ApiInterface) ApiClient.getClient().create(ApiInterface.class)).getDesginmateSubscribedCoursePacks(this.masterClassId, Integer.parseInt(this.studentEnrollmentID), this.dbName).enqueue(new Callback<ApiResponse<DesignMateCoursePacksModel>>() {
            public void onResponse(Call<ApiResponse<DesignMateCoursePacksModel>> call, Response<ApiResponse<DesignMateCoursePacksModel>> response) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                if (response.body() == null) {
                    Utility.showAlertDialog(MenuHomeFragment1.this.myActivity);
                    return;
                }
                int status = ((ApiResponse) response.body()).getStatus();
                Intent intent = new Intent(MenuHomeFragment1.this.context, (Class<?>) DesignMateContentActivity.class);
                if (status == 1) {
                    if (((ApiResponse) response.body()).getResult().size() > 0) {
                        intent.putExtra("To", "Subscribed");
                    } else {
                        intent.putExtra("To", "All");
                    }
                } else {
                    intent.putExtra("To", "All");
                }
                MenuHomeFragment1.this.startActivity(intent);
            }

            public void onFailure(Call<ApiResponse<DesignMateCoursePacksModel>> call, Throwable th) {
                if (MenuHomeFragment1.this.mProgressbar != null && MenuHomeFragment1.this.mProgressbar.isShowing()) {
                    MenuHomeFragment1.this.mProgressbar.dismiss();
                }
                Utility.showAlertDialog(MenuHomeFragment1.this.myActivity);
            }
        });
    }

    public class GetStudentDetailsLearning extends AsyncTask<String, String, String> {
        SoapObject soapObject;

        public GetStudentDetailsLearning() {
        }

        @Override
        protected void onPreExecute() {
            if (MenuHomeFragment1.this.mProgressbar.isShowing()) {
                return;
            }
            MenuHomeFragment1.this.mProgressbar.show();
        }

        @Override
        public String doInBackground(String... strArr) {
            try {
                this.soapObject = SoapObjectProvider.GetStudentDetailsLearning(MenuHomeFragment1.this.context, Integer.parseInt(MenuHomeFragment1.this.studentEnrollmentID), Integer.parseInt(MenuHomeFragment1.this.academicYearId));
                return null;
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }

        @Override
        public void onPostExecute(String str) {
            if (MenuHomeFragment1.this.mProgressbar.isShowing()) {
                MenuHomeFragment1.this.mProgressbar.dismiss();
            }
            SoapObject soapObject = this.soapObject;
            if (soapObject == null) {
                Utility.showAlertDialog(MenuHomeFragment1.this.myActivity);
                return;
            }
            try {
                if (soapObject.getProperty("GetStudentDetails_LearningResult") == null) {
                    Utility.showAlertDialog(MenuHomeFragment1.this.myActivity);
                    return;
                }
                JSONArray jSONArray = new JSONArray(this.soapObject.getProperty("GetStudentDetails_LearningResult").toString());
                if (jSONArray.length() > 0) {
                    JSONObject jSONObject = jSONArray.getJSONObject(0);
                    MenuHomeFragment1.this.masterClassId = jSONObject.getInt("MasterClassID");
                    MenuHomeFragment1.this.dbName = jSONObject.getString("DBName");
                }
                if (Utility.hasNetworkConnection(MenuHomeFragment1.this.context)) {
                    MenuHomeFragment1.this.getCoursePacks();
                } else {
                    Toast.makeText(MenuHomeFragment1.this.context, "Check your Network Connection", 0).show();
                }
            } catch (Exception e) {
                Utility.showAlertDialog(MenuHomeFragment1.this.myActivity);
                e.printStackTrace();
            }
        }
    }
}