Use binding in EditOptions and TourGuide of DroidFishApp

This commit is contained in:
Ebrahim Byagowi
2019-04-23 00:04:16 +04:30
committed by Peter Osterlund
parent 80e8183757
commit a912458ffb
9 changed files with 431 additions and 348 deletions

View File

@@ -50,6 +50,8 @@ android {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
dataBinding.enabled = true
}
dependencies {

View File

@@ -18,13 +18,6 @@
package org.petero.droidfish.activities;
import java.util.Locale;
import java.util.TreeMap;
import org.petero.droidfish.R;
import org.petero.droidfish.Util;
import org.petero.droidfish.engine.UCIOptions;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -35,20 +28,27 @@ import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.ToggleButton;
/** Edit UCI options. */
import org.petero.droidfish.R;
import org.petero.droidfish.Util;
import org.petero.droidfish.databinding.UciOptionButtonBinding;
import org.petero.droidfish.databinding.UciOptionCheckBinding;
import org.petero.droidfish.databinding.UciOptionComboBinding;
import org.petero.droidfish.databinding.UciOptionSpinBinding;
import org.petero.droidfish.databinding.UciOptionStringBinding;
import org.petero.droidfish.engine.UCIOptions;
import java.util.Locale;
import java.util.TreeMap;
/**
* Edit UCI options.
*/
public class EditOptions extends Activity {
private UCIOptions uciOpts = null;
private String engineName = "";
@@ -102,28 +102,29 @@ public class EditOptions extends Activity {
continue;
switch (o.type) {
case CHECK: {
View v = View.inflate(this, R.layout.uci_option_check, null);
CheckBox checkBox = v.findViewById(R.id.eo_value);
checkBox.setText(o.name);
UciOptionCheckBinding binding = UciOptionCheckBinding.inflate(getLayoutInflater(), null, false);
binding.eoValue.setText(o.name);
final UCIOptions.CheckOption co = (UCIOptions.CheckOption) o;
checkBox.setChecked(co.value);
checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> co.set(isChecked));
content.addView(v);
binding.eoValue.setChecked(co.value);
binding.eoValue.setOnCheckedChangeListener((buttonView, isChecked) -> co.set(isChecked));
content.addView(binding.getRoot());
break;
}
case SPIN: {
View v = View.inflate(this, R.layout.uci_option_spin, null);
TextView label = v.findViewById(R.id.eo_label);
EditText value = v.findViewById(R.id.eo_value);
UciOptionSpinBinding binding = UciOptionSpinBinding.inflate(getLayoutInflater(), null, false);
final UCIOptions.SpinOption so = (UCIOptions.SpinOption) o;
String labelText = String.format(Locale.US, "%s (%d\u2013%d)", so.name, so.minValue, so.maxValue);
label.setText(labelText);
value.setText(so.getStringValue());
binding.eoLabel.setText(labelText);
binding.eoValue.setText(so.getStringValue());
if (so.minValue >= 0)
value.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);
value.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) { }
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
binding.eoValue.setInputType(android.text.InputType.TYPE_CLASS_NUMBER);
binding.eoValue.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
try {
@@ -138,60 +139,61 @@ public class EditOptions extends Activity {
}
}
});
content.addView(v);
content.addView(binding.getRoot());
break;
}
case COMBO: {
View v = View.inflate(this, R.layout.uci_option_combo, null);
TextView label = v.findViewById(R.id.eo_label);
Spinner value = v.findViewById(R.id.eo_value);
label.setText(o.name);
UciOptionComboBinding binding = UciOptionComboBinding.inflate(getLayoutInflater(), null, false);
binding.eoLabel.setText(o.name);
final UCIOptions.ComboOption co = (UCIOptions.ComboOption) o;
ArrayAdapter<CharSequence> adapter =
new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item,
new ArrayAdapter<>(this, android.R.layout.simple_spinner_item,
co.allowedValues);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
value.setAdapter(adapter);
value.setSelection(adapter.getPosition(co.value));
value.setOnItemSelectedListener(new OnItemSelectedListener() {
binding.eoValue.setAdapter(adapter);
binding.eoValue.setSelection(adapter.getPosition(co.value));
binding.eoValue.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> av, View view, int position, long id) {
if ((position >= 0) && (position < co.allowedValues.length))
co.set(co.allowedValues[position]);
}
public void onNothingSelected(AdapterView<?> arg0) { }
public void onNothingSelected(AdapterView<?> arg0) {
}
});
content.addView(v);
content.addView(binding.getRoot());
break;
}
case BUTTON: {
View v = View.inflate(this, R.layout.uci_option_button, null);
ToggleButton button = v.findViewById(R.id.eo_label);
UciOptionButtonBinding binding = UciOptionButtonBinding.inflate(getLayoutInflater(), null, false);
final UCIOptions.ButtonOption bo = (UCIOptions.ButtonOption) o;
bo.trigger = false;
button.setText(o.name);
button.setTextOn(o.name);
button.setTextOff(o.name);
button.setOnCheckedChangeListener((buttonView, isChecked) -> bo.trigger = isChecked);
content.addView(v);
binding.eoLabel.setText(o.name);
binding.eoLabel.setTextOn(o.name);
binding.eoLabel.setTextOff(o.name);
binding.eoLabel.setOnCheckedChangeListener((buttonView, isChecked) -> bo.trigger = isChecked);
content.addView(binding.getRoot());
break;
}
case STRING: {
View v = View.inflate(this, R.layout.uci_option_string, null);
TextView label = v.findViewById(R.id.eo_label);
EditText value = v.findViewById(R.id.eo_value);
label.setText(o.name + " ");
UciOptionStringBinding binding = UciOptionStringBinding.inflate(getLayoutInflater(), null, false);
binding.eoLabel.setText(String.format("%s ", o.name));
final UCIOptions.StringOption so = (UCIOptions.StringOption) o;
value.setText(so.value);
value.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) { }
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
binding.eoValue.setText(so.value);
binding.eoValue.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
so.set(s.toString());
}
});
content.addView(v);
content.addView(binding.getRoot());
break;
}
}

