Example usage for android.graphics Color WHITE

List of usage examples for android.graphics Color WHITE

Introduction

In this page you can find the example usage for android.graphics Color WHITE.

Prototype

int WHITE

To view the source code for android.graphics Color WHITE.

Click Source Link

Usage

From source file:com.radicaldynamic.groupinform.activities.LauncherActivity.java

private void displaySplash() {
    // Don't show the splash screen if this app appears to be registered
    if (PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
            .getString(InformOnlineState.DEVICE_ID, null) instanceof String) {
        return;/*from   w  w w . j a v  a2 s. c  o  m*/
    }

    // Fetch the splash screen Drawable
    Drawable image = null;

    try {
        // Attempt to load the configured default splash screen
        // The following code only works in 1.6+
        // BitmapDrawable bitImage = new BitmapDrawable(getResources(), FileUtils.SPLASH_SCREEN_FILE_PATH);
        BitmapDrawable bitImage = new BitmapDrawable(
                FileUtilsExtended.EXTERNAL_FILES + File.separator + FileUtilsExtended.SPLASH_SCREEN_FILE);

        if (bitImage.getBitmap() != null && bitImage.getIntrinsicHeight() > 0
                && bitImage.getIntrinsicWidth() > 0) {
            image = bitImage;
        }
    } catch (Exception e) {
        // TODO: log exception for debugging?
    }

    // TODO: rework
    if (image == null) {
        // no splash provided...
        //            if (FileUtils.storageReady() && !((new File(FileUtils.DEFAULT_CONFIG_PATH)).exists())) {
        // Show the built-in splash image if the config directory 
        // does not exist. Otherwise, suppress the icon.
        image = getResources().getDrawable(R.drawable.gc_color);
        //            }

        if (image == null)
            return;
    }

    // Create ImageView to hold the Drawable...
    ImageView view = new ImageView(getApplicationContext());

    // Initialise it with Drawable and full-screen layout parameters
    view.setImageDrawable(image);

    int width = getWindowManager().getDefaultDisplay().getWidth();
    int height = getWindowManager().getDefaultDisplay().getHeight();

    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(width, height, 0);

    view.setLayoutParams(lp);
    view.setScaleType(ScaleType.CENTER);
    view.setBackgroundColor(Color.WHITE);

    // And wrap the image view in a frame layout so that the full-screen layout parameters are honoured
    FrameLayout layout = new FrameLayout(getApplicationContext());
    layout.addView(view);

    // Create the toast and set the view to be that of the FrameLayout
    mSplashToast = Toast.makeText(getApplicationContext(), "splash screen", Toast.LENGTH_LONG);
    mSplashToast.setView(layout);
    mSplashToast.setGravity(Gravity.CENTER, 0, 0);
    mSplashToast.show();
}

From source file:bikebadger.RideFragment.java

