pull/53/head
Mattia Iavarone 8 years ago
parent 363d914339
commit 9bc42de78f
  1. 11
      demo/src/main/java/com/otaliastudios/cameraview/demo/ControlView.java
  2. 3
      demo/src/main/res/layout/spinner_text.xml

@ -3,6 +3,7 @@ package com.otaliastudios.cameraview.demo;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
@ -63,8 +64,12 @@ public class ControlView<Value> extends LinearLayout implements Spinner.OnItemSe
}
if (values.isEmpty()) {
spinner.setOnItemSelectedListener(null);
spinner.setEnabled(false);
spinner.setAlpha(0.8f);
spinner.setAdapter(new ArrayAdapter(getContext(),
R.layout.spinner_text, new String[]{ "Not supported." }));
spinner.setSelection(0, false);
} else {
spinner.setEnabled(true);
spinner.setAlpha(1f);
@ -88,9 +93,9 @@ public class ControlView<Value> extends LinearLayout implements Spinner.OnItemSe
private String stringify(Value value) {
if (value instanceof Integer) {
if ((Integer) value == ViewGroup.LayoutParams.MATCH_PARENT) return "MATCH_PARENT";
if ((Integer) value == ViewGroup.LayoutParams.WRAP_CONTENT) return "WRAP_CONTENT";
if ((Integer) value == ViewGroup.LayoutParams.MATCH_PARENT) return "match parent";
if ((Integer) value == ViewGroup.LayoutParams.WRAP_CONTENT) return "wrap content";
}
return String.valueOf(value);
return String.valueOf(value).replace("_", " ").toLowerCase();
}
}

@ -2,6 +2,7 @@
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/TextAppearance.AppCompat.Medium"
android:padding="8dp"
android:padding="12dp"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

Loading…
Cancel
Save