Project restructure
We don't need to separate widget/onscreen from the main module, let's merge them together.
@ -6,7 +6,5 @@
|
||||
<file url="file://$PROJECT_DIR$/android-app-core/src/main/java/org/solovyev/android/calculator/ServiceLocator.java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/android-app-tests/build.gradle" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/android-app-tests/src/test/java/org/solovyev/android/CalculatorTestRunner.java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/android-app/src/main/java/android/preference/AdPreference.java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/android-app/src/main/res/layout/ad_pref.xml" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -11,11 +11,7 @@
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/android-app" />
|
||||
<option value="$PROJECT_DIR$/android-app-core" />
|
||||
<option value="$PROJECT_DIR$/android-app-core-tests" />
|
||||
<option value="$PROJECT_DIR$/android-app-onscreen" />
|
||||
<option value="$PROJECT_DIR$/android-app-tests" />
|
||||
<option value="$PROJECT_DIR$/android-app-widget" />
|
||||
<option value="$PROJECT_DIR$/core" />
|
||||
</set>
|
||||
</option>
|
||||
|
@ -3,11 +3,7 @@
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/android-app/android-app.iml" filepath="$PROJECT_DIR$/android-app/android-app.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android-app-core/android-app-core.iml" filepath="$PROJECT_DIR$/android-app-core/android-app-core.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android-app-core-tests/android-app-core-tests.iml" filepath="$PROJECT_DIR$/android-app-core-tests/android-app-core-tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android-app-onscreen/android-app-onscreen.iml" filepath="$PROJECT_DIR$/android-app-onscreen/android-app-onscreen.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android-app-tests/android-app-tests.iml" filepath="$PROJECT_DIR$/android-app-tests/android-app-tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android-app-widget/android-app-widget.iml" filepath="$PROJECT_DIR$/android-app-widget/android-app-widget.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/calculatorpp.iml" filepath="$PROJECT_DIR$/calculatorpp.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/core/core.iml" filepath="$PROJECT_DIR$/core/core.iml" />
|
||||
</modules>
|
||||
|
@ -1,110 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":android-app-core-tests" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="calculatorpp" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":android-app-core-tests" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/classes/main" />
|
||||
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="android-app" exported="" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="robolectric-2.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="mockito-all-1.9.5" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="jsonassert-1.2.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="objenesis-1.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="commons-logging-1.1.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="commons-codec-1.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="httpclient-4.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="support-v4-19.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="fest-util-1.2.5" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="fest-reflect-1.4.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="httpcore-4.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classworlds-1.1-alpha-2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="plexus-container-default-1.0-alpha-9-stable-1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="plexus-utils-1.5.15" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="plexus-interpolation-1.11" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-artifact-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-artifact-manager-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-model-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-project-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-error-diagnostics-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-settings-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-file-1.0-beta-6" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-lightweight-1.0-beta-6" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-provider-api-1.0-beta-6" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-repository-metadata-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="backport-util-concurrent-3.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-profile-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="maven-plugin-registry-2.2.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
dependencies {
|
||||
def androidModule = project(':android-app')
|
||||
compile androidModule
|
||||
|
||||
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.classpath
|
||||
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.outputs.files
|
||||
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
|
||||
|
||||
testCompile 'junit:junit:4.+'
|
||||
testCompile 'org.robolectric:robolectric:2.3'
|
||||
testCompile "org.mockito:mockito-all:1.9.5"
|
||||
testCompile "org.skyscreamer:jsonassert:1.2.3"
|
||||
}
|
||||
|
||||
tasks.withType(Test) {
|
||||
scanForTestClasses = false
|
||||
include "**/*Test.class"
|
||||
exclude "**/*AngleUnitsButtonTest*"
|
||||
exclude "**/*NumeralBasesButtonTest*"
|
||||
}
|
||||
|
||||
test {
|
||||
maxParallelForks = 15
|
||||
forkEvery = 1
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.content.Context;
|
||||
import jscl.JsclMathEngine;
|
||||
import org.mockito.Mockito;
|
||||
import org.solovyev.android.calculator.history.CalculatorHistory;
|
||||
import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 10/7/12
|
||||
* Time: 8:56 PM
|
||||
*/
|
||||
public class CalculatorTestUtils {
|
||||
|
||||
public static void staticSetUp(@Nullable Context context) throws Exception {
|
||||
Locator.getInstance().init(new CalculatorImpl(), newCalculatorEngine(), Mockito.mock(CalculatorClipboard.class), Mockito.mock(CalculatorNotifier.class), Mockito.mock(CalculatorHistory.class), new SystemOutCalculatorLogger(), Mockito.mock(CalculatorPreferenceService.class), Mockito.mock(CalculatorKeyboard.class), Mockito.mock(CalculatorPlotter.class), null);
|
||||
Locator.getInstance().getEngine().init();
|
||||
|
||||
if (context != null) {
|
||||
initViews(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initViews(@Nonnull Context context) {
|
||||
final AndroidCalculatorEditorView editor = new AndroidCalculatorEditorView(context);
|
||||
editor.init();
|
||||
Locator.getInstance().getEditor().setView(editor);
|
||||
|
||||
final AndroidCalculatorDisplayView display = new AndroidCalculatorDisplayView(context);
|
||||
display.init(context);
|
||||
Locator.getInstance().getDisplay().setView(display);
|
||||
}
|
||||
|
||||
public static void staticSetUp() throws Exception {
|
||||
staticSetUp(null);
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
static CalculatorEngineImpl newCalculatorEngine() {
|
||||
final MathEntityDao mathEntityDao = Mockito.mock(MathEntityDao.class);
|
||||
|
||||
final JsclMathEngine jsclEngine = JsclMathEngine.getInstance();
|
||||
|
||||
final CalculatorVarsRegistry varsRegistry = new CalculatorVarsRegistry(jsclEngine.getConstantsRegistry(), mathEntityDao);
|
||||
final CalculatorFunctionsMathRegistry functionsRegistry = new CalculatorFunctionsMathRegistry(jsclEngine.getFunctionsRegistry(), mathEntityDao);
|
||||
final CalculatorOperatorsMathRegistry operatorsRegistry = new CalculatorOperatorsMathRegistry(jsclEngine.getOperatorsRegistry(), mathEntityDao);
|
||||
final CalculatorPostfixFunctionsRegistry postfixFunctionsRegistry = new CalculatorPostfixFunctionsRegistry(jsclEngine.getPostfixFunctionsRegistry(), mathEntityDao);
|
||||
|
||||
return new CalculatorEngineImpl(jsclEngine, varsRegistry, functionsRegistry, operatorsRegistry, postfixFunctionsRegistry, null);
|
||||
}
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":android-app-core" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="org.solovyev.android" external.system.module.version="2.0.6" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":android-app-core" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
<option name="LIBRARY_PROJECT" value="true" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" />
|
||||
<orderEntry type="module" module-name="core" exported="" />
|
||||
</component>
|
||||
</module>
|
@ -1,150 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
|
||||
android {
|
||||
compileSdkVersion android_sdk_version()
|
||||
buildToolsVersion android_build_tools_version()
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion android_min_sdk_version()
|
||||
targetSdkVersion android_sdk_version()
|
||||
versionCode version_code()
|
||||
versionName version_name()
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':core')
|
||||
compile 'org.solovyev:common-core:1.0.7'
|
||||
compile 'org.solovyev:common-text:1.0.7'
|
||||
compile 'org.solovyev:common-security:1.0.7'
|
||||
compile 'org.solovyev.android:android-common-views:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||
compile('org.solovyev:jscl:1.0.8') {
|
||||
exclude(module: 'xercesImpl')
|
||||
}
|
||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||
compile 'com.android.support:support-v4:21.0.3'
|
||||
compile 'org.solovyev.android:checkout:0.6.0@aar'
|
||||
compile 'com.google.android.gms:play-services:6.5.87@aar'
|
||||
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
||||
}
|
||||
|
||||
|
||||
task androidJavadocs(type: Javadoc) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
classpath += project.files(android.plugin.getBootClasspath().join(File.pathSeparator))
|
||||
configurations.compile.each { File file -> classpath += project.files(file.path) }
|
||||
}
|
||||
|
||||
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
|
||||
classifier = 'javadoc'
|
||||
from androidJavadocs.destinationDir
|
||||
}
|
||||
|
||||
task androidSourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
|
||||
task apklib(type: Zip) {
|
||||
appendix = extension = 'apklib'
|
||||
|
||||
from 'src/main/AndroidManifest.xml'
|
||||
into('res') {
|
||||
from android.sourceSets.main.res.srcDirs
|
||||
}
|
||||
into('src') {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
into('src') {
|
||||
from android.sourceSets.main.aidl.srcDirs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
artifacts {
|
||||
archives androidSourcesJar
|
||||
archives androidJavadocsJar
|
||||
archives apklib
|
||||
}
|
||||
|
||||
signing {
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
group = "org.solovyev.android"
|
||||
archivesBaseName = "calculatorpp-android-app-core"
|
||||
version = version_name()
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
|
||||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
|
||||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
|
||||
pom.project {
|
||||
name 'Calculator++ Application Core'
|
||||
packaging 'aar'
|
||||
url 'https://github.com/serso/android-calculatorpp'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/serso/android-calculatorpp'
|
||||
connection 'scm:https://serso@github.com/serso/android-calculatorpp.git'
|
||||
developerConnection 'scm:git://github.com/serso/android-calculatorpp.git'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache Software License, Version 2.0'
|
||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'se.solovyev'
|
||||
name 'Sergey Solovyev'
|
||||
email 'se.solovyev@gmail.com'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.solovyev.android.calculator.core"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="4"
|
||||
android:targetSdkVersion="17"/>
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
</manifest>
|
@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2013 serso aka se.solovyev
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Contact details
|
||||
~
|
||||
~ Email: se.solovyev@gmail.com
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!--
|
||||
monochrome,
|
||||
dashed,
|
||||
dotted,
|
||||
dash_dotted;
|
||||
-->
|
||||
<string-array name="cpp_plot_line_style_names">
|
||||
<item>@string/cpp_solid_line_style</item>
|
||||
<item>@string/cpp_dashed_line_style</item>
|
||||
<item>@string/cpp_dotted_line_style</item>
|
||||
<item>@string/cpp_dash_dotted_line_style</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="cpp_plot_line_color_type_names">
|
||||
<item>@string/cpp_monochrome_line_color_type</item>
|
||||
<item>@string/cpp_color_map_line_color_type</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="cpp_plot_line_color_names">
|
||||
<item>@string/p_white_line_color</item>
|
||||
<item>@string/p_blue_line_color</item>
|
||||
<item>@string/p_red_line_color</item>
|
||||
<item>@string/p_green_line_color</item>
|
||||
<item>@string/p_grey_line_color</item>
|
||||
</string-array>
|
||||
<string-array name="cpp_plot_line_color_values">
|
||||
<item>white</item>
|
||||
<item>blue</item>
|
||||
<item>red</item>
|
||||
<item>green</item>
|
||||
<item>grey</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -1,108 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":android-app-onscreen" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="org.solovyev.android" external.system.module.version="2.0.6" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":android-app-onscreen" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
<option name="LIBRARY_PROJECT" value="true" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" />
|
||||
<orderEntry type="module" module-name="android-app-core" exported="" />
|
||||
<orderEntry type="module" module-name="core" exported="" />
|
||||
</component>
|
||||
</module>
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
|
||||
android {
|
||||
compileSdkVersion android_sdk_version()
|
||||
buildToolsVersion android_build_tools_version()
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion android_min_sdk_version()
|
||||
targetSdkVersion android_sdk_version()
|
||||
versionCode version_code()
|
||||
versionName version_name()
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':core')
|
||||
compile project(':android-app-core')
|
||||
compile 'org.solovyev:common-core:1.0.7'
|
||||
compile 'org.solovyev:common-text:1.0.7'
|
||||
compile 'org.solovyev.android:android-common-views:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||
compile('org.solovyev:jscl:1.0.8') {
|
||||
exclude(module: 'xercesImpl')
|
||||
}
|
||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||
compile 'com.android.support:support-v4:21.0.3'
|
||||
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
||||
}
|
||||
|
||||
|
||||
task androidJavadocs(type: Javadoc) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
classpath += project.files(android.plugin.getBootClasspath().join(File.pathSeparator))
|
||||
configurations.compile.each { File file -> classpath += project.files(file.path) }
|
||||
}
|
||||
|
||||
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
|
||||
classifier = 'javadoc'
|
||||
from androidJavadocs.destinationDir
|
||||
}
|
||||
|
||||
task androidSourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
|
||||
task apklib(type: Zip) {
|
||||
appendix = extension = 'apklib'
|
||||
|
||||
from 'src/main/AndroidManifest.xml'
|
||||
into('res') {
|
||||
from android.sourceSets.main.res.srcDirs
|
||||
}
|
||||
into('src') {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
into('src') {
|
||||
from android.sourceSets.main.aidl.srcDirs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
artifacts {
|
||||
archives androidSourcesJar
|
||||
archives androidJavadocsJar
|
||||
archives apklib
|
||||
}
|
||||
|
||||
signing {
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
group = "org.solovyev.android"
|
||||
archivesBaseName = "calculatorpp-android-app-onscreen"
|
||||
version = version_name()
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
|
||||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
|
||||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
|
||||
pom.project {
|
||||
name 'Calculator++ Application Onscreen'
|
||||
packaging 'aar'
|
||||
url 'https://github.com/serso/android-calculatorpp'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/serso/android-calculatorpp'
|
||||
connection 'scm:https://serso@github.com/serso/android-calculatorpp.git'
|
||||
developerConnection 'scm:git://github.com/serso/android-calculatorpp.git'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache Software License, Version 2.0'
|
||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'se.solovyev'
|
||||
name 'Sergey Solovyev'
|
||||
email 'se.solovyev@gmail.com'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-parent</artifactId>
|
||||
<version>2.0.7-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-android-app-onscreen</artifactId>
|
||||
<version>2.0.7-SNAPSHOT</version>
|
||||
<name>Calculator++ Application Onscreen</name>
|
||||
<packaging>apklib</packaging>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-android-app-core</artifactId>
|
||||
<type>apklib</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>support-v4</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>com.simpligility.maven.plugins</groupId>
|
||||
<artifactId>android-maven-plugin</artifactId>
|
||||
</extension>
|
||||
</extensions>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.solovyev.android.calculator.onscreen"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="4"
|
||||
android:targetSdkVersion="17"/>
|
||||
|
||||
</manifest>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="cpp_onscreen_cursor_color">#ff707070</color>
|
||||
</resources>
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="cpp_onscreen_main_layout_style" parent="cpp_default_main_layout_style">
|
||||
<item name="android:background">@color/cpp_default_background</item>
|
||||
<item name="android:padding">1dp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -71,40 +71,36 @@
|
||||
<orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_preferences_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="simple-xml-2.6.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_core_build_libs_core_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="commons-cli-1.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="annotations-2.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="core" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="internal_impl-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_views_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_lists_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="stax-1.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_other_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_menus_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_android_support_support_v4_21_0_3_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-msg-1.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_db_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-listeners-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="guava-11.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-text-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="acra-4.5.0" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_wizard_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_checkout_0_6_0_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_core_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_google_android_gms_play_services_6_5_87_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-core-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="jscl-1.0.8" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_security_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="common-security-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="classes" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_com_actionbarsherlock_actionbarsherlock_4_4_0_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_exploded_aar_org_solovyev_android_android_common_sherlock_1_1_18_classes_jar" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_classes_debug" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="_home_serso_projects_java_serso_android_calculatorpp_android_app_build_intermediates_dependency_cache_debug" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -44,6 +44,8 @@ tasks.withType(Test) {
|
||||
exclude "**/*OnScreenCalculatorWizardStepTest*"
|
||||
exclude "**/*CalculatorWizardTest*"
|
||||
exclude "**/*WizardStepTest*"
|
||||
exclude "**/*AngleUnitsButtonTest*"
|
||||
exclude "**/*NumeralBasesButtonTest*"
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -1,108 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":android-app-widget" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="org.solovyev.android" external.system.module.version="2.0.6" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":android-app-widget" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
<option name="LIBRARY_PROJECT" value="true" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" />
|
||||
<orderEntry type="module" module-name="android-app-core" exported="" />
|
||||
<orderEntry type="module" module-name="core" exported="" />
|
||||
</component>
|
||||
</module>
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
|
||||
android {
|
||||
compileSdkVersion android_sdk_version()
|
||||
buildToolsVersion android_build_tools_version()
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion android_min_sdk_version()
|
||||
targetSdkVersion android_sdk_version()
|
||||
versionCode version_code()
|
||||
versionName version_name()
|
||||
}
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':core')
|
||||
compile project(':android-app-core')
|
||||
compile 'org.solovyev:common-core:1.0.7'
|
||||
compile 'org.solovyev:common-text:1.0.7'
|
||||
compile 'org.solovyev.android:android-common-views:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-core:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||
compile('org.solovyev:jscl:1.0.8') {
|
||||
exclude(module: 'xercesImpl')
|
||||
}
|
||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||
compile 'com.android.support:support-v4:21.0.3'
|
||||
//testCompile group: 'org.robolectric', name: 'robolectric', version: '2.1.1'
|
||||
}
|
||||
|
||||
|
||||
task androidJavadocs(type: Javadoc) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
classpath += project.files(android.plugin.getBootClasspath().join(File.pathSeparator))
|
||||
configurations.compile.each { File file -> classpath += project.files(file.path) }
|
||||
}
|
||||
|
||||
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
|
||||
classifier = 'javadoc'
|
||||
from androidJavadocs.destinationDir
|
||||
}
|
||||
|
||||
task androidSourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
|
||||
task apklib(type: Zip) {
|
||||
appendix = extension = 'apklib'
|
||||
|
||||
from 'src/main/AndroidManifest.xml'
|
||||
into('res') {
|
||||
from android.sourceSets.main.res.srcDirs
|
||||
}
|
||||
into('src') {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
into('src') {
|
||||
from android.sourceSets.main.aidl.srcDirs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
artifacts {
|
||||
archives androidSourcesJar
|
||||
archives androidJavadocsJar
|
||||
archives apklib
|
||||
}
|
||||
|
||||
signing {
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
group = "org.solovyev.android"
|
||||
archivesBaseName = "calculatorpp-android-app-widget"
|
||||
version = version_name()
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
|
||||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
|
||||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
|
||||
pom.project {
|
||||
name 'Calculator++ Application Widget'
|
||||
packaging 'aar'
|
||||
url 'https://github.com/serso/android-calculatorpp'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/serso/android-calculatorpp'
|
||||
connection 'scm:https://serso@github.com/serso/android-calculatorpp.git'
|
||||
developerConnection 'scm:git://github.com/serso/android-calculatorpp.git'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'The Apache Software License, Version 2.0'
|
||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'se.solovyev'
|
||||
name 'Sergey Solovyev'
|
||||
email 'se.solovyev@gmail.com'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.solovyev.android.calculator.widget"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="4"
|
||||
android:targetSdkVersion="17"/>
|
||||
|
||||
</manifest>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="cpp_widget_cursor_color">#ff707070</color>
|
||||
</resources>
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="cpp_widget_editor_text_size_collapsed">16sp</dimen>
|
||||
<dimen name="cpp_widget_editor_text_size">25sp</dimen>
|
||||
<dimen name="cpp_widget_display_text_size_collapsed">16sp</dimen>
|
||||
<dimen name="cpp_widget_display_text_size">25sp</dimen>
|
||||
<dimen name="cpp_widget_margin">6dp</dimen>
|
||||
<dimen name="min_expanded_height_lock_screen">300dp</dimen>
|
||||
</resources>
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="cpp_widget_main_layout_style" parent="cpp_default_main_layout_style">
|
||||
<item name="android:background">@color/cpp_default_background</item>
|
||||
<item name="android:padding">1dp</item>
|
||||
<item name="android:layout_margin">@dimen/cpp_widget_margin</item>
|
||||
</style>
|
||||
|
||||
<style name="cpp_widget_editor_style" parent="cpp_editor_style">
|
||||
<item name="android:textSize">@dimen/cpp_widget_editor_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="cpp_widget_display_style" parent="cpp_display_style">
|
||||
<item name="android:textSize">@dimen/cpp_widget_display_text_size</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":android-app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="org.solovyev.android" external.system.module.version="2.0.6" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id=":android-app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="org.solovyev.android" external.system.module.version="2.1.0" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
@ -79,35 +79,36 @@
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Maven Android API 17 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="android-common-db-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-db-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-security-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="actionbarsherlock-4.4.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="annotations-2.0.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-wizard-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-security-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-core-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-wizard-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-listeners-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-text-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="jscl-1.0.8" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-views-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="stax-1.2.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-menus-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-security-1.0.7" level="project" />
|
||||
<orderEntry type="library" exported="" name="checkout-0.6.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-core-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="common-msg-1.0.5" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-other-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-preferences-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-lists-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="guava-11.0.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-common-sherlock-1.1.18" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-cli-1.2" level="project" />
|
||||
<orderEntry type="library" exported="" name="simple-xml-2.6.1" level="project" />
|
||||
<orderEntry type="module" module-name="android-app-core" exported="" />
|
||||
<orderEntry type="module" module-name="android-app-onscreen" exported="" />
|
||||
<orderEntry type="module" module-name="core" exported="" />
|
||||
<orderEntry type="module" module-name="android-app-widget" exported="" />
|
||||
</component>
|
||||
</module>
|
@ -47,6 +47,10 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile project(':core')
|
||||
compile 'org.solovyev:common-core:1.0.7'
|
||||
compile 'org.solovyev:common-text:1.0.7'
|
||||
compile 'org.solovyev:common-security:1.0.7'
|
||||
compile 'com.android.support:support-v4:21.0.3'
|
||||
compile ('ch.acra:acra:4.5.0') {
|
||||
exclude group: 'org.json'
|
||||
@ -58,11 +62,16 @@ dependencies {
|
||||
compile 'org.solovyev.android:android-common-other:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-db:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-security:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-views:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-menus:1.1.18@aar'
|
||||
compile 'org.solovyev.android:android-common-preferences:1.1.18@aar'
|
||||
compile('org.solovyev:jscl:1.0.8') {
|
||||
exclude(module: 'xercesImpl')
|
||||
}
|
||||
compile 'org.solovyev.android:checkout:0.6.0@aar'
|
||||
compile project(':android-app-core')
|
||||
compile project(':android-app-widget')
|
||||
compile project(':android-app-onscreen')
|
||||
compile project(':core')
|
||||
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
|
||||
compile 'com.google.android.gms:play-services:6.5.87@aar'
|
||||
|
||||
}
|
||||
|
||||
task androidJavadocs(type: Javadoc) {
|
||||
|
@ -31,16 +31,13 @@ import android.support.v4.app.FragmentActivity;
|
||||
import android.text.Html;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.text.TextProcessor;
|
||||
import org.solovyev.android.calculator.view.TextHighlighter;
|
||||
import org.solovyev.android.calculator.text.TextProcessorEditorResult;
|
||||
import org.solovyev.android.calculator.view.TextHighlighter;
|
||||
import org.solovyev.android.view.AutoResizeTextView;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
@ -215,6 +215,9 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
||||
Locator.getInstance().getNotifier().showDebugMessage(TAG, "Application started!");
|
||||
|
||||
typeFace = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf");
|
||||
|
||||
// we must update the widget when app starts
|
||||
App.getBroadcaster().sendEditorStateChangedIntent();
|
||||
}
|
||||
|
||||
private void setTheme(@Nonnull SharedPreferences preferences) {
|
||||
|
@ -27,7 +27,7 @@ import android.content.Context;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
@ -37,7 +37,7 @@ import jscl.AngleUnit;
|
||||
import jscl.NumeralBase;
|
||||
|
||||
import org.solovyev.android.Views;
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||
import org.solovyev.android.calculator.view.AngleUnitsButton;
|
||||
import org.solovyev.android.calculator.view.NumeralBasesButton;
|
@ -27,7 +27,7 @@ import jscl.math.Generic;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||
import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
||||
import org.solovyev.android.calculator.view.NumeralBaseConverterDialog;
|
@ -1,77 +1,77 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.View;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.menu.ContextMenuBuilder;
|
||||
import org.solovyev.android.menu.ListContextMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 21.09.12
|
||||
* Time: 10:58
|
||||
*/
|
||||
public class CalculatorDisplayOnClickListener implements View.OnClickListener {
|
||||
|
||||
@Nonnull
|
||||
private final FragmentActivity activity;
|
||||
|
||||
public CalculatorDisplayOnClickListener(@Nonnull FragmentActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v instanceof CalculatorDisplayView) {
|
||||
final CalculatorDisplay cd = Locator.getInstance().getDisplay();
|
||||
|
||||
final CalculatorDisplayViewState displayViewState = cd.getViewState();
|
||||
|
||||
if (displayViewState.isValid()) {
|
||||
final List<CalculatorDisplayMenuItem> filteredMenuItems = new ArrayList<CalculatorDisplayMenuItem>(CalculatorDisplayMenuItem.values().length);
|
||||
for (CalculatorDisplayMenuItem menuItem : CalculatorDisplayMenuItem.values()) {
|
||||
if (menuItem.isItemVisible(displayViewState)) {
|
||||
filteredMenuItems.add(menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (!filteredMenuItems.isEmpty()) {
|
||||
ContextMenuBuilder.newInstance(activity, "display-menu", ListContextMenu.newInstance(filteredMenuItems)).build(displayViewState).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
final String errorMessage = displayViewState.getErrorMessage();
|
||||
if (errorMessage != null) {
|
||||
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_evaluation_error, errorMessage, activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.View;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.menu.ContextMenuBuilder;
|
||||
import org.solovyev.android.menu.ListContextMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 21.09.12
|
||||
* Time: 10:58
|
||||
*/
|
||||
public class CalculatorDisplayOnClickListener implements View.OnClickListener {
|
||||
|
||||
@Nonnull
|
||||
private final FragmentActivity activity;
|
||||
|
||||
public CalculatorDisplayOnClickListener(@Nonnull FragmentActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v instanceof CalculatorDisplayView) {
|
||||
final CalculatorDisplay cd = Locator.getInstance().getDisplay();
|
||||
|
||||
final CalculatorDisplayViewState displayViewState = cd.getViewState();
|
||||
|
||||
if (displayViewState.isValid()) {
|
||||
final List<CalculatorDisplayMenuItem> filteredMenuItems = new ArrayList<CalculatorDisplayMenuItem>(CalculatorDisplayMenuItem.values().length);
|
||||
for (CalculatorDisplayMenuItem menuItem : CalculatorDisplayMenuItem.values()) {
|
||||
if (menuItem.isItemVisible(displayViewState)) {
|
||||
filteredMenuItems.add(menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (!filteredMenuItems.isEmpty()) {
|
||||
ContextMenuBuilder.newInstance(activity, "display-menu", ListContextMenu.newInstance(filteredMenuItems)).build(displayViewState).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
final String errorMessage = displayViewState.getErrorMessage();
|
||||
if (errorMessage != null) {
|
||||
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_evaluation_error, errorMessage, activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ import android.content.SharedPreferences;
|
||||
import jscl.AngleUnit;
|
||||
import jscl.NumeralBase;
|
||||
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.calculator.math.MathType;
|
||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||
import org.solovyev.android.prefs.*;
|
@ -22,8 +22,6 @@ public final class CalculatorReceiver extends BroadcastReceiver {
|
||||
if (button != null) {
|
||||
button.onClick(context);
|
||||
}
|
||||
|
||||
App.getBroadcaster().sendEditorStateChangedIntent();
|
||||
}
|
||||
}
|
||||
|
@ -1,76 +1,76 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.content.Context;
|
||||
import jscl.NumeralBase;
|
||||
import jscl.math.Generic;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 9/21/12
|
||||
* Time: 12:11 AM
|
||||
*/
|
||||
enum ConversionMenuItem implements AMenuItem<CalculatorDisplayViewState> {
|
||||
|
||||
convert_to_bin(NumeralBase.bin),
|
||||
convert_to_dec(NumeralBase.dec),
|
||||
convert_to_hex(NumeralBase.hex);
|
||||
|
||||
@Nonnull
|
||||
private final NumeralBase toNumeralBase;
|
||||
|
||||
ConversionMenuItem(@Nonnull NumeralBase toNumeralBase) {
|
||||
this.toNumeralBase = toNumeralBase;
|
||||
}
|
||||
|
||||
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
|
||||
boolean result = false;
|
||||
|
||||
if (operation == JsclOperation.numeric) {
|
||||
if (generic.getConstants().isEmpty()) {
|
||||
// conversion possible => return true
|
||||
final NumeralBase fromNumeralBase = Locator.getInstance().getEngine().getNumeralBase();
|
||||
if (fromNumeralBase != toNumeralBase) {
|
||||
result = Locator.getInstance().getCalculator().isConversionPossible(generic, fromNumeralBase, this.toNumeralBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
|
||||
final Generic result = data.getResult();
|
||||
|
||||
if (result != null) {
|
||||
Locator.getInstance().getCalculator().convert(result, this.toNumeralBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.content.Context;
|
||||
import jscl.NumeralBase;
|
||||
import jscl.math.Generic;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 9/21/12
|
||||
* Time: 12:11 AM
|
||||
*/
|
||||
enum ConversionMenuItem implements AMenuItem<CalculatorDisplayViewState> {
|
||||
|
||||
convert_to_bin(NumeralBase.bin),
|
||||
convert_to_dec(NumeralBase.dec),
|
||||
convert_to_hex(NumeralBase.hex);
|
||||
|
||||
@Nonnull
|
||||
private final NumeralBase toNumeralBase;
|
||||
|
||||
ConversionMenuItem(@Nonnull NumeralBase toNumeralBase) {
|
||||
this.toNumeralBase = toNumeralBase;
|
||||
}
|
||||
|
||||
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
|
||||
boolean result = false;
|
||||
|
||||
if (operation == JsclOperation.numeric) {
|
||||
if (generic.getConstants().isEmpty()) {
|
||||
// conversion possible => return true
|
||||
final NumeralBase fromNumeralBase = Locator.getInstance().getEngine().getNumeralBase();
|
||||
if (fromNumeralBase != toNumeralBase) {
|
||||
result = Locator.getInstance().getCalculator().isConversionPossible(generic, fromNumeralBase, this.toNumeralBase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
|
||||
final Generic result = data.getResult();
|
||||
|
||||
if (result != null) {
|
||||
Locator.getInstance().getCalculator().convert(result, this.toNumeralBase);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,56 +1,56 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.view.drag.DirectionDragButton;
|
||||
import org.solovyev.android.view.drag.DragButton;
|
||||
import org.solovyev.android.view.drag.DragDirection;
|
||||
import org.solovyev.android.view.drag.SimpleOnDragListener;
|
||||
import org.solovyev.common.math.Point2d;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 9/16/11
|
||||
* Time: 11:48 PM
|
||||
*/
|
||||
public class DigitButtonDragProcessor implements SimpleOnDragListener.DragProcessor {
|
||||
|
||||
@Nonnull
|
||||
private CalculatorKeyboard calculatorKeyboard;
|
||||
|
||||
public DigitButtonDragProcessor(@Nonnull CalculatorKeyboard calculatorKeyboard) {
|
||||
this.calculatorKeyboard = calculatorKeyboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
|
||||
assert dragButton instanceof DirectionDragButton;
|
||||
calculatorKeyboard.buttonPressed(((DirectionDragButton) dragButton).getText(dragDirection));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.view.drag.DirectionDragButton;
|
||||
import org.solovyev.android.view.drag.DragButton;
|
||||
import org.solovyev.android.view.drag.DragDirection;
|
||||
import org.solovyev.android.view.drag.SimpleOnDragListener;
|
||||
import org.solovyev.common.math.Point2d;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 9/16/11
|
||||
* Time: 11:48 PM
|
||||
*/
|
||||
public class DigitButtonDragProcessor implements SimpleOnDragListener.DragProcessor {
|
||||
|
||||
@Nonnull
|
||||
private CalculatorKeyboard calculatorKeyboard;
|
||||
|
||||
public DigitButtonDragProcessor(@Nonnull CalculatorKeyboard calculatorKeyboard) {
|
||||
this.calculatorKeyboard = calculatorKeyboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
|
||||
assert dragButton instanceof DirectionDragButton;
|
||||
calculatorKeyboard.buttonPressed(((DirectionDragButton) dragButton).getText(dragDirection));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -40,7 +40,7 @@ import com.actionbarsherlock.app.SherlockActivity;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.common.msg.Message;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
@ -37,7 +37,7 @@ import jscl.math.operator.Operator;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.*;
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.prefs.BooleanPreference;
|
||||
import org.solovyev.android.prefs.Preference;
|
||||
import org.solovyev.android.prefs.StringPreference;
|
@ -1,121 +1,121 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.preference.PreferenceManager;
|
||||
import org.simpleframework.xml.Serializer;
|
||||
import org.simpleframework.xml.core.Persister;
|
||||
import org.solovyev.android.calculator.App;
|
||||
import org.solovyev.android.calculator.MathEntityDao;
|
||||
import org.solovyev.android.calculator.MathEntityPersistenceContainer;
|
||||
import org.solovyev.android.calculator.MathPersistenceEntity;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 10/7/12
|
||||
* Time: 6:46 PM
|
||||
*/
|
||||
public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements MathEntityDao<T> {
|
||||
|
||||
@Nonnull
|
||||
private static final String TAG = AndroidMathEntityDao.class.getSimpleName();
|
||||
|
||||
@Nullable
|
||||
private final String preferenceString;
|
||||
|
||||
@Nonnull
|
||||
private final Context context;
|
||||
|
||||
@Nullable
|
||||
private final Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass;
|
||||
|
||||
public AndroidMathEntityDao(@Nullable String preferenceString,
|
||||
@Nonnull Application application,
|
||||
@Nullable Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass) {
|
||||
this.preferenceString = preferenceString;
|
||||
this.context = application;
|
||||
this.persistenceContainerClass = persistenceContainerClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(@Nonnull MathEntityPersistenceContainer<T> container) {
|
||||
if (preferenceString != null) {
|
||||
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final SharedPreferences.Editor editor = settings.edit();
|
||||
|
||||
final StringWriter sw = new StringWriter();
|
||||
final Serializer serializer = new Persister();
|
||||
try {
|
||||
serializer.write(container, sw);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
editor.putString(preferenceString, sw.toString());
|
||||
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public MathEntityPersistenceContainer<T> load() {
|
||||
if (persistenceContainerClass != null && preferenceString != null) {
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
if (preferences != null) {
|
||||
final String value = preferences.getString(preferenceString, null);
|
||||
if (value != null) {
|
||||
final Serializer serializer = new Persister();
|
||||
try {
|
||||
return serializer.read(persistenceContainerClass, value);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getDescription(@Nonnull String descriptionId) {
|
||||
final Resources resources = context.getResources();
|
||||
|
||||
final int stringId = resources.getIdentifier(descriptionId, "string", App.getApplication().getClass().getPackage().getName());
|
||||
try {
|
||||
return resources.getString(stringId);
|
||||
} catch (Resources.NotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.model;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.preference.PreferenceManager;
|
||||
import org.simpleframework.xml.Serializer;
|
||||
import org.simpleframework.xml.core.Persister;
|
||||
import org.solovyev.android.calculator.App;
|
||||
import org.solovyev.android.calculator.MathEntityDao;
|
||||
import org.solovyev.android.calculator.MathEntityPersistenceContainer;
|
||||
import org.solovyev.android.calculator.MathPersistenceEntity;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 10/7/12
|
||||
* Time: 6:46 PM
|
||||
*/
|
||||
public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements MathEntityDao<T> {
|
||||
|
||||
@Nonnull
|
||||
private static final String TAG = AndroidMathEntityDao.class.getSimpleName();
|
||||
|
||||
@Nullable
|
||||
private final String preferenceString;
|
||||
|
||||
@Nonnull
|
||||
private final Context context;
|
||||
|
||||
@Nullable
|
||||
private final Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass;
|
||||
|
||||
public AndroidMathEntityDao(@Nullable String preferenceString,
|
||||
@Nonnull Application application,
|
||||
@Nullable Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass) {
|
||||
this.preferenceString = preferenceString;
|
||||
this.context = application;
|
||||
this.persistenceContainerClass = persistenceContainerClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(@Nonnull MathEntityPersistenceContainer<T> container) {
|
||||
if (preferenceString != null) {
|
||||
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final SharedPreferences.Editor editor = settings.edit();
|
||||
|
||||
final StringWriter sw = new StringWriter();
|
||||
final Serializer serializer = new Persister();
|
||||
try {
|
||||
serializer.write(container, sw);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
editor.putString(preferenceString, sw.toString());
|
||||
|
||||
editor.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public MathEntityPersistenceContainer<T> load() {
|
||||
if (persistenceContainerClass != null && preferenceString != null) {
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
if (preferences != null) {
|
||||
final String value = preferences.getString(preferenceString, null);
|
||||
if (value != null) {
|
||||
final Serializer serializer = new Persister();
|
||||
try {
|
||||
return serializer.read(persistenceContainerClass, value);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getDescription(@Nonnull String descriptionId) {
|
||||
final Resources resources = context.getResources();
|
||||
|
||||
final int stringId = resources.getIdentifier(descriptionId, "string", App.getApplication().getClass().getPackage().getName());
|
||||
try {
|
||||
return resources.getString(stringId);
|
||||
} catch (Resources.NotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +1,38 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.onscreen;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class CalculatorOnscreenStartActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
CalculatorOnscreenService.showOnscreenView(this);
|
||||
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.onscreen;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class CalculatorOnscreenStartActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
CalculatorOnscreenService.showOnscreenView(this);
|
||||
|
||||
this.finish();
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import jscl.AngleUnit;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.view.drag.DirectionDragButton;
|
||||
|
||||
import javax.annotation.Nonnull;
|
@ -1,122 +1,120 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.view;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.CalculatorParseException;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
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.Strings;
|
||||
import org.solovyev.common.units.Unit;
|
||||
import org.solovyev.common.units.UnitImpl;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 4/22/12
|
||||
* Time: 12:20 AM
|
||||
*/
|
||||
public class NumeralBaseConverterDialog {
|
||||
|
||||
@Nullable
|
||||
private String initialFromValue;
|
||||
|
||||
public NumeralBaseConverterDialog(@Nullable String initialFromValue) {
|
||||
this.initialFromValue = initialFromValue;
|
||||
}
|
||||
|
||||
public void show(@Nonnull Context context) {
|
||||
final UnitConverterViewBuilder b = new UnitConverterViewBuilder();
|
||||
b.setFromUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
|
||||
b.setToUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
|
||||
|
||||
if (!Strings.isEmpty(initialFromValue)) {
|
||||
String value = initialFromValue;
|
||||
try {
|
||||
value = ToJsclTextProcessor.getInstance().process(value).getExpression();
|
||||
b.setFromValue(UnitImpl.newInstance(value, CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase())));
|
||||
} catch (CalculatorParseException e) {
|
||||
b.setFromValue(UnitImpl.newInstance(value, CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase())));
|
||||
}
|
||||
} else {
|
||||
b.setFromValue(UnitImpl.newInstance("", CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase())));
|
||||
}
|
||||
|
||||
b.setConverter(CalculatorNumeralBase.getConverter());
|
||||
|
||||
final MutableObject<AlertDialog> alertDialogHolder = new MutableObject<AlertDialog>();
|
||||
b.setOkButtonOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final AlertDialog alertDialog = alertDialogHolder.getObject();
|
||||
if (alertDialog != null) {
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
b.setCustomButtonData(new UnitConverterViewBuilder.CustomButtonData(context.getString(R.string.c_use_short), new UnitConverterViewBuilder.CustomButtonOnClickListener() {
|
||||
@Override
|
||||
public void onClick(@Nonnull Unit<String> fromUnits, @Nonnull Unit<String> toUnits) {
|
||||
String toUnitsValue = toUnits.getValue();
|
||||
|
||||
if (!toUnits.getUnitType().equals(CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase()))) {
|
||||
toUnitsValue = ((CalculatorNumeralBase) toUnits.getUnitType()).getNumeralBase().getJsclPrefix() + toUnitsValue;
|
||||
}
|
||||
|
||||
Locator.getInstance().getKeyboard().buttonPressed(toUnitsValue);
|
||||
final AlertDialog alertDialog = alertDialogHolder.getObject();
|
||||
if (alertDialog != null) {
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
|
||||
alertBuilder.setView(b.build(context));
|
||||
alertBuilder.setTitle(R.string.c_conversion_tool);
|
||||
|
||||
final AlertDialog alertDialog = alertBuilder.create();
|
||||
|
||||
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||||
lp.copyFrom(alertDialog.getWindow().getAttributes());
|
||||
|
||||
lp.width = WindowManager.LayoutParams.FILL_PARENT;
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
alertDialogHolder.setObject(alertDialog);
|
||||
alertDialog.show();
|
||||
alertDialog.getWindow().setAttributes(lp);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.view;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import org.solovyev.android.calculator.CalculatorParseException;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.calculator.ToJsclTextProcessor;
|
||||
import org.solovyev.android.calculator.units.CalculatorNumeralBase;
|
||||
import org.solovyev.common.MutableObject;
|
||||
import org.solovyev.common.text.Strings;
|
||||
import org.solovyev.common.units.Unit;
|
||||
import org.solovyev.common.units.UnitImpl;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 4/22/12
|
||||
* Time: 12:20 AM
|
||||
*/
|
||||
public class NumeralBaseConverterDialog {
|
||||
|
||||
@Nullable
|
||||
private String initialFromValue;
|
||||
|
||||
public NumeralBaseConverterDialog(@Nullable String initialFromValue) {
|
||||
this.initialFromValue = initialFromValue;
|
||||
}
|
||||
|
||||
public void show(@Nonnull Context context) {
|
||||
final UnitConverterViewBuilder b = new UnitConverterViewBuilder();
|
||||
b.setFromUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
|
||||
b.setToUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
|
||||
|
||||
if (!Strings.isEmpty(initialFromValue)) {
|
||||
String value = initialFromValue;
|
||||
try {
|
||||
value = ToJsclTextProcessor.getInstance().process(value).getExpression();
|
||||
b.setFromValue(UnitImpl.newInstance(value, CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase())));
|
||||
} catch (CalculatorParseException e) {
|
||||
b.setFromValue(UnitImpl.newInstance(value, CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase())));
|
||||
}
|
||||
} else {
|
||||
b.setFromValue(UnitImpl.newInstance("", CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase())));
|
||||
}
|
||||
|
||||
b.setConverter(CalculatorNumeralBase.getConverter());
|
||||
|
||||
final MutableObject<AlertDialog> alertDialogHolder = new MutableObject<AlertDialog>();
|
||||
b.setOkButtonOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final AlertDialog alertDialog = alertDialogHolder.getObject();
|
||||
if (alertDialog != null) {
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
b.setCustomButtonData(new UnitConverterViewBuilder.CustomButtonData(context.getString(R.string.c_use_short), new UnitConverterViewBuilder.CustomButtonOnClickListener() {
|
||||
@Override
|
||||
public void onClick(@Nonnull Unit<String> fromUnits, @Nonnull Unit<String> toUnits) {
|
||||
String toUnitsValue = toUnits.getValue();
|
||||
|
||||
if (!toUnits.getUnitType().equals(CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase()))) {
|
||||
toUnitsValue = ((CalculatorNumeralBase) toUnits.getUnitType()).getNumeralBase().getJsclPrefix() + toUnitsValue;
|
||||
}
|
||||
|
||||
Locator.getInstance().getKeyboard().buttonPressed(toUnitsValue);
|
||||
final AlertDialog alertDialog = alertDialogHolder.getObject();
|
||||
if (alertDialog != null) {
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
final AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
|
||||
alertBuilder.setView(b.build(context));
|
||||
alertBuilder.setTitle(R.string.c_conversion_tool);
|
||||
|
||||
final AlertDialog alertDialog = alertBuilder.create();
|
||||
|
||||
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||||
lp.copyFrom(alertDialog.getWindow().getAttributes());
|
||||
|
||||
lp.width = WindowManager.LayoutParams.FILL_PARENT;
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
alertDialogHolder.setObject(alertDialog);
|
||||
alertDialog.show();
|
||||
alertDialog.getWindow().setAttributes(lp);
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ import android.text.TextPaint;
|
||||
import android.util.AttributeSet;
|
||||
import jscl.NumeralBase;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.view.drag.DirectionDragButton;
|
||||
|
||||
import javax.annotation.Nonnull;
|
@ -1,243 +1,243 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.view.ViewBuilder;
|
||||
import org.solovyev.android.view.ViewFromLayoutBuilder;
|
||||
import org.solovyev.common.units.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 4/20/12
|
||||
* Time: 4:50 PM
|
||||
*/
|
||||
public class UnitConverterViewBuilder implements ViewBuilder<View> {
|
||||
|
||||
@Nonnull
|
||||
private List<? extends UnitType<String>> fromUnitTypes = Collections.emptyList();
|
||||
|
||||
@Nonnull
|
||||
private List<? extends UnitType<String>> toUnitTypes = Collections.emptyList();
|
||||
|
||||
@Nullable
|
||||
private Unit<String> fromValue;
|
||||
|
||||
@Nonnull
|
||||
private UnitConverter<String> converter = UnitConverter.Dummy.getInstance();
|
||||
|
||||
@Nullable
|
||||
private View.OnClickListener okButtonOnClickListener;
|
||||
|
||||
@Nullable
|
||||
private CustomButtonData customButtonData;
|
||||
|
||||
public void setFromUnitTypes(@Nonnull List<? extends UnitType<String>> fromUnitTypes) {
|
||||
this.fromUnitTypes = fromUnitTypes;
|
||||
}
|
||||
|
||||
public void setToUnitTypes(@Nonnull List<? extends UnitType<String>> toUnitTypes) {
|
||||
this.toUnitTypes = toUnitTypes;
|
||||
}
|
||||
|
||||
public void setFromValue(@Nullable Unit<String> fromValue) {
|
||||
this.fromValue = fromValue;
|
||||
}
|
||||
|
||||
public void setConverter(@Nonnull UnitConverter<String> converter) {
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
public void setOkButtonOnClickListener(@Nullable View.OnClickListener okButtonOnClickListener) {
|
||||
this.okButtonOnClickListener = okButtonOnClickListener;
|
||||
}
|
||||
|
||||
public void setCustomButtonData(@Nullable CustomButtonData customButtonData) {
|
||||
this.customButtonData = customButtonData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public View build(@Nonnull final Context context) {
|
||||
final View main = ViewFromLayoutBuilder.newInstance(R.layout.cpp_unit_converter).build(context);
|
||||
|
||||
final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from);
|
||||
final EditText fromEditText = (EditText) main.findViewById(R.id.units_from);
|
||||
fromEditText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
doConversion(main, context, UnitConverterViewBuilder.this.converter);
|
||||
}
|
||||
});
|
||||
|
||||
fillSpinner(main, context, R.id.unit_types_from, fromUnitTypes);
|
||||
fillSpinner(main, context, R.id.unit_types_to, toUnitTypes);
|
||||
|
||||
if (fromValue != null) {
|
||||
fromEditText.setText(fromValue.getValue());
|
||||
|
||||
int i = fromUnitTypes.indexOf(fromValue.getUnitType());
|
||||
if (i >= 0) {
|
||||
fromSpinner.setSelection(i);
|
||||
}
|
||||
}
|
||||
|
||||
final Button copyButton = (Button) main.findViewById(R.id.unit_converter_copy_button);
|
||||
copyButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final EditText toEditText = (EditText) main.findViewById(R.id.units_to);
|
||||
|
||||
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
|
||||
clipboard.setText(toEditText.getText().toString());
|
||||
Toast.makeText(context, context.getText(R.string.c_result_copied), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
final Button okButton = (Button) main.findViewById(R.id.unit_converter_ok_button);
|
||||
if (okButtonOnClickListener == null) {
|
||||
((ViewGroup) okButton.getParent()).removeView(okButton);
|
||||
} else {
|
||||
okButton.setOnClickListener(this.okButtonOnClickListener);
|
||||
}
|
||||
|
||||
final Button customButton = (Button) main.findViewById(R.id.unit_converter_custom_button);
|
||||
if (customButtonData == null) {
|
||||
((ViewGroup) customButton.getParent()).removeView(customButton);
|
||||
} else {
|
||||
customButton.setText(customButtonData.text);
|
||||
customButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
customButtonData.clickListener.onClick(getFromUnit(main), getToUnit(main));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return main;
|
||||
}
|
||||
|
||||
private void fillSpinner(@Nonnull final View main,
|
||||
@Nonnull final Context context,
|
||||
final int spinnerId,
|
||||
@Nonnull List<? extends UnitType<String>> unitTypes) {
|
||||
final Spinner spinner = (Spinner) main.findViewById(spinnerId);
|
||||
|
||||
final ArrayAdapter<UnitType<String>> adapter = new ArrayAdapter<UnitType<String>>(context, android.R.layout.simple_spinner_item);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
for (UnitType<String> fromUnitType : unitTypes) {
|
||||
adapter.add(fromUnitType);
|
||||
}
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
doConversion(main, context, UnitConverterViewBuilder.this.converter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
spinner.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private static void doConversion(@Nonnull View main, @Nonnull Context context, @Nonnull UnitConverter<String> converter) {
|
||||
final EditText fromEditText = (EditText) main.findViewById(R.id.units_from);
|
||||
|
||||
final EditText toEditText = (EditText) main.findViewById(R.id.units_to);
|
||||
|
||||
final String from = fromEditText.getText().toString();
|
||||
try {
|
||||
toEditText.setText(Conversions.doConversion(converter, from, getFromUnitType(main), getToUnitType(main)));
|
||||
} catch (ConversionException e) {
|
||||
toEditText.setText(context.getString(R.string.c_error));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static Unit<String> getToUnit(@Nonnull View main) {
|
||||
final EditText toUnits = (EditText) main.findViewById(R.id.units_to);
|
||||
return UnitImpl.newInstance(toUnits.getText().toString(), getToUnitType(main));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static UnitType<String> getToUnitType(@Nonnull View main) {
|
||||
final Spinner toSpinner = (Spinner) main.findViewById(R.id.unit_types_to);
|
||||
return (UnitType<String>) toSpinner.getSelectedItem();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static Unit<String> getFromUnit(@Nonnull View main) {
|
||||
final EditText fromUnits = (EditText) main.findViewById(R.id.units_from);
|
||||
return UnitImpl.newInstance(fromUnits.getText().toString(), getFromUnitType(main));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static UnitType<String> getFromUnitType(@Nonnull View main) {
|
||||
final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from);
|
||||
return (UnitType<String>) fromSpinner.getSelectedItem();
|
||||
}
|
||||
|
||||
public static class CustomButtonData {
|
||||
|
||||
@Nonnull
|
||||
private String text;
|
||||
|
||||
@Nonnull
|
||||
private CustomButtonOnClickListener clickListener;
|
||||
|
||||
|
||||
public CustomButtonData(@Nonnull String text, @Nonnull CustomButtonOnClickListener clickListener) {
|
||||
this.text = text;
|
||||
this.clickListener = clickListener;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface CustomButtonOnClickListener {
|
||||
void onClick(@Nonnull Unit<String> fromUnits, @Nonnull Unit<String> toUnits);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.view;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.*;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.view.ViewBuilder;
|
||||
import org.solovyev.android.view.ViewFromLayoutBuilder;
|
||||
import org.solovyev.common.units.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 4/20/12
|
||||
* Time: 4:50 PM
|
||||
*/
|
||||
public class UnitConverterViewBuilder implements ViewBuilder<View> {
|
||||
|
||||
@Nonnull
|
||||
private List<? extends UnitType<String>> fromUnitTypes = Collections.emptyList();
|
||||
|
||||
@Nonnull
|
||||
private List<? extends UnitType<String>> toUnitTypes = Collections.emptyList();
|
||||
|
||||
@Nullable
|
||||
private Unit<String> fromValue;
|
||||
|
||||
@Nonnull
|
||||
private UnitConverter<String> converter = UnitConverter.Dummy.getInstance();
|
||||
|
||||
@Nullable
|
||||
private View.OnClickListener okButtonOnClickListener;
|
||||
|
||||
@Nullable
|
||||
private CustomButtonData customButtonData;
|
||||
|
||||
public void setFromUnitTypes(@Nonnull List<? extends UnitType<String>> fromUnitTypes) {
|
||||
this.fromUnitTypes = fromUnitTypes;
|
||||
}
|
||||
|
||||
public void setToUnitTypes(@Nonnull List<? extends UnitType<String>> toUnitTypes) {
|
||||
this.toUnitTypes = toUnitTypes;
|
||||
}
|
||||
|
||||
public void setFromValue(@Nullable Unit<String> fromValue) {
|
||||
this.fromValue = fromValue;
|
||||
}
|
||||
|
||||
public void setConverter(@Nonnull UnitConverter<String> converter) {
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
public void setOkButtonOnClickListener(@Nullable View.OnClickListener okButtonOnClickListener) {
|
||||
this.okButtonOnClickListener = okButtonOnClickListener;
|
||||
}
|
||||
|
||||
public void setCustomButtonData(@Nullable CustomButtonData customButtonData) {
|
||||
this.customButtonData = customButtonData;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public View build(@Nonnull final Context context) {
|
||||
final View main = ViewFromLayoutBuilder.newInstance(R.layout.cpp_unit_converter).build(context);
|
||||
|
||||
final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from);
|
||||
final EditText fromEditText = (EditText) main.findViewById(R.id.units_from);
|
||||
fromEditText.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
doConversion(main, context, UnitConverterViewBuilder.this.converter);
|
||||
}
|
||||
});
|
||||
|
||||
fillSpinner(main, context, R.id.unit_types_from, fromUnitTypes);
|
||||
fillSpinner(main, context, R.id.unit_types_to, toUnitTypes);
|
||||
|
||||
if (fromValue != null) {
|
||||
fromEditText.setText(fromValue.getValue());
|
||||
|
||||
int i = fromUnitTypes.indexOf(fromValue.getUnitType());
|
||||
if (i >= 0) {
|
||||
fromSpinner.setSelection(i);
|
||||
}
|
||||
}
|
||||
|
||||
final Button copyButton = (Button) main.findViewById(R.id.unit_converter_copy_button);
|
||||
copyButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final EditText toEditText = (EditText) main.findViewById(R.id.units_to);
|
||||
|
||||
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
|
||||
clipboard.setText(toEditText.getText().toString());
|
||||
Toast.makeText(context, context.getText(R.string.c_result_copied), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
final Button okButton = (Button) main.findViewById(R.id.unit_converter_ok_button);
|
||||
if (okButtonOnClickListener == null) {
|
||||
((ViewGroup) okButton.getParent()).removeView(okButton);
|
||||
} else {
|
||||
okButton.setOnClickListener(this.okButtonOnClickListener);
|
||||
}
|
||||
|
||||
final Button customButton = (Button) main.findViewById(R.id.unit_converter_custom_button);
|
||||
if (customButtonData == null) {
|
||||
((ViewGroup) customButton.getParent()).removeView(customButton);
|
||||
} else {
|
||||
customButton.setText(customButtonData.text);
|
||||
customButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
customButtonData.clickListener.onClick(getFromUnit(main), getToUnit(main));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return main;
|
||||
}
|
||||
|
||||
private void fillSpinner(@Nonnull final View main,
|
||||
@Nonnull final Context context,
|
||||
final int spinnerId,
|
||||
@Nonnull List<? extends UnitType<String>> unitTypes) {
|
||||
final Spinner spinner = (Spinner) main.findViewById(spinnerId);
|
||||
|
||||
final ArrayAdapter<UnitType<String>> adapter = new ArrayAdapter<UnitType<String>>(context, android.R.layout.simple_spinner_item);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
for (UnitType<String> fromUnitType : unitTypes) {
|
||||
adapter.add(fromUnitType);
|
||||
}
|
||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
doConversion(main, context, UnitConverterViewBuilder.this.converter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
spinner.setAdapter(adapter);
|
||||
}
|
||||
|
||||
private static void doConversion(@Nonnull View main, @Nonnull Context context, @Nonnull UnitConverter<String> converter) {
|
||||
final EditText fromEditText = (EditText) main.findViewById(R.id.units_from);
|
||||
|
||||
final EditText toEditText = (EditText) main.findViewById(R.id.units_to);
|
||||
|
||||
final String from = fromEditText.getText().toString();
|
||||
try {
|
||||
toEditText.setText(Conversions.doConversion(converter, from, getFromUnitType(main), getToUnitType(main)));
|
||||
} catch (ConversionException e) {
|
||||
toEditText.setText(context.getString(R.string.c_error));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static Unit<String> getToUnit(@Nonnull View main) {
|
||||
final EditText toUnits = (EditText) main.findViewById(R.id.units_to);
|
||||
return UnitImpl.newInstance(toUnits.getText().toString(), getToUnitType(main));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static UnitType<String> getToUnitType(@Nonnull View main) {
|
||||
final Spinner toSpinner = (Spinner) main.findViewById(R.id.unit_types_to);
|
||||
return (UnitType<String>) toSpinner.getSelectedItem();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static Unit<String> getFromUnit(@Nonnull View main) {
|
||||
final EditText fromUnits = (EditText) main.findViewById(R.id.units_from);
|
||||
return UnitImpl.newInstance(fromUnits.getText().toString(), getFromUnitType(main));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static UnitType<String> getFromUnitType(@Nonnull View main) {
|
||||
final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from);
|
||||
return (UnitType<String>) fromSpinner.getSelectedItem();
|
||||
}
|
||||
|
||||
public static class CustomButtonData {
|
||||
|
||||
@Nonnull
|
||||
private String text;
|
||||
|
||||
@Nonnull
|
||||
private CustomButtonOnClickListener clickListener;
|
||||
|
||||
|
||||
public CustomButtonData(@Nonnull String text, @Nonnull CustomButtonOnClickListener clickListener) {
|
||||
this.text = text;
|
||||
this.clickListener = clickListener;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface CustomButtonOnClickListener {
|
||||
void onClick(@Nonnull Unit<String> fromUnits, @Nonnull Unit<String> toUnits);
|
||||
}
|
||||
}
|
@ -1,33 +1,33 @@
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 19.10.12
|
||||
* Time: 16:20
|
||||
*/
|
||||
public class CalculatorWidgetConfigurationActivity extends Activity {
|
||||
}
|
||||
/*
|
||||
* Copyright 2013 serso aka se.solovyev
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Contact details
|
||||
*
|
||||
* Email: se.solovyev@gmail.com
|
||||
* Site: http://se.solovyev.org
|
||||
*/
|
||||
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 19.10.12
|
||||
* Time: 16:20
|
||||
*/
|
||||
public class CalculatorWidgetConfigurationActivity extends Activity {
|
||||
}
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 420 B After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 515 B |
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 576 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 424 B After Width: | Height: | Size: 424 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 593 B After Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 601 B |
Before Width: | Height: | Size: 896 B After Width: | Height: | Size: 896 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 942 B After Width: | Height: | Size: 942 B |
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 870 B After Width: | Height: | Size: 870 B |
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 670 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |