体质测试UI bug改好了

This commit is contained in:
ScorpioMiku
2018-10-02 16:45:41 +08:00
parent 47aea25966
commit fb4654e24a
5 changed files with 28 additions and 9 deletions

View File

@@ -56,7 +56,6 @@ public class CardHolder extends RecyclerView.ViewHolder {
context.startActivity(i);
}
});
}

View File

@@ -7,6 +7,7 @@ import android.hardware.Camera;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.Display;
import android.view.Surface;
import android.view.View;
import android.view.Window;
@@ -17,6 +18,7 @@ import android.widget.TextView;
import com.example.ninefourone.nutritionmaster.R;
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
import com.orhanobut.logger.Logger;
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -42,6 +44,8 @@ public class FoodMaterialCamera extends AppCompatActivity {
private CameraPreview mPreview;
private int mCameraId = Camera.CameraInfo.CAMERA_FACING_BACK;
private int widthPixel;
private float heightPixel;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -55,6 +59,9 @@ public class FoodMaterialCamera extends AppCompatActivity {
//注意上面两个设置必须写在setContentView前面
setContentView(R.layout.cameras_layout);
ButterKnife.bind(this);
Display display = getWindowManager().getDefaultDisplay();
widthPixel = display.getWidth();
heightPixel = display.getHeight() * (14.0f / 16);
if (!checkCameraHardware(this)) {
MessageUtils.MakeToast("不支持相机");
@@ -65,6 +72,12 @@ public class FoodMaterialCamera extends AppCompatActivity {
setCameraDisplayOrientation(this, mCameraId, mCamera);
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
}
/**
* 检查当前设备是否有相机
*
@@ -109,8 +122,10 @@ public class FoodMaterialCamera extends AppCompatActivity {
Camera c = null;
try {
c = Camera.open();
Camera.Parameters mParameters = c.getParameters();
mParameters.setPictureSize(720, 1280);
Logger.d(widthPixel+", "+heightPixel);
mParameters.setPictureSize(widthPixel, (int) heightPixel);
c.setParameters(mParameters);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -94,7 +94,6 @@ public class AddPhysiqueActivity extends BaseActivity {
private void initAddView() {
BaseAdapter adapter = new BaseAdapter() {
@Override
public int getCount() {
return colors.length;
@@ -113,6 +112,7 @@ public class AddPhysiqueActivity extends BaseActivity {
@Override
public View getView(final int position, View child, ViewGroup parent) {
child = LayoutInflater.from(parent.getContext()).inflate(R.layout.add_item, parent,
false);
child.findViewById(R.id.image).setBackgroundColor(colors[position]);
@@ -143,7 +143,6 @@ public class AddPhysiqueActivity extends BaseActivity {
}
});
} else {
firstButtons[position].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -190,6 +189,9 @@ public class AddPhysiqueActivity extends BaseActivity {
@Override
public void onTurned(int position) {
bottomContent.setBackgroundColor(colors[position] - 60);
firstButtons[position].setEnabled(true);
secondButtons[position].setEnabled(true);
thirdButtons[position].setEnabled(true);
}
});

View File

@@ -35,6 +35,7 @@
android:id="@+id/choose_first"
android:layout_width="150dp"
android:layout_height="50dp"
android:enabled="false"
android:text="测试"
android:textSize="13sp"
android:visibility="gone">
@@ -46,6 +47,7 @@
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:enabled="false"
android:text="测试"
android:textSize="13sp"
android:visibility="gone">
@@ -57,6 +59,7 @@
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:enabled="false"
android:text="测试"
android:textSize="13sp"
android:visibility="gone">

View File

@@ -16,7 +16,7 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="9">
android:layout_weight="14">
<FrameLayout
android:id="@+id/camera_preview"
@@ -38,9 +38,9 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2"
android:alpha="0.4"
android:background="#8A000000">
android:layout_weight="2"
android:alpha="0.2"
android:background="#8a515050">
<ImageView
android:id="@+id/more_take_photo_button_capture"
@@ -67,7 +67,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.3"
android:background="@color/place_holder"
android:background="#e6e6e6"
android:visibility="invisible">
<ProgressBar