private void updateUI() {

    boolean trackingLocations = mRideManager.isTrackingLocations();
    boolean trackingThisRun = mRideManager.isTrackingRun(mRide);
    boolean mRunNotNull = mRide != null;
    String msg = "";

    Log.d(Constants.APP.TAG, "RideFragment::updateUI");
    if (trackingLocations)
        Log.d(Constants.APP.TAG, "trackingLocations=" + trackingLocations);
    else// w  ww .  j a  va 2s . c  o  m
        Log.d(Constants.APP.TAG, "trackingLocations is FALSE");
    if (trackingThisRun)
        Log.d(Constants.APP.TAG, "trackingThisRun=" + trackingThisRun);
    else
        Log.d(Constants.APP.TAG, "trackingThisRun is FALSE");

    if (mRunNotNull)
        Log.d(Constants.APP.TAG, "mRide is NOT null!");
    else
        Log.d(Constants.APP.TAG, "mRide is NULL!");

    if (mRide != null) {
        mStartedTextView.setText(mRide.getStartDate().toString());
    }

    int durationSeconds = 0;

    if (mRide != null && mLastLocation != null) {
        Log.d(Constants.APP.TAG, "mRide != null && mLastLocation != null");
        mMessagebarView.setTextColor(Color.WHITE);
        //String msg = "mRide != null && mLastLocation != null";
        double bearing1 = mLastLocation.getBearing();
        double bearing2 = mRideManager.mClosestBearing;
        double bearingDif = bearing2 - bearing1;
        if (mRideManager.mClosestWaypoint != null) {
            Log.d(Constants.APP.TAG, "mRideManager.mClosestWaypoint != null");

            if (mRideManager.mClosestWaypoint.IsTriggered()) {
                mMessagebarView.setTextColor(Color.RED);
                msg = "\"" + mRideManager.mClosestWaypoint.getName() + "\"";
                msg += " (Active)";
                Bitmap activeBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_triggered);
                mArrowView.setImageBitmap(activeBitmap);
            } else {
                mMessagebarView.setTextColor(Color.WHITE);
                msg = "\"" + mRideManager.mClosestWaypoint.getName() + "\"";
                msg += " at ";
                msg += Formatter.FormatDistanceMiles(mRideManager.mClosestDistance);
                //msg += " ft";
                //msg += " (" + Formatter.FormatDecimal(bearing1) + "->";
                // msg += Formatter.FormatDecimal(bearing2) + ":" + Formatter.FormatDecimal(bearingDif);
                // Point the arrow to the bearing of the closest waypoint...
                Bitmap myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_arrow_white);
                Matrix matrix = new Matrix();
                matrix.postRotate((float) (bearingDif));
                final int width = myBitmap.getWidth();
                final int height = myBitmap.getHeight();
                Log.d(Constants.APP.TAG, "myBitmap.getWidth=" + myBitmap.getWidth() + "myBitmap.getHeight="
                        + myBitmap.getHeight());
                Bitmap rotatedBitmap = Bitmap.createBitmap(myBitmap, 0, 0, width, height, matrix, true);
                mArrowView.setImageBitmap(rotatedBitmap);
            }
        }

        // set the top message line
        mMessagebarView.setText(msg);

        durationSeconds = mRide.StopwatchSeconds();
        mSpeedTextView.setText(Formatter.FormatDecimal(mLastLocation.getSpeed() * Ride.METERS_TO_MILES));
        mTargetSpeedTextView.setText(Formatter.FormatDecimal(mRide.GetTargetAvgSpeed()));
        mAverageSpeedTextView.setText(Formatter.FormatDecimal(mRide.GetAverageSpeed()));
        mDurationTextView.setText(Formatter.FormatDuration(durationSeconds));

    } else if (mRide == null && mLastLocation == null) {
        Log.d(Constants.APP.TAG, "mRide == null && mLastLocation == null");
        mTargetSpeedTextView.setText(Formatter.FormatDecimal(mRideManager.GetDefaultTargetAvgSpeed()));

        mMessagebarView.setTextColor(Color.WHITE);
        if (mRideManager.WaypointsLoaded()) {
            mMessagebarView.setText("\"" + mRideManager.GetGPXFileName() + "\" loaded ("
                    + mRideManager.mWaypoints.size() + ")");
        }
    } else if (mRide != null && mLastLocation == null) { // mLastLocation is null
        mMessagebarView.setTextColor(Color.RED);
        mMessagebarView.setText("Waiting on GPS...");
    } else if (mRide == null && mLastLocation != null) {
        Log.d(Constants.APP.TAG, "mRide == null && mLastLocation != null");
    }

    if (!trackingThisRun) {
        mStartStopButton.setBackgroundResource(R.drawable.ic_button_white_play);
        mStartStopButton.setOnClickListener(mPlayButtonClickListener);
    }

    if (trackingThisRun) {
        mStartStopButton.setBackgroundResource(R.drawable.ic_button_white_pause);
        mStartStopButton.setOnClickListener(mPauseButtonClickListener);
    }

    //mStartButton.setEnabled(!started);
    mResetButton.setEnabled(trackingLocations && trackingThisRun);
    mWaypointButton.setEnabled(trackingLocations);
    //mTargetEditButton.setEnabled(trackingLocations && trackingThisRun);
}

