Example usage for android.graphics Color TRANSPARENT

List of usage examples for android.graphics Color TRANSPARENT

Introduction

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

Prototype

int TRANSPARENT

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

Click Source Link

Usage

From source file:com.android.tv.settings.dialog.DialogFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    android.util.Log.v("DialogFragment", "onCreate");
    super.onCreate(savedInstanceState);
    Bundle state = (savedInstanceState != null) ? savedInstanceState : getArguments();
    if (mTitle == null) {
        mTitle = state.getString(EXTRA_CONTENT_TITLE);
    }//from   w  ww. j a va2s. co  m
    if (mBreadcrumb == null) {
        mBreadcrumb = state.getString(EXTRA_CONTENT_BREADCRUMB);
    }
    if (mDescription == null) {
        mDescription = state.getString(EXTRA_CONTENT_DESCRIPTION);
    }
    if (mIconResourceId == 0) {
        mIconResourceId = state.getInt(EXTRA_CONTENT_ICON_RESOURCE_ID, 0);
    }
    if (mIconUri == null) {
        mIconUri = state.getParcelable(EXTRA_CONTENT_ICON_URI);
    }
    if (mIconBitmap == null) {
        mIconBitmap = state.getParcelable(EXTRA_CONTENT_ICON_BITMAP);
    }
    if (mIconBackgroundColor == Color.TRANSPARENT) {
        mIconBackgroundColor = state.getInt(EXTRA_CONTENT_ICON_BACKGROUND, Color.TRANSPARENT);
    }
    if (mActions == null) {
        mActions = state.getParcelableArrayList(EXTRA_ACTION_ACTIONS);
    }
    if (mName == null) {
        mName = state.getString(EXTRA_ACTION_NAME);
    }
    if (mSelectedIndex == -1) {
        mSelectedIndex = state.getInt(EXTRA_ACTION_SELECTED_INDEX, -1);
    }
    mEntryTransitionPerformed = state.getBoolean(EXTRA_ENTRY_TRANSITION_PERFORMED, false);
}

From source file:com.hannesdorfmann.search.SearchActivity.java

@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_search);
      setRetainInstance(true);/* w  ww. j  a va2s.com*/

      ButterKnife.bind(this);
      setupSearchView();

      auto = TransitionInflater.from(this).inflateTransition(R.transition.auto);
      adapter = new FeedAdapter(this, columns, PocketUtils.isPocketInstalled(this));

      results.setAdapter(adapter);
      GridLayoutManager layoutManager = new GridLayoutManager(this, columns);
      layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
          @Override
          public int getSpanSize(int position) {
              return adapter.getItemColumnSpan(position);
          }
      });
      results.setLayoutManager(layoutManager);
      results.addOnScrollListener(new InfiniteScrollListener(layoutManager) {
          @Override
          public void onLoadMore() {
              if (!adapter.isLoadingMore()) {
                  presenter.searchMore(searchView.getQuery().toString());
              }
          }
      });
      results.setHasFixedSize(true);
      results.addOnScrollListener(gridScroll);

      // extract the search icon's location passed from the launching activity, minus 4dp to
      // compensate for different paddings in the views
      searchBackDistanceX = getIntent().getIntExtra(EXTRA_MENU_LEFT, 0) - (int) TypedValue
              .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
      searchIconCenterX = getIntent().getIntExtra(EXTRA_MENU_CENTER_X, 0);

      // translate icon to match the launching screen then animate back into position
      searchBackContainer.setTranslationX(searchBackDistanceX);
      searchBackContainer.animate().translationX(0f).setDuration(650L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in));
      // transform from search icon to back icon
      AnimatedVectorDrawable searchToBack = (AnimatedVectorDrawable) ContextCompat.getDrawable(this,
              R.drawable.avd_search_to_back);
      searchBack.setImageDrawable(searchToBack);
      searchToBack.start();
      // for some reason the animation doesn't always finish (leaving a part arrow!?) so after
      // the animation set a static drawable. Also animation callbacks weren't added until API23
      // so using post delayed :(
      // TODO fix properly!!
      searchBack.postDelayed(new Runnable() {
          @Override
          public void run() {
              searchBack.setImageDrawable(
                      ContextCompat.getDrawable(SearchActivity.this, R.drawable.ic_arrow_back_padded));
          }
      }, 600);

      // fade in the other search chrome
      searchBackground.animate().alpha(1f).setDuration(300L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
      searchView.animate().alpha(1f).setStartDelay(400L).setDuration(400L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in))
              .setListener(new AnimatorListenerAdapter() {
                  @Override
                  public void onAnimationEnd(Animator animation) {
                      searchView.requestFocus();
                      ImeUtils.showIme(searchView);
                  }
              });

      // animate in a scrim over the content behind
      scrim.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
          @Override
          public boolean onPreDraw() {
              scrim.getViewTreeObserver().removeOnPreDrawListener(this);
              AnimatorSet showScrim = new AnimatorSet();
              showScrim.playTogether(
                      ViewAnimationUtils.createCircularReveal(scrim, searchIconCenterX,
                              searchBackground.getBottom(), 0,
                              (float) Math.hypot(searchBackDistanceX,
                                      scrim.getHeight() - searchBackground.getBottom())),
                      ObjectAnimator.ofArgb(scrim, ViewUtils.BACKGROUND_COLOR, Color.TRANSPARENT,
                              ContextCompat.getColor(SearchActivity.this, R.color.scrim)));
              showScrim.setDuration(400L);
              showScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                      android.R.interpolator.linear_out_slow_in));
              showScrim.start();
              return false;
          }
      });
      onNewIntent(getIntent());
  }

