Example usage for android.content SharedPreferences getFloat

List of usage examples for android.content SharedPreferences getFloat

Introduction

In this page you can find the example usage for android.content SharedPreferences getFloat.

Prototype

float getFloat(String key, float defValue);

Source Link

Document

Retrieve a float value from the preferences.

Usage

From source file:com.unovo.frame.utils.SharedPreferencesHelper.java

@SuppressWarnings("TryWithIdenticalCatches")
private static <T> Object buildTargetFromSource(Class<T> clx, T target, String preFix, Set<String> existKeys,
        SharedPreferences sp) {
    // Each to Object
    if (clx == null || clx.equals(Object.class)) {
        return target;
    }//from  www .j av a  2  s .c  o m

    // Create instance
    if (target == null) {
        try {
            target = clx.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
            return null;
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            return null;
        }
    }

    // Get the class fields
    Field[] fields = clx.getDeclaredFields();
    if (fields == null || fields.length == 0)
        return target;

    // Foreach fields
    for (Field field : fields) {
        if (isContSupport(field))
            continue;

        final String fieldName = field.getName();
        Class<?> fieldType = field.getType();

        // Change the Field accessible status
        boolean isAccessible = field.isAccessible();
        if (!isAccessible)
            field.setAccessible(true);

        // Build the key
        String key = preFix + fieldName;
        // Get target value
        Object value = null;
        if (isBasicType(fieldType)) {
            if (existKeys.contains(key)) {
                // From the share map
                if (fieldType.equals(Byte.class) || fieldType.equals(byte.class)) {
                    value = (byte) sp.getInt(key, 0);
                } else if (fieldType.equals(Short.class) || fieldType.equals(short.class)) {
                    value = (short) sp.getInt(key, 0);
                } else if (fieldType.equals(Integer.class) || fieldType.equals(int.class)) {
                    value = sp.getInt(key, 0);
                } else if (fieldType.equals(Long.class) || fieldType.equals(long.class)) {
                    value = sp.getLong(key, 0);
                } else if (fieldType.equals(Float.class) || fieldType.equals(float.class)) {
                    value = sp.getFloat(key, 0);
                } else if (fieldType.equals(Double.class) || fieldType.equals(double.class)) {
                    value = Double.valueOf(sp.getString(key, "0.00"));
                } else if (fieldType.equals(Boolean.class) || fieldType.equals(boolean.class)) {
                    value = sp.getBoolean(key, false);
                } else if (fieldType.equals(Character.class) || fieldType.equals(char.class)) {
                    value = sp.getString(key, "").charAt(0);
                } else if (fieldType.equals(String.class)) {
                    value = sp.getString(key, "");
                }
            }
        } else {
            value = buildTargetFromSource(fieldType, null, preFix + fieldName + SEPARATOR, existKeys, sp);
        }

        // Set the field value
        if (value != null) {
            try {
                field.set(target, value);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
                Logger.e(TAG,
                        String.format("Set field error, Key:%s, type:%s, value:%s", key, fieldType, value));
            }
        } else {
            Logger.e(TAG, String.format("Get field value error, Key:%s, type:%s", key, fieldType));
        }
    }

    // Get super class fields
    return buildTargetFromSource(clx.getSuperclass(), target, preFix, existKeys, sp);
}

From source file:pandroid.agent.PandroidAgentListener.java

private String getSharedData(String preferenceName, String tokenName, String defaultValue, String type) {

    SharedPreferences agentPreferences = getApplicationContext().getSharedPreferences(
            getApplicationContext().getString(R.string.const_string_preferences), Activity.MODE_PRIVATE);

    if (type == "boolean") {
        boolean a = agentPreferences.getBoolean(tokenName, Boolean.parseBoolean(defaultValue));
        return Boolean.valueOf(a).toString();
    } else if (type == "float") {
        float a = agentPreferences.getFloat(tokenName, Float.parseFloat(defaultValue));
        return Float.valueOf(a).toString();
    } else if (type == "integer") {
        int a = agentPreferences.getInt(tokenName, Integer.parseInt(defaultValue));
        return Integer.valueOf(a).toString();
    } else if (type == "long") {
        long a = agentPreferences.getLong(tokenName, Long.parseLong(defaultValue));
        return Long.valueOf(a).toString();
    } else if (type == "string") {
        return agentPreferences.getString(tokenName, defaultValue);
    }//from   w w w.  j  a  va2 s.  co  m

    return "";
}

From source file:com.openatk.field_work.MainActivity.java

private void setUpMapIfNeeded() {
    if (map == null) {
        //TODO IDK if we need this, check beginning of onCreate
        map = ((ATKSupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getAtkMap();
    }//from w  w w  . j a  va  2  s . com

    if (atkMapFragment.getRetained() == false) {
        Log.d("setUpMapIfNeeded", "New map need to set it up");

        //New map, we need to set it up
        setUpMap();

        SharedPreferences prefs = this.getSharedPreferences("com.openatk.field_work", Context.MODE_PRIVATE);
        Float startLat = prefs.getFloat("StartupLat", START_LAT);
        Float startLng = prefs.getFloat("StartupLng", START_LNG);
        Float startZoom = prefs.getFloat("StartupZoom", START_ZOOM);
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(startLat, startLng), startZoom));

        //TODO do stuff for hazards
        //this.showingHazards = prefs.getBoolean("showingHazards", false);
    } else {
        Log.d("setUpMapIfNeeded", "Old map, get everything from it");

        //Get the current field and job
        Integer selectedField = -100;
        if (this.savedInstanceState != null) {
            selectedField = savedInstanceState.getInt("currentField", -100);
        }

        SharedPreferences prefs = getApplicationContext().getSharedPreferences("com.openatk.field_work",
                Context.MODE_PRIVATE | Context.MODE_MULTI_PROCESS);
        //Check if sync occurred while we were gone.
        if (prefs.getInt(MainActivity.PREF_GONE,
                MainActivity.PREF_GONE_NO_UPDATE) == MainActivity.PREF_GONE_UPDATE) {
            //We need to update the entire screen... Cloud sync occurred while we were gone and it made changes.
            //We will do this in onResume after we register our receivers.
        } else {
            //Old map we need to get all our data from it
            //Get the FieldViews from ATKMap
            List<ATKPolygonView> polygonViews = map.getPolygonViews();
            for (int i = 0; i < polygonViews.size(); i++) {
                FieldView fieldView = (FieldView) polygonViews.get(i).getData();
                this.fieldViews.add(fieldView);
                Log.d("setUpMapIfNeeded", "selected field:" + Integer.toString(selectedField));
                Log.d("setUpMapIfNeeded", "fieldView:" + Integer.toString(fieldView.getFieldId()));
                if (fieldView.getFieldId() == selectedField) {
                    this.currentFieldView = fieldView;
                }
            }
        }
    }
    Log.d("setUpMapIfNeeded", "map was setup");
    //Setup stuff for new activity
    map.setOnMapClickListener(this);
    map.setOnPolygonClickListener(this);
    map.setOnPointClickListener(this);
    map.setOnPointDragListener(this);
    this.updateCurrentOperation();
}

