version update

This commit is contained in:
Sergey Solovyev
2013-02-02 20:21:05 +04:00
parent cafa6b01ed
commit 8d84e24ca9
76 changed files with 282 additions and 874 deletions

View File

@@ -1,21 +1,5 @@
package org.solovyev.android;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.Log;
import android.view.MotionEvent;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* User: Solovyev_S
* Date: 03.10.12
@@ -23,95 +7,8 @@ import java.io.IOException;
*/
public final class AndroidUtils2 {
@NotNull
private static final boolean AT_LEAST_API_5 = Build.VERSION.SDK_INT >= 5;
private AndroidUtils2() {
throw new AssertionError();
}
public static void addFlags(@NotNull Intent intent, boolean detached, @NotNull Context context) {
int flags = 0;
if (!(context instanceof Activity)) {
flags = flags | Intent.FLAG_ACTIVITY_NEW_TASK;
}
if (detached) {
flags = flags | Intent.FLAG_ACTIVITY_NO_HISTORY;
}
intent.setFlags(flags);
}
public static void toggleComponent(@NotNull Context context,
@NotNull Class<? extends Context> componentClass,
boolean enable) {
final PackageManager pm = context.getPackageManager();
final int componentState;
if (enable) {
componentState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
} else {
componentState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
}
pm.setComponentEnabledSetting(new ComponentName(context, componentClass), componentState, PackageManager.DONT_KILL_APP);
}
public static boolean isComponentEnabled(@NotNull Context context,
@NotNull Class<? extends Context> componentClass) {
final PackageManager pm = context.getPackageManager();
int componentEnabledSetting = pm.getComponentEnabledSetting(new ComponentName(context, componentClass));
return componentEnabledSetting == PackageManager.COMPONENT_ENABLED_STATE_ENABLED || componentEnabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
}
public static String saveBitmap(@NotNull Bitmap bitmap,
@NotNull String path,
@NotNull String fileName) {
final File filePath = new File(path);
filePath.mkdirs();
final File file = new File(path, fileName);
if (!file.exists()) {
final String name = file.getAbsolutePath();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(name);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
} catch (FileNotFoundException e) {
Log.e("AndroidUtils", e.getMessage(), e);
} catch (IOException e) {
Log.e("AndroidUtils", e.getMessage(), e);
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
Log.e("AndroidUtils", e.getMessage(), e);
}
}
}
return name;
}
return null;
}
public static int getPointerCountFromMotionEvent(@NotNull MotionEvent event) {
return AT_LEAST_API_5 ? event.getPointerCount() : 1;
}
public static float getXFromMotionEvent(@NotNull MotionEvent event, int pointer) {
return AT_LEAST_API_5 ? event.getX(pointer) : 0;
}
public static float getYFromMotionEvent(@NotNull MotionEvent event, int pointer) {
return AT_LEAST_API_5 ? event.getY(pointer) : 0;
}
}

View File

@@ -1,69 +0,0 @@
package org.solovyev.android;
import android.app.Application;
import org.jetbrains.annotations.NotNull;
import org.solovyev.common.DelayedExecutor;
/**
* User: serso
* Date: 12/1/12
* Time: 3:58 PM
*/
public final class App {
/*
**********************************************************************
*
* STATIC
*
**********************************************************************
*/
@NotNull
public static final App instance = new App();
@NotNull
public static App getInstance() {
return instance;
}
/*
**********************************************************************
*
* FIELDS
*
**********************************************************************
*/
@NotNull
private volatile Application application;
@NotNull
private volatile DelayedExecutor uiThreadExecutor;
private volatile boolean initialized;
private App() {
}
public void init(@NotNull Application application) {
if (!initialized) {
this.application = application;
this.uiThreadExecutor = new UiThreadExecutor();
this.initialized = true;
}
}
@NotNull
public <A extends Application> A getApplication() {
return (A) application;
}
@NotNull
public DelayedExecutor getUiThreadExecutor() {
return uiThreadExecutor;
}
}

View File

@@ -1,34 +0,0 @@
package org.solovyev.android;
import android.os.Handler;
import org.jetbrains.annotations.NotNull;
import org.solovyev.common.DelayedExecutor;
import java.util.concurrent.TimeUnit;
/**
* User: serso
* Date: 12/1/12
* Time: 4:11 PM
*/
public class UiThreadExecutor implements DelayedExecutor {
@NotNull
private final Handler uiHandler;
public UiThreadExecutor() {
assert AndroidUtils.isUiThread() : "Must be called on UI thread!";
this.uiHandler = new Handler();
}
@Override
public void execute(@NotNull Runnable command, long delay, @NotNull TimeUnit delayUnit) {
this.uiHandler.postDelayed(command, delayUnit.toMillis(delay));
}
@Override
public void execute(@NotNull Runnable command) {
this.uiHandler.post(command);
}
}

