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.hypodiabetic.happ.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    activity = this;
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    ins = this;//from  w  w  w .  java  2 s . com
    PreferenceManager.setDefaultValues(this, R.xml.pref_aps, false); //Sets default APS Preferences if the user has not

    //xdrip start
    prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    checkEula();

    startService(new Intent(getApplicationContext(), DataCollectionService.class));

    PreferenceManager.setDefaultValues(this, R.xml.pref_general, false);
    PreferenceManager.setDefaultValues(this, R.xml.pref_bg_notification, false);
    //xdrip end

    setContentView(R.layout.activity_main);
    extendedGraphBuilder = new ExtendedGraphBuilder(this);

    //Setup menu
    tickWhite = getDrawable(R.drawable.checkbox_marked_circle);
    clockWhite = getDrawable(R.drawable.clock);
    tickWhite.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
    clockWhite.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);

    insulinIntegrationApp_status = (TextView) findViewById(R.id.insulinIntegrationApp_status);
    insulinIntegrationApp_icon = (ImageView) findViewById(R.id.insulinIntegrationApp_icon);
    mDrawerList = (ListView) findViewById(R.id.navList);
    String[] osArray = { "Cancel Temp", "Settings", "Integration Report" };
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, osArray);
    mDrawerList.setAdapter(mAdapter);
    mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                pumpAction.cancelTempBasal(MainActivity.activity);
                break;
            case 1:
                startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
                break;
            case 2:
                startActivity(new Intent(getApplicationContext(), Integration_Report.class));
                break;
            }
            mDrawerLayout.closeDrawers();
        }
    });
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLinear = (LinearLayout) findViewById(R.id.left_drawer);
    mActivityTitle = getTitle().toString();
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open,
            R.string.drawer_close) {
        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.getInstace());
            Date now = new Date();
            Profile p = new Profile(now, MainActivity.getInstace());
            //Local device based Integrations
            String insulin_Integration_App = prefs.getString("insulin_integration", "");

            //Insulin Integration App, try and connect
            if (!insulin_Integration_App.equals("")) {
                InsulinIntegrationApp insulinIntegrationApp = new InsulinIntegrationApp(
                        MainActivity.getInstace(), insulin_Integration_App, "TEST");
                insulinIntegrationApp.connectInsulinTreatmentApp();
                insulinIntegrationApp_status.setText("Connecting...");
                insulinIntegrationApp_icon.setBackground(clockWhite);

                //listens out for connection
                insulinIntegrationAppUpdate = new BroadcastReceiver() {
                    @Override
                    public void onReceive(Context context, Intent intent) {
                        insulinIntegrationApp_status.setText(intent.getStringExtra("MSG"));
                        insulinIntegrationApp_icon.setBackground(tickWhite);

                    }
                };
                LocalBroadcastManager.getInstance(MainActivity.getInstace()).registerReceiver(
                        insulinIntegrationAppUpdate, new IntentFilter("INSULIN_INTEGRATION_TEST"));
            } else {
                insulinIntegrationApp_status.setText("No app selected or not in Closed Loop");
                insulinIntegrationApp_icon.setBackgroundResource(R.drawable.alert_circle);
            }
        }

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    mDrawerToggle.syncState();
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    // Create the adapter that will return a fragment for each of the 4 primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) this.findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    //mViewPager.setOffscreenPageLimit(4);                                                        //Do not destroy any Fragments, // TODO: 14/09/2015 casues an issue with bvb chart rendering, not sure why
    //Build Fragments
    openAPSFragmentObject = new openAPSFragment();
    iobcobActiveFragmentObject = new iobcobActiveFragment();
    iobcobFragmentObject = new iobcobFragment();
    basalvsTempBasalObject = new basalvsTempBasalFragment();

    //Updates notifications every 60 seconds
    updateEvery60Seconds = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            APSResult apsResult = APSResult.last();
            Notifications.updateCard(context, apsResult);
        }
    };
    registerReceiver(updateEvery60Seconds, new IntentFilter(Intent.ACTION_TIME_TICK));

}

From source file:com.esri.android.ecologicalmarineunitexplorer.chartsummary.SummaryChartFragment.java

