android.os.Bundle#getFloat ( )源码实例Demo

下面列出了android.os.Bundle#getFloat ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SprintNBA   文件: CircleProgress.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if(state instanceof Bundle) {
        final Bundle bundle = (Bundle) state;
        textColor = bundle.getInt(INSTANCE_TEXT_COLOR);
        textSize = bundle.getFloat(INSTANCE_TEXT_SIZE);
        finishedColor = bundle.getInt(INSTANCE_FINISHED_STROKE_COLOR);
        unfinishedColor = bundle.getInt(INSTANCE_UNFINISHED_STROKE_COLOR);
        initPainters();
        setMax(bundle.getInt(INSTANCE_MAX));
        setProgress(bundle.getInt(INSTANCE_PROGRESS));
        prefixText = bundle.getString(INSTANCE_PREFIX);
        suffixText = bundle.getString(INSTANCE_SUFFIX);
        super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE));
        return;
    }
    super.onRestoreInstanceState(state);
}
 
源代码2 项目: XYStudy   文件: MainActivity.java
@Override
public void run() {
    Looper.prepare();
    tHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MSG_MOTIONEVENT:
                    Bundle bundle = msg.getData();
                    float rx = bundle.getFloat("x");
                    float ry = bundle.getFloat("y");

                    mInst.sendPointerSync(MotionEvent.obtain(SystemClock.uptimeMillis(),
                            SystemClock.uptimeMillis(), msg.arg1,
                            rx, ry, 0));
                    break;
            }
        }
    };
    Looper.loop();
}
 
源代码3 项目: SwipableLayout   文件: TouchImageView.java
@Override
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        normalizedScale = bundle.getFloat("saveScale");
        m = bundle.getFloatArray("matrix");
        prevMatrix.setValues(m);
        prevMatchViewHeight = bundle.getFloat("matchViewHeight");
        prevMatchViewWidth = bundle.getFloat("matchViewWidth");
        prevViewHeight = bundle.getInt("viewHeight");
        prevViewWidth = bundle.getInt("viewWidth");
        imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
源代码4 项目: Document-Scanner   文件: TouchImageView.java
@Override
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        normalizedScale = bundle.getFloat("saveScale");
        m = bundle.getFloatArray("matrix");
        prevMatrix.setValues(m);
        prevMatchViewHeight = bundle.getFloat("matchViewHeight");
        prevMatchViewWidth = bundle.getFloat("matchViewWidth");
        prevViewHeight = bundle.getInt("viewHeight");
        prevViewWidth = bundle.getInt("viewWidth");
        imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
源代码5 项目: iGap-Android   文件: TouchImageView.java
@Override
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        normalizedScale = bundle.getFloat("saveScale");
        m = bundle.getFloatArray("matrix");
        prevMatrix.setValues(m);
        prevMatchViewHeight = bundle.getFloat("matchViewHeight");
        prevMatchViewWidth = bundle.getFloat("matchViewWidth");
        prevViewHeight = bundle.getInt("viewHeight");
        prevViewWidth = bundle.getInt("viewWidth");
        imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
源代码6 项目: FireFiles   文件: NumberProgressBar.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if(state instanceof Bundle){
        final Bundle bundle = (Bundle)state;
        mTextColor = bundle.getInt(INSTANCE_TEXT_COLOR);
        mTextSize = bundle.getFloat(INSTANCE_TEXT_SIZE);
        mReachedBarHeight = bundle.getFloat(INSTANCE_REACHED_BAR_HEIGHT);
        mUnreachedBarHeight = bundle.getFloat(INSTANCE_UNREACHED_BAR_HEIGHT);
        mReachedBarColor = bundle.getInt(INSTANCE_REACHED_BAR_COLOR);
        mUnreachedBarColor = bundle.getInt(INSTANCE_UNREACHED_BAR_COLOR);
        initializePainters();
        setMax(bundle.getInt(INSTANCE_MAX));
        setProgress(bundle.getInt(INSTANCE_PROGRESS));
        setPrefix(bundle.getString(INSTANCE_PREFIX));
        setSuffix(bundle.getString(INSTANCE_SUFFIX));
        setProgressTextVisibility(bundle.getBoolean(INSTANCE_TEXT_VISBILITY) ? ProgressTextVisibility.Visible : ProgressTextVisibility.Invisible);
        super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE));
        return;
    }
    super.onRestoreInstanceState(state);
}
 
@Override
public void onRestoreInstanceState(Parcelable state) {
  	if (state instanceof Bundle) {
     Bundle bundle = (Bundle) state;
     normalizedScale = bundle.getFloat("saveScale");
     m = bundle.getFloatArray("matrix");
     prevMatrix.setValues(m);
     prevMatchViewHeight = bundle.getFloat("matchViewHeight");
     prevMatchViewWidth = bundle.getFloat("matchViewWidth");
     prevViewHeight = bundle.getInt("viewHeight");
     prevViewWidth = bundle.getInt("viewWidth");
     imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
     super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
     return;
  	}

  	super.onRestoreInstanceState(state);
}
 