From source file:com.aware.Aware.java

/**
 * Given a plugin's package name, fetch the context card for reuse.
 * @param context: application context//from   ww w  .  ja va 2s .  c o  m
 * @param package_name: plugin's package name
 * @return View for reuse (instance of LinearLayout)
 */
public static View getContextCard(final Context context, final String package_name) {

    if (!isClassAvailable(context, package_name, "ContextCard")) {
        return null;
    }

    String ui_class = package_name + ".ContextCard";
    LinearLayout card = new LinearLayout(context);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    card.setLayoutParams(params);
    card.setOrientation(LinearLayout.VERTICAL);

    try {
        Context packageContext = context.createPackageContext(package_name,
                Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);

        Class<?> fragment_loader = packageContext.getClassLoader().loadClass(ui_class);
        Object fragment = fragment_loader.newInstance();
        Method[] allMethods = fragment_loader.getDeclaredMethods();
        Method m = null;
        for (Method mItem : allMethods) {
            String mName = mItem.getName();
            if (mName.contains("getContextCard")) {
                mItem.setAccessible(true);
                m = mItem;
                break;
            }
        }

        View ui = (View) m.invoke(fragment, packageContext);
        if (ui != null) {
            //Check if plugin has settings. If it does, tapping the card shows the settings
            if (isClassAvailable(context, package_name, "Settings")) {
                ui.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent open_settings = new Intent();
                        open_settings.setClassName(package_name, package_name + ".Settings");
                        open_settings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        context.startActivity(open_settings);
                    }
                });
            }

            //Set card look-n-feel
            ui.setBackgroundColor(Color.WHITE);
            ui.setPadding(20, 20, 20, 20);
            card.addView(ui);

            LinearLayout shadow = new LinearLayout(context);
            LayoutParams params_shadow = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
            params_shadow.setMargins(0, 0, 0, 10);
            shadow.setBackgroundColor(context.getResources().getColor(R.color.card_shadow));
            shadow.setMinimumHeight(5);
            shadow.setLayoutParams(params_shadow);
            card.addView(shadow);

            return card;
        } else {
            return null;
        }
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.paic.zhifu.wallet.activity.modules.boundcard.OpenPaymentConfirmActivity.java

/**
 * ?/*  w  w  w. ja  v a 2 s .co  m*/
 */
private void checkAndChangeNextBtnState() {
    // ?????????
    if (!checkPhoneNum() || !checkLicense() || !checkSMSCode()) {
        next_btn.setBackgroundResource(R.drawable.normal_btn2);
        next_btn.setTextColor(Color.BLACK);
        next_btn.setEnabled(false);
    } else {
        next_btn.setBackgroundResource(R.drawable.normal_btn);
        next_btn.setTextColor(Color.WHITE);
        next_btn.setEnabled(true);
    }
}

From source file:com.application.akscorp.yandextranslator2017.TranslateScreen.java

/**
 * This method use for notify user about error
 *
 * @param Message/*from w  w w . ja  v a2 s.  c o m*/
 * @param ButtonText
 * @param action
 */
private void ShowErrorMessage(String Message, String ButtonText, final Runnable action) {

    ErrorSnackBar = Snackbar.make(getActivity().findViewById(R.id.activity_start_screen), Message,
            Snackbar.LENGTH_INDEFINITE);
    ErrorSnackBar.setAction(ButtonText, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            action.run();
            ErrorSnackBar.dismiss();
        }
    });

    View snackbarView = ErrorSnackBar.getView();
    snackbarView.setBackgroundColor(Color.WHITE);
    TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);
    textView.setMaxLines(4);
    ErrorSnackBar.show();

}