View File

@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.text.TextProcessor;
import org.solovyev.android.calculator.view.TextHighlighter;
import org.solovyev.android.prefs.BooleanPreference;
import org.solovyev.common.collections.CollectionsUtils;
import org.solovyev.common.collections.Collections;
/**
* User: serso
@@ -33,7 +33,7 @@ import org.solovyev.common.collections.CollectionsUtils;
public class AndroidCalculatorEditorView extends EditText implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEditorView {
@NotNull
private static final BooleanPreference colorDisplay = new BooleanPreference("org.solovyev.android.calculator.CalculatorModel_color_display", true);
private static final BooleanPreference colorDisplay = BooleanPreference.of("org.solovyev.android.calculator.CalculatorModel_color_display", true);
private volatile boolean initialized = false;
@@ -74,7 +74,7 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe
// fix for missing cursor in android 3 and higher
try {
// IDEA: return false always except if method was called from TextView.isCursorVisible() method
for (StackTraceElement stackTraceElement : CollectionsUtils.asList(Thread.currentThread().getStackTrace())) {
for (StackTraceElement stackTraceElement : Collections.asList(Thread.currentThread().getStackTrace())) {
if ("isCursorVisible".equals(stackTraceElement.getMethodName())) {
return true;
}

View File

@@ -15,7 +15,7 @@ import jscl.AngleUnit;
import jscl.NumeralBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AndroidUtils;
import org.solovyev.android.AViews;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
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);
AndroidUtils.processViewsOfType(root, DragButton.class, new AndroidUtils.ViewProcessor<DragButton>() {
AViews.processViewsOfType(root, DragButton.class, new AViews.ViewProcessor<DragButton>() {
@Override
public void process(@NotNull DragButton button) {
button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
@@ -68,11 +68,11 @@ public final class CalculatorButtons {
@NotNull Activity activity) {
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
final boolean large = AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) &&
final boolean large = AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) &&
CalculatorPreferences.Gui.getLayout(preferences) != CalculatorPreferences.Gui.Layout.main_calculator_mobile;
if (!large) {
if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT
if (AViews.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT
|| !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
final DragButton equalsButton = (DragButton)activity.findViewById(R.id.cpp_button_equals);

View File

@@ -3,8 +3,8 @@ package org.solovyev.android.calculator;
import android.content.Context;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.menu.AMenuBuilder;
import org.solovyev.android.menu.MenuImpl;
import org.solovyev.android.menu.ContextMenuBuilder;
import org.solovyev.android.menu.ListContextMenu;
import java.util.ArrayList;
import java.util.List;
@@ -39,7 +39,7 @@ public class CalculatorDisplayOnClickListener implements View.OnClickListener {
}
if (!filteredMenuItems.isEmpty()) {
AMenuBuilder.newInstance(context, MenuImpl.newInstance(filteredMenuItems)).create(displayViewState).show();
ContextMenuBuilder.newInstance(context, ListContextMenu.newInstance(filteredMenuItems)).create(displayViewState).show();
}
} else {

View File

@@ -30,37 +30,37 @@ public final class CalculatorPreferences {
throw new AssertionError();
}
public static final Preference<Integer> appVersion = new IntegerPreference("application.version", -1);
public static final Preference<Integer> appOpenedCounter = new IntegerPreference("app_opened_counter", 0);
public static final Preference<Integer> appVersion = IntegerPreference.of("application.version", -1);
public static final Preference<Integer> appOpenedCounter = IntegerPreference.of("app_opened_counter", 0);
public static class OnscreenCalculator {
public static final Preference<Boolean> startOnBoot = new BooleanPreference("onscreen_start_on_boot", false);
public static final Preference<Boolean> showAppIcon = new BooleanPreference("onscreen_show_app_icon", true);
public static final Preference<Boolean> removeIconDialogShown = new BooleanPreference("onscreen_remove_icon_dialog_shown", false);
public static final Preference<Boolean> startOnBoot = BooleanPreference.of("onscreen_start_on_boot", false);
public static final Preference<Boolean> showAppIcon = BooleanPreference.of("onscreen_show_app_icon", true);
public static final Preference<Boolean> removeIconDialogShown = BooleanPreference.of("onscreen_remove_icon_dialog_shown", false);
}
public static class Calculations {
public static final Preference<Boolean> calculateOnFly = new BooleanPreference("calculations_calculate_on_fly", true);
public static final Preference<Boolean> showCalculationMessagesDialog = new BooleanPreference("show_calculation_messages_dialog", true);
public static final Preference<Boolean> calculateOnFly = BooleanPreference.of("calculations_calculate_on_fly", true);
public static final Preference<Boolean> showCalculationMessagesDialog = BooleanPreference.of("show_calculation_messages_dialog", true);
public static final Preference<NumeralBase> preferredNumeralBase = StringPreference.newInstance("preferred_numeral_base", AndroidCalculatorEngine.Preferences.numeralBase.getDefaultValue(), NumeralBase.class);
public static final Preference<AngleUnit> preferredAngleUnits = StringPreference.newInstance("preferred_angle_units", AndroidCalculatorEngine.Preferences.angleUnit.getDefaultValue(), AngleUnit.class);
public static final Preference<Long> lastPreferredPreferencesCheck = new LongPreference("preferred_preferences_check_time", 0L);
public static final Preference<NumeralBase> preferredNumeralBase = StringPreference.ofEnum("preferred_numeral_base", AndroidCalculatorEngine.Preferences.numeralBase.getDefaultValue(), NumeralBase.class);
public static final Preference<AngleUnit> preferredAngleUnits = StringPreference.ofEnum("preferred_angle_units", AndroidCalculatorEngine.Preferences.angleUnit.getDefaultValue(), AngleUnit.class);
public static final Preference<Long> lastPreferredPreferencesCheck = LongPreference.of("preferred_preferences_check_time", 0L);
}
public static class Gui {
public static final Preference<Theme> theme = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_theme", Theme.metro_blue_theme, Theme.class);
public static final Preference<Layout> layout = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_layout", Layout.main_calculator, Layout.class);
public static final Preference<Boolean> feedbackWindowShown = new BooleanPreference("feedback_window_shown", false);
public static final Preference<Boolean> notesppAnnounceShown = new BooleanPreference("notespp_announce_shown", false);
public static final Preference<Boolean> showReleaseNotes = new BooleanPreference("org.solovyev.android.calculator.CalculatorActivity_show_release_notes", true);
public static final Preference<Boolean> usePrevAsBack = new BooleanPreference("org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev", false);
public static final Preference<Boolean> showEqualsButton = new BooleanPreference("showEqualsButton", true);
public static final Preference<Boolean> autoOrientation = new BooleanPreference("autoOrientation", true);
public static final Preference<Boolean> hideNumeralBaseDigits = new BooleanPreference("hideNumeralBaseDigits", true);
public static final Preference<Theme> theme = StringPreference.ofEnum("org.solovyev.android.calculator.CalculatorActivity_calc_theme", Theme.metro_blue_theme, Theme.class);
public static final Preference<Layout> layout = StringPreference.ofEnum("org.solovyev.android.calculator.CalculatorActivity_calc_layout", Layout.main_calculator, Layout.class);
public static final Preference<Boolean> feedbackWindowShown = BooleanPreference.of("feedback_window_shown", false);
public static final Preference<Boolean> notesppAnnounceShown = BooleanPreference.of("notespp_announce_shown", false);
public static final Preference<Boolean> showReleaseNotes = BooleanPreference.of("org.solovyev.android.calculator.CalculatorActivity_show_release_notes", true);
public static final Preference<Boolean> usePrevAsBack = BooleanPreference.of("org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev", false);
public static final Preference<Boolean> showEqualsButton = BooleanPreference.of("showEqualsButton", true);
public static final Preference<Boolean> autoOrientation = BooleanPreference.of("autoOrientation", true);
public static final Preference<Boolean> hideNumeralBaseDigits = BooleanPreference.of("hideNumeralBaseDigits", true);
@NotNull
public static Theme getTheme(@NotNull SharedPreferences preferences) {
@@ -131,11 +131,11 @@ public final class CalculatorPreferences {
}
public static class Graph {
public static final Preference<Boolean> plotImag = new BooleanPreference("graph_plot_imag", false);
public static final Preference<Boolean> plotImag = BooleanPreference.of("graph_plot_imag", false);
}
public static class History {
public static final Preference<Boolean> showIntermediateCalculations = new BooleanPreference("history_show_intermediate_calculations", false);
public static final Preference<Boolean> showIntermediateCalculations = BooleanPreference.of("history_show_intermediate_calculations", false);
}
@@ -210,9 +210,7 @@ public final class CalculatorPreferences {
}
private static void applyDefaultPreference(@NotNull SharedPreferences preferences, @NotNull Preference<?> preference) {
if (!preference.isSet(preferences)) {
preference.putDefault(preferences);
}
preference.tryPutDefault(preferences);
}
}

View File

@@ -17,7 +17,7 @@ import com.actionbarsherlock.app.SherlockActivity;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.calculator.core.R;
import org.solovyev.common.msg.Message;
import org.solovyev.common.text.StringUtils;
import org.solovyev.common.text.Strings;
import java.util.ArrayList;
import java.util.Collections;
@@ -101,7 +101,7 @@ public class FixableMessagesDialog extends SherlockActivity {
fixButton.setOnClickListener(new FixErrorOnClickListener(messages, message));
final CharSequence fixCaption = fixableError.getFixCaption();
if (!StringUtils.isEmpty(fixCaption)) {
if (!Strings.isEmpty(fixCaption)) {
fixButton.setText(fixCaption);
}
}

View File

@@ -1,36 +0,0 @@
package org.solovyev.android.calculator;
import android.app.Activity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.AndroidUtils;
/**
* User: serso
* Date: 1/19/13
* Time: 5:04 PM
*/
public final class Threads {
private Threads() {
throw new AssertionError();
}
public static void tryRunOnUiThread(@Nullable final Activity activity, @NotNull final Runnable runnable) {
if (activity != null && !activity.isFinishing()) {
if (AndroidUtils.isUiThread()) {
runnable.run();
} else {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
// some time may pass and activity might be closing
if (!activity.isFinishing()) {
runnable.run();
}
}
});
}
}
}
}