From source file:edu.stanford.mobisocial.dungbeetle.ui.ViewContactActivity.java

@Override
public void onPageSelected(int position) {
    int c = mButtons.size();
    for (int i = 0; i < c; i++) {
        mButtons.get(i).setBackgroundColor(Color.TRANSPARENT);
    }//w  w  w .  j a  v  a 2 s.c om
    mButtons.get(position).setBackgroundColor(R.color.default_tab_selected);
}

From source file:com.nbplus.hybrid.BasicWebViewClient.java

public void setBackgroundTransparent() {
    mWebView.setBackgroundColor(Color.TRANSPARENT);
}

From source file:com.android.tv.settings.dialog.SettingsLayoutFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle state = (savedInstanceState != null) ? savedInstanceState : getArguments();
    mTitle = state.getString(EXTRA_CONTENT_TITLE);
    mBreadcrumb = state.getString(EXTRA_CONTENT_BREADCRUMB);
    mDescription = state.getString(EXTRA_CONTENT_DESCRIPTION);
    //mIcon = state.getParcelable(EXTRA_CONTENT_ICON_RESOURCE_ID, 0);
    mIconUri = state.getParcelable(EXTRA_CONTENT_ICON_URI);
    mIconBitmap = state.getParcelable(EXTRA_CONTENT_ICON_BITMAP);
    mIconBackgroundColor = state.getInt(EXTRA_CONTENT_ICON_BACKGROUND, Color.TRANSPARENT);
    mName = state.getString(EXTRA_ACTION_NAME);
    mSelectedIndex = state.getInt(EXTRA_ACTION_SELECTED_INDEX, -1);
    mEntryTransitionPerformed = state.getBoolean(EXTRA_ENTRY_TRANSITION_PERFORMED, false);
}

From source file:com.gosuncn.core.util.view.StatusBarUtils.java

/**
 *  DrawerLayout ???/*w w w  . java  2 s .  c o  m*/
 *
 * @param activity     ?activity
 * @param drawerLayout DrawerLayout
 */
public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
    } else {
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
    // ? LinearLayout ,padding top
    if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
        contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
    }

    // 
    ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
    drawerLayout.setFitsSystemWindows(false);
    contentLayout.setFitsSystemWindows(false);
    contentLayout.setClipToPadding(true);
    drawer.setFitsSystemWindows(false);
}

From source file:com.cqyw.smart.widget.viewpaper.PagerSlidingTabStrip.java

/**
 * ?actionBar tabView//from  w  ww .j  ava  2  s. c  o m
 * @author: Kyrong
 * @param position
 */
private void scrollToActionBarTabview(int position) {
    if (actionbarTabLayout == null) {
        return;
    }
    if (position == 0) {
        actionbarTabLayout.findViewById(R.id.friend_tab_session).setBackgroundColor(Color.TRANSPARENT);
        actionbarTabLayout.findViewById(R.id.friend_tab_contact)
                .setBackgroundResource(R.drawable.right_rounded_bg);
        ((TextView) actionbarTabLayout.findViewById(R.id.friend_tab_session))
                .setTextColor(getResources().getColor(checkedTextColor));
        ((TextView) actionbarTabLayout.findViewById(R.id.friend_tab_contact))
                .setTextColor(getResources().getColor(unCheckedTextColor));
    } else if (position == 1) {
        actionbarTabLayout.findViewById(R.id.friend_tab_session)
                .setBackgroundResource(R.drawable.left_rounded_bg);
        actionbarTabLayout.findViewById(R.id.friend_tab_contact).setBackgroundColor(Color.TRANSPARENT);
        ((TextView) actionbarTabLayout.findViewById(R.id.friend_tab_session))
                .setTextColor(getResources().getColor(unCheckedTextColor));
        ((TextView) actionbarTabLayout.findViewById(R.id.friend_tab_contact))
                .setTextColor(getResources().getColor(checkedTextColor));
    }
}

From source file:com.androzic.waypoint.WaypointDetails.java

@SuppressLint("NewApi")
private void updateWaypointDetails(double lat, double lon) {
    Androzic application = Androzic.getApplication();
    AppCompatActivity activity = (AppCompatActivity) getActivity();

    activity.getSupportActionBar().setTitle(waypoint.name);

    View view = getView();/*from  www.  j a v  a  2 s .  com*/

    final TextView coordsView = (TextView) view.findViewById(R.id.coordinates);
    coordsView.requestFocus();
    coordsView.setTag(Integer.valueOf(StringFormatter.coordinateFormat));
    coordsView.setText(StringFormatter.coordinates(" ", waypoint.latitude, waypoint.longitude));
    coordsView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int format = ((Integer) coordsView.getTag()).intValue() + 1;
            if (format == 5)
                format = 0;
            coordsView.setText(StringFormatter.coordinates(format, " ", waypoint.latitude, waypoint.longitude));
            coordsView.setTag(Integer.valueOf(format));
        }
    });

    if (waypoint.altitude != Integer.MIN_VALUE) {
        ((TextView) view.findViewById(R.id.altitude))
                .setText("\u2336 " + StringFormatter.elevationH(waypoint.altitude));
        view.findViewById(R.id.altitude).setVisibility(View.VISIBLE);
    } else {
        view.findViewById(R.id.altitude).setVisibility(View.GONE);
    }

    if (waypoint.proximity > 0) {
        ((TextView) view.findViewById(R.id.proximity))
                .setText("~ " + StringFormatter.distanceH(waypoint.proximity));
        view.findViewById(R.id.proximity).setVisibility(View.VISIBLE);
    } else {
        view.findViewById(R.id.proximity).setVisibility(View.GONE);
    }

    double dist = Geo.distance(lat, lon, waypoint.latitude, waypoint.longitude);
    double bearing = Geo.bearing(lat, lon, waypoint.latitude, waypoint.longitude);
    bearing = application.fixDeclination(bearing);
    String distance = StringFormatter.distanceH(dist) + " " + StringFormatter.angleH(bearing);
    ((TextView) view.findViewById(R.id.distance)).setText(distance);

    ((TextView) view.findViewById(R.id.waypointset)).setText(waypoint.set.name);

    if (waypoint.date != null) {
        view.findViewById(R.id.date_row).setVisibility(View.VISIBLE);
        ((TextView) view.findViewById(R.id.date))
                .setText(DateFormat.getDateFormat(activity).format(waypoint.date) + " "
                        + DateFormat.getTimeFormat(activity).format(waypoint.date));
    } else {
        view.findViewById(R.id.date_row).setVisibility(View.GONE);
    }

    if ("".equals(waypoint.description)) {
        view.findViewById(R.id.description_row).setVisibility(View.GONE);
    } else {
        WebView description = (WebView) view.findViewById(R.id.description);
        String descriptionHtml;
        try {
            TypedValue tv = new TypedValue();
            Theme theme = activity.getTheme();
            Resources resources = getResources();
            theme.resolveAttribute(android.R.attr.textColorPrimary, tv, true);
            int secondaryColor = resources.getColor(tv.resourceId);
            String css = String.format(
                    "<style type=\"text/css\">html,body{margin:0;background:transparent} *{color:#%06X}</style>\n",
                    (secondaryColor & 0x00FFFFFF));
            descriptionHtml = css + waypoint.description;
            description.setWebViewClient(new WebViewClient() {
                @SuppressLint("NewApi")
                @Override
                public void onPageFinished(WebView view, String url) {
                    view.setBackgroundColor(Color.TRANSPARENT);
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
                        view.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
                }
            });
            description.setBackgroundColor(Color.TRANSPARENT);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
                description.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
        } catch (Resources.NotFoundException e) {
            description.setBackgroundColor(Color.LTGRAY);
            descriptionHtml = waypoint.description;
        }

        WebSettings settings = description.getSettings();
        settings.setDefaultTextEncodingName("utf-8");
        settings.setAllowFileAccess(true);
        Uri baseUrl = Uri.fromFile(new File(application.dataPath));
        description.loadDataWithBaseURL(baseUrl.toString() + "/", descriptionHtml, "text/html", "utf-8", null);
        view.findViewById(R.id.description_row).setVisibility(View.VISIBLE);
    }
}

