deps versions update

This commit is contained in:
Sergey Solovyev
2013-06-12 23:08:44 +04:00
parent 0b902355e0
commit a00a2ac684
31 changed files with 310 additions and 123 deletions

View File

@@ -80,7 +80,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
}
public void processButtons(@NotNull final Activity activity, @NotNull View root) {
dpclRegister.removeAll();
dpclRegister.removeListeners();
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
final SimpleOnDragListener.Preferences dragPreferences = SimpleOnDragListener.getPreferences(preferences, activity);

View File

@@ -5,7 +5,7 @@ import android.os.Handler;
import android.widget.Toast;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AThreads;
import org.solovyev.android.Threads;
import org.solovyev.android.msg.AndroidMessage;
import org.solovyev.common.msg.Message;
import org.solovyev.common.msg.MessageType;
@@ -32,7 +32,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
}
public AndroidCalculatorNotifier(@NotNull Application application, boolean showDebugMessages) {
assert AThreads.isUiThread();
assert Threads.isUiThread();
this.application = application;
this.showDebugMessages = showDebugMessages;
@@ -61,7 +61,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
}
private void showMessageInUiThread(@NotNull final String message) {
if (AThreads.isUiThread()) {
if (Threads.isUiThread()) {
Toast.makeText(application, message, Toast.LENGTH_SHORT).show();
} else {
uiHandler.post(new Runnable() {

View File

@@ -23,9 +23,9 @@ import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AActivities;
import org.solovyev.android.AThreads;
import org.solovyev.android.AndroidUtils;
import org.solovyev.android.Activities;
import org.solovyev.android.Android;
import org.solovyev.android.Threads;
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
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 int appVersion = AndroidUtils.getAppVersionCode(context, CalculatorActivity.class.getPackage().getName());
final int appVersion = Android.getAppVersionCode(context);
CalculatorPreferences.appVersion.putPreference(preferences, appVersion);
@@ -201,7 +201,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
final CalculatorPreferences.Gui.Layout newLayout = CalculatorPreferences.Gui.layout.getPreference(preferences);
if ( newLayout != activityHelper.getLayout() ) {
AActivities.restartActivity(this);
Activities.restartActivity(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) {
switch (calculatorEventType) {
case plot_graph:
AThreads.tryRunOnUiThread(this, new Runnable() {
@Override
public void run() {
if (isMultiPane()) {
final ActionBar.Tab selectedTab = getSupportActionBar().getSelectedTab();
if (selectedTab != null && CalculatorFragmentType.plotter.getFragmentTag().equals(selectedTab.getTag())) {
// do nothing - fragment shown and already registered for plot updates
} else {
// otherwise - open fragment
activityHelper.selectTab(CalculatorActivity.this, CalculatorFragmentType.plotter);
}
} else {
// start new activity
CalculatorActivityLauncher.plotGraph(CalculatorActivity.this);
}
}
});
Threads.tryRunOnUiThread(this, new Runnable() {
@Override
public void run() {
if (isMultiPane()) {
final ActionBar.Tab selectedTab = getSupportActionBar().getSelectedTab();
if (selectedTab != null && CalculatorFragmentType.plotter.getFragmentTag().equals(selectedTab.getTag())) {
// do nothing - fragment shown and already registered for plot updates
} else {
// otherwise - open fragment
activityHelper.selectTab(CalculatorActivity.this, CalculatorFragmentType.plotter);
}
} else {
// start new activity
CalculatorActivityLauncher.plotGraph(CalculatorActivity.this);
}
}
});
break;
}
}

View File

@@ -18,8 +18,8 @@ import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AActivities;
import org.solovyev.android.AViews;
import org.solovyev.android.Activities;
import org.solovyev.android.Views;
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
/**
@@ -113,7 +113,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
final ActionBar actionBar = activity.getSupportActionBar();
if (activity instanceof CalculatorActivity) {
if (AViews.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) {
if (Views.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) {
actionBar.setDisplayShowTitleEnabled(true);
} else {
actionBar.setDisplayShowTitleEnabled(false);
@@ -145,7 +145,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
final CalculatorPreferences.Gui.Theme newTheme = CalculatorPreferences.Gui.theme.getPreference(preferences);
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();
helpText.append("Size: ");
if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE, c)) {
if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE, c)) {
helpText.append("xlarge");
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, c)) {
} else if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, c)) {
helpText.append("large");
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL, c)) {
} else if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL, c)) {
helpText.append("normal");
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL, c)) {
} else if (Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL, c)) {
helpText.append("small");
} else {
helpText.append("unknown");

View File

@@ -14,7 +14,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AndroidUtils;
import org.solovyev.android.Android;
import org.solovyev.android.App;
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
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) {
final Intent intent = new Intent(context, CalculatorHistoryActivity.class);
AndroidUtils.addIntentFlags(intent, detached, context);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
@@ -60,7 +60,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
public static void showSettings(@NotNull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorPreferencesActivity.class);
AndroidUtils.addIntentFlags(intent, detached, context);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
@@ -74,7 +74,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
public static void showFunctions(@NotNull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorFunctionsActivity.class);
AndroidUtils.addIntentFlags(intent, detached, context);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
@@ -84,7 +84,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
public static void showOperators(@NotNull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorOperatorsActivity.class);
AndroidUtils.addIntentFlags(intent, detached, context);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
@@ -94,14 +94,14 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
public static void showVars(@NotNull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
AndroidUtils.addIntentFlags(intent, detached, context);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
public static void plotGraph(@NotNull final Context context){
final Intent intent = new Intent();
intent.setClass(context, CalculatorPlotActivity.class);
AndroidUtils.addIntentFlags(intent, false, context);
Android.addIntentFlags(intent, false, context);
context.startActivity(intent);
}
@@ -117,7 +117,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
} else {
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
intent.putExtra(CalculatorVarsFragment.CREATE_VAR_EXTRA_STRING, varValue);
AndroidUtils.addIntentFlags(intent, false, context);
Android.addIntentFlags(intent, false, context);
context.startActivity(intent);
}
} else {
@@ -184,7 +184,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
public static void likeButtonPressed(@NotNull final Context context) {
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);
}
@@ -213,7 +213,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
@Override
public void run() {
final Intent intent = new Intent(context, CalculatorMatrixActivity.class);
AndroidUtils.addIntentFlags(intent, false, context);
Android.addIntentFlags(intent, false, context);
context.startActivity(intent);
}
});

View File

@@ -13,8 +13,9 @@ import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.AndroidUtils;
import org.solovyev.android.Android;
import org.solovyev.android.App;
import org.solovyev.android.ServiceLocator;
import org.solovyev.android.ads.AdsController;
import org.solovyev.android.calculator.external.AndroidExternalListenersContainer;
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
@@ -40,7 +41,7 @@ import java.util.List;
resToastText = R.string.crashed,
resDialogTitle = R.string.crash_dialog_title,
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) {
if (CalculatorPreferences.OnscreenCalculator.showAppIcon.getKey().equals(key)) {
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);
}
}

View File

@@ -11,7 +11,7 @@ import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AndroidUtils;
import org.solovyev.android.Android;
import org.solovyev.android.fragments.FragmentUtils;
import org.solovyev.common.msg.MessageType;
import org.solovyev.common.text.Strings;
@@ -33,7 +33,7 @@ public class CalculatorDialogActivity extends SherlockFragmentActivity {
final Intent intent = new Intent();
intent.setClass(context, CalculatorDialogActivity.class);
intent.putExtra(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData));
AndroidUtils.addIntentFlags(intent, false, context);
Android.addIntentFlags(intent, false, context);
context.startActivity(intent);
}

View File

@@ -13,7 +13,7 @@ import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.TextView;
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.CalculatorFragment;
import org.solovyev.android.calculator.CalculatorFragmentType;
@@ -51,7 +51,7 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment {
final StringBuilder result = new StringBuilder();
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());

View File

@@ -8,6 +8,7 @@ package org.solovyev.android.calculator.history;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -22,7 +23,6 @@ import com.actionbarsherlock.view.MenuItem;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.android.menu.*;
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) {
final CalculatorHistoryState historyState = (CalculatorHistoryState) parent.getItemAtPosition(position);
final Context context = getActivity();
final FragmentActivity activity = getActivity();
final HistoryItemMenuData data = new HistoryItemMenuData(historyState, adapter);
@@ -160,8 +160,8 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
menuItems.remove(HistoryItemMenuItem.copy_result);
}
final ContextMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = ContextMenuBuilder.newInstance(context, ListContextMenu.newInstance(menuItems));
menuBuilder.create(data).show();
final ContextMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = ContextMenuBuilder.newInstance(activity, "history-menu", ListContextMenu.newInstance(menuItems));
menuBuilder.build(data).show();
return true;
}
@@ -220,7 +220,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
historyState.setSaved(true);
if ( Collections.contains(historyState, Locator.getInstance().getHistory().getSavedHistory(), new Equalizer<CalculatorHistoryState>() {
@Override
public boolean equals(@Nullable CalculatorHistoryState first, @Nullable CalculatorHistoryState second) {
public boolean areEqual(@Nullable CalculatorHistoryState first, @Nullable CalculatorHistoryState second) {
return first != null && second != null &&
first.getTime() == second.getTime() &&
first.getDisplayState().equals(second.getDisplayState()) &&

View File

@@ -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";
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);
if (!menuItems.isEmpty()) {
final ContextMenuBuilder<LabeledMenuItem<T>, T> menuBuilder = ContextMenuBuilder.newInstance(AbstractMathEntityListFragment.this.getActivity(), ListContextMenu.newInstance(menuItems));
menuBuilder.create(item).show();
final ContextMenuBuilder<LabeledMenuItem<T>, T> menuBuilder = ContextMenuBuilder.newInstance(AbstractMathEntityListFragment.this.getActivity(), "math-entity-menu", ListContextMenu.newInstance(menuItems));
menuBuilder.build(item).show();
}
return true;

View File

@@ -16,8 +16,8 @@ import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AThreads;
import org.solovyev.android.AndroidUtils;
import org.solovyev.android.Android;
import org.solovyev.android.Threads;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
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) {
AThreads.tryRunOnUiThread(activity, new Runnable() {
@Override
public void run() {
createChart(plotData);
Threads.tryRunOnUiThread(activity, new Runnable() {
@Override
public void run() {
createChart(plotData);
final View view = getView();
if (view != null) {
createGraphicalView(view, plotData);
}
final View view = getView();
if (view != null) {
createGraphicalView(view, plotData);
}
activity.invalidateOptionsMenu();
}
});
activity.invalidateOptionsMenu();
}
});
}
protected abstract void onError();
@@ -309,7 +309,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
final File externalFilesDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
if (externalFilesDir != null) {
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);
} else {
Locator.getInstance().getNotifier().showMessage(R.string.cpp_plot_unable_to_save_screenshot, MessageType.error);

View File

@@ -10,7 +10,7 @@ import org.solovyev.android.calculator.CalculatorListFragment;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.R;
import org.solovyev.android.fragments.FragmentUtils;
import org.solovyev.android.list.ListItemArrayAdapter;
import org.solovyev.android.list.ListItemAdapter;
import java.util.List;
@@ -48,7 +48,7 @@ public class CalculatorPlotFunctionsActivity extends SherlockFragmentActivity {
}
});
ListItemArrayAdapter.createAndAttach(getListView(), this.getActivity(), items);
ListItemAdapter.createAndAttach(this, items);
}
}
}

View File

@@ -5,7 +5,7 @@ package org.solovyev.android.calculator.plot;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.AViews;
import org.solovyev.android.Views;
class TouchHandler {
@@ -43,7 +43,7 @@ class TouchHandler {
float x = event.getX();
float y = event.getY();
int pointerCount = AViews.getPointerCountFromMotionEvent(event);
int pointerCount = Views.getPointerCountFromMotionEvent(event);
switch (action) {
case MotionEvent.ACTION_DOWN:
@@ -63,7 +63,7 @@ class TouchHandler {
velocityTracker.addMovement(event);
listener.onTouchMove(x, y);
} 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;
@@ -75,7 +75,7 @@ class TouchHandler {
case MotionEvent.ACTION_POINTER_DOWN:
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;

View File

@@ -21,7 +21,7 @@ import net.robotmedia.billing.ResponseCode;
import net.robotmedia.billing.helper.AbstractBillingObserver;
import net.robotmedia.billing.model.Transaction;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.AActivities;
import org.solovyev.android.Activities;
import org.solovyev.android.App;
import org.solovyev.android.ads.AdsController;
import org.solovyev.android.calculator.*;
@@ -156,7 +156,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
case PURCHASED:
adFreePreference.setEnabled(false);
// restart activity to disable ads
AActivities.restartActivity(this);
Activities.restartActivity(this);
break;
case CANCELLED:
adFreePreference.setEnabled(true);