From source file:es.javocsoft.android.lib.toolbox.ToolBox.java

public static Object prefs_readPreference(Context ctx, String prefName, String key, Class<?> valueType) {
    SharedPreferences prefs = ctx.getSharedPreferences(prefName, Context.MODE_PRIVATE);

    if (valueType == Long.class) {
        return prefs.getLong(key, Long.valueOf(-1));
    } else if (valueType == Boolean.class) {
        return prefs.getBoolean(key, Boolean.valueOf(false));
    } else if (valueType == Float.class) {
        return prefs.getFloat(key, Float.valueOf(-1));
    } else if (valueType == Integer.class) {
        return prefs.getInt(key, Integer.valueOf(-1));
    } else if (valueType == String.class) {
        return prefs.getString(key, null);
    } else if (valueType == Set.class) {
        //return prefs.getStringSet(key, null); //Only from 11 API level.
        return getSetListFromCommaSeparatedString(ctx, prefName, key);
    }//from w  w w. j  a  v a 2  s  . com

    return null;
}

From source file:org.kiwix.kiwixmobile.KiwixMobileActivity.java

public void loadPrefs() {

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    nightMode = KiwixSettingsActivity.nightMode(sharedPreferences);
    isBackToTopEnabled = sharedPreferences.getBoolean(PREF_BACK_TO_TOP, false);
    isHideToolbar = sharedPreferences.getBoolean(PREF_HIDE_TOOLBAR, false);
    isFullscreenOpened = sharedPreferences.getBoolean(PREF_FULLSCREEN, false);
    boolean isZoomEnabled = sharedPreferences.getBoolean(PREF_ZOOM_ENABLED, false);
    isOpenNewTabInBackground = sharedPreferences.getBoolean(PREF_NEW_TAB_BACKGROUND, false);

    if (isZoomEnabled) {
        int zoomScale = (int) sharedPreferences.getFloat(PREF_ZOOM, 100.0f);
        getCurrentWebView().setInitialScale(zoomScale);
    } else {/*w ww  .j a v  a  2 s . c  o  m*/
        getCurrentWebView().setInitialScale(0);
    }

    if (!isBackToTopEnabled) {
        backToTopButton.setVisibility(View.INVISIBLE);
    }

    if (isFullscreenOpened) {
        openFullScreen();
    }

    // Night mode status
    Log.d(TAG_KIWIX, "nightMode value (" + nightMode + ")");
    if (nightMode) {
        getCurrentWebView().toggleNightMode();
    } else {
        getCurrentWebView().deactivateNightMode();
    }
}

From source file:com.gigabytedevelopersinc.app.calculator.Calculator.java

void evaluate(String exp) {
    Solver solver = new Solver();
    if (page_no == 4) {
        switch (unitSpinner.getSelectedItem().toString()) {
        case "Area":
            convert(exp, areaValues);/*from www .ja v  a  2  s  .com*/
            break;
        case "Cooking":
            convert(exp, cookingValues);
            break;
        case "Digital Storage":
            convert(exp, digitalValues);
            break;
        case "Energy":
            convert(exp, energyValues);
            break;
        case "Fuel Consumption":
            convert(exp, fuelValues);
            break;
        case "Length / Distance":
            convert(exp, lengthValues);
            break;
        case "Mass / Weight":
            convert(exp, massValues);
            break;
        case "Power":
            convert(exp, powerValues);
            break;
        case "Pressure":
            convert(exp, pressureValues);
            break;
        case "Speed":
            convert(exp, speedValues);
            break;
        case "Time":
            convert(exp, timeValues);
            break;
        case "Torque":
            convert(exp, torqueValues);
            break;
        case "Volume":
            convert(exp, volumeValues);
            break;
        }
    } else {
        try {
            int test = too.getVisibility();
            SharedPreferences settings = getSharedPreferences("MyPrefs", 0);
            Float rate = settings.getFloat("rate", 0);
            if (format_bool) {
                try {
                    result_TV.setText(formatter
                            .format(Double.valueOf(solver.solve(exp).replace(Constants.DECIMAL_POINT, '.'))));
                    resultant_TV.setText(formatter.format(Double.valueOf(
                            solver.solve(String.valueOf(solver.solve("(" + exp + ")*" + rate.toString())
                                    .replace(Constants.DECIMAL_POINT, '.'))))));
                } catch (Exception i) {
                    result_TV.setText(String.valueOf(solver.solve(exp)));
                    resultant_TV.setText(String
                            .valueOf(solver.solve(String.valueOf(solver.solve(exp)) + "*" + rate.toString())));
                }
            } else {
                result_TV.setText(String.valueOf(solver.solve(exp)));
                resultant_TV.setText(String
                        .valueOf(solver.solve(String.valueOf(solver.solve(exp)) + "*" + rate.toString())));
            }
        } catch (Exception ee) {
            try {
                if (format_bool) {
                    try {
                        result_TV.setText(formatter.format(
                                Double.valueOf(solver.solve(exp).replace(Constants.DECIMAL_POINT, '.'))));
                    } catch (Exception i) {
                        result_TV.setText(String.valueOf(solver.solve(exp)));
                    }
                } else
                    result_TV.setText(String.valueOf(solver.solve(exp)));
                done = false;
            } catch (SyntaxException S) {
                if (done) {
                    Toast.makeText(Calculator.this, S.toString(), Toast.LENGTH_SHORT).show();
                }
                done = false;
            }
        }

        /*try {
        TextView decTV = (TextView) findViewById(R.id.dec_tv);
        TextView hexTV = (TextView) findViewById(R.id.hex_TV);
        TextView octTV = (TextView) findViewById(R.id.oct_TV);
        TextView binTV = (TextView) findViewById(R.id.bin_TV);
                
        DecimalFormat df = new DecimalFormat();
        df.setGroupingUsed(false);
        df.setMaximumFractionDigits(15);
        try {
            solver.setBase(base);
            String ans = solver.solve(exp);
            decTV.setText(changeBase(ans, base, Base.DECIMAL));
            hexTV.setText(newBase(decTV.getText().toString(), 10, 16));
            octTV.setText(newBase(decTV.getText().toString(), 10, 8));
            binTV.setText(newBase(decTV.getText().toString(), 10, 2));
        } catch (SyntaxException R) {
            if (done) {
                Toast.makeText(MainActivity.this, R.toString(), Toast.LENGTH_SHORT).show();
            }
            done = false;
        } catch (Exception e) {
            //Toast.makeText(MainActivity.this, e.toString(), Toast.LENGTH_SHORT).show();
        }
        } catch (RuntimeException R) {
        //
        }*/
    }
}

