当前位置: 首页>>代码示例>>Java>>正文


Java SizeF类代码示例

本文整理汇总了Java中android.util.SizeF的典型用法代码示例。如果您正苦于以下问题:Java SizeF类的具体用法?Java SizeF怎么用?Java SizeF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SizeF类属于android.util包,在下文中一共展示了SizeF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTransact

import android.util.SizeF; //导入依赖的package包/类
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch(code) {
        case TRANSACT_methodWithNotNullSizeArrayParameter: {
            data.enforceInterface(this.getInterfaceDescriptor());

            final SizeF[] sizeArrayParamArray;
            final int sizeArrayParamLength = data.readInt();
            if (sizeArrayParamLength < 0) {
                sizeArrayParamArray = null;
            } else {
                sizeArrayParamArray = new SizeF[sizeArrayParamLength];
                for (int i = 0; i < sizeArrayParamArray.length; i++) {
                    sizeArrayParamArray[i] = data.readSizeF();
                }
            }

            delegate.methodWithNotNullSizeArrayParameter(sizeArrayParamArray);
            reply.writeNoException();

            return true;
        }
    }
    return super.onTransact(code, data, reply, flags);
}
 
开发者ID:chdir,项目名称:aidl2,代码行数:26,代码来源:NotNullSizeArrayParameter$$AidlServerImpl.java

示例2: methodWithNotNullSizeArrayParameter

import android.util.SizeF; //导入依赖的package包/类
@Override
public void methodWithNotNullSizeArrayParameter(@NotNull SizeF[] sizeArrayParam) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(NotNullSizeArrayParameter$$AidlServerImpl.DESCRIPTOR);

        if (sizeArrayParam == null) {
            data.writeInt(-1);
        } else {
            data.writeInt(sizeArrayParam.length);
            for (SizeF sizeArrayParamComponent : sizeArrayParam) {
                data.writeSizeF(sizeArrayParamComponent);
            }
        }

        delegate.transact(NotNullSizeArrayParameter$$AidlServerImpl.TRANSACT_methodWithNotNullSizeArrayParameter, data, reply, 0);
        reply.readException();
    } finally {
        data.recycle();
        reply.recycle();
    }
}
 
开发者ID:chdir,项目名称:aidl2,代码行数:24,代码来源:NotNullSizeArrayParameter$$AidlClientImpl.java

示例3: getAngle

import android.util.SizeF; //导入依赖的package包/类
public float[] getAngle() {
    // 物理センサのサイズを取得(単位はミリメートル)
    // SizeFクラス float型の幅widthと高さheightの情報を持つ
    SizeF physicalSize = mCameraCharacteristics.get( mCameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE );
    Log.d( "CameraCharacteristics", "物理サイズ : " + physicalSize.getWidth() + ", " + physicalSize.getHeight() );

    // 焦点距離取得
    float[] focalLength = mCameraCharacteristics.get( mCameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS );

    // 画素配列の画素数取得
    // Sizeクラス int型の幅widthと高さheightの情報を持つ
    Size fullArraySize = mCameraCharacteristics.get( mCameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE );
    Log.d( "CameraCharacteristics", "画素配列幅 : " + fullArraySize.getWidth() + ", " + fullArraySize.getHeight() );

    // 有効な配列領域取得( = 切り取り領域[ 0, 0, activeRect.width, activeRect.height ])
    Rect activeRect = mCameraCharacteristics.get( mCameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE );
    Log.d( "CameraCharacteristics", "有効配列幅 : " + activeRect.width() + ", " + activeRect.height() );

    // 出力ストリームのサイズ取得
    Size outputStreamSize = new Size( mTextureView.getWidth(), mTextureView.getHeight() );
    Log.d( "CameraCharacteristics", "出力ストリーム : " + outputStreamSize.getWidth() + ", " + outputStreamSize.getHeight() );
    //
    // 縦方向を切り取る場合(出力アスペクト比 > 切り取り領域のアスペクト比)
    // 横方向を切り取る場合(出力アスペクト比 < 切り取り領域のアスペクト比)


    /*
     * 【FOVを求める式】 angle = 2 * arctan( d / (2 * f) )
     * f = 焦点距離, d = 縦または横のセンサ物理サイズ
     */
    // 実際に画面に表示している領域と取得したセンサ全体の物理サイズは異なる
    // その辺の計算がよくわからないので全体で考えます
    float[] angle = new float[2];
    angle[0] = 2f * (float)Math.toDegrees( Math.atan( physicalSize.getWidth()  / ( 2 * focalLength[0] ) ) ); // 横
    angle[1] = 2f * (float)Math.toDegrees( Math.atan( physicalSize.getHeight() / ( 2 * focalLength[0] ) ) ); // 縦
    Log.d("getAngle",  angle[0] + ", " + angle[1] + ", " );
    return angle;
}
 
