Fragments
This commit is contained in:
parent
631ea40c15
commit
c6c2682362
@ -1,70 +1,70 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="81" android:versionName="1.3.2"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="81" android:versionName="1.3.2"
|
||||||
package="org.solovyev.android.calculator">
|
package="org.solovyev.android.calculator">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="com.android.vending.BILLING"/>
|
<uses-permission android:name="com.android.vending.BILLING"/>
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
|
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
|
||||||
|
|
||||||
<application android:debuggable="true" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication">
|
<application android:debuggable="true" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/metro_blue_theme">
|
||||||
|
|
||||||
<activity android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
|
<activity android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!--NOTE: a:configChanges="orientation|keyboardHidden" is needed to correct work of dialog windows (not to close them on orientation change) -->
|
<!--NOTE: a:configChanges="orientation|keyboardHidden" is needed to correct work of dialog windows (not to close them on orientation change) -->
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_app_settings" android:name=".CalculatorPreferencesActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_app_settings" android:name=".CalculatorPreferencesActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_app_history" android:name=".history.CalculatorHistoryTabActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_app_history" android:name=".history.CalculatorHistoryFragmentActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_history" android:name=".history.HistoryActivityTab"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_history" android:name=".history.CalculatorHistoryFragment"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_saved_history" android:name=".history.SavedHistoryActivityTab"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_saved_history" android:name=".history.CalculatorSavedHistoryFragment"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_about" android:name=".about.CalculatorAboutTabActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_about" android:name=".about.CalculatorAboutTabActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_about" android:name=".about.CalculatorAboutActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_about" android:name=".about.CalculatorAboutActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_about" android:name=".about.CalculatorReleaseNotesActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_about" android:name=".about.CalculatorReleaseNotesActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.CalculatorHelpTabActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.CalculatorHelpTabActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.HelpFaqActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.HelpFaqActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.HelpHintsActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.HelpHintsActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.HelpScreensActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_help" android:name=".help.HelpScreensActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsTabActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsTabActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_operators" android:name=".math.edit.CalculatorOperatorsActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_operators" android:name=".math.edit.CalculatorOperatorsActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsTabActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsTabActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsActivity"/>
|
<activity android:configChanges="orientation|keyboardHidden" android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsActivity"/>
|
||||||
|
|
||||||
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/>
|
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/>
|
||||||
|
|
||||||
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity"/>
|
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity"/>
|
||||||
|
|
||||||
<service android:name="net.robotmedia.billing.BillingService"/>
|
<service android:name="net.robotmedia.billing.BillingService"/>
|
||||||
<receiver android:name="net.robotmedia.billing.BillingReceiver">
|
<receiver android:name="net.robotmedia.billing.BillingReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.android.vending.billing.IN_APP_NOTIFY"/>
|
<action android:name="com.android.vending.billing.IN_APP_NOTIFY"/>
|
||||||
<action android:name="com.android.vending.billing.RESPONSE_CODE"/>
|
<action android:name="com.android.vending.billing.RESPONSE_CODE"/>
|
||||||
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"/>
|
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
@ -1,322 +1,336 @@
|
|||||||
<?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.android</groupId>
|
||||||
<artifactId>jscl</artifactId>
|
<artifactId>android-common-sherlock</artifactId>
|
||||||
</dependency>
|
<version>1.0.0</version>
|
||||||
|
<type>apklib</type>
|
||||||
<!--OTHER-->
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.android</groupId>
|
<dependency>
|
||||||
<artifactId>android</artifactId>
|
<groupId>org.solovyev</groupId>
|
||||||
<scope>provided</scope>
|
<artifactId>jscl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!--OTHER-->
|
||||||
<groupId>com.google.android</groupId>
|
|
||||||
<artifactId>support-v4</artifactId>
|
<dependency>
|
||||||
</dependency>
|
<groupId>com.google.android</groupId>
|
||||||
|
<artifactId>android</artifactId>
|
||||||
<dependency>
|
<scope>provided</scope>
|
||||||
<groupId>net.sf.opencsv</groupId>
|
</dependency>
|
||||||
<artifactId>opencsv</artifactId>
|
|
||||||
<version>2.0</version>
|
<dependency>
|
||||||
<scope>test</scope>
|
<groupId>com.google.android</groupId>
|
||||||
</dependency>
|
<artifactId>support-v4</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.simpleframework</groupId>
|
<dependency>
|
||||||
<artifactId>simple-xml</artifactId>
|
<groupId>com.actionbarsherlock</groupId>
|
||||||
</dependency>
|
<artifactId>library</artifactId>
|
||||||
|
<version>4.1.0</version>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>achartengine</groupId>
|
|
||||||
<artifactId>achartengine</artifactId>
|
<dependency>
|
||||||
<version>0.7.0</version>
|
<groupId>net.sf.opencsv</groupId>
|
||||||
</dependency>
|
<artifactId>opencsv</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
<dependency>
|
<scope>test</scope>
|
||||||
<groupId>admob</groupId>
|
</dependency>
|
||||||
<artifactId>admob</artifactId>
|
|
||||||
<version>6.1.0</version>
|
<dependency>
|
||||||
</dependency>
|
<groupId>org.simpleframework</groupId>
|
||||||
|
<artifactId>simple-xml</artifactId>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.solovyev.android</groupId>
|
|
||||||
<artifactId>billing</artifactId>
|
<dependency>
|
||||||
<version>0.1</version>
|
<groupId>achartengine</groupId>
|
||||||
<!--<type>apklib</type>-->
|
<artifactId>achartengine</artifactId>
|
||||||
</dependency>
|
<version>0.7.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.guava</groupId>
|
<dependency>
|
||||||
<artifactId>guava</artifactId>
|
<groupId>admob</groupId>
|
||||||
<version>11.0.2</version>
|
<artifactId>admob</artifactId>
|
||||||
</dependency>
|
<version>6.1.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
<dependency>
|
||||||
<artifactId>junit</artifactId>
|
<groupId>org.solovyev.android</groupId>
|
||||||
<scope>test</scope>
|
<artifactId>billing</artifactId>
|
||||||
</dependency>
|
<version>0.1</version>
|
||||||
|
<!--<type>apklib</type>-->
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>com.intellij</groupId>
|
|
||||||
<artifactId>annotations</artifactId>
|
<dependency>
|
||||||
</dependency>
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
</dependencies>
|
<version>11.0.2</version>
|
||||||
|
</dependency>
|
||||||
<build>
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
<plugins>
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
<plugin>
|
</dependency>
|
||||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
|
||||||
<artifactId>android-maven-plugin</artifactId>
|
<dependency>
|
||||||
<extensions>true</extensions>
|
<groupId>com.intellij</groupId>
|
||||||
<configuration>
|
<artifactId>annotations</artifactId>
|
||||||
<manifest>
|
</dependency>
|
||||||
<debuggable>true</debuggable>
|
|
||||||
</manifest>
|
</dependencies>
|
||||||
</configuration>
|
|
||||||
<executions>
|
<build>
|
||||||
<execution>
|
|
||||||
<id>manifestUpdate</id>
|
|
||||||
<phase>process-resources</phase>
|
<plugins>
|
||||||
<goals>
|
|
||||||
<goal>manifest-update</goal>
|
<plugin>
|
||||||
</goals>
|
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||||
</execution>
|
<artifactId>android-maven-plugin</artifactId>
|
||||||
<execution>
|
<extensions>true</extensions>
|
||||||
<id>alignApk</id>
|
<configuration>
|
||||||
<phase>package</phase>
|
<manifest>
|
||||||
<goals>
|
<debuggable>true</debuggable>
|
||||||
<goal>zipalign</goal>
|
</manifest>
|
||||||
</goals>
|
</configuration>
|
||||||
</execution>
|
<executions>
|
||||||
</executions>
|
<execution>
|
||||||
</plugin>
|
<id>manifestUpdate</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
</plugins>
|
<goals>
|
||||||
|
<goal>manifest-update</goal>
|
||||||
</build>
|
</goals>
|
||||||
|
</execution>
|
||||||
<profiles>
|
<execution>
|
||||||
|
<id>alignApk</id>
|
||||||
<profile>
|
<phase>package</phase>
|
||||||
<id>release</id>
|
<goals>
|
||||||
<!-- via this activation the profile is automatically used when the release is done with the maven release
|
<goal>zipalign</goal>
|
||||||
plugin -->
|
</goals>
|
||||||
<activation>
|
</execution>
|
||||||
<property>
|
</executions>
|
||||||
<name>performRelease</name>
|
</plugin>
|
||||||
<value>true</value>
|
|
||||||
</property>
|
</plugins>
|
||||||
</activation>
|
|
||||||
|
</build>
|
||||||
<build>
|
|
||||||
<plugins>
|
<profiles>
|
||||||
|
|
||||||
<plugin>
|
<profile>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<id>release</id>
|
||||||
<artifactId>properties-maven-plugin</artifactId>
|
<!-- via this activation the profile is automatically used when the release is done with the maven release
|
||||||
<version>1.0-alpha-2</version>
|
plugin -->
|
||||||
<executions>
|
<activation>
|
||||||
<execution>
|
<property>
|
||||||
<phase>initialize</phase>
|
<name>performRelease</name>
|
||||||
<goals>
|
<value>true</value>
|
||||||
<goal>read-project-properties</goal>
|
</property>
|
||||||
</goals>
|
</activation>
|
||||||
<configuration>
|
|
||||||
<files>
|
<build>
|
||||||
<file>${project.basedir}/misc/env/jarsigner.properties</file>
|
<plugins>
|
||||||
</files>
|
|
||||||
</configuration>
|
<plugin>
|
||||||
</execution>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
</executions>
|
<artifactId>properties-maven-plugin</artifactId>
|
||||||
</plugin>
|
<version>1.0-alpha-2</version>
|
||||||
|
<executions>
|
||||||
<plugin>
|
<execution>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<phase>initialize</phase>
|
||||||
<artifactId>maven-jarsigner-plugin</artifactId>
|
<goals>
|
||||||
<executions>
|
<goal>read-project-properties</goal>
|
||||||
<execution>
|
</goals>
|
||||||
<id>signing</id>
|
<configuration>
|
||||||
<goals>
|
<files>
|
||||||
<goal>sign</goal>
|
<file>${project.basedir}/misc/env/jarsigner.properties</file>
|
||||||
<goal>verify</goal>
|
</files>
|
||||||
</goals>
|
</configuration>
|
||||||
<phase>package</phase>
|
</execution>
|
||||||
<inherited>true</inherited>
|
</executions>
|
||||||
<configuration>
|
</plugin>
|
||||||
<removeExistingSignatures>true</removeExistingSignatures>
|
|
||||||
<archiveDirectory/>
|
<plugin>
|
||||||
<includes>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<include>${project.build.directory}/${project.artifactId}-${project.version}.apk</include>
|
<artifactId>maven-jarsigner-plugin</artifactId>
|
||||||
</includes>
|
<executions>
|
||||||
<keystore>${sign.keystore}</keystore>
|
<execution>
|
||||||
<alias>${sign.alias}</alias>
|
<id>signing</id>
|
||||||
<storepass>${sign.storepass}</storepass>
|
<goals>
|
||||||
<keypass>${sign.keypass}</keypass>
|
<goal>sign</goal>
|
||||||
<verbose>false</verbose>
|
<goal>verify</goal>
|
||||||
</configuration>
|
</goals>
|
||||||
</execution>
|
<phase>package</phase>
|
||||||
</executions>
|
<inherited>true</inherited>
|
||||||
</plugin>
|
<configuration>
|
||||||
|
<removeExistingSignatures>true</removeExistingSignatures>
|
||||||
<!-- the signed apk then needs to be zipaligned and we activate proguard and we run the manifest
|
<archiveDirectory/>
|
||||||
update -->
|
<includes>
|
||||||
<plugin>
|
<include>${project.build.directory}/${project.artifactId}-${project.version}.apk</include>
|
||||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
</includes>
|
||||||
<artifactId>android-maven-plugin</artifactId>
|
<keystore>${sign.keystore}</keystore>
|
||||||
<inherited>true</inherited>
|
<alias>${sign.alias}</alias>
|
||||||
<configuration>
|
<storepass>${sign.storepass}</storepass>
|
||||||
|
<keypass>${sign.keypass}</keypass>
|
||||||
<sign>
|
<verbose>false</verbose>
|
||||||
<debug>false</debug>
|
</configuration>
|
||||||
</sign>
|
</execution>
|
||||||
|
</executions>
|
||||||
<zipalign>
|
</plugin>
|
||||||
<verbose>false</verbose>
|
|
||||||
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
|
<!-- the signed apk then needs to be zipaligned and we activate proguard and we run the manifest
|
||||||
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
|
update -->
|
||||||
</zipalign>
|
<plugin>
|
||||||
|
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||||
<manifest>
|
<artifactId>android-maven-plugin</artifactId>
|
||||||
<debuggable>false</debuggable>
|
<inherited>true</inherited>
|
||||||
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
|
<configuration>
|
||||||
</manifest>
|
|
||||||
|
<sign>
|
||||||
<proguard>
|
<debug>false</debug>
|
||||||
<skip>true</skip>
|
</sign>
|
||||||
</proguard>
|
|
||||||
</configuration>
|
<zipalign>
|
||||||
|
<verbose>false</verbose>
|
||||||
<executions>
|
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
|
||||||
<execution>
|
<outputApk>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</outputApk>
|
||||||
<id>manifestUpdate</id>
|
</zipalign>
|
||||||
<phase>process-resources</phase>
|
|
||||||
<goals>
|
<manifest>
|
||||||
<goal>manifest-update</goal>
|
<debuggable>false</debuggable>
|
||||||
</goals>
|
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
|
||||||
</execution>
|
</manifest>
|
||||||
<execution>
|
|
||||||
<id>alignApk</id>
|
<proguard>
|
||||||
<phase>package</phase>
|
<skip>true</skip>
|
||||||
<goals>
|
</proguard>
|
||||||
<goal>zipalign</goal>
|
</configuration>
|
||||||
</goals>
|
|
||||||
</execution>
|
<executions>
|
||||||
</executions>
|
<execution>
|
||||||
</plugin>
|
<id>manifestUpdate</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
<plugin>
|
<goals>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<goal>manifest-update</goal>
|
||||||
<artifactId>build-helper-maven-plugin</artifactId>
|
</goals>
|
||||||
<configuration>
|
</execution>
|
||||||
<artifacts>
|
<execution>
|
||||||
<artifact>
|
<id>alignApk</id>
|
||||||
<file>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</file>
|
<phase>package</phase>
|
||||||
<type>apk</type>
|
<goals>
|
||||||
<classifier>signed-aligned</classifier>
|
<goal>zipalign</goal>
|
||||||
</artifact>
|
</goals>
|
||||||
<artifact>
|
</execution>
|
||||||
<file>${project.build.directory}/proguard/mapping.txt</file>
|
</executions>
|
||||||
<type>map</type>
|
</plugin>
|
||||||
<classifier>release</classifier>
|
|
||||||
</artifact>
|
<plugin>
|
||||||
</artifacts>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
</configuration>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
<executions>
|
<configuration>
|
||||||
<execution>
|
<artifacts>
|
||||||
<id>attach-signed-aligned</id>
|
<artifact>
|
||||||
<phase>package</phase>
|
<file>${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk</file>
|
||||||
<goals>
|
<type>apk</type>
|
||||||
<goal>attach-artifact</goal>
|
<classifier>signed-aligned</classifier>
|
||||||
</goals>
|
</artifact>
|
||||||
</execution>
|
<artifact>
|
||||||
</executions>
|
<file>${project.build.directory}/proguard/mapping.txt</file>
|
||||||
</plugin>
|
<type>map</type>
|
||||||
|
<classifier>release</classifier>
|
||||||
</plugins>
|
</artifact>
|
||||||
</build>
|
</artifacts>
|
||||||
</profile>
|
</configuration>
|
||||||
</profiles>
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-signed-aligned</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>attach-artifact</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -15,5 +15,8 @@ android.library.reference.3=gen-external-apklibs/org.solovyev.android_android-co
|
|||||||
android.library.reference.4=gen-external-apklibs/org.solovyev.android_android-common-preferences_1.0.0
|
android.library.reference.4=gen-external-apklibs/org.solovyev.android_android-common-preferences_1.0.0
|
||||||
android.library.reference.5=gen-external-apklibs/org.solovyev.android_android-common-other_1.0.0
|
android.library.reference.5=gen-external-apklibs/org.solovyev.android_android-common-other_1.0.0
|
||||||
android.library.reference.6=gen-external-apklibs/org.solovyev.android_android-common-menu_1.0.0
|
android.library.reference.6=gen-external-apklibs/org.solovyev.android_android-common-menu_1.0.0
|
||||||
|
android.library.reference.7=gen-external-apklibs/org.solovyev.android_android-common-sherlock_1.0.0
|
||||||
|
android.library.reference.8=gen-external-apklibs/com.actionbarsherlock_library_4.0.2
|
||||||
|
android.library.reference.9=gen-external-apklibs/org.solovyev.android_android-common-list_1.0.0
|
||||||
|
|
||||||
|
|
||||||
|
78
calculatorpp/res/layout-large-land/main_calculator.xml
Normal file
78
calculatorpp/res/layout-large-land/main_calculator.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||||
|
~ For more information, please, contact se.solovyev@gmail.com
|
||||||
|
~ or visit http://se.solovyev.org
|
||||||
|
-->
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:id="@+id/main_layout"
|
||||||
|
a:orientation="horizontal"
|
||||||
|
a:layout_gravity="center"
|
||||||
|
a:background="@color/default_background"
|
||||||
|
a:baselineAligned="false">
|
||||||
|
|
||||||
|
<LinearLayout a:orientation="vertical"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_weight="1">
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/editorContainer"
|
||||||
|
a:layout_weight="2"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="0dp"/>
|
||||||
|
|
||||||
|
<LinearLayout a:layout_weight="1"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="0dp">
|
||||||
|
|
||||||
|
<include layout="@layout/calc_left_button"
|
||||||
|
a:layout_margin="@dimen/button_margin"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
|
<include layout="@layout/calc_erase_button"
|
||||||
|
a:layout_margin="@dimen/button_margin"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/displayContainer"
|
||||||
|
a:layout_margin="@dimen/display_margin"
|
||||||
|
a:layout_weight="4"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<include layout="@layout/calc_clear_button"
|
||||||
|
a:layout_margin="@dimen/button_margin"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
|
<include layout="@layout/calc_right_button"
|
||||||
|
a:layout_margin="@dimen/button_margin"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/keyboardContainer"
|
||||||
|
a:layout_weight="3"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_height="0dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/content_second_pane"
|
||||||
|
a:orientation="vertical"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -1,26 +1,26 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="metro_digit_button_style" parent="button_style">
|
<style name="metro_digit_button_style" parent="button_style">
|
||||||
<item name="android:background">@drawable/metro_button_dark</item>
|
<item name="android:background">@drawable/metro_button_dark</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="metro_control_button_style" parent="metro_digit_button_style">
|
<style name="metro_control_button_style" parent="metro_digit_button_style">
|
||||||
<item name="android:background">@drawable/metro_button_light</item>
|
<item name="android:background">@drawable/metro_button_light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="metro_blue_operation_button_style" parent="metro_digit_button_style">
|
<style name="metro_blue_operation_button_style" parent="metro_digit_button_style">
|
||||||
<item name="android:background">@drawable/metro_button_blue</item>
|
<item name="android:background">@drawable/metro_button_blue</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="metro_control_image_button_style" parent="metro_control_button_style">
|
<style name="metro_control_image_button_style" parent="metro_control_button_style">
|
||||||
<item name="android:padding">6dp</item>
|
<item name="android:padding">6dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="metro_blue_theme">
|
<style name="metro_blue_theme" parent="Theme.Sherlock">
|
||||||
<item name="digitButtonStyle">@style/metro_digit_button_style</item>
|
<item name="digitButtonStyle">@style/metro_digit_button_style</item>
|
||||||
<item name="controlButtonStyle">@style/metro_control_button_style</item>
|
<item name="controlButtonStyle">@style/metro_control_button_style</item>
|
||||||
<item name="controlImageButtonStyle">@style/metro_control_image_button_style</item>
|
<item name="controlImageButtonStyle">@style/metro_control_image_button_style</item>
|
||||||
<item name="operationButtonStyle">@style/metro_blue_operation_button_style</item>
|
<item name="operationButtonStyle">@style/metro_blue_operation_button_style</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -0,0 +1,19 @@
|
|||||||
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 9/25/12
|
||||||
|
* Time: 10:31 PM
|
||||||
|
*/
|
||||||
|
public interface CalculatorActivityHelper {
|
||||||
|
|
||||||
|
void onCreate(@NotNull SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState);
|
||||||
|
|
||||||
|
void onSaveInstanceState(@NotNull SherlockFragmentActivity activity, @NotNull Bundle outState);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
import com.actionbarsherlock.app.ActionBar;
|
||||||
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.solovyev.android.calculator.history.CalculatorHistoryFragment;
|
||||||
|
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 9/25/12
|
||||||
|
* Time: 10:32 PM
|
||||||
|
*/
|
||||||
|
public class CalculatorActivityHelperImpl implements CalculatorActivityHelper {
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* CONSTANTS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
private static final String SELECTED_NAV = "selected_nav";
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
*
|
||||||
|
* FIELDS
|
||||||
|
*
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int layoutId;
|
||||||
|
|
||||||
|
private boolean showActionBarTabs = true;
|
||||||
|
|
||||||
|
private boolean homeIcon = false;
|
||||||
|
|
||||||
|
public CalculatorActivityHelperImpl(int layoutId) {
|
||||||
|
this.layoutId = layoutId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CalculatorActivityHelperImpl(int layoutId, boolean showActionBarTabs, boolean homeIcon) {
|
||||||
|
this.layoutId = layoutId;
|
||||||
|
this.showActionBarTabs = showActionBarTabs;
|
||||||
|
this.homeIcon = homeIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@NotNull final SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState) {
|
||||||
|
activity.setContentView(layoutId);
|
||||||
|
|
||||||
|
final ActionBar actionBar = activity.getSupportActionBar();
|
||||||
|
actionBar.setDisplayUseLogoEnabled(false);
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(homeIcon);
|
||||||
|
actionBar.setDisplayShowHomeEnabled(true);
|
||||||
|
actionBar.setDisplayShowTitleEnabled(true);
|
||||||
|
|
||||||
|
if (showActionBarTabs) {
|
||||||
|
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||||
|
|
||||||
|
addTab(activity, "history", CalculatorHistoryFragment.class, null, R.string.c_history, R.drawable.icon);
|
||||||
|
//addTab(activity, "messages", MessengerChatsFragment.class, null, R.string.c_messages, R.drawable.msg_footer_messages_icon);
|
||||||
|
|
||||||
|
// settings tab
|
||||||
|
final ActionBar.Tab tab = actionBar.newTab();
|
||||||
|
tab.setTag("settings");
|
||||||
|
tab.setText(R.string.c_settings);
|
||||||
|
//tab.setIcon(R.drawable.msg_footer_settings_icon);
|
||||||
|
tab.setTabListener(new ActionBar.TabListener() {
|
||||||
|
@Override
|
||||||
|
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||||
|
activity.startActivity(new Intent(activity.getApplicationContext(), CalculatorPreferencesActivity.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
actionBar.addTab(tab);
|
||||||
|
|
||||||
|
int navPosition = -1;
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
navPosition = savedInstanceState.getInt(SELECTED_NAV, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (navPosition >= 0) {
|
||||||
|
activity.getSupportActionBar().setSelectedNavigationItem(navPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NotNull SherlockFragmentActivity activity, @NotNull Bundle outState) {
|
||||||
|
outState.putInt(SELECTED_NAV, activity.getSupportActionBar().getSelectedNavigationIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addTab(@NotNull SherlockFragmentActivity activity,
|
||||||
|
@NotNull String tag,
|
||||||
|
@NotNull Class<? extends Fragment> fragmentClass,
|
||||||
|
@Nullable Bundle fragmentArgs,
|
||||||
|
int captionResId,
|
||||||
|
int iconResId) {
|
||||||
|
final ActionBar actionBar = activity.getSupportActionBar();
|
||||||
|
final ActionBar.Tab tab = actionBar.newTab();
|
||||||
|
tab.setTag(tag);
|
||||||
|
tab.setText(captionResId);
|
||||||
|
//tab.setIcon(iconResId);
|
||||||
|
tab.setTabListener(new ActionBarFragmentTabListener(activity, tag, fragmentClass, fragmentArgs, R.id.content_second_pane));
|
||||||
|
actionBar.addTab(tab);
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,7 @@ import org.achartengine.ChartFactory;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.android.calculator.about.CalculatorAboutTabActivity;
|
import org.solovyev.android.calculator.about.CalculatorAboutTabActivity;
|
||||||
import org.solovyev.android.calculator.help.CalculatorHelpTabActivity;
|
import org.solovyev.android.calculator.help.CalculatorHelpTabActivity;
|
||||||
import org.solovyev.android.calculator.history.CalculatorHistoryTabActivity;
|
import org.solovyev.android.calculator.history.CalculatorHistoryFragmentActivity;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsTabActivity;
|
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsTabActivity;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorOperatorsActivity;
|
import org.solovyev.android.calculator.math.edit.CalculatorOperatorsActivity;
|
||||||
import org.solovyev.android.calculator.math.edit.CalculatorVarsTabActivity;
|
import org.solovyev.android.calculator.math.edit.CalculatorVarsTabActivity;
|
||||||
@ -25,7 +25,7 @@ import org.solovyev.common.text.StringUtils;
|
|||||||
public class CalculatorActivityLauncher {
|
public class CalculatorActivityLauncher {
|
||||||
|
|
||||||
public static void showHistory(@NotNull final Context context) {
|
public static void showHistory(@NotNull final Context context) {
|
||||||
context.startActivity(new Intent(context, CalculatorHistoryTabActivity.class));
|
context.startActivity(new Intent(context, CalculatorHistoryFragmentActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showHelp(@NotNull final Context context) {
|
public static void showHelp(@NotNull final Context context) {
|
||||||
|
@ -109,4 +109,9 @@ public class CalculatorApplication extends android.app.Application {
|
|||||||
public static void registerOnRemoteStackTrace() {
|
public static void registerOnRemoteStackTrace() {
|
||||||
//Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(null, REMOTE_STACK_TRACE_URL));
|
//Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(null, REMOTE_STACK_TRACE_URL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public CalculatorActivityHelper createCalculatorHistoryHelper(int layoutResId) {
|
||||||
|
return new CalculatorActivityHelperImpl(layoutResId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,16 @@
|
|||||||
|
|
||||||
package org.solovyev.android.calculator.history;
|
package org.solovyev.android.calculator.history;
|
||||||
|
|
||||||
import android.app.ListActivity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.MenuInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import com.actionbarsherlock.app.SherlockListFragment;
|
||||||
import com.google.ads.AdView;
|
import com.google.ads.AdView;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -41,7 +42,8 @@ import java.util.List;
|
|||||||
* Date: 10/15/11
|
* Date: 10/15/11
|
||||||
* Time: 1:13 PM
|
* Time: 1:13 PM
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractHistoryActivity extends ListActivity {
|
public abstract class AbstractCalculatorHistoryFragment extends SherlockListFragment {
|
||||||
|
|
||||||
|
|
||||||
public static final Comparator<CalculatorHistoryState> COMPARATOR = new Comparator<CalculatorHistoryState>() {
|
public static final Comparator<CalculatorHistoryState> COMPARATOR = new Comparator<CalculatorHistoryState>() {
|
||||||
@Override
|
@Override
|
||||||
@ -65,65 +67,73 @@ public abstract class AbstractHistoryActivity extends ListActivity {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private AdView adView;
|
private AdView adView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
return inflater.inflate(R.layout.history_activity, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
adView = AdsController.getInstance().inflateAd(this.getActivity());
|
||||||
|
|
||||||
|
adapter = new HistoryArrayAdapter(this.getActivity(), getLayoutId(), R.id.history_item, new ArrayList<CalculatorHistoryState>());
|
||||||
|
setListAdapter(adapter);
|
||||||
|
|
||||||
|
final ListView lv = getListView();
|
||||||
|
lv.setTextFilterEnabled(true);
|
||||||
|
|
||||||
|
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
public void onItemClick(final AdapterView<?> parent,
|
||||||
|
final View view,
|
||||||
|
final int position,
|
||||||
|
final long id) {
|
||||||
|
|
||||||
|
useHistoryItem((CalculatorHistoryState) parent.getItemAtPosition(position), getActivity());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
||||||
|
final CalculatorHistoryState historyState = (CalculatorHistoryState) parent.getItemAtPosition(position);
|
||||||
|
|
||||||
|
final Context context = getActivity();
|
||||||
|
|
||||||
|
final HistoryItemMenuData data = new HistoryItemMenuData(historyState, adapter);
|
||||||
|
|
||||||
|
final List<HistoryItemMenuItem> menuItems = CollectionsUtils.asList(HistoryItemMenuItem.values());
|
||||||
|
|
||||||
|
if (historyState.isSaved()) {
|
||||||
|
menuItems.remove(HistoryItemMenuItem.save);
|
||||||
|
} else {
|
||||||
|
if (isAlreadySaved(historyState)) {
|
||||||
|
menuItems.remove(HistoryItemMenuItem.save);
|
||||||
|
}
|
||||||
|
menuItems.remove(HistoryItemMenuItem.remove);
|
||||||
|
menuItems.remove(HistoryItemMenuItem.edit);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (historyState.getDisplayState().isValid() && StringUtils.isEmpty(historyState.getDisplayState().getEditorState().getText())) {
|
||||||
|
menuItems.remove(HistoryItemMenuItem.copy_result);
|
||||||
|
}
|
||||||
|
|
||||||
|
final AMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = AMenuBuilder.newInstance(context, MenuImpl.newInstance(menuItems));
|
||||||
|
menuBuilder.create(data).show();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.history_activity);
|
|
||||||
|
|
||||||
adView = AdsController.getInstance().inflateAd(this);
|
|
||||||
|
|
||||||
adapter = new HistoryArrayAdapter(this, getLayoutId(), R.id.history_item, new ArrayList<CalculatorHistoryState>());
|
|
||||||
setListAdapter(adapter);
|
|
||||||
|
|
||||||
final ListView lv = getListView();
|
|
||||||
lv.setTextFilterEnabled(true);
|
|
||||||
|
|
||||||
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
public void onItemClick(final AdapterView<?> parent,
|
|
||||||
final View view,
|
|
||||||
final int position,
|
|
||||||
final long id) {
|
|
||||||
|
|
||||||
useHistoryItem((CalculatorHistoryState) parent.getItemAtPosition(position), AbstractHistoryActivity.this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
|
||||||
final CalculatorHistoryState historyState = (CalculatorHistoryState) parent.getItemAtPosition(position);
|
|
||||||
|
|
||||||
final Context context = AbstractHistoryActivity.this;
|
|
||||||
|
|
||||||
final HistoryItemMenuData data = new HistoryItemMenuData(historyState, adapter);
|
|
||||||
|
|
||||||
final List<HistoryItemMenuItem> menuItems = CollectionsUtils.asList(HistoryItemMenuItem.values());
|
|
||||||
|
|
||||||
if (historyState.isSaved()) {
|
|
||||||
menuItems.remove(HistoryItemMenuItem.save);
|
|
||||||
} else {
|
|
||||||
if (isAlreadySaved(historyState)) {
|
|
||||||
menuItems.remove(HistoryItemMenuItem.save);
|
|
||||||
}
|
|
||||||
menuItems.remove(HistoryItemMenuItem.remove);
|
|
||||||
menuItems.remove(HistoryItemMenuItem.edit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (historyState.getDisplayState().isValid() && StringUtils.isEmpty(historyState.getDisplayState().getEditorState().getText())) {
|
|
||||||
menuItems.remove(HistoryItemMenuItem.copy_result);
|
|
||||||
}
|
|
||||||
|
|
||||||
final AMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = AMenuBuilder.newInstance(context, MenuImpl.newInstance(menuItems));
|
|
||||||
menuBuilder.create(data).show();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
public void onDestroy() {
|
||||||
if ( this.adView != null ) {
|
if ( this.adView != null ) {
|
||||||
this.adView.destroy();
|
this.adView.destroy();
|
||||||
}
|
}
|
||||||
@ -133,7 +143,7 @@ public abstract class AbstractHistoryActivity extends ListActivity {
|
|||||||
protected abstract int getLayoutId();
|
protected abstract int getLayoutId();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
final List<CalculatorHistoryState> historyList = getHistoryList();
|
final List<CalculatorHistoryState> historyList = getHistoryList();
|
||||||
@ -173,7 +183,7 @@ public abstract class AbstractHistoryActivity extends ListActivity {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void useHistoryItem(@NotNull final CalculatorHistoryState historyState, @NotNull AbstractHistoryActivity activity) {
|
public static void useHistoryItem(@NotNull final CalculatorHistoryState historyState, @NotNull Activity activity) {
|
||||||
final EditorHistoryState editorState = historyState.getEditorState();
|
final EditorHistoryState editorState = historyState.getEditorState();
|
||||||
CalculatorLocatorImpl.getInstance().getEditor().setText(StringUtils.getNotEmpty(editorState.getText(), ""), editorState.getCursorPosition());
|
CalculatorLocatorImpl.getInstance().getEditor().setText(StringUtils.getNotEmpty(editorState.getText(), ""), editorState.getCursorPosition());
|
||||||
|
|
||||||
@ -219,7 +229,8 @@ public abstract class AbstractHistoryActivity extends ListActivity {
|
|||||||
return jsclOperation == JsclOperation.simplify ? "≡" : "=";
|
return jsclOperation == JsclOperation.simplify ? "≡" : "=";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// todo serso: menu
|
||||||
|
/* @Override
|
||||||
public boolean onCreateOptionsMenu(android.view.Menu menu) {
|
public boolean onCreateOptionsMenu(android.view.Menu menu) {
|
||||||
final MenuInflater menuInflater = getMenuInflater();
|
final MenuInflater menuInflater = getMenuInflater();
|
||||||
menuInflater.inflate(R.menu.history_menu, menu);
|
menuInflater.inflate(R.menu.history_menu, menu);
|
||||||
@ -240,7 +251,7 @@ public abstract class AbstractHistoryActivity extends ListActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
protected abstract void clearHistory();
|
protected abstract void clearHistory();
|
||||||
|
|
@ -18,7 +18,8 @@ import java.util.List;
|
|||||||
* Date: 12/18/11
|
* Date: 12/18/11
|
||||||
* Time: 7:39 PM
|
* Time: 7:39 PM
|
||||||
*/
|
*/
|
||||||
public class HistoryActivityTab extends AbstractHistoryActivity {
|
public class CalculatorHistoryFragment extends AbstractCalculatorHistoryFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
return R.layout.history;
|
return R.layout.history;
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||||
|
* For more information, please, contact se.solovyev@gmail.com
|
||||||
|
* or visit http://se.solovyev.org
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.solovyev.android.calculator.history;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.solovyev.android.calculator.CalculatorActivityHelper;
|
||||||
|
import org.solovyev.android.calculator.CalculatorApplication;
|
||||||
|
import org.solovyev.android.calculator.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: serso
|
||||||
|
* Date: 12/18/11
|
||||||
|
* Time: 7:37 PM
|
||||||
|
*/
|
||||||
|
public class CalculatorHistoryFragmentActivity extends SherlockFragmentActivity {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createCalculatorHistoryHelper(R.layout.history_activity);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
activityHelper.onCreate(this, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
|
||||||
|
activityHelper.onSaveInstanceState(this, outState);
|
||||||
|
}
|
||||||
|
}
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
|
||||||
* For more information, please, contact se.solovyev@gmail.com
|
|
||||||
* or visit http://se.solovyev.org
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.solovyev.android.calculator.history;
|
|
||||||
|
|
||||||
import android.app.TabActivity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.widget.TabHost;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.solovyev.android.AndroidUtils;
|
|
||||||
import org.solovyev.android.LastTabSaver;
|
|
||||||
import org.solovyev.android.calculator.R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* User: serso
|
|
||||||
* Date: 12/18/11
|
|
||||||
* Time: 7:37 PM
|
|
||||||
*/
|
|
||||||
public class CalculatorHistoryTabActivity extends TabActivity {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private LastTabSaver lastTabSaver;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
setContentView(R.layout.tabs);
|
|
||||||
|
|
||||||
final TabHost tabHost = getTabHost();
|
|
||||||
|
|
||||||
AndroidUtils.addTab(this, tabHost, "saved_history", R.string.c_saved_history, SavedHistoryActivityTab.class);
|
|
||||||
AndroidUtils.addTab(this, tabHost, "history", R.string.c_history, HistoryActivityTab.class);
|
|
||||||
|
|
||||||
this.lastTabSaver = new LastTabSaver(this, "saved_history");
|
|
||||||
|
|
||||||
AndroidUtils.centerAndWrapTabsFor(tabHost);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
if ( this.lastTabSaver != null ) {
|
|
||||||
this.lastTabSaver.destroy();
|
|
||||||
}
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,7 +18,8 @@ import java.util.List;
|
|||||||
* Date: 12/18/11
|
* Date: 12/18/11
|
||||||
* Time: 7:40 PM
|
* Time: 7:40 PM
|
||||||
*/
|
*/
|
||||||
public class SavedHistoryActivityTab extends AbstractHistoryActivity {
|
public class CalculatorSavedHistoryFragment extends AbstractCalculatorHistoryFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
return R.layout.saved_history;
|
return R.layout.saved_history;
|
@ -40,7 +40,7 @@ public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
|
|||||||
time.setText(new SimpleDateFormat().format(new Date(state.getTime())));
|
time.setText(new SimpleDateFormat().format(new Date(state.getTime())));
|
||||||
|
|
||||||
final TextView editor = (TextView) result.findViewById(R.id.history_item);
|
final TextView editor = (TextView) result.findViewById(R.id.history_item);
|
||||||
editor.setText(AbstractHistoryActivity.getHistoryText(state));
|
editor.setText(AbstractCalculatorHistoryFragment.getHistoryText(state));
|
||||||
|
|
||||||
final TextView commentView = (TextView) result.findViewById(R.id.history_item_comment);
|
final TextView commentView = (TextView) result.findViewById(R.id.history_item_comment);
|
||||||
if (commentView != null) {
|
if (commentView != null) {
|
||||||
@ -57,7 +57,7 @@ public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
|
|||||||
if (state.isSaved()) {
|
if (state.isSaved()) {
|
||||||
status.setText(getContext().getString(R.string.c_history_item_saved));
|
status.setText(getContext().getString(R.string.c_history_item_saved));
|
||||||
} else {
|
} else {
|
||||||
if ( AbstractHistoryActivity.isAlreadySaved(state) ) {
|
if ( AbstractCalculatorHistoryFragment.isAlreadySaved(state) ) {
|
||||||
status.setText(getContext().getString(R.string.c_history_item_already_saved));
|
status.setText(getContext().getString(R.string.c_history_item_already_saved));
|
||||||
} else {
|
} else {
|
||||||
status.setText(getContext().getString(R.string.c_history_item_not_saved));
|
status.setText(getContext().getString(R.string.c_history_item_not_saved));
|
||||||
@ -71,7 +71,7 @@ public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
|
|||||||
@Override
|
@Override
|
||||||
public void notifyDataSetChanged() {
|
public void notifyDataSetChanged() {
|
||||||
this.setNotifyOnChange(false);
|
this.setNotifyOnChange(false);
|
||||||
this.sort(AbstractHistoryActivity.COMPARATOR);
|
this.sort(AbstractCalculatorHistoryFragment.COMPARATOR);
|
||||||
this.setNotifyOnChange(true);
|
this.setNotifyOnChange(true);
|
||||||
super.notifyDataSetChanged();
|
super.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
|
|||||||
use(R.string.c_use) {
|
use(R.string.c_use) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
|
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
|
||||||
if (context instanceof AbstractHistoryActivity) {
|
if (context instanceof Activity) {
|
||||||
AbstractHistoryActivity.useHistoryItem(data.getHistoryState(), (AbstractHistoryActivity) context);
|
AbstractCalculatorHistoryFragment.useHistoryItem(data.getHistoryState(), (Activity) context);
|
||||||
} else {
|
} else {
|
||||||
Log.e(HistoryItemMenuItem.class.getName(), AbstractHistoryActivity.class + " must be passed as context!");
|
Log.e(HistoryItemMenuItem.class.getName(), AbstractCalculatorHistoryFragment.class + " must be passed as context!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -110,7 +110,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
|
|||||||
final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
final View editView = layoutInflater.inflate(R.layout.history_edit, null);
|
final View editView = layoutInflater.inflate(R.layout.history_edit, null);
|
||||||
final TextView historyExpression = (TextView)editView.findViewById(R.id.history_edit_expression);
|
final TextView historyExpression = (TextView)editView.findViewById(R.id.history_edit_expression);
|
||||||
historyExpression.setText(AbstractHistoryActivity.getHistoryText(historyState));
|
historyExpression.setText(AbstractCalculatorHistoryFragment.getHistoryText(historyState));
|
||||||
|
|
||||||
final EditText comment = (EditText)editView.findViewById(R.id.history_edit_comment);
|
final EditText comment = (EditText)editView.findViewById(R.id.history_edit_comment);
|
||||||
comment.setText(historyState.getComment());
|
comment.setText(historyState.getComment());
|
||||||
|
Loading…
Reference in New Issue
Block a user