/**
 * Build out the charts for given dataset
 * @param id - int representing chart id
 * @param data - CombinedData displayed in the chart
 *///from  ww  w  . j a v a 2  s. co m
private void prepareChartView(final int id, final CombinedData data) {
    final CombinedChart chart = (CombinedChart) mRoot.findViewById(id);
    chart.getPaint(Chart.PAINT_DESCRIPTION).setTextAlign(Paint.Align.CENTER);
    chart.getXAxis().setEnabled(false);
    chart.getAxisRight().setEnabled(false);
    chart.getAxisLeft().setDrawGridLines(false);
    chart.getDescription().setEnabled(false);
    chart.getLegend().setEnabled(false);
    chart.setBackgroundColor(Color.WHITE);
    chart.setDrawGridBackground(false);

    chart.setData(data);
    chart.invalidate();
}

From source file:com.duy.pascal.ui.view.console.ConsoleView.java

private void init(Context context) {
    mContext = context;//from  w  w  w.  j  av a 2 s. com
    mGestureDetector = new GestureDetectorCompat(getContext(), this);
    mGestureDetector.setOnDoubleTapListener(this);

    mPascalPreferences = new PascalPreferences(context);

    mAntiAlias = mPascalPreferences.useAntiAlias();

    mGraphScreen = new GraphScreen(context, this);
    mGraphScreen.setAntiAlias(mAntiAlias);

    mConsoleScreen = new ConsoleScreen(mPascalPreferences);
    mConsoleScreen.setBackgroundColor(Color.BLACK);

    mTextRenderer = new TextRenderer(
            getTextSize(TypedValue.COMPLEX_UNIT_SP, mPascalPreferences.getConsoleTextSize()));
    mTextRenderer.setTypeface(mPascalPreferences.getConsoleFont());
    mTextRenderer.setTextColor(Color.WHITE);
    mTextRenderer.setAntiAlias(mAntiAlias);

    firstLine = 0;
    mScreenBufferData.firstIndex = 0;
    mScreenBufferData.textConsole = null;

    mCursor = new ConsoleCursor(0, 0, Color.DKGRAY);
    mCursor.setCoordinate(0, 0);
    mCursor.setCursorBlink(true);
    mCursor.setVisible(true);
}

From source file:mobisocial.musubi.ui.fragments.FeedViewFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    WizardStepHandler.accomplishTask(mActivity, WizardStepHandler.TASK_OPEN_FEED);
    mSendTextButton = (Button) view.findViewById(R.id.send_text);
    mSendTextButton.setOnClickListener(mSendStatus);
    mSendTextButton.setEnabled(false);/*  w  ww. j a  va2  s. c  o m*/

    mStatusText = (EditText) view.findViewById(R.id.status_text);
    mStatusText.setOnEditorActionListener(FeedViewFragment.this);
    mStatusText.addTextChangedListener(FeedViewFragment.this);

    view.findViewById(R.id.pick_app).setOnClickListener(mPickApp);

    mInputBar = (View) view.findViewById(R.id.input_bar);
    mInputBar.setBackgroundColor(Color.WHITE);

    mListView = getListView();
    mListView.setFastScrollEnabled(true);
    mListView.setOnItemClickListener(mItemClickListener);
    mListView.setOnItemLongClickListener(mItemLongClickListener);
    mListView.setOnScrollListener(this);
    mListView.setFocusable(true);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(0,
            RelativeLayout.LayoutParams.FILL_PARENT);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

    ((MusubiBaseActivity) getActivity()).setOnKeyListener(this);
}

From source file:br.comoferta.ui.view.SlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.//ww  w .  j a v  a2s.c o  m
 */
protected TextView createDefaultTabView(Context context) {
    ColorStateList colorStateList = new ColorStateList(new int[][] {
            new int[] { android.R.attr.state_selected }, new int[] { -android.R.attr.state_selected }, },
            new int[] { Color.WHITE, Color.LTGRAY });

    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTextColor(colorStateList);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}

From source file:com.kabootar.GlassMemeGenerator.ImageOverlay.java

/**
 * Draws the given string centered, as big as possible, on either the top or
 * bottom 20% of the image given.//from  www . java2  s.  c o  m
 */
