deps versions update
This commit is contained in:
parent
0b902355e0
commit
a00a2ac684
@ -10,6 +10,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
@ -183,7 +184,11 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
|
|||||||
setTextSize(TypedValue.COMPLEX_UNIT_SP, getResources().getDimension(R.dimen.cpp_display_text_size_mobile));
|
setTextSize(TypedValue.COMPLEX_UNIT_SP, getResources().getDimension(R.dimen.cpp_display_text_size_mobile));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setOnClickListener(new CalculatorDisplayOnClickListener(context));
|
if (context instanceof FragmentActivity) {
|
||||||
|
this.setOnClickListener(new CalculatorDisplayOnClickListener((FragmentActivity) context));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Must be fragment activity, got " + context.getClass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
|
@ -15,7 +15,7 @@ import jscl.AngleUnit;
|
|||||||
import jscl.NumeralBase;
|
import jscl.NumeralBase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AViews;
|
import org.solovyev.android.Views;
|
||||||
import org.solovyev.android.calculator.core.R;
|
import org.solovyev.android.calculator.core.R;
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||||
import org.solovyev.android.calculator.view.AngleUnitsButton;
|
import org.solovyev.android.calculator.view.AngleUnitsButton;
|
||||||
@ -43,7 +43,7 @@ public final class CalculatorButtons {
|
|||||||
|
|
||||||
final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile);
|
final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile);
|
||||||
|
|
||||||
AViews.processViewsOfType(root, DragButton.class, new AViews.ViewProcessor<DragButton>() {
|
Views.processViewsOfType(root, DragButton.class, new Views.ViewProcessor<DragButton>() {
|
||||||
@Override
|
@Override
|
||||||
public void process(@NotNull DragButton button) {
|
public void process(@NotNull DragButton button) {
|
||||||
button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
|
button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
|
||||||
@ -68,11 +68,11 @@ public final class CalculatorButtons {
|
|||||||
@NotNull Activity activity) {
|
@NotNull Activity activity) {
|
||||||
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
|
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
|
||||||
|
|
||||||
final boolean large = AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) &&
|
final boolean large = Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) &&
|
||||||
CalculatorPreferences.Gui.getLayout(preferences) != CalculatorPreferences.Gui.Layout.main_calculator_mobile;
|
CalculatorPreferences.Gui.getLayout(preferences) != CalculatorPreferences.Gui.Layout.main_calculator_mobile;
|
||||||
|
|
||||||
if (!large) {
|
if (!large) {
|
||||||
if (AViews.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT
|
if (Views.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT
|
||||||
|| !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
|
|| !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
|
||||||
|
|
||||||
final DragButton equalsButton = (DragButton)activity.findViewById(R.id.cpp_button_equals);
|
final DragButton equalsButton = (DragButton)activity.findViewById(R.id.cpp_button_equals);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.menu.ContextMenuBuilder;
|
import org.solovyev.android.menu.ContextMenuBuilder;
|
||||||
@ -17,10 +17,10 @@ import java.util.List;
|
|||||||
public class CalculatorDisplayOnClickListener implements View.OnClickListener {
|
public class CalculatorDisplayOnClickListener implements View.OnClickListener {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Context context;
|
private final FragmentActivity activity;
|
||||||
|
|
||||||
public CalculatorDisplayOnClickListener(@NotNull Context context) {
|
public CalculatorDisplayOnClickListener(@NotNull FragmentActivity activity) {
|
||||||
this.context = context;
|
this.activity = activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -39,13 +39,13 @@ public class CalculatorDisplayOnClickListener implements View.OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!filteredMenuItems.isEmpty()) {
|
if (!filteredMenuItems.isEmpty()) {
|
||||||
ContextMenuBuilder.newInstance(context, ListContextMenu.newInstance(filteredMenuItems)).create(displayViewState).show();
|
ContextMenuBuilder.newInstance(activity, "display-menu", ListContextMenu.newInstance(filteredMenuItems)).build(displayViewState).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final String errorMessage = displayViewState.getErrorMessage();
|
final String errorMessage = displayViewState.getErrorMessage();
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_evaluation_error, errorMessage, context);
|
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_evaluation_error, errorMessage, activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@ import android.content.SharedPreferences;
|
|||||||
import jscl.AngleUnit;
|
import jscl.AngleUnit;
|
||||||
import jscl.NumeralBase;
|
import jscl.NumeralBase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Android;
|
||||||
|
import org.solovyev.android.DeviceModel;
|
||||||
import org.solovyev.android.calculator.math.MathType;
|
import org.solovyev.android.calculator.math.MathType;
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||||
import org.solovyev.android.calculator.plot.PlotLineColor;
|
import org.solovyev.android.calculator.plot.PlotLineColor;
|
||||||
@ -19,6 +20,10 @@ import org.solovyev.android.view.VibratorContainer;
|
|||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static org.solovyev.android.Android.isPhoneModel;
|
||||||
|
import static org.solovyev.android.DeviceModel.samsung_galaxy_s;
|
||||||
|
import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
* Date: 4/20/12
|
* Date: 4/20/12
|
||||||
@ -166,7 +171,7 @@ public final class CalculatorPreferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!AndroidCalculatorEngine.Preferences.multiplicationSign.isSet(preferences)) {
|
if (!AndroidCalculatorEngine.Preferences.multiplicationSign.isSet(preferences)) {
|
||||||
if (AndroidUtils.isPhoneModel(AndroidUtils.PhoneModel.samsung_galaxy_s) || AndroidUtils.isPhoneModel(AndroidUtils.PhoneModel.samsung_galaxy_s_2)) {
|
if (isPhoneModel(samsung_galaxy_s) || isPhoneModel(samsung_galaxy_s_2)) {
|
||||||
// workaround ofr samsung galaxy s phones
|
// workaround ofr samsung galaxy s phones
|
||||||
AndroidCalculatorEngine.Preferences.multiplicationSign.putPreference(preferences, "*");
|
AndroidCalculatorEngine.Preferences.multiplicationSign.putPreference(preferences, "*");
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import android.util.DisplayMetrics;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AViews;
|
import org.solovyev.android.Views;
|
||||||
import org.solovyev.android.calculator.CalculatorDisplayViewState;
|
import org.solovyev.android.calculator.CalculatorDisplayViewState;
|
||||||
import org.solovyev.android.calculator.CalculatorEditorViewState;
|
import org.solovyev.android.calculator.CalculatorEditorViewState;
|
||||||
import org.solovyev.android.calculator.Locator;
|
import org.solovyev.android.calculator.Locator;
|
||||||
@ -65,7 +65,7 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul
|
|||||||
twoThirdWidth = Math.min(twoThirdWidth, twoThirdHeight);
|
twoThirdWidth = Math.min(twoThirdWidth, twoThirdHeight);
|
||||||
twoThirdHeight = Math.max(twoThirdWidth, getHeight(twoThirdWidth));
|
twoThirdHeight = Math.max(twoThirdWidth, getHeight(twoThirdWidth));
|
||||||
|
|
||||||
final int baseWidth = AViews.toPixels(dm, 300);
|
final int baseWidth = Views.toPixels(dm, 300);
|
||||||
final int width0 = Math.min(twoThirdWidth, baseWidth);
|
final int width0 = Math.min(twoThirdWidth, baseWidth);
|
||||||
final int height0 = Math.min(twoThirdHeight, getHeight(baseWidth));
|
final int height0 = Math.min(twoThirdHeight, getHeight(baseWidth));
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.App;
|
import org.solovyev.android.App;
|
||||||
import org.solovyev.android.calculator.AbstractFixableError;
|
import org.solovyev.android.calculator.AbstractFixableError;
|
||||||
import org.solovyev.android.calculator.CalculatorPreferences;
|
import org.solovyev.android.calculator.CalculatorPreferences;
|
||||||
@ -22,7 +22,7 @@ public class CalculatorOnscreenStartActivity extends Activity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (AndroidUtils.isComponentEnabled(this, CalculatorOnscreenStartActivity.class)) {
|
if (Android.isComponentEnabled(this, CalculatorOnscreenStartActivity.class)) {
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
if (!CalculatorPreferences.OnscreenCalculator.removeIconDialogShown.getPreference(prefs)) {
|
if (!CalculatorPreferences.OnscreenCalculator.removeIconDialogShown.getPreference(prefs)) {
|
||||||
|
@ -114,7 +114,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>11.0.2</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
~ Copyright (c) 2009-2012. Created by serso aka se.solovyev.
|
|
||||||
~ For more information, please, contact se.solovyev@gmail.com
|
|
||||||
~ or visit http://se.solovyev.org
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
|
||||||
a:layout_width="fill_parent"
|
|
||||||
a:layout_height="fill_parent"
|
|
||||||
a:orientation="vertical">
|
|
||||||
</LinearLayout>
|
|
@ -8,6 +8,6 @@
|
|||||||
a:summary="@string/c_calc_ad_free_summary"
|
a:summary="@string/c_calc_ad_free_summary"
|
||||||
a:defaultValue="false"/>
|
a:defaultValue="false"/>
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/admob_pref"/>
|
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
@ -6,7 +6,7 @@
|
|||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
a:title="@string/c_prefs_appearance_category">
|
a:title="@string/c_prefs_appearance_category">
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/admob_pref"/>
|
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="@string/p_calc_color_display_key"
|
a:key="@string/p_calc_color_display_key"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<PreferenceScreen a:title="@string/c_prefs_calculations_category">
|
<PreferenceScreen a:title="@string/c_prefs_calculations_category">
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/admob_pref"/>
|
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="@string/p_calc_round_result_key"
|
a:key="@string/p_calc_round_result_key"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<PreferenceScreen a:title="@string/prefs_onscreen_title">
|
<PreferenceScreen a:title="@string/prefs_onscreen_title">
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/admob_pref"/>
|
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="onscreen_start_on_boot"
|
a:key="onscreen_start_on_boot"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
a:title="@string/c_prefs_other_category">
|
a:title="@string/c_prefs_other_category">
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/admob_pref"/>
|
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="@string/p_calc_show_release_notes_key"
|
a:key="@string/p_calc_show_release_notes_key"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<PreferenceScreen a:title="@string/prefs_graph_screen_title">
|
<PreferenceScreen a:title="@string/prefs_graph_screen_title">
|
||||||
|
|
||||||
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/admob_pref"/>
|
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/acl_adview_pref"/>
|
||||||
|
|
||||||
<android.preference.CheckBoxPreference
|
<android.preference.CheckBoxPreference
|
||||||
a:key="graph_plot_imag"
|
a:key="graph_plot_imag"
|
||||||
|
@ -80,7 +80,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processButtons(@NotNull final Activity activity, @NotNull View root) {
|
public void processButtons(@NotNull final Activity activity, @NotNull View root) {
|
||||||
dpclRegister.removeAll();
|
dpclRegister.removeListeners();
|
||||||
|
|
||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
final SimpleOnDragListener.Preferences dragPreferences = SimpleOnDragListener.getPreferences(preferences, activity);
|
final SimpleOnDragListener.Preferences dragPreferences = SimpleOnDragListener.getPreferences(preferences, activity);
|
||||||
|
@ -5,7 +5,7 @@ import android.os.Handler;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AThreads;
|
import org.solovyev.android.Threads;
|
||||||
import org.solovyev.android.msg.AndroidMessage;
|
import org.solovyev.android.msg.AndroidMessage;
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageType;
|
||||||
@ -32,7 +32,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AndroidCalculatorNotifier(@NotNull Application application, boolean showDebugMessages) {
|
public AndroidCalculatorNotifier(@NotNull Application application, boolean showDebugMessages) {
|
||||||
assert AThreads.isUiThread();
|
assert Threads.isUiThread();
|
||||||
|
|
||||||
this.application = application;
|
this.application = application;
|
||||||
this.showDebugMessages = showDebugMessages;
|
this.showDebugMessages = showDebugMessages;
|
||||||
@ -61,7 +61,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showMessageInUiThread(@NotNull final String message) {
|
private void showMessageInUiThread(@NotNull final String message) {
|
||||||
if (AThreads.isUiThread()) {
|
if (Threads.isUiThread()) {
|
||||||
Toast.makeText(application, message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(application, message, Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
uiHandler.post(new Runnable() {
|
uiHandler.post(new Runnable() {
|
||||||
|
@ -23,9 +23,9 @@ import com.actionbarsherlock.app.ActionBar;
|
|||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AActivities;
|
import org.solovyev.android.Activities;
|
||||||
import org.solovyev.android.AThreads;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Threads;
|
||||||
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
|
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
|
||||||
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
@ -109,7 +109,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
|||||||
|
|
||||||
final Integer savedVersion = CalculatorPreferences.appVersion.getPreference(preferences);
|
final Integer savedVersion = CalculatorPreferences.appVersion.getPreference(preferences);
|
||||||
|
|
||||||
final int appVersion = AndroidUtils.getAppVersionCode(context, CalculatorActivity.class.getPackage().getName());
|
final int appVersion = Android.getAppVersionCode(context);
|
||||||
|
|
||||||
CalculatorPreferences.appVersion.putPreference(preferences, appVersion);
|
CalculatorPreferences.appVersion.putPreference(preferences, appVersion);
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
|||||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
final CalculatorPreferences.Gui.Layout newLayout = CalculatorPreferences.Gui.layout.getPreference(preferences);
|
final CalculatorPreferences.Gui.Layout newLayout = CalculatorPreferences.Gui.layout.getPreference(preferences);
|
||||||
if ( newLayout != activityHelper.getLayout() ) {
|
if ( newLayout != activityHelper.getLayout() ) {
|
||||||
AActivities.restartActivity(this);
|
Activities.restartActivity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activityHelper.onResume(this);
|
this.activityHelper.onResume(this);
|
||||||
@ -332,23 +332,23 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
|||||||
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
|
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
|
||||||
switch (calculatorEventType) {
|
switch (calculatorEventType) {
|
||||||
case plot_graph:
|
case plot_graph:
|
||||||
AThreads.tryRunOnUiThread(this, new Runnable() {
|
Threads.tryRunOnUiThread(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (isMultiPane()) {
|
if (isMultiPane()) {
|
||||||
final ActionBar.Tab selectedTab = getSupportActionBar().getSelectedTab();
|
final ActionBar.Tab selectedTab = getSupportActionBar().getSelectedTab();
|
||||||
if (selectedTab != null && CalculatorFragmentType.plotter.getFragmentTag().equals(selectedTab.getTag())) {
|
if (selectedTab != null && CalculatorFragmentType.plotter.getFragmentTag().equals(selectedTab.getTag())) {
|
||||||
// do nothing - fragment shown and already registered for plot updates
|
// do nothing - fragment shown and already registered for plot updates
|
||||||
} else {
|
} else {
|
||||||
// otherwise - open fragment
|
// otherwise - open fragment
|
||||||
activityHelper.selectTab(CalculatorActivity.this, CalculatorFragmentType.plotter);
|
activityHelper.selectTab(CalculatorActivity.this, CalculatorFragmentType.plotter);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// start new activity
|
// start new activity
|
||||||
CalculatorActivityLauncher.plotGraph(CalculatorActivity.this);
|
CalculatorActivityLauncher.plotGraph(CalculatorActivity.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ import com.actionbarsherlock.app.ActionBar;
|
|||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AActivities;
|
import org.solovyev.android.Activities;
|
||||||
import org.solovyev.android.AViews;
|
import org.solovyev.android.Views;
|
||||||
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,7 +113,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
final ActionBar actionBar = activity.getSupportActionBar();
|
final ActionBar actionBar = activity.getSupportActionBar();
|
||||||
|
|
||||||
if (activity instanceof CalculatorActivity) {
|
if (activity instanceof CalculatorActivity) {
|
||||||
if (AViews.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) {
|
if (Views.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
actionBar.setDisplayShowTitleEnabled(true);
|
actionBar.setDisplayShowTitleEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
actionBar.setDisplayShowTitleEnabled(false);
|
actionBar.setDisplayShowTitleEnabled(false);
|
||||||
@ -145,7 +145,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
|
|
||||||
final CalculatorPreferences.Gui.Theme newTheme = CalculatorPreferences.Gui.theme.getPreference(preferences);
|
final CalculatorPreferences.Gui.Theme newTheme = CalculatorPreferences.Gui.theme.getPreference(preferences);
|
||||||
if (!theme.equals(newTheme)) {
|
if (!theme.equals(newTheme)) {
|
||||||
AActivities.restartActivity(activity);
|
Activities.restartActivity(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,13 +282,13 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
|
|||||||
|
|
||||||
final StringBuilder helpText = new StringBuilder();
|
final StringBuilder helpText = new StringBuilder();
|
||||||
helpText.append("Size: ");
|
helpText.append("Size: ");
|
||||||
if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE, c)) {
|
if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE, c)) {
|
||||||
helpText.append("xlarge");
|
helpText.append("xlarge");
|
||||||
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, c)) {
|
} else if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, c)) {
|
||||||
helpText.append("large");
|
helpText.append("large");
|
||||||
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL, c)) {
|
} else if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL, c)) {
|
||||||
helpText.append("normal");
|
helpText.append("normal");
|
||||||
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL, c)) {
|
} else if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL, c)) {
|
||||||
helpText.append("small");
|
helpText.append("small");
|
||||||
} else {
|
} else {
|
||||||
helpText.append("unknown");
|
helpText.append("unknown");
|
||||||
|
@ -14,7 +14,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
|||||||
import jscl.math.Generic;
|
import jscl.math.Generic;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.App;
|
import org.solovyev.android.App;
|
||||||
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
|
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
|
||||||
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
||||||
@ -47,7 +47,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
|
|
||||||
public static void showHistory(@NotNull final Context context, boolean detached) {
|
public static void showHistory(@NotNull final Context context, boolean detached) {
|
||||||
final Intent intent = new Intent(context, CalculatorHistoryActivity.class);
|
final Intent intent = new Intent(context, CalculatorHistoryActivity.class);
|
||||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
Android.addIntentFlags(intent, detached, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
}
|
}
|
||||||
public static void showSettings(@NotNull final Context context, boolean detached) {
|
public static void showSettings(@NotNull final Context context, boolean detached) {
|
||||||
final Intent intent = new Intent(context, CalculatorPreferencesActivity.class);
|
final Intent intent = new Intent(context, CalculatorPreferencesActivity.class);
|
||||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
Android.addIntentFlags(intent, detached, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
|
|
||||||
public static void showFunctions(@NotNull final Context context, boolean detached) {
|
public static void showFunctions(@NotNull final Context context, boolean detached) {
|
||||||
final Intent intent = new Intent(context, CalculatorFunctionsActivity.class);
|
final Intent intent = new Intent(context, CalculatorFunctionsActivity.class);
|
||||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
Android.addIntentFlags(intent, detached, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
|
|
||||||
public static void showOperators(@NotNull final Context context, boolean detached) {
|
public static void showOperators(@NotNull final Context context, boolean detached) {
|
||||||
final Intent intent = new Intent(context, CalculatorOperatorsActivity.class);
|
final Intent intent = new Intent(context, CalculatorOperatorsActivity.class);
|
||||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
Android.addIntentFlags(intent, detached, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,14 +94,14 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
|
|
||||||
public static void showVars(@NotNull final Context context, boolean detached) {
|
public static void showVars(@NotNull final Context context, boolean detached) {
|
||||||
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
||||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
Android.addIntentFlags(intent, detached, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void plotGraph(@NotNull final Context context){
|
public static void plotGraph(@NotNull final Context context){
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.setClass(context, CalculatorPlotActivity.class);
|
intent.setClass(context, CalculatorPlotActivity.class);
|
||||||
AndroidUtils.addIntentFlags(intent, false, context);
|
Android.addIntentFlags(intent, false, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
} else {
|
} else {
|
||||||
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
||||||
intent.putExtra(CalculatorVarsFragment.CREATE_VAR_EXTRA_STRING, varValue);
|
intent.putExtra(CalculatorVarsFragment.CREATE_VAR_EXTRA_STRING, varValue);
|
||||||
AndroidUtils.addIntentFlags(intent, false, context);
|
Android.addIntentFlags(intent, false, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -184,7 +184,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
|
|
||||||
public static void likeButtonPressed(@NotNull final Context context) {
|
public static void likeButtonPressed(@NotNull 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(CalculatorApplication.FACEBOOK_APP_URL));
|
||||||
AndroidUtils.addIntentFlags(intent, false, context);
|
Android.addIntentFlags(intent, false, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final Intent intent = new Intent(context, CalculatorMatrixActivity.class);
|
final Intent intent = new Intent(context, CalculatorMatrixActivity.class);
|
||||||
AndroidUtils.addIntentFlags(intent, false, context);
|
Android.addIntentFlags(intent, false, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -13,8 +13,9 @@ import org.acra.ACRA;
|
|||||||
import org.acra.ReportingInteractionMode;
|
import org.acra.ReportingInteractionMode;
|
||||||
import org.acra.annotation.ReportsCrashes;
|
import org.acra.annotation.ReportsCrashes;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.App;
|
import org.solovyev.android.App;
|
||||||
|
import org.solovyev.android.ServiceLocator;
|
||||||
import org.solovyev.android.ads.AdsController;
|
import org.solovyev.android.ads.AdsController;
|
||||||
import org.solovyev.android.calculator.external.AndroidExternalListenersContainer;
|
import org.solovyev.android.calculator.external.AndroidExternalListenersContainer;
|
||||||
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
||||||
@ -40,7 +41,7 @@ import java.util.List;
|
|||||||
resToastText = R.string.crashed,
|
resToastText = R.string.crashed,
|
||||||
resDialogTitle = R.string.crash_dialog_title,
|
resDialogTitle = R.string.crash_dialog_title,
|
||||||
resDialogText = R.string.crash_dialog_text)
|
resDialogText = R.string.crash_dialog_text)
|
||||||
public class CalculatorApplication extends android.app.Application implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class CalculatorApplication extends android.app.Application implements SharedPreferences.OnSharedPreferenceChangeListener, ServiceLocator {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
@ -221,7 +222,7 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
|||||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||||
if (CalculatorPreferences.OnscreenCalculator.showAppIcon.getKey().equals(key)) {
|
if (CalculatorPreferences.OnscreenCalculator.showAppIcon.getKey().equals(key)) {
|
||||||
boolean showAppIcon = CalculatorPreferences.OnscreenCalculator.showAppIcon.getPreference(prefs);
|
boolean showAppIcon = CalculatorPreferences.OnscreenCalculator.showAppIcon.getPreference(prefs);
|
||||||
AndroidUtils.toggleComponent(this, CalculatorOnscreenStartActivity.class, showAppIcon);
|
Android.toggleComponent(this, CalculatorOnscreenStartActivity.class, showAppIcon);
|
||||||
Locator.getInstance().getNotifier().showMessage(R.string.cpp_this_change_may_require_reboot, MessageType.info);
|
Locator.getInstance().getNotifier().showMessage(R.string.cpp_this_change_may_require_reboot, MessageType.info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import android.widget.TextView;
|
|||||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageType;
|
||||||
import org.solovyev.common.text.Strings;
|
import org.solovyev.common.text.Strings;
|
||||||
@ -33,7 +33,7 @@ public class CalculatorDialogActivity extends SherlockFragmentActivity {
|
|||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.setClass(context, CalculatorDialogActivity.class);
|
intent.setClass(context, CalculatorDialogActivity.class);
|
||||||
intent.putExtra(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData));
|
intent.putExtra(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData));
|
||||||
AndroidUtils.addIntentFlags(intent, false, context);
|
Android.addIntentFlags(intent, false, context);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import android.text.method.LinkMovementMethod;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.calculator.CalculatorApplication;
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
import org.solovyev.android.calculator.CalculatorFragment;
|
import org.solovyev.android.calculator.CalculatorFragment;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||||
@ -51,7 +51,7 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment {
|
|||||||
final StringBuilder result = new StringBuilder();
|
final StringBuilder result = new StringBuilder();
|
||||||
|
|
||||||
final String releaseNotesForTitle = context.getString(R.string.c_release_notes_for_title);
|
final String releaseNotesForTitle = context.getString(R.string.c_release_notes_for_title);
|
||||||
final int version = AndroidUtils.getAppVersionCode(context, CalculatorApplication.class.getPackage().getName());
|
final int version = Android.getAppVersionCode(context);
|
||||||
|
|
||||||
final TextHelper textHelper = new TextHelper(context.getResources(), CalculatorApplication.class.getPackage().getName());
|
final TextHelper textHelper = new TextHelper(context.getResources(), CalculatorApplication.class.getPackage().getName());
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ package org.solovyev.android.calculator.history;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -22,7 +23,6 @@ import com.actionbarsherlock.view.MenuItem;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
|
||||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||||
import org.solovyev.android.menu.*;
|
import org.solovyev.android.menu.*;
|
||||||
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
||||||
@ -140,7 +140,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
|||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
||||||
final CalculatorHistoryState historyState = (CalculatorHistoryState) parent.getItemAtPosition(position);
|
final CalculatorHistoryState historyState = (CalculatorHistoryState) parent.getItemAtPosition(position);
|
||||||
|
|
||||||
final Context context = getActivity();
|
final FragmentActivity activity = getActivity();
|
||||||
|
|
||||||
final HistoryItemMenuData data = new HistoryItemMenuData(historyState, adapter);
|
final HistoryItemMenuData data = new HistoryItemMenuData(historyState, adapter);
|
||||||
|
|
||||||
@ -160,8 +160,8 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
|||||||
menuItems.remove(HistoryItemMenuItem.copy_result);
|
menuItems.remove(HistoryItemMenuItem.copy_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ContextMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = ContextMenuBuilder.newInstance(context, ListContextMenu.newInstance(menuItems));
|
final ContextMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = ContextMenuBuilder.newInstance(activity, "history-menu", ListContextMenu.newInstance(menuItems));
|
||||||
menuBuilder.create(data).show();
|
menuBuilder.build(data).show();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
|||||||
historyState.setSaved(true);
|
historyState.setSaved(true);
|
||||||
if ( Collections.contains(historyState, Locator.getInstance().getHistory().getSavedHistory(), new Equalizer<CalculatorHistoryState>() {
|
if ( Collections.contains(historyState, Locator.getInstance().getHistory().getSavedHistory(), new Equalizer<CalculatorHistoryState>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable CalculatorHistoryState first, @Nullable CalculatorHistoryState second) {
|
public boolean areEqual(@Nullable CalculatorHistoryState first, @Nullable CalculatorHistoryState second) {
|
||||||
return first != null && second != null &&
|
return first != null && second != null &&
|
||||||
first.getTime() == second.getTime() &&
|
first.getTime() == second.getTime() &&
|
||||||
first.getDisplayState().equals(second.getDisplayState()) &&
|
first.getDisplayState().equals(second.getDisplayState()) &&
|
||||||
|
@ -51,7 +51,7 @@ 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";
|
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.toObject("1234567890abcdefghijklmnopqrstuvwxyzйцукенгшщзхъфывапролджэячсмитьбюё_".toCharArray()));
|
protected final static List<Character> acceptableChars = Arrays.asList(Strings.toObjects("1234567890abcdefghijklmnopqrstuvwxyzйцукенгшщзхъфывапролджэячсмитьбюё_".toCharArray()));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -124,8 +124,8 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
|||||||
final List<LabeledMenuItem<T>> menuItems = getMenuItemsOnLongClick(item);
|
final List<LabeledMenuItem<T>> menuItems = getMenuItemsOnLongClick(item);
|
||||||
|
|
||||||
if (!menuItems.isEmpty()) {
|
if (!menuItems.isEmpty()) {
|
||||||
final ContextMenuBuilder<LabeledMenuItem<T>, T> menuBuilder = ContextMenuBuilder.newInstance(AbstractMathEntityListFragment.this.getActivity(), ListContextMenu.newInstance(menuItems));
|
final ContextMenuBuilder<LabeledMenuItem<T>, T> menuBuilder = ContextMenuBuilder.newInstance(AbstractMathEntityListFragment.this.getActivity(), "math-entity-menu", ListContextMenu.newInstance(menuItems));
|
||||||
menuBuilder.create(item).show();
|
menuBuilder.build(item).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -16,8 +16,8 @@ import com.actionbarsherlock.view.MenuInflater;
|
|||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.AThreads;
|
import org.solovyev.android.Android;
|
||||||
import org.solovyev.android.AndroidUtils;
|
import org.solovyev.android.Threads;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||||
import org.solovyev.android.menu.AMenuItem;
|
import org.solovyev.android.menu.AMenuItem;
|
||||||
@ -153,19 +153,19 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateChart(@NotNull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) {
|
private void updateChart(@NotNull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) {
|
||||||
AThreads.tryRunOnUiThread(activity, new Runnable() {
|
Threads.tryRunOnUiThread(activity, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
createChart(plotData);
|
createChart(plotData);
|
||||||
|
|
||||||
final View view = getView();
|
final View view = getView();
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
createGraphicalView(view, plotData);
|
createGraphicalView(view, plotData);
|
||||||
}
|
}
|
||||||
|
|
||||||
activity.invalidateOptionsMenu();
|
activity.invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void onError();
|
protected abstract void onError();
|
||||||
@ -309,7 +309,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
final File externalFilesDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
final File externalFilesDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||||
if (externalFilesDir != null) {
|
if (externalFilesDir != null) {
|
||||||
final String path = externalFilesDir.getPath();
|
final String path = externalFilesDir.getPath();
|
||||||
AndroidUtils.saveBitmap(screenshot, path, screenShotFileName);
|
Android.saveBitmap(screenshot, path, screenShotFileName);
|
||||||
Locator.getInstance().getNotifier().showMessage(R.string.cpp_plot_screenshot_saved, MessageType.info, path + "/" + screenShotFileName);
|
Locator.getInstance().getNotifier().showMessage(R.string.cpp_plot_screenshot_saved, MessageType.info, path + "/" + screenShotFileName);
|
||||||
} else {
|
} else {
|
||||||
Locator.getInstance().getNotifier().showMessage(R.string.cpp_plot_unable_to_save_screenshot, MessageType.error);
|
Locator.getInstance().getNotifier().showMessage(R.string.cpp_plot_unable_to_save_screenshot, MessageType.error);
|
||||||
|
@ -10,7 +10,7 @@ import org.solovyev.android.calculator.CalculatorListFragment;
|
|||||||
import org.solovyev.android.calculator.Locator;
|
import org.solovyev.android.calculator.Locator;
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.fragments.FragmentUtils;
|
import org.solovyev.android.fragments.FragmentUtils;
|
||||||
import org.solovyev.android.list.ListItemArrayAdapter;
|
import org.solovyev.android.list.ListItemAdapter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public class CalculatorPlotFunctionsActivity extends SherlockFragmentActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ListItemArrayAdapter.createAndAttach(getListView(), this.getActivity(), items);
|
ListItemAdapter.createAndAttach(this, items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ package org.solovyev.android.calculator.plot;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.VelocityTracker;
|
import android.view.VelocityTracker;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.AViews;
|
import org.solovyev.android.Views;
|
||||||
|
|
||||||
class TouchHandler {
|
class TouchHandler {
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class TouchHandler {
|
|||||||
float x = event.getX();
|
float x = event.getX();
|
||||||
float y = event.getY();
|
float y = event.getY();
|
||||||
|
|
||||||
int pointerCount = AViews.getPointerCountFromMotionEvent(event);
|
int pointerCount = Views.getPointerCountFromMotionEvent(event);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
@ -63,7 +63,7 @@ class TouchHandler {
|
|||||||
velocityTracker.addMovement(event);
|
velocityTracker.addMovement(event);
|
||||||
listener.onTouchMove(x, y);
|
listener.onTouchMove(x, y);
|
||||||
} else if (pointerCount == 2) {
|
} else if (pointerCount == 2) {
|
||||||
listener.onTouchZoomMove(x, y, AViews.getXFromMotionEvent(event, 1), AViews.getYFromMotionEvent(event, 1));
|
listener.onTouchZoomMove(x, y, Views.getXFromMotionEvent(event, 1), Views.getYFromMotionEvent(event, 1));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ class TouchHandler {
|
|||||||
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
if (pointerCount == 2) {
|
if (pointerCount == 2) {
|
||||||
listener.onTouchZoomDown(x, y, AViews.getXFromMotionEvent(event, 1), AViews.getYFromMotionEvent(event, 1));
|
listener.onTouchZoomDown(x, y, Views.getXFromMotionEvent(event, 1), Views.getYFromMotionEvent(event, 1));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import net.robotmedia.billing.ResponseCode;
|
|||||||
import net.robotmedia.billing.helper.AbstractBillingObserver;
|
import net.robotmedia.billing.helper.AbstractBillingObserver;
|
||||||
import net.robotmedia.billing.model.Transaction;
|
import net.robotmedia.billing.model.Transaction;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.AActivities;
|
import org.solovyev.android.Activities;
|
||||||
import org.solovyev.android.App;
|
import org.solovyev.android.App;
|
||||||
import org.solovyev.android.ads.AdsController;
|
import org.solovyev.android.ads.AdsController;
|
||||||
import org.solovyev.android.calculator.*;
|
import org.solovyev.android.calculator.*;
|
||||||
@ -156,7 +156,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
|
|||||||
case PURCHASED:
|
case PURCHASED:
|
||||||
adFreePreference.setEnabled(false);
|
adFreePreference.setEnabled(false);
|
||||||
// restart activity to disable ads
|
// restart activity to disable ads
|
||||||
AActivities.restartActivity(this);
|
Activities.restartActivity(this);
|
||||||
break;
|
break;
|
||||||
case CANCELLED:
|
case CANCELLED:
|
||||||
adFreePreference.setEnabled(true);
|
adFreePreference.setEnabled(true);
|
||||||
|
11
core/pom.xml
11
core/pom.xml
@ -22,6 +22,11 @@
|
|||||||
<artifactId>common-text</artifactId>
|
<artifactId>common-text</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.solovyev</groupId>
|
||||||
|
<artifactId>common-listeners</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
@ -57,6 +62,12 @@
|
|||||||
<artifactId>simple-xml</artifactId>
|
<artifactId>simple-xml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-cli</groupId>
|
||||||
|
<artifactId>commons-cli</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
168
core/src/main/java/org/solovyev/acraanalyzer/AcraAnalyzer.java
Normal file
168
core/src/main/java/org/solovyev/acraanalyzer/AcraAnalyzer.java
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
package org.solovyev.acraanalyzer;
|
||||||
|
|
||||||
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
import org.apache.commons.cli.*;
|
||||||
|
import org.solovyev.common.text.Strings;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.solovyev.common.collections.Collections.getFirstCollectionElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 6/12/13
|
||||||
|
* Time: 10:08 PM
|
||||||
|
*/
|
||||||
|
public final class AcraAnalyzer {
|
||||||
|
|
||||||
|
private static final String NEW_LINE = System.getProperty("line.separator");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws ParseException {
|
||||||
|
final Options options = new Options();
|
||||||
|
options.addOption("path", true, "Path to the ACRA reports");
|
||||||
|
|
||||||
|
final CommandLineParser parser = new GnuParser();
|
||||||
|
final CommandLine cmd = parser.parse(options, args);
|
||||||
|
final String path = cmd.getOptionValue("path");
|
||||||
|
if (Strings.isEmpty(path)) {
|
||||||
|
throw new IllegalArgumentException("Path should be specified");
|
||||||
|
} else {
|
||||||
|
final Multimap<String, AcraReport> reports = ArrayListMultimap.create(100, 20);
|
||||||
|
scanFiles(path, reports);
|
||||||
|
final List<Collection<AcraReport>> sortedReports = new ArrayList<Collection<AcraReport>>(reports.size());
|
||||||
|
for (String stackTrace : reports.keys()) {
|
||||||
|
sortedReports.add(reports.get(stackTrace));
|
||||||
|
}
|
||||||
|
Collections.sort(sortedReports, new Comparator<Collection<AcraReport>>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Collection<AcraReport> lhs, Collection<AcraReport> rhs) {
|
||||||
|
if (lhs.size() == rhs.size()) {
|
||||||
|
return 0;
|
||||||
|
} else if (lhs.size() < rhs.size()) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (Collection<AcraReport> sortedReport : sortedReports) {
|
||||||
|
final AcraReport report = getFirstCollectionElement(sortedReport);
|
||||||
|
System.out.println("Count: " + sortedReport.size());
|
||||||
|
System.out.println("App version: " + report.appVersion);
|
||||||
|
System.out.println("Stack trace: " + report.stackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void scanFiles(String path, Multimap<String, AcraReport> reports) {
|
||||||
|
final File directory = new File(path);
|
||||||
|
if (directory.isDirectory()) {
|
||||||
|
scanFiles(directory, reports);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void scanFiles(File directory, Multimap<String, AcraReport> reports) {
|
||||||
|
final File[] files = directory.listFiles();
|
||||||
|
if (files != null) {
|
||||||
|
for (File file : files) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
scanFiles(file, reports);
|
||||||
|
} else {
|
||||||
|
analyzeFile(file, reports);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void analyzeFile(File file, Multimap<String, AcraReport> reports) {
|
||||||
|
final AcraReport report = readReport(file);
|
||||||
|
if (!Strings.isEmpty(report.stackTrace)) {
|
||||||
|
reports.put(report.stackTrace, report);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AcraReport readReport(File file) {
|
||||||
|
final AcraReport result = new AcraReport();
|
||||||
|
|
||||||
|
Scanner scanner = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
scanner = new Scanner(file);
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
final String line = scanner.nextLine();
|
||||||
|
if (line.startsWith("STACK_TRACE")) {
|
||||||
|
result.stackTrace = readStackTrace(line.substring("STACK_TRACE=".length()), scanner);
|
||||||
|
break;
|
||||||
|
} else if (line.startsWith("ANDROID_VERSION")) {
|
||||||
|
result.androidVersion = line.substring("ANDROID_VERSION=".length());
|
||||||
|
} else if (line.startsWith("APP_VERSION_NAME")) {
|
||||||
|
result.appVersion = line.substring("APP_VERSION_NAME=".length());
|
||||||
|
} else if (line.startsWith("BRAND")) {
|
||||||
|
result.brand = line.substring("BRAND=".length());
|
||||||
|
} else if (line.startsWith("USER_COMMENT")) {
|
||||||
|
result.userComment = line.substring("USER_COMMENT=".length());
|
||||||
|
} else if (line.startsWith("PHONE_MODEL")) {
|
||||||
|
result.phoneModel = line.substring("PHONE_MODEL=".length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (scanner != null) {
|
||||||
|
scanner.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String readStackTrace(String firstLine, Scanner scanner) {
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(firstLine.trim()).append(newLine());
|
||||||
|
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
final String line = scanner.nextLine().trim();
|
||||||
|
if (line.startsWith("at")) {
|
||||||
|
sb.append(line).append(newLine());
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class AcraReport {
|
||||||
|
private String userComment;
|
||||||
|
private String phoneModel;
|
||||||
|
private String brand;
|
||||||
|
private String appVersion;
|
||||||
|
private String androidVersion;
|
||||||
|
private String stackTrace = "";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
AcraReport that = (AcraReport) o;
|
||||||
|
|
||||||
|
if (!stackTrace.equals(that.stackTrace)) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return stackTrace.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String newLine() {
|
||||||
|
return NEW_LINE;
|
||||||
|
}
|
||||||
|
}
|
20
pom.xml
20
pom.xml
@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<android.common.version>1.0.7-SNAPSHOT</android.common.version>
|
<android.common.version>1.1.1-SNAPSHOT</android.common.version>
|
||||||
<common.version>1.0.4-SNAPSHOT</common.version>
|
<common.version>1.0.4</common.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@ -79,6 +79,12 @@
|
|||||||
<version>${common.version}</version>
|
<version>${common.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.solovyev</groupId>
|
||||||
|
<artifactId>common-listeners</artifactId>
|
||||||
|
<version>${common.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-core</artifactId>
|
<artifactId>android-common-core</artifactId>
|
||||||
@ -209,6 +215,12 @@
|
|||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>11.0.2</version>
|
<version>11.0.2</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -237,7 +249,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.electriccloud</groupId>
|
<groupId>com.electriccloud</groupId>
|
||||||
<artifactId>javac2-maven-plugin</artifactId>
|
<artifactId>javac2-maven-plugin</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>@NotNull Instrumentation</id>
|
<id>@NotNull Instrumentation</id>
|
||||||
@ -295,7 +307,7 @@
|
|||||||
</sourceDirectories>
|
</sourceDirectories>
|
||||||
|
|
||||||
<sdk>
|
<sdk>
|
||||||
<platform>15</platform>
|
<platform>17</platform>
|
||||||
</sdk>
|
</sdk>
|
||||||
|
|
||||||
<emulator>
|
<emulator>
|
||||||
|
Loading…
Reference in New Issue
Block a user