demo updates

pull/1/head
Dylan McIntyre 8 years ago
parent 89cd184c33
commit 62c64940a2
  1. 8
      camerakit/src/main/java/com/flurgle/camerakit/utils/CenterCrop.java
  2. 3
      demo/src/main/AndroidManifest.xml
  3. 36
      demo/src/main/java/com/flurgle/camerakit/demo/MainActivity.java
  4. 56
      demo/src/main/res/drawable/launch_bg.xml
  5. 4
      demo/src/main/res/values/styles.xml

@ -27,10 +27,6 @@ public class CenterCrop {
this.croppedJpeg = out.toByteArray();
}
public byte[] getJpeg() {
return croppedJpeg;
}
private static Rect getCrop(int currentWidth, int currentHeight, AspectRatio targetRatio) {
AspectRatio currentRatio = AspectRatio.of(currentWidth, currentHeight);
@ -48,4 +44,8 @@ public class CenterCrop {
return crop;
}
public byte[] getJpeg() {
return croppedJpeg;
}
}

@ -12,7 +12,8 @@
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:theme="@style/Theme.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

@ -103,6 +103,8 @@ public class MainActivity extends AppCompatActivity {
captureModeRadioGroup.setOnCheckedChangeListener(captureModeChangedListener);
cropModeRadioGroup.setOnCheckedChangeListener(cropModeChangedListener);
tapToFocusModeRadioGroup.setOnCheckedChangeListener(tapToFocusModeChangedListener);
widthModeRadioGroup.setOnCheckedChangeListener(widthModeChangedListener);
heightModeRadioGroup.setOnCheckedChangeListener(heightModeChangedListener);
}
@Override
@ -220,11 +222,7 @@ public class MainActivity extends AppCompatActivity {
@OnTextChanged(value = R.id.width, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
void widthChanged() {
if (String.valueOf(mCameraWidth).equals(width.getText().toString())) {
widthUpdate.setAlpha(.2f);
} else {
widthUpdate.setAlpha(1f);
}
}
@OnClick(R.id.widthUpdate)
@ -234,13 +232,20 @@ public class MainActivity extends AppCompatActivity {
}
}
RadioGroup.OnCheckedChangeListener widthModeChangedListener = new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
widthUpdate.setEnabled(checkedId == R.id.widthCustom);
widthUpdate.setAlpha(checkedId == R.id.widthCustom ? 1f : 0.3f);
width.clearFocus();
width.setEnabled(checkedId == R.id.widthCustom);
width.setAlpha(checkedId == R.id.widthCustom ? 1f : 0.5f);
}
};
@OnTextChanged(value = R.id.height)
void heightChanged() {
if (String.valueOf(mCameraHeight).equals(height.getText().toString())) {
heightUpdate.setAlpha(.2f);
} else {
heightUpdate.setAlpha(1f);
}
}
@OnClick(R.id.heightUpdate)
@ -250,6 +255,17 @@ public class MainActivity extends AppCompatActivity {
}
}
RadioGroup.OnCheckedChangeListener heightModeChangedListener = new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
heightUpdate.setEnabled(checkedId == R.id.heightCustom);
heightUpdate.setAlpha(checkedId == R.id.heightCustom ? 1f : 0.3f);
height.clearFocus();
height.setEnabled(checkedId == R.id.heightCustom);
height.setAlpha(checkedId == R.id.heightCustom ? 1f : 0.5f);
}
};
private void updateCamera(boolean updateWidth, boolean updateHeight) {
ViewGroup.LayoutParams cameraLayoutParams = camera.getLayoutParams();
int width = cameraLayoutParams.width;

@ -0,0 +1,56 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="1080dp"
android:height="1919dp"
android:viewportWidth="1080.0"
android:viewportHeight="1919.0">
<path
android:pathData="M0,0h1080v1920h-1080z"
android:strokeColor="#00000000"
android:fillColor="#FF4444"
android:strokeWidth="1"/>
<path
android:pathData="M291,960a249,247.1 0,1 0,498 0a249,247.1 0,1 0,-498 0z"
android:strokeColor="#00000000"
android:fillColor="#FFFFFF"
android:strokeWidth="1"/>
<path
android:pathData="M582.4,920L582.4,920A28.2,28.2 0,0 1,610.6 948.2L610.6,974.4A28.2,28.2 0,0 1,582.4 1002.6L582.4,1002.6A28.2,28.2 0,0 1,554.1 974.4L554.1,948.2A28.2,28.2 0,0 1,582.4 920z"
android:strokeColor="#00000000"
android:fillColor="#26C6DA"
android:strokeWidth="1"/>
<path
android:pathData="M497.6,920L497.6,920A28.2,28.2 0,0 1,525.9 948.2L525.9,974.4A28.2,28.2 0,0 1,497.6 1002.6L497.6,1002.6A28.2,28.2 0,0 1,469.4 974.4L469.4,948.2A28.2,28.2 0,0 1,497.6 920z"
android:strokeColor="#00000000"
android:fillColor="#26C6DA"
android:strokeWidth="1"/>
<path
android:pathData="M441,968.8C441,968.8 418.7,1040.2 411.9,1086.7C410,1099.9 409.4,1111.1 410.9,1118.1C445.5,1141.2 507.3,1179.7 597.8,1150.5C566.4,1123.6 528.5,1097.3 505,1069.9C481.5,1042.5 441,968.8 441,968.8Z"
android:strokeColor="#00000000"
android:fillColor="#FF4444"
android:strokeWidth="1"/>
<path
android:pathData="M477.6,881.2C477.6,881.2 404.6,897.6 361,915C348.6,920 338.6,925 333.3,929.8C330.6,971.3 328.1,1044.1 398.7,1107.8C406.3,1067.2 410.1,1021.2 422,987.2C434,953.1 477.6,881.2 477.6,881.2Z"
android:strokeColor="#00000000"
android:fillColor="#FF4444"
android:strokeWidth="1"/>
<path
android:pathData="M601.6,1039.3C601.6,1039.3 674.6,1023 718.2,1005.5C730.6,1000.6 740.6,995.6 745.9,990.8C748.6,949.2 751.1,876.4 680.5,812.8C673,853.3 669.1,899.3 657.2,933.4C645.2,967.4 601.6,1039.3 601.6,1039.3Z"
android:strokeColor="#00000000"
android:fillColor="#FF4444"
android:strokeWidth="1"/>
<path
android:pathData="M637.5,950.8C637.5,950.8 659.9,879.4 666.6,832.9C668.5,819.7 669.1,808.5 667.6,801.5C633,778.4 571.2,739.9 480.8,769.1C512.1,796 550,822.3 573.5,849.7C597.1,877 637.5,950.8 637.5,950.8Z"
android:strokeColor="#00000000"
android:fillColor="#FF4444"
android:strokeWidth="1"/>
<path
android:pathData="M575.5,871.5C575.5,871.5 524.9,816.4 488,787.4C477.5,779.1 468.1,773 461.4,770.8C424,789.2 359.7,823.5 339.9,916.4C378.8,902.7 420.5,883 456,876.3C491.4,869.6 575.5,871.5 575.5,871.5Z"
android:strokeColor="#00000000"
android:fillColor="#FF4444"
android:strokeWidth="1"/>
<path
android:pathData="M503,1049.2C503,1049.2 553.7,1104.3 590.6,1133.3C601,1141.6 610.4,1147.7 617.2,1149.9C654.5,1131.5 718.8,1097.2 738.7,1004.3C699.7,1018 658,1037.7 622.6,1044.4C587.1,1051.1 503,1049.2 503,1049.2Z"
android:strokeColor="#00000000"
android:fillColor="#FF4444"
android:strokeWidth="1"/>
</vector>

@ -8,6 +8,10 @@
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Theme.MainActivity" parent="AppTheme">
<item name="android:windowBackground">@drawable/launch_bg</item>
</style>
<style name="Theme.PreviewActivity" parent="Theme.AppCompat.NoActionBar">
</style>

Loading…
Cancel
Save