List of usage examples for android.graphics Color LTGRAY
int LTGRAY
To view the source code for android.graphics Color LTGRAY.
Click Source Link
From source file:com.androzic.waypoint.WaypointInfo.java
@SuppressLint("NewApi") private void updateWaypointInfo(double lat, double lon) { Androzic application = Androzic.getApplication(); Activity activity = getActivity();/* w w w .ja v a 2 s . co m*/ Dialog dialog = getDialog(); View view = getView(); WebView description = (WebView) view.findViewById(R.id.description); if ("".equals(waypoint.description)) { description.setVisibility(View.GONE); } else { String descriptionHtml; try { TypedValue tv = new TypedValue(); Theme theme = activity.getTheme(); Resources resources = getResources(); theme.resolveAttribute(android.R.attr.textColorSecondary, 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() { @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); } String coords = StringFormatter.coordinates(" ", waypoint.latitude, waypoint.longitude); ((TextView) view.findViewById(R.id.coordinates)).setText(coords); if (waypoint.altitude != Integer.MIN_VALUE) { ((TextView) view.findViewById(R.id.altitude)).setText(StringFormatter.elevationH(waypoint.altitude)); } 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); if (waypoint.date != null) ((TextView) view.findViewById(R.id.date)) .setText(DateFormat.getDateFormat(activity).format(waypoint.date) + " " + DateFormat.getTimeFormat(activity).format(waypoint.date)); else ((TextView) view.findViewById(R.id.date)).setVisibility(View.GONE); dialog.setTitle(waypoint.name); }
From source file:com.example.parkhere.seeker.SeekerProfileVehicleFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { user = (User) getArguments().getSerializable(USER_KEY); vehicles = (Vehicle[]) getArguments().getSerializable(SEEKER_VEHICLES_KEY); getCurrInfo();//from www . j av a 2s. c om rootView = inflater.inflate(R.layout.fragment_seeker_profile_vehicle, container, false); sprof_make = (EditText) rootView.findViewById(R.id.sprof_make); sprof_model = (EditText) rootView.findViewById(R.id.sprof_model); sprof_color = (EditText) rootView.findViewById(R.id.sprof_color); sprof_year = (EditText) rootView.findViewById(R.id.sprof_year); sprof_licenseplate = (EditText) rootView.findViewById(R.id.sprof_licenseplate); tl = (TableLayout) rootView.findViewById(R.id.sprof_vehicle_table); sprof_add_vehicle_button = (Button) rootView.findViewById(R.id.sprof_add_vehicle_button); sprof_edit_vehicle_button = (Button) rootView.findViewById(R.id.sprof_edit_vehicle_button); sprof_delete_vehicle_button = (Button) rootView.findViewById(R.id.sprof_delete_vehicle_button); sprof_add_vehicle_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { String make = sprof_make.getText().toString(); String model = sprof_model.getText().toString(); String color = sprof_color.getText().toString(); String year = sprof_year.getText().toString(); String licensePlate = sprof_licenseplate.getText().toString(); Vehicle vehicle = new Vehicle(); vehicle.setMake(make); vehicle.setModel(model); vehicle.setColor(color); vehicle.setYear(year); vehicle.setLicensePlate(licensePlate); if (!validate(vehicle)) { onAddUpdateVehicleFailed(); return; } Vehicle v = getVehicle(licensePlate); if (v.getMake() == null) { addVehicle(vehicle); } else { Snackbar.make(rootView, "Vehicle with this license plate already exists; cannot re-add", Snackbar.LENGTH_LONG).show(); } } }); sprof_edit_vehicle_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (selectedMake.equals("")) { Snackbar.make(rootView, "Must select a vehicle", Snackbar.LENGTH_LONG).show(); } else { String make = sprof_make.getText().toString(); String model = sprof_model.getText().toString(); String color = sprof_color.getText().toString(); String year = sprof_year.getText().toString(); String licensePlate = sprof_licenseplate.getText().toString(); Vehicle vehicle = new Vehicle(); vehicle.setMake(make); vehicle.setModel(model); vehicle.setColor(color); vehicle.setYear(year); vehicle.setLicensePlate(licensePlate); if (!validate(vehicle)) { onAddUpdateVehicleFailed(); return; } else if (!licensePlate.equals(selectedLicensePlate)) { Snackbar.make(rootView, "Cannot update vehicle license plate; add a new vehicle with this license plate", Snackbar.LENGTH_LONG).show(); } else { vehicles[selectedIndex - 1] = vehicle; TableRow tr = (TableRow) tl.findViewWithTag(selectedIndex); tr.setBackgroundColor(Color.LTGRAY); TextView tv = (TextView) tr.getChildAt(0); tv.setText(vehicle.getMake()); tv = (TextView) tr.getChildAt(1); tv.setText(vehicle.getModel()); editVehicle(); } } } }); sprof_delete_vehicle_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (selectedMake.equals("")) { Snackbar.make(rootView, "Must select a vehicle", Snackbar.LENGTH_LONG).show(); } else if (tag == 2) { Snackbar.make(rootView, "Must add another vehicle before deleting your only listed vehicle", Snackbar.LENGTH_LONG).show(); } else { LayoutInflater li = LayoutInflater.from(myContext); View customView = li.inflate(R.layout.popup_delete_vehicle, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(myContext); alertDialogBuilder.setView(customView); final AlertDialog alertDialog = alertDialogBuilder.create(); TextView deleteText = (TextView) customView.findViewById(R.id.popup_delete_vehicle_text); deleteText.setText("Are you sure you want to delete this vehicle: " + selectedMake + " " + selectedModel + " " + selectedLicensePlate + "?"); ImageButton closeButton = (ImageButton) customView .findViewById(R.id.popup_delete_vehicle_close); closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { alertDialog.dismiss(); } }); Button deleteButton = (Button) customView.findViewById(R.id.popup_delete_vehicle_button); deleteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { deleteVehicle(); alertDialog.dismiss(); } }); alertDialog.show(); } } }); return rootView; }
From source file:info.rti.tabsswipe.PressureFragment.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); mItems = new ArrayList<String>(); mSeries = new HashMap<String, TimeSeries>(); mDataset = new XYMultipleSeriesDataset(); mRenderer = new XYMultipleSeriesRenderer(); mRenderer.setAxisTitleTextSize(24);//from w w w. j av a 2 s. c om mRenderer.setChartTitleTextSize(28); mRenderer.setLabelsTextSize(22); mRenderer.setLegendTextSize(22); mRenderer.setPointSize(8f); mYAxisPadding = 9; mRenderer.setXLabelsAlign(Align.CENTER); mRenderer.setYLabelsAlign(Align.CENTER); DecimalFormat newFormat = new DecimalFormat("#.###"); double mAltitude_t = Double.valueOf(newFormat.format(BMP_pressureSubscriber.mAltitude)); mRenderer.setChartTitle("Live Pressure from RaspberryPi (" + BMP_pressureSubscriber.mId + ") Barometric Sensor (BMP085)" + "\nat Temperature " + BMP_pressureSubscriber.mTemperature + " Celsius and Altitude " + mAltitude_t + " meter"); mRenderer.setXTitle("In Real Time..."); mRenderer.setYTitle("Atmospheric Pressure (kPa)"); mRenderer.setLabelsColor(Color.LTGRAY); mRenderer.setAxesColor(Color.LTGRAY); mRenderer.setGridColor(Color.rgb(136, 136, 136)); mRenderer.setBackgroundColor(Color.BLACK); mRenderer.setApplyBackgroundColor(true); mRenderer.setMargins(new int[] { 60, 60, 60, 60 }); mRenderer.setFitLegend(true); mRenderer.setShowGrid(true); mRenderer.setZoomButtonsVisible(false); mRenderer.setZoomEnabled(true); mRenderer.setExternalZoomEnabled(true); mRenderer.setAntialiasing(true); mRenderer.setInScroll(true); mLastItemChange = new Date().getTime(); mItemIndex = 5;// Math.abs(RAND.nextInt(ITEMS.length)); mThresholds = new TimeSeries[3]; mThresholdRenderers = new XYSeriesRenderer[3]; int THRESHOLD_VALUES_t[] = { BMP_pressureSubscriber.mPressure_high, 100, BMP_pressureSubscriber.mPressure_low }; for (int i = 0; i < THRESHOLD_COLORS.length; i++) { mThresholdRenderers[i] = new XYSeriesRenderer(); mThresholdRenderers[i].setColor(THRESHOLD_COLORS[i]); mThresholdRenderers[i].setLineWidth(3); mThresholds[i] = new TimeSeries(THRESHOLD_LABELS[i]); final long now = new Date().getTime(); mThresholds[i].add(new Date(now - 1000 * 60 * 10), THRESHOLD_VALUES_t[i]); mThresholds[i].add(new Date(now + 1000 * 60 * 10), THRESHOLD_VALUES_t[i]); mDataset.addSeries(mThresholds[i]); mRenderer.addSeriesRenderer(mThresholdRenderers[i]); } }
From source file:co.ldln.android.MapFragment.java
private void loadOfflineMaps() { // Find the mbtiles file in a LDLN subfolder of the SDK card // Note: if there is more than one file, the following logic will // find the last alphabetically-ordered mbtiles file in that folder // and use that. String filePath = null;//from ww w . jav a2s .c o m File sdCardRoot = Environment.getExternalStorageDirectory(); File dir = new File(sdCardRoot, "LDLN"); for (File f : dir.listFiles()) { if (f.isFile()) { String name = f.getName(); //Log.d("LDLN Dir", name); if (name.substring(name.lastIndexOf('.') + 1).equals("mbtiles")) filePath = dir + "/" + name; } } // Load the map if (filePath != null) { // Load the map and create a suitable object for including in the map as a layer File file = new File(filePath); MBTiles mbTiles = new MBTiles(file); LDLNVectorSimpleStyleGenerator vectorStyleSimpleGenerator = new LDLNVectorSimpleStyleGenerator( mActivity, mapControl); MapboxVectorTileSource mapboxVectorTileSource = new MapboxVectorTileSource(mbTiles, vectorStyleSimpleGenerator); QuadPagingLayer quadPagingLayer = new QuadPagingLayer(mapControl, new SphericalMercatorCoordSystem(), mapboxVectorTileSource); // Set number of threads to use quadPagingLayer.setSimultaneousFetches(8); quadPagingLayer.setUseParentTileBounds(true); quadPagingLayer.setTileHeightRange(0.0062, 100); // Set controller to be gesture delegate. // Needed to allow selection. mapControl.gestureDelegate = this; // Set the color of the land mapControl.setClearColor(Color.LTGRAY); // Add the layer mapControl.addLayer(quadPagingLayer); // Stop the map from being able to rotate mapControl.setAllowRotateGesture(false); // Insert markers and center insertMarkersAndCenter(); // Provide some instructions for using the map Toast.makeText(mActivity, "Map is loaded!\n-Pan & Zoom like any map\n- Longtap to create pins\n- Tap pins to see details", Toast.LENGTH_LONG).show(); } }
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)}./*w w w. j a va 2 s. 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:org.ounl.noisenotifier.SubjectsActivity.java
private XYMultipleSeriesRenderer getDemoRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.setAxisTitleTextSize(16);//from w w w .j a va2s .c o m renderer.setChartTitleTextSize(20); renderer.setLabelsTextSize(15); renderer.setLegendTextSize(15); renderer.setPointSize(5f); renderer.setMargins(new int[] { 20, 30, 15, 0 }); XYSeriesRenderer r = new XYSeriesRenderer(); r.setColor(Color.BLUE); r.setPointStyle(PointStyle.SQUARE); r.setFillBelowLine(true); r.setFillBelowLineColor(Color.WHITE); r.setFillPoints(true); renderer.addSeriesRenderer(r); r = new XYSeriesRenderer(); r.setPointStyle(PointStyle.CIRCLE); r.setColor(Color.GREEN); r.setFillPoints(true); renderer.addSeriesRenderer(r); renderer.setAxesColor(Color.DKGRAY); renderer.setLabelsColor(Color.LTGRAY); return renderer; }
From source file:com.soil.soilsample.ui.main.FileBrowserFragment.java
private void initializeFileListView() { ListView lView = (ListView) (getView().findViewById(R.id.fileListView)); lView.setBackgroundColor(Color.LTGRAY); LinearLayout.LayoutParams lParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);/*from w w w .j ava 2 s . c o m*/ lParam.setMargins(15, 5, 15, 5); lView.setAdapter(this.adapter); lView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { chosenFile = fileList.get(position).file; final File sel = new File(path + "/" + chosenFile); if (sel.isDirectory()) { // Directory if (sel.canRead()) { // Adds chosen directory to list pathDirsList.add(chosenFile); path = new File(sel + ""); loadFileList(); adapter.notifyDataSetChanged(); updateCurrentDirectoryTextView(); } else { showToast("Path does not exist or cannot be read"); } } else { // File picked or an empty directory message clicked if (!mDirectoryShownIsEmpty) { // show a popup menu to allow users to open a raster layer for // different purpose including basemap layer, operational layer, // elevation data source for BlendRenderer, or some combinations. returnFileFinishActivity(sel.getAbsolutePath()); } } } }); }
From source file:org.odk.collect.android.views.MediaLayout.java
public void setAVT(FormIndex index, String selectionDesignator, TextView text, String audioURI, String imageURI, String videoURI, final String bigImageURI) { this.selectionDesignator = selectionDesignator; this.index = index; viewText = text;/*from ww w.j av a2s.c om*/ originalText = text.getText(); viewText.setId(ViewIds.generateViewId()); this.videoURI = videoURI; // Layout configurations for our elements in the relative layout RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams audioParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); RelativeLayout.LayoutParams videoParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); // First set up the audio button if (audioURI != null) { // An audio file is specified audioButton = new AudioButton(getContext(), this.index, this.selectionDesignator, audioURI, player); audioButton.setPadding(22, 12, 22, 12); audioButton.setBackgroundColor(Color.LTGRAY); audioButton.setOnClickListener(this); audioButton.setId(ViewIds.generateViewId()); // random ID to be used by the // relative layout. } else { // No audio file specified, so ignore. } // Then set up the video button if (videoURI != null) { // An video file is specified videoButton = new AppCompatImageButton(getContext()); Bitmap b = BitmapFactory.decodeResource(getContext().getResources(), android.R.drawable.ic_media_play); videoButton.setImageBitmap(b); videoButton.setPadding(22, 12, 22, 12); videoButton.setBackgroundColor(Color.LTGRAY); videoButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "onClick", "playVideoPrompt" + MediaLayout.this.selectionDesignator, MediaLayout.this.index); MediaLayout.this.playVideo(); } }); videoButton.setId(ViewIds.generateViewId()); } else { // No video file specified, so ignore. } // Now set up the image view String errorMsg = null; final int imageId = ViewIds.generateViewId(); if (imageURI != null) { try { String imageFilename = ReferenceManager.instance().DeriveReference(imageURI).getLocalURI(); final File imageFile = new File(imageFilename); if (imageFile.exists()) { DisplayMetrics metrics = context.getResources().getDisplayMetrics(); int screenWidth = metrics.widthPixels; int screenHeight = metrics.heightPixels; Bitmap b = FileUtils.getBitmapScaledToDisplay(imageFile, screenHeight, screenWidth); if (b != null) { imageView = new ImageView(getContext()); imageView.setPadding(2, 2, 2, 2); imageView.setImageBitmap(b); imageView.setId(imageId); imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (bigImageURI != null) { Collect.getInstance().getActivityLogger().logInstanceAction(this, "onClick", "showImagePromptBigImage" + MediaLayout.this.selectionDesignator, MediaLayout.this.index); try { File bigImage = new File(ReferenceManager.instance() .DeriveReference(bigImageURI).getLocalURI()); Intent i = new Intent("android.intent.action.VIEW"); i.setDataAndType(Uri.fromFile(bigImage), "image/*"); getContext().startActivity(i); } catch (InvalidReferenceException e) { Timber.e(e, "Invalid image reference due to %s ", e.getMessage()); } catch (ActivityNotFoundException e) { Timber.d(e, "No Activity found to handle due to %s", e.getMessage()); ToastUtils.showShortToast( getContext().getString(R.string.activity_not_found, "view image")); } } else { if (viewText instanceof RadioButton) { ((RadioButton) viewText).setChecked(true); } else if (viewText instanceof CheckBox) { CheckBox checkbox = (CheckBox) viewText; checkbox.setChecked(!checkbox.isChecked()); } } } }); } else { // Loading the image failed, so it's likely a bad file. errorMsg = getContext().getString(R.string.file_invalid, imageFile); } } else { // We should have an image, but the file doesn't exist. errorMsg = getContext().getString(R.string.file_missing, imageFile); } if (errorMsg != null) { // errorMsg is only set when an error has occurred Timber.e(errorMsg); missingImage = new TextView(getContext()); missingImage.setText(errorMsg); missingImage.setPadding(10, 10, 10, 10); missingImage.setId(imageId); } } catch (InvalidReferenceException e) { Timber.e(e, "Invalid image reference due to %s ", e.getMessage()); } } else { // There's no imageURI listed, so just ignore it. } // e.g., for TextView that flag will be true boolean isNotAMultipleChoiceField = !RadioButton.class.isAssignableFrom(text.getClass()) && !CheckBox.class.isAssignableFrom(text.getClass()); // Determine the layout constraints... // Assumes LTR, TTB reading bias! if (viewText.getText().length() == 0 && (imageView != null || missingImage != null)) { // No text; has image. The image is treated as question/choice icon. // The Text view may just have a radio button or checkbox. It // needs to remain in the layout even though it is blank. // // The image view, as created above, will dynamically resize and // center itself. We want it to resize but left-align itself // in the resized area and we want a white background, as otherwise // it will show a grey bar to the right of the image icon. if (imageView != null) { imageView.setScaleType(ScaleType.FIT_START); } // // In this case, we have: // Text upper left; image upper, left edge aligned with text right edge; // audio upper right; video below audio on right. textParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); if (isNotAMultipleChoiceField) { imageParams.addRule(RelativeLayout.CENTER_HORIZONTAL); } else { imageParams.addRule(RelativeLayout.RIGHT_OF, viewText.getId()); } imageParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); if (audioButton != null && videoButton == null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); } else if (audioButton == null && videoButton != null) { videoParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.setMargins(0, 0, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else if (audioButton != null && videoButton != null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.addRule(RelativeLayout.BELOW, audioButton.getId()); videoParams.setMargins(0, 20, 11, 0); imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else { // the image will implicitly scale down to fit within parent... // no need to bound it by the width of the parent... if (!isNotAMultipleChoiceField) { imageParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } } imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } else { // We have a non-blank text label -- image is below the text. // In this case, we want the image to be centered... if (imageView != null) { imageView.setScaleType(ScaleType.FIT_START); } // // Text upper left; audio upper right; video below audio on right. // image below text, audio and video buttons; left-aligned with text. textParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); textParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); if (audioButton != null && videoButton == null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); textParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); } else if (audioButton == null && videoButton != null) { videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.setMargins(0, 0, 11, 0); textParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else if (audioButton != null && videoButton != null) { audioParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); audioParams.setMargins(0, 0, 11, 0); textParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); videoParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); videoParams.setMargins(0, 20, 11, 0); videoParams.addRule(RelativeLayout.BELOW, audioButton.getId()); } else { textParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); } if (imageView != null || missingImage != null) { imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); imageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); if (videoButton != null) { imageParams.addRule(RelativeLayout.LEFT_OF, videoButton.getId()); } else if (audioButton != null) { imageParams.addRule(RelativeLayout.LEFT_OF, audioButton.getId()); } imageParams.addRule(RelativeLayout.BELOW, viewText.getId()); } else { textParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } } addView(viewText, textParams); if (audioButton != null) { addView(audioButton, audioParams); } if (videoButton != null) { addView(videoButton, videoParams); } if (imageView != null) { addView(imageView, imageParams); } else if (missingImage != null) { addView(missingImage, imageParams); } }
From source file:org.nla.tarotdroid.lib.ui.charts.GameScoresEvolutionChartFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { List<double[]> scores = this.statisticsComputer.getScores(); XYMultipleSeriesRenderer renderer = this.buildRenderer(this.statisticsComputer.getScoresColors(), this.getScoresPointStyles()); this.setChartSettings(renderer, "", AppContext.getApplication().getResources().getString(R.string.lblScoreEvolutionGames), AppContext.getApplication().getResources().getString(R.string.lblScoreEvolutionPoints), 0, this.statisticsComputer.getGameCount() + 1, this.statisticsComputer.getMaxAbsoluteScore() * -1 - 100, this.statisticsComputer.getMaxAbsoluteScore() + 100, Color.GRAY, Color.LTGRAY); return ChartFactory.getLineChartView(this.getActivity(), this.buildDataset(this.statisticsComputer.getPlayerNames(), scores), renderer); }
From source file:com.progym.custom.fragments.FoodCalloriesProgressYearlyLineFragment.java
public void setYearProgressData(Date date) { int yMaxAxisValue = 0; try {// ww w . java2s.com rlRootGraphLayout.removeView(viewChart); } catch (Exception edsx) { edsx.printStackTrace(); } DATE = date; // Get amount of days in a month to find out average int daysInMonth = Utils.getDaysInMonth(date.getMonth(), Integer.valueOf(Utils.formatDate(date, DataBaseUtils.DATE_PATTERN_YYYY))); // set January as first month date.setMonth(0); date.setDate(1); int[] x = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); CategorySeries seriesCallories = new CategorySeries("Callories"); List<Ingridient> list; for (int i = 0; i < x.length; i++) { list = DataBaseUtils .getAllFoodConsumedInMonth(Utils.formatDate(date, DataBaseUtils.DATE_PATTERN_YYYY_MM)); // init "average" data int totalCallories = 0; for (Ingridient ingridient : list) { totalCallories += ingridient.kkal; } // add value to series seriesCallories.add(totalCallories / daysInMonth); // calculate maximum Y axis values yMaxAxisValue = Math.max(yMaxAxisValue, totalCallories / daysInMonth); // increment month date = DateUtils.addMonths(date, 1); } int[] colors = new int[] { getActivity().getResources().getColor(R.color.purple) }; XYMultipleSeriesRenderer renderer = buildBarRenderer(colors); setChartSettings(renderer, String.format("Callories statistic for %s year", Utils.getSpecificDateValue(DATE, "yyyy")), "Months", "Amount (g)", 0.7, 12.3, 0, yMaxAxisValue + 30, Color.GRAY, Color.LTGRAY); renderer.getSeriesRendererAt(0).setDisplayChartValues(true); renderer.getSeriesRendererAt(0).setChartValuesTextSize(15f); renderer.setXLabels(0); renderer.setClickEnabled(false); renderer.setZoomEnabled(false); renderer.setPanEnabled(false, false); renderer.setZoomButtonsVisible(false); renderer.setPanLimits(new double[] { 1, 11 }); renderer.setShowGrid(true); renderer.setShowLegend(true); renderer.setFitLegend(true); for (int i = 0; i < ActivityWaterProgress.months_short.length; i++) { renderer.addXTextLabel(i + 1, ActivityWaterProgress.months_short[i]); } dataset.addSeries(seriesCallories.toXYSeries()); viewChart = ChartFactory.getBarChartView(getActivity(), dataset, renderer, Type.DEFAULT); rlRootGraphLayout.addView(viewChart, 0); }