List of usage examples for android.graphics Color argb
@ColorInt public static int argb(float alpha, float red, float green, float blue)
From source file:com.ruesga.rview.widget.TagEditTextView.java
public static int newRandomColor() { int random = (int) (Math.floor(Math.random() * 0xff0f0f0f) + 0xff000000); int color = Color.argb(0xff, Color.red(random), Color.green(random), Color.blue(random)); float[] hsv = new float[3]; Color.colorToHSV(color, hsv); hsv[2] *= 0.8f; // value component color = Color.HSVToColor(hsv); return color; }
From source file:com.klinker.android.sliding.MultiShrinkScroller.java
/** * Sets the tint color that should be applied to the header. If an image is present, this * will go behind the image and show over it as the activity is scrolled, otherwise it will * just be the color displayed at the top of the screen. * @param color the primary color for the activity to display. *//* w w w . j a v a 2 s .c o m*/ public void setHeaderTintColor(int color) { headerTintColor = color; updatePhotoTintAndDropShadow(); // We want to use the same amount of alpha on the new tint color as the previous tint color. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final int edgeEffectAlpha = Color.alpha(edgeGlowBottom.getColor()); edgeGlowBottom.setColor((color & 0xffffff) | Color.argb(edgeEffectAlpha, 0, 0, 0)); edgeGlowTop.setColor(edgeGlowBottom.getColor()); } }
From source file:com.bw.luzz.monkeyapplication.View.DateTimePicker.date.DatePickerDialog.java
/** * Set the accent color of this dialog//from w ww. j a v a 2 s . c om * @param color the accent color you want */ public void setAccentColor(@ColorInt int color) { mAccentColor = Color.argb(255, Color.red(color), Color.green(color), Color.blue(color)); ; }
From source file:org.huxizhijian.sdk.util.StatusBarUtil.java
public static void setTranslucentImageHeader(Activity activity, int alpha, View needOffsetView) { setFullScreen(activity);/*from w w w . ja va 2s .c om*/ //?windowphonedecorView ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); int count = decorView.getChildCount(); //??statusBarView if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) { decorView.getChildAt(count - 1).setBackgroundColor(Color.argb(alpha, 0, 0, 0)); } else { //??view StatusBarView statusView = createTranslucentStatusBarView(activity, alpha); decorView.addView(statusView); } if (needOffsetView != null) { ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView .getLayoutParams(); layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0); } }
From source file:com.jaredrummler.android.colorpicker.ColorPickerDialog.java
private void setupTransparency() { int progress = 255 - Color.alpha(color); transparencySeekBar.setMax(255);//from w w w. j a va 2 s . c om transparencySeekBar.setProgress(progress); int percentage = (int) ((double) progress * 100 / 255); transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage)); transparencySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int percentage = (int) ((double) progress * 100 / 255); transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage)); int alpha = 255 - progress; // update items in GridView: for (int i = 0; i < adapter.colors.length; i++) { int color = adapter.colors[i]; int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); adapter.colors[i] = Color.argb(alpha, red, green, blue); } adapter.notifyDataSetChanged(); // update shades: for (int i = 0; i < shadesLayout.getChildCount(); i++) { FrameLayout layout = (FrameLayout) shadesLayout.getChildAt(i); ColorPanelView cpv = (ColorPanelView) layout.findViewById(R.id.cpv_color_panel_view); ImageView iv = (ImageView) layout.findViewById(R.id.cpv_color_image_view); if (layout.getTag() == null) { // save the original border color layout.setTag(cpv.getBorderColor()); } int color = cpv.getColor(); color = Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); if (alpha <= ALPHA_THRESHOLD) { cpv.setBorderColor(color | 0xFF000000); } else { cpv.setBorderColor((int) layout.getTag()); } if (cpv.getTag() != null && (Boolean) cpv.getTag()) { // The alpha changed on the selected shaded color. Update the checkmark color filter. if (alpha <= ALPHA_THRESHOLD) { iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN); } else { if (ColorUtils.calculateLuminance(color) >= 0.65) { iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN); } else { iv.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); } } } cpv.setColor(color); } // update color: int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); color = Color.argb(alpha, red, green, blue); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); }
From source file:com.nicolatesser.geofencedemo.LocationActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // getIntent() should always return the most recent setIntent(intent);/* w w w . j av a2s . c o m*/ boolean receiverStarted = intent.getBooleanExtra("RECEIVER_STARTED", false); if (!receiverStarted) { return; } Bundle bundle = intent.getParcelableExtra("geo_fences"); ArrayList<String> requestIds = bundle.getStringArrayList("request_ids"); if (requestIds == null) { Log.v(LocationActivity.TAG, "request_ids == null"); return; } int transition = intent.getIntExtra("transition", -2); for (String requestId : requestIds) { Log.v(LocationActivity.TAG, "Triggering Geo Fence requestId " + requestId); if (transition == Geofence.GEOFENCE_TRANSITION_ENTER) { Circle circle = mGeoFences.get(requestId); if (circle == null) { continue; } Log.v(LocationActivity.TAG, "triggering_geo_fences enter == " + requestId); // Add a superimposed red circle when a geofence is entered and // put the corresponding object in triggering_fences. CircleOptions circleOptions = new CircleOptions(); circleOptions.center(circle.getCenter()).radius(circle.getRadius()) .fillColor(Color.argb(100, 100, 0, 0)); Circle newCircle = mMap.addCircle(circleOptions); mTriggeringFences.put(requestId, newCircle); // LocationLoggerService.getInstance().writeActivity( // DemoConstant.NAME, "Entered in Geofence"); } else if (transition == Geofence.GEOFENCE_TRANSITION_EXIT) { Log.v(LocationActivity.TAG, "triggering_geo_fences exit == " + requestId); Circle circle = mTriggeringFences.get(requestId); if (circle == null) { continue; } // Remove the superimposed red circle from the map and the // corresponding Circle object from triggering_fences hash_map. circle.remove(); mTriggeringFences.remove(requestId); // LocationLoggerService.getInstance().writeActivity( // DemoConstant.NAME, "Exited from Geofence"); } } return; }
From source file:com.jrummyapps.android.colorpicker.ColorPickerDialog.java
private void setupTransparency() { int progress = 255 - Color.alpha(color); transparencySeekBar.setMax(255);//from w w w. ja v a 2s.co m transparencySeekBar.setProgress(progress); int percentage = (int) ((double) progress * 100 / 255); transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage)); transparencySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int percentage = (int) ((double) progress * 100 / 255); transparencyPercText.setText(String.format(Locale.ENGLISH, "%d%%", percentage)); int alpha = 255 - progress; // update items in GridView: for (int i = 0; i < adapter.colors.length; i++) { int color = adapter.colors[i]; int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); adapter.colors[i] = Color.argb(alpha, red, green, blue); } adapter.notifyDataSetChanged(); // update shades: for (int i = 0; i < shadesLayout.getChildCount(); i++) { FrameLayout layout = (FrameLayout) shadesLayout.getChildAt(i); ColorPanelView cpv = layout.findViewById(R.id.cpv_color_panel_view); ImageView iv = layout.findViewById(R.id.cpv_color_image_view); if (layout.getTag() == null) { // save the original border color layout.setTag(cpv.getBorderColor()); } int color = cpv.getColor(); color = Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); if (alpha <= ALPHA_THRESHOLD) { cpv.setBorderColor(color | 0xFF000000); } else { cpv.setBorderColor((int) layout.getTag()); } if (cpv.getTag() != null && (Boolean) cpv.getTag()) { // The alpha changed on the selected shaded color. Update the checkmark color filter. if (alpha <= ALPHA_THRESHOLD) { iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN); } else { if (ColorUtils.calculateLuminance(color) >= 0.65) { iv.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_IN); } else { iv.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); } } } cpv.setColor(color); } // update color: int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); color = Color.argb(alpha, red, green, blue); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); }
From source file:info.papdt.blacklight.support.Utility.java
/** * * @param from color value in the form 0xAARRGGBB. * @param to color value in the form 0xAARRGGBB. *//* w ww . j a v a 2 s . c o m*/ public static int getGradientColor(int from, int to, float factor) { int r = calculateGradient(Color.red(from), Color.red(to), factor); // It's so annoying without lambda. int g = calculateGradient(Color.green(from), Color.green(to), factor); int b = calculateGradient(Color.blue(from), Color.blue(to), factor); int a = calculateGradient(Color.alpha(from), Color.alpha(to), factor); return Color.argb(a, r, g, b); }
From source file:com.dngames.mobilewebcam.PhotoSettings.java
@Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if (key == "cam_refresh") { int new_refresh = getEditInt(mContext, prefs, "cam_refresh", 60); String msg = "Camera refresh set to " + new_refresh + " seconds!"; if (MobileWebCam.gIsRunning) { if (!mNoToasts && new_refresh != mRefreshDuration) { try { Toast.makeText(mContext.getApplicationContext(), msg, Toast.LENGTH_SHORT).show(); } catch (RuntimeException e) { e.printStackTrace(); }//from www .j a va2s. co m } } else if (new_refresh != mRefreshDuration) { MobileWebCam.LogI(msg); } } // get all preferences for (Field f : getClass().getFields()) { { BooleanPref bp = f.getAnnotation(BooleanPref.class); if (bp != null) { try { f.setBoolean(this, prefs.getBoolean(bp.key(), bp.val())); } catch (Exception e) { Log.e("MobileWebCam", "Exception: " + bp.key() + " <- " + bp.val()); e.printStackTrace(); } } } { EditIntPref ip = f.getAnnotation(EditIntPref.class); if (ip != null) { try { int eval = getEditInt(mContext, prefs, ip.key(), ip.val()) * ip.factor(); if (ip.max() != Integer.MAX_VALUE) eval = Math.min(eval, ip.max()); if (ip.min() != Integer.MIN_VALUE) eval = Math.max(eval, ip.min()); f.setInt(this, eval); } catch (Exception e) { e.printStackTrace(); } } } { IntPref ip = f.getAnnotation(IntPref.class); if (ip != null) { try { int eval = prefs.getInt(ip.key(), ip.val()) * ip.factor(); if (ip.max() != Integer.MAX_VALUE) eval = Math.min(eval, ip.max()); if (ip.min() != Integer.MIN_VALUE) eval = Math.max(eval, ip.min()); f.setInt(this, eval); } catch (Exception e) { // handle wrong set class e.printStackTrace(); Editor edit = prefs.edit(); edit.remove(ip.key()); edit.putInt(ip.key(), ip.val()); edit.commit(); try { f.setInt(this, ip.val()); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } } } } { EditFloatPref fp = f.getAnnotation(EditFloatPref.class); if (fp != null) { try { float eval = getEditFloat(mContext, prefs, fp.key(), fp.val()); if (fp.max() != Float.MAX_VALUE) eval = Math.min(eval, fp.max()); if (fp.min() != Float.MIN_VALUE) eval = Math.max(eval, fp.min()); f.setFloat(this, eval); } catch (Exception e) { e.printStackTrace(); } } } { StringPref sp = f.getAnnotation(StringPref.class); if (sp != null) { try { f.set(this, prefs.getString(sp.key(), getDefaultString(mContext, sp))); } catch (Exception e) { e.printStackTrace(); } } } } mCustomImageScale = Enum.valueOf(ImageScaleMode.class, prefs.getString("custompicscale", "CROP")); mAutoStart = prefs.getBoolean("autostart", false); mCameraStartupEnabled = prefs.getBoolean("cam_autostart", true); mShutterSound = prefs.getBoolean("shutter", true); mDateTimeColor = GetPrefColor(prefs, "datetime_color", "#FFFFFFFF", Color.WHITE); mDateTimeShadowColor = GetPrefColor(prefs, "datetime_shadowcolor", "#FF000000", Color.BLACK); mDateTimeBackgroundColor = GetPrefColor(prefs, "datetime_backcolor", "#80FF0000", Color.argb(0x80, 0xFF, 0x00, 0x00)); mDateTimeBackgroundLine = prefs.getBoolean("datetime_fillline", true); mDateTimeX = prefs.getInt("datetime_x", 98); mDateTimeY = prefs.getInt("datetime_y", 98); mDateTimeAlign = Paint.Align.valueOf(prefs.getString("datetime_imprintalign", "RIGHT")); mDateTimeFontScale = (float) prefs.getInt("datetime_fontsize", 6); mTextColor = GetPrefColor(prefs, "text_color", "#FFFFFFFF", Color.WHITE); mTextShadowColor = GetPrefColor(prefs, "text_shadowcolor", "#FF000000", Color.BLACK); mTextBackgroundColor = GetPrefColor(prefs, "text_backcolor", "#80FF0000", Color.argb(0x80, 0xFF, 0x00, 0x00)); mTextBackgroundLine = prefs.getBoolean("text_fillline", true); mTextX = prefs.getInt("text_x", 2); mTextY = prefs.getInt("text_y", 2); mTextAlign = Paint.Align.valueOf(prefs.getString("text_imprintalign", "LEFT")); mTextFontScale = (float) prefs.getInt("infotext_fontsize", 6); mTextFontname = prefs.getString("infotext_fonttypeface", ""); mStatusInfoColor = GetPrefColor(prefs, "statusinfo_color", "#FFFFFFFF", Color.WHITE); mStatusInfoShadowColor = GetPrefColor(prefs, "statusinfo_shadowcolor", "#FF000000", Color.BLACK); mStatusInfoX = prefs.getInt("statusinfo_x", 2); mStatusInfoY = prefs.getInt("statusinfo_y", 98); mStatusInfoAlign = Paint.Align.valueOf(prefs.getString("statusinfo_imprintalign", "LEFT")); mStatusInfoBackgroundColor = GetPrefColor(prefs, "statusinfo_backcolor", "#00000000", Color.TRANSPARENT); mStatusInfoFontScale = (float) prefs.getInt("statusinfo_fontsize", 6); mStatusInfoBackgroundLine = prefs.getBoolean("statusinfo_fillline", false); mGPSColor = GetPrefColor(prefs, "gps_color", "#FFFFFFFF", Color.WHITE); mGPSShadowColor = GetPrefColor(prefs, "gps_shadowcolor", "#FF000000", Color.BLACK); mGPSX = prefs.getInt("gps_x", 98); mGPSY = prefs.getInt("gps_y", 2); mGPSAlign = Paint.Align.valueOf(prefs.getString("gps_imprintalign", "RIGHT")); mGPSBackgroundColor = GetPrefColor(prefs, "gps_backcolor", "#00000000", Color.TRANSPARENT); mGPSFontScale = (float) prefs.getInt("gps_fontsize", 6); mGPSBackgroundLine = prefs.getBoolean("gps_fillline", false); mImprintPictureX = prefs.getInt("imprint_picture_x", 0); mImprintPictureY = prefs.getInt("imprint_picture_y", 0); mNightAutoConfigEnabled = prefs.getBoolean("night_auto_enabled", false); mSetNightConfiguration = prefs.getBoolean("cam_nightconfiguration", false); // override night camera parameters (read again with postfix) getCurrentNightSettings(); mFilterPicture = false; //***prefs.getBoolean("filter_picture", false); mFilterType = getEditInt(mContext, prefs, "filter_sel", 0); if (mImprintPicture) { if (mImprintPictureURL.length() == 0) { // sdcard image File path = new File(Environment.getExternalStorageDirectory() + "/MobileWebCam/"); if (path.exists()) { synchronized (gImprintBitmapLock) { if (gImprintBitmap != null) gImprintBitmap.recycle(); gImprintBitmap = null; File file = new File(path, "imprint.png"); try { FileInputStream in = new FileInputStream(file); gImprintBitmap = BitmapFactory.decodeStream(in); in.close(); } catch (IOException e) { Toast.makeText(mContext, "Error: unable to read imprint bitmap " + file.getName() + "!", Toast.LENGTH_SHORT).show(); gImprintBitmap = null; } catch (OutOfMemoryError e) { Toast.makeText(mContext, "Error: imprint bitmap " + file.getName() + " too large!", Toast.LENGTH_LONG).show(); gImprintBitmap = null; } } } } else { DownloadImprintBitmap(); } synchronized (gImprintBitmapLock) { if (gImprintBitmap == null) { // last resort: resource default try { gImprintBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.imprint); } catch (OutOfMemoryError e) { Toast.makeText(mContext, "Error: default imprint bitmap too large!", Toast.LENGTH_LONG) .show(); gImprintBitmap = null; } } } } mNoToasts = prefs.getBoolean("no_messages", false); mFullWakeLock = prefs.getBoolean("full_wakelock", true); switch (getEditInt(mContext, prefs, "camera_mode", 1)) { case 0: mMode = Mode.MANUAL; break; case 2: mMode = Mode.HIDDEN; break; case 3: mMode = Mode.BACKGROUND; break; case 1: default: mMode = Mode.NORMAL; break; } }
From source file:org.mixare.DataView.java
public void draw(PaintScreen dw) { // ? ?? ? ?? ? mixContext.getRM(cam.transform);//from w w w. ja v a 2s.co m // ? ? ?? curFix = mixContext.getCurrentLocation(); int po = mixContext.getPosition(); String searchtitle = mixContext.title; double searchlat = mixContext.lat; double searchlon = mixContext.lon; // ? ?? ? ?? state.calcPitchBearing(cam.transform); // Load Layer // ? ? ? ??, ?? ? if (state.nextLStatus == MixState.NOT_STARTED && !frozen) { // Log.i("check", String.valueOf(po)); // ?? URL ? ?? if (mixContext.getStartUrl().length() > 0) { // ? ? ?? switch (po) { case 1: requestData(mixContext.getStartUrl(), DATAFORMAT.CONVENIENCE, DATASOURCE.CONVENIENCE); isLauncherStarted = true; break; // ? ? ? case 2: requestData(mixContext.getStartUrl(), DATAFORMAT.CAFE, DATASOURCE.CAFE); isLauncherStarted = true; break; case 3: requestData(mixContext.getStartUrl(), DATAFORMAT.BANK, DATASOURCE.BANK); isLauncherStarted = true; break; case 4: requestData(mixContext.getStartUrl(), DATAFORMAT.PCCAFE, DATASOURCE.PCCAFE); isLauncherStarted = true; break; case 5: requestData(mixContext.getStartUrl(), DATAFORMAT.HOSPITAL, DATASOURCE.HOSPITAL); isLauncherStarted = true; break; case 6: requestData(mixContext.getStartUrl(), DATAFORMAT.PHARMACY, DATASOURCE.PHARMACY); isLauncherStarted = true; break; case 7: requestData(mixContext.getStartUrl(), DATAFORMAT.HOTEL, DATASOURCE.HOTEL); isLauncherStarted = true; break; case 8: requestData(mixContext.getStartUrl(), DATAFORMAT.SEARCH, DATASOURCE.SEARCH); isLauncherStarted = true; Toast.makeText(mixContext, "data view default", Toast.LENGTH_SHORT).show(); break; default: Toast.makeText(mixContext, "data view default", Toast.LENGTH_SHORT).show(); break; // if (!mixContext.isDataSourceSelected(DataSource.DATASOURCE.CAFE)) { // mixContext.toogleDataSource(DataSource.DATASOURCE.CAFE); } } // URL ? ? ? ? else { // ? ?, ?, ? ? ? double lat = curFix.getLatitude(), lon = curFix.getLongitude(), alt = curFix.getAltitude(); if (po == 1) { if (mixContext.isDataSourceSelected(DataSource.DATASOURCE.CONVENIENCE)) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.CONVENIENCE, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.CONVENIENCE), DataSource.DATASOURCE.CONVENIENCE); } } else if (po == 2) { if (mixContext.isDataSourceSelected(DataSource.DATASOURCE.CAFE)) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.CAFE, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.CAFE), DataSource.DATASOURCE.CAFE); } } else if (po == 3) { if (mixContext.isDataSourceSelected(DataSource.DATASOURCE.BANK)) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.BANK, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.BANK), DataSource.DATASOURCE.BANK); } } else if (po == 4) { if (mixContext.isDataSourceSelected(DataSource.DATASOURCE.PCCAFE)) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.PCCAFE, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.PCCAFE), DataSource.DATASOURCE.PCCAFE); } } else if (po == 5) { if (mixContext.isDataSourceSelected(DataSource.DATASOURCE.HOSPITAL)) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.HOSPITAL, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.HOSPITAL), DataSource.DATASOURCE.HOSPITAL); } } else if (po == 6) { if (mixContext.isDataSourceSelected(DataSource.DATASOURCE.PHARMACY)) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.PHARMACY, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.PHARMACY), DataSource.DATASOURCE.PHARMACY); } } else if (po == 7) { if (mixContext.isDataSourceSelected(DataSource.DATASOURCE.HOTEL)) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.HOTEL, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.HOTEL), DataSource.DATASOURCE.HOTEL); } } else if (po == 8) { requestData( DataSource.createRequestURL(DataSource.DATASOURCE.SEARCH, lat, lon, alt, radius, Locale.getDefault().getLanguage(), searchlat, searchlon), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.SEARCH), DataSource.DATASOURCE.SEARCH); // Intent intent = new Intent(); // ArrayList<String> items = intent.getStringArrayExtra("data"); } /*switch(po) { case 1: if(mixContext.isDataSourceSelected(DataSource.DATASOURCE.CONVENIENCE)){ requestData(DataSource.createRequestURL(DataSource.DATASOURCE.CONVENIENCE, lat, lon, alt, radius, Locale.getDefault().getLanguage()), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.CONVENIENCE),DataSource.DATASOURCE.CONVENIENCE);} break; case 2: if(mixContext.isDataSourceSelected(DataSource.DATASOURCE.CAFE)){ requestData(DataSource.createRequestURL(DataSource.DATASOURCE.CAFE, lat, lon, alt, radius, Locale.getDefault().getLanguage()), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.CAFE),DataSource.DATASOURCE.CAFE);} break; case 3: if(mixContext.isDataSourceSelected(DataSource.DATASOURCE.BANK)){ requestData(DataSource.createRequestURL(DataSource.DATASOURCE.BANK, lat, lon, alt, radius, Locale.getDefault().getLanguage()), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.BANK),DataSource.DATASOURCE.BANK);} break; case 4: if(mixContext.isDataSourceSelected(DataSource.DATASOURCE.PCCAFE)){ requestData(DataSource.createRequestURL(DataSource.DATASOURCE.PCCAFE, lat, lon, alt, radius, Locale.getDefault().getLanguage()), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.PCCAFE),DataSource.DATASOURCE.PCCAFE);} break; case 5: if(mixContext.isDataSourceSelected(DataSource.DATASOURCE.HOSPITAL)){ requestData(DataSource.createRequestURL(DataSource.DATASOURCE.HOSPITAL, lat, lon, alt, radius, Locale.getDefault().getLanguage()), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.HOSPITAL),DataSource.DATASOURCE.HOSPITAL);} break; case 6: if(mixContext.isDataSourceSelected(DataSource.DATASOURCE.PHARMACY)){ requestData(DataSource.createRequestURL(DataSource.DATASOURCE.PHARMACY, lat, lon, alt, radius, Locale.getDefault().getLanguage()), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.PHARMACY),DataSource.DATASOURCE.PHARMACY);} break; case 7: if(mixContext.isDataSourceSelected(DataSource.DATASOURCE.HOTEL)){ requestData(DataSource.createRequestURL(DataSource.DATASOURCE.HOTEL, lat, lon, alt, radius, Locale.getDefault().getLanguage()), DataSource.dataFormatFromDataSource(DataSource.DATASOURCE.HOTEL),DataSource.DATASOURCE.HOTEL);} break; }*/ // ??? ?? ?? ? /* for(DataSource.DATASOURCE source: DataSource.DATASOURCE.values()) { // ?? ?? ?? ? Log.i("check", String.valueOf(cnt++));f requestData(DataSource.createRequestURL(source,lat,lon,alt,radius,Locale.getDefault().getLanguage()),DataSource.dataFormatFromDataSource(source),source); // Debug notification // Toast.makeText(mixContext, "Downloading from "+ source, Toast.LENGTH_SHORT).show(); } }*/ } // ? ? ? ?? ? if (state.nextLStatus == MixState.NOT_STARTED) state.nextLStatus = MixState.DONE; // ? ? ? } //TODO: //state.downloadId = mixContext.getDownloader().submitJob(request); else if (state.nextLStatus == MixState.PROCESSING) { // ? ?? // ? ? ? DownloadManager dm = mixContext.getDownloader(); DownloadResult dRes; // // ?? ?? ? while ((dRes = dm.getNextResult()) != null) { // ? ? ?? ? 1 ?? if (dRes.error && retry < 2) { retry++; // ? ? mixContext.getDownloader().submitJob(dRes.errorRequest); // ? ?? Toast.makeText(mixContext, mixContext.getResources().getString(R.string.download_error) + " " + dRes.errorRequest.url, Toast.LENGTH_SHORT).show(); } // ? if (!dRes.error) { //jLayer = (DataHandler) dRes.obj; // ?? ? Log.i(MixView.TAG, "Adding Markers"); dataHandler.addMarkers(dRes.getMarkers()); dataHandler.onLocationChanged(curFix); // // ?? ?? Toast.makeText(mixContext, mixContext.getResources().getString(R.string.download_received) + " " + dRes.source, Toast.LENGTH_SHORT).show(); } } if (dm.isDone()) { // ?? ? ?? retry = 0; // ? state.nextLStatus = MixState.DONE; // ? ? } } /* ?? */ dataHandler.updateActivationStatus(mixContext); // ? // ??? ? ? for (int i = dataHandler.getMarkerCount() - 1; i >= 0; i--) { Marker ma = dataHandler.getMarker(i); //if (ma.isActive() && (ma.getDistance() / 1000f < radius || ma instanceof NavigationMarker || ma instanceof SocialMarker)) { // ? ? ? ? if (ma.isActive() && (ma.getDistance() / 1000f < radius)) { // ? ? , ? // , ? ?? // ? ? ?? //if (!frozen) // ma.update(curFix); if (!frozen) ma.calcPaint(cam, addX, addY); ma.draw(dw); } } /* ?? */ String dirTxt = ""; // ? ? int bearing = (int) state.getCurBearing(); // ? ?? ?? int range = (int) (state.getCurBearing() / (360f / 16f)); // //TODO: XML ? ? ? ? // ? ? ? ? if (range == 15 || range == 0) dirTxt = "N"; else if (range == 1 || range == 2) dirTxt = "NE"; else if (range == 3 || range == 4) dirTxt = "E"; else if (range == 5 || range == 6) dirTxt = "SE"; else if (range == 7 || range == 8) dirTxt = "S"; else if (range == 9 || range == 10) dirTxt = "SW"; else if (range == 11 || range == 12) dirTxt = "W"; else if (range == 13 || range == 14) dirTxt = "NW"; // ??? ?? radarPoints.view = this; // ? ?? dw.paintObj(radarPoints, rx, ry, -state.getCurBearing(), 1); dw.setFill(false); dw.setColor(Color.argb(150, 0, 0, 220)); dw.paintLine(lrl.x, lrl.y, rx + RadarPoints.RADIUS, ry + RadarPoints.RADIUS); dw.paintLine(rrl.x, rrl.y, rx + RadarPoints.RADIUS, ry + RadarPoints.RADIUS); dw.setColor(Color.rgb(255, 255, 255)); dw.setFontSize(12); // ??? ? ? radarText(dw, MixUtils.formatDist(radius * 1000), rx + RadarPoints.RADIUS, ry + RadarPoints.RADIUS * 2 - 10, false); radarText(dw, "" + bearing + ((char) 176) + " " + dirTxt, rx + RadarPoints.RADIUS, ry - 5, true); /* ? UI ? */ UIEvent evt = null; synchronized (uiEvents) { if (uiEvents.size() > 0) { evt = uiEvents.get(0); uiEvents.remove(0); } } // ?? if (evt != null) { switch (evt.type) { case UIEvent.KEY: handleKeyEvent((KeyEvent) evt); break; case UIEvent.CLICK: handleClickEvent((ClickEvent) evt); break; } } state.nextLStatus = MixState.PROCESSING; // ? ? }