From source file:com.android.mms.ui.MessageUtils.java

public static float getPreferenceValueFloat(Context context, String key, float defaultValue) {
    SharedPreferences sp = context.getSharedPreferences("com.android.mms_preferences",
            Context.MODE_PRIVATE | Context.MODE_MULTI_PROCESS);
    return sp.getFloat(key, defaultValue);
}

From source file:com.androzic.Androzic.java

public void initializeNavigation() {
    bindService(new Intent(this, NavigationService.class), navigationConnection, BIND_AUTO_CREATE);
    registerReceiver(broadcastReceiver, new IntentFilter(NavigationService.BROADCAST_NAVIGATION_STATUS));
    registerReceiver(broadcastReceiver, new IntentFilter(NavigationService.BROADCAST_NAVIGATION_STATE));

    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    String navWpt = settings.getString(getString(R.string.nav_wpt), "");
    if (!"".equals(navWpt)) {
        Waypoint waypoint = new Waypoint();
        waypoint.name = navWpt;/*from   w  w  w .j a  va 2 s  .  c  om*/
        waypoint.latitude = (double) settings.getFloat(getString(R.string.nav_wpt_lat), 0);
        waypoint.longitude = (double) settings.getFloat(getString(R.string.nav_wpt_lon), 0);
        waypoint.proximity = settings.getInt(getString(R.string.nav_wpt_prx), 0);
        startNavigation(waypoint);
    }

    String navRoute = settings.getString(getString(R.string.nav_route), "");
    if (!"".equals(navRoute) && settings.getBoolean(getString(R.string.pref_navigation_loadlast),
            getResources().getBoolean(R.bool.def_navigation_loadlast))) {
        int ndir = settings.getInt(getString(R.string.nav_route_dir), 0);
        int nwpt = settings.getInt(getString(R.string.nav_route_wpt), -1);
        try {
            Route route = getRouteByFile(navRoute);
            if (route != null) {
                route.show = true;
            } else {
                File rtf = new File(navRoute);
                // FIXME It's bad - it can be not a first route in a file
                route = OziExplorerFiles.loadRoutesFromFile(rtf, charset).get(0);
                addRoute(route);
            }
            startNavigation(route, ndir, nwpt);
        } catch (Exception e) {
            Log.e(TAG, "Failed to start navigation", e);
        }
    }
}

From source file:com.updetector.MainActivity.java