View File

@@ -109,7 +109,7 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList
Locator.getInstance().getNotifier().showDebugMessage(TAG, "Editor state changed: " + newEditorState.getText());
onEditorStateChanged(App.getInstance().getApplication(), calculatorEventData, newEditorState);
onEditorStateChanged(App.getApplication(), calculatorEventData, newEditorState);
break;
case display_state_changed:
@@ -118,7 +118,7 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList
Locator.getInstance().getNotifier().showDebugMessage(TAG, "Display state changed: " + newDisplayState.getText());
onDisplayStateChanged(App.getInstance().getApplication(), calculatorEventData, newDisplayState);
onDisplayStateChanged(App.getApplication(), calculatorEventData, newDisplayState);
break;
}
}

View File

@@ -24,7 +24,7 @@ import org.solovyev.android.prefs.Preference;
import org.solovyev.android.prefs.StringPreference;
import org.solovyev.common.text.EnumMapper;
import org.solovyev.common.text.NumberMapper;
import org.solovyev.common.text.StringUtils;
import org.solovyev.common.text.Strings;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
@@ -63,14 +63,14 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen
private static final String ANGLE_UNITS_DEFAULT = "deg";
public static class Preferences {
public static final Preference<String> groupingSeparator = StringPreference.newInstance(GROUPING_SEPARATOR_P_KEY, JsclMathEngine.GROUPING_SEPARATOR_DEFAULT);
public static final Preference<String> multiplicationSign = StringPreference.newInstance(MULTIPLICATION_SIGN_P_KEY, MULTIPLICATION_SIGN_DEFAULT);
public static final Preference<Integer> precision = StringPreference.newInstance(RESULT_PRECISION_P_KEY, RESULT_PRECISION_DEFAULT, NumberMapper.getMapper(Integer.class));
public static final Preference<Boolean> roundResult = new BooleanPreference(ROUND_RESULT_P_KEY, ROUND_RESULT_DEFAULT);
public static final Preference<NumeralBase> numeralBase = StringPreference.newInstance(NUMERAL_BASES_P_KEY, NUMERAL_BASES_DEFAULT, EnumMapper.newInstance(NumeralBase.class));
public static final Preference<AngleUnit> angleUnit = StringPreference.newInstance(ANGLE_UNITS_P_KEY, ANGLE_UNITS_DEFAULT, EnumMapper.newInstance(AngleUnit.class));
public static final Preference<Boolean> scienceNotation = new BooleanPreference(SCIENCE_NOTATION_P_KEY, SCIENCE_NOTATION_DEFAULT);
public static final Preference<Integer> maxCalculationTime = StringPreference.newInstance(MAX_CALCULATION_TIME_P_KEY, MAX_CALCULATION_TIME_DEFAULT, NumberMapper.getMapper(Integer.class));
public static final Preference<String> groupingSeparator = StringPreference.of(GROUPING_SEPARATOR_P_KEY, JsclMathEngine.GROUPING_SEPARATOR_DEFAULT);
public static final Preference<String> multiplicationSign = StringPreference.of(MULTIPLICATION_SIGN_P_KEY, MULTIPLICATION_SIGN_DEFAULT);
public static final Preference<Integer> precision = StringPreference.ofTypedValue(RESULT_PRECISION_P_KEY, RESULT_PRECISION_DEFAULT, NumberMapper.of(Integer.class));
public static final Preference<Boolean> roundResult = BooleanPreference.of(ROUND_RESULT_P_KEY, ROUND_RESULT_DEFAULT);
public static final Preference<NumeralBase> numeralBase = StringPreference.ofTypedValue(NUMERAL_BASES_P_KEY, NUMERAL_BASES_DEFAULT, EnumMapper.of(NumeralBase.class));
public static final Preference<AngleUnit> angleUnit = StringPreference.ofTypedValue(ANGLE_UNITS_P_KEY, ANGLE_UNITS_DEFAULT, EnumMapper.of(AngleUnit.class));
public static final Preference<Boolean> scienceNotation = BooleanPreference.of(SCIENCE_NOTATION_P_KEY, SCIENCE_NOTATION_DEFAULT);
public static final Preference<Integer> maxCalculationTime = StringPreference.ofTypedValue(MAX_CALCULATION_TIME_P_KEY, MAX_CALCULATION_TIME_DEFAULT, NumberMapper.of(Integer.class));
private static final List<String> preferenceKeys = new ArrayList<String>();
@@ -246,7 +246,7 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen
this.setTimeout(Preferences.maxCalculationTime.getPreference(preferences));
final String groupingSeparator = Preferences.groupingSeparator.getPreference(preferences);
if (StringUtils.isEmpty(groupingSeparator)) {
if (Strings.isEmpty(groupingSeparator)) {
this.setUseGroupingSeparator(false);
} else {
this.setUseGroupingSeparator(true);

View File

@@ -89,7 +89,7 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
public String getDescription(@NotNull String descriptionId) {
final Resources resources = context.getResources();
final int stringId = resources.getIdentifier(descriptionId, "string", App.getInstance().getApplication().getClass().getPackage().getName());
final int stringId = resources.getIdentifier(descriptionId, "string", App.getApplication().getClass().getPackage().getName());
try {
return resources.getString(stringId);
} catch (Resources.NotFoundException e) {

View File

@@ -12,9 +12,9 @@ import org.solovyev.android.calculator.ToJsclTextProcessor;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.calculator.units.CalculatorNumeralBase;
import org.solovyev.common.MutableObject;
import org.solovyev.common.text.StringUtils;
import org.solovyev.math.units.Unit;
import org.solovyev.math.units.UnitImpl;
import org.solovyev.common.text.Strings;
import org.solovyev.common.units.Unit;
import org.solovyev.common.units.UnitImpl;
import java.util.Arrays;
@@ -28,7 +28,7 @@ public class NumeralBaseConverterDialog {
@Nullable
private String initialFromValue;
public NumeralBaseConverterDialog(String initialFromValue) {
public NumeralBaseConverterDialog(@Nullable String initialFromValue) {
this.initialFromValue = initialFromValue;
}
@@ -37,7 +37,7 @@ public class NumeralBaseConverterDialog {
b.setFromUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
b.setToUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
if (!StringUtils.isEmpty(initialFromValue)) {
if (!Strings.isEmpty(initialFromValue)) {
String value = initialFromValue;
try {
value = ToJsclTextProcessor.getInstance().process(value).getExpression();

View File

@@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.view.ViewBuilder;
import org.solovyev.android.view.ViewFromLayoutBuilder;
import org.solovyev.math.units.*;
import org.solovyev.common.units.*;
import java.util.Collections;
import java.util.List;
@@ -169,7 +169,7 @@ public class UnitConverterViewBuilder implements ViewBuilder<View> {
final String from = fromEditText.getText().toString();
try {
toEditText.setText(ConversionUtils.doConversion(converter, from, getFromUnitType(main), getToUnitType(main)));
toEditText.setText(Conversions.doConversion(converter, from, getFromUnitType(main), getToUnitType(main)));
} catch (ConversionException e) {
toEditText.setText(context.getString(R.string.c_error));
}