Move units to copy/paste buttons

This commit is contained in:
serso 2016-03-10 15:21:46 +01:00
parent 5b7205b299
commit 9ea6349946
14 changed files with 137 additions and 102 deletions

View File

@ -12,18 +12,35 @@ import android.util.TypedValue;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.ActivityLauncher;
import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.BaseActivity;
import org.solovyev.android.calculator.Calculator;
import org.solovyev.android.calculator.Editor;
import org.solovyev.android.calculator.Keyboard;
import org.solovyev.android.calculator.Preferences;
import org.solovyev.android.calculator.PreferredPreferences;
import org.solovyev.android.calculator.buttons.CppSpecialButton; import org.solovyev.android.calculator.buttons.CppSpecialButton;
import org.solovyev.android.views.Adjuster; import org.solovyev.android.views.Adjuster;
import org.solovyev.android.views.dragbutton.*; import org.solovyev.android.views.dragbutton.DirectionDragButton;
import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import org.solovyev.android.views.dragbutton.DirectionDragListener;
import org.solovyev.android.views.dragbutton.DirectionDragView;
import org.solovyev.android.views.dragbutton.DragDirection;
import org.solovyev.android.views.dragbutton.DragEvent;
import org.solovyev.android.views.dragbutton.DragView;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
import static android.view.HapticFeedbackConstants.*; import static android.view.HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING;
import static android.view.HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING;
import static android.view.HapticFeedbackConstants.KEYBOARD_TAP;
import static org.solovyev.android.calculator.App.cast; import static org.solovyev.android.calculator.App.cast;
import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple; import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple;
import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple_mobile; import static org.solovyev.android.calculator.Preferences.Gui.Layout.simple_mobile;
@ -134,7 +151,7 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer
Adjuster.adjustText(button, textScale); Adjuster.adjustText(button, textScale);
} }
protected final void hideText(@Nullable DirectionDragButton button, @Nonnull DragDirection... directions) { protected final void hideText(@Nullable DirectionDragView button, @Nonnull DragDirection... directions) {
if (button == null) { if (button == null) {
return; return;
} }
@ -143,11 +160,11 @@ public abstract class BaseKeyboardUi implements SharedPreferences.OnSharedPrefer
} }
} }
protected final void hideText(@Nullable DirectionDragButton button, @Nonnull DragDirection direction) { protected final void hideText(@Nullable DirectionDragView button, @Nonnull DragDirection direction) {
if (button == null) { if (button == null) {
return; return;
} }
button.setShowDirectionText(direction, false); button.getText(direction).setVisible(false);
} }
public void onDestroyView() { public void onDestroyView() {

View File

@ -10,6 +10,26 @@ import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import org.solovyev.android.calculator.ActivityLauncher;
import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.Display;
import org.solovyev.android.calculator.DisplayState;
import org.solovyev.android.calculator.Engine;
import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.buttons.CppSpecialButton;
import org.solovyev.android.calculator.history.History;
import org.solovyev.android.calculator.memory.Memory;
import org.solovyev.android.calculator.view.AngleUnitsButton;
import org.solovyev.android.calculator.view.NumeralBasesButton;
import org.solovyev.android.views.dragbutton.DirectionDragButton;
import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import org.solovyev.android.views.dragbutton.DirectionDragView;
import org.solovyev.android.views.dragbutton.DragDirection;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import butterknife.Bind; import butterknife.Bind;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import dagger.Lazy; import dagger.Lazy;
@ -17,21 +37,13 @@ import jscl.AngleUnit;
import jscl.NumeralBase; import jscl.NumeralBase;
import jscl.math.Expression; import jscl.math.Expression;
import jscl.math.Generic; import jscl.math.Generic;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.buttons.CppSpecialButton;
import org.solovyev.android.calculator.history.History;
import org.solovyev.android.calculator.memory.Memory;
import org.solovyev.android.calculator.view.AngleUnitsButton;
import org.solovyev.android.views.dragbutton.DirectionDragButton;
import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import org.solovyev.android.views.dragbutton.DragButton;
import org.solovyev.android.views.dragbutton.DragDirection;
import javax.annotation.Nonnull; import static org.solovyev.android.calculator.Engine.Preferences.angleUnit;
import javax.inject.Inject; import static org.solovyev.android.calculator.Engine.Preferences.multiplicationSign;
import static org.solovyev.android.calculator.Engine.Preferences.numeralBase;
import static org.solovyev.android.calculator.Engine.Preferences.*; import static org.solovyev.android.views.dragbutton.DragDirection.down;
import static org.solovyev.android.views.dragbutton.DragDirection.*; import static org.solovyev.android.views.dragbutton.DragDirection.left;
import static org.solovyev.android.views.dragbutton.DragDirection.up;
public class KeyboardUi extends BaseKeyboardUi { public class KeyboardUi extends BaseKeyboardUi {
@ -48,7 +60,7 @@ public class KeyboardUi extends BaseKeyboardUi {
@Bind(R.id.cpp_button_5) @Bind(R.id.cpp_button_5)
public DirectionDragButton button5; public DirectionDragButton button5;
@Bind(R.id.cpp_button_6) @Bind(R.id.cpp_button_6)
public AngleUnitsButton button6; public DirectionDragButton button6;
@Bind(R.id.cpp_button_7) @Bind(R.id.cpp_button_7)
public DirectionDragButton button7; public DirectionDragButton button7;
@Bind(R.id.cpp_button_8) @Bind(R.id.cpp_button_8)
@ -89,9 +101,9 @@ public class KeyboardUi extends BaseKeyboardUi {
@Bind(R.id.cpp_button_round_brackets) @Bind(R.id.cpp_button_round_brackets)
DirectionDragButton bracketsButton; DirectionDragButton bracketsButton;
@Bind(R.id.cpp_button_copy) @Bind(R.id.cpp_button_copy)
ImageButton copyButton; NumeralBasesButton copyButton;
@Bind(R.id.cpp_button_paste) @Bind(R.id.cpp_button_paste)
ImageButton pasteButton; AngleUnitsButton pasteButton;
@Nullable @Nullable
@Bind(R.id.cpp_button_like) @Bind(R.id.cpp_button_like)
ImageButton likeButton; ImageButton likeButton;
@ -139,13 +151,14 @@ public class KeyboardUi extends BaseKeyboardUi {
prepareButton(button4); prepareButton(button4);
prepareButton(button5); prepareButton(button5);
prepareButton(button6); prepareButton(button6);
button6.setAngleUnit(angleUnit.getPreference(preferences));
prepareButton(button7); prepareButton(button7);
prepareButton(button8); prepareButton(button8);
prepareButton(button9); prepareButton(button9);
prepareButton(copyButton); prepareButton(copyButton);
copyButton.setNumeralBase(numeralBase.getPreference(preferences));
prepareButton(pasteButton); prepareButton(pasteButton);
pasteButton.setAngleUnit(angleUnit.getPreference(preferences));
prepareButton(likeButton); prepareButton(likeButton);
prepareButton(memoryButton); prepareButton(memoryButton);
@ -155,12 +168,13 @@ public class KeyboardUi extends BaseKeyboardUi {
hideText(button3, up, down); hideText(button3, up, down);
hideText(button4, down); hideText(button4, down);
hideText(button5, down); hideText(button5, down);
hideText(button6, up, down);
hideText(button7, left, up, down); hideText(button7, left, up, down);
hideText(button8, left, up, down); hideText(button8, left, up, down);
hideText(button9, left); hideText(button9, left);
hideText(multiplicationButton, left); hideText(multiplicationButton, left);
hideText(plusButton, up, down); hideText(plusButton, up, down);
hideText(copyButton, left, up, down);
hideText(pasteButton, left, up, down);
} }
multiplicationButton.setText(engine.getMultiplicationSign()); multiplicationButton.setText(engine.getMultiplicationSign());
toggleNumericDigits(); toggleNumericDigits();
@ -176,10 +190,11 @@ public class KeyboardUi extends BaseKeyboardUi {
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) { public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
super.onSharedPreferenceChanged(preferences, key); super.onSharedPreferenceChanged(preferences, key);
if (angleUnit.isSameKey(key)) { if (angleUnit.isSameKey(key)) {
button6.setAngleUnit(angleUnit.getPreference(preferences)); pasteButton.setAngleUnit(angleUnit.getPreference(preferences));
} }
if (numeralBase.isSameKey(key)) { if (numeralBase.isSameKey(key)) {
toggleNumericDigits(); toggleNumericDigits();
copyButton.setNumeralBase(numeralBase.getPreference(preferences));
} }
if (multiplicationSign.isSameKey(key)) { if (multiplicationSign.isSameKey(key)) {
multiplicationButton.setText(multiplicationSign.getPreference(preferences)); multiplicationButton.setText(multiplicationSign.getPreference(preferences));
@ -263,16 +278,18 @@ public class KeyboardUi extends BaseKeyboardUi {
return true; return true;
} }
return false; return false;
case R.id.cpp_button_6: case R.id.cpp_button_copy:
return processAngleUnitsButton(direction, (DirectionDragButton) view); return processNumeralBaseButton(direction, (DirectionDragView) view);
case R.id.cpp_button_paste:
return processAngleUnitsButton(direction, (DirectionDragView) view);
case R.id.cpp_button_round_brackets: case R.id.cpp_button_round_brackets:
if (direction == left) { if (direction == left) {
keyboard.roundBracketsButtonPressed(); keyboard.roundBracketsButtonPressed();
return true; return true;
} }
return processDefault(direction, (DragButton) view); return processDefault(direction, (DirectionDragView) view);
default: default:
return processDefault(direction, (DragButton) view); return processDefault(direction, (DirectionDragView) view);
} }
} }
@ -306,11 +323,11 @@ public class KeyboardUi extends BaseKeyboardUi {
return false; return false;
} }
private boolean processAngleUnitsButton(@Nonnull DragDirection direction, @Nonnull DirectionDragButton button) { private boolean processAngleUnitsButton(@Nonnull DragDirection direction, @Nonnull DirectionDragView button) {
if (direction == DragDirection.left) { if (direction == DragDirection.left) {
return processDefault(direction, button); return processDefault(direction, button);
} }
final String text = button.getTextValue(direction); final String text = button.getText(direction).getValue();
if (TextUtils.isEmpty(text)) { if (TextUtils.isEmpty(text)) {
return processDefault(direction, button); return processDefault(direction, button);
} }
@ -327,8 +344,26 @@ public class KeyboardUi extends BaseKeyboardUi {
return false; return false;
} }
private boolean processDefault(@Nonnull DragDirection direction, @Nonnull DragButton button) { private boolean processDefault(@Nonnull DragDirection direction, @Nonnull DirectionDragView button) {
final String text = ((DirectionDragButton) button).getTextValue(direction); final String text = button.getText(direction).getValue();
return keyboard.buttonPressed(text); return keyboard.buttonPressed(text);
} }
private boolean processNumeralBaseButton(@Nonnull DragDirection direction, @Nonnull DirectionDragView button) {
final String text = button.getText(direction).getValue();
if (TextUtils.isEmpty(text)) {
return false;
}
try {
final NumeralBase newNumeralBase = NumeralBase.valueOf(text);
final NumeralBase oldNumeralBase = Engine.Preferences.numeralBase.getPreference(preferences);
if (oldNumeralBase != newNumeralBase) {
preferredPreferences.setNumeralBase(newNumeralBase);
return true;
}
} catch (IllegalArgumentException e) {
Log.d(this.getClass().getName(), "Unsupported numeral base: " + text);
}
return false;
}
} }

View File

@ -6,19 +6,14 @@ import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import butterknife.Bind;
import butterknife.ButterKnife;
import jscl.NumeralBase;
import org.solovyev.android.calculator.Engine;
import org.solovyev.android.calculator.Preferences; import org.solovyev.android.calculator.Preferences;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.buttons.CppSpecialButton; import org.solovyev.android.calculator.buttons.CppSpecialButton;
import org.solovyev.android.calculator.view.EditorLongClickEraser; import org.solovyev.android.calculator.view.EditorLongClickEraser;
import org.solovyev.android.calculator.view.NumeralBasesButton;
import org.solovyev.android.views.dragbutton.DirectionDragButton; import org.solovyev.android.views.dragbutton.DirectionDragButton;
import org.solovyev.android.views.dragbutton.DirectionDragImageButton; import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import org.solovyev.android.views.dragbutton.DragDirection; import org.solovyev.android.views.dragbutton.DragDirection;
@ -26,10 +21,13 @@ import org.solovyev.android.views.dragbutton.DragDirection;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.inject.Inject; import javax.inject.Inject;
import static org.solovyev.android.calculator.Engine.Preferences.numeralBase; import butterknife.Bind;
import butterknife.ButterKnife;
import static org.solovyev.android.calculator.Preferences.Gui.showEqualsButton; import static org.solovyev.android.calculator.Preferences.Gui.showEqualsButton;
import static org.solovyev.android.calculator.Preferences.Gui.vibrateOnKeypress; import static org.solovyev.android.calculator.Preferences.Gui.vibrateOnKeypress;
import static org.solovyev.android.views.dragbutton.DragDirection.*; import static org.solovyev.android.views.dragbutton.DragDirection.down;
import static org.solovyev.android.views.dragbutton.DragDirection.up;
public class PartialKeyboardUi extends BaseKeyboardUi { public class PartialKeyboardUi extends BaseKeyboardUi {
@ -41,7 +39,7 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
DirectionDragImageButton leftButton; DirectionDragImageButton leftButton;
@Nullable @Nullable
@Bind(R.id.cpp_button_clear) @Bind(R.id.cpp_button_clear)
NumeralBasesButton clearButton; Button clearButton;
@Nullable @Nullable
@Bind(R.id.cpp_button_erase) @Bind(R.id.cpp_button_erase)
ImageButton eraseButton; ImageButton eraseButton;
@ -64,17 +62,11 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
prepareButton(leftButton); prepareButton(leftButton);
prepareButton(equalsButton); prepareButton(equalsButton);
prepareButton(clearButton); prepareButton(clearButton);
if (clearButton != null) {
clearButton.setNumeralBase(numeralBase.getPreference(preferences));
}
if (eraseButton != null) { if (eraseButton != null) {
// backspace button is too big, scale it more // backspace button is too big, scale it more
prepareButton(eraseButton, IMAGE_SCALE_ERASE); prepareButton(eraseButton, IMAGE_SCALE_ERASE);
longClickEraser = EditorLongClickEraser.attachTo(eraseButton, keyboard.isVibrateOnKeypress(), editor, calculator); longClickEraser = EditorLongClickEraser.attachTo(eraseButton, keyboard.isVibrateOnKeypress(), editor, calculator);
} }
if (isSimpleLayout()) {
hideText(clearButton, left, up, down);
}
toggleEqualsButton(); toggleEqualsButton();
} }
@ -96,9 +88,6 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) { public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
super.onSharedPreferenceChanged(preferences, key); super.onSharedPreferenceChanged(preferences, key);
if (clearButton != null && numeralBase.isSameKey(key)) {
clearButton.setNumeralBase(numeralBase.getPreference(preferences));
}
if (equalsButton != null && showEqualsButton.isSameKey(key)) { if (equalsButton != null && showEqualsButton.isSameKey(key)) {
toggleEqualsButton(); toggleEqualsButton();
} }
@ -126,8 +115,6 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
} }
return false; return false;
case R.id.cpp_button_clear:
return processNumeralBaseButton(direction, (DirectionDragButton) view);
} }
return false; return false;
} }
@ -152,22 +139,4 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
break; break;
} }
} }
private boolean processNumeralBaseButton(@Nonnull DragDirection direction, @Nonnull DirectionDragButton button) {
final String text = button.getTextValue(direction);
if (TextUtils.isEmpty(text)) {
return false;
}
try {
final NumeralBase newNumeralBase = NumeralBase.valueOf(text);
final NumeralBase oldNumeralBase = Engine.Preferences.numeralBase.getPreference(preferences);
if (oldNumeralBase != newNumeralBase) {
preferredPreferences.setNumeralBase(newNumeralBase);
return true;
}
} catch (IllegalArgumentException e) {
Log.d(this.getClass().getName(), "Unsupported numeral base: " + text);
}
return false;
}
} }