From source file:com.fvd.nimbus.PaintActivity.java

private int colorToId(int c) {
    int res = 0;//from ww  w. j  av a2s  .c  o m
    switch (c) {
    case Color.CYAN:
        res = 2;
        break;
    case Color.RED:
        res = 5;
        break;
    case Color.GREEN:
        res = 3;
        break;
    case Color.WHITE:
        res = 0;
        break;
    case Color.BLACK:
        res = 7;
        break;
    }
    return res;
}

From source file:net.droidsolutions.droidcharts.core.plot.CategoryPlot.java

/**
 * Creates a new plot.//from  w w w  . j  a  v a 2s .  com
 * 
 * @param dataset
 *            the dataset (<code>null</code> permitted).
 * @param domainAxis
 *            the domain axis (<code>null</code> permitted).
 * @param rangeAxis
 *            the range axis (<code>null</code> permitted).
 * @param renderer
 *            the item renderer (<code>null</code> permitted).
 * 
 */
public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis, ValueAxis rangeAxis,
        CategoryItemRenderer renderer) {

    super();

    this.orientation = PlotOrientation.VERTICAL;

    // allocate storage for dataset, axes and renderers
    this.domainAxes = new ObjectList();
    this.domainAxisLocations = new ObjectList();
    this.rangeAxes = new ObjectList();
    this.rangeAxisLocations = new ObjectList();

    this.datasetToDomainAxesMap = new TreeMap();
    this.datasetToRangeAxesMap = new TreeMap();

    this.renderers = new ObjectList();

    this.datasets = new ObjectList();
    this.datasets.set(0, dataset);

    this.axisOffset = RectangleInsets.ZERO_INSETS;

    setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT, false);
    setRangeAxisLocation(AxisLocation.TOP_OR_LEFT, false);

    this.renderers.set(0, renderer);
    if (renderer != null) {
        renderer.setPlot(this);
        renderer.addChangeListener(this);
    }

    this.domainAxes.set(0, domainAxis);
    this.mapDatasetToDomainAxis(0, 0);
    if (domainAxis != null) {
        domainAxis.setPlot(this);
    }
    this.drawSharedDomainAxis = false;

    this.rangeAxes.set(0, rangeAxis);
    this.mapDatasetToRangeAxis(0, 0);
    if (rangeAxis != null) {
        rangeAxis.setPlot(this);
    }

    configureDomainAxes();
    configureRangeAxes();

    this.domainGridlinesVisible = DEFAULT_DOMAIN_GRIDLINES_VISIBLE;
    this.domainGridlinePosition = CategoryAnchor.MIDDLE;
    this.domainGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.domainGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeZeroBaselineVisible = false;
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.BLACK);
    this.rangeZeroBaselinePaint = paint;
    this.rangeZeroBaselineStroke = .5f;

    this.rangeGridlinesVisible = DEFAULT_RANGE_GRIDLINES_VISIBLE;
    this.rangeGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    this.rangeGridlinePaint = DEFAULT_GRIDLINE_PAINT;

    this.rangeMinorGridlinesVisible = false;
    this.rangeMinorGridlineStroke = DEFAULT_GRIDLINE_STROKE;
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.WHITE);
    this.rangeMinorGridlinePaint = paint;

    this.foregroundDomainMarkers = new HashMap();
    this.backgroundDomainMarkers = new HashMap();
    this.foregroundRangeMarkers = new HashMap();
    this.backgroundRangeMarkers = new HashMap();

    this.anchorValue = 0.0;

    this.domainCrosshairVisible = false;
    this.domainCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.domainCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.rangeCrosshairVisible = DEFAULT_CROSSHAIR_VISIBLE;
    this.rangeCrosshairValue = 0.0;
    this.rangeCrosshairStroke = DEFAULT_CROSSHAIR_STROKE;
    this.rangeCrosshairPaint = DEFAULT_CROSSHAIR_PAINT;

    this.annotations = new java.util.ArrayList();

    this.rangePannable = false;
}

From source file:com.dragon4.owo.ar_trace.ARCore.MixView.java

@Override
protected void onResume() {
    super.onResume();

    try {//from   w ww.  j  a va2  s .  c o m
        this.mWakeLock.acquire(); // ?? ?

        killOnError(); // ?  ?
        mixContext.mixView = this; // ??  
        dataView.doStart(); // ?? 
        dataView.clearEvents(); // ? ?

        double angleX, angleY; // ? x, y

        /*? ?  ? */
        angleX = Math.toRadians(-90);
        m1.set(1f, 0f, 0f, 0f, (float) Math.cos(angleX), (float) -Math.sin(angleX), 0f,
                (float) Math.sin(angleX), (float) Math.cos(angleX));

        angleX = Math.toRadians(-90);
        angleY = Math.toRadians(-90);
        m2.set(1f, 0f, 0f, 0f, (float) Math.cos(angleX), (float) -Math.sin(angleX), 0f,
                (float) Math.sin(angleX), (float) Math.cos(angleX));
        m3.set((float) Math.cos(angleY), 0f, (float) Math.sin(angleY), 0f, 1f, 0f, (float) -Math.sin(angleY),
                0f, (float) Math.cos(angleY));

        m4.toIdentity();

        for (int i = 0; i < histR.length; i++) {
            histR[i] = new Matrix();
        }
        /*   */

        //  ? 
        sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);

        // ?  ?
        // ?? 
        sensors = sensorMgr.getSensorList(Sensor.TYPE_ACCELEROMETER);
        if (sensors.size() > 0) {
            sensorGrav = sensors.get(0);
        }

        // ? 
        sensors = sensorMgr.getSensorList(Sensor.TYPE_MAGNETIC_FIELD);
        if (sensors.size() > 0) {
            sensorMag = sensors.get(0);
        }
        //// TODO: 2016-06-01
        if (sensors.size() > 0) {
            sensors = sensorMgr_ori.getSensorList(Sensor.TYPE_ORIENTATION);
            orientationSensor = sensors.get(0);
        }
        //  ??  ? ? ? ?
        sensorMgr.registerListener(this, sensorGrav, SENSOR_DELAY_GAME);
        sensorMgr.registerListener(this, sensorMag, SENSOR_DELAY_GAME);

        if (orientationSensor != null) {
            sensorMgr_ori.registerListener(this, orientationSensor, sensorMgr_ori.SENSOR_DELAY_GAME);
        }

        try {
            // ?? (Criteria)
            // http://developer.android.com/reference/android/location/Criteria.html
            Criteria c = new Criteria();

            // ? 
            c.setAccuracy(Criteria.ACCURACY_FINE);
            //c.setBearingRequired(true);

            // ?  
            locationMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
            // ?? ? ?  ? . 2 , 3 
            locationMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 4, this);

            // ?? ? ,   
            String bestP = locationMgr.getBestProvider(c, true);
            isGpsEnabled = locationMgr.isProviderEnabled(bestP);

            // gps, ? ? ?   
            Location hardFix = new Location("reverseGeocoded");

            try {
                //  ? gps, ??     
                Location gps = locationMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                Location network = locationMgr.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

                //  ?  ?   
                //  gps > ? > 
                if (gps != null)
                    mixContext.curLoc = gps;
                else if (network != null)
                    mixContext.curLoc = network;
                else
                    mixContext.curLoc = hardFix;

            } catch (Exception ex2) { //  ? 
                ex2.printStackTrace(); //  
                mixContext.curLoc = hardFix; //   
            }
            // ? ?  ??  
            mixContext.setLocationAtLastDownload(mixContext.curLoc);

            // ?? .   ?   
            GeomagneticField gmf = new GeomagneticField((float) mixContext.curLoc.getLatitude(),
                    (float) mixContext.curLoc.getLongitude(), (float) mixContext.curLoc.getAltitude(),
                    System.currentTimeMillis());

            // ??   
            angleY = Math.toRadians(-gmf.getDeclination());
            m4.set((float) Math.cos(angleY), 0f, (float) Math.sin(angleY), 0f, 1f, 0f,
                    (float) -Math.sin(angleY), 0f, (float) Math.cos(angleY));
            mixContext.declination = gmf.getDeclination();
        } catch (Exception ex) {
            Log.d("mixare", "GPS Initialize Error", ex); //  ? 
        }
        //  ? 
        downloadThread = new Thread(mixContext.downloadManager);
        downloadThread.start();

    } catch (Exception ex) {
        doError(ex); // ? 

        try {
            // ???  
            if (sensorMgr != null) {
                sensorMgr.unregisterListener(this, sensorGrav);
                sensorMgr.unregisterListener(this, sensorMag);
                sensorMgr = null;
            }
            //  ??   
            if (locationMgr != null) {
                locationMgr.removeUpdates(this);
                locationMgr = null;
            }
            // ??  ?? 
            if (mixContext != null) {
                if (mixContext.downloadManager != null)
                    mixContext.downloadManager.stop();
            }
        } catch (Exception ignore) {
        }
    }

    //  ?? 
    // ??   ? ( ?? ) ?    
    if (dataView.isFrozen() && searchNotificationTxt == null) {
        searchNotificationTxt = new TextView(this);
        searchNotificationTxt.setWidth(dWindow.getWidth());
        searchNotificationTxt.setPadding(10, 2, 0, 0);
        searchNotificationTxt.setBackgroundColor(Color.DKGRAY);
        searchNotificationTxt.setTextColor(Color.WHITE);

        searchNotificationTxt.setOnTouchListener(this);
        addContentView(searchNotificationTxt,
                new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    } else if (!dataView.isFrozen() && searchNotificationTxt != null) {
        searchNotificationTxt.setVisibility(View.GONE);
        searchNotificationTxt = null;
    }
}