private static void drawStringCentered(Canvas g, String text, Bitmap image, boolean top, Context baseContext)
        throws InterruptedException {
    if (text == null)
        text = "";

    int height = 0;
    int fontSize = MAX_FONT_SIZE;
    int maxCaptionHeight = image.getHeight() / 5;
    int maxLineWidth = image.getWidth() - SIDE_MARGIN * 2;
    String formattedString = "";
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);

    Paint stkPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    stkPaint.setStyle(STROKE);
    stkPaint.setStrokeWidth(8);
    stkPaint.setColor(Color.BLACK);

    //Typeface tf = Typeface.create("Arial", Typeface.BOLD);
    Typeface tf = Typeface.createFromAsset(baseContext.getAssets(), "fonts/impact.ttf");

    paint.setTypeface(tf);
    stkPaint.setTypeface(tf);
    do {

        paint.setTextSize(fontSize);

        // first inject newlines into the text to wrap properly
        StringBuilder sb = new StringBuilder();
        int left = 0;
        int right = text.length() - 1;
        while (left < right) {

            String substring = text.substring(left, right + 1);
            Rect stringBounds = new Rect();
            paint.getTextBounds(substring, 0, substring.length(), stringBounds);
            while (stringBounds.width() > maxLineWidth) {
                if (Thread.currentThread().isInterrupted()) {
                    throw new InterruptedException();
                }

                // look for a space to break the line
                boolean spaceFound = false;
                for (int i = right; i > left; i--) {
                    if (text.charAt(i) == ' ') {
                        right = i - 1;
                        spaceFound = true;
                        break;
                    }
                }
                substring = text.substring(left, right + 1);
                paint.getTextBounds(substring, 0, substring.length(), stringBounds);

                // If we're down to a single word and we are still too wide,
                // the font is just too big.
                if (!spaceFound && stringBounds.width() > maxLineWidth) {
                    break;
                }
            }
            sb.append(substring).append("\n");
            left = right + 2;
            right = text.length() - 1;
        }

        formattedString = sb.toString();

        // now determine if this font size is too big for the allowed height
        height = 0;
        for (String line : formattedString.split("\n")) {
            Rect stringBounds = new Rect();
            paint.getTextBounds(line, 0, line.length(), stringBounds);
            height += stringBounds.height();
        }
        fontSize--;
    } while (height > maxCaptionHeight);

    // draw the string one line at a time
    int y = 0;
    if (top) {
        y = TOP_MARGIN;
    } else {
        y = image.getHeight() - height - BOTTOM_MARGIN;
    }
    for (String line : formattedString.split("\n")) {
        // Draw each string twice for a shadow effect
        Rect stringBounds = new Rect();
        paint.getTextBounds(line, 0, line.length(), stringBounds);
        //paint.setColor(Color.BLACK);
        //g.drawText(line, (image.getWidth() - (int) stringBounds.width()) / 2 + 2, y + stringBounds.height() + 2, paint);

        paint.setColor(Color.WHITE);
        g.drawText(line, (image.getWidth() - (int) stringBounds.width()) / 2, y + stringBounds.height(), paint);

        //stroke
        Rect strokeBounds = new Rect();
        stkPaint.setTextSize(fontSize);
        stkPaint.getTextBounds(line, 0, line.length(), strokeBounds);
        g.drawText(line, (image.getWidth() - (int) strokeBounds.width()) / 2, y + strokeBounds.height(),
                stkPaint);

        y += stringBounds.height();
    }
}

From source file:com.edicon.activity.fit.HistoryActivity.java

/**
 *  Initialize a custom log class that outputs both to in-app targets and logcat.
 *///from   w  w w .  ja v  a2s  . c o m
private void initializeLogging() {
    // Wraps Android's native log framework.
    LogWrapper logWrapper = new LogWrapper();
    // Using Log, front-end to the logging chain, emulates android.util.log method signatures.
    Log.setLogNode(logWrapper);
    // Filter strips out everything except the message text.
    MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter();
    logWrapper.setNext(msgFilter);
    // On screen logging via a customized TextView.
    LogView logView = (LogView) findViewById(R.id.sample_logview);

    // Fixing this lint error adds logic without benefit.
    //noinspection AndroidLintDeprecation
    logView.setTextAppearance(this, R.style.Log);

    logView.setBackgroundColor(Color.WHITE);
    msgFilter.setNext(logView);
    Log.i(TAG, "Ready.");
}

