Fragments
This commit is contained in:
parent
2f2914dd46
commit
5242d65e3a
@ -1,317 +1,322 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>calculatorpp-parent</artifactId>
|
<artifactId>calculatorpp-parent</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>calculatorpp</artifactId>
|
<artifactId>calculatorpp</artifactId>
|
||||||
<packaging>apk</packaging>
|
<packaging>apk</packaging>
|
||||||
<name>Calculator++ Application</name>
|
<name>Calculator++ Application</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- OWN -->
|
<!-- OWN -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>calculatorpp-core</artifactId>
|
<artifactId>calculatorpp-core</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev</groupId>
|
<groupId>org.solovyev</groupId>
|
||||||
<artifactId>common-core</artifactId>
|
<artifactId>common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev</groupId>
|
<groupId>org.solovyev</groupId>
|
||||||
<artifactId>common-text</artifactId>
|
<artifactId>common-text</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-core</artifactId>
|
<artifactId>android-common-core</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-ads</artifactId>
|
<artifactId>android-common-ads</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-view</artifactId>
|
<artifactId>android-common-view</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-preferences</artifactId>
|
<artifactId>android-common-preferences</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-other</artifactId>
|
<artifactId>android-common-other</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-menu</artifactId>
|
<artifactId>android-common-menu</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev</groupId>
|
<groupId>org.solovyev</groupId>
|
||||||
<artifactId>jscl</artifactId>
|
<artifactId>jscl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--OTHER-->
|
<!--OTHER-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.android</groupId>
|
<groupId>com.google.android</groupId>
|
||||||
<artifactId>android</artifactId>
|
<artifactId>android</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.opencsv</groupId>
|
<groupId>com.google.android</groupId>
|
||||||
<artifactId>opencsv</artifactId>
|
<artifactId>support-v4</artifactId>
|
||||||
<version>2.0</version>
|
</dependency>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
<dependency>
|
||||||
|
<groupId>net.sf.opencsv</groupId>
|
||||||
<dependency>
|
<artifactId>opencsv</artifactId>
|
||||||
<groupId>org.simpleframework</groupId>
|
<version>2.0</version>
|
||||||
<artifactId>simple-xml</artifactId>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>achartengine</groupId>
|
<groupId>org.simpleframework</groupId>
|
||||||
<artifactId>achartengine</artifactId>
|
<artifactId>simple-xml</artifactId>
|
||||||
<version>0.7.0</version>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
<dependency>
|
||||||
<dependency>
|
<groupId>achartengine</groupId>
|
||||||
<groupId>admob</groupId>
|
<artifactId>achartengine</artifactId>
|
||||||
<artifactId>admob</artifactId>
|
<version>0.7.0</version>
|
||||||
<version>6.1.0</version>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
<dependency>
|
||||||
<dependency>
|
<groupId>admob</groupId>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<artifactId>admob</artifactId>
|
||||||
<artifactId>billing</artifactId>
|
<version>6.1.0</version>
|
||||||
<version>0.1</version>
|
</dependency>
|
||||||
<!--<type>apklib</type>-->
|
|
||||||
</dependency>
|
<dependency>
|
||||||
|
<groupId>org.solovyev.android</groupId>
|
||||||
<dependency>
|
<artifactId>billing</artifactId>
|
||||||
<groupId>com.google.guava</groupId>
|
<version>0.1</version>
|
||||||
<artifactId>guava</artifactId>
|
<!--<type>apklib</type>-->
|
||||||
<version>11.0.2</version>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
<dependency>
|
||||||
<dependency>
|
<groupId>com.google.guava</groupId>
|
||||||
<groupId>junit</groupId>
|
<artifactId>guava</artifactId>
|
||||||
<artifactId>junit</artifactId>
|
<version>11.0.2</version>
|
||||||
<scope>test</scope>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
|
<dependency>
|
||||||
<dependency>
|
<groupId>junit</groupId>
|
||||||
<groupId>com.intellij</groupId>
|
<artifactId>junit</artifactId>
|
||||||
<artifactId>annotations</artifactId>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
<dependency>
|
||||||
|
<groupId>com.intellij</groupId>
|
||||||
<build>
|
<artifactId>annotations</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<plugins>
|
</dependencies>
|
||||||
|
|
||||||
<plugin>
|
<build>
|
||||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
|
||||||
<artifactId>android-maven-plugin</artifactId>
|
|
||||||
<extensions>true</extensions>
|
<plugins>
|
||||||
<configuration>
|
|
||||||
<manifest>
|
<plugin>
|
||||||
<debuggable>true</debuggable>
|
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||||
</manifest>
|
<artifactId>android-maven-plugin</artifactId>
|
||||||
</configuration>
|
<extensions>true</extensions>
|
||||||
<executions>
|
<configuration>
|
||||||
<execution>
|
<manifest>
|
||||||
<id>manifestUpdate</id>
|
<debuggable>true</debuggable>
|
||||||
<phase>process-resources</phase>
|
</manifest>
|
||||||
<goals>
|
</configuration>
|
||||||
<goal>manifest-update</goal>
|
<executions>
|
||||||
</goals>
|
<execution>
|
||||||
</execution>
|
<id>manifestUpdate</id>
|
||||||
<execution>
|
<phase>process-resources</phase>
|
||||||
<id>alignApk</id>
|
<goals>
|
||||||
<phase>package</phase>
|
<goal>manifest-update</goal>
|
||||||
<goals>
|
</goals>
|
||||||
<goal>zipalign</goal>
|
</execution>
|
||||||
</goals>
|
<execution>
|
||||||
</execution>
|
<id>alignApk</id>
|
||||||
</executions>
|
<phase>package</phase>
|
||||||
</plugin>
|
<goals>
|
||||||
|
<goal>zipalign</goal>
|
||||||
</plugins>
|
</goals>
|
||||||
|
</execution>
|
||||||
</build>
|
</executions>
|
||||||
|
</plugin>
|
||||||
<profiles>
|
|
||||||
|
</plugins>
|
||||||
<profile>
|
|
||||||
<id>release</id>
|
</build>
|
||||||
<!-- via this activation the profile is automatically used when the release is done with the maven release
|
|
||||||
plugin -->
|
<profiles>
|
||||||
<activation>
|
|
||||||
<property>
|
<profile>
|
||||||
<name>performRelease</name>
|
<id>release</id>
|
||||||
<value>true</value>
|
<!-- via this activation the profile is automatically used when the release is done with the maven release
|
||||||
</property>
|
plugin -->
|
||||||
</activation>
|
<activation>
|
||||||
|
<property>
|
||||||
<build>
|
<name>performRelease</name>
|
||||||
<plugins>
|
<value>true</value>
|
||||||
|
</property>
|
||||||
<plugin>
|
</activation>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>properties-maven-plugin</artifactId>
|
<build>
|
||||||
<version>1.0-alpha-2</version>
|
<plugins>
|
||||||
<executions>
|
|
||||||
<execution>
|
<plugin>
|
||||||
<phase>initialize</phase>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<goals>
|
<artifactId>properties-maven-plugin</artifactId>
|
||||||
<goal>read-project-properties</goal>
|
<version>1.0-alpha-2</version>
|
||||||
</goals>
|
<executions>
|
||||||
<configuration>
|
<execution>
|
||||||
<files>
|
<phase>initialize</phase>
|
||||||
<file>${project.basedir}/misc/env/jarsigner.properties</file>
|
<goals>
|
||||||
</files>
|
<goal>read-project-properties</goal>
|
||||||
</configuration>
|
</goals>
|
||||||
</execution>
|
<configuration>
|
||||||
</executions>
|
<files>
|
||||||
</plugin>
|
<file>${project.basedir}/misc/env/jarsigner.properties</file>
|
||||||
|
</files>
|
||||||
<plugin>
|
</configuration>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</execution>
|
||||||
<artifactId>maven-jarsigner-plugin</artifactId>
|
</executions>
|
||||||
<executions>
|
</plugin>
|
||||||
<execution>
|
|
||||||
<id>signing</id>
|
<plugin>
|
||||||
<goals>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<goal>sign</goal>
|
<artifactId>maven-jarsigner-plugin</artifactId>
|
||||||
<goal>verify</goal>
|
<executions>
|
||||||
</goals>
|
<execution>
|
||||||
<phase>package</phase>
|
<id>signing</id>
|
||||||
<inherited>true</inherited>
|
<goals>
|
||||||
<configuration>
|
<goal>sign</goal>
|
||||||
<removeExistingSignatures>true</removeExistingSignatures>
|
<goal>verify</goal>
|
||||||
<archiveDirectory/>
|
</goals>
|
||||||
<includes>
|
<phase>package</phase>
|
||||||
<include>${project.build.directory}/${project.artifactId}-${project.version}.apk</include>
|
<inherited>true</inherited>
|
||||||
</includes>
|
<configuration>
|
||||||
<keystore>${sign.keystore}</keystore>
|
<removeExistingSignatures>true</removeExistingSignatures>
|
||||||
<alias>${sign.alias}</alias>
|
<archiveDirectory/>
|
||||||
<storepass>${sign.storepass}</storepass>
|
<includes>
|
||||||
<keypass>${sign.keypass}</keypass>
|
<include>${project.build.directory}/${project.artifactId}-${project.version}.apk</include>
|
||||||
<verbose>false</verbose>
|
</includes>
|
||||||
</configuration>
|
<keystore>${sign.keystore}</keystore>
|
||||||
</execution>
|
<alias>${sign.alias}</alias>
|
||||||
</executions>
|
<storepass>${sign.storepass}</storepass>
|
||||||
</plugin>
|
<keypass>${sign.keypass}</keypass>
|
||||||
|
<verbose>false</verbose>
|
||||||
<!-- the signed apk then needs to be zipaligned and we activate proguard and we run the manifest
|
</configuration>
|
||||||
update -->
|
</execution>
|
||||||
<plugin>
|
</executions>
|
||||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
</plugin>
|
||||||
<artifactId>android-maven-plugin</artifactId>
|
|
||||||
<inherited>true</inherited>
|
<!-- the signed apk then needs to be zipaligned and we activate proguard and we run the manifest
|
||||||
<configuration>
|
update -->
|
||||||
|
<plugin>
|
||||||
<sign>
|
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||||
<debug>false</debug>
|
<artifactId>android-maven-plugin</artifactId>
|
||||||
</sign>
|
<inherited>true</inherited>
|
||||||
|
<configuration>
|
||||||
<zipalign>
|
|
||||||
<verbose>false</verbose>
|
<sign>
|
||||||
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
|
<debug>false</debug>
|
||||||
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
|
</sign>
|
||||||
</zipalign>
|
|
||||||
|
<zipalign>
|
||||||
<manifest>
|
<verbose>false</verbose>
|
||||||
<debuggable>false</debuggable>
|
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
|
||||||
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
|
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
|
||||||
</manifest>
|
</zipalign>
|
||||||
|
|
||||||
<proguard>
|
<manifest>
|
||||||
<skip>true</skip>
|
<debuggable>false</debuggable>
|
||||||
</proguard>
|
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
|
||||||
</configuration>
|
</manifest>
|
||||||
|
|
||||||
<executions>
|
<proguard>
|
||||||
<execution>
|
<skip>true</skip>
|
||||||
<id>manifestUpdate</id>
|
</proguard>
|
||||||
<phase>process-resources</phase>
|
</configuration>
|
||||||
<goals>
|
|
||||||
<goal>manifest-update</goal>
|
<executions>
|
||||||
</goals>
|
<execution>
|
||||||
</execution>
|
<id>manifestUpdate</id>
|
||||||
<execution>
|
<phase>process-resources</phase>
|
||||||
<id>alignApk</id>
|
<goals>
|
||||||
<phase>package</phase>
|
<goal>manifest-update</goal>
|
||||||
<goals>
|
</goals>
|
||||||
<goal>zipalign</goal>
|
</execution>
|
||||||
</goals>
|
<execution>
|
||||||
</execution>
|
<id>alignApk</id>
|
||||||
</executions>
|
<phase>package</phase>
|
||||||
</plugin>
|
<goals>
|
||||||
|
<goal>zipalign</goal>
|
||||||
<plugin>
|
</goals>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
</execution>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
</executions>
|
||||||
<configuration>
|
</plugin>
|
||||||
<artifacts>
|
|
||||||
<artifact>
|
<plugin>
|
||||||
<file>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</file>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<type>apk</type>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
<classifier>signed-aligned</classifier>
|
<configuration>
|
||||||
</artifact>
|
<artifacts>
|
||||||
<artifact>
|
<artifact>
|
||||||
<file>${project.build.directory}/proguard/mapping.txt</file>
|
<file>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</file>
|
||||||
<type>map</type>
|
<type>apk</type>
|
||||||
<classifier>release</classifier>
|
<classifier>signed-aligned</classifier>
|
||||||
</artifact>
|
</artifact>
|
||||||
</artifacts>
|
<artifact>
|
||||||
</configuration>
|
<file>${project.build.directory}/proguard/mapping.txt</file>
|
||||||
<executions>
|
<type>map</type>
|
||||||
<execution>
|
<classifier>release</classifier>
|
||||||
<id>attach-signed-aligned</id>
|
</artifact>
|
||||||
<phase>package</phase>
|
</artifacts>
|
||||||
<goals>
|
</configuration>
|
||||||
<goal>attach-artifact</goal>
|
<executions>
|
||||||
</goals>
|
<execution>
|
||||||
</execution>
|
<id>attach-signed-aligned</id>
|
||||||
</executions>
|
<phase>package</phase>
|
||||||
</plugin>
|
<goals>
|
||||||
|
<goal>attach-artifact</goal>
|
||||||
</plugins>
|
</goals>
|
||||||
</build>
|
</execution>
|
||||||
</profile>
|
</executions>
|
||||||
</profiles>
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -1,84 +1,87 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||||
~ For more information, please, contact se.solovyev@gmail.com
|
~ For more information, please, contact se.solovyev@gmail.com
|
||||||
~ or visit http://se.solovyev.org
|
~ or visit http://se.solovyev.org
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
a:layout_width="fill_parent"
|
a:layout_width="fill_parent"
|
||||||
a:layout_height="fill_parent"
|
a:layout_height="fill_parent"
|
||||||
a:id="@+id/ad_parent_view"
|
a:id="@+id/ad_parent_view"
|
||||||
a:orientation="vertical"
|
a:orientation="vertical"
|
||||||
a:layout_gravity="center"
|
a:layout_gravity="center"
|
||||||
a:background="#ff000000">
|
a:background="#ff000000">
|
||||||
|
|
||||||
<include layout="@layout/calc_editor"/>
|
<LinearLayout a:id="@+id/editorContainer"
|
||||||
|
a:layout_weight="2"
|
||||||
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="0dp"/>
|
||||||
<include layout="@layout/calc_equals_button"
|
|
||||||
a:layout_weight="1"
|
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
||||||
a:layout_width="0dp"
|
|
||||||
a:layout_height="fill_parent"/>
|
<include layout="@layout/calc_equals_button"
|
||||||
|
a:layout_weight="1"
|
||||||
<include layout="@layout/calc_display"
|
a:layout_width="0dp"
|
||||||
a:layout_weight="4"
|
a:layout_height="fill_parent"/>
|
||||||
a:layout_width="0dp"
|
|
||||||
a:layout_height="fill_parent"/>
|
<LinearLayout a:id="@+id/displayContainer"
|
||||||
|
a:layout_weight="4"
|
||||||
</LinearLayout>
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="match_parent"/>
|
||||||
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
|
||||||
|
</LinearLayout>
|
||||||
<include layout="@layout/calc_seven_digit_button"/>
|
|
||||||
<include layout="@layout/calc_eight_digit_button"/>
|
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
||||||
<include layout="@layout/calc_nine_digit_button"/>
|
|
||||||
<include layout="@layout/calc_multiplication_button"/>
|
<include layout="@layout/calc_seven_digit_button"/>
|
||||||
<include layout="@layout/calc_clear_button"/>
|
<include layout="@layout/calc_eight_digit_button"/>
|
||||||
|
<include layout="@layout/calc_nine_digit_button"/>
|
||||||
</LinearLayout>
|
<include layout="@layout/calc_multiplication_button"/>
|
||||||
|
<include layout="@layout/calc_clear_button"/>
|
||||||
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
|
||||||
|
</LinearLayout>
|
||||||
<include layout="@layout/calc_four_digit_button"/>
|
|
||||||
<include layout="@layout/calc_five_digit_button"/>
|
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
||||||
<include layout="@layout/calc_six_digit_button"/>
|
|
||||||
<include layout="@layout/calc_division_button"/>
|
<include layout="@layout/calc_four_digit_button"/>
|
||||||
<include layout="@layout/calc_erase_button"/>
|
<include layout="@layout/calc_five_digit_button"/>
|
||||||
|
<include layout="@layout/calc_six_digit_button"/>
|
||||||
</LinearLayout>
|
<include layout="@layout/calc_division_button"/>
|
||||||
|
<include layout="@layout/calc_erase_button"/>
|
||||||
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
|
||||||
|
</LinearLayout>
|
||||||
<include layout="@layout/calc_one_digit_button"/>
|
|
||||||
<include layout="@layout/calc_two_digit_button"/>
|
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
||||||
<include layout="@layout/calc_three_digit_button"/>
|
|
||||||
<include layout="@layout/calc_plus_button"/>
|
<include layout="@layout/calc_one_digit_button"/>
|
||||||
<include layout="@layout/calc_copy_button"/>
|
<include layout="@layout/calc_two_digit_button"/>
|
||||||
|
<include layout="@layout/calc_three_digit_button"/>
|
||||||
</LinearLayout>
|
<include layout="@layout/calc_plus_button"/>
|
||||||
|
<include layout="@layout/calc_copy_button"/>
|
||||||
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
|
||||||
|
</LinearLayout>
|
||||||
<include layout="@layout/calc_round_brackets_button"/>
|
|
||||||
<include layout="@layout/calc_zero_digit_button"/>
|
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
||||||
<include layout="@layout/calc_dot_button"/>
|
|
||||||
<include layout="@layout/calc_subtraction_button"/>
|
<include layout="@layout/calc_round_brackets_button"/>
|
||||||
<include layout="@layout/calc_paste_button"/>
|
<include layout="@layout/calc_zero_digit_button"/>
|
||||||
|
<include layout="@layout/calc_dot_button"/>
|
||||||
</LinearLayout>
|
<include layout="@layout/calc_subtraction_button"/>
|
||||||
|
<include layout="@layout/calc_paste_button"/>
|
||||||
|
|
||||||
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
</LinearLayout>
|
||||||
|
|
||||||
<include layout="@layout/calc_left_button"/>
|
|
||||||
<include layout="@layout/calc_right_button"/>
|
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
|
||||||
<include layout="@layout/calc_vars_button"/>
|
|
||||||
<include layout="@layout/calc_functions_button"/>
|
<include layout="@layout/calc_left_button"/>
|
||||||
<include layout="@layout/calc_history_button"/>
|
<include layout="@layout/calc_right_button"/>
|
||||||
|
<include layout="@layout/calc_vars_button"/>
|
||||||
</LinearLayout>
|
<include layout="@layout/calc_functions_button"/>
|
||||||
</LinearLayout>
|
<include layout="@layout/calc_history_button"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
@ -7,9 +7,8 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
a:layout_weight="2"
|
a:layout_width="match_parent"
|
||||||
a:layout_width="fill_parent"
|
a:layout_height="wrap_content">
|
||||||
a:layout_height="0dp">
|
|
||||||
|
|
||||||
<org.solovyev.android.calculator.AndroidCalculatorEditorView
|
<org.solovyev.android.calculator.AndroidCalculatorEditorView
|
||||||
a:id="@+id/calculatorEditor"
|
a:id="@+id/calculatorEditor"
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.SharedPreferences;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
import jscl.NumeralBase;
|
import jscl.NumeralBase;
|
||||||
import jscl.math.Generic;
|
import jscl.math.Generic;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -22,17 +26,44 @@ public class AndroidCalculator implements Calculator {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final Calculator calculator = new CalculatorImpl();
|
private final Calculator calculator = new CalculatorImpl();
|
||||||
|
|
||||||
public void init(@NotNull final Activity activity, @NotNull SharedPreferences preferences) {
|
public static void showEvaluationError(@NotNull Context context, @NotNull final String errorMessage) {
|
||||||
final AndroidCalculatorEditorView editorView = (AndroidCalculatorEditorView) activity.findViewById(R.id.calculatorEditor);
|
final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||||
editorView.init(preferences);
|
|
||||||
preferences.registerOnSharedPreferenceChangeListener(editorView);
|
|
||||||
CalculatorLocatorImpl.getInstance().getEditor().setView(editorView);
|
|
||||||
|
|
||||||
|
final View errorMessageView = layoutInflater.inflate(R.layout.display_error_message, null);
|
||||||
|
((TextView) errorMessageView.findViewById(R.id.error_message_text_view)).setText(errorMessage);
|
||||||
|
|
||||||
|
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
|
||||||
|
.setPositiveButton(R.string.c_cancel, null)
|
||||||
|
.setView(errorMessageView);
|
||||||
|
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(@NotNull final Activity activity) {
|
||||||
|
setEditor(activity);
|
||||||
|
setDisplay(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplay(@NotNull Activity activity) {
|
||||||
final AndroidCalculatorDisplayView displayView = (AndroidCalculatorDisplayView) activity.findViewById(R.id.calculatorDisplay);
|
final AndroidCalculatorDisplayView displayView = (AndroidCalculatorDisplayView) activity.findViewById(R.id.calculatorDisplay);
|
||||||
displayView.setOnClickListener(new CalculatorDisplayOnClickListener(activity));
|
setDisplay(activity, displayView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplay(@NotNull Context context, @NotNull AndroidCalculatorDisplayView displayView) {
|
||||||
|
displayView.init(context);
|
||||||
CalculatorLocatorImpl.getInstance().getDisplay().setView(displayView);
|
CalculatorLocatorImpl.getInstance().getDisplay().setView(displayView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEditor(@NotNull Activity activity) {
|
||||||
|
final AndroidCalculatorEditorView editorView = (AndroidCalculatorEditorView) activity.findViewById(R.id.calculatorEditor);
|
||||||
|
setEditor(activity, editorView);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditor(@NotNull Context context, @NotNull AndroidCalculatorEditorView editorView) {
|
||||||
|
editorView.init(context);
|
||||||
|
CalculatorLocatorImpl.getInstance().getEditor().setView(editorView);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
@ -1,189 +1,199 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||||
* For more information, please, contact se.solovyev@gmail.com
|
* For more information, please, contact se.solovyev@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.text.TextProcessor;
|
import org.solovyev.android.calculator.text.TextProcessor;
|
||||||
import org.solovyev.android.calculator.view.TextHighlighter;
|
import org.solovyev.android.calculator.view.TextHighlighter;
|
||||||
import org.solovyev.android.view.AutoResizeTextView;
|
import org.solovyev.android.view.AutoResizeTextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
* Date: 9/17/11
|
* Date: 9/17/11
|
||||||
* Time: 10:58 PM
|
* Time: 10:58 PM
|
||||||
*/
|
*/
|
||||||
public class AndroidCalculatorDisplayView extends AutoResizeTextView implements CalculatorDisplayView {
|
public class AndroidCalculatorDisplayView extends AutoResizeTextView implements CalculatorDisplayView {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*
|
*
|
||||||
* STATIC FIELDS
|
* STATIC FIELDS
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final static TextProcessor<TextHighlighter.Result, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
|
private final static TextProcessor<TextHighlighter.Result, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*
|
*
|
||||||
* FIELDS
|
* FIELDS
|
||||||
*
|
*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private volatile CalculatorDisplayViewState state = CalculatorDisplayViewStateImpl.newDefaultInstance();
|
private volatile CalculatorDisplayViewState state = CalculatorDisplayViewStateImpl.newDefaultInstance();
|
||||||
|
|
||||||
private volatile boolean viewStateChange = false;
|
private volatile boolean viewStateChange = false;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
|
|
||||||
/*
|
private volatile boolean initialized = false;
|
||||||
**********************************************************************
|
|
||||||
*
|
/*
|
||||||
* CONSTRUCTORS
|
**********************************************************************
|
||||||
*
|
*
|
||||||
**********************************************************************
|
* CONSTRUCTORS
|
||||||
*/
|
*
|
||||||
|
**********************************************************************
|
||||||
public AndroidCalculatorDisplayView(Context context) {
|
*/
|
||||||
super(context);
|
|
||||||
this.addTextChangedListener(new TextWatcherImpl());
|
public AndroidCalculatorDisplayView(Context context) {
|
||||||
}
|
super(context);
|
||||||
|
this.addTextChangedListener(new TextWatcherImpl());
|
||||||
public AndroidCalculatorDisplayView(Context context, AttributeSet attrs) {
|
}
|
||||||
super(context, attrs);
|
|
||||||
this.addTextChangedListener(new TextWatcherImpl());
|
public AndroidCalculatorDisplayView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
}
|
this.addTextChangedListener(new TextWatcherImpl());
|
||||||
|
|
||||||
public AndroidCalculatorDisplayView(Context context, AttributeSet attrs, int defStyle) {
|
}
|
||||||
super(context, attrs, defStyle);
|
|
||||||
this.addTextChangedListener(new TextWatcherImpl());
|
public AndroidCalculatorDisplayView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
}
|
super(context, attrs, defStyle);
|
||||||
|
this.addTextChangedListener(new TextWatcherImpl());
|
||||||
/*
|
}
|
||||||
**********************************************************************
|
|
||||||
*
|
/*
|
||||||
* METHODS
|
**********************************************************************
|
||||||
*
|
*
|
||||||
**********************************************************************
|
* METHODS
|
||||||
*/
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
@Override
|
|
||||||
public void setState(@NotNull final CalculatorDisplayViewState state) {
|
|
||||||
final CharSequence text = prepareText(state.getStringResult(), state.isValid());
|
@Override
|
||||||
|
public void setState(@NotNull final CalculatorDisplayViewState state) {
|
||||||
handler.post(new Runnable() {
|
final CharSequence text = prepareText(state.getStringResult(), state.isValid());
|
||||||
@Override
|
|
||||||
public void run() {
|
handler.post(new Runnable() {
|
||||||
synchronized (lock) {
|
@Override
|
||||||
try {
|
public void run() {
|
||||||
viewStateChange = true;
|
synchronized (lock) {
|
||||||
|
try {
|
||||||
AndroidCalculatorDisplayView.this.state = state;
|
viewStateChange = true;
|
||||||
if (state.isValid()) {
|
|
||||||
setTextColor(getResources().getColor(R.color.default_text_color));
|
AndroidCalculatorDisplayView.this.state = state;
|
||||||
setText(text);
|
if (state.isValid()) {
|
||||||
|
setTextColor(getResources().getColor(R.color.default_text_color));
|
||||||
adjustTextSize();
|
setText(text);
|
||||||
|
|
||||||
} else {
|
adjustTextSize();
|
||||||
// update text in order to get rid of HTML tags
|
|
||||||
setText(getText().toString());
|
} else {
|
||||||
setTextColor(getResources().getColor(R.color.display_error_text_color));
|
// update text in order to get rid of HTML tags
|
||||||
|
setText(getText().toString());
|
||||||
// error messages are never shown -> just greyed out text (error message will be shown on click)
|
setTextColor(getResources().getColor(R.color.display_error_text_color));
|
||||||
//setText(state.getErrorMessage());
|
|
||||||
//redraw();
|
// error messages are never shown -> just greyed out text (error message will be shown on click)
|
||||||
}
|
//setText(state.getErrorMessage());
|
||||||
} finally {
|
//redraw();
|
||||||
viewStateChange = false;
|
}
|
||||||
}
|
} finally {
|
||||||
}
|
viewStateChange = false;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
@NotNull
|
}
|
||||||
@Override
|
|
||||||
public CalculatorDisplayViewState getState() {
|
@NotNull
|
||||||
synchronized (lock) {
|
@Override
|
||||||
return this.state;
|
public CalculatorDisplayViewState getState() {
|
||||||
}
|
synchronized (lock) {
|
||||||
}
|
return this.state;
|
||||||
|
}
|
||||||
@Nullable
|
}
|
||||||
private static CharSequence prepareText(@Nullable String text, boolean valid) {
|
|
||||||
CharSequence result;
|
@Nullable
|
||||||
|
private static CharSequence prepareText(@Nullable String text, boolean valid) {
|
||||||
if (valid && text != null) {
|
CharSequence result;
|
||||||
|
|
||||||
//Log.d(this.getClass().getName(), text);
|
if (valid && text != null) {
|
||||||
|
|
||||||
try {
|
//Log.d(this.getClass().getName(), text);
|
||||||
final TextHighlighter.Result processedText = textHighlighter.process(text);
|
|
||||||
text = processedText.toString();
|
try {
|
||||||
result = Html.fromHtml(text);
|
final TextHighlighter.Result processedText = textHighlighter.process(text);
|
||||||
} catch (CalculatorParseException e) {
|
text = processedText.toString();
|
||||||
result = text;
|
result = Html.fromHtml(text);
|
||||||
}
|
} catch (CalculatorParseException e) {
|
||||||
} else {
|
result = text;
|
||||||
result = text;
|
}
|
||||||
}
|
} else {
|
||||||
|
result = text;
|
||||||
return result;
|
}
|
||||||
}
|
|
||||||
|
return result;
|
||||||
private void adjustTextSize() {
|
}
|
||||||
// todo serso: think where to move it (keep in mind org.solovyev.android.view.AutoResizeTextView.resetTextSize())
|
|
||||||
setAddEllipsis(false);
|
private void adjustTextSize() {
|
||||||
setMinTextSize(10);
|
// todo serso: think where to move it (keep in mind org.solovyev.android.view.AutoResizeTextView.resetTextSize())
|
||||||
resizeText();
|
setAddEllipsis(false);
|
||||||
}
|
setMinTextSize(10);
|
||||||
|
resizeText();
|
||||||
|
}
|
||||||
public void handleTextChange(Editable s) {
|
|
||||||
synchronized (lock) {
|
|
||||||
if (!viewStateChange) {
|
public void handleTextChange(Editable s) {
|
||||||
// external text change => need to notify display
|
synchronized (lock) {
|
||||||
// todo serso: implement
|
if (!viewStateChange) {
|
||||||
}
|
// external text change => need to notify display
|
||||||
}
|
// todo serso: implement
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private final class TextWatcherImpl implements TextWatcher {
|
}
|
||||||
|
|
||||||
@Override
|
public synchronized void init(@NotNull Context context) {
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
if (!initialized) {
|
||||||
|
this.setOnClickListener(new CalculatorDisplayOnClickListener(context));
|
||||||
}
|
|
||||||
|
this.initialized = true;
|
||||||
@Override
|
}
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
}
|
||||||
}
|
|
||||||
|
private final class TextWatcherImpl implements TextWatcher {
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
@Override
|
||||||
handleTextChange(s);
|
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) {
|
||||||
|
handleTextChange(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,204 +1,213 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||||
* For more information, please, contact se.solovyev@gmail.com
|
* For more information, please, contact se.solovyev@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.Editable;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.Html;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.Html;
|
||||||
import android.util.AttributeSet;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
import android.util.AttributeSet;
|
||||||
import android.view.ContextMenu;
|
import android.util.Log;
|
||||||
import android.widget.EditText;
|
import android.view.ContextMenu;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import android.widget.EditText;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.calculator.text.TextProcessor;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.android.calculator.view.TextHighlighter;
|
import org.solovyev.android.calculator.text.TextProcessor;
|
||||||
import org.solovyev.common.collections.CollectionsUtils;
|
import org.solovyev.android.calculator.view.TextHighlighter;
|
||||||
|
import org.solovyev.common.collections.CollectionsUtils;
|
||||||
/**
|
|
||||||
* User: serso
|
/**
|
||||||
* Date: 9/17/11
|
* User: serso
|
||||||
* Time: 12:25 AM
|
* Date: 9/17/11
|
||||||
*/
|
* Time: 12:25 AM
|
||||||
public class AndroidCalculatorEditorView extends EditText implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEditorView {
|
*/
|
||||||
|
public class AndroidCalculatorEditorView extends EditText implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEditorView {
|
||||||
private static final String CALC_COLOR_DISPLAY_KEY = "org.solovyev.android.calculator.CalculatorModel_color_display";
|
|
||||||
private static final boolean CALC_COLOR_DISPLAY_DEFAULT = true;
|
private static final String CALC_COLOR_DISPLAY_KEY = "org.solovyev.android.calculator.CalculatorModel_color_display";
|
||||||
|
private static final boolean CALC_COLOR_DISPLAY_DEFAULT = true;
|
||||||
private boolean highlightText = true;
|
|
||||||
|
private volatile boolean initialized = false;
|
||||||
@NotNull
|
|
||||||
private final static TextProcessor<TextHighlighter.Result, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
|
private boolean highlightText = true;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private volatile CalculatorEditorViewState viewState = CalculatorEditorViewStateImpl.newDefaultInstance();
|
private final static TextProcessor<TextHighlighter.Result, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
|
||||||
|
|
||||||
private volatile boolean viewStateChange = false;
|
@NotNull
|
||||||
|
private volatile CalculatorEditorViewState viewState = CalculatorEditorViewStateImpl.newDefaultInstance();
|
||||||
// NOTE: static because super constructor calls some overridden methods (like onSelectionChanged and current lock is not yet created)
|
|
||||||
@NotNull
|
private volatile boolean viewStateChange = false;
|
||||||
private static final Object lock = new Object();
|
|
||||||
|
// NOTE: static because super constructor calls some overridden methods (like onSelectionChanged and current lock is not yet created)
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Handler handler = new Handler();
|
private static final Object lock = new Object();
|
||||||
|
|
||||||
public AndroidCalculatorEditorView(Context context) {
|
@NotNull
|
||||||
super(context);
|
private final Handler handler = new Handler();
|
||||||
this.addTextChangedListener(new TextWatcherImpl());
|
|
||||||
}
|
public AndroidCalculatorEditorView(Context context) {
|
||||||
|
super(context);
|
||||||
public AndroidCalculatorEditorView(Context context, AttributeSet attrs) {
|
}
|
||||||
super(context, attrs);
|
|
||||||
this.addTextChangedListener(new TextWatcherImpl());
|
public AndroidCalculatorEditorView(Context context, AttributeSet attrs) {
|
||||||
}
|
super(context, attrs);
|
||||||
|
}
|
||||||
public AndroidCalculatorEditorView(Context context, AttributeSet attrs, int defStyle) {
|
|
||||||
super(context, attrs, defStyle);
|
public AndroidCalculatorEditorView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
this.addTextChangedListener(new TextWatcherImpl());
|
super(context, attrs, defStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Override
|
public boolean onCheckIsTextEditor() {
|
||||||
public boolean onCheckIsTextEditor() {
|
// NOTE: code below can be used carefully and should not be copied without special intention
|
||||||
// NOTE: code below can be used carefully and should not be copied without special intention
|
// The main purpose of code is to disable soft input (virtual keyboard) but leave all the TextEdit functionality, like cursor, scrolling, copy/paste menu etc
|
||||||
// The main purpose of code is to disable soft input (virtual keyboard) but leave all the TextEdit functionality, like cursor, scrolling, copy/paste menu etc
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 11) {
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
// fix for missing cursor in android 3 and higher
|
||||||
// fix for missing cursor in android 3 and higher
|
try {
|
||||||
try {
|
// IDEA: return false always except if method was called from TextView.isCursorVisible() method
|
||||||
// IDEA: return false always except if method was called from TextView.isCursorVisible() method
|
for (StackTraceElement stackTraceElement : CollectionsUtils.asList(Thread.currentThread().getStackTrace())) {
|
||||||
for (StackTraceElement stackTraceElement : CollectionsUtils.asList(Thread.currentThread().getStackTrace())) {
|
if ("isCursorVisible".equals(stackTraceElement.getMethodName())) {
|
||||||
if ("isCursorVisible".equals(stackTraceElement.getMethodName())) {
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (RuntimeException e) {
|
||||||
} catch (RuntimeException e) {
|
// just in case...
|
||||||
// just in case...
|
}
|
||||||
}
|
|
||||||
|
return false;
|
||||||
return false;
|
} else {
|
||||||
} else {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
protected void onCreateContextMenu(ContextMenu menu) {
|
||||||
protected void onCreateContextMenu(ContextMenu menu) {
|
super.onCreateContextMenu(menu);
|
||||||
super.onCreateContextMenu(menu);
|
|
||||||
|
menu.removeItem(android.R.id.selectAll);
|
||||||
menu.removeItem(android.R.id.selectAll);
|
}
|
||||||
}
|
|
||||||
|
@Nullable
|
||||||
@Nullable
|
private CharSequence prepareText(@NotNull String text, boolean highlightText) {
|
||||||
private CharSequence prepareText(@NotNull String text, boolean highlightText) {
|
CharSequence result;
|
||||||
CharSequence result;
|
|
||||||
|
if (highlightText) {
|
||||||
if (highlightText) {
|
|
||||||
|
try {
|
||||||
try {
|
final TextHighlighter.Result processesText = textHighlighter.process(text);
|
||||||
final TextHighlighter.Result processesText = textHighlighter.process(text);
|
|
||||||
|
assert processesText.getOffset() == 0;
|
||||||
assert processesText.getOffset() == 0;
|
|
||||||
|
result = Html.fromHtml(processesText.toString());
|
||||||
result = Html.fromHtml(processesText.toString());
|
} catch (CalculatorParseException e) {
|
||||||
} catch (CalculatorParseException e) {
|
// set raw text
|
||||||
// set raw text
|
result = text;
|
||||||
result = text;
|
|
||||||
|
Log.e(this.getClass().getName(), e.getMessage(), e);
|
||||||
Log.e(this.getClass().getName(), e.getMessage(), e);
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
result = text;
|
||||||
result = text;
|
}
|
||||||
}
|
|
||||||
|
return result;
|
||||||
return result;
|
}
|
||||||
}
|
|
||||||
|
public boolean isHighlightText() {
|
||||||
public boolean isHighlightText() {
|
return highlightText;
|
||||||
return highlightText;
|
}
|
||||||
}
|
|
||||||
|
public void setHighlightText(boolean highlightText) {
|
||||||
public void setHighlightText(boolean highlightText) {
|
this.highlightText = highlightText;
|
||||||
this.highlightText = highlightText;
|
CalculatorLocatorImpl.getInstance().getEditor().updateViewState();
|
||||||
CalculatorLocatorImpl.getInstance().getEditor().updateViewState();
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
if (CALC_COLOR_DISPLAY_KEY.equals(key)) {
|
||||||
if (CALC_COLOR_DISPLAY_KEY.equals(key)) {
|
this.setHighlightText(preferences.getBoolean(CALC_COLOR_DISPLAY_KEY, CALC_COLOR_DISPLAY_DEFAULT));
|
||||||
this.setHighlightText(preferences.getBoolean(CALC_COLOR_DISPLAY_KEY, CALC_COLOR_DISPLAY_DEFAULT));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public synchronized void init(@NotNull Context context) {
|
||||||
public void init(@NotNull SharedPreferences preferences) {
|
if (!initialized) {
|
||||||
onSharedPreferenceChanged(preferences, CALC_COLOR_DISPLAY_KEY);
|
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
}
|
|
||||||
|
preferences.registerOnSharedPreferenceChangeListener(this);
|
||||||
@Override
|
|
||||||
public void setState(@NotNull final CalculatorEditorViewState viewState) {
|
this.addTextChangedListener(new TextWatcherImpl());
|
||||||
|
|
||||||
final CharSequence text = prepareText(viewState.getText(), highlightText);
|
onSharedPreferenceChanged(preferences, CALC_COLOR_DISPLAY_KEY);
|
||||||
|
|
||||||
handler.post(new Runnable() {
|
initialized = true;
|
||||||
@Override
|
}
|
||||||
public void run() {
|
}
|
||||||
final AndroidCalculatorEditorView editorView = AndroidCalculatorEditorView.this;
|
|
||||||
synchronized (lock) {
|
@Override
|
||||||
try {
|
public void setState(@NotNull final CalculatorEditorViewState viewState) {
|
||||||
editorView.viewStateChange = true;
|
|
||||||
editorView.viewState = viewState;
|
final CharSequence text = prepareText(viewState.getText(), highlightText);
|
||||||
editorView.setText(text, BufferType.EDITABLE);
|
|
||||||
editorView.setSelection(viewState.getSelection());
|
handler.post(new Runnable() {
|
||||||
} finally {
|
@Override
|
||||||
editorView.viewStateChange = false;
|
public void run() {
|
||||||
}
|
final AndroidCalculatorEditorView editorView = AndroidCalculatorEditorView.this;
|
||||||
}
|
synchronized (lock) {
|
||||||
}
|
try {
|
||||||
});
|
editorView.viewStateChange = true;
|
||||||
}
|
editorView.viewState = viewState;
|
||||||
|
editorView.setText(text, BufferType.EDITABLE);
|
||||||
@Override
|
editorView.setSelection(viewState.getSelection());
|
||||||
protected void onSelectionChanged(int selStart, int selEnd) {
|
} finally {
|
||||||
synchronized (lock) {
|
editorView.viewStateChange = false;
|
||||||
if (!viewStateChange) {
|
}
|
||||||
// external text change => need to notify editor
|
}
|
||||||
super.onSelectionChanged(selStart, selEnd);
|
}
|
||||||
CalculatorLocatorImpl.getInstance().getEditor().setSelection(selStart);
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
@Override
|
||||||
|
protected void onSelectionChanged(int selStart, int selEnd) {
|
||||||
public void handleTextChange(Editable s) {
|
synchronized (lock) {
|
||||||
synchronized (lock) {
|
if (!viewStateChange) {
|
||||||
if (!viewStateChange) {
|
// external text change => need to notify editor
|
||||||
// external text change => need to notify editor
|
super.onSelectionChanged(selStart, selEnd);
|
||||||
CalculatorLocatorImpl.getInstance().getEditor().setText(String.valueOf(s));
|
CalculatorLocatorImpl.getInstance().getEditor().setSelection(selStart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class TextWatcherImpl implements TextWatcher {
|
public void handleTextChange(Editable s) {
|
||||||
|
synchronized (lock) {
|
||||||
@Override
|
if (!viewStateChange) {
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
// external text change => need to notify editor
|
||||||
|
CalculatorLocatorImpl.getInstance().getEditor().setText(String.valueOf(s));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
}
|
private final class TextWatcherImpl implements TextWatcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
handleTextChange(s);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
handleTextChange(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
|||||||
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: Solovyev_S
|
||||||
|
* Date: 25.09.12
|
||||||
|
* Time: 12:03
|
||||||
|
*/
|
||||||
|
public class CalculatorDisplayFragment extends Fragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
return inflater.inflate(R.layout.calc_display, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
((AndroidCalculator) CalculatorLocatorImpl.getInstance().getCalculator()).setDisplay(getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
@ -1,53 +1,53 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.menu.AMenuBuilder;
|
import org.solovyev.android.menu.AMenuBuilder;
|
||||||
import org.solovyev.android.menu.MenuImpl;
|
import org.solovyev.android.menu.MenuImpl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
* Date: 21.09.12
|
* Date: 21.09.12
|
||||||
* Time: 10:58
|
* Time: 10:58
|
||||||
*/
|
*/
|
||||||
public class CalculatorDisplayOnClickListener implements View.OnClickListener {
|
public class CalculatorDisplayOnClickListener implements View.OnClickListener {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Activity activity;
|
private final Context context;
|
||||||
|
|
||||||
public CalculatorDisplayOnClickListener(@NotNull Activity activity) {
|
public CalculatorDisplayOnClickListener(@NotNull Context context) {
|
||||||
this.activity = activity;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v instanceof CalculatorDisplayView) {
|
if (v instanceof CalculatorDisplayView) {
|
||||||
final CalculatorDisplay cd = CalculatorLocatorImpl.getInstance().getDisplay();
|
final CalculatorDisplay cd = CalculatorLocatorImpl.getInstance().getDisplay();
|
||||||
|
|
||||||
final CalculatorDisplayViewState displayViewState = cd.getViewState();
|
final CalculatorDisplayViewState displayViewState = cd.getViewState();
|
||||||
|
|
||||||
if (displayViewState.isValid()) {
|
if (displayViewState.isValid()) {
|
||||||
final List<CalculatorDisplayMenuItem> filteredMenuItems = new ArrayList<CalculatorDisplayMenuItem>(CalculatorDisplayMenuItem.values().length);
|
final List<CalculatorDisplayMenuItem> filteredMenuItems = new ArrayList<CalculatorDisplayMenuItem>(CalculatorDisplayMenuItem.values().length);
|
||||||
for (CalculatorDisplayMenuItem menuItem : CalculatorDisplayMenuItem.values()) {
|
for (CalculatorDisplayMenuItem menuItem : CalculatorDisplayMenuItem.values()) {
|
||||||
if (menuItem.isItemVisible(displayViewState)) {
|
if (menuItem.isItemVisible(displayViewState)) {
|
||||||
filteredMenuItems.add(menuItem);
|
filteredMenuItems.add(menuItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filteredMenuItems.isEmpty()) {
|
if (!filteredMenuItems.isEmpty()) {
|
||||||
AMenuBuilder.newInstance(activity, MenuImpl.newInstance(filteredMenuItems)).create(displayViewState).show();
|
AMenuBuilder.newInstance(context, MenuImpl.newInstance(filteredMenuItems)).create(displayViewState).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final String errorMessage = displayViewState.getErrorMessage();
|
final String errorMessage = displayViewState.getErrorMessage();
|
||||||
if (errorMessage != null) {
|
if (errorMessage != null) {
|
||||||
CalculatorModel.showEvaluationError(activity, errorMessage);
|
AndroidCalculator.showEvaluationError(context, errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: Solovyev_S
|
||||||
|
* Date: 25.09.12
|
||||||
|
* Time: 10:49
|
||||||
|
*/
|
||||||
|
public class CalculatorEditorFragment extends Fragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
return inflater.inflate(R.layout.calc_editor, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
((AndroidCalculator) CalculatorLocatorImpl.getInstance().getCalculator()).setEditor(getActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
|
||||||
* For more information, please, contact se.solovyev@gmail.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.solovyev.android.calculator;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
|
||||||
import org.solovyev.common.gui.CursorControl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User: serso
|
|
||||||
* Date: 9/12/11
|
|
||||||
* Time: 11:15 PM
|
|
||||||
*/
|
|
||||||
public enum CalculatorModel implements CalculatorEngineControl, CursorControl {
|
|
||||||
|
|
||||||
instance;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private final CalculatorEditor editor;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private final CalculatorDisplay display;
|
|
||||||
|
|
||||||
private CalculatorModel() {
|
|
||||||
display = CalculatorLocatorImpl.getInstance().getDisplay();
|
|
||||||
editor = CalculatorLocatorImpl.getInstance().getEditor();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CalculatorModel attachViews(@NotNull final Activity activity, @NotNull SharedPreferences preferences) {
|
|
||||||
Log.d(this.getClass().getName(), "CalculatorModel initialization with activity: " + activity);
|
|
||||||
|
|
||||||
final AndroidCalculatorEditorView editorView = (AndroidCalculatorEditorView) activity.findViewById(R.id.calculatorEditor);
|
|
||||||
editorView.init(preferences);
|
|
||||||
preferences.registerOnSharedPreferenceChangeListener(editorView);
|
|
||||||
editor.setView(editorView);
|
|
||||||
|
|
||||||
final AndroidCalculatorDisplayView displayView = (AndroidCalculatorDisplayView) activity.findViewById(R.id.calculatorDisplay);
|
|
||||||
displayView.setOnClickListener(new CalculatorDisplayOnClickListener(activity));
|
|
||||||
display.setView(displayView);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showEvaluationError(@NotNull Activity activity, @NotNull final String errorMessage) {
|
|
||||||
final LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
|
||||||
|
|
||||||
final View errorMessageView = layoutInflater.inflate(R.layout.display_error_message, null);
|
|
||||||
((TextView) errorMessageView.findViewById(R.id.error_message_text_view)).setText(errorMessage);
|
|
||||||
|
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(activity)
|
|
||||||
.setPositiveButton(R.string.c_cancel, null)
|
|
||||||
.setView(errorMessageView);
|
|
||||||
|
|
||||||
builder.create().show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCursorOnStart() {
|
|
||||||
this.editor.setCursorOnStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCursorOnEnd() {
|
|
||||||
this.editor.setCursorOnEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void moveCursorLeft() {
|
|
||||||
this.editor.moveCursorLeft();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void moveCursorRight() {
|
|
||||||
this.editor.moveCursorRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void evaluate() {
|
|
||||||
CalculatorLocatorImpl.getInstance().getCalculator().evaluate(JsclOperation.numeric, this.editor.getViewState().getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void simplify() {
|
|
||||||
CalculatorLocatorImpl.getInstance().getCalculator().evaluate(JsclOperation.simplify, this.editor.getViewState().getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public CalculatorDisplay getDisplay() {
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
494
pom.xml
494
pom.xml
@ -1,245 +1,251 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>calculatorpp-parent</artifactId>
|
<artifactId>calculatorpp-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.3.2</version>
|
<version>1.3.2</version>
|
||||||
<name>Calculator++</name>
|
<name>Calculator++</name>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>calculatorpp</module>
|
<module>calculatorpp</module>
|
||||||
<module>calculatorpp-test</module>
|
<module>calculatorpp-test</module>
|
||||||
<module>calculatorpp-core</module>
|
<module>calculatorpp-core</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev</groupId>
|
<groupId>org.solovyev</groupId>
|
||||||
<artifactId>common-core</artifactId>
|
<artifactId>common-core</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev</groupId>
|
<groupId>org.solovyev</groupId>
|
||||||
<artifactId>common-text</artifactId>
|
<artifactId>common-text</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-core</artifactId>
|
<artifactId>android-common-core</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-ads</artifactId>
|
<artifactId>android-common-ads</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-view</artifactId>
|
<artifactId>android-common-view</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-preferences</artifactId>
|
<artifactId>android-common-preferences</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-menu</artifactId>
|
<artifactId>android-common-menu</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev</groupId>
|
<groupId>org.solovyev</groupId>
|
||||||
<artifactId>jscl</artifactId>
|
<artifactId>jscl</artifactId>
|
||||||
<version>0.0.2</version>
|
<version>0.0.2</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>xercesImpl</artifactId>
|
<artifactId>xercesImpl</artifactId>
|
||||||
<groupId>xerces</groupId>
|
<groupId>xerces</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<artifactId>android-common-other</artifactId>
|
<artifactId>android-common-other</artifactId>
|
||||||
<type>apklib</type>
|
<type>apklib</type>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.8.2</version>
|
<version>4.8.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.intellij</groupId>
|
<groupId>com.intellij</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<version>7.0.3</version>
|
<version>7.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.android</groupId>
|
<groupId>com.google.android</groupId>
|
||||||
<artifactId>android</artifactId>
|
<artifactId>android</artifactId>
|
||||||
<version>4.0.1.2</version>
|
<version>4.0.1.2</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.android</groupId>
|
<groupId>com.google.android</groupId>
|
||||||
<artifactId>android-test</artifactId>
|
<artifactId>support-v4</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>r7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.android</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>android-test</artifactId>
|
||||||
<version>11.0.2</version>
|
<version>2.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.simpleframework</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>simple-xml</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>2.6.1</version>
|
<version>11.0.2</version>
|
||||||
<exclusions>
|
</dependency>
|
||||||
<exclusion>
|
|
||||||
<artifactId>stax-api</artifactId>
|
<dependency>
|
||||||
<groupId>stax</groupId>
|
<groupId>org.simpleframework</groupId>
|
||||||
</exclusion>
|
<artifactId>simple-xml</artifactId>
|
||||||
<exclusion>
|
<version>2.6.1</version>
|
||||||
<artifactId>xpp3</artifactId>
|
<exclusions>
|
||||||
<groupId>xpp3</groupId>
|
<exclusion>
|
||||||
</exclusion>
|
<artifactId>stax-api</artifactId>
|
||||||
</exclusions>
|
<groupId>stax</groupId>
|
||||||
</dependency>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
</dependencies>
|
<artifactId>xpp3</artifactId>
|
||||||
</dependencyManagement>
|
<groupId>xpp3</groupId>
|
||||||
|
</exclusion>
|
||||||
<build>
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
<plugins>
|
|
||||||
|
</dependencies>
|
||||||
<plugin>
|
</dependencyManagement>
|
||||||
<groupId>com.electriccloud</groupId>
|
|
||||||
<artifactId>javac2-maven-plugin</artifactId>
|
<build>
|
||||||
<version>1.0.1</version>
|
|
||||||
<executions>
|
<plugins>
|
||||||
<execution>
|
|
||||||
<id>@NotNull Instrumentation</id>
|
<plugin>
|
||||||
<goals>
|
<groupId>com.electriccloud</groupId>
|
||||||
<goal>instrument</goal>
|
<artifactId>javac2-maven-plugin</artifactId>
|
||||||
</goals>
|
<version>1.0.1</version>
|
||||||
<!--compile phase instead of process-classes because of proguard.
|
<executions>
|
||||||
@NotNull instrumentation will be done now after compilation and before proguard-->
|
<execution>
|
||||||
<phase>compile</phase>
|
<id>@NotNull Instrumentation</id>
|
||||||
</execution>
|
<goals>
|
||||||
</executions>
|
<goal>instrument</goal>
|
||||||
</plugin>
|
</goals>
|
||||||
|
<!--compile phase instead of process-classes because of proguard.
|
||||||
</plugins>
|
@NotNull instrumentation will be done now after compilation and before proguard-->
|
||||||
|
<phase>compile</phase>
|
||||||
<pluginManagement>
|
</execution>
|
||||||
<plugins>
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</plugins>
|
||||||
<artifactId>maven-jarsigner-plugin</artifactId>
|
|
||||||
<version>1.2</version>
|
<pluginManagement>
|
||||||
</plugin>
|
<plugins>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>android-maven-plugin</artifactId>
|
<artifactId>maven-jarsigner-plugin</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>1.2</version>
|
||||||
<configuration>
|
</plugin>
|
||||||
|
|
||||||
<sourceDirectories>
|
<plugin>
|
||||||
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
|
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||||
</sourceDirectories>
|
<artifactId>android-maven-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
<sdk>
|
<configuration>
|
||||||
<platform>15</platform>
|
|
||||||
</sdk>
|
<sourceDirectories>
|
||||||
|
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
|
||||||
<emulator>
|
</sourceDirectories>
|
||||||
<avd>23</avd>
|
|
||||||
<wait>10000</wait>
|
<sdk>
|
||||||
<!--<options>-no-skin</options>-->
|
<platform>15</platform>
|
||||||
</emulator>
|
</sdk>
|
||||||
|
|
||||||
<zipalign>
|
<emulator>
|
||||||
<verbose>true</verbose>
|
<avd>23</avd>
|
||||||
</zipalign>
|
<wait>10000</wait>
|
||||||
|
<!--<options>-no-skin</options>-->
|
||||||
<undeployBeforeDeploy>true</undeployBeforeDeploy>
|
</emulator>
|
||||||
|
|
||||||
</configuration>
|
<zipalign>
|
||||||
|
<verbose>true</verbose>
|
||||||
</plugin>
|
</zipalign>
|
||||||
|
|
||||||
<plugin>
|
<undeployBeforeDeploy>true</undeployBeforeDeploy>
|
||||||
<groupId>com.pyx4me</groupId>
|
|
||||||
<artifactId>proguard-maven-plugin</artifactId>
|
</configuration>
|
||||||
<version>2.0.4</version>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>com.pyx4me</groupId>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
<artifactId>proguard-maven-plugin</artifactId>
|
||||||
<version>1.5</version>
|
<version>2.0.4</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
<plugin>
|
||||||
</pluginManagement>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
</build>
|
<version>1.5</version>
|
||||||
|
</plugin>
|
||||||
<profiles>
|
|
||||||
|
</plugins>
|
||||||
<profile>
|
</pluginManagement>
|
||||||
<!-- the standard profile runs instrumentation tests -->
|
|
||||||
<id>standard</id>
|
</build>
|
||||||
</profile>
|
|
||||||
|
<profiles>
|
||||||
<profile>
|
|
||||||
<!-- the release profile does sign, proguard, zipalign -->
|
<profile>
|
||||||
<id>release</id>
|
<!-- the standard profile runs instrumentation tests -->
|
||||||
<!-- via this activation the profile is automatically used when the release is done with the maven release
|
<id>standard</id>
|
||||||
plugin -->
|
</profile>
|
||||||
<activation>
|
|
||||||
<property>
|
<profile>
|
||||||
<name>performRelease</name>
|
<!-- the release profile does sign, proguard, zipalign -->
|
||||||
<value>true</value>
|
<id>release</id>
|
||||||
</property>
|
<!-- via this activation the profile is automatically used when the release is done with the maven release
|
||||||
</activation>
|
plugin -->
|
||||||
|
<activation>
|
||||||
</profile>
|
<property>
|
||||||
</profiles>
|
<name>performRelease</name>
|
||||||
|
<value>true</value>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
Loading…
Reference in New Issue
Block a user