@Override public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;

        this.hasBorder = bundle.getBoolean(BorderView.KEY_DISPLAYED);
        this.bootstrapSize = bundle.getFloat(BootstrapSizeView.KEY);

        Serializable brand = bundle.getSerializable(BootstrapBrandView.KEY);

        if (brand instanceof BootstrapBrand) {
            this.bootstrapBrand = (BootstrapBrand) brand;
        }
        state = bundle.getParcelable(TAG);
    }
    super.onRestoreInstanceState(state);
    updateImageState();
}
 
源代码9 项目: GankMeizhi   文件: TouchImageView.java
@Override
public void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        normalizedScale = bundle.getFloat("saveScale");
        m = bundle.getFloatArray("matrix");
        prevMatrix.setValues(m);
        prevMatchViewHeight = bundle.getFloat("matchViewHeight");
        prevMatchViewWidth = bundle.getFloat("matchViewWidth");
        prevViewHeight = bundle.getInt("viewHeight");
        prevViewWidth = bundle.getInt("viewWidth");
        imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
        super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
        return;
    }

    super.onRestoreInstanceState(state);
}
 
源代码10 项目: glass_snippets   文件: CameraService.java
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
	if (intent.getExtras() != null) {
		Bundle e = intent.getExtras();

		Log.d(TAG, e.keySet().toString());

		mWidth = e.getInt(Parameters.WIDTH, mWidth);
		Log.e(TAG, String.format("mWidth is %d", mWidth));
		mHeight = e.getInt(Parameters.HEIGHT, mHeight);
		mX = e.getInt(Parameters.X, mX);
		mY = e.getInt(Parameters.Y, mY);
		mOutFile = e.getString(Parameters.OUTFILE, mOutFile);
		mCaptureRate = e.getFloat(Parameters.RATE, mCaptureRate);
	}

	// Create new SurfaceView, and put on top of all other windows
	windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
	surfaceView = new SurfaceView(this);
	LayoutParams layoutParams = new WindowManager.LayoutParams(
			mWidth, mHeight, mX, mY,
			WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
			WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
			PixelFormat.TRANSLUCENT
	);
	layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
	windowManager.addView(surfaceView, layoutParams);
	surfaceView.getHolder().addCallback(this);

	super.onStartCommand(intent, flags, startId);
	return START_NOT_STICKY;
}
 
源代码11 项目: memoir   文件: ColorWheelView.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
    Bundle savedState = (Bundle) state;

    Parcelable superState = savedState.getParcelable(STATE_PARENT);
    super.onRestoreInstanceState(superState);

    mAngle = savedState.getFloat(STATE_ANGLE);
    setOldCenterColor(savedState.getInt(STATE_OLD_COLOR));
    mShowCenterOldColor = savedState.getBoolean(STATE_SHOW_OLD_COLOR);
    int currentColor = calculateColor(mAngle);
    mPointerColor.setColor(currentColor);
    setNewCenterColor(currentColor);
}
 
源代码12 项目: AndroidDemoProjects   文件: MainActivity.java
@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
if( savedInstanceState != null ) {
	if( savedInstanceState.containsKey( EXTRA_LAT ) && savedInstanceState.containsKey( EXTRA_LONG ) ) {
		mCurrentLocation = new LatLng( savedInstanceState.getDouble( EXTRA_LAT ), savedInstanceState.getDouble( EXTRA_LONG ) );
		if( savedInstanceState.containsKey( EXTRA_TILT ) && savedInstanceState.containsKey( EXTRA_BEARING ) ) {
			mTilt = savedInstanceState.getFloat( EXTRA_TILT );
			mBearing = savedInstanceState.getFloat( EXTRA_BEARING );
			mZoom = savedInstanceState.getFloat( EXTRA_ZOOM );
		}
	}
}
  }
 
源代码13 项目: SlideUp-Android   文件: SlideUpBuilder.java
/**
 * <p>Trying restore saved state</p>
 */