开发者ID:jphacks,项目名称:TK_1701,代码行数:39,代码来源:Camera2.java

示例4: testSerializeSizeF

import android.util.SizeF; //导入依赖的package包/类
@Test
public void testSerializeSizeF() {
    SizeF expectedValue = new SizeF(9, 5);
    mCoder.serialize(bundle(), randomKey(), expectedValue);
    assertEquals(expectedValue, bundle().getSizeF(randomKey()));

}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:8,代码来源:SizeFCoderTest.java

示例5: testCoderApi21NotNullAbove21

import android.util.SizeF; //导入依赖的package包/类
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Test
public void testCoderApi21NotNullAbove21() throws CoderNotFoundException {
    assertCoderNotNull(Size.class);
    assertCoderNotNull(SizeF.class);
}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:8,代码来源:StateCoderUtilsTest.java

示例6: testCoderApi21ThrowsBelowApi21

import android.util.SizeF; //导入依赖的package包/类
@Config(maxSdk = Build.VERSION_CODES.KITKAT)
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Test(expected = CoderNotFoundException.class)
public void testCoderApi21ThrowsBelowApi21() throws CoderNotFoundException {
    assertCoderNotNull(Size.class);
    assertCoderNotNull(SizeF.class);
}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:8,代码来源:StateCoderUtilsTest.java

示例7: onTransact

import android.util.SizeF; //导入依赖的package包/类
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch(code) {
        case TRANSACT_methodWithCollectionReturn: {
            data.enforceInterface(this.getInterfaceDescriptor());

            final ArrayList<SizeF> abstrListCollection;
            final int abstrListSize = data.readInt();
            if (abstrListSize < 0) {
                abstrListCollection = null;
            } else {
                abstrListCollection = new ArrayList<>(abstrListSize);
                for (int j = 0; j < abstrListSize; j++) {
                    final SizeF abstrListTmp;
                    if (data.readByte() == -1) {
                        abstrListTmp = null;
                    } else {
                        abstrListTmp = data.readSizeF();
                    }
                    abstrListCollection.add(abstrListTmp);
                }
            }

            final Collection<AbstractListTest> returnValue = delegate.methodWithCollectionReturn(abstrListCollection);
            reply.writeNoException();

            if (returnValue == null) {
                reply.writeInt(-1);
            } else {
                reply.writeInt(returnValue.size());
                for (AbstractListTest returnValueElement : returnValue) {
                    reply.writeStrongBinder(returnValueElement == null ? null : returnValueElement.asBinder());
                }
            }

            return true;
        }
    }
    return super.onTransact(code, data, reply, flags);
}
 
开发者ID:chdir,项目名称:aidl2,代码行数:41,代码来源:AbstractListTest$$AidlServerImpl.java

示例8: testGetSizeF