From source file:eu.codeplumbers.cosi.activities.NoteDetailsActivity.java

private void setupEditor() {
    findViewById(R.id.action_undo).setOnClickListener(new View.OnClickListener() {
        @Override/*from  w w  w  .j  ava  2 s  .com*/
        public void onClick(View v) {
            body.undo();
        }
    });

    findViewById(R.id.action_redo).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.redo();
        }
    });

    findViewById(R.id.action_bold).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setBold();
        }
    });

    findViewById(R.id.action_italic).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setItalic();
        }
    });

    findViewById(R.id.action_subscript).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setSubscript();
        }
    });

    findViewById(R.id.action_superscript).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setSuperscript();
        }
    });

    findViewById(R.id.action_strikethrough).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setStrikeThrough();
        }
    });

    findViewById(R.id.action_underline).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setUnderline();
        }
    });

    findViewById(R.id.action_heading1).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setHeading(1);
        }
    });

    findViewById(R.id.action_heading2).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setHeading(2);
        }
    });

    findViewById(R.id.action_heading3).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setHeading(3);
        }
    });

    findViewById(R.id.action_heading4).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setHeading(4);
        }
    });

    findViewById(R.id.action_heading5).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setHeading(5);
        }
    });

    findViewById(R.id.action_heading6).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setHeading(6);
        }
    });

    findViewById(R.id.action_txt_color).setOnClickListener(new View.OnClickListener() {
        private boolean isChanged;

        @Override
        public void onClick(View v) {
            body.setTextColor(isChanged ? Color.BLACK : Color.RED);
            isChanged = !isChanged;
        }
    });

    findViewById(R.id.action_bg_color).setOnClickListener(new View.OnClickListener() {
        private boolean isChanged;

        @Override
        public void onClick(View v) {
            body.setTextBackgroundColor(isChanged ? Color.TRANSPARENT : Color.YELLOW);
            isChanged = !isChanged;
        }
    });

    findViewById(R.id.action_indent).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setIndent();
        }
    });

    findViewById(R.id.action_outdent).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setOutdent();
        }
    });

    findViewById(R.id.action_align_left).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setAlignLeft();
        }
    });

    findViewById(R.id.action_align_center).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setAlignCenter();
        }
    });

    findViewById(R.id.action_align_right).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setAlignRight();
        }
    });

    findViewById(R.id.action_blockquote).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setBlockquote();
        }
    });

    findViewById(R.id.action_insert_bullets).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setBullets();
        }
    });

    findViewById(R.id.action_insert_numbers).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.setNumbers();
        }
    });

    findViewById(R.id.action_insert_image).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.insertImage("http://www.1honeywan.com/dachshund/image/7.21/7.21_3_thumb.JPG", "dachshund");
        }
    });

    findViewById(R.id.action_insert_link).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.insertLink("https://github.com/wasabeef", "wasabeef");
        }
    });
    findViewById(R.id.action_insert_checkbox).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            body.insertTodo();
        }
    });
}