View File

@@ -1,7 +1,5 @@
package tourguide.tourguide;
import org.petero.droidfish.R;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
@@ -11,22 +9,24 @@ import android.graphics.Color;
import android.graphics.Point;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.i2p.android.ext.floatingactionbutton.FloatingActionButton;
import org.petero.droidfish.R;
import org.petero.droidfish.databinding.TooltipBinding;
/**
* Created by tanjunrong on 2/10/15.
*/
public class TourGuide {
/**
* This describes the animation techniques
* */
*/
public enum Technique {
Click, HorizontalLeft, HorizontalRight, VerticalUpward, VerticalDownward
}
@@ -37,15 +37,16 @@ public class TourGuide {
public enum MotionType {
AllowAll, ClickOnly, SwipeOnly
}
private Technique mTechnique;
private View mHighlightedView;
private Activity mActivity;
private MotionType mMotionType;
private FrameLayoutWithHole mFrameLayout;
private View mToolTipViewGroup;
public ToolTip mToolTip;
public Pointer mPointer;
public Overlay mOverlay;
private TooltipBinding tooltipBinding;
ToolTip mToolTip;
Pointer mPointer;
Overlay mOverlay;
private Sequence mSequence;
@@ -67,6 +68,7 @@ public class TourGuide {
/**
* Setter for the animation to be used
*
* @param technique Animation to be used
* @return return TourGuide instance for chaining purpose
*/
@@ -77,6 +79,7 @@ public class TourGuide {
/**
* Sets which motion type is motionType
*
* @param motionType
* @return return TourGuide instance for chaining purpose
*/
@@ -87,6 +90,7 @@ public class TourGuide {
/**
* Sets the duration
*
* @param view the view in which the tutorial button will be placed on top of
* @return return TourGuide instance for chaining purpose
*/
@@ -98,6 +102,7 @@ public class TourGuide {
/**
* Sets the overlay
*
* @param overlay this overlay object should contain the attributes of the overlay, such as background color, animation, Style, etc
* @return return TourGuide instance for chaining purpose
*/
@@ -105,8 +110,10 @@ public class TourGuide {
mOverlay = overlay;
return this;
}
/**
* Set the toolTip
*
* @param toolTip this toolTip object should contain the attributes of the ToolTip, such as, the title text, and the description text, background color, etc
* @return return TourGuide instance for chaining purpose
*/
@@ -114,8 +121,10 @@ public class TourGuide {
mToolTip = toolTip;
return this;
}
/**
* Set the Pointer
*
* @param pointer this pointer object should contain the attributes of the Pointer, such as the pointer color, pointer gravity, etc, refer to @Link{pointer}
* @return return TourGuide instance for chaining purpose
*/
@@ -123,14 +132,15 @@ public class TourGuide {
mPointer = pointer;
return this;
}
/**
* Clean up the tutorial that is added to the activity
*/
public void cleanUp() {
if (mFrameLayout != null)
mFrameLayout.cleanUp();
if (mToolTipViewGroup!=null) {
((ViewGroup) mActivity.getWindow().getDecorView()).removeView(mToolTipViewGroup);
if (tooltipBinding != null) {
((ViewGroup) mActivity.getWindow().getDecorView()).removeView(tooltipBinding.getRoot());
}
}
@@ -179,19 +189,19 @@ public class TourGuide {
}
/**
*
* @return FrameLayoutWithHole that is used as overlay
*/
public FrameLayoutWithHole getOverlay() {
return mFrameLayout;
}
/**
*
* @return the ToolTip container View
*/
public View getToolTip() {
return mToolTipViewGroup;
return tooltipBinding.getRoot();
}
/******
*
* Private methods
@@ -210,6 +220,7 @@ public class TourGuide {
return x + mHighlightedView.getWidth() / 2 - width / 2;
}
}
//TODO: move into Pointer
private int getYBasedOnGravity(int height) {
int[] pos = new int[2];
@@ -250,10 +261,12 @@ public class TourGuide {
}
});
}
private void checking() {
// There is not check for tooltip because tooltip can be null, it means there no tooltip will be shown
}
private void handleDisableClicking(FrameLayoutWithHole frameLayoutWithHole) {
// 1. if user provides an overlay listener, use that as 1st priority
if (mOverlay != null && mOverlay.mOnClickListener != null) {
@@ -266,7 +279,8 @@ public class TourGuide {
frameLayoutWithHole.setViewHole(mHighlightedView);
frameLayoutWithHole.setSoundEffectsEnabled(false);
// do nothing, disabled.
frameLayoutWithHole.setOnClickListener(v -> {});
frameLayoutWithHole.setOnClickListener(v -> {
});
}
}
@@ -276,31 +290,28 @@ public class TourGuide {
if (mToolTip != null) {
/* inflate and get views */
ViewGroup parent = (ViewGroup) mActivity.getWindow().getDecorView();
LayoutInflater layoutInflater = mActivity.getLayoutInflater();
mToolTipViewGroup = layoutInflater.inflate(R.layout.tooltip, null);
View toolTipContainer = mToolTipViewGroup.findViewById(R.id.toolTip_container);
TextView toolTipTitleTV = mToolTipViewGroup.findViewById(R.id.title);
TextView toolTipDescriptionTV = mToolTipViewGroup.findViewById(R.id.description);
tooltipBinding = TooltipBinding.inflate(mActivity.getLayoutInflater(),
null, false);
/* set tooltip attributes */
toolTipContainer.setBackgroundColor(mToolTip.mBackgroundColor);
tooltipBinding.toolTipContainer.setBackgroundColor(mToolTip.mBackgroundColor);
if (mToolTip.mTitle == null) {
toolTipTitleTV.setVisibility(View.GONE);
tooltipBinding.title.setVisibility(View.GONE);
} else {
toolTipTitleTV.setText(mToolTip.mTitle);
tooltipBinding.title.setText(mToolTip.mTitle);
}
if (mToolTip.mDescription == null) {
toolTipDescriptionTV.setVisibility(View.GONE);
tooltipBinding.description.setVisibility(View.GONE);
} else {
toolTipDescriptionTV.setText(mToolTip.mDescription);
tooltipBinding.description.setText(mToolTip.mDescription);
}
mToolTipViewGroup.startAnimation(mToolTip.mEnterAnimation);
tooltipBinding.getRoot().startAnimation(mToolTip.mEnterAnimation);
/* add setShadow if it's turned on */
if (mToolTip.mShadow) {
mToolTipViewGroup.setBackgroundDrawable(mActivity.getResources().getDrawable(R.drawable.drop_shadow));
tooltipBinding.getRoot().setBackgroundDrawable(mActivity.getResources().getDrawable(R.drawable.drop_shadow));
}
/* position and size calculation */
@@ -310,9 +321,9 @@ public class TourGuide {
final int targetViewY = pos[1];
// get measured size of tooltip
mToolTipViewGroup.measure(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
int toolTipMeasuredWidth = mToolTipViewGroup.getMeasuredWidth();
int toolTipMeasuredHeight = mToolTipViewGroup.getMeasuredHeight();
tooltipBinding.getRoot().measure(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
int toolTipMeasuredWidth = tooltipBinding.getRoot().getMeasuredWidth();
int toolTipMeasuredHeight = tooltipBinding.getRoot().getMeasuredHeight();
Point resultPoint = new Point(); // this holds the final position of tooltip
float density = mActivity.getResources().getDisplayMetrics().density;
@@ -328,28 +339,28 @@ public class TourGuide {
resultPoint.y = getYForTooTip(mToolTip.mGravity, toolTipMeasuredHeight, targetViewY, adjustment);
// add view to parent
// ((ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content)).addView(mToolTipViewGroup, layoutParams);
parent.addView(mToolTipViewGroup, layoutParams);
// ((ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content)).addView(tooltipBinding, layoutParams);
parent.addView(tooltipBinding.getRoot(), layoutParams);
// 1. width < screen check
if (toolTipMeasuredWidth > parent.getWidth()) {
mToolTipViewGroup.getLayoutParams().width = parent.getWidth();
tooltipBinding.getRoot().getLayoutParams().width = parent.getWidth();
toolTipMeasuredWidth = parent.getWidth();
}
// 2. x left boundary check
if (resultPoint.x < 0) {
mToolTipViewGroup.getLayoutParams().width = toolTipMeasuredWidth + resultPoint.x; //since point.x is negative, use plus
tooltipBinding.getRoot().getLayoutParams().width = toolTipMeasuredWidth + resultPoint.x; //since point.x is negative, use plus
resultPoint.x = 0;
}
// 3. x right boundary check
int tempRightX = resultPoint.x + toolTipMeasuredWidth;
if (tempRightX > parent.getWidth()) {
mToolTipViewGroup.getLayoutParams().width = parent.getWidth() - resultPoint.x; //since point.x is negative, use plus
tooltipBinding.getRoot().getLayoutParams().width = parent.getWidth() - resultPoint.x; //since point.x is negative, use plus
}
// pass toolTip onClickListener into toolTipViewGroup
if (mToolTip.mOnClickListener != null) {
mToolTipViewGroup.setOnClickListener(mToolTip.mOnClickListener);
tooltipBinding.getRoot().setOnClickListener(mToolTip.mOnClickListener);
}
// TODO: no boundary check for height yet, this is a unlikely case though
@@ -357,16 +368,16 @@ public class TourGuide {
// this needs an viewTreeObserver, that's because TextView measurement of it's vertical height is not accurate (didn't take into account of multiple lines yet) before it's rendered
// re-calculate height again once it's rendered
final ViewTreeObserver viewTreeObserver = mToolTipViewGroup.getViewTreeObserver();
final ViewTreeObserver viewTreeObserver = tooltipBinding.getRoot().getViewTreeObserver();
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mToolTipViewGroup.getViewTreeObserver().removeGlobalOnLayoutListener(this);// make sure this only run once
tooltipBinding.getRoot().getViewTreeObserver().removeGlobalOnLayoutListener(this);// make sure this only run once
int fixedY;
int toolTipHeightAfterLayouted = mToolTipViewGroup.getHeight();
int toolTipHeightAfterLayouted = tooltipBinding.getRoot().getHeight();
fixedY = getYForTooTip(mToolTip.mGravity, toolTipHeightAfterLayouted, targetViewY, adjustment);
layoutParams.setMargins((int)mToolTipViewGroup.getX(),fixedY,0,0);
layoutParams.setMargins((int) tooltipBinding.getRoot().getX(), fixedY, 0, 0);
}
});
@@ -387,6 +398,7 @@ public class TourGuide {
}
return x;
}
private int getYForTooTip(int gravity, int toolTipMeasuredHeight, int targetViewY, float adjustment) {
int y;
if ((gravity & Gravity.TOP) == Gravity.TOP) {
@@ -465,9 +477,18 @@ public class TourGuide {
final AnimatorSet animatorSet = new AnimatorSet();
final AnimatorSet animatorSet2 = new AnimatorSet();
Animator.AnimatorListener lis1 = new Animator.AnimatorListener() {
@Override public void onAnimationStart(Animator animator) {}
@Override public void onAnimationCancel(Animator animator) {}
@Override public void onAnimationRepeat(Animator animator) {}
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
view.setScaleX(1f);
@@ -477,9 +498,18 @@ public class TourGuide {
}
};
Animator.AnimatorListener lis2 = new Animator.AnimatorListener() {
@Override public void onAnimationStart(Animator animator) {}
@Override public void onAnimationCancel(Animator animator) {}
@Override public void onAnimationRepeat(Animator animator) {}
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
view.setScaleX(1f);
@@ -542,9 +572,18 @@ public class TourGuide {
final AnimatorSet animatorSet = new AnimatorSet();
final AnimatorSet animatorSet2 = new AnimatorSet();
Animator.AnimatorListener lis1 = new Animator.AnimatorListener() {
@Override public void onAnimationStart(Animator animator) {}
@Override public void onAnimationCancel(Animator animator) {}
@Override public void onAnimationRepeat(Animator animator) {}
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
view.setScaleX(1f);
@@ -554,9 +593,18 @@ public class TourGuide {
}
};
Animator.AnimatorListener lis2 = new Animator.AnimatorListener() {
@Override public void onAnimationStart(Animator animator) {}
@Override public void onAnimationCancel(Animator animator) {}
@Override public void onAnimationRepeat(Animator animator) {}
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
view.setScaleX(1f);
@@ -621,6 +669,7 @@ public class TourGuide {
mFrameLayout.addAnimatorSet(animatorSet2);
}
}
private int getScreenWidth() {
if (mActivity != null) {
return mActivity.getResources().getDisplayMetrics().widthPixels;

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -15,8 +17,8 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#e74c3c"
android:orientation="vertical"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp">
<TextView
@@ -38,3 +40,5 @@
</LinearLayout>
</LinearLayout>
</layout>

View File

@@ -1,5 +1,9 @@
<ToggleButton xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<ToggleButton
android:id="@+id/eo_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ToggleButton>
android:layout_height="wrap_content" />
</layout>

View File

@@ -1,5 +1,9 @@
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBox
android:id="@+id/eo_value"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</CheckBox>
android:layout_height="wrap_content" />
</layout>

View File

@@ -1,15 +1,21 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/eo_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/eo_value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
</Spinner>
android:layout_weight="1" />
</LinearLayout>
</layout>

View File

@@ -1,16 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/eo_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
android:layout_height="wrap_content" />
<EditText
android:id="@+id/eo_value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="numberSigned">
</EditText>
android:inputType="numberSigned" />
</LinearLayout>
</layout>

View File

@@ -1,16 +1,22 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/eo_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
android:layout_height="wrap_content" />
<EditText
android:id="@+id/eo_value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="text">
</EditText>
android:inputType="text" />
</LinearLayout>
</layout>