微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.util.SizeF的实例源码

项目:aidl2    文件NotNullSizeArrayParameter$$AidlServerImpl.java   
@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);
}
项目:aidl2    文件NotNullSizeArrayParameter$$AidlClientImpl.java   
@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,0);
        reply.readException();
    } finally {
        data.recycle();
        reply.recycle();
    }
}
项目:TK_1701    文件Camera2.java   
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,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;
}
项目:Lyra    文件SizefCoderTest.java   
@Test
public void testSerializeSizef() {
    Sizef expectedValue = new Sizef(9,5);
    mCoder.serialize(bundle(),randomKey(),expectedValue);
    assertEquals(expectedValue,bundle().getSizef(randomKey()));

}
项目:Lyra    文件StateCoderUtilsTest.java   
@Config(minSdk = Build.VERSION_CODES.LOLLIPOP)
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Test
public void testCoderApi21NotNullAbove21() throws CoderNotFoundException {
    assertCoderNotNull(Size.class);
    assertCoderNotNull(Sizef.class);
}
项目:Lyra    文件StateCoderUtilsTest.java   
@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);
}
项目:aidl2    文件AbstractListTest$$AidlServerImpl.java   
@Override
protected boolean onTransact(int code,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,flags);
}
项目:typedbundle    文件TypedBundleTest.java   
@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);
}
项目:typedbundle    文件TypedBundleTest.java   
@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);
}
项目:TinyAndroidMVP    文件MvpBundle.java   
@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;
    }
}
项目:TinyAndroidMVP    文件MvpBundle.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void putSizef(String key,Sizef value){
    if(bundle != null) {
        bundle.putSizef(key,value);
    } else {
        stub.put(key,value);
    }
}
项目:baindo    文件ValueSaverTest.java   
@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);
}
项目:paperparcel    文件TypeAdapterTest.java   
@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);
}
项目:Lyra    文件SizefCoderTest.java   
@Test
public void testDeserializeSizef() {
    Sizef expectedValue = new Sizef(9,5);
    bundle().putSizef(randomKey(),mCoder.deserialize(bundle(),randomKey()));
}
项目:MagicBox    文件SizefWriter.java   
@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));
}
项目:OpenHub    文件BundleHelper.java   
public BundleHelper put(@NonNull String key,@Nullable Sizef value){
    bundle.putSizef(key,value);
    return this;
}
项目:Rabbits    文件AbstractNavigator.java   
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public AbstractNavigator putExtra(String key,Sizef value) {
    ensureExtras();
    mTarget.getExtras().putSizef(key,value);
    return this;
}
项目:aidl2    文件SimpleMap$$AidlClientImpl.java   
@Override
public Map<String,Integer> abstractMapMethod(Map<Parcelable,Sizef> responder) throws remoteexception {
  Parcel data = Parcel.obtain();
  Parcel reply = Parcel.obtain();
  try {
    data.writeInterfacetoken(SimpleMap$$AidlServerImpl.DESCRIPTOR);

    if (responder == null) {
      data.writeInt(-1);
    } else {
      data.writeInt(responder.size());
      for (Map.Entry<Parcelable,Sizef> responderEntry: responder.entrySet()) {
        data.writeParcelable(responderEntry.getKey(),0);
        if (responderEntry.getValue() == null) {
          data.writeByte((byte) -1);
        } else {
          data.writeByte((byte) 0);
          data.writeSizef(responderEntry.getValue());
        }
      }
    }

    delegate.transact(SimpleMap$$AidlServerImpl.TRANSACT_abstractMapMethod,0);
    reply.readException();

    final HashMap<String,Integer> returnValueMap;
    final int returnValueSize = reply.readInt();
    if (returnValueSize < 0) {
      returnValueMap = null;
    } else {
      returnValueMap = new HashMap<>();
      for (int k = 0; k < returnValueSize; k++) {
        final Integer returnValueTmp;
        if (reply.readByte() == -1) {
          returnValueTmp = null;
        } else {
          returnValueTmp = reply.readInt();
        }
        returnValueMap.put(reply.readString(),returnValueTmp);
      }
    }
    return returnValueMap;
  } finally {
    data.recycle();
    reply.recycle();
  }
}
项目:aidl2    文件SimpleMap$$AidlClientImpl.java   
@Override
public LinkedHashMap<String,Integer> concreteMapMethod(HashMap<Parcelable,0);
        if (responderEntry.getValue() == null) {
          data.writeByte((byte) -1);
        } else {
          data.writeByte((byte) 0);
          data.writeSizef(responderEntry.getValue());
        }
      }
    }

    delegate.transact(SimpleMap$$AidlServerImpl.TRANSACT_concreteMapMethod,0);
    reply.readException();

    final LinkedHashMap<String,Integer> returnValueMap;
    final int returnValueSize = reply.readInt();
    if (returnValueSize < 0) {
      returnValueMap = null;
    } else {
      returnValueMap = new LinkedHashMap<>(returnValueSize,1f);
      for (int k = 0; k < returnValueSize; k++) {
        final Integer returnValueTmp;
        if (reply.readByte() == -1) {
          returnValueTmp = null;
        } else {
          returnValueTmp = reply.readInt();
        }
        returnValueMap.put(reply.readString(),returnValueTmp);
      }
    }
    return returnValueMap;
  } finally {
    data.recycle();
    reply.recycle();
  }
}
项目:aidl2    文件AbstractListSimplenested$$AidlServerImpl.java   
@Override
protected boolean onTransact(int code,int flags) throws remoteexception {
    switch(code) {
        case TRANSACT_methodWithAbstractListReturn: {
            data.enforceInterface(this.getInterfaceDescriptor());

            final ArrayList<Sizef[][]> sizesCollection;
            final int sizesSize = data.readInt();
            if (sizesSize < 0) {
                sizesCollection = null;
            } else {
                sizesCollection = new ArrayList<>(sizesSize);
                for (int j = 0; j < sizesSize; j++) {
                    final Sizef[][] sizesArray;
                    final int sizesLength = data.readInt();
                    if (sizesLength < 0) {
                        sizesArray = null;
                    } else {
                        sizesArray = new Sizef[sizesLength][];
                        for (int i = 0; i < sizesArray.length; i++) {
                            final Sizef[] sizesArray_;
                            final int sizesLength_ = data.readInt();
                            if (sizesLength_ < 0) {
                                sizesArray_ = null;
                            } else {
                                sizesArray_ = new Sizef[sizesLength_];
                                for (int i_ = 0; i_ < sizesArray_.length; i_++) {
                                    final Sizef sizesTmp;
                                    if (data.readByte() == -1) {
                                        sizesTmp = null;
                                    } else {
                                        sizesTmp = data.readSizef();
                                    }
                                    sizesArray_[i_] = sizesTmp;
                                }
                            }
                            sizesArray[i] = sizesArray_;
                        }
                    }
                    sizesCollection.add(sizesArray);
                }
            }

            final Collection<? extends Collection<? extends Serializable>> returnValue = delegate.methodWithAbstractListReturn(sizesCollection);
            reply.writeNoException();

            if (returnValue == null) {
                reply.writeInt(-1);
            } else {
                reply.writeInt(returnValue.size());
                for (Collection<? extends Serializable> returnValueElement : returnValue) {
                    if (returnValueElement == null) {
                        reply.writeInt(-1);
                    } else {
                        reply.writeInt(returnValueElement.size());
                        for (Serializable returnValueElement_ : returnValueElement) {
                            AidlUtil.writetoObjectStream(reply,returnValueElement_);
                        }
                    }
                }
            }

            return true;
        }
    }
    return super.onTransact(code,flags);
}
项目:aidl2    文件AbstractListSimplenested$$AidlClientImpl.java   
@Override
public AbstractList<List<Date>> methodWithAbstractListReturn(List<Sizef[][]> sizes) throws remoteexception {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfacetoken(AbstractListSimplenested$$AidlServerImpl.DESCRIPTOR);

        if (sizes == null) {
            data.writeInt(-1);
        } else {
            data.writeInt(sizes.size());
            for (Sizef[][] sizesElement : sizes) {
                if (sizesElement == null) {
                    data.writeInt(-1);
                } else {
                    data.writeInt(sizesElement.length);
                    for (Sizef[] sizesElementComponent : sizesElement) {
                        if (sizesElementComponent == null) {
                            data.writeInt(-1);
                        } else {
                            data.writeInt(sizesElementComponent.length);
                            for (Sizef sizesElementComponent_ : sizesElementComponent) {
                                if (sizesElementComponent_ == null) {
                                    data.writeByte((byte) -1);
                                } else {
                                    data.writeByte((byte) 0);
                                    data.writeSizef(sizesElementComponent_);
                                }
                            }
                        }
                    }
                }
            }
        }

        delegate.transact(AbstractListSimplenested$$AidlServerImpl.TRANSACT_methodWithAbstractListReturn,0);
        reply.readException();

        final ArrayList<List<Date>> returnValueCollection;
        final int returnValueSize = reply.readInt();
        if (returnValueSize < 0) {
            returnValueCollection = null;
        } else {
            returnValueCollection = new ArrayList<>(returnValueSize);
            for (int j = 0; j < returnValueSize; j++) {
                final ArrayList<Date> returnValueCollection_;
                final int returnValueSize_ = reply.readInt();
                if (returnValueSize_ < 0) {
                    returnValueCollection_ = null;
                } else {
                    returnValueCollection_ = new ArrayList<>(returnValueSize_);
                    for (int j_ = 0; j_ < returnValueSize_; j_++) {
                        returnValueCollection_.add(AidlUtil.readFromObjectStream(reply));
                    }
                }
                returnValueCollection.add(returnValueCollection_);
            }
        }
        return returnValueCollection;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
项目:aidl2    文件AbstractListTest$$AidlClientImpl.java   
@Override
public Collection<AbstractListTest> methodWithCollectionReturn(AbstractList<Sizef> abstrList) throws remoteexception {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfacetoken(AbstractListTest$$AidlServerImpl.DESCRIPTOR);

        if (abstrList == null) {
            data.writeInt(-1);
        } else {
            data.writeInt(abstrList.size());
            for (Sizef abstrListElement : abstrList) {
                if (abstrListElement == null) {
                    data.writeByte((byte) -1);
                } else {
                    data.writeByte((byte) 0);
                    data.writeSizef(abstrListElement);
                }
            }
        }

        delegate.transact(AbstractListTest$$AidlServerImpl.TRANSACT_methodWithCollectionReturn,0);
        reply.readException();

        final ArrayList<AbstractListTest> returnValueCollection;
        final int returnValueSize = reply.readInt();
        if (returnValueSize < 0) {
            returnValueCollection = null;
        } else {
            returnValueCollection = new ArrayList<>(returnValueSize);
            for (int j = 0; j < returnValueSize; j++) {
                final IBinder returnValueBinder = reply.readStrongBinder();
                final AbstractListTest iReturnValue = returnValueBinder == null ? null : InterfaceLoader.asInterface(returnValueBinder,AbstractListTest.class);
                returnValueCollection.add(iReturnValue);
            }
        }
        return returnValueCollection;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
项目:Akatsuki    文件Bundle.java   
public void putSizef(java.lang.String key,Sizef value){
    throw new RuntimeException("Stub!");
}
项目:Akatsuki    文件Bundle.java   
public Sizef getSizef(java.lang.String key){
    throw new RuntimeException("Stub!");
}
项目:baindo    文件SizefValueSaver.java   
@Override
public void save(Bundle state,String key,Sizef value) {
    state.putSizef(key,value);
}
项目:paperparcel    文件StaticAdapters.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@NonNull @Override public Sizef readFromParcel(@NonNull Parcel source) {
  return source.readSizef();
}
项目:paperparcel    文件StaticAdapters.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override public void writetoParcel(@NonNull Sizef value,@NonNull Parcel dest,int flags) {
  dest.writeSizef(value);
}
项目:lr_dialer    文件Bundler.java   
/**
 * Inserts a Sizef value into the mapping of this Bundle,replacing
 * any existing value for the given key.  Either key or value may be null.
 *
 * @param key   a String,or null
 * @param value a Sizef object,or null
 */
@TargetApi(21)
public Bundler putSizef(String key,Sizef value)
{
    bundle.putSizef(key,value);
    return this;
}
项目:GitHub    文件Bundler.java   
/**
 * Inserts a Sizef value into the mapping of this Bundle,Sizef value) {
  bundle.putSizef(key,value);
  return this;
}
项目:KUtils    文件Bundler.java   
/**
 * Inserts a Sizef value into the mapping of this Bundle,value);
  return this;
}
项目:Lyra    文件SizefCoder.java   
/**
 * Write a field's value into the saved state {@link Bundle}.
 *
 * @param state      {@link Bundle} used to save the state
 * @param key        key retrieved from {@code fieldDeclaringClass#fieldName}
 * @param fieldValue value of field
 */
@Override
public void serialize(@NonNull Bundle state,@NonNull String key,@NonNull Sizef fieldValue) {
    state.putSizef(key,fieldValue);
}
项目:KUtils-master    文件Bundler.java   
/**
 * Inserts a Sizef value into the mapping of this Bundle,value);
  return this;
}
项目:bull    文件Metadata.java   
/**
 * Inserts a Sizef value into the mapping of this Bundle,or null
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public Metadata putSizef(@Nullable String key,@Nullable Sizef value) {
    mBundle.putSizef(key,value);
    return this;
}
项目:bull    文件Metadata.java   
/**
 * Returns the value associated with the given key,or null if
 * no mapping of the desired type exists for the given key or a null
 * value is explicitly associated with the key.
 *
 * @param key a String,or null
 * @return a Size value,or null
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Nullable
public Sizef getSizef(@Nullable String key) {
    return mBundle.getSizef(key);
}
项目:typedbundle    文件TypedBundle.java   
/**
 * Inserts a value into the mapping of this {@code TypedBundle},replacing any existing value
 * for the given key.
 *
 * @param key   the key
 * @param value the value
 * @return the {@code TypedBundle} for chaining
 */
@TargetApi(21)
public TypedBundle put(@NonNull Key<Sizef> key,Sizef value) {
    bundle.putSizef(key.name,value);
    return this;
}
项目:SmartTabLayout    文件Bundler.java   
/**
 * Inserts a Sizef value into the mapping of this Bundle,value);
  return this;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。