import android.util.SizeF; //导入依赖的package包/类
@TargetApi(21)
public void testGetSizeF() {
    Key<SizeF> key = new Key<>("key");
    Bundle bundle = new Bundle();
    SizeF testSize = new SizeF(1, 2);
    bundle.putSizeF("key", testSize);
    TypedBundle typedBundle = runThroughParcel(new TypedBundle(bundle));

    assertThat(typedBundle.get(key)).isEqualTo(testSize);
}
 
开发者ID:evant,项目名称:typedbundle,代码行数:11,代码来源:TypedBundleTest.java

示例9: testPutSizeF

import android.util.SizeF; //导入依赖的package包/类
@TargetApi(21)
public void testPutSizeF() {
    Key<SizeF> key = new Key<>("key");
    SizeF testSize = new SizeF(1, 2);
    TypedBundle typedBundle = new TypedBundle();
    typedBundle.put(key, testSize);

    assertThat(runThroughParcel(typedBundle).getBundle().getSizeF("key")).isEqualTo(testSize);
}
 
开发者ID:evant,项目名称:typedbundle,代码行数:10,代码来源:TypedBundleTest.java

示例10: getSizeF

import android.util.SizeF; //导入依赖的package包/类
@TargetApi(21)
public SizeF getSizeF(String key){
	if(bundle != null){
		return bundle.getSizeF(key);
	}
	try{
		return (SizeF) stub.get(key);
	} catch(Exception e){
		return null;
	}
}
 
开发者ID:nicktgn,项目名称:TinyAndroidMVP,代码行数:12,代码来源:MvpBundle.java

示例11: putSizeF

import android.util.SizeF; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void putSizeF(String key, SizeF value){
	if(bundle != null) {
		bundle.putSizeF(key, value);
	} else {
		stub.put(key, value);
	}
}
 
开发者ID:nicktgn,项目名称:TinyAndroidMVP,代码行数:9,代码来源:MvpBundle.java

示例12: shouldSaveSizeFValueType

import android.util.SizeF; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Test
public void shouldSaveSizeFValueType() {
    Bundle bundle = mock(Bundle.class);
    SizeF value = new SizeF(42, 42);
    ValueSaver<SizeF> valueSaver = mValueSaverFactory.build(value);
    valueSaver.save(bundle, SOME_KEY, value);
    verify(bundle).putSizeF(SOME_KEY, value);
}
 
开发者ID:raycoarana,项目名称:baindo,代码行数:10,代码来源:ValueSaverTest.java

示例13: sizeFIsCorrectlyParcelled

import android.util.SizeF; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Test public void sizeFIsCorrectlyParcelled() {
  TypeAdapter<SizeF> adapter = StaticAdapters.SIZE_F_ADAPTER;
  SizeF expected = new SizeF(10.f, 10.f);
  SizeF result = writeThenRead(adapter, expected);
  assertThat(result).isEqualTo(expected);
}
 
开发者ID:grandstaish,项目名称:paperparcel,代码行数:8,代码来源:TypeAdapterTest.java

示例14: testDeserializeSizeF

import android.util.SizeF; //导入依赖的package包/类
@Test
public void testDeserializeSizeF() {
    SizeF expectedValue = new SizeF(9, 5);
    bundle().putSizeF(randomKey(), expectedValue);
    assertEquals(expectedValue, mCoder.deserialize(bundle(), randomKey()));
}
 
开发者ID:Fondesa,项目名称:Lyra,代码行数:7,代码来源:SizeFCoderTest.java

示例15: write

import android.util.SizeF; //导入依赖的package包/类
@Override
public void write(Bundle bundle, Object to, StateField field) throws IllegalAccessException {
    Field propertyField = field.getField();
    propertyField.setAccessible(true);
    bundle.putSizeF(field.getBundleKey(), (SizeF) propertyField.get(to));
}
 
开发者ID:leobert-lan,项目名称:MagicBox,代码行数:7,代码来源:SizeFWriter.java


注:本文中的android.util.SizeF类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。