From source file:com.mdlive.sav.MDLiveProviderDetails.java

/**
 *  Successful Response Handler for Load Provider Info.Here the Profile image of
 *  the Particular provider will be displayed.Along with that the Provider's
 *  speciality,about the Provider , license and the languages will also be
 *  displayed.Along with this Provider's affilitations will also be displayed
 *
 *///from  w w w.  ja  va  2 s .c om
private void handleSuccessResponse(JSONObject response) {
    // DEBUGGING.  o.uwechue
    Log.d("MDLProviderDetails", "*********\nHTTP Response: " + response);
    try {
        //Fetch Data From the Services
        Log.d("Response details", "******************\n*******************\n" + response.toString());
        JsonParser parser = new JsonParser();
        JsonObject responObj = (JsonObject) parser.parse(response.toString());
        JsonObject profileobj = responObj.get("doctor_profile").getAsJsonObject();
        JsonObject providerdetObj = profileobj.get("provider_details").getAsJsonObject();

        JsonObject appointment_slot = profileobj.get("appointment_slot").getAsJsonObject();
        JsonArray available_hour = appointment_slot.get("available_hour").getAsJsonArray();

        boolean isDoctorWithPatient = false;
        LinearLayout layout = (LinearLayout) findViewById(R.id.panelMessageFiles);
        String str_timeslot = ""; /*str_phys_avail_id = "",*/
        SharedPreferences sharedpreferences = getSharedPreferences(PreferenceConstants.MDLIVE_USER_PREFERENCES,
                Context.MODE_PRIVATE);
        str_Availability_Type = sharedpreferences
                .getString(PreferenceConstants.PROVIDER_AVAILABILITY_TYPE_PREFERENCES, "");
        String str_avail_status = sharedpreferences
                .getString(PreferenceConstants.PROVIDER_AVAILABILITY_STATUS_PREFERENCES, "");
        if (str_avail_status.equalsIgnoreCase("true")) {
            if (str_Availability_Type.equalsIgnoreCase("video or phone")) {
                isDoctorAvailableNow = true;
            } else if (str_Availability_Type.equalsIgnoreCase("phone")) {
                isDoctorAvailableNow = true;
            } else if (str_Availability_Type.equalsIgnoreCase("video")) {
                isDoctorAvailableNow = true;
            }

            else if (str_Availability_Type.equalsIgnoreCase("With Patient")) {
                isDoctorAvailableNow = false;
            } else {
                isDoctorAvailableNow = false;
            }
        } else {
            isDoctorAvailableNow = false;
        }

        if (layout.getChildCount() > 0) {
            layout.removeAllViews();
        }
        videoList.clear();
        phoneList.clear();

        for (int i = 0; i < available_hour.size(); i++) {
            JsonObject availabilityStatus = available_hour.get(i).getAsJsonObject();
            String str_availabilityStatus = "";

            if (MdliveUtils.checkJSONResponseHasString(availabilityStatus, "status")) {
                str_availabilityStatus = availabilityStatus.get("status").getAsString();
                if (str_availabilityStatus.equals("Available")) {
                    JsonArray timeSlotArray = availabilityStatus.get("time_slot").getAsJsonArray();
                    for (int j = 0; j < timeSlotArray.size(); j++) {
                        JsonObject timeSlotObj = timeSlotArray.get(j).getAsJsonObject();

                        if (MdliveUtils.checkJSONResponseHasString(timeSlotObj, "appointment_type")
                                && MdliveUtils.checkJSONResponseHasString(timeSlotObj, "timeslot")) {
                            str_appointmenttype = timeSlotObj.get("appointment_type").getAsString();
                            str_timeslot = timeSlotObj.get("timeslot").getAsString();
                            selectedTimestamp = timeSlotObj.get("timeslot").getAsString();
                            Log.d("***TIMESLOT***", "****\n****\nTimeslot: [" + selectedTimestamp + "]");

                            if (MdliveUtils.checkJSONResponseHasString(timeSlotObj, "phys_availability_id")) {
                                str_phys_avail_id = timeSlotObj.get("phys_availability_id").getAsString();
                            } else {
                                str_phys_avail_id = null;
                            }

                            HashMap<String, String> map = new HashMap<String, String>();
                            map.put("timeslot", str_timeslot);
                            map.put("phys_id", (str_phys_avail_id == null) ? "" : str_phys_avail_id + "");
                            map.put("appointment_type", str_appointmenttype);

                            timeSlotListMap.add(map);
                            if (str_timeslot.equals("0")) {
                                if (!str_Availability_Type.equalsIgnoreCase("With Patient")) {
                                    final int density = (int) getBaseContext().getResources()
                                            .getDisplayMetrics().density;

                                    final Button myText = new Button(MDLiveProviderDetails.this);
                                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                                        myText.setElevation(0f);
                                    }
                                    isDoctorAvailableNow = true;
                                    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                                            LinearLayout.LayoutParams.WRAP_CONTENT,
                                            LinearLayout.LayoutParams.WRAP_CONTENT);
                                    params.setMargins(4 * density, 4 * density, 4 * density, 4 * density);
                                    myText.setLayoutParams(params);
                                    myText.setGravity(Gravity.CENTER);
                                    myText.setTextColor(Color.WHITE);
                                    myText.setTextSize(16);
                                    myText.setPadding(8 * density, 4 * density, 8 * density, 4 * density);
                                    myText.setBackgroundResource(R.drawable.timeslot_white_rounded_corner);
                                    myText.setText("Now");
                                    myText.setBackgroundResource(R.drawable.timeslot_blue_rounded_corner);
                                    myText.setClickable(true);
                                    previousSelectedTv = myText;
                                    if (str_appointmenttype.toLowerCase().contains("video")) {
                                        videoList.add(myText);
                                    }
                                    if (str_appointmenttype.toLowerCase().contains("phone")) {
                                        phoneList.add(myText);
                                    }
                                    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                                            LinearLayout.LayoutParams.WRAP_CONTENT,
                                            LinearLayout.LayoutParams.WRAP_CONTENT);
                                    lp.setMargins(4 * density, 4 * density, 4 * density, 4 * density);
                                    myText.setLayoutParams(lp);
                                    myText.setTag("Now");
                                    defaultNowTextPreferences(myText, str_appointmenttype);
                                    selectedTimeslot = true;
                                    clickEventForHorizontalText(myText, str_timeslot, str_phys_avail_id);
                                    layout.addView(myText);
                                    //layout.addView(line, 1);
                                }
                            } else {
                                setHorizontalScrollviewTimeslots(layout, str_timeslot, j, str_phys_avail_id);
                            }
                        }
                    }
                } else if (str_availabilityStatus.equalsIgnoreCase("With patient")) {
                    isDoctorWithPatient = true;
                }
            }
        }

        //with patient
        if (isDoctorWithPatient) {
            if (layout.getChildCount() >= 1) {
                // Req Future Appmt

                enableOrdisableProviderDetails(str_Availability_Type);
            } else if (layout.getChildCount() < 1) {
                //Make future appointment
                onlyWithPatient();

            }
        }

        /*This is for Status is available and the timeslot is Zero..Remaining all
            the status were not available.*/
        //Available now only
        else if (isDoctorAvailableNow && layout.getChildCount() < 1) {

            horizontalscrollview.setVisibility(View.GONE);
            findViewById(R.id.dateTxtLayout).setVisibility(View.GONE);
            if (str_Availability_Type.equalsIgnoreCase("video")) {
                onlyVideo();

            } else if (str_Availability_Type.equalsIgnoreCase("video or phone")) {
                VideoOrPhoneNotAvailable();
            } else if (str_Availability_Type.equalsIgnoreCase("phone")) {
                onlyPhone();
            } else if (str_Availability_Type.equalsIgnoreCase("With Patient")) {
                onlyWithPatient();
            }

        }

        //Available now and later
        //Part1 ----> timeslot zero followed by many timeslots
        else if (isDoctorAvailableNow && layout.getChildCount() >= 1) {
            enableOrdisableProviderDetails(str_Availability_Type);

        }
        //part 2 available ly later
        //Part2 ----> timeslot not zero followed by many timeslots
        else if (!isDoctorAvailableNow && layout.getChildCount() >= 1) {
            availableOnlyLater(str_Availability_Type);

        }

        //not available

        else if (layout.getChildCount() == 0 && str_Availability_Type.equals("not available")) {
            if (str_appointmenttype.equals("1")) {
                notAvailable();
            } else if (str_appointmenttype.equals("2")) {
                notAvailable();
            } else {
                notAvailable();
            }
        }

        //not available
        else if (layout.getChildCount() == 0) {
            horizontalscrollview.setVisibility(View.GONE);
            findViewById(R.id.dateTxtLayout).setVisibility(View.GONE);
            if (str_Availability_Type.equalsIgnoreCase("video")) {
                onlyVideo();

            } else if (str_Availability_Type.equalsIgnoreCase("video or phone")) {
                VideoOrPhoneNotAvailable();
            } else if (str_Availability_Type.equalsIgnoreCase("phone")) {
                onlyPhone();
            } else if (str_Availability_Type.equalsIgnoreCase("With patient")) {
                onlyWithPatient();
            } else if (str_Availability_Type.equalsIgnoreCase("not available")) {
                //Make future appointment only
                notAvailable();
            }
        }

        setResponseQualificationDetails(providerdetObj, str_Availability_Type);

    } catch (Exception e) {
        e.printStackTrace();
    }

}