导航菜单

页面标题

页面副标题

EFFICIENT POS v1.5.7 - DynamicMenuFragment.java 源代码

正在查看: EFFICIENT POS v1.5.7 应用的 DynamicMenuFragment.java JAVA 源代码文件

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


package dev.gtr.pos.fragment;

import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.SpannableString;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.transition.Slide;
import android.transition.TransitionManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import dev.gtr.pos.R;
import dev.gtr.pos.activity.AccountHeadActivity;
import dev.gtr.pos.activity.AccountTransactionListActivity;
import dev.gtr.pos.activity.AttendanceActivity;
import dev.gtr.pos.activity.CategoryActivity;
import dev.gtr.pos.activity.CustomerActivity;
import dev.gtr.pos.activity.EmployeeActivity;
import dev.gtr.pos.activity.EmployeeAttendanceHistoryActivity;
import dev.gtr.pos.activity.InsertUpdateGetSalesActivity;
import dev.gtr.pos.activity.LoginActivity;
import dev.gtr.pos.activity.OnlineSalesListActivity;
import dev.gtr.pos.activity.ProductListActivity;
import dev.gtr.pos.activity.PurchaseOrderActivity;
import dev.gtr.pos.activity.PurchaseOrderListActivity;
import dev.gtr.pos.activity.SalesListActivity;
import dev.gtr.pos.activity.SalesReportViewActivity;
import dev.gtr.pos.activity.SettingsActivity;
import dev.gtr.pos.activity.SupplierActivity;
import dev.gtr.pos.activity.TaskActivity;
import dev.gtr.pos.activity.UnitActivity;
import dev.gtr.pos.activity.WebActivity;
import dev.gtr.pos.activity.WebActivityEcommerce;
import dev.gtr.pos.adapter.AdapterMenu;
import dev.gtr.pos.adapter.AdapterSpinner;
import dev.gtr.pos.adapter.AdapterSpinnerAttendance;
import dev.gtr.pos.api.ApiClient;
import dev.gtr.pos.config.Constant;
import dev.gtr.pos.fragment.DynamicMenuFragment;
import dev.gtr.pos.model.AttendanceFeedBack;
import dev.gtr.pos.model.CategoryUnitList;
import dev.gtr.pos.model.EmployeeDropDown;
import dev.gtr.pos.model.HomeMessage;
import dev.gtr.pos.model.Menu;
import dev.gtr.pos.model.ModelErrorLogin;
import es.dmoral.toasty.Toasty;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class DynamicMenuFragment extends Fragment {
    AdapterMenu adapterMenu;
    AlertDialog.Builder alertBuilder;
    AlertDialog.Builder alertBuilderLoc;
    AlertDialog alertDialog;
    AlertDialog alertDialogLoc;
    Button buttonMsgTitle;
    Button buttonProceed;
    Calendar calendar;
    ArrayList<CategoryUnitList> category;
    String company;
    ConstraintLayout constraintLayoutAlert;
    LinearLayout constraintLayoutAnim;
    ConstraintLayout constraintLayoutItem;
    List<String> cookies;
    SimpleDateFormat dateFormat;
    SharedPreferences.Editor editor;
    String email;
    ArrayList<EmployeeDropDown> employee;
    Handler handler;
    ImageView imageViewCheck;
    ArrayList<Menu> item;
    double lang;
    double lat;
    LocationManager lm;
    LocationListener locationListener;
    ArrayList<HomeMessage> msg;
    DatePickerDialog.OnDateSetListener onDateSetListenerFrom;
    DatePickerDialog.OnDateSetListener onDateSetListenerTo;
    String openInBrowser;
    String pass;
    ProgressBar progressBar;
    RecyclerView recyclerViewMenu;
    String role;
    Runnable runnable;
    SharedPreferences sharedPreferences;
    TextView textViewDayDate;
    TextView textViewError;
    TextView textViewLoc;
    TextView textViewM;
    TextView textViewUserInfo;
    String username;
    ArrayList<CategoryUnitList> warehouse;
    int selectedValue = 0;
    int TopWareHouseId = 0;
    int slide = 0;
    boolean attendanceTime = false;
    boolean logout = false;
    boolean fromAtt = false;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

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

    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        this.constraintLayoutItem = view.findViewById(R.id.constraintLayout3);
        this.constraintLayoutAlert = view.findViewById(R.id.constraintLayout_alert);
        this.textViewM = (TextView) view.findViewById(R.id.textView_anim);
        this.textViewError = (TextView) view.findViewById(R.id.textView_error_msg);
        this.textViewDayDate = (TextView) view.findViewById(R.id.textView_day);
        this.textViewUserInfo = (TextView) view.findViewById(R.id.textView_info);
        this.buttonMsgTitle = (Button) view.findViewById(R.id.textView_categorie);
        this.constraintLayoutAnim = (LinearLayout) view.findViewById(R.id.constraintLayout_anim);
        this.recyclerViewMenu = view.findViewById(R.id.recyclerview_menu);
        Calendar calendar = Calendar.getInstance();
        this.calendar = calendar;
        String displayName = calendar.getDisplayName(7, 2, Locale.US);
        this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy", Locale.US);
        this.textViewDayDate.setText("" + displayName + "\n" + this.dateFormat.format(this.calendar.getTime()));
        SharedPreferences sharedPreferences = getActivity().getSharedPreferences("LOGIN", 0);
        this.sharedPreferences = sharedPreferences;
        this.editor = sharedPreferences.edit();
        this.email = this.sharedPreferences.getString("EMAIl", null);
        this.openInBrowser = this.sharedPreferences.getString("IN_BROWSER", "0");
        this.pass = this.sharedPreferences.getString("PASS", null);
        this.role = this.sharedPreferences.getString("ROLENAME", null);
        this.company = this.sharedPreferences.getString("COMPNAME", null);
        this.username = this.sharedPreferences.getString("USERNAME", null);
        this.textViewUserInfo.setText("User : " + this.username + "\nCompany : " + this.company + "\nEmail : " + this.email + "\nRole : " + this.role);
        this.lm = (LocationManager) getActivity().getSystemService(FirebaseAnalytics.Param.LOCATION);
        this.alertBuilderLoc = new AlertDialog.Builder(getActivity());
        View inflate = getLayoutInflater().inflate(R.layout.alert_loc, (ViewGroup) null);
        this.progressBar = (ProgressBar) inflate.findViewById(R.id.progress_loc);
        this.buttonProceed = (Button) inflate.findViewById(R.id.button_proceed);
        this.textViewLoc = (TextView) inflate.findViewById(R.id.textView39);
        this.imageViewCheck = (ImageView) inflate.findViewById(R.id.imageView_check);
        this.buttonProceed.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                DynamicMenuFragment.this.getActivity().startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) AttendanceActivity.class));
            }
        });
        this.category = new ArrayList<>();
        this.warehouse = new ArrayList<>();
        this.alertBuilderLoc.setView(inflate);
        this.alertDialogLoc = this.alertBuilderLoc.create();
        this.category = new ArrayList<>();
        this.warehouse = new ArrayList<>();
        getCategory();
        getWareHouses();
        getEmployee();
        getTextMesg();
        getAllMenu();
        this.locationListener = new LocationListener() {
            @Override
            public void onLocationChanged(Location location) {
                DynamicMenuFragment.this.lat = location.getLatitude();
                DynamicMenuFragment.this.lang = location.getLongitude();
                if (DynamicMenuFragment.this.lat != 0.0d && DynamicMenuFragment.this.lang != 0.0d && DynamicMenuFragment.this.fromAtt) {
                    DynamicMenuFragment dynamicMenuFragment = DynamicMenuFragment.this;
                    dynamicMenuFragment.getAddress(dynamicMenuFragment.lat, DynamicMenuFragment.this.lang);
                }
                if (DynamicMenuFragment.this.lang == 0.0d || DynamicMenuFragment.this.lat == 0.0d || !DynamicMenuFragment.this.logout) {
                    return;
                }
                DynamicMenuFragment dynamicMenuFragment2 = DynamicMenuFragment.this;
                dynamicMenuFragment2.logOut(dynamicMenuFragment2.lat, DynamicMenuFragment.this.lang);
            }
        };
        getLonLog(1);
    }

    public void logOut(double d, double d2) {
        ApiClient.getInstance(getActivity()).getApi().logout("Bearer " + Constant.Token, String.valueOf(d2), String.valueOf(d)).enqueue(new Callback<String>() {
            @Override
            public void onFailure(Call<String> call, Throwable th) {
            }

            @Override
            public void onResponse(Call<String> call, Response<String> response) {
                if (response.isSuccessful()) {
                    if (response.body().toString().equals("true")) {
                        DynamicMenuFragment.this.editor.putString("TOKEN", "");
                        DynamicMenuFragment.this.editor.putString("COMID", "");
                        DynamicMenuFragment.this.editor.putString("UID", "");
                        DynamicMenuFragment.this.editor.putString("EMAIL", "");
                        DynamicMenuFragment.this.editor.putString("PASS", "");
                        DynamicMenuFragment.this.editor.putInt("ISLOGIN", 0);
                        DynamicMenuFragment.this.editor.putInt("CHECK", 0);
                        DynamicMenuFragment.this.editor.putString("SALEBARCODE", "");
                        DynamicMenuFragment.this.editor.putString("ROLENAME", "");
                        DynamicMenuFragment.this.editor.apply();
                        DynamicMenuFragment.this.getActivity().finish();
                        DynamicMenuFragment.this.logout = false;
                        Toasty.success((Context) DynamicMenuFragment.this.getActivity(), (CharSequence) "Logged Out Successfully", 0).show();
                        DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) LoginActivity.class));
                        return;
                    }
                    return;
                }
                Log.e("logout", "" + response.code());
            }
        });
    }

    public void getAddress(double d, double d2) {
        try {
            String addressLine = new Geocoder(getActivity(), Locale.getDefault()).getFromLocation(d, d2, 1).get(0).getAddressLine(0);
            if (addressLine != null) {
                this.progressBar.setVisibility(8);
                if (this.attendanceTime) {
                    return;
                }
                getAttendance(String.valueOf(d), String.valueOf(this.lang), addressLine);
            }
        } catch (IOException e) {
            e.printStackTrace();
            this.alertDialogLoc.dismiss();
            Toasty.error((Context) getActivity(), (CharSequence) "Please try again", 0).show();
        }
    }

    private void getAttendance(String str, String str2, String str3) {
        ApiClient.getInstance(getActivity()).getApi().AddAttendance("Bearer " + Constant.Token, Constant.uId, str, str2, str3).enqueue(new Callback<AttendanceFeedBack>() {
            @Override
            public void onFailure(Call<AttendanceFeedBack> call, Throwable th) {
            }

            @Override
            public void onResponse(Call<AttendanceFeedBack> call, Response<AttendanceFeedBack> response) {
                if (response.isSuccessful()) {
                    if (response.body().getSuccess().equals("true")) {
                        DynamicMenuFragment.this.textViewLoc.setText("Your Attendance taken ");
                        DynamicMenuFragment.this.imageViewCheck.setVisibility(0);
                        DynamicMenuFragment.this.attendanceTime = true;
                        Toasty.success((Context) DynamicMenuFragment.this.getActivity(), (CharSequence) "Your attendance taken successfully", 0).show();
                        return;
                    }
                    Toasty.error((Context) DynamicMenuFragment.this.getActivity(), (CharSequence) "Attendance couldn't Take", 0).show();
                }
            }
        });
    }

    class AnonymousClass5 implements Callback<ResponseBody> {
        @Override
        public void onFailure(Call<ResponseBody> call, Throwable th) {
        }

        AnonymousClass5() {
        }

        @Override
        public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
            String str;
            if (response.body() != null) {
                DynamicMenuFragment.this.item = new ArrayList<>();
                Gson gson = new Gson();
                try {
                    str = response.body().string();
                } catch (IOException e) {
                    e.printStackTrace();
                    str = null;
                }
                try {
                    ModelErrorLogin modelErrorLogin = (ModelErrorLogin) gson.fromJson(str, ModelErrorLogin.class);
                    if (modelErrorLogin.getError() != null && modelErrorLogin.getError().booleanValue()) {
                        DynamicMenuFragment.this.constraintLayoutAlert.setVisibility(0);
                        DynamicMenuFragment.this.textViewError.setText(modelErrorLogin.getMessage());
                    }
                } catch (Exception e2) {
                    try {
                        DynamicMenuFragment.this.item = (ArrayList) gson.fromJson(str, new TypeToken<List<Menu>>() {
                        }.getType());
                        if (DynamicMenuFragment.this.item.size() <= 0) {
                            DynamicMenuFragment.this.constraintLayoutAlert.setVisibility(0);
                            DynamicMenuFragment.this.textViewError.setText("No Permission,Contact with your software provider");
                        } else {
                            for (int i = 0; i < DynamicMenuFragment.this.item.size(); i++) {
                                if (DynamicMenuFragment.this.item.get(i).getMnName().equals("mnusaleslist")) {
                                    Constant.IsCreateSales = DynamicMenuFragment.this.item.get(i).getIsCreate();
                                    Constant.IsDeleteSales = DynamicMenuFragment.this.item.get(i).getIsDeleteP();
                                    Constant.IsEditSales = DynamicMenuFragment.this.item.get(i).getIsEdit();
                                }
                                if (DynamicMenuFragment.this.item.get(i).getMnName().equals("mnuRecevingOrder")) {
                                    Constant.IsCreatePurchase = DynamicMenuFragment.this.item.get(i).getIsCreate();
                                    Constant.IsDeletePurchase = DynamicMenuFragment.this.item.get(i).getIsDeleteP();
                                    Constant.IsEditPurchase = DynamicMenuFragment.this.item.get(i).getIsEdit();
                                }
                                if (DynamicMenuFragment.this.item.get(i).getMnName().equals("mnuSupplier")) {
                                    Constant.IsCreateSupplier = "" + DynamicMenuFragment.this.item.get(i).getIsCreate();
                                    Constant.IsDeleteSupplier = "" + DynamicMenuFragment.this.item.get(i).getIsDeleteP();
                                    Constant.IsEditSupplier = "" + DynamicMenuFragment.this.item.get(i).getIsEdit();
                                }
                                if (DynamicMenuFragment.this.item.get(i).getMnName().equals("mnuCustomer")) {
                                    Constant.IsCreateCustomer = "" + DynamicMenuFragment.this.item.get(i).getIsCreate();
                                    Constant.IsDeleteCustomer = "" + DynamicMenuFragment.this.item.get(i).getIsDeleteP();
                                    Constant.IsEditCustomer = "" + DynamicMenuFragment.this.item.get(i).getIsEdit();
                                }
                                if (DynamicMenuFragment.this.item.get(i).getMnName().equals("mnuAccount")) {
                                    Constant.IsCreateAccHead = "" + DynamicMenuFragment.this.item.get(i).getIsCreate();
                                    Constant.IsEditAccHead = "" + DynamicMenuFragment.this.item.get(i).getIsEdit();
                                    Constant.IsDeleteAccHead = "" + DynamicMenuFragment.this.item.get(i).getIsDeleteP();
                                }
                            }
                        }
                    } catch (Exception e3) {
                        Log.e("Head", "" + e3.toString());
                    }
                    e2.printStackTrace();
                }
                DynamicMenuFragment.this.adapterMenu = new AdapterMenu(DynamicMenuFragment.this.item, DynamicMenuFragment.this.getActivity());
                DynamicMenuFragment.this.recyclerViewMenu.setLayoutManager(new GridLayoutManager(DynamicMenuFragment.this.getActivity(), 3));
                DynamicMenuFragment.this.recyclerViewMenu.setAdapter(DynamicMenuFragment.this.adapterMenu);
                DynamicMenuFragment.this.recyclerViewMenu.setHasFixedSize(true);
                DynamicMenuFragment.this.adapterMenu.setOnItemClick(new AnonymousClass2());
            }
        }

        class AnonymousClass2 implements AdapterMenu.OnItemClick {
            AnonymousClass2() {
            }

            @Override
            public void onClick(int i, Menu menu) {
                if (menu.getMnName().equals("mnuSalesEntry")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) InsertUpdateGetSalesActivity.class));
                }
                if (menu.getMnName().equals("mnusaleslist")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) SalesListActivity.class));
                }
                if (menu.getMnName().equals("mnuItem")) {
                    Intent intent = new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) ProductListActivity.class);
                    intent.putExtra(Constant.IsCreate, "" + DynamicMenuFragment.this.item.get(i).getIsCreate());
                    intent.putExtra(Constant.IsDelete, "" + DynamicMenuFragment.this.item.get(i).getIsDeleteP());
                    intent.putExtra(Constant.IsEdit, "" + DynamicMenuFragment.this.item.get(i).getIsEdit());
                    DynamicMenuFragment.this.startActivity(intent);
                }
                if (menu.getMnName().equals("mnucategory")) {
                    Intent intent2 = new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) CategoryActivity.class);
                    intent2.putExtra(Constant.IsCreate, "" + DynamicMenuFragment.this.item.get(i).getIsCreate());
                    intent2.putExtra(Constant.IsDelete, "" + DynamicMenuFragment.this.item.get(i).getIsDeleteP());
                    intent2.putExtra(Constant.IsEdit, "" + DynamicMenuFragment.this.item.get(i).getIsEdit());
                    DynamicMenuFragment.this.startActivity(intent2);
                }
                if (menu.getMnName().equals("mnuCustomer")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) CustomerActivity.class));
                }
                if (menu.getMnName().equals("mnuUnit")) {
                    Intent intent3 = new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) UnitActivity.class);
                    intent3.putExtra(Constant.IsCreate, "" + DynamicMenuFragment.this.item.get(i).getIsCreate());
                    intent3.putExtra(Constant.IsDelete, "" + DynamicMenuFragment.this.item.get(i).getIsDeleteP());
                    intent3.putExtra(Constant.IsEdit, "" + DynamicMenuFragment.this.item.get(i).getIsEdit());
                    DynamicMenuFragment.this.startActivity(intent3);
                }
                if (menu.getMnName().equals("mnuMore")) {
                    if (DynamicMenuFragment.this.openInBrowser.equals("1")) {
                        StringBuilder sb = new StringBuilder("https://www.pqstec.com/invoiceapps/Home/LoginApi?Email=");
                        sb.append(DynamicMenuFragment.this.email);
                        sb.append("&Password=");
                        sb.append(DynamicMenuFragment.this.pass);
                        sb.append("&isMobile=1&DefaultComId=");
                        sb.append(Constant.ComId);
                        Intent intent4 = new Intent("android.intent.action.VIEW", Uri.parse(sb.toString()));
                        Log.e("URLs", sb.toString());
                        DynamicMenuFragment.this.startActivity(intent4);
                    } else {
                        DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) WebActivity.class));
                    }
                }
                if (menu.getMnName().equals("mnuAttendance")) {
                    if (DynamicMenuFragment.this.attendanceTime) {
                        DynamicMenuFragment.this.attendanceTime = false;
                        DynamicMenuFragment.this.textViewLoc.setText("Please Wait finding your location");
                        DynamicMenuFragment.this.imageViewCheck.setVisibility(8);
                        DynamicMenuFragment.this.progressBar.setVisibility(0);
                    }
                    DynamicMenuFragment.this.getLonLog(0);
                }
                if (menu.getMnName().equals("mnuSupplier")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) SupplierActivity.class));
                }
                if (menu.getMnName().equals("mnuAttReport")) {
                    if (DynamicMenuFragment.this.employee != null && DynamicMenuFragment.this.employee.size() > 0) {
                        DynamicMenuFragment.this.alertBuilder = new AlertDialog.Builder(DynamicMenuFragment.this.getActivity());
                        View inflate = DynamicMenuFragment.this.getLayoutInflater().inflate(R.layout.alert_attendance_report, (ViewGroup) null);
                        AppCompatSpinner findViewById = inflate.findViewById(R.id.appcompatspinner_employee);
                        Button button = (Button) inflate.findViewById(R.id.button_view);
                        Button button2 = (Button) inflate.findViewById(R.id.button_report);
                        final TextView textView = (TextView) inflate.findViewById(R.id.textView_fromDate);
                        final TextView textView2 = (TextView) inflate.findViewById(R.id.textView_toDate);
                        TextView textView3 = (TextView) inflate.findViewById(R.id.previous);
                        TextView textView4 = (TextView) inflate.findViewById(R.id.next);
                        TextView textView5 = (TextView) inflate.findViewById(R.id.current);
                        final CheckBox checkBox = (CheckBox) inflate.findViewById(R.id.checkBox_attendance);
                        if (DynamicMenuFragment.this.sharedPreferences.getInt("CHECK", 0) == 1) {
                            checkBox.setChecked(true);
                        } else {
                            checkBox.setChecked(false);
                        }
                        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                            @Override
                            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                                if (z) {
                                    DynamicMenuFragment.this.editor.putInt("CHECK", 1);
                                } else {
                                    DynamicMenuFragment.this.editor.putInt("CHECK", 0);
                                }
                                DynamicMenuFragment.this.editor.apply();
                            }
                        });
                        DynamicMenuFragment.this.calendar = Calendar.getInstance();
                        int i2 = DynamicMenuFragment.this.calendar.get(1);
                        int i3 = DynamicMenuFragment.this.calendar.get(2);
                        int i4 = DynamicMenuFragment.this.calendar.get(5);
                        DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                        DynamicMenuFragment.this.calendar.set(i2, i3, i4);
                        textView2.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                        textView.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                        DynamicMenuFragment.this.onDateSetListenerTo = new DatePickerDialog.OnDateSetListener() {
                            @Override
                            public final void onDateSet(DatePicker datePicker, int i5, int i6, int i7) {
                                DynamicMenuFragment.AnonymousClass5.AnonymousClass2.this.m232lambda$onClick$0$devgtrposfragmentDynamicMenuFragment$5$2(textView2, datePicker, i5, i6, i7);
                            }
                        };
                        DynamicMenuFragment.this.onDateSetListenerFrom = new DatePickerDialog.OnDateSetListener() {
                            @Override
                            public final void onDateSet(DatePicker datePicker, int i5, int i6, int i7) {
                                DynamicMenuFragment.AnonymousClass5.AnonymousClass2.this.m233lambda$onClick$1$devgtrposfragmentDynamicMenuFragment$5$2(textView, datePicker, i5, i6, i7);
                            }
                        };
                        textView.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                DynamicMenuFragment.this.ShowDate(DynamicMenuFragment.this.onDateSetListenerFrom);
                            }
                        });
                        textView2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                DynamicMenuFragment.this.ShowDate(DynamicMenuFragment.this.onDateSetListenerTo);
                            }
                        });
                        textView3.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                DynamicMenuFragment.this.calendar.setTime(new Date(textView.getText().toString()));
                                int i5 = DynamicMenuFragment.this.calendar.get(2);
                                int i6 = DynamicMenuFragment.this.calendar.get(1);
                                int i7 = i5 - 1;
                                if (i7 == 0) {
                                    i6--;
                                    i7 = 12;
                                }
                                DynamicMenuFragment.this.calendar.set(i6, i7, DynamicMenuFragment.this.calendar.getActualMinimum(5));
                                DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                                textView.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                                DynamicMenuFragment.this.calendar.set(i6, i7, DynamicMenuFragment.this.calendar.getActualMaximum(5));
                                textView2.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                            }
                        });
                        textView4.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                DynamicMenuFragment.this.calendar.setTime(new Date(textView.getText().toString()));
                                int i5 = DynamicMenuFragment.this.calendar.get(2);
                                int i6 = DynamicMenuFragment.this.calendar.get(1);
                                int i7 = i5 + 1;
                                if (i7 == 12) {
                                    i6++;
                                    i7 = 0;
                                }
                                DynamicMenuFragment.this.calendar.set(i6, i7, DynamicMenuFragment.this.calendar.getActualMinimum(5));
                                DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                                textView.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                                DynamicMenuFragment.this.calendar.set(i6, i7, DynamicMenuFragment.this.calendar.getActualMaximum(5));
                                textView2.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                            }
                        });
                        textView5.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                Calendar calendar = Calendar.getInstance();
                                int i5 = calendar.get(2);
                                int i6 = calendar.get(1);
                                calendar.set(i6, i5, calendar.getActualMinimum(5));
                                DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                                textView.setText(DynamicMenuFragment.this.dateFormat.format(calendar.getTime()));
                                calendar.set(i6, i5, calendar.getActualMaximum(5));
                                textView2.setText(DynamicMenuFragment.this.dateFormat.format(calendar.getTime()));
                            }
                        });
                        button.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                Intent intent5 = new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) EmployeeAttendanceHistoryActivity.class);
                                intent5.putExtra(Constant.EMPID, DynamicMenuFragment.this.selectedValue);
                                intent5.putExtra(Constant.FROM, textView.getText().toString());
                                intent5.putExtra(Constant.TO, textView2.getText().toString());
                                intent5.putExtra(Constant.COOKIE, DynamicMenuFragment.this.cookies.get(0));
                                intent5.putExtra(Constant.FromAttendance, "1");
                                if (checkBox.isChecked()) {
                                    intent5.putExtra(Constant.ISLOC, "1");
                                } else {
                                    intent5.putExtra(Constant.ISLOC, "0");
                                }
                                DynamicMenuFragment.this.startActivity(intent5);
                            }
                        });
                        button2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                Intent intent5 = new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) SalesReportViewActivity.class);
                                intent5.putExtra(Constant.EMPID, DynamicMenuFragment.this.selectedValue);
                                intent5.putExtra(Constant.FROM, textView.getText().toString());
                                intent5.putExtra(Constant.TO, textView2.getText().toString());
                                intent5.putExtra(Constant.COOKIE, DynamicMenuFragment.this.cookies.get(0));
                                intent5.putExtra(Constant.FromAttendance, "1");
                                if (checkBox.isChecked()) {
                                    intent5.putExtra(Constant.ISLOC, "1");
                                } else {
                                    intent5.putExtra(Constant.ISLOC, "0");
                                }
                                DynamicMenuFragment.this.startActivity(intent5);
                            }
                        });
                        AdapterSpinnerAttendance adapterSpinnerAttendance = new AdapterSpinnerAttendance(DynamicMenuFragment.this.getActivity(), DynamicMenuFragment.this.employee);
                        findViewById.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                            @Override
                            public void onNothingSelected(AdapterView<?> adapterView) {
                            }

                            @Override
                            public void onItemSelected(AdapterView<?> adapterView, View view, int i5, long j) {
                                EmployeeDropDown employeeDropDown = (EmployeeDropDown) adapterView.getItemAtPosition(i5);
                                DynamicMenuFragment.this.selectedValue = 0;
                                if (employeeDropDown.getValue() != null) {
                                    DynamicMenuFragment.this.selectedValue = Integer.parseInt(employeeDropDown.getValue());
                                }
                            }
                        });
                        findViewById.setAdapter(adapterSpinnerAttendance);
                        DynamicMenuFragment.this.alertBuilder.setView(inflate);
                        DynamicMenuFragment.this.alertDialog = DynamicMenuFragment.this.alertBuilder.create();
                        DynamicMenuFragment.this.alertDialog.show();
                    } else {
                        Toasty.info((Context) DynamicMenuFragment.this.getActivity(), (CharSequence) "Please Wait a minute");
                    }
                }
                if (menu.getMnName().equals("mnuItemStock")) {
                    DynamicMenuFragment.this.alertBuilder = new AlertDialog.Builder(DynamicMenuFragment.this.getActivity());
                    View inflate2 = DynamicMenuFragment.this.getLayoutInflater().inflate(R.layout.alert_stock, (ViewGroup) null);
                    AppCompatSpinner findViewById2 = inflate2.findViewById(R.id.appcompatspinner_category);
                    AppCompatSpinner findViewById3 = inflate2.findViewById(R.id.appcompatspinner_warehouse);
                    Button button3 = (Button) inflate2.findViewById(R.id.button_submit);
                    Button button4 = (Button) inflate2.findViewById(R.id.button_cancel);
                    final TextView textView6 = (TextView) inflate2.findViewById(R.id.textView_fromDate);
                    final TextView textView7 = (TextView) inflate2.findViewById(R.id.textView_toDate);
                    DynamicMenuFragment.this.calendar = Calendar.getInstance();
                    int i5 = DynamicMenuFragment.this.calendar.get(1);
                    int i6 = DynamicMenuFragment.this.calendar.get(2);
                    int i7 = DynamicMenuFragment.this.calendar.get(5);
                    DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                    DynamicMenuFragment.this.calendar.set(i5, i6, i7);
                    textView7.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                    textView6.setText(DynamicMenuFragment.this.dateFormat.format(DynamicMenuFragment.this.calendar.getTime()));
                    DynamicMenuFragment.this.onDateSetListenerTo = new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public final void onDateSet(DatePicker datePicker, int i8, int i9, int i10) {
                            DynamicMenuFragment.AnonymousClass5.AnonymousClass2.this.m234lambda$onClick$2$devgtrposfragmentDynamicMenuFragment$5$2(textView7, datePicker, i8, i9, i10);
                        }
                    };
                    DynamicMenuFragment.this.onDateSetListenerFrom = new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public final void onDateSet(DatePicker datePicker, int i8, int i9, int i10) {
                            DynamicMenuFragment.AnonymousClass5.AnonymousClass2.this.m235lambda$onClick$3$devgtrposfragmentDynamicMenuFragment$5$2(textView6, datePicker, i8, i9, i10);
                        }
                    };
                    textView6.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            DynamicMenuFragment.this.ShowDate(DynamicMenuFragment.this.onDateSetListenerFrom);
                        }
                    });
                    textView7.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            DynamicMenuFragment.this.ShowDate(DynamicMenuFragment.this.onDateSetListenerTo);
                        }
                    });
                    button3.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent intent5 = new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) SalesReportViewActivity.class);
                            intent5.putExtra(Constant.CATEGORY_ID, DynamicMenuFragment.this.selectedValue);
                            intent5.putExtra(Constant.WAREHOUSE_ID, DynamicMenuFragment.this.TopWareHouseId);
                            intent5.putExtra(Constant.FROM, textView6.getText().toString());
                            intent5.putExtra(Constant.TO, textView7.getText().toString());
                            intent5.putExtra(Constant.COOKIE, DynamicMenuFragment.this.cookies.get(0));
                            intent5.putExtra(Constant.FromStock, "1");
                            DynamicMenuFragment.this.alertDialog.dismiss();
                            DynamicMenuFragment.this.startActivity(intent5);
                        }
                    });
                    button4.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            DynamicMenuFragment.this.alertDialog.dismiss();
                        }
                    });
                    AdapterSpinner adapterSpinner = new AdapterSpinner(DynamicMenuFragment.this.getActivity(), DynamicMenuFragment.this.category);
                    findViewById2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onNothingSelected(AdapterView<?> adapterView) {
                        }

                        @Override
                        public void onItemSelected(AdapterView<?> adapterView, View view, int i8, long j) {
                            CategoryUnitList categoryUnitList = (CategoryUnitList) adapterView.getItemAtPosition(i8);
                            DynamicMenuFragment.this.selectedValue = Integer.parseInt(categoryUnitList.getValue());
                        }
                    });
                    findViewById2.setAdapter(adapterSpinner);
                    findViewById3.setAdapter(new AdapterSpinner(DynamicMenuFragment.this.getActivity(), DynamicMenuFragment.this.warehouse));
                    findViewById3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onNothingSelected(AdapterView<?> adapterView) {
                        }

                        @Override
                        public void onItemSelected(AdapterView<?> adapterView, View view, int i8, long j) {
                            CategoryUnitList categoryUnitList = (CategoryUnitList) adapterView.getItemAtPosition(i8);
                            DynamicMenuFragment.this.TopWareHouseId = Integer.parseInt(categoryUnitList.getValue());
                        }
                    });
                    DynamicMenuFragment.this.alertBuilder.setView(inflate2);
                    DynamicMenuFragment.this.alertDialog = DynamicMenuFragment.this.alertBuilder.create();
                    DynamicMenuFragment.this.alertDialog.show();
                }
                if (menu.getMnName().equals("mnuEcommerce")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) WebActivityEcommerce.class));
                }
                if (menu.getMnName().equals("mnuPurchaseOrder")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) PurchaseOrderActivity.class));
                }
                if (menu.getMnName().equals("mnuRecevingOrder")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) PurchaseOrderListActivity.class));
                }
                if (menu.getMnName().equals("mnuEmployee")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) EmployeeActivity.class));
                }
                if (menu.getMnName().equals("mnuAccountsTransaction")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) AccountTransactionListActivity.class));
                }
                if (menu.getMnName().equals("mnuOnlineOrder")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) OnlineSalesListActivity.class));
                }
                if (menu.getMnName().equals("mnuTaskToDo")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) TaskActivity.class));
                }
                if (menu.getMnName().equals("mnuAccount")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) AccountHeadActivity.class));
                }
                if (menu.getMnName().equals("mnuSettings")) {
                    DynamicMenuFragment.this.startActivity(new Intent((Context) DynamicMenuFragment.this.getActivity(), (Class<?>) SettingsActivity.class));
                }
                if (menu.getMnName().equals("mnuLogout")) {
                    DynamicMenuFragment.this.logOut(0.0d, 0.0d);
                }
            }

            void m232lambda$onClick$0$devgtrposfragmentDynamicMenuFragment$5$2(TextView textView, DatePicker datePicker, int i, int i2, int i3) {
                DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                Calendar calendar = Calendar.getInstance();
                calendar.set(i, i2, i3);
                textView.setText(DynamicMenuFragment.this.dateFormat.format(calendar.getTime()));
            }

            void m233lambda$onClick$1$devgtrposfragmentDynamicMenuFragment$5$2(TextView textView, DatePicker datePicker, int i, int i2, int i3) {
                DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                Calendar calendar = Calendar.getInstance();
                calendar.set(i, i2, i3);
                textView.setText(DynamicMenuFragment.this.dateFormat.format(calendar.getTime()));
            }

            void m234lambda$onClick$2$devgtrposfragmentDynamicMenuFragment$5$2(TextView textView, DatePicker datePicker, int i, int i2, int i3) {
                DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                Calendar calendar = Calendar.getInstance();
                calendar.set(i, i2, i3);
                textView.setText(DynamicMenuFragment.this.dateFormat.format(calendar.getTime()));
            }

            void m235lambda$onClick$3$devgtrposfragmentDynamicMenuFragment$5$2(TextView textView, DatePicker datePicker, int i, int i2, int i3) {
                DynamicMenuFragment.this.dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
                Calendar calendar = Calendar.getInstance();
                calendar.set(i, i2, i3);
                textView.setText(DynamicMenuFragment.this.dateFormat.format(calendar.getTime()));
            }
        }
    }

    private void getAllMenu() {
        ApiClient.getInstance(getActivity()).getApi().getMenu("Bearer " + Constant.Token, Constant.uId).enqueue(new AnonymousClass5());
    }

    private void getCategory() {
        ApiClient.getInstance(getActivity()).getApi().getCategory("Bearer " + Constant.Token).enqueue(new Callback<List<CategoryUnitList>>() {
            @Override
            public void onFailure(Call<List<CategoryUnitList>> call, Throwable th) {
            }

            @Override
            public void onResponse(Call<List<CategoryUnitList>> call, Response<List<CategoryUnitList>> response) {
                if (response.body() == null || !response.isSuccessful()) {
                    return;
                }
                DynamicMenuFragment.this.category.add(new CategoryUnitList("0", "------- All --------"));
                for (CategoryUnitList categoryUnitList : response.body()) {
                    DynamicMenuFragment.this.category.add(new CategoryUnitList(categoryUnitList.getValue(), categoryUnitList.getText()));
                }
            }
        });
    }

    private void getTextMesg() {
        this.constraintLayoutAnim.setVisibility(8);
        this.textViewM.setText("");
        this.buttonMsgTitle.setVisibility(8);
        ApiClient.getInstance(getActivity()).getApi().getTextMessage("Bearer " + Constant.Token).enqueue(new AnonymousClass7());
    }

    class AnonymousClass7 implements Callback<List<HomeMessage>> {
        @Override
        public void onFailure(Call<List<HomeMessage>> call, Throwable th) {
        }

        AnonymousClass7() {
        }

        @Override
        public void onResponse(Call<List<HomeMessage>> call, Response<List<HomeMessage>> response) {
            if (!response.isSuccessful() || response.body() == null || response.body().size() <= 0) {
                return;
            }
            DynamicMenuFragment.this.buttonMsgTitle.setVisibility(0);
            DynamicMenuFragment.this.constraintLayoutAnim.setVisibility(0);
            DynamicMenuFragment.this.msg = (ArrayList) response.body();
            DynamicMenuFragment.this.slide = r3.msg.size() - 1;
            DynamicMenuFragment.this.handler = new Handler();
            DynamicMenuFragment.this.runnable = new Runnable() {
                @Override
                public final void run() {
                    DynamicMenuFragment.AnonymousClass7.this.m236lambda$onResponse$0$devgtrposfragmentDynamicMenuFragment$7();
                }
            };
            DynamicMenuFragment.this.handler.postDelayed(DynamicMenuFragment.this.runnable, 1000L);
        }

        void m236lambda$onResponse$0$devgtrposfragmentDynamicMenuFragment$7() {
            if (DynamicMenuFragment.this.textViewM.getVisibility() == 0) {
                DynamicMenuFragment dynamicMenuFragment = DynamicMenuFragment.this;
                dynamicMenuFragment.ViewInvisible(dynamicMenuFragment.textViewM);
                DynamicMenuFragment dynamicMenuFragment2 = DynamicMenuFragment.this;
                dynamicMenuFragment2.ViewInvisible(dynamicMenuFragment2.buttonMsgTitle);
                DynamicMenuFragment.this.handler.postDelayed(DynamicMenuFragment.this.runnable, 1000L);
                return;
            }
            if (DynamicMenuFragment.this.slide >= 0) {
                String txtOne = DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtOne();
                String txtTwo = DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtTwo();
                String txtThree = DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtThree();
                if (DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtOneColor() != null && !DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtOneColor().isEmpty() && DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettOneSize() != null && !DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettOneSize().isEmpty()) {
                    SpannableString spannableString = new SpannableString(txtOne);
                    spannableString.setSpan(new AbsoluteSizeSpan(Integer.parseInt(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettOneSize()), true), 0, txtOne.length(), 18);
                    spannableString.setSpan(new ForegroundColorSpan(Color.parseColor(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtOneColor())), 0, txtOne.length(), 33);
                    DynamicMenuFragment.this.textViewM.append(spannableString);
                    DynamicMenuFragment.this.textViewM.append("\n");
                } else if (txtOne != null && !txtOne.isEmpty()) {
                    DynamicMenuFragment.this.textViewM.append(txtOne);
                    DynamicMenuFragment.this.textViewM.append("\n");
                }
                if (DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettTwoSize() != null && !DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettTwoSize().isEmpty() && DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtTwoColor() != null && !DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtTwoColor().isEmpty()) {
                    SpannableString spannableString2 = new SpannableString(txtTwo);
                    spannableString2.setSpan(new AbsoluteSizeSpan(Integer.parseInt(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettTwoSize()), true), 0, txtTwo.length(), 18);
                    spannableString2.setSpan(new ForegroundColorSpan(Color.parseColor(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtTwoColor())), 0, txtTwo.length(), 33);
                    DynamicMenuFragment.this.textViewM.append(spannableString2);
                    DynamicMenuFragment.this.textViewM.append("\n");
                } else if (txtTwo != null && !txtTwo.isEmpty()) {
                    DynamicMenuFragment.this.textViewM.append(txtTwo);
                    DynamicMenuFragment.this.textViewM.append("\n");
                }
                if (DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettThreeSize() != null && !DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettThreeSize().isEmpty() && DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtThreeColor() != null && !DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtThreeColor().isEmpty()) {
                    SpannableString spannableString3 = new SpannableString(txtThree);
                    spannableString3.setSpan(new AbsoluteSizeSpan(Integer.parseInt(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettThreeSize()), true), 0, txtThree.length(), 18);
                    spannableString3.setSpan(new ForegroundColorSpan(Color.parseColor(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getTxtThreeColor())), 0, txtThree.length(), 33);
                    DynamicMenuFragment.this.textViewM.append(spannableString3);
                } else if (txtThree != null && !txtThree.isEmpty()) {
                    DynamicMenuFragment.this.textViewM.append(txtThree);
                }
                if (DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getType() != null && !DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getType().isEmpty()) {
                    DynamicMenuFragment.this.buttonMsgTitle.setText(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).getType());
                }
                if (!DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettSize().isEmpty() && DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettSize() != null) {
                    DynamicMenuFragment.this.buttonMsgTitle.setTextSize(Integer.parseInt(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettSize()));
                }
                if (!DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettColor().isEmpty() && DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettColor() != null) {
                    DynamicMenuFragment.this.buttonMsgTitle.setBackgroundColor(Color.parseColor(DynamicMenuFragment.this.msg.get(DynamicMenuFragment.this.slide).gettColor()));
                }
                DynamicMenuFragment.this.slide--;
                DynamicMenuFragment dynamicMenuFragment3 = DynamicMenuFragment.this;
                dynamicMenuFragment3.ViewVisible(dynamicMenuFragment3.textViewM);
                DynamicMenuFragment dynamicMenuFragment4 = DynamicMenuFragment.this;
                dynamicMenuFragment4.ViewVisible(dynamicMenuFragment4.buttonMsgTitle);
                DynamicMenuFragment.this.handler.postDelayed(DynamicMenuFragment.this.runnable, 6000L);
                return;
            }
            if (DynamicMenuFragment.this.slide == -1) {
                DynamicMenuFragment dynamicMenuFragment5 = DynamicMenuFragment.this;
                dynamicMenuFragment5.slide = dynamicMenuFragment5.msg.size() - 1;
                DynamicMenuFragment.this.handler.postDelayed(DynamicMenuFragment.this.runnable, 500L);
            }
        }
    }

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

    public void onResume() {
        if (this.handler != null && getActivity() != null) {
            this.handler.removeCallbacks(this.runnable);
            this.handler = new Handler();
            this.runnable = null;
            getTextMesg();
        }
        String string = this.sharedPreferences.getString("IN_BROWSER", "0");
        this.openInBrowser = string;
        Log.e("ccc", string);
        super.onResume();
    }

    public void ViewVisible(View view) {
        Slide slide = new Slide(80);
        slide.setDuration(1000L);
        slide.addTarget(view);
        try {
            TransitionManager.beginDelayedTransition(this.constraintLayoutAnim, slide);
            this.textViewM.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in));
            view.setVisibility(0);
        } catch (Exception unused) {
        }
    }

    public void ViewInvisible(View view) {
        Slide slide = new Slide(48);
        slide.setDuration(1000L);
        slide.addTarget(view);
        try {
            Animation loadAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.slide_out);
            this.textViewM.startAnimation(loadAnimation);
            loadAnimation.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    DynamicMenuFragment.this.textViewM.setText("");
                    DynamicMenuFragment.this.buttonMsgTitle.setText("");
                }
            });
            TransitionManager.beginDelayedTransition(this.constraintLayoutAnim, slide);
            view.setVisibility(4);
        } catch (Exception unused) {
        }
    }

    public void getLonLog(int i) {
        boolean isLocationEnabled;
        if (ActivityCompat.checkSelfPermission(getActivity(), "android.permission.ACCESS_FINE_LOCATION") != 0 && ActivityCompat.checkSelfPermission(getActivity(), "android.permission.ACCESS_COARSE_LOCATION") != 0) {
            ActivityCompat.requestPermissions(getActivity(), new String[]{"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"}, 1);
            return;
        }
        if (Build.VERSION.SDK_INT >= 28) {
            isLocationEnabled = this.lm.isLocationEnabled();
            if (isLocationEnabled) {
                this.lm.requestLocationUpdates("network", 0L, 0.0f, this.locationListener);
                if (i != 1) {
                    this.fromAtt = true;
                    this.alertDialogLoc.show();
                    return;
                }
                return;
            }
            Toasty.warning((Context) getActivity(), (CharSequence) "Please Turned On Location", 0).show();
        }
    }

    private void getWareHouses() {
        ApiClient.getInstance(getActivity()).getApi().getWareHouses("Bearer " + Constant.Token).enqueue(new Callback<List<CategoryUnitList>>() {
            @Override
            public void onFailure(Call<List<CategoryUnitList>> call, Throwable th) {
            }

            @Override
            public void onResponse(Call<List<CategoryUnitList>> call, Response<List<CategoryUnitList>> response) {
                if (response.isSuccessful()) {
                    DynamicMenuFragment.this.cookies = response.headers().values("set-Cookie");
                    DynamicMenuFragment.this.warehouse.add(new CategoryUnitList("0", "------- All --------"));
                    for (CategoryUnitList categoryUnitList : response.body()) {
                        DynamicMenuFragment.this.warehouse.add(new CategoryUnitList(categoryUnitList.getValue(), categoryUnitList.getText()));
                    }
                }
            }
        });
    }

    private void getEmployee() {
        ApiClient.getInstance(getActivity()).getApi().getEmployeeDropDown("Bearer " + Constant.Token).enqueue(new Callback<List<EmployeeDropDown>>() {
            @Override
            public void onFailure(Call<List<EmployeeDropDown>> call, Throwable th) {
            }

            @Override
            public void onResponse(Call<List<EmployeeDropDown>> call, Response<List<EmployeeDropDown>> response) {
                if (response.isSuccessful()) {
                    DynamicMenuFragment.this.cookies = response.headers().values("set-Cookie");
                    DynamicMenuFragment.this.employee = (ArrayList) response.body();
                    return;
                }
                Log.e("EMP", "" + response.code());
            }
        });
    }

    public void ShowDate(DatePickerDialog.OnDateSetListener onDateSetListener) {
        Calendar calendar = Calendar.getInstance();
        DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.customsDate, onDateSetListener, calendar.get(1), calendar.get(2), calendar.get(5));
        datePickerDialog.show();
        datePickerDialog.getButton(-2).setTextColor(getResources().getColor(R.color.black_mart));
        datePickerDialog.getButton(-1).setTextColor(getResources().getColor(R.color.black_mart));
    }
}