/**
* Handle Performance Tuning Click//from w  w  w.j a  v a 2 s .  c  om
*/
private void handleAdvancedSetting() {
    final Dialog dialog = new Dialog(this);
    dialog.setTitle(R.string.menu_item_advanced_settings);
    dialog.setContentView(R.layout.advanced_setting);

    final SharedPreferences mPrefs = getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE);
    final Editor editor = mPrefs.edit();

    final ToggleButton classifierForCIVOnButton = (ToggleButton) dialog.findViewById(R.id.civ_classifier_on);
    classifierForCIVOnButton.setChecked(mPrefs.getBoolean(Constants.PREFERENCE_KEY_CIV_CLASSIFIER_ON, false));

    final ToggleButton isOutdoorButton = (ToggleButton) dialog.findViewById(R.id.is_outdoor);
    isOutdoorButton.setChecked(mPrefs.getBoolean(Constants.PREFERENCE_KEY_IS_OUTDOOR, false));

    final EditText notificationTresholdText = (EditText) dialog.findViewById(R.id.notification_threshold);
    notificationTresholdText
            .setText(String.format("%.2f", mPrefs.getFloat(Constants.PREFERENCE_KEY_NOTIFICATION_THRESHOLD,
                    (float) Constants.DEFAULT_DETECTION_THRESHOLD)));

    //final EditText detectionIntervalText=(EditText)dialog.findViewById(R.id.detection_interval);
    //detectionIntervalText.setText(String.valueOf(mPrefs.getInt(Constants.PREFERENCE_KEY_DETECTION_INTERVAL, Constants.DETECTION_INTERVAL_DEFAULT_VALUE) ));

    final EditText googleActivityUpdateIntervalText = (EditText) dialog
            .findViewById(R.id.google_activity_update_interval);
    googleActivityUpdateIntervalText
            .setText(String.valueOf(mPrefs.getInt(Constants.PREFERENCE_KEY_GOOGLE_ACTIVITY_UPDATE_INTERVAL,
                    Constants.GOOGLE_ACTIVITY_UPDATE_INTERVAL_DEFAULT_VALUE)));

    //final ToggleButton useGoogleActivityInFusion=(ToggleButton)dialog.findViewById(R.id.use_google_for_motion_state_in_fusion);
    //useGoogleActivityInFusion.setChecked(mPrefs.getBoolean(Constants.PREFERENCE_KEY_USE_GOOGLE_ACTIVITY_IN_FUSION, false));

    final ToggleButton logAcclRawButton = (ToggleButton) dialog.findViewById(R.id.log_raw_switch);
    logAcclRawButton.setChecked(mPrefs.getBoolean(Constants.LOGGING_ACCL_RAW_SWITCH, false));

    final ToggleButton logGoogleActUpdatesButton = (ToggleButton) dialog
            .findViewById(R.id.log_google_updates_switch);
    logGoogleActUpdatesButton.setChecked(mPrefs.getBoolean(Constants.LOGGING_GOOGLE_ACTIVITY_UPDATE, false));

    final ToggleButton logDetectionButton = (ToggleButton) dialog.findViewById(R.id.log_report_switch);
    logDetectionButton.setChecked(mPrefs.getBoolean(Constants.LOGGING_DETECTION_SWITCH, false));

    final ToggleButton logErrorButton = (ToggleButton) dialog.findViewById(R.id.log_error_switch);
    logErrorButton.setChecked(mPrefs.getBoolean(Constants.LOGGING_ERROR_SWITCH, true));

    //final EditText deltaForConditionalProb=(EditText)dialog.findViewById(R.id.normal_dist_delta);
    //deltaForConditionalProb.setText(String.valueOf(mPrefs.getFloat(Constants.CIV_DELTA_CONDITIONAL_PROBABILITY, 2)) );      

    final Button applyButton = (Button) dialog.findViewById(R.id.performance_apply_button);
    final Button cancelButton = (Button) dialog.findViewById(R.id.peformance_cancel_button);
    applyButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            if (classifierForCIVOnButton.isChecked())
                editor.putBoolean(Constants.PREFERENCE_KEY_CIV_CLASSIFIER_ON, true);
            else
                editor.putBoolean(Constants.PREFERENCE_KEY_CIV_CLASSIFIER_ON, false);

            if (isOutdoorButton.isChecked())
                editor.putBoolean(Constants.PREFERENCE_KEY_IS_OUTDOOR, true);
            else
                editor.putBoolean(Constants.PREFERENCE_KEY_IS_OUTDOOR, false);

            if (logAcclRawButton.isChecked())
                editor.putBoolean(Constants.LOGGING_ACCL_RAW_SWITCH, true);
            else
                editor.putBoolean(Constants.LOGGING_ACCL_RAW_SWITCH, false);

            if (logGoogleActUpdatesButton.isChecked())
                editor.putBoolean(Constants.LOGGING_GOOGLE_ACTIVITY_UPDATE, true);
            else
                editor.putBoolean(Constants.LOGGING_GOOGLE_ACTIVITY_UPDATE, false);

            if (logDetectionButton.isChecked())
                editor.putBoolean(Constants.LOGGING_DETECTION_SWITCH, true);
            else
                editor.putBoolean(Constants.LOGGING_DETECTION_SWITCH, false);

            if (logErrorButton.isChecked())
                editor.putBoolean(Constants.LOGGING_ERROR_SWITCH, true);
            else
                editor.putBoolean(Constants.LOGGING_ERROR_SWITCH, false);

            float notificationTreshold;
            try {
                notificationTreshold = Float.parseFloat(notificationTresholdText.getText().toString());
            } catch (Exception ex) {
                notificationTreshold = (float) Constants.DEFAULT_DETECTION_THRESHOLD;
            }
            editor.putFloat(Constants.PREFERENCE_KEY_NOTIFICATION_THRESHOLD, notificationTreshold);

            /*int detectionInterval;
            try{
               detectionInterval=Integer.parseInt(
             detectionIntervalText.getText().toString());
            }catch(Exception ex){
               detectionInterval=Constants.DETECTION_INTERVAL_DEFAULT_VALUE;
            }
            editor.putInt(Constants.PREFERENCE_KEY_DETECTION_INTERVAL, detectionInterval);*/

            /*if (useGoogleActivityInFusion.isChecked())
               editor.putBoolean(Constants.PREFERENCE_KEY_USE_GOOGLE_ACTIVITY_IN_FUSION, true);
            else
               editor.putBoolean(Constants.PREFERENCE_KEY_USE_GOOGLE_ACTIVITY_IN_FUSION, false);*/

            int googleActivityUpdateInterval;
            try {
                googleActivityUpdateInterval = Integer
                        .parseInt(googleActivityUpdateIntervalText.getText().toString());
            } catch (Exception ex) {
                googleActivityUpdateInterval = Constants.GOOGLE_ACTIVITY_UPDATE_INTERVAL_DEFAULT_VALUE;
            }
            editor.putInt(Constants.PREFERENCE_KEY_GOOGLE_ACTIVITY_UPDATE_INTERVAL,
                    googleActivityUpdateInterval);

            /*try{
               Float delta=Float.parseFloat(deltaForConditionalProb.getText().toString());
               editor.putFloat(Constants.CIV_DELTA_CONDITIONAL_PROBABILITY, delta);
            }catch(Exception ex){
               Toast.makeText(getApplicationContext(), "Input must be a float number", Toast.LENGTH_SHORT).show();
            }*/

            editor.commit();
            dialog.cancel();
        }
    });

    cancelButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            dialog.cancel();
        }
    });
    dialog.show();
}

From source file:com.gigabytedevelopersinc.app.calculator.Calculator.java