From source file:com.VVTeam.ManHood.Fragment.HistogramFragment.java

private void initViews(View view) {
    parentLayout = (RelativeLayout) view.findViewById(R.id.fragment_histogram_parent_relative_layout);
    /*BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 2;//from  w w  w . ja v  a 2 s  .  com
    parentLayout.setBackgroundDrawable(new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.histogram_bg, options)));*/
    settingsRelative = (RelativeLayout) view.findViewById(R.id.fragment_histogram_settings_relative_layout);
    markRelative = (RelativeLayout) view.findViewById(R.id.fragment_histogram_mark_relative_layout);
    worldRelative = (RelativeLayout) view.findViewById(R.id.fragment_histogram_world_relative);
    //        worldRelative.setSelected(true);
    worldRelative.setBackgroundResource(R.drawable.cell_p);
    areaRelative = (RelativeLayout) view.findViewById(R.id.fragment_histogram_area_relative);
    hoodRelative = (RelativeLayout) view.findViewById(R.id.fragment_histogram_hood_relative);
    yourResultButton = (Button) view.findViewById(R.id.fragment_histogram_your_result_button);

    contentRelative = (RelativeLayout) view.findViewById(R.id.fragment_histogram_content_relative);

    RelativeLayout shareRelative = (RelativeLayout) view
            .findViewById(R.id.fragment_histogram_share_button_relative);
    shareRelative.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            GoogleTracker.StarSendEvent(getActivity(), "ui_action", "user_action", "histogram_share");

            Bitmap image = makeSnapshot();

            File pictureFile = getOutputMediaFile();
            try {
                FileOutputStream fos = new FileOutputStream(pictureFile);
                image.compress(Bitmap.CompressFormat.PNG, 90, fos);
                fos.close();

            } catch (Exception e) {

            }

            //            String pathofBmp = Images.Media.insertImage(getActivity().getContentResolver(), makeSnapshot(), "Man Hood App", null);
            //             Uri bmpUri = Uri.parse(pathofBmp);
            Uri bmpUri = Uri.fromFile(pictureFile);
            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            emailIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
            emailIntent.setType("image/png");
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Man Hood App");
            getActivity().startActivity(emailIntent);

        }
    });

    polarPlot = (PolarPlot) view.findViewById(R.id.polarPlot);

    thicknessHisto = (Histogram) view.findViewById(R.id.thicknessHisto);
    thicknessHisto.setOrientation(ORIENT.LEFT);
    thicknessHisto.setBackgroundColor(Color.TRANSPARENT);
    lengthHisto = (Histogram) view.findViewById(R.id.lengthHistogram);
    lengthHisto.setOrientation(ORIENT.RIGHT);
    lengthHisto.setBackgroundColor(Color.TRANSPARENT);
    girthHisto = (Histogram) view.findViewById(R.id.girthHistogram);
    girthHisto.setOrientation(ORIENT.BOTTOM);
    girthHisto.setBackgroundColor(Color.TRANSPARENT);

    lengthHisto.setCallBackListener(new HistogramCallBack() {

        @Override
        public void setValueSelectionChangedBlock(Histogram histo, HistogramSelectionState selectionState,
                float value, HistogramBin bin) {
            // TODO Auto-generated method stub
            if (selectionState == HistogramSelectionState.HistogramSelectionStateSelected) {
                histogramSelected = true;

                setNearestUserID(usersData.userIDWithNearestLength(value));

                setSelection(true, girthHisto, usersData.girthOfUserWithID(nearestUserID));
                setSelection(true, thicknessHisto, usersData.thicknessOfUserWithID(nearestUserID));
                //               setSelection(false, lengthHisto, 0.0f);
                setSelection(true, lengthHisto, value);

                setupPolarPlotWithCurrentUserID(nearestUserID, usersData, selfUserData);
            } else if (selectionState == HistogramSelectionState.HistogramSelectionStateNotSelected) {
                histogramSelected = false;

                setNearestUserID(null);
                setSelectionForAverage();
                setupPolarPlotWithCurrentUserID(nearestUserID, usersData, selfUserData);
            } else if (selectionState == HistogramSelectionState.HistogramSelectionStateDelayedFinish) {

            }

        }
    });

    girthHisto.setCallBackListener(new HistogramCallBack() {

        @Override
        public void setValueSelectionChangedBlock(Histogram histo, HistogramSelectionState selectionState,
                float value, HistogramBin bin) {
            // TODO Auto-generated method stub
            if (selectionState == HistogramSelectionState.HistogramSelectionStateSelected) {
                histogramSelected = true;

                setNearestUserID(usersData.userIDWithNearestGirth(value));

                setSelection(true, lengthHisto, usersData.lengthOfUserWithID(nearestUserID));
                setSelection(true, thicknessHisto, usersData.thicknessOfUserWithID(nearestUserID));
                //               setSelection(false, girthHisto, 0.0f);
                setSelection(true, girthHisto, value);

                setupPolarPlotWithCurrentUserID(nearestUserID, usersData, selfUserData);
            } else if (selectionState == HistogramSelectionState.HistogramSelectionStateNotSelected) {
                histogramSelected = false;

                setNearestUserID(null);

                setSelectionForAverage();
                setupPolarPlotWithCurrentUserID(nearestUserID, usersData, selfUserData);
            } else if (selectionState == HistogramSelectionState.HistogramSelectionStateDelayedFinish) {

            }

        }
    });

    thicknessHisto.setCallBackListener(new HistogramCallBack() {

        @Override
        public void setValueSelectionChangedBlock(Histogram histo, HistogramSelectionState selectionState,
                float value, HistogramBin bin) {
            // TODO Auto-generated method stub
            if (selectionState == HistogramSelectionState.HistogramSelectionStateSelected) {
                histogramSelected = true;

                setNearestUserID(usersData.userIDWithNearestThickness(value));

                setSelection(true, girthHisto, usersData.girthOfUserWithID(nearestUserID));
                setSelection(true, lengthHisto, usersData.lengthOfUserWithID(nearestUserID));
                //                 setSelection(false, thicknessHisto, 0.0f);
                setSelection(true, thicknessHisto, value);

                setupPolarPlotWithCurrentUserID(nearestUserID, usersData, selfUserData);
            } else if (selectionState == HistogramSelectionState.HistogramSelectionStateNotSelected) {
                histogramSelected = false;

                setNearestUserID(null);
                setSelectionForAverage();
                setupPolarPlotWithCurrentUserID(nearestUserID, usersData, selfUserData);
            } else if (selectionState == HistogramSelectionState.HistogramSelectionStateDelayedFinish) {

            }

        }
    });

    textBoxTitleLabel = (TextView) view.findViewById(R.id.txtBoxTitle);
    textBoxTitleLabel.setText("AVERAGE");

    layoutSubTitle = (LinearLayout) view.findViewById(R.id.layoutSubTitle);
    layoutSubTitle.setVisibility(View.INVISIBLE);
    textBoxSubtitleLabel = (TextView) view.findViewById(R.id.txtBoxSubTitleLabel);
    textBoxSubtitleValueLabel = (TextView) view.findViewById(R.id.txtBoxSubTitleValue);

    lengthSelectedLabel = (TextView) view.findViewById(R.id.txtlengthselected);
    lengthSelectedLabel.setText("50%");
    lengthTOPLabel = (TextView) view.findViewById(R.id.lengthTOPLabel);

    girthSelectedLabel = (TextView) view.findViewById(R.id.txtgirthselected);
    girthSelectedLabel.setText("50%");
    girthTOPLabel = (TextView) view.findViewById(R.id.girthTOPLabel);

    thicknessSelectedLabel = (TextView) view.findViewById(R.id.txtthicknessselected);
    thicknessSelectedLabel.setText("50%");
    thinkestAtTOPLabel = (TextView) view.findViewById(R.id.thinkestAtTOPLabel);

    curvedSelectedLabel = (TextView) view.findViewById(R.id.txtcurvedselected);
    curvedSelectedLabel.setText("0");

    girthTopLB = (TextView) view.findViewById(R.id.girthTop);
    girthMiddleLB = (TextView) view.findViewById(R.id.girthMiddle);
    girthBottomLB = (TextView) view.findViewById(R.id.girthBottom);

    thicknessTopLB = (TextView) view.findViewById(R.id.thicknessTop);
    thicknessMiddleLB = (TextView) view.findViewById(R.id.thicknessMiddle);
    thicknessBottomLB = (TextView) view.findViewById(R.id.thicknessBottom);

    lengthTopLB = (TextView) view.findViewById(R.id.lengthTop);
    lengthMiddleLB = (TextView) view.findViewById(R.id.lengthMiddle);
    lengthBottomLB = (TextView) view.findViewById(R.id.lengthBottom);

    settingsRelative.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((MainActivity) getActivity()).openSettingsActivity();
        }
    });
    markRelative.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((MainActivity) getActivity()).openCertificateActivity();
        }
    });

    worldRelative.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setSelectedRange(SliceRange.SliceRangeAll);
            updateRangeSwitch();
        }
    });
    areaRelative.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setSelectedRange(SliceRange.SliceRange200);
            updateRangeSwitch();
        }
    });
    hoodRelative.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setSelectedRange(SliceRange.SliceRange20);
            updateRangeSwitch();
        }
    });

    yourResultButton.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub

            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                youTouchDown();
            } else if (event.getAction() == MotionEvent.ACTION_UP) {
                youTouchUp();
                //               final Handler handler = new Handler();
                //                handler.postDelayed(new Runnable() {
                //                    @Override
                //                    public void run() {
                //                       youTouchUp();             
                //                    }
                //                }, 2000);
            }

            return true;
        }
    });

    RequestManager.getInstance().checkUser();

    /* in-app billing */
    String base64EncodedPublicKey = LICENSE_KEY;

    // Create the helper, passing it our context and the public key to verify signatures with
    Log.d(TAG, "Creating IAB helper.");
    mHelper = new IabHelper(getActivity(), base64EncodedPublicKey);

    // enable debug logging (for a production application, you should set this to false).
    mHelper.enableDebugLogging(true);

    // Start setup. This is asynchronous and the specified listener
    // will be called once setup completes.
    Log.d(TAG, "Starting setup.");
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
            Log.d(TAG, "Setup finished.");

            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                Log.d(TAG, "Problem setting up in-app billing: " + result);
                return;
            }

            // Have we been disposed of in the meantime? If so, quit.
            if (mHelper == null)
                return;

            // IAB is fully set up. Now, let's get an inventory of stuff we own.
            Log.d(TAG, "Setup successful. Querying inventory.");
            mHelper.queryInventoryAsync(mGotInventoryListener);
        }
    });

}