private void restoreParams(@Nullable Bundle savedState) {
    if (savedState == null) return;
    mStateRestored = savedState.getBoolean(SlideUp.KEY_STATE_SAVED, false);
    if (savedState.getSerializable(SlideUp.KEY_STATE) != null) {
        mStartState = (SlideUp.State) savedState.getSerializable(SlideUp.KEY_STATE);
    }
    mStartGravity = savedState.getInt(SlideUp.KEY_START_GRAVITY, mStartGravity);
    mDebug = savedState.getBoolean(SlideUp.KEY_DEBUG, mDebug);
    mTouchableArea = savedState.getFloat(SlideUp.KEY_TOUCHABLE_AREA, mTouchableArea) * mDensity;
    mAutoSlideDuration = savedState.getInt(SlideUp.KEY_AUTO_SLIDE_DURATION, mAutoSlideDuration);
    mHideKeyboard = savedState.getBoolean(SlideUp.KEY_HIDE_SOFT_INPUT, mHideKeyboard);
}
 
源代码14 项目: SpinnerLoader   文件: SpinnerLoader.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if(state instanceof Bundle){
        final Bundle bundle = (Bundle)state;
        angle = bundle.getInt(ANGLE);
        bigCircleCenterX = bundle.getFloat(BIGCIRCLECENTERX);
        bigCircleCenterY = bundle.getFloat(BIGCIRCLECENTERY);
        raduis = bundle.getFloat(RADUIS);
        circleRaduis = bundle.getFloat(CIRCLERADUIS);
        moveRaduis = bundle.getFloat(MOVERADUIS);
        startX1 = bundle.getFloat(STARTX1);
        startY1 = bundle.getFloat(STARTY1);
        endX1 = bundle.getFloat(ENDX1);
        endY1 = bundle.getFloat(ENDY1);
        startX2 = bundle.getFloat(STARTX2);
        startY2 = bundle.getFloat(STARTY2);
        endX2 = bundle.getFloat(ENDX2);
        endY2 = bundle.getFloat(ENDY2);
        controlX1 = bundle.getFloat(CONTROLX1);
        controlY1 = bundle.getFloat(CONTROLY1);
        pointColor = bundle.getInt(POINTCOLOR);
        bigStep = bundle.getInt(BIGSTEP);
        init();
        super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE));
        return;
    }
    super.onRestoreInstanceState(state);
}
 
源代码15 项目: nono-android   文件: ColorPicker.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
	Bundle savedState = (Bundle) state;

	Parcelable superState = savedState.getParcelable(STATE_PARENT);
	super.onRestoreInstanceState(superState);

	mAngle = savedState.getFloat(STATE_ANGLE);
	setOldCenterColor(savedState.getInt(STATE_OLD_COLOR));
	mShowCenterOldColor = savedState.getBoolean(STATE_SHOW_OLD_COLOR);
	int currentColor = calculateColor(mAngle);
	mPointerColor.setColor(currentColor);
	setNewCenterColor(currentColor);
}
 
源代码16 项目: BigApp_Discuz_Android   文件: BottomItemView.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
        Bundle bundle = (Bundle) state;
        mAlpha = bundle.getFloat(STATUS_ALPHA);
        super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATUS));
        return;
    }
    super.onRestoreInstanceState(state);
}
 
源代码17 项目: android_9.0.0_r45   文件: TextToSpeechService.java
float getFloatParam(Bundle params, String key, float defaultValue) {
    return params == null ? defaultValue : params.getFloat(key, defaultValue);
}
 
源代码18 项目: weex   文件: QRCodeEncoder.java
private void encodeQRCodeContents(Intent intent, String type) {
  switch (type) {
    case Contents.Type.TEXT:
      String textData = intent.getStringExtra(Intents.Encode.DATA);
      if (textData != null && !textData.isEmpty()) {
        contents = textData;
        displayContents = textData;
        title = activity.getString(R.string.contents_text);
      }
      break;

    case Contents.Type.EMAIL:
      String emailData = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
      if (emailData != null) {
        contents = "mailto:" + emailData;
        displayContents = emailData;
        title = activity.getString(R.string.contents_email);
      }
      break;

    case Contents.Type.PHONE:
      String phoneData = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
      if (phoneData != null) {
        contents = "tel:" + phoneData;
        displayContents = PhoneNumberUtils.formatNumber(phoneData);
        title = activity.getString(R.string.contents_phone);
      }
      break;

    case Contents.Type.SMS:
      String smsData = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
      if (smsData != null) {
        contents = "sms:" + smsData;
        displayContents = PhoneNumberUtils.formatNumber(smsData);
        title = activity.getString(R.string.contents_sms);
      }
      break;

    case Contents.Type.CONTACT:
      Bundle contactBundle = intent.getBundleExtra(Intents.Encode.DATA);
      if (contactBundle != null) {

        String name = contactBundle.getString(ContactsContract.Intents.Insert.NAME);
        String organization = contactBundle.getString(ContactsContract.Intents.Insert.COMPANY);
        String address = contactBundle.getString(ContactsContract.Intents.Insert.POSTAL);
        List<String> phones = getAllBundleValues(contactBundle, Contents.PHONE_KEYS);
        List<String> phoneTypes = getAllBundleValues(contactBundle, Contents.PHONE_TYPE_KEYS);
        List<String> emails = getAllBundleValues(contactBundle, Contents.EMAIL_KEYS);
        String url = contactBundle.getString(Contents.URL_KEY);
        List<String> urls = url == null ? null : Collections.singletonList(url);
        String note = contactBundle.getString(Contents.NOTE_KEY);

        ContactEncoder encoder = useVCard ? new VCardContactEncoder() : new MECARDContactEncoder();
        String[] encoded = encoder.encode(Collections.singletonList(name),
                                          organization,
                                          Collections.singletonList(address),
                                          phones,
                                          phoneTypes,
                                          emails,
                                          urls,
                                          note);
        // Make sure we've encoded at least one field.
        if (!encoded[1].isEmpty()) {
          contents = encoded[0];
          displayContents = encoded[1];
          title = activity.getString(R.string.contents_contact);
        }

      }
      break;

    case Contents.Type.LOCATION:
      Bundle locationBundle = intent.getBundleExtra(Intents.Encode.DATA);
      if (locationBundle != null) {
        // These must use Bundle.getFloat(), not getDouble(), it's part of the API.
        float latitude = locationBundle.getFloat("LAT", Float.MAX_VALUE);
        float longitude = locationBundle.getFloat("LONG", Float.MAX_VALUE);
        if (latitude != Float.MAX_VALUE && longitude != Float.MAX_VALUE) {
          contents = "geo:" + latitude + ',' + longitude;
          displayContents = latitude + "," + longitude;
          title = activity.getString(R.string.contents_location);
        }
      }
      break;
  }
}
 