public void BtnClick(final View v) {

    page_no = mPager.getCurrentItem();/*from   w w  w  . j av a2 s.  c  o m*/
    unitSpinner = findViewById(R.id.units_spinner);
    switch (page_no) {
    /*case 0:
        result_TV = (AutoResizeTextView) findViewById(R.id.sci_result_TV);
        expression_TV = (EditText) findViewById(R.id.sci_expression_TV);
        break;
    case 1:
        result_TV = (AutoResizeTextView) findViewById(R.id.pro_result_TV);
        expression_TV = (EditText) findViewById(R.id.pro_expression_TV);
        break;*/
    case 2:
        result_TV = (AutoResizeTextView) findViewById(R.id.curr_result_TV);
        expression_TV = (EditText) findViewById(R.id.curr_expression_TV);
        resultant_TV = (AutoResizeTextView) findViewById(R.id.curr_resultant_TV);
        break;
    case 3:
    case 4:
        result_TV = (AutoResizeTextView) findViewById(R.id.conv_result_TV);
        expression_TV = (EditText) findViewById(R.id.conv_expression_TV);
        resultant_TV = (AutoResizeTextView) findViewById(R.id.conv_resultant_TV);
        break;

    }
    try {
        result_TV.setInputType(InputType.TYPE_NULL);
        result_TV.setRawInputType(InputType.TYPE_CLASS_TEXT);
        result_TV.setTextIsSelectable(true);
        result = result_TV.getText().toString();

        try {
            resultant_TV.setInputType(InputType.TYPE_NULL);
            resultant_TV.setRawInputType(InputType.TYPE_CLASS_TEXT);
            resultant_TV.setTextIsSelectable(true);
        } catch (Exception idk) {
            //
        }

        expression_TV.setInputType(InputType.TYPE_NULL);
        expression_TV.setRawInputType(InputType.TYPE_CLASS_TEXT);
        expression_TV.setTextIsSelectable(true);
        expression = expression_TV.getText().toString();
        if (!flag) {
            expression_TV.setText("");
            result_TV.setMaxTextSize(34);
            result_TV.setTextSize(34);
            result_TV.setText("" + 0);
            expression = "";
            result = "" + 0;
            flag = true;
        }
    } catch (Exception eee) {
        //
    }

    //Converter
    from = (Spinner) findViewById(R.id.from_spinner);
    to = (Spinner) findViewById(R.id.to_spinner);
    try {
        from.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                evaluate(expression_TV.getText().toString());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
            }
        });
        to.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                evaluate(expression_TV.getText().toString());
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {
            }
        });
    } catch (Exception e) {
        //
    }

    //Currency
    fro = (Spinner) findViewById(R.id.fro_spinner);
    too = (Spinner) findViewById(R.id.too_spinner);
    /*LinearLayout sciFunLayout = (LinearLayout) findViewById(R.id.sci_fun_layout);
    final ListView constantsList = (ListView) findViewById(R.id.constants_list);*/

    switch (page_no) {
    /*case 0:
        historyLayout = (LinearLayout) findViewById(R.id.sci_history_layout);
        memoryLayout = (LinearLayout) findViewById(R.id.sci_memory_layout);
        simplePad = (LinearLayout) findViewById(R.id.sci_simple_pad);
        historyList = (ListView) findViewById(R.id.sci_history_list);
        historyList.setEmptyView(findViewById(R.id.sci_empty_history));
        memoryList = (ListView) findViewById(R.id.sci_memory_list);
        memoryList.setEmptyView(findViewById(R.id.sci_empty));
        fav_List_LL = (LinearLayout) findViewById(R.id.conv_fav_layout);
        favList = (ListView) findViewById(R.id.conv_fav_list);
        favList.setEmptyView(findViewById(R.id.conv_empty_fav));
        hyBtn = (Button) findViewById(R.id.sci_history_Btn);
        myBtn = (Button) findViewById(R.id.sci_M_Btn);
        favBtn = (Button) findViewById(R.id.conv_fav_Btn);
        break;
    case 1:
        historyLayout = (LinearLayout) findViewById(R.id.pro_history_layout);
        memoryLayout = (LinearLayout) findViewById(R.id.pro_memory_layout);
        simplePad = (LinearLayout) findViewById(R.id.pro_simple_pad);
        historyList = (ListView) findViewById(R.id.pro_history_list);
        historyList.setEmptyView(findViewById(R.id.pro_empty_history));
        memoryList = (ListView) findViewById(R.id.pro_memory_list);
        memoryList.setEmptyView(findViewById(R.id.pro_empty));
        fav_List_LL = (LinearLayout) findViewById(R.id.conv_fav_layout);
        favList = (ListView) findViewById(R.id.conv_fav_list);
        favList.setEmptyView(findViewById(R.id.conv_empty_fav));
        favBtn = (Button) findViewById(R.id.conv_fav_Btn);
        break;*/
    case 2:
        historyLayout = (LinearLayout) findViewById(R.id.curr_history_layout);
        memoryLayout = (LinearLayout) findViewById(R.id.curr_memory_layout);
        simplePad = (LinearLayout) findViewById(R.id.curr_simple_pad);
        historyList = (ListView) findViewById(R.id.curr_history_list);
        historyList.setEmptyView(findViewById(R.id.curr_empty_history));
        memoryList = (ListView) findViewById(R.id.curr_memory_list);
        memoryList.setEmptyView(findViewById(R.id.curr_empty));
        fav_List_LL = (LinearLayout) findViewById(R.id.curr_fav_layout);
        favList = (ListView) findViewById(R.id.curr_fav_list);
        favList.setEmptyView(findViewById(R.id.curr_empty_fav));
        /*hyBtn = (Button) findViewById(R.id.curr_history_Btn);
        myBtn = (Button) findViewById(R.id.curr_M_Btn);
        favBtn = (Button) findViewById(R.id.curr_fav_Btn);*/
        break;
    case 3:
    case 4:
        historyLayout = (LinearLayout) findViewById(R.id.conv_history_layout);
        memoryLayout = (LinearLayout) findViewById(R.id.conv_memory_layout);
        simplePad = (LinearLayout) findViewById(R.id.conv_simple_pad);
        historyList = (ListView) findViewById(R.id.conv_history_list);
        historyList.setEmptyView(findViewById(R.id.conv_empty_history));
        memoryList = (ListView) findViewById(R.id.conv_memory_list);
        memoryList.setEmptyView(findViewById(R.id.conv_empty));
        fav_List_LL = (LinearLayout) findViewById(R.id.conv_fav_layout);
        favList = (ListView) findViewById(R.id.conv_fav_list);
        favList.setEmptyView(findViewById(R.id.conv_empty_fav));
        /*hyBtn = (Button) findViewById(R.id.conv_history_Btn);
        myBtn = (Button) findViewById(R.id.conv_M_Btn);
        favBtn = (Button) findViewById(R.id.conv_fav_Btn);*/
        break;
    default:
        historyLayout = (LinearLayout) findViewById(R.id.conv_history_layout);
        memoryLayout = (LinearLayout) findViewById(R.id.conv_memory_layout);
        simplePad = (LinearLayout) findViewById(R.id.conv_simple_pad);
        historyList = (ListView) findViewById(R.id.conv_history_list);
        historyList.setEmptyView(findViewById(R.id.conv_empty_history));
        fav_List_LL = (LinearLayout) findViewById(R.id.conv_fav_layout);
        memoryList = (ListView) findViewById(R.id.conv_memory_list);
        memoryList.setEmptyView(findViewById(R.id.conv_empty));
        favList = (ListView) findViewById(R.id.conv_fav_list);
        favList.setEmptyView(findViewById(R.id.conv_empty_fav));
        /*hyBtn = (Button) findViewById(R.id.conv_history_Btn);
        myBtn = (Button) findViewById(R.id.conv_M_Btn);
        favBtn = (Button) findViewById(R.id.conv_fav_Btn);*/
        break;
    }

    /*Button funcBtn = (Button) findViewById(R.id.functions_Btn);
    Button constBtn = (Button) findViewById(R.id.constants_Btn);
            
    Button decBtn = (Button) findViewById(R.id.dec_Btn);
    Button hexBtn = (Button) findViewById(R.id.hex_Btn);
    Button octBtn = (Button) findViewById(R.id.oct_Btn);
    Button binBtn = (Button) findViewById(R.id.bin_Btn);
            
    TextView decTV = (TextView) findViewById(R.id.dec_tv);
    TextView hexTV = (TextView) findViewById(R.id.hex_TV);
    TextView octTV = (TextView) findViewById(R.id.oct_TV);
    TextView binTV = (TextView) findViewById(R.id.bin_TV);*/

    int id = v.getId();
    Button btn = (Button) findViewById(id);
    final String btnText = btn.getText().toString();
    switch (id) {
    case R.id.curr_add_to_fav:
    case R.id.conv_add_to_fav:
        createFav();
        break;
    //case R.id.sci_history_Btn:
    //case R.id.conv_history_Btn:
    //case R.id.curr_history_Btn:
    /*dbAdapter = new DbAdapter(this);
    dbAdapter.open();
    fillData();
            
    if (historyLayout.getVisibility() == View.GONE) {
        historyLayout.setVisibility(View.VISIBLE);
        hyBtn.setTextColor(primary_text_color);
        hyBtn.setBackgroundColor(primary_color);
        myBtn.setTextColor(sec_text_color);
        myBtn.setBackgroundColor(sec_color);
        memoryLayout.setVisibility(View.GONE);
        try {
            fav_List_LL.setVisibility(View.GONE);
            favBtn.setTextColor(sec_text_color);
            favBtn.setBackgroundColor(sec_color);
        } catch (Exception e) {
            //
        }
        *//*try {
             constantsList.setVisibility(View.GONE);
             constBtn.setTextColor(sec_text_color);
             constBtn.setBackgroundColor(sec_color);
             sciFunLayout.setVisibility(View.GONE);
             funcBtn.setTextColor(sec_text_color);
             funcBtn.setBackgroundColor(sec_color);
           } catch (Exception e) {
             //
           }*//*
               simplePad.setVisibility(View.GONE);
               } else {
               hyBtn.setTextColor(sec_text_color);
               hyBtn.setBackgroundColor(sec_color);
               historyLayout.setVisibility(View.GONE);
               simplePad.setVisibility(View.VISIBLE);
               }
               break;*/

    /*case R.id.floating:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if (getDrawPermit()) {
                Intent startServiceIntent = new Intent(MainActivity.this, FloatingCalculator.class);
                startService(startServiceIntent);
            } else
                Toast.makeText(getApplicationContext(),
                        "Allow permission to draw over other apps to use Floating Calculator.",
                        Toast.LENGTH_LONG).show();
        } else {
            Intent startServiceIntent = new Intent(MainActivity.this, FloatingCalculator.class);
            startService(startServiceIntent);
        }
        break;
    case R.id.matgraph:
        startActivity(new Intent(getApplicationContext(), Calculator.class).putExtra("MAIN", true));
        break;
    case R.id.settings:
        startActivity(new Intent(MainActivity.this, SettingsActivity.class));
        break;
    case R.id.report:
        Intent report = new Intent(Intent.ACTION_VIEW,
                Uri.parse("https://github.com/gigabytedevelopers/CalcMate/issues"));
        startActivity(report);
        break;
    case R.id.about:
        new LibsBuilder()
                .withLicenseShown(true)
                .withVersionShown(true)
                .withAboutVersionShown(true)
                .withActivityTitle(getString(R.string.app_name))
                .withAboutIconShown(true)
                .withListener(libsListener)
                .start(MainActivity.this);
        break;*/

    case R.id.AC_Btn:
        createHistory();
        reset();
        break;
    case R.id.C_Btn:
        int start = Math.max(expression_TV.getSelectionStart(), 0);
        int end = Math.max(expression_TV.getSelectionEnd(), 0);
        if (start == end && start != 0)
            expression_TV.getText().replace(Math.min(start, end) - 1, Math.max(start, end), "", 0, 0);
        else
            expression_TV.getText().replace(Math.min(start, end), Math.max(start, end), "", 0, 0);
        evaluate(expression_TV.getText().toString());
        break;

    //Memory
    case R.id.MC_Btn:
        dbAdapter = new DbAdapter(this);
        dbAdapter.open();
        dbAdapter.deleteAllMemories();
        Toast clearmem = Toast.makeText(Calculator.this, "Memory Cleared!", Toast.LENGTH_SHORT);
        clearmem.show();
        fillData();
        break;
    case R.id.MR_Btn:
        dbAdapter = new DbAdapter(this);
        dbAdapter.open();
        fillData();
        String mem = dbAdapter.memoryRetrieve();
        if (mem.equals("xyz")) {
            Toast toast = Toast.makeText(Calculator.this, "No Memory Yet!", Toast.LENGTH_SHORT);
            toast.show();
        } else
            insert(dbAdapter.memoryRetrieve());
        break;
    case R.id.MS_Btn:
        createMemory();
        Toast savemem = Toast.makeText(Calculator.this, "New Memory Saved!", Toast.LENGTH_SHORT);
        savemem.show();
        break;
    //case R.id.sci_M_Btn:
    //case R.id.curr_M_Btn:
    /*case R.id.conv_M_Btn:
    dbAdapter = new DbAdapter(this);
    dbAdapter.open();
    fillData();
    if (memoryLayout.getVisibility() == View.GONE) {
        memoryLayout.setVisibility(View.VISIBLE);
        myBtn.setTextColor(primary_text_color);
        myBtn.setBackgroundColor(primary_color);
        try {
            fav_List_LL.setVisibility(View.GONE);
            favBtn.setTextColor(sec_text_color);
            favBtn.setBackgroundColor(sec_color);
        } catch (Exception e) {
            //
        }
        *//*try {
             constantsList.setVisibility(View.GONE);
             constBtn.setTextColor(sec_text_color);
             constBtn.setBackgroundColor(sec_color);
             sciFunLayout.setVisibility(View.GONE);
             funcBtn.setTextColor(sec_text_color);
             funcBtn.setBackgroundColor(sec_color);
           } catch (Exception e) {
             //
           }*//*
               simplePad.setVisibility(View.GONE);
               hyBtn.setTextColor(sec_text_color);
               hyBtn.setBackgroundColor(sec_color);
               historyLayout.setVisibility(View.GONE);
               } else {
               myBtn.setTextColor(sec_text_color);
               myBtn.setBackgroundColor(sec_color);
               memoryLayout.setVisibility(View.GONE);
               simplePad.setVisibility(View.VISIBLE);
               }
               break;*/

    //case R.id.curr_fav_Btn:
    //case R.id.conv_fav_Btn:
    /*dbAdapter = new DbAdapter(this);
    dbAdapter.open();
    fillData();
    if (fav_List_LL.getVisibility() == View.GONE) {
        fav_List_LL.setVisibility(View.VISIBLE);
        try {
            memoryLayout.setVisibility(View.GONE);
            myBtn.setTextColor(sec_text_color);
            myBtn.setBackgroundColor(sec_color);
        } catch (Exception e) {
            //
        }
        favBtn.setTextColor(primary_text_color);
        favBtn.setBackgroundColor(primary_color);
        simplePad.setVisibility(View.GONE);
        hyBtn.setTextColor(sec_text_color);
        hyBtn.setBackgroundColor(sec_color);
        historyLayout.setVisibility(View.GONE);
    } else {
        fav_List_LL.setVisibility(View.GONE);
        favBtn.setTextColor(sec_text_color);
        favBtn.setBackgroundColor(sec_color);
        simplePad.setVisibility(View.VISIBLE);
    }
    break;*/

    /*case R.id.constants_Btn:
        dataBaseHelper = new DataBaseHelper(this);
        try {
            dataBaseHelper.createDataBase();
        } catch (IOException ioe) {
            throw new Error("Unable to create database");
        }
        dataBaseHelper.openDataBase();
        dataSource = new DataSource(this);
        dataSource.open();
        if (constantsList.getVisibility() == View.GONE) {
            constantsList.setVisibility(View.VISIBLE);
            constBtn.setTextColor(primary_text_color);
            constBtn.setBackgroundColor(primary_color);
            memoryLayout.setVisibility(View.GONE);
            myBtn.setTextColor(sec_text_color);
            myBtn.setBackgroundColor(sec_color);
            hyBtn.setTextColor(sec_text_color);
            hyBtn.setBackgroundColor(sec_color);
            historyLayout.setVisibility(View.GONE);
            try {
                sciFunLayout.setVisibility(View.GONE);
                funcBtn.setTextColor(sec_text_color);
                funcBtn.setBackgroundColor(sec_color);
            } catch (Exception e) {
                //
            }
            simplePad.setVisibility(View.GONE);
        } else {
            constantsList.setVisibility(View.GONE);
            constBtn.setTextColor(sec_text_color);
            constBtn.setBackgroundColor(sec_color);
            simplePad.setVisibility(View.VISIBLE);
        }
        try {
            Cursor c = dataSource.getConstants();
            startManagingCursor(c);
            
            String[] fro = new String[]{DataBaseHelper.COLUMN_NAME, DataBaseHelper.COLUMN_SYMBOL, DataBaseHelper.COLUMN_VALUE, DataBaseHelper.COLUMN_DIMENSION};
            int[] too = new int[]{R.id.text11, R.id.text12, R.id.text21, R.id.text22};
            
            SimpleCursorAdapter constants =
                    new SimpleCursorAdapter(this, R.layout.constants_row, c, fro, too);
            constantsList.setAdapter(constants);
            constantsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    Cursor obj = (Cursor) constantsList.getItemAtPosition(position);
                    insert(obj.getString(3));
                }
            });
        } catch (Exception e) {
            //
        }
        break;
            
    case R.id.functions_Btn:
        if (sciFunLayout.getVisibility() == View.GONE) {
            funcBtn.setTextColor(primary_text_color);
            funcBtn.setBackgroundColor(primary_color);
            sciFunLayout.setVisibility(View.VISIBLE);
            memoryLayout.setVisibility(View.GONE);
            myBtn.setTextColor(sec_text_color);
            myBtn.setBackgroundColor(sec_color);
            hyBtn.setTextColor(sec_text_color);
            hyBtn.setBackgroundColor(sec_color);
            historyLayout.setVisibility(View.GONE);
            simplePad.setVisibility(View.GONE);
            constantsList.setVisibility(View.GONE);
            constBtn.setTextColor(sec_text_color);
            constBtn.setBackgroundColor(sec_color);
        } else {
            funcBtn.setTextColor(sec_text_color);
            funcBtn.setBackgroundColor(sec_color);
            sciFunLayout.setVisibility(View.GONE);
            simplePad.setVisibility(View.VISIBLE);
        }
        break;*/

    case R.id.conv_swap_Btn:
    case R.id.curr_swap_Btn:
        if (page_no == 4) {
            int temp = from.getSelectedItemPosition();
            from.setSelection(to.getSelectedItemPosition());
            to.setSelection(temp);
        } else {
            SharedPreferences settings = getSharedPreferences("MyPrefs", 0);
            Float rate = settings.getFloat("rate", 0);
            SharedPreferences.Editor editor = settings.edit();
            editor.putFloat("rate", 1 / rate);
            editor.apply();
            rate = 1 / rate;
            result_TV.setText("1");
            resultant_TV.setText(rate.toString());
            int temp = fro.getSelectedItemPosition();
            fro.setSelection(too.getSelectedItemPosition());
            too.setSelection(temp);
        }
        break;

    //Operators
    case R.id.leftBracket_Btn:
    case R.id.rightBracket_Btn:
    case R.id.add_Btn:
    case R.id.sub_Btn:
        //case R.id.factorial_Btn:
        // case R.id.imagine_Btn:
        //Numbers
    case R.id.dot_Btn:
    case R.id.Btn_0:
    case R.id.Btn_1:
    case R.id.Btn_2:
    case R.id.Btn_3:
    case R.id.Btn_4:
    case R.id.Btn_5:
    case R.id.Btn_6:
    case R.id.Btn_7:
    case R.id.Btn_8:
    case R.id.Btn_9:
        insert(btnText);
        break;
    case R.id.div_Btn:
        insert("/");
        break;
    case R.id.mul_Btn:
        insert("*");
        break;

    /*//Hex
    case R.id.A_Btn:
    case R.id.B_Btn:
    case R.id.C_hex_Btn:
    case R.id.D_Btn:
    case R.id.E_Btn:
    case R.id.F_Btn:
        insert(btnText);
        break;
    //Functions
    case R.id.abs_Btn:
    case R.id.ceil_Btn:
    case R.id.cos_Btn:
    case R.id.cosh_Btn:
    case R.id.exp_Btn:
    case R.id.floor_Btn:
    case R.id.log_Btn:
    case R.id.log10_Btn:
    case R.id.log2_Btn:
    case R.id.sin_Btn:
    case R.id.sinh_Btn:
    case R.id.tan_Btn:
    case R.id.tanh_Btn:
        insert(btnText + "(");
        break;
            
    case R.id.deg_Btn:
        insert("*" + getResources().getString(R.string.pi) + "/180");
        break;
            
    case R.id.acos_Btn:
        insert("acos(");
        break;
    case R.id.asin_Btn:
        insert("asin(");
        break;
    case R.id.atan_Btn:
        insert("atan(");
        break;
    case R.id.acosd_Btn:
        insert("acosd(");
        break;
    case R.id.acosh_Btn:
        insert("acosh(");
        break;
    case R.id.asind_Btn:
        insert("asind(");
        break;
    case R.id.sind_Btn:
        insert("sind(");
        break;
    case R.id.asinh_Btn:
        insert("asinh(");
        break;
    case R.id.cosd_Btn:
        insert("cosd(");
        break;
    case R.id.tand_Btn:
        insert("tand(");
        break;
    case R.id.atand_Btn:
        insert("atand(");
        break;
    case R.id.atanh_Btn:
        insert("atanh(");
        break;
            
    case R.id.root_Btn:
        insert("sqrt(");
        break;
            
    case R.id.cbrt_Btn:
        insert("cbrt(");
        break;
            
    case R.id.reciprocal_Btn:
        expression_TV.getText().replace(0, 0, "1/(", 0, 3);
        break;*/

    case R.id.percent_Btn:
        insert("%");
        break;

    /*case R.id.e_Btn:
        insert("2.7182818285");
        break;
            
    case R.id.pi_Btn:
        insert(btnText);
        break;*/

    case R.id.power_Btn:
        insert(btnText);
        break;

    case R.id.equals_Btn:
        done = true;
        evaluate(expression_TV.getText().toString());
        createHistory();
        try {
            expression_TV.setText("");
            insert(result_TV.getText().toString());
            result_TV.setText("0");
        } catch (RuntimeException ee) {
            //
        }
        break;

    /*case R.id.dec_Btn:
        try {
            decBtn.setBackgroundColor(sec_color);
            decBtn.setTextColor(sec_text_color);
            hexBtn.setBackgroundColor(primary_color);
            hexBtn.setTextColor(primary_text_color);
            octBtn.setBackgroundColor(primary_color);
            octBtn.setTextColor(primary_text_color);
            binBtn.setBackgroundColor(primary_color);
            binBtn.setTextColor(primary_text_color);
            decTV.setBackgroundColor(sec_color);
            decTV.setTextColor(sec_text_color);
            hexTV.setBackgroundColor(primary_color);
            hexTV.setTextColor(primary_text_color);
            octTV.setBackgroundColor(primary_color);
            octTV.setTextColor(primary_text_color);
            binTV.setBackgroundColor(primary_color);
            binTV.setTextColor(primary_text_color);
            expression_TV.setText("");
            insert(changeBase(expression, base, Base.DECIMAL));
            base = Base.DECIMAL;
        } catch (SyntaxException S) {
            Toast.makeText(getApplicationContext(), S.toString(), Toast.LENGTH_SHORT).show();
        }
        break;
    case R.id.hex_Btn:
        try {
            decBtn.setBackgroundColor(primary_color);
            decBtn.setTextColor(primary_text_color);
            hexBtn.setBackgroundColor(sec_color);
            hexBtn.setTextColor(sec_text_color);
            octBtn.setBackgroundColor(primary_color);
            octBtn.setTextColor(primary_text_color);
            binBtn.setBackgroundColor(primary_color);
            binBtn.setTextColor(primary_text_color);
            decTV.setBackgroundColor(primary_color);
            decTV.setTextColor(primary_text_color);
            hexTV.setBackgroundColor(sec_color);
            hexTV.setTextColor(sec_text_color);
            octTV.setBackgroundColor(primary_color);
            octTV.setTextColor(primary_text_color);
            binTV.setBackgroundColor(primary_color);
            binTV.setTextColor(primary_text_color);
            expression_TV.setText("");
            insert(changeBase(expression, base, Base.HEXADECIMAL));
            base = Base.HEXADECIMAL;
        } catch (SyntaxException S) {
            Toast.makeText(getApplicationContext(), S.toString(), Toast.LENGTH_SHORT).show();
        }
        break;
    case R.id.oct_Btn:
        try {
            decBtn.setBackgroundColor(primary_color);
            decBtn.setTextColor(primary_text_color);
            hexBtn.setBackgroundColor(primary_color);
            hexBtn.setTextColor(primary_text_color);
            octBtn.setBackgroundColor(sec_color);
            octBtn.setTextColor(sec_text_color);
            binBtn.setBackgroundColor(primary_color);
            binBtn.setTextColor(primary_text_color);
            decTV.setBackgroundColor(primary_color);
            decTV.setTextColor(primary_text_color);
            hexTV.setBackgroundColor(primary_color);
            hexTV.setTextColor(primary_text_color);
            octTV.setBackgroundColor(sec_color);
            octTV.setTextColor(sec_text_color);
            binTV.setBackgroundColor(primary_color);
            binTV.setTextColor(primary_text_color);
            expression_TV.setText("");
            insert(changeBase(expression, base, Base.OCTAL));
            base = Base.OCTAL;
        } catch (SyntaxException S) {
            Toast.makeText(getApplicationContext(), S.toString(), Toast.LENGTH_SHORT).show();
        }
        break;
    case R.id.bin_Btn:
        try {
            decBtn.setBackgroundColor(primary_color);
            decBtn.setTextColor(primary_text_color);
            hexBtn.setBackgroundColor(primary_color);
            hexBtn.setTextColor(primary_text_color);
            octBtn.setBackgroundColor(primary_color);
            octBtn.setTextColor(primary_text_color);
            binBtn.setBackgroundColor(sec_color);
            binBtn.setTextColor(sec_text_color);
            decTV.setBackgroundColor(primary_color);
            decTV.setTextColor(primary_text_color);
            hexTV.setBackgroundColor(primary_color);
            hexTV.setTextColor(primary_text_color);
            octTV.setBackgroundColor(primary_color);
            octTV.setTextColor(primary_text_color);
            binTV.setBackgroundColor(sec_color);
            binTV.setTextColor(sec_text_color);
            expression_TV.setText("");
            insert(changeBase(expression, base, Base.BINARY));
            base = Base.BINARY;
        } catch (SyntaxException S) {
            Toast.makeText(getApplicationContext(), S.toString(), Toast.LENGTH_SHORT).show();
        }
        break;
            
    default:
        break;
    }
    try {
        if (v.getId() != R.id.AC_Btn) {
            result_TV.resizeText();
            try {
                resultant_TV.resizeText();
            } catch (Exception e) {
                //
            }
        }
            
    } catch (Exception eeee) {
        //
    }*/
    }
}