View File

@ -27,7 +27,7 @@ import android.support.v4.content.ContextCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import org.solovyev.android.views.dragbutton.DirectionDragButton; import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import org.solovyev.android.views.dragbutton.DirectionTextView; import org.solovyev.android.views.dragbutton.DirectionTextView;
import org.solovyev.android.views.dragbutton.DragDirection; import org.solovyev.android.views.dragbutton.DragDirection;
@ -35,7 +35,7 @@ import javax.annotation.Nonnull;
import jscl.AngleUnit; import jscl.AngleUnit;
public class AngleUnitsButton extends DirectionDragButton { public class AngleUnitsButton extends DirectionDragImageButton {
@Nonnull @Nonnull
private AngleUnit angleUnit = AngleUnit.deg; private AngleUnit angleUnit = AngleUnit.deg;

View File

@ -27,7 +27,7 @@ import android.support.v4.content.ContextCompat;
import android.util.AttributeSet; import android.util.AttributeSet;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import org.solovyev.android.views.dragbutton.DirectionDragButton; import org.solovyev.android.views.dragbutton.DirectionDragImageButton;
import org.solovyev.android.views.dragbutton.DirectionTextView; import org.solovyev.android.views.dragbutton.DirectionTextView;
import org.solovyev.android.views.dragbutton.DragDirection; import org.solovyev.android.views.dragbutton.DragDirection;
@ -35,7 +35,7 @@ import javax.annotation.Nonnull;
import jscl.NumeralBase; import jscl.NumeralBase;
public class NumeralBasesButton extends DirectionDragButton { public class NumeralBasesButton extends DirectionDragImageButton {
@Nonnull @Nonnull
private NumeralBase numeralBase = NumeralBase.dec; private NumeralBase numeralBase = NumeralBase.dec;

View File

@ -10,7 +10,7 @@ import android.util.AttributeSet;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class DirectionDragButton extends DragButton { public class DirectionDragButton extends DragButton implements DirectionDragView {
private final DirectionTextView textView = new DirectionTextView(); private final DirectionTextView textView = new DirectionTextView();
@NonNull @NonNull
private final TextPaint baseTextPaint = new TextPaint(); private final TextPaint baseTextPaint = new TextPaint();
@ -69,8 +69,9 @@ public class DirectionDragButton extends DragButton {
return this; return this;
} }
@Override
@Nonnull @Nonnull
protected DirectionTextView.Text getText(@NonNull DragDirection direction) { public DirectionTextView.Text getText(@NonNull DragDirection direction) {
return textView.getText(direction); return textView.getText(direction);
} }

View File

@ -11,7 +11,7 @@ import android.widget.TextView;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class DirectionDragImageButton extends DragImageButton { public class DirectionDragImageButton extends DragImageButton implements DirectionDragView {
private final DirectionTextView textView = new DirectionTextView(); private final DirectionTextView textView = new DirectionTextView();
private final TextPaint baseTextPaint = new TextPaint(); private final TextPaint baseTextPaint = new TextPaint();
@ -48,7 +48,7 @@ public class DirectionDragImageButton extends DragImageButton {
} }
@Nonnull @Nonnull
protected DirectionTextView.Text getText(@NonNull DragDirection direction) { public DirectionTextView.Text getText(@NonNull DragDirection direction) {
return textView.getText(direction); return textView.getText(direction);
} }

View File

@ -0,0 +1,10 @@
package org.solovyev.android.views.dragbutton;
import android.support.annotation.NonNull;
import javax.annotation.Nonnull;
public interface DirectionDragView extends DragView {
@Nonnull
DirectionTextView.Text getText(@NonNull DragDirection direction);
}

View File

@ -4,6 +4,5 @@ import android.support.annotation.Nullable;
public interface DragView { public interface DragView {
void setOnDragListener(@Nullable DragListener listener); void setOnDragListener(@Nullable DragListener listener);
void setVibrateOnDrag(boolean vibrateOnDrag); void setVibrateOnDrag(boolean vibrateOnDrag);
} }

View File

@ -22,14 +22,12 @@
~ Site: http://se.solovyev.org ~ Site: http://se.solovyev.org
--> -->
<org.solovyev.android.calculator.view.AngleUnitsButton <org.solovyev.android.views.dragbutton.DirectionDragButton
xmlns:a="http://schemas.android.com/apk/res/android" xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:c="http://schemas.android.com/apk/res-auto" xmlns:c="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
a:id="@id/cpp_button_6" a:id="@id/cpp_button_6"
style="?attr/cpp_button_style_digit" style="?attr/cpp_button_style_digit"
a:text="6" a:text="6"
c:directionTextDown="rad"
c:directionTextLeft="F" c:directionTextLeft="F"
c:directionTextUp="deg"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />

View File

@ -22,13 +22,9 @@
~ Site: http://se.solovyev.org ~ Site: http://se.solovyev.org
--> -->
<org.solovyev.android.calculator.view.NumeralBasesButton <Button
xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:c="http://schemas.android.com/apk/res-auto"
a:id="@id/cpp_button_clear" a:id="@id/cpp_button_clear"
style="?attr/cpp_button_style_control_image" style="?attr/cpp_button_style_control_image"
xmlns:a="http://schemas.android.com/apk/res/android"
a:text="@string/c_clear" a:text="@string/c_clear"
a:textStyle="bold" a:textStyle="bold"/>
c:directionTextDown="bin"
c:directionTextLeft="hex"
c:directionTextUp="dec" />

View File

@ -22,8 +22,13 @@
~ Site: http://se.solovyev.org ~ Site: http://se.solovyev.org
--> -->
<ImageButton <org.solovyev.android.calculator.view.NumeralBasesButton
xmlns:a="http://schemas.android.com/apk/res/android" android:id="@id/cpp_button_copy"
a:id="@id/cpp_button_copy"
style="?attr/cpp_button_style_control_image" style="?attr/cpp_button_style_control_image"
a:src="@drawable/ic_content_copy_white_48dp" /> xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:src="@drawable/ic_content_copy_white_48dp"
app:directionTextScale="@dimen/cpp_direction_text_scale_units"
app:directionTextDown="bin"
app:directionTextLeft="hex"
app:directionTextUp="dec"/>

View File

@ -22,8 +22,12 @@
~ Site: http://se.solovyev.org ~ Site: http://se.solovyev.org
--> -->
<ImageButton <org.solovyev.android.calculator.view.AngleUnitsButton
xmlns:a="http://schemas.android.com/apk/res/android" android:id="@id/cpp_button_paste"
a:id="@id/cpp_button_paste"
style="?attr/cpp_button_style_control_image" style="?attr/cpp_button_style_control_image"
a:src="@drawable/ic_content_paste_white_48dp" /> xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:directionTextScale="@dimen/cpp_direction_text_scale_units"
android:src="@drawable/ic_content_paste_white_48dp"
app:directionTextDown="rad"
app:directionTextUp="deg"/>

View File

@ -11,6 +11,7 @@
<dimen name="cpp_direction_text_default_padding">2dp</dimen> <dimen name="cpp_direction_text_default_padding">2dp</dimen>
<dimen name="cpp_direction_text_min_size">9dp</dimen> <dimen name="cpp_direction_text_min_size">9dp</dimen>
<item name="cpp_direction_text_scale" format="float" type="dimen">0.45</item> <item name="cpp_direction_text_scale" format="float" type="dimen">0.45</item>
<item name="cpp_direction_text_scale_units" format="float" type="dimen">0.35</item>
<dimen name="cpp_button_corner">1dp</dimen> <dimen name="cpp_button_corner">1dp</dimen>
<dimen name="cpp_keyboard_button_direction_text_padding">4dp</dimen> <dimen name="cpp_keyboard_button_direction_text_padding">4dp</dimen>