源代码19 项目: BarcodeScanner   文件: CaptureActivityHandler.java
@Override
public void handleMessage(Message message) {
	switch (message.what) {
		case R.id.restart_preview: // 准备进行下一次扫描
			Log.d(TAG, "Got restart preview message");
			restartPreviewAndDecode();
			break;
		case R.id.decode_succeeded:
			Log.d(TAG, "Got decode succeeded message");
			state = State.SUCCESS;
			Bundle bundle = message.getData();
			Bitmap barcode = null;
			float scaleFactor = 1.0f;
			if (bundle != null) {
				byte[] compressedBitmap = bundle
						.getByteArray(DecodeThread.BARCODE_BITMAP);
				if (compressedBitmap != null) {
					barcode = BitmapFactory.decodeByteArray(
							compressedBitmap, 0, compressedBitmap.length,
							null);
					// Mutable copy:
					barcode = barcode.copy(Bitmap.Config.ARGB_8888, true);
				}
				scaleFactor = bundle
						.getFloat(DecodeThread.BARCODE_SCALED_FACTOR);
			}
			activity.handleDecode((Result) message.obj, barcode,
					scaleFactor);
			break;
		case R.id.decode_failed:
			// We're decoding as fast as possible, so when one decode fails,
			// start another.
			state = State.PREVIEW;
			cameraManager.requestPreviewFrame(decodeThread.getHandler(),
					R.id.decode);
			break;
		case R.id.return_scan_result:
			Log.d(TAG, "Got return scan result message");
			activity.setResult(Activity.RESULT_OK, (Intent) message.obj);
			activity.finish();
			break;
		case R.id.launch_product_query:
			Log.d(TAG, "Got product query message");
			String url = (String) message.obj;

			Intent intent = new Intent(Intent.ACTION_VIEW);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
			intent.setData(Uri.parse(url));

			/**
			 * 这段代码是zxing项目组想要用chrome打开浏览器浏览url
			 */
			ResolveInfo resolveInfo = activity.getPackageManager()
					.resolveActivity(intent,
							PackageManager.MATCH_DEFAULT_ONLY);
			String browserPackageName = null;
			if (resolveInfo != null && resolveInfo.activityInfo != null) {
				browserPackageName = resolveInfo.activityInfo.packageName;
				Log.d(TAG, "Using browser in package " + browserPackageName);
			}

			// Needed for default Android browser / Chrome only apparently
			if ("com.android.browser".equals(browserPackageName)
					|| "com.android.chrome".equals(browserPackageName)) {
				intent.setPackage(browserPackageName);
				intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				intent.putExtra(Browser.EXTRA_APPLICATION_ID,
						browserPackageName);
			}

			try {
				activity.startActivity(intent);
			}
			catch (ActivityNotFoundException ignored) {
				Log.w(TAG, "Can't find anything to handle VIEW of URI "
						+ url);
			}
			break;
	}
}
 
源代码20 项目: YcShareElement   文件: TextViewStateSaver.java
public float getTextSize(Bundle bundle){
    return bundle.getFloat("textSize");
}