Merge remote-tracking branch 'origin/master'
Conflicts: android-app-core/res/values-ru/text_about.xml android-app-core/res/values-ru/text_wizard.xml android-app-core/res/values/text_about.xml android-app-core/res/values/text_wizard.xml pom.xml
This commit is contained in:
@@ -24,6 +24,6 @@
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@id/cpp_button_like"
|
||||
a:src="@drawable/kb_facebook"
|
||||
a:src="@drawable/kb_share"
|
||||
style="?cpp_control_image_button_style"
|
||||
a:onClick="likeButtonClickHandler"/>
|
@@ -29,7 +29,7 @@
|
||||
a:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
a:text="Drag button is an exclusive feature of Calculator++ which provides fast access to the secondary functions"
|
||||
a:text="@string/cpp_wizard_dragbutton_description"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="match_parent"/>
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
a:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
a:text="Calculator in separate window allows you to do calculations while using other apps on your device"
|
||||
a:text="@string/cpp_wizard_onscreen_description"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="match_parent"/>
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
a:id="@+id/wizard_onscreen_app_enabled_checkbox"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="match_parent"
|
||||
a:text="Enable calculator in separate window (second icon will appear in the apps list)"/>
|
||||
a:text="@string/cpp_wizard_onscreen_checkbox"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -43,7 +43,6 @@
|
||||
a:id="@+id/history_item"
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_height="fill_parent"
|
||||
a:textColor="@color/cpp_button_operator_text_color"
|
||||
style="@style/history_item"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -36,7 +36,6 @@
|
||||
a:id="@+id/history_item"
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_height="fill_parent"
|
||||
a:textColor="@color/cpp_button_operator_text_color"
|
||||
style="@style/history_item"/>
|
||||
|
||||
<LinearLayout
|
||||
|
@@ -46,6 +46,69 @@
|
||||
style="@style/cpp_default_text_size"
|
||||
a:inputType="text"/>
|
||||
|
||||
<LinearLayout
|
||||
a:id="@+id/var_edit_greek_buttons_1"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="match_parent"
|
||||
a:orientation="horizontal">
|
||||
|
||||
<Button a:text="α"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="β"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="γ"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="δ"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="ε"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:id="@+id/var_edit_greek_buttons_2"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="match_parent"
|
||||
a:orientation="horizontal">
|
||||
<Button a:text="θ"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="λ"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="μ"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="τ"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<Button a:text="φ"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_width="match_parent"
|
||||
|
@@ -52,6 +52,8 @@ import java.util.List;
|
||||
|
||||
import static org.solovyev.android.calculator.CalculatorPreferences.Gui.Layout.simple;
|
||||
import static org.solovyev.android.calculator.CalculatorPreferences.Gui.Layout.simple_mobile;
|
||||
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.angleUnit;
|
||||
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.numeralBase;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -75,6 +77,12 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
||||
@Nonnull
|
||||
private String logTag = "CalculatorActivity";
|
||||
|
||||
@Nullable
|
||||
private AngleUnitsButton angleUnitsButton;
|
||||
|
||||
@Nullable
|
||||
private NumeralBasesButton clearButton;
|
||||
|
||||
protected AbstractCalculatorHelper() {
|
||||
}
|
||||
|
||||
@@ -151,12 +159,12 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
||||
equalsButton.setOnDragListener(new OnDragListenerVibrator(newOnDragListener(new EqualsDragProcessor(), dragPreferences), vibrator, preferences));
|
||||
}
|
||||
|
||||
final AngleUnitsButton angleUnitsButton = (AngleUnitsButton) getButton(root, R.id.cpp_button_6);
|
||||
angleUnitsButton = getButton(root, R.id.cpp_button_6);
|
||||
if (angleUnitsButton != null) {
|
||||
angleUnitsButton.setOnDragListener(new OnDragListenerVibrator(newOnDragListener(new CalculatorButtons.AngleUnitsChanger(activity), dragPreferences), vibrator, preferences));
|
||||
}
|
||||
|
||||
final NumeralBasesButton clearButton = (NumeralBasesButton) getButton(root, R.id.cpp_button_clear);
|
||||
clearButton = getButton(root, R.id.cpp_button_clear);
|
||||
if (clearButton != null) {
|
||||
clearButton.setOnDragListener(new OnDragListenerVibrator(newOnDragListener(new CalculatorButtons.NumeralBasesChanger(activity), dragPreferences), vibrator, preferences));
|
||||
}
|
||||
@@ -266,12 +274,22 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||
if (key != null && key.startsWith("org.solovyev.android.calculator.DragButtonCalibrationActivity")) {
|
||||
if (key.startsWith("org.solovyev.android.calculator.DragButtonCalibrationActivity")) {
|
||||
final SimpleOnDragListener.Preferences dragPreferences = SimpleOnDragListener.getPreferences(preferences, CalculatorApplication.getInstance());
|
||||
for (DragPreferencesChangeListener dragPreferencesChangeListener : dpclRegister.getListeners()) {
|
||||
dragPreferencesChangeListener.onDragPreferencesChange(dragPreferences);
|
||||
}
|
||||
}
|
||||
|
||||
if (angleUnit.isSameKey(key) || numeralBase.isSameKey(key)) {
|
||||
if (angleUnitsButton != null) {
|
||||
angleUnitsButton.setAngleUnit(angleUnit.getPreference(preferences));
|
||||
}
|
||||
|
||||
if (clearButton != null) {
|
||||
clearButton.setNumeralBase(numeralBase.getPreference(preferences));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy(@Nonnull Activity activity) {
|
||||
|
@@ -205,7 +205,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
}
|
||||
|
||||
public static void likeButtonPressed(@Nonnull final Context context) {
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CalculatorApplication.FACEBOOK_APP_URL));
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(context.getString(R.string.cpp_share_link)));
|
||||
Android.addIntentFlags(intent, false, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
@@ -72,7 +72,6 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
||||
*/
|
||||
|
||||
private static final String TAG = "Calculator++ Application";
|
||||
public static final String FACEBOOK_APP_URL = "http://www.facebook.com/calculatorpp";
|
||||
|
||||
public static final String AD_FREE_PRODUCT_ID = "ad_free";
|
||||
public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free";
|
||||
|
@@ -36,6 +36,14 @@ import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||
|
||||
import static org.solovyev.android.calculator.CalculatorPreferences.Gui.hideNumeralBaseDigits;
|
||||
import static org.solovyev.android.calculator.CalculatorPreferences.Gui.showEqualsButton;
|
||||
import static org.solovyev.android.calculator.NumeralBaseButtons.toggleNumericDigits;
|
||||
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences;
|
||||
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.angleUnit;
|
||||
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.multiplicationSign;
|
||||
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.numeralBase;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 25.09.12
|
||||
@@ -108,21 +116,6 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
|
||||
|
||||
}
|
||||
|
||||
/* private static void setMarginsForView(@Nullable View view, int marginLeft, int marginBottom, @Nonnull Context context) {
|
||||
// IMPORTANT: this is workaround for probably android bug
|
||||
// currently margin values set in styles are not applied for some reasons to the views (using include tag) => set them manually
|
||||
|
||||
if (view != null) {
|
||||
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
|
||||
if (view.getLayoutParams() instanceof LinearLayout.LayoutParams) {
|
||||
final LinearLayout.LayoutParams oldParams = (LinearLayout.LayoutParams) view.getLayoutParams();
|
||||
final LinearLayout.LayoutParams newParams = new LinearLayout.LayoutParams(oldParams.width, oldParams.height, oldParams.weight);
|
||||
newParams.setMargins(AndroidUtils.toPixels(dm, marginLeft), 0, 0, AndroidUtils.toPixels(dm, marginBottom));
|
||||
view.setLayoutParams(newParams);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
@@ -130,25 +123,15 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||
if (AndroidCalculatorEngine.Preferences.numeralBase.getKey().equals(key) ||
|
||||
CalculatorPreferences.Gui.hideNumeralBaseDigits.getKey().equals(key)) {
|
||||
NumeralBaseButtons.toggleNumericDigits(this.getActivity(), preferences);
|
||||
if (numeralBase.isSameKey(key) || hideNumeralBaseDigits.isSameKey(key)) {
|
||||
toggleNumericDigits(this.getActivity(), preferences);
|
||||
}
|
||||
|
||||
if (AndroidCalculatorEngine.Preferences.angleUnit.getKey().equals(key) ||
|
||||
AndroidCalculatorEngine.Preferences.numeralBase.getKey().equals(key)) {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
// we should update state of angle units/numeral base button => we can achieve it by invalidating the whole view
|
||||
view.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
if (CalculatorPreferences.Gui.showEqualsButton.getKey().equals(key)) {
|
||||
if (showEqualsButton.isSameKey(key)) {
|
||||
CalculatorButtons.toggleEqualsButton(preferences, this.getActivity());
|
||||
}
|
||||
|
||||
if (AndroidCalculatorEngine.Preferences.multiplicationSign.getKey().equals(key)) {
|
||||
if (multiplicationSign.isSameKey(key)) {
|
||||
CalculatorButtons.initMultiplicationButton(getView());
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,10 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||
|
||||
import static jscl.NumeralBase.hex;
|
||||
import static org.solovyev.android.calculator.CalculatorPreferences.Gui.hideNumeralBaseDigits;
|
||||
import static org.solovyev.android.calculator.model.AndroidCalculatorEngine.Preferences.numeralBase;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 4/20/12
|
||||
@@ -48,12 +52,12 @@ public class NumeralBaseButtons {
|
||||
}
|
||||
|
||||
public static void toggleNumericDigits(@Nonnull Activity activity, @Nonnull SharedPreferences preferences) {
|
||||
if (CalculatorPreferences.Gui.hideNumeralBaseDigits.getPreference(preferences)) {
|
||||
final NumeralBase nb = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(preferences);
|
||||
if (hideNumeralBaseDigits.getPreference(preferences)) {
|
||||
final NumeralBase nb = numeralBase.getPreference(preferences);
|
||||
toggleNumericDigits(activity, nb);
|
||||
} else {
|
||||
// set HEX to show all digits
|
||||
AndroidNumeralBase.valueOf(NumeralBase.hex).toggleButtons(true, activity);
|
||||
AndroidNumeralBase.valueOf(hex).toggleButtons(true, activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -80,8 +80,6 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
||||
|
||||
public static final String MATH_ENTITY_CATEGORY_EXTRA_STRING = "org.solovyev.android.calculator.CalculatorVarsActivity_math_entity_category";
|
||||
|
||||
protected final static List<Character> acceptableChars = Arrays.asList(Strings.toObjects("1234567890abcdefghijklmnopqrstuvwxyzйцукенгшщзхъфывапролджэячсмитьбюё_".toCharArray()));
|
||||
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
package org.solovyev.android.calculator.math.edit;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
@@ -30,17 +31,24 @@ import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import jscl.math.function.IConstant;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.Views;
|
||||
import org.solovyev.android.calculator.*;
|
||||
import org.solovyev.android.calculator.model.Var;
|
||||
import org.solovyev.android.sherlock.AndroidSherlockUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
@@ -49,6 +57,8 @@ import org.solovyev.android.sherlock.AndroidSherlockUtils;
|
||||
*/
|
||||
public class VarEditDialogFragment extends DialogFragment implements CalculatorEventListener {
|
||||
|
||||
private final static List<Character> acceptableChars = Arrays.asList(Strings.toObjects("1234567890abcdefghijklmnopqrstuvwxyzйцукенгшщзхъфывапролджэячсмитьбюёαβγδεζηθικλμνξοπρστυφχψω_".toCharArray()));
|
||||
|
||||
@Nonnull
|
||||
private final Input input;
|
||||
|
||||
@@ -101,7 +111,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
|
||||
public void afterTextChanged(Editable s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (!AbstractMathEntityListFragment.acceptableChars.contains(c)) {
|
||||
if (!acceptableChars.contains(c)) {
|
||||
s.delete(i, i + 1);
|
||||
Toast.makeText(getActivity(), String.format(errorMsg, c), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -109,9 +119,12 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
|
||||
}
|
||||
});
|
||||
|
||||
processGreekButtons(root, editName, R.id.var_edit_greek_buttons_1);
|
||||
processGreekButtons(root, editName, R.id.var_edit_greek_buttons_2);
|
||||
|
||||
// show soft keyboard automatically
|
||||
editName.requestFocus();
|
||||
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
getDialog().getWindow().setSoftInputMode(SOFT_INPUT_STATE_VISIBLE);
|
||||
|
||||
final EditText editValue = (EditText) root.findViewById(R.id.var_edit_value);
|
||||
editValue.setText(input.getValue());
|
||||
@@ -149,6 +162,21 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
|
||||
}
|
||||
}
|
||||
|
||||
private void processGreekButtons(@Nonnull View root, @Nonnull final EditText editName, int greekButtonsViewId) {
|
||||
final ViewGroup greekButtons = (ViewGroup) root.findViewById(greekButtonsViewId);
|
||||
Views.processViewsOfType(greekButtons, Button.class, new Views.ViewProcessor<Button>() {
|
||||
@Override
|
||||
public void process(@Nonnull final Button greekButton) {
|
||||
greekButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
editName.append(greekButton.getText());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
|
||||
switch (calculatorEventType) {
|
||||
|
Reference in New Issue
Block a user