From source file:audio.lisn.view.SlidingTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.//  www. ja  v a 2s  .  c om
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextColor(Color.WHITE);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(true);
    }

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}

From source file:com.richtodd.android.quiltdesign.block.PaperPiecedBlock.java

static final PaperPiecedBlock createFromJSONObject(JSONObject jsonObject) throws JSONException {

    float width = (float) jsonObject.optDouble("width", 0);
    float height = (float) jsonObject.optDouble("height", 0);
    int backgroundColor = jsonObject.optInt("backgroundColor", Color.WHITE);

    PaperPiecedBlock block = new PaperPiecedBlock(width, height, backgroundColor);

    JSONArray jsonPieces = jsonObject.getJSONArray("pieces");
    for (int idx = 0; idx < jsonPieces.length(); ++idx) {
        JSONObject jsonPiece = jsonPieces.getJSONObject(idx);
        block.m_pieces.add(PaperPiecedBlockPiece.createFromJSONObject(jsonPiece));
    }//w  ww  . j  a v a2s.c om

    return block;
}

From source file:com.spoiledmilk.ibikecph.favorites.EditFavoriteFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View ret = inflater.inflate(R.layout.fragment_edit_favorite, container, false);

    if (getArguments() != null) {
        favoritesData = getArguments().getParcelable("favoritesData");
    }//www  . j  a  v  a 2 s  . c  o  m

    btnBack = (ImageButton) ret.findViewById(R.id.btnBack);
    btnBack.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            popFragment();
        }
    });

    textTitle = (TextView) ret.findViewById(R.id.textTitle);
    textAddress = (EditText) ret.findViewById(R.id.textAddress);
    textAddress.setClickable(true);
    textAddress.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent i = new Intent(getActivity(), SearchAutocompleteActivity.class);
            i.putExtra("isA", true);
            getActivity().startActivityForResult(i, 2);

        }

    });

    textFavoriteName = (EditText) ret.findViewById(R.id.textFavoriteName);
    textFavorite = (TextView) ret.findViewById(R.id.textFavorite);
    textHome = (TextView) ret.findViewById(R.id.textHome);
    textWork = (TextView) ret.findViewById(R.id.textWork);
    textSchool = (TextView) ret.findViewById(R.id.textSchool);

    btnFavorite = (ImageButton) ret.findViewById(R.id.btnFavorite);
    btnFavorite.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            unselectGraphics();
            btnFavorite.setImageResource(R.drawable.favtypefavoritebuttonpressed);
            if (isPredefinedName(textFavoriteName.getText().toString()))
                textFavoriteName.setText(IbikeApplication.getString("Favorite"));
            currentFavoriteType = FavoritesData.favFav;
            textFavorite.setTextColor(getSelectedTextColor());
        }
    });

    btnHome = (ImageButton) ret.findViewById(R.id.btnHome);
    btnHome.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            unselectGraphics();
            btnHome.setImageResource(R.drawable.favtypehomebuttonpressed);
            if (isPredefinedName(textFavoriteName.getText().toString()))
                textFavoriteName.setText(IbikeApplication.getString("Home"));
            currentFavoriteType = FavoritesData.favHome;
            textHome.setTextColor(getSelectedTextColor());
        }
    });

    btnWork = (ImageButton) ret.findViewById(R.id.btnWork);
    btnWork.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            unselectGraphics();
            btnWork.setImageResource(R.drawable.favtypeworkbuttonpressed);
            if (isPredefinedName(textFavoriteName.getText().toString()))
                textFavoriteName.setText(IbikeApplication.getString("Work"));
            currentFavoriteType = FavoritesData.favWork;
            textWork.setTextColor(getSelectedTextColor());
        }
    });

    btnSchool = (ImageButton) ret.findViewById(R.id.btnSchool);
    btnSchool.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            unselectGraphics();
            btnSchool.setImageResource(R.drawable.favtypeschoolbuttonpressed);
            if (isPredefinedName(textFavoriteName.getText().toString()))
                textFavoriteName.setText(IbikeApplication.getString("School"));
            currentFavoriteType = FavoritesData.favSchool;
            textSchool.setTextColor(getSelectedTextColor());
        }
    });

    btnSave = (TexturedButton) ret.findViewById(R.id.btnSave);
    btnSave.setTextureResource(R.drawable.btn_pattern_repeteable);
    btnSave.setBackgroundResource(R.drawable.btn_blue_selector);
    btnSave.setTextColor(Color.WHITE);
    btnSave.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (Util.isNetworkConnected(getActivity())) {
                if (favoritesData != null && textFavoriteName.getText().toString() != null
                        && !textFavoriteName.getText().toString().trim().equals("")) {
                    if (new DB(getActivity()).favoritesForName(textFavoriteName.getText().toString().trim()) < 1
                            || favoritesData.getName().trim()
                                    .equalsIgnoreCase(textFavoriteName.getText().toString())) {
                        String st = favoritesData.getName() + " - (" + favoritesData.getLatitude() + ","
                                + favoritesData.getLongitude() + ")";
                        IbikeApplication.getTracker().sendEvent("Favorites", "Save", st, (long) 0);
                        favoritesData.setName(textFavoriteName.getText().toString());
                        favoritesData.setAdress(textAddress.getText().toString());
                        favoritesData.setSubSource(currentFavoriteType);
                        Thread updateThread = new Thread(new Runnable() {
                            @Override
                            public void run() {
                                (new DB(getActivity())).updateFavorite(favoritesData, getActivity(),
                                        EditFavoriteFragment.this);
                            }
                        });
                        getView().findViewById(R.id.progress).setVisibility(View.VISIBLE);
                        updateThread.start();
                    } else {
                        Builder builder = new AlertDialog.Builder(getActivity());
                        builder.setMessage(IbikeApplication.getString("name_used"));
                        builder.setTitle(IbikeApplication.getString("Error"));
                        builder.setCancelable(false);
                        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                            }
                        });
                        dialog = builder.create();
                        dialog.show();
                    }
                } else if (getActivity() != null) {
                    Util.showSimpleMessageDlg(getActivity(),
                            IbikeApplication.getString("register_error_fields"));
                }
            } else {
                Util.launchNoConnectionDialog(getActivity());
            }
        }
    });

    btnDelete = (Button) ret.findViewById(R.id.btnDelete);
    btnDelete.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (Util.isNetworkConnected(getActivity())) {
                getView().findViewById(R.id.progress).setVisibility(View.VISIBLE);
                final FavoritesData temp = favoritesData;
                new Thread(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            final JSONObject postObject = new JSONObject();
                            postObject.put("auth_token", IbikeApplication.getAuthToken());
                            if (temp.getApiId() < 0) {
                                int apiId = new DB(getActivity()).getApiId(temp.getId());
                                if (apiId != -1) {
                                    temp.setApiId(apiId);
                                }
                            }
                            JsonNode ret = HttpUtils.deleteFromServer(
                                    Config.serverUrl + "/favourites/" + temp.getApiId(), postObject);
                            if (ret != null && ret.has("success")) {
                                if (ret.path("success").asBoolean()) {
                                    if (getActivity() != null) {
                                        getActivity().runOnUiThread(new Runnable() {

                                            @Override
                                            public void run() {
                                                btnDelete.setTextColor(Color.WHITE);
                                                String st = favoritesData.getName() + " - ("
                                                        + favoritesData.getLatitude() + ","
                                                        + favoritesData.getLongitude() + ")";
                                                IbikeApplication.getTracker().sendEvent("Favorites", "Delete",
                                                        st, (long) 0);
                                                (new DB(getActivity())).deleteFavorite(favoritesData,
                                                        getActivity());
                                                popFragment();
                                            }
                                        });

                                    }

                                } else {
                                    launchErrorDialog(ret.path("info").asText());
                                }
                            } else {
                                launchErrorDialog("Error");
                            }

                        } catch (Exception e) {
                            LOG.e(e.getLocalizedMessage());
                        }
                    }

                }).start();

            } else {
                Util.launchNoConnectionDialog(getActivity());
            }
        }

    });

    return ret;
}