导航菜单

页面标题

页面副标题

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

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

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


package com.mcb.stjohnsemschool.utils;

import android.R;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Environment;
import android.provider.Settings;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TableRow;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.an.biometric.BiometricManager$;
import com.chinalwb.are.AREditText;
import com.chinalwb.are.styles.toolbar.IARE_Toolbar;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_AlignmentCenter;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_AlignmentLeft;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_AlignmentRight;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_At;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_BackgroundColor;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Bold;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_FontColor;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_FontSize;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Hr;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Image;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Italic;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Link;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_ListBullet;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_ListNumber;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Quote;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Strikethrough;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Subscript;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Superscript;
import com.chinalwb.are.styles.toolitems.ARE_ToolItem_Underline;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.LocationSettingsResult;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.mcb.stjohnsemschool.model.NotificationChannelModel;
import com.mcb.stjohnsemschool.model.SchoolStoreBeltSizesModel;
import com.mcb.stjohnsemschool.model.SchoolStoreItemsCatsModelClass;
import com.mcb.stjohnsemschool.model.SchoolStoreItemsModelClass;
import com.mcb.stjohnsemschool.model.SchoolStoreKitCatVendorsModelClass;
import com.mcb.stjohnsemschool.model.SchoolStorePantSizesModel;
import com.mcb.stjohnsemschool.model.SchoolStorePinosSizesModel;
import com.mcb.stjohnsemschool.model.SchoolStoreShirtSizesModel;
import com.mcb.stjohnsemschool.model.SchoolStoreShoeSizeTypeModel;
import com.mcb.stjohnsemschool.model.SchoolStoreShoeSizesModel;
import com.mcb.stjohnsemschool.model.SchoolStoreSkirtSizesModel;
import com.mcb.stjohnsemschool.services.ApiClient;
import com.mcb.stjohnsemschool.services.ApiInterface;
import com.microsoft.identity.client.internal.MsalUtils;
import com.microsoft.identity.common.java.eststelemetry.SchemaConstants;
import io.ably.lib.realtime.AblyRealtime;
import io.ably.lib.types.AblyException;
import io.ably.lib.types.ClientOptions;
import io.ably.lib.util.AgentHeaderCreator;
import java.io.File;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class Utility {
    public static String getSchoolApiKey(Context context) {
        return getSharedPrefs(context).getString(Constants.SCHOOL_API_KEY, "");
    }

    public static String currencyFormat(Context context, double d) {
        return new DecimalFormat("###.##").format(d);
    }

    public static String getStorageDir(Context context) {
        String str = null;
        File[] externalFilesDirs = context.getExternalFilesDirs(null);
        if (externalFilesDirs != null && externalFilesDirs.length > 0) {
            str = context.getExternalFilesDirs(null)[0].getAbsolutePath();
        }
        if (str == null) {
            str = Environment.getExternalStorageDirectory().getAbsolutePath();
        }
        return str == null ? "" : str;
    }

    public static String getDownloadStorageDir(Context context) {
        File externalStoragePublicDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
        String absolutePath = externalStoragePublicDirectory != null ? externalStoragePublicDirectory.getAbsolutePath() : null;
        if (absolutePath == null) {
            absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath();
        }
        return absolutePath == null ? "" : absolutePath;
    }

    public static void locationChecker(GoogleApiClient googleApiClient, final Activity activity) {
        LocationRequest create = LocationRequest.create();
        create.setPriority(100);
        create.setInterval(30000L);
        create.setFastestInterval(5000L);
        LocationSettingsRequest.Builder addLocationRequest = new LocationSettingsRequest.Builder().addLocationRequest(create);
        addLocationRequest.setAlwaysShow(true);
        LocationServices.SettingsApi.checkLocationSettings(googleApiClient, addLocationRequest.build()).setResultCallback(new ResultCallback<LocationSettingsResult>() {
            public void onResult(LocationSettingsResult locationSettingsResult) {
                Status status = locationSettingsResult.getStatus();
                locationSettingsResult.getLocationSettingsStates();
                if (status.getStatusCode() != 6) {
                    return;
                }
                try {
                    status.startResolutionForResult(activity, 1000);
                } catch (IntentSender.SendIntentException unused) {
                }
            }
        });
    }

    public static ARE_ToolItem_Image initToolbar(IARE_Toolbar iARE_Toolbar, AREditText aREditText, boolean z) {
        ARE_ToolItem_Bold aRE_ToolItem_Bold = new ARE_ToolItem_Bold();
        ARE_ToolItem_Italic aRE_ToolItem_Italic = new ARE_ToolItem_Italic();
        ARE_ToolItem_Underline aRE_ToolItem_Underline = new ARE_ToolItem_Underline();
        ARE_ToolItem_Strikethrough aRE_ToolItem_Strikethrough = new ARE_ToolItem_Strikethrough();
        ARE_ToolItem_FontSize aRE_ToolItem_FontSize = new ARE_ToolItem_FontSize();
        ARE_ToolItem_FontColor aRE_ToolItem_FontColor = new ARE_ToolItem_FontColor();
        ARE_ToolItem_BackgroundColor aRE_ToolItem_BackgroundColor = new ARE_ToolItem_BackgroundColor();
        ARE_ToolItem_Quote aRE_ToolItem_Quote = new ARE_ToolItem_Quote();
        ARE_ToolItem_ListNumber aRE_ToolItem_ListNumber = new ARE_ToolItem_ListNumber();
        ARE_ToolItem_ListBullet aRE_ToolItem_ListBullet = new ARE_ToolItem_ListBullet();
        ARE_ToolItem_Hr aRE_ToolItem_Hr = new ARE_ToolItem_Hr();
        ARE_ToolItem_Link aRE_ToolItem_Link = new ARE_ToolItem_Link();
        ARE_ToolItem_Subscript aRE_ToolItem_Subscript = new ARE_ToolItem_Subscript();
        ARE_ToolItem_Superscript aRE_ToolItem_Superscript = new ARE_ToolItem_Superscript();
        ARE_ToolItem_AlignmentLeft aRE_ToolItem_AlignmentLeft = new ARE_ToolItem_AlignmentLeft();
        ARE_ToolItem_AlignmentCenter aRE_ToolItem_AlignmentCenter = new ARE_ToolItem_AlignmentCenter();
        ARE_ToolItem_AlignmentRight aRE_ToolItem_AlignmentRight = new ARE_ToolItem_AlignmentRight();
        ARE_ToolItem_Image aRE_ToolItem_Image = new ARE_ToolItem_Image();
        ARE_ToolItem_At aRE_ToolItem_At = new ARE_ToolItem_At();
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Bold);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Italic);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Underline);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Strikethrough);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_FontSize);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_FontColor);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_BackgroundColor);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Quote);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_ListNumber);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_ListBullet);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Hr);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Link);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Subscript);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_Superscript);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_AlignmentLeft);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_AlignmentCenter);
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_AlignmentRight);
        if (!z) {
            iARE_Toolbar.addToolbarItem(aRE_ToolItem_Image);
        }
        iARE_Toolbar.addToolbarItem(aRE_ToolItem_At);
        aREditText.setToolbar(iARE_Toolbar);
        aREditText.setImageStrategy(new UploadFileToCDN());
        return aRE_ToolItem_Image;
    }

    public static Spanned fromHtml(String str) {
        if (Build.VERSION.SDK_INT >= 24) {
            return BiometricManager$.ExternalSyntheticApiModelOutline0.m(str, 0);
        }
        return Html.fromHtml(str);
    }

    public static int getColor(Context context, int i) {
        if (Build.VERSION.SDK_INT >= 23) {
            return BiometricManager$.ExternalSyntheticApiModelOutline0.m(context.getResources(), i, context.getTheme());
        }
        return context.getResources().getColor(i);
    }

    public static void setCursorColor(EditText editText, int i) {
        try {
            Field declaredField = TextView.class.getDeclaredField("mCursorDrawableRes");
            declaredField.setAccessible(true);
            declaredField.set(editText, 2131230965);
        } catch (Exception unused) {
        }
    }

    public static void setTextViewText(TextView textView, String str) {
        String[] split = str.split(" ");
        StringBuilder sb = new StringBuilder();
        for (String str2 : split) {
            if (str2.length() > 1) {
                str2 = str2.substring(0, 1).toUpperCase() + str2.substring(1).toLowerCase();
            }
            sb.append(str2 + " ");
        }
        textView.setText(sb.toString());
    }

    public static boolean hasNetworkConnection(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isAvailable() && connectivityManager.getActiveNetworkInfo().isConnected();
    }

    public static void showAlertDialog(final Activity activity) {
        try {
            final Dialog dialog = new Dialog(activity);
            dialog.requestWindowFeature(1);
            dialog.setContentView(2131558995);
            dialog.setCancelable(true);
            ((TextView) dialog.findViewById(2131364252)).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    dialog.dismiss();
                    activity.finish();
                }
            });
            dialog.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void showInfoDialog(Activity activity, String str) {
        new AlertDialog.Builder(activity).setMessage(str).setCancelable(false).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.cancel();
            }
        }).setIcon(R.drawable.ic_dialog_alert).show();
    }

    public static void updateCartCount(ArrayList<SchoolStoreItemsCatsModelClass> arrayList, TextView textView) {
        Iterator<SchoolStoreItemsCatsModelClass> it = arrayList.iterator();
        int i = 0;
        while (it.hasNext()) {
            Iterator<SchoolStoreItemsModelClass> it2 = it.next().getSchoolStoreItems().iterator();
            while (it2.hasNext()) {
                SchoolStoreItemsModelClass next = it2.next();
                if (next.isSelected() || next.getIsEnableItemSelection() == 0) {
                    i++;
                }
            }
        }
        textView.setText(String.valueOf(i));
    }

    public static SharedPreferences getSharedPrefs(Context context) {
        return context.getSharedPreferences("", 0);
    }

    public static void updateCatVendorCartCount(ArrayList<SchoolStoreKitCatVendorsModelClass> arrayList, TextView textView) {
        Iterator<SchoolStoreKitCatVendorsModelClass> it = arrayList.iterator();
        int i = 0;
        while (it.hasNext()) {
            Iterator<SchoolStoreItemsModelClass> it2 = it.next().getSchoolStoreItems().iterator();
            while (it2.hasNext()) {
                SchoolStoreItemsModelClass next = it2.next();
                if (next.isSelected() || next.getIsEnableItemSelection() == 0) {
                    i++;
                }
            }
        }
        textView.setText(String.valueOf(i));
    }

    public static void showShirtSizeChart(Context context, ArrayList<SchoolStoreShirtSizesModel> arrayList, LinearLayout linearLayout, TextView textView, Dialog dialog) {
        if (arrayList.size() > 0) {
            LinearLayout linearLayout2 = new LinearLayout(context);
            linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 4.0f));
            linearLayout2.setGravity(16);
            TextView headerElementTextView = getHeaderElementTextView(context, "Size", 1.0f);
            TextView headerElementTextView2 = getHeaderElementTextView(context, "Chest (in)", 1.0f);
            TextView headerElementTextView3 = getHeaderElementTextView(context, "Front Length (in)", 1.0f);
            TextView headerElementTextView4 = getHeaderElementTextView(context, "Across Shoulder (in)", 1.0f);
            linearLayout2.addView(headerElementTextView);
            linearLayout2.addView(headerElementTextView2);
            linearLayout2.addView(headerElementTextView3);
            linearLayout2.addView(headerElementTextView4);
            linearLayout.addView(linearLayout2);
            Iterator<SchoolStoreShirtSizesModel> it = arrayList.iterator();
            while (it.hasNext()) {
                SchoolStoreShirtSizesModel next = it.next();
                LinearLayout linearLayout3 = new LinearLayout(context);
                linearLayout3.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 4.0f));
                linearLayout3.setGravity(16);
                TextView elementTextView = getElementTextView(context, next.getSize(), 1.0f);
                TextView elementTextView2 = getElementTextView(context, String.valueOf(next.getChestInch()), 1.0f);
                TextView elementTextView3 = getElementTextView(context, String.valueOf(next.getFrontLengthInch()), 1.0f);
                TextView elementTextView4 = getElementTextView(context, String.valueOf(next.getAcrossShoulderInch()), 1.0f);
                linearLayout3.addView(elementTextView);
                linearLayout3.addView(elementTextView2);
                linearLayout3.addView(elementTextView3);
                linearLayout3.addView(elementTextView4);
                linearLayout.addView(linearLayout3);
            }
            linearLayout.setVisibility(0);
            textView.setVisibility(8);
        } else {
            linearLayout.setVisibility(8);
            textView.setVisibility(0);
        }
        if (dialog == null || dialog.isShowing()) {
            return;
        }
        dialog.show();
    }

    public static void showPantSizeChart(Context context, ArrayList<SchoolStorePantSizesModel> arrayList, LinearLayout linearLayout, TextView textView, Dialog dialog) {
        if (arrayList.size() > 0) {
            LinearLayout linearLayout2 = new LinearLayout(context);
            linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 3.0f));
            linearLayout2.setGravity(16);
            TextView headerElementTextView = getHeaderElementTextView(context, "Size", 1.0f);
            TextView headerElementTextView2 = getHeaderElementTextView(context, "To Fit Waist (in)", 1.0f);
            TextView headerElementTextView3 = getHeaderElementTextView(context, "Inseam Length (in)", 1.0f);
            linearLayout2.addView(headerElementTextView);
            linearLayout2.addView(headerElementTextView2);
            linearLayout2.addView(headerElementTextView3);
            linearLayout.addView(linearLayout2);
            Iterator<SchoolStorePantSizesModel> it = arrayList.iterator();
            while (it.hasNext()) {
                SchoolStorePantSizesModel next = it.next();
                LinearLayout linearLayout3 = new LinearLayout(context);
                linearLayout3.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 3.0f));
                linearLayout3.setGravity(16);
                TextView elementTextView = getElementTextView(context, next.getSize(), 1.0f);
                TextView elementTextView2 = getElementTextView(context, String.valueOf(next.getWaistInch()), 1.0f);
                TextView elementTextView3 = getElementTextView(context, String.valueOf(next.getInseamLengthInch()), 1.0f);
                linearLayout3.addView(elementTextView);
                linearLayout3.addView(elementTextView2);
                linearLayout3.addView(elementTextView3);
                linearLayout.addView(linearLayout3);
            }
            linearLayout.setVisibility(0);
            textView.setVisibility(8);
        } else {
            linearLayout.setVisibility(8);
            textView.setVisibility(0);
        }
        if (dialog == null || dialog.isShowing()) {
            return;
        }
        dialog.show();
    }

    public static void showShoeSizeChart(Context context, ArrayList<SchoolStoreShoeSizeTypeModel> arrayList, LinearLayout linearLayout, TextView textView, Dialog dialog) {
        if (arrayList.size() > 0) {
            Iterator<SchoolStoreShoeSizeTypeModel> it = arrayList.iterator();
            while (it.hasNext()) {
                SchoolStoreShoeSizeTypeModel next = it.next();
                View typeHeaderElementTextView = getTypeHeaderElementTextView(context, next.getType());
                LinearLayout linearLayout2 = new LinearLayout(context);
                linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 2.0f));
                linearLayout2.setGravity(16);
                TextView headerElementTextView = getHeaderElementTextView(context, "Size", 1.0f);
                TextView headerElementTextView2 = getHeaderElementTextView(context, "To Fit Foot Length (Inches)", 1.0f);
                linearLayout2.addView(headerElementTextView);
                linearLayout2.addView(headerElementTextView2);
                linearLayout.addView(typeHeaderElementTextView);
                linearLayout.addView(linearLayout2);
                Iterator<SchoolStoreShoeSizesModel> it2 = next.getShoeSizes().iterator();
                while (it2.hasNext()) {
                    SchoolStoreShoeSizesModel next2 = it2.next();
                    String ukSize = next2.getUkSize();
                    LinearLayout linearLayout3 = new LinearLayout(context);
                    linearLayout3.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 2.0f));
                    linearLayout3.setGravity(16);
                    TextView elementTextView = getElementTextView(context, ukSize, 1.0f);
                    TextView elementTextView2 = getElementTextView(context, String.valueOf(next2.getFootLengthInch()), 1.0f);
                    linearLayout3.addView(elementTextView);
                    linearLayout3.addView(elementTextView2);
                    linearLayout.addView(linearLayout3);
                }
                View view = new View(context);
                view.setLayoutParams(new LinearLayout.LayoutParams(-1, 1));
                view.setPadding(5, 5, 5, 5);
                view.setBackgroundColor(context.getResources().getColor(2131099845));
                linearLayout.addView(view);
            }
            linearLayout.setVisibility(0);
            textView.setVisibility(8);
        } else {
            linearLayout.setVisibility(8);
            textView.setVisibility(0);
        }
        if (dialog == null || dialog.isShowing()) {
            return;
        }
        dialog.show();
    }

    public static void showSkirtSizeChart(Context context, ArrayList<SchoolStoreSkirtSizesModel> arrayList, LinearLayout linearLayout, TextView textView, Dialog dialog) {
        if (arrayList.size() > 0) {
            LinearLayout linearLayout2 = new LinearLayout(context);
            linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 4.0f));
            linearLayout2.setGravity(16);
            TextView headerElementTextView = getHeaderElementTextView(context, "Size", 1.0f);
            TextView headerElementTextView2 = getHeaderElementTextView(context, "Brand Size", 1.0f);
            TextView headerElementTextView3 = getHeaderElementTextView(context, "Skirt Length (in)", 1.0f);
            TextView headerElementTextView4 = getHeaderElementTextView(context, "To Fit Waist (in)", 1.0f);
            linearLayout2.addView(headerElementTextView);
            linearLayout2.addView(headerElementTextView2);
            linearLayout2.addView(headerElementTextView3);
            linearLayout2.addView(headerElementTextView4);
            linearLayout.addView(linearLayout2);
            Iterator<SchoolStoreSkirtSizesModel> it = arrayList.iterator();
            while (it.hasNext()) {
                SchoolStoreSkirtSizesModel next = it.next();
                LinearLayout linearLayout3 = new LinearLayout(context);
                linearLayout3.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 4.0f));
                linearLayout3.setGravity(16);
                TextView elementTextView = getElementTextView(context, next.getSize(), 1.0f);
                TextView elementTextView2 = getElementTextView(context, next.getBrandSize(), 1.0f);
                TextView elementTextView3 = getElementTextView(context, String.valueOf(next.getSkirtLengthInch()), 1.0f);
                TextView elementTextView4 = getElementTextView(context, String.valueOf(next.getWaistInch()), 1.0f);
                linearLayout3.addView(elementTextView);
                linearLayout3.addView(elementTextView2);
                linearLayout3.addView(elementTextView3);
                linearLayout3.addView(elementTextView4);
                linearLayout.addView(linearLayout3);
            }
            linearLayout.setVisibility(0);
            textView.setVisibility(8);
        } else {
            linearLayout.setVisibility(8);
            textView.setVisibility(0);
        }
        if (dialog == null || dialog.isShowing()) {
            return;
        }
        dialog.show();
    }

    public static void showBeltSizeChart(Context context, ArrayList<SchoolStoreBeltSizesModel> arrayList, LinearLayout linearLayout, TextView textView, Dialog dialog) {
        if (arrayList.size() > 0) {
            LinearLayout linearLayout2 = new LinearLayout(context);
            linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 3.0f));
            linearLayout2.setGravity(16);
            TextView headerElementTextView = getHeaderElementTextView(context, "Size", 1.0f);
            TextView headerElementTextView2 = getHeaderElementTextView(context, "Brand Size", 1.0f);
            linearLayout2.addView(headerElementTextView);
            linearLayout2.addView(headerElementTextView2);
            linearLayout.addView(linearLayout2);
            Iterator<SchoolStoreBeltSizesModel> it = arrayList.iterator();
            while (it.hasNext()) {
                SchoolStoreBeltSizesModel next = it.next();
                LinearLayout linearLayout3 = new LinearLayout(context);
                linearLayout3.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 3.0f));
                linearLayout3.setGravity(16);
                TextView elementTextView = getElementTextView(context, next.getSize(), 1.0f);
                TextView elementTextView2 = getElementTextView(context, next.getBrandSize(), 1.0f);
                linearLayout3.addView(elementTextView);
                linearLayout3.addView(elementTextView2);
                linearLayout.addView(linearLayout3);
            }
            linearLayout.setVisibility(0);
            textView.setVisibility(8);
        } else {
            linearLayout.setVisibility(8);
            textView.setVisibility(0);
        }
        if (dialog == null || dialog.isShowing()) {
            return;
        }
        dialog.show();
    }

    public static void showPinosSizeChart(Context context, ArrayList<SchoolStorePinosSizesModel> arrayList, LinearLayout linearLayout, TextView textView, Dialog dialog) {
        if (arrayList.size() > 0) {
            LinearLayout linearLayout2 = new LinearLayout(context);
            linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 5.0f));
            int i = 16;
            linearLayout2.setGravity(16);
            TextView headerElementTextView = getHeaderElementTextView(context, "Size", 1.0f);
            TextView headerElementTextView2 = getHeaderElementTextView(context, "Brand Size", 1.0f);
            TextView headerElementTextView3 = getHeaderElementTextView(context, "To Fit Bust (in)", 1.0f);
            TextView headerElementTextView4 = getHeaderElementTextView(context, "To Fit Waist (in)", 1.0f);
            TextView headerElementTextView5 = getHeaderElementTextView(context, "To Fit Hip (in)", 1.0f);
            linearLayout2.addView(headerElementTextView);
            linearLayout2.addView(headerElementTextView2);
            linearLayout2.addView(headerElementTextView3);
            linearLayout2.addView(headerElementTextView4);
            linearLayout2.addView(headerElementTextView5);
            linearLayout.addView(linearLayout2);
            Iterator<SchoolStorePinosSizesModel> it = arrayList.iterator();
            while (it.hasNext()) {
                SchoolStorePinosSizesModel next = it.next();
                LinearLayout linearLayout3 = new LinearLayout(context);
                linearLayout3.setLayoutParams(new LinearLayout.LayoutParams(-1, -2, 5.0f));
                linearLayout3.setGravity(i);
                TextView elementTextView = getElementTextView(context, next.getSize(), 1.0f);
                TextView elementTextView2 = getElementTextView(context, next.getBrandSize(), 1.0f);
                TextView elementTextView3 = getElementTextView(context, String.valueOf(next.getBustInch()), 1.0f);
                TextView elementTextView4 = getElementTextView(context, String.valueOf(next.getWaistInch()), 1.0f);
                TextView elementTextView5 = getElementTextView(context, String.valueOf(next.getHipInch()), 1.0f);
                linearLayout3.addView(elementTextView);
                linearLayout3.addView(elementTextView2);
                linearLayout3.addView(elementTextView3);
                linearLayout3.addView(elementTextView4);
                linearLayout3.addView(elementTextView5);
                linearLayout.addView(linearLayout3);
                i = 16;
            }
            linearLayout.setVisibility(0);
            textView.setVisibility(8);
        } else {
            linearLayout.setVisibility(8);
            textView.setVisibility(0);
        }
        if (dialog == null || dialog.isShowing()) {
            return;
        }
        dialog.show();
    }

    static TextView getTypeHeaderElementTextView(Context context, String str) {
        Typeface fontStyle = getFontStyle(context);
        TextView textView = new TextView(context);
        textView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
        textView.setText(str);
        textView.setTextSize(18.0f);
        textView.setTextColor(context.getResources().getColor(2131100860));
        textView.setTypeface(fontStyle, 1);
        textView.setGravity(17);
        textView.setPadding(20, 10, 10, 10);
        textView.setBackgroundColor(context.getResources().getColor(2131099650));
        return textView;
    }

    static TextView getHeaderElementTextView(Context context, String str, float f) {
        Typeface fontStyle = getFontStyle(context);
        TextView textView = new TextView(context);
        textView.setLayoutParams(new LinearLayout.LayoutParams(0, -2, f));
        textView.setText(str);
        textView.setTextSize(14.0f);
        textView.setTextColor(context.getResources().getColor(2131099707));
        textView.setTypeface(fontStyle, 1);
        textView.setGravity(17);
        textView.setPadding(10, 10, 10, 10);
        return textView;
    }

    static TextView getElementTextView(Context context, String str, float f) {
        Typeface fontStyle = getFontStyle(context);
        TextView textView = new TextView(context);
        textView.setLayoutParams(new TableRow.LayoutParams(0, -2, f));
        textView.setText(str);
        textView.setTextSize(14.0f);
        textView.setTextColor(context.getResources().getColor(2131099761));
        textView.setTypeface(fontStyle);
        textView.setGravity(17);
        textView.setPadding(10, 10, 10, 10);
        return textView;
    }

    public static Typeface getFontStyle(Context context) {
        return Typeface.createFromAsset(context.getAssets(), "Roboto-Regular.ttf");
    }

    public static String formURL(Context context, String str) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        String string = sharedPreferences.getString("usernamekey", "");
        String string2 = sharedPreferences.getString("passwordkey", "");
        String string3 = sharedPreferences.getString("OrganisationNameKey", "");
        String string4 = sharedPreferences.getString("orgnizationIdKey", "");
        String string5 = sharedPreferences.getString("BranchGUID", "");
        String string6 = sharedPreferences.getString("OrgGUID", "");
        String string7 = sharedPreferences.getString("StudentGUID", "");
        String string8 = context.getString(2131886483);
        return str.replace("@UNAME", string).replace("@PWD", string2).replace("@SERVICEURL", string8).replace("@ORGNAME", string3).replace("@ORGID", string4).replace("@BGUID", string5).replace("@ORGGUID", string6).replace("@STUGUID", string7).replace("@WEBURL", context.getString(2131886432));
    }

    public static String maskPhoneNo(String str) {
        int length = str.length();
        String str2 = "";
        int i = 0;
        while (true) {
            int i2 = length - 3;
            if (i < i2) {
                str2 = str2 + "X";
                i++;
            } else {
                return str2 + str.substring(i2);
            }
        }
    }

    public static String maskEmail(String str) {
        if (!str.contains("@")) {
            return str;
        }
        String[] split = str.split("@");
        int length = split[0].length();
        if (length <= 2) {
            return str;
        }
        String str2 = "" + str.substring(0, 2);
        for (int i = 2; i < length; i++) {
            str2 = str2 + "X";
        }
        if (split.length <= 1) {
            return str2;
        }
        return str2 + "@" + split[1];
    }

    public static String getThumbnailFromYoutubeURL(String str) {
        return "https://img.youtube.com/vi/" + getVideoIDFromYoutubeURL(str) + "/default.jpg";
    }

    public static String getVideoIDFromYoutubeURL(String str) {
        String str2 = "";
        try {
            if (str.contains("v=")) {
                String[] split = str.split("v=");
                if (split.length > 1) {
                    str2 = split[1];
                }
            } else if (str.startsWith("https://youtu.be/")) {
                str2 = str.substring(17);
            } else if (str.startsWith("https://www.youtube.com/embed/")) {
                str2 = str.substring(30);
            } else if (str.startsWith("http://www.youtube.com/user/IngridMichaelsonVEVO#p/a/u/1/")) {
                str2 = str.substring(57);
            } else if (str.startsWith("http://www.youtube.com/v/")) {
                str2 = str.substring(25);
            }
            if (str2.contains(MsalUtils.QUERY_STRING_DELIMITER)) {
                str2 = str2.substring(0, str2.indexOf(MsalUtils.QUERY_STRING_DELIMITER));
            }
            if (str2.contains("#")) {
                str2 = str2.substring(0, str2.indexOf("#"));
            }
            return str2.contains(MsalUtils.QUERY_STRING_SYMBOL) ? str2.substring(0, str2.indexOf(MsalUtils.QUERY_STRING_SYMBOL)) : str2;
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    public static boolean isStringHasValue(String str) {
        return (str == null || str.length() <= 0 || str.equalsIgnoreCase("null")) ? false : true;
    }

    public static String getDeviceId(Context context) {
        String string = Settings.Secure.getString(context.getContentResolver(), "android_id");
        String str = Build.SERIAL;
        if (string != null) {
            return "02" + string;
        }
        if (str == null) {
            return null;
        }
        return "03" + str;
    }

    public static void subscribeFirebaseTopicName(final Context context, Activity activity, final int i, ArrayList<NotificationChannelModel> arrayList) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        sharedPreferences.getBoolean(Constants.ABLY_ACTIVATED, false);
        sharedPreferences.getString(Constants.ABLY_API_KEY, "");
        String string = context.getResources().getString(2131886199);
        String string2 = sharedPreferences.getString("OrganisationNameKey", "");
        final String string3 = sharedPreferences.getString("usernamekey", "");
        String string4 = sharedPreferences.getString("passwordkey", "");
        sharedPreferences.getString(Constants.ABLY_DEVICE_ID, "");
        final String string5 = sharedPreferences.getString("UseridKey", SchemaConstants.Value.FALSE);
        final String string6 = sharedPreferences.getString("orgnizationIdKey", SchemaConstants.Value.FALSE);
        String string7 = sharedPreferences.getString(Constants.REGISTER_ID, "");
        String str = Build.MODEL;
        final String str2 = "Android," + Build.MANUFACTURER + "," + str;
        final String deviceId = getDeviceId(activity);
        final String packageName = context.getPackageName();
        String str3 = "DeviceToken: " + string7 + ", Url: " + string + ", School: " + string2 + ", Credentials: " + string3 + AgentHeaderCreator.AGENT_DIVIDER + string4;
        Iterator<NotificationChannelModel> it = arrayList.iterator();
        while (it.hasNext()) {
            final String channelName = it.next().getChannelName();
            final String str4 = str3;
            final String str5 = string7;
            FirebaseMessaging.getInstance().subscribeToTopic(channelName).addOnCompleteListener(new OnCompleteListener<Void>() {
                public void onComplete(Task<Void> task) {
                    if (!task.isSuccessful()) {
                        String str6 = "Subscribe Channel: " + channelName + ", " + str4;
                        if (Utility.hasNetworkConnection(context)) {
                            Context context2 = context;
                            Utility.sendExceptionMail(context2, "Subscribed", str6, context2.getString(2131886124));
                            return;
                        }
                        return;
                    }
                    if (Utility.hasNetworkConnection(context)) {
                        Context context3 = context;
                        String str7 = string3;
                        String str8 = string5;
                        int i2 = i;
                        String str9 = str5;
                        Utility.SaveSubscribedChannels(context3, str7, str8, i2, str9, deviceId, str2, str9, Integer.parseInt(string6), packageName, "", str2, channelName, "");
                    }
                }
            });
            str3 = str3;
            string7 = string7;
        }
    }

    public static void unsubscribeFirebaseTopicName(final Context context, Activity activity, final int i, ArrayList<NotificationChannelModel> arrayList) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        sharedPreferences.getBoolean(Constants.ABLY_ACTIVATED, false);
        sharedPreferences.getString(Constants.ABLY_API_KEY, "");
        String string = context.getResources().getString(2131886199);
        String string2 = sharedPreferences.getString("OrganisationNameKey", "");
        final String string3 = sharedPreferences.getString("usernamekey", "");
        String string4 = sharedPreferences.getString("passwordkey", "");
        sharedPreferences.getString(Constants.ABLY_DEVICE_ID, "");
        final String string5 = sharedPreferences.getString("UseridKey", SchemaConstants.Value.FALSE);
        final String string6 = sharedPreferences.getString("orgnizationIdKey", SchemaConstants.Value.FALSE);
        String string7 = sharedPreferences.getString(Constants.REGISTER_ID, "");
        String str = Build.MODEL;
        final String str2 = "Android," + Build.MANUFACTURER + "," + str;
        final String deviceId = getDeviceId(activity);
        final String packageName = context.getPackageName();
        String str3 = "DeviceToken: " + string7 + ", Url: " + string + ", School: " + string2 + ", Credentials: " + string3 + AgentHeaderCreator.AGENT_DIVIDER + string4;
        Iterator<NotificationChannelModel> it = arrayList.iterator();
        while (it.hasNext()) {
            final String channelName = it.next().getChannelName();
            final String str4 = str3;
            final String str5 = string7;
            FirebaseMessaging.getInstance().subscribeToTopic(channelName).addOnCompleteListener(new OnCompleteListener<Void>() {
                public void onComplete(Task<Void> task) {
                    if (!task.isSuccessful()) {
                        String str6 = "UnSubscribe Channel: " + channelName + ", " + str4;
                        if (Utility.hasNetworkConnection(context)) {
                            Context context2 = context;
                            Utility.sendExceptionMail(context2, "UnSubscribed", str6, context2.getString(2131886124));
                            return;
                        }
                        return;
                    }
                    if (Utility.hasNetworkConnection(context)) {
                        Context context3 = context;
                        String str7 = string3;
                        String str8 = string5;
                        int i2 = i;
                        String str9 = str5;
                        Utility.SaveSubscribedChannels(context3, str7, str8, i2, str9, deviceId, str2, str9, Integer.parseInt(string6), packageName, "", str2, channelName, "");
                    }
                }
            });
            str3 = str3;
            string7 = string7;
        }
    }

    public static void deactivateAbly(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        if (sharedPreferences.getBoolean(Constants.ABLY_ACTIVATED, false)) {
            String string = sharedPreferences.getString(Constants.ABLY_API_KEY, "");
            String string2 = context.getResources().getString(2131886199);
            String string3 = sharedPreferences.getString("OrganisationNameKey", "");
            String string4 = sharedPreferences.getString("usernamekey", "");
            String string5 = sharedPreferences.getString("passwordkey", "");
            String string6 = sharedPreferences.getString(Constants.ABLY_DEVICE_ID, "");
            String str = "AblyDeviceId: " + string6 + ", Url: " + string2 + ", School: " + string3 + ", Credentials: " + string4 + AgentHeaderCreator.AGENT_DIVIDER + string5;
            if (string != null) {
                try {
                    if (string.length() <= 0 || string6 == null || string6.length() <= 0) {
                        return;
                    }
                    ClientOptions clientOptions = new ClientOptions();
                    clientOptions.key = string;
                    clientOptions.clientId = Settings.Secure.getString(context.getContentResolver(), "android_id");
                    clientOptions.logLevel = 4;
                    clientOptions.queryTime = true;
                    AblyRealtime ablyRealtime = new AblyRealtime(clientOptions);
                    ablyRealtime.setAndroidContext(context);
                    ablyRealtime.push.deactivate();
                } catch (AblyException e) {
                    if (hasNetworkConnection(context)) {
                        sendExceptionMail(context, e.getMessage(), str, context.getString(2131886124));
                    }
                    e.printStackTrace();
                }
            }
        }
    }

    public static void LogoutStudent(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        String string = sharedPreferences.getString("UseridKey", SchemaConstants.Value.FALSE);
        String string2 = sharedPreferences.getString("studentEnrollmentIdKey", SchemaConstants.Value.FALSE);
        ((ApiInterface) ApiClient.getClient1(context).create(ApiInterface.class)).LogoutStudent(Integer.parseInt(string), Integer.parseInt(string2), sharedPreferences.getString(Constants.REGISTER_ID, SchemaConstants.Value.FALSE), getSchoolApiKey(context)).enqueue(new Callback<String>() {
            public void onFailure(Call<String> call, Throwable th) {
            }

            public void onResponse(Call<String> call, Response<String> response) {
            }
        });
    }

    public static void sendExceptionMail(Context context, String str, String str2, String str3) {
        if (str2.length() == 0) {
            SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
            String string = sharedPreferences.getString("OrganisationNameKey", "");
            String string2 = sharedPreferences.getString("usernamekey", "");
            String string3 = sharedPreferences.getString("passwordkey", "");
            str2 = context.getResources().getString(2131886199) + ": " + string2 + AgentHeaderCreator.AGENT_DIVIDER + string3 + ": " + string;
        }
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("ErrorMessage", str);
        hashMap.put("Paramas", str2);
        hashMap.put("PageName", str3);
        hashMap.put("apikey", getSchoolApiKey(context));
        ((ApiInterface) ApiClient.getClient1(context).create(ApiInterface.class)).SendExceptionMail(hashMap).enqueue(new Callback<String>() {
            public void onFailure(Call<String> call, Throwable th) {
            }

            public void onResponse(Call<String> call, Response<String> response) {
            }
        });
    }

    public static void SaveSubscribedChannels(Context context, String str, String str2, int i, String str3, String str4, String str5, String str6, int i2, String str7, String str8, String str9, String str10, String str11) {
        try {
            ((ApiInterface) ApiClient.getClient1(context).create(ApiInterface.class)).SaveSubscribedChannels(str, str2, i, str3, str4, str5, str6, i2, str7, str8, str9, str10, str11, getSchoolApiKey(context)).enqueue(new Callback<String>() {
                public void onResponse(Call<String> call, Response<String> response) {
                    Log.v("onResponse", String.valueOf(response.code()));
                }

                public void onFailure(Call<String> call, Throwable th) {
                    Log.v("onFailure", th.getMessage());
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void saveVideoViewLog(Context context, String str, int i, int i2, int i3, int i4) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        String string = sharedPreferences.getString("orgnizationIdKey", SchemaConstants.Value.FALSE);
        String string2 = sharedPreferences.getString("UseridKey", SchemaConstants.Value.FALSE);
        String string3 = sharedPreferences.getString("studentEnrollmentIdKey", SchemaConstants.Value.FALSE);
        String string4 = sharedPreferences.getString("ClassidKey", SchemaConstants.Value.FALSE);
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("UserID", string2);
        hashMap.put("StudentEnrollmentID", string3);
        hashMap.put("OrganisationID", string);
        hashMap.put("ClassID", string4);
        hashMap.put("ChapterID", String.valueOf(i));
        hashMap.put("TopicID", String.valueOf(i2));
        hashMap.put("SubjectGUID", str);
        hashMap.put("VideoLinkID", String.valueOf(i3));
        hashMap.put("IsEnd", String.valueOf(i4));
        hashMap.put("apikey", getSchoolApiKey(context));
        ((ApiInterface) ApiClient.getClient1(context).create(ApiInterface.class)).SaveVideoViewLog(hashMap).enqueue(new Callback<String>() {
            public void onResponse(Call<String> call, Response<String> response) {
                Log.d("SaveVideoViewLog", "onResponse");
            }

            public void onFailure(Call<String> call, Throwable th) {
                Log.d("SaveVideoViewLog", "onFailure");
            }
        });
    }

    public static void saveFileViewLog(Context context, String str, int i, int i2, int i3, int i4) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        String string = sharedPreferences.getString("orgnizationIdKey", SchemaConstants.Value.FALSE);
        String string2 = sharedPreferences.getString("UseridKey", SchemaConstants.Value.FALSE);
        String string3 = sharedPreferences.getString("studentEnrollmentIdKey", SchemaConstants.Value.FALSE);
        String string4 = sharedPreferences.getString("ClassidKey", SchemaConstants.Value.FALSE);
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("UserID", string2);
        hashMap.put("StudentEnrollmentID", string3);
        hashMap.put("OrganisationID", string);
        hashMap.put("ClassID", string4);
        hashMap.put("ChapterID", String.valueOf(i));
        hashMap.put("TopicID", String.valueOf(i2));
        hashMap.put("SubjectGUID", str);
        hashMap.put("SubjectFileID", String.valueOf(i3));
        hashMap.put("IsEnd", String.valueOf(i4));
        hashMap.put("apikey", getSchoolApiKey(context));
        ((ApiInterface) ApiClient.getClient1(context).create(ApiInterface.class)).SaveFileViewLog(hashMap).enqueue(new Callback<String>() {
            public void onResponse(Call<String> call, Response<String> response) {
                Log.d("SaveFileViewLog", "onResponse");
            }

            public void onFailure(Call<String> call, Throwable th) {
                Log.d("SaveFileViewLog", "onFailure");
            }
        });
    }

    public static void saveLinkViewLog(Context context, String str, int i, int i2, int i3, int i4) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        String string = sharedPreferences.getString("orgnizationIdKey", SchemaConstants.Value.FALSE);
        String string2 = sharedPreferences.getString("UseridKey", SchemaConstants.Value.FALSE);
        String string3 = sharedPreferences.getString("studentEnrollmentIdKey", SchemaConstants.Value.FALSE);
        String string4 = sharedPreferences.getString("ClassidKey", SchemaConstants.Value.FALSE);
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("UserID", string2);
        hashMap.put("StudentEnrollmentID", string3);
        hashMap.put("OrganisationID", string);
        hashMap.put("ClassID", string4);
        hashMap.put("ChapterID", String.valueOf(i));
        hashMap.put("TopicID", String.valueOf(i2));
        hashMap.put("SubjectGUID", str);
        hashMap.put("SubjectLinkID", String.valueOf(i3));
        hashMap.put("IsEnd", String.valueOf(i4));
        hashMap.put("apikey", getSchoolApiKey(context));
        ((ApiInterface) ApiClient.getClient1(context).create(ApiInterface.class)).SaveLinkViewLog(hashMap).enqueue(new Callback<String>() {
            public void onResponse(Call<String> call, Response<String> response) {
                Log.d("SaveLinkViewLog", "onResponse");
            }

            public void onFailure(Call<String> call, Throwable th) {
                Log.d("SaveLinkViewLog", "onFailure");
            }
        });
    }

    public static void saveNoteViewLog(Context context, String str, int i, int i2, int i3, int i4) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("", 0);
        String string = sharedPreferences.getString("orgnizationIdKey", SchemaConstants.Value.FALSE);
        String string2 = sharedPreferences.getString("UseridKey", SchemaConstants.Value.FALSE);
        String string3 = sharedPreferences.getString("studentEnrollmentIdKey", SchemaConstants.Value.FALSE);
        String string4 = sharedPreferences.getString("ClassidKey", SchemaConstants.Value.FALSE);
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("UserID", string2);
        hashMap.put("StudentEnrollmentID", string3);
        hashMap.put("OrganisationID", string);
        hashMap.put("ClassID", string4);
        hashMap.put("ChapterID", String.valueOf(i));
        hashMap.put("TopicID", String.valueOf(i2));
        hashMap.put("SubjectGUID", str);
        hashMap.put("SubjectTopicsNoteID", String.valueOf(i3));
        hashMap.put("IsEnd", String.valueOf(i4));
        hashMap.put("apikey", getSchoolApiKey(context));
        ((ApiInterface) ApiClient.getClient1(context).create(ApiInterface.class)).SaveNoteViewLog(hashMap).enqueue(new Callback<String>() {
            public void onResponse(Call<String> call, Response<String> response) {
                Log.d("SaveNoteViewLog", "onResponse");
            }

            public void onFailure(Call<String> call, Throwable th) {
                Log.d("SaveNoteViewLog", "onFailure");
            }
        });
    }
}