diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..59e5d96d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "plotter"] + path = plotter + url = https://git.bubu1.eu/Bubu/android-plotter.git +[submodule "otto"] + path = otto + url = https://git.bubu1.eu/Bubu/serso-otto.git diff --git a/app/build.gradle b/app/build.gradle index 2bf0e75b..83042fb7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,25 +21,28 @@ */ apply plugin: 'com.android.application' -apply plugin: 'maven' apply plugin: 'signing' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-kapt' android { - compileSdkVersion versions.sdk.compile - buildToolsVersion versions.sdk.buildTools + compileSdk versions.sdk.compile defaultConfig { applicationId "org.solovyev.android.calculator" minSdkVersion versions.sdk.min targetSdkVersion versions.sdk.target - versionCode 158 - versionName '2.2.7' - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + versionCode 161 + versionName '2.3.3' + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' + } + buildFeatures { + dataBinding true + viewBinding true } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard.cfg' - zipAlignEnabled true } debug { minifyEnabled false @@ -49,68 +52,66 @@ android { multiDexEnabled true } } - lintOptions { + namespace 'org.solovyev.android.calculator' + lint { abortOnError false + disable 'ContentDescription', 'IconLauncherShape' warning 'MissingTranslation' - disable 'ContentDescription' - // floating icon is semi-transparent - disable 'IconLauncherShape' } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - defaultConfig { - javaCompileOptions { - annotationProcessorOptions { - arguments = ['library': 'true'] - } + testOptions { + unitTests { + includeAndroidResources = true } } } +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} + dependencies { - implementation "com.android.support:support-v4:${versions.supportLib}" - implementation "com.android.support:appcompat-v7:${versions.supportLib}" - implementation "com.android.support:design:${versions.supportLib}" + implementation "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}" + + implementation "androidx.viewpager:viewpager:1.1.0-alpha01" + implementation "androidx.preference:preference-ktx:1.2.1" + implementation 'com.google.android.material:material:1.9.0' + implementation project(":measure") - implementation 'com.squareup:otto:1.3.9-SNAPSHOT' - annotationProcessor 'com.squareup:otto:1.3.9-SNAPSHOT' - annotationProcessor 'com.squareup:otto-compiler:1.3.9-SNAPSHOT' - annotationProcessor 'com.squareup:javapoet:1.9.0' + implementation project(':otto:otto') + kapt project(':otto:otto') + kapt project(':otto:otto-compiler') + kapt 'com.squareup:javapoet:1.9.0' + implementation project(':plotter:lib') implementation project(':dragbutton') implementation(project(':jscl')) { exclude(module: 'xercesImpl') } - implementation 'org.solovyev.android:checkout:1.2.1' - implementation 'org.solovyev.android:material:0.1.4@aar' - implementation(name: 'plotter', ext: 'aar') - implementation 'com.google.guava:guava:20.0' - implementation('org.simpleframework:simple-xml:2.6.1') { + implementation 'org.solovyev.android:checkout:1.3.1' + implementation 'com.google.guava:guava:32.1.2-android' + implementation('org.simpleframework:simple-xml:2.7.1') { exclude(module: 'stax') exclude(module: 'stax-api') exclude(module: 'xpp3') } - implementation 'com.jakewharton:butterknife:8.8.1' - annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' implementation 'com.google.dagger:dagger:2.0.2' - annotationProcessor "com.google.dagger:dagger-compiler:2.0.2" - implementation 'javax.annotation:jsr250-api:1.0' + kapt "com.google.dagger:dagger-compiler:2.0.2" + implementation 'javax.annotation:javax.annotation-api:1.3.2' + kapt "javax.annotation:javax.annotation-api:1.3.2" - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13.2' testImplementation 'net.sf.opencsv:opencsv:2.0' - testImplementation 'org.mockito:mockito-core:2.7.6' - testImplementation 'org.robolectric:robolectric:3.5.1' - testImplementation 'org.mockito:mockito-all:1.9.5' - testImplementation 'org.skyscreamer:jsonassert:1.2.3' + testImplementation 'org.mockito:mockito-core:5.3.1' + testImplementation 'org.robolectric:robolectric:4.10.3' + testImplementation 'org.skyscreamer:jsonassert:1.5.0' - androidTestImplementation "com.android.support:support-annotations:${versions.supportLib}" - androidTestImplementation'com.android.support.test:runner:1.0.2' - androidTestImplementation'com.android.support.test:rules:1.0.2' + androidTestImplementation 'androidx.annotation:annotation:1.7.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test:rules:1.5.0' androidTestImplementation'org.hamcrest:hamcrest-library:1.3' - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { + androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { // use version of jsr305 provided by Checkout exclude group: 'com.google.code.findbugs', module: 'jsr305' })} @@ -118,6 +119,7 @@ dependencies { tasks.withType(Test) { scanForTestClasses = false include "**/*Test.class" + exclude "**/*BaseCalculatorTest*" exclude "**/*AndroidCalculatorEditorViewTest*" exclude "**/*CalculatorWizardActivityTest*" exclude "**/*OnScreenCalculatorWizardStepTest*" @@ -126,6 +128,7 @@ tasks.withType(Test) { exclude "**/*AngleUnitsButtonTest*" exclude "**/*NumeralBasesButtonTest*" } +/* task androidJavadocs(type: Javadoc) { source = android.sourceSets.main.java.srcDirs @@ -156,3 +159,57 @@ signing { group = "org.solovyev.android" version = android.defaultConfig.versionName +uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> + signing.signPom(deployment) + // for some reason Gradle :uploadArchives tries to upload null.txt.asc and null.map artifacts. + // As we don't want those let's filter them now (note that these files are not included in the + // list of project artifacts, so their origin is not clear) + def removeCond = { artifact -> return !artifact.classifier && (artifact.type == "map" || artifact.type == "txt.asc") } + deployment.artifacts.removeAll(removeCond) + deployment.attachedArtifacts.removeAll(removeCond) + } + + repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + pom.project { + artifactId = 'calculatorpp-app' + name 'Calculator++ Application' + packaging 'apk' + description 'Calculator for Android' + url 'https://github.com/serso/android-calculatorpp' + + scm { + url 'https://github.com/serso/android-calculatorpp' + connection 'scm:https://serso@github.com/serso/android-calculatorpp.git' + developerConnection 'scm:git://github.com/serso/android-calculatorpp.git' + } + + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution 'repo' + } + } + + developers { + developer { + id 'se.solovyev' + name 'Sergey Solovyev' + email 'se.solovyev@gmail.com' + } + } + } + } + } +} +*/ diff --git a/app/misc/libs/plotter.aar b/app/misc/libs/plotter.aar deleted file mode 100644 index b2bbe10c..00000000 Binary files a/app/misc/libs/plotter.aar and /dev/null differ diff --git a/app/proguard.cfg b/app/proguard.cfg index 8f55fffd..139dd19f 100644 --- a/app/proguard.cfg +++ b/app/proguard.cfg @@ -63,8 +63,6 @@ -dontwarn jscl.mathml.** -dontwarn com.google.common.** -dontwarn com.google.ads.** --dontwarn com.sun.org.apache.xerces.internal.impl.dv.util.Base64 --dontwarn com.actionbarsherlock.BuildConfig -dontwarn com.google.android.gms.internal.** -dontwarn com.google.android.gms.common.internal.** -dontwarn com.google.android.gms.common.GooglePlayServicesUtil @@ -73,16 +71,6 @@ -dontwarn com.squareup.leakcanary.** -keep class org.simpleframework.xml.** { *; } --keep class * implements org.solovyev.android.calculator.model.MathPersistenceEntity --keep class * implements org.solovyev.android.calculator.MathEntityPersistenceContainer - -# Allow obfuscation of android.support.v7.internal.view.menu.** -# to avoid problem on Samsung 4.2.2 devices with appcompat v21 -# see https://code.google.com/p/android/issues/detail?id=78377 --keep class android.support.v4.app.** { *; } --keep interface android.support.v4.app.** { *; } --keep class !android.support.v7.internal.view.menu.MenuBuilder, !android.support.v7.internal.view.menu.SubMenuBuilder, android.support.v7.** { *; } --keep interface android.support.v7.** { *; } ## JAVAX UNITS @@ -106,45 +94,8 @@ public static *; } -## ACRA - -# keep this around for some enums that ACRA needs --keep class org.acra.ReportingInteractionMode { - *; -} - --keepnames class org.acra.sender.HttpSender$** { - *; -} - --keepnames class org.acra.ReportField { - *; -} - -# keep this otherwise it is removed by ProGuard --keep public class org.acra.ErrorReporter { - public void addCustomData(java.lang.String,java.lang.String); - public void putCustomData(java.lang.String,java.lang.String); - public void removeCustomData(java.lang.String); -} - -# keep this otherwise it is removed by ProGuard --keep public class org.acra.ErrorReporter { - public void handleSilentException(java.lang.Throwable); -} - -## BUTTERKNIFE - --keep class butterknife.** { *; } --dontwarn butterknife.internal.** --keep class **$$ViewBinder { *; } - --keepclasseswithmembernames class * { - @butterknife.* ; -} - --keepclasseswithmembernames class * { - @butterknife.* ; +-assumenosideeffects class org.solovyev.android.plotter.Check { + public static *; } ## OTTO BUS @@ -153,4 +104,6 @@ -keepclassmembers class ** { @com.squareup.otto.Subscribe public *; @com.squareup.otto.Produce public *; -} \ No newline at end of file +} + +-dontwarn com.google.protobuf.* diff --git a/app/project.properties b/app/project.properties deleted file mode 100644 index 0a815a7c..00000000 --- a/app/project.properties +++ /dev/null @@ -1,35 +0,0 @@ -# suppress inspection "UnusedProperty" for whole file -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-17 -android.library.reference.1=../android-app-core -android.library.reference.2=../android-app-widget -android.library.reference.3=../android-app-onscreen -android.library.reference.4=gen-external-apklibs/org.solovyev.android_android-common-all_1.1.11 -android.library.reference.5=gen-external-apklibs/org.solovyev.android_android-common-ads_1.1.11 -android.library.reference.6=gen-external-apklibs/org.solovyev.android_android-common-core_1.1.11 -android.library.reference.7=gen-external-apklibs/org.solovyev.android_android-common-billing_1.1.11 -android.library.reference.8=gen-external-apklibs/org.solovyev.android_android-common-db_1.1.11 -android.library.reference.9=gen-external-apklibs/org.solovyev.android_android-common-security_1.1.11 -android.library.reference.10=gen-external-apklibs/org.solovyev.android_android-common-http_1.1.11 -android.library.reference.11=gen-external-apklibs/org.solovyev.android_android-common-lists_1.1.11 -android.library.reference.12=gen-external-apklibs/org.solovyev.android_android-common-views_1.1.11 -android.library.reference.13=gen-external-apklibs/org.solovyev.android_android-common-preferences_1.1.11 -android.library.reference.14=gen-external-apklibs/org.solovyev.android_android-common-menus_1.1.11 -android.library.reference.15=gen-external-apklibs/org.solovyev.android_android-common-other_1.1.11 -android.library.reference.16=gen-external-apklibs/org.solovyev.android_android-common-sherlock_1.1.11 -android.library.reference.17=gen-external-apklibs/com.actionbarsherlock_actionbarsherlock_4.2.0 -android.library.reference.18=gen-external-apklibs/org.solovyev.android_android-common-keyboards_1.1.11 -android.library.reference.19=gen-external-apklibs/org.solovyev.android_android-common-app_1.1.11 -android.library.reference.20=gen-external-apklibs/org.solovyev.android_android-common-networks_1.1.11 -android.library.reference.21=gen-external-apklibs/org.solovyev.android_android-common-fragments_1.1.11 -android.library.reference.22=gen-external-apklibs/org.solovyev.android_android-common-tasks_1.1.11 -android.library.reference.23=gen-external-apklibs/org.solovyev.android_android-common-wizard_1.1.11 \ No newline at end of file diff --git a/app/src/androidTest/java/net/slideshare/mobile/test/util/OrientationChangeAction.java b/app/src/androidTest/java/net/slideshare/mobile/test/util/OrientationChangeAction.java index 47c4cc98..8146812f 100644 --- a/app/src/androidTest/java/net/slideshare/mobile/test/util/OrientationChangeAction.java +++ b/app/src/androidTest/java/net/slideshare/mobile/test/util/OrientationChangeAction.java @@ -9,10 +9,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,23 +20,23 @@ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * + * */ package net.slideshare.mobile.test.util; import android.annotation.SuppressLint; import android.app.Activity; import android.content.pm.ActivityInfo; -import android.support.test.espresso.UiController; -import android.support.test.espresso.ViewAction; -import android.support.test.runner.lifecycle.ActivityLifecycleMonitorRegistry; -import android.support.test.runner.lifecycle.Stage; +import androidx.test.espresso.UiController; +import androidx.test.espresso.ViewAction; +import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry; +import androidx.test.runner.lifecycle.Stage; import android.view.View; import org.hamcrest.Matcher; import java.util.Collection; -import static android.support.test.espresso.matcher.ViewMatchers.isRoot; +import static androidx.test.espresso.matcher.ViewMatchers.isRoot; /** * An Espresso ViewAction that changes the orientation of the screen @@ -82,4 +82,4 @@ public class OrientationChangeAction implements ViewAction { public static ViewAction orientationPortrait() { return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } -} \ No newline at end of file +} diff --git a/app/src/androidTest/java/org/solovyev/android/calculator/converter/ConverterFragmentTest.java b/app/src/androidTest/java/org/solovyev/android/calculator/converter/ConverterFragmentTest.java index 1d1d74fe..72d82ce5 100644 --- a/app/src/androidTest/java/org/solovyev/android/calculator/converter/ConverterFragmentTest.java +++ b/app/src/androidTest/java/org/solovyev/android/calculator/converter/ConverterFragmentTest.java @@ -1,17 +1,17 @@ package org.solovyev.android.calculator.converter; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu; -import static android.support.test.espresso.action.ViewActions.clearText; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.action.ViewActions.typeText; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.RootMatchers.isPlatformPopup; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu; +import static androidx.test.espresso.action.ViewActions.clearText; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.action.ViewActions.typeText; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withText; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.rule.ActivityTestRule; +import androidx.test.ext.junit.runners.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; import org.junit.Rule; @@ -39,4 +39,4 @@ public class ConverterFragmentTest { onView(withId(R.id.converter_edittext_to)).check(matches(withText("1E0"))); } -} \ No newline at end of file +} diff --git a/app/src/androidTest/java/org/solovyev/android/calculator/plot/BasePlotTest.java b/app/src/androidTest/java/org/solovyev/android/calculator/plot/BasePlotTest.java index 53e5d432..a603d521 100644 --- a/app/src/androidTest/java/org/solovyev/android/calculator/plot/BasePlotTest.java +++ b/app/src/androidTest/java/org/solovyev/android/calculator/plot/BasePlotTest.java @@ -1,9 +1,9 @@ package org.solovyev.android.calculator.plot; -import android.support.annotation.NonNull; -import android.support.test.espresso.action.ViewActions; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; +import androidx.annotation.NonNull; +import androidx.test.espresso.action.ViewActions; +import androidx.test.rule.ActivityTestRule; +import androidx.test.ext.junit.runners.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; import android.text.TextUtils; @@ -14,14 +14,14 @@ import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.functions.CppFunction; import org.solovyev.android.calculator.functions.FunctionParamsView; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.action.ViewActions.typeText; -import static android.support.test.espresso.action.ViewActions.typeTextIntoFocusedView; -import static android.support.test.espresso.matcher.ViewMatchers.hasFocus; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withTagValue; -import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.action.ViewActions.typeText; +import static androidx.test.espresso.action.ViewActions.typeTextIntoFocusedView; +import static androidx.test.espresso.matcher.ViewMatchers.hasFocus; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withTagValue; +import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.allOf; @RunWith(AndroidJUnit4.class) diff --git a/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java b/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java index daeaa1dc..900097ed 100644 --- a/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java +++ b/app/src/androidTest/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragmentTest.java @@ -6,15 +6,15 @@ import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.functions.CppFunction; import org.solovyev.android.calculator.functions.FunctionParamsView; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.action.ViewActions.typeTextIntoFocusedView; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.hasFocus; -import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withTagValue; -import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.action.ViewActions.typeTextIntoFocusedView; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.ViewMatchers.hasFocus; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withTagValue; +import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.not; @@ -59,4 +59,4 @@ public class PlotEditFunctionFragmentTest extends BasePlotTest { onView(allOf(hasFocus(), withTagValue(Matchers.equalTo(FunctionParamsView.PARAM_VIEW_TAG)))).perform(typeTextIntoFocusedView("y")); onView(allOf(hasFocus(), withTagValue(Matchers.equalTo(FunctionParamsView.PARAM_VIEW_TAG)))).check(matches(withText("y"))); } -} \ No newline at end of file +} diff --git a/app/src/androidTest/java/org/solovyev/android/calculator/wizard/WizardActivityTest.java b/app/src/androidTest/java/org/solovyev/android/calculator/wizard/WizardActivityTest.java index 2fb022f6..4ecbd557 100644 --- a/app/src/androidTest/java/org/solovyev/android/calculator/wizard/WizardActivityTest.java +++ b/app/src/androidTest/java/org/solovyev/android/calculator/wizard/WizardActivityTest.java @@ -1,19 +1,19 @@ package org.solovyev.android.calculator.wizard; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.rule.ActivityTestRule; +import androidx.test.ext.junit.runners.AndroidJUnit4; import android.test.suitebuilder.annotation.LargeTest; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.solovyev.android.calculator.R; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.action.ViewActions.swipeLeft; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.RootMatchers.isDialog; -import static android.support.test.espresso.matcher.ViewMatchers.*; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.action.ViewActions.swipeLeft; +import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.RootMatchers.isDialog; +import static androidx.test.espresso.matcher.ViewMatchers.*; import static net.slideshare.mobile.test.util.OrientationChangeAction.orientationLandscape; import static net.slideshare.mobile.test.util.OrientationChangeAction.orientationPortrait; import static org.hamcrest.Matchers.allOf; @@ -62,4 +62,4 @@ public class WizardActivityTest { onView(isRoot()).perform(orientationPortrait()); onView(withId(R.id.pager)).check(matches(hasDescendant(withText(R.string.cpp_wizard_mode_title)))); } -} \ No newline at end of file +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 31a498df..7e440967 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,9 +1,8 @@ - + android:installLocation="auto"> + @@ -25,6 +24,7 @@ tools:ignore="GoogleAppIndexingWarning,UnusedAttribute"> @@ -113,6 +114,7 @@ android:theme="@style/Cpp.Theme.Dialog" /> @@ -121,6 +123,7 @@ @@ -137,6 +140,7 @@ @@ -188,4 +193,4 @@ - \ No newline at end of file + diff --git a/app/src/main/java/com/viewpagerindicator/CirclePageIndicator.java b/app/src/main/java/com/viewpagerindicator/CirclePageIndicator.java index 1009b506..92c721ab 100644 --- a/app/src/main/java/com/viewpagerindicator/CirclePageIndicator.java +++ b/app/src/main/java/com/viewpagerindicator/CirclePageIndicator.java @@ -26,14 +26,14 @@ import android.graphics.Paint.Style; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; -import android.support.v4.view.MotionEventCompat; -import android.support.v4.view.ViewConfigurationCompat; -import android.support.v4.view.ViewPager; +import androidx.core.view.MotionEventCompat; +import androidx.core.view.ViewConfigurationCompat; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; +import androidx.viewpager.widget.ViewPager; import org.solovyev.android.calculator.R; import static android.graphics.Paint.ANTI_ALIAS_FLAG; diff --git a/app/src/main/java/com/viewpagerindicator/PageIndicator.java b/app/src/main/java/com/viewpagerindicator/PageIndicator.java index 929c91a4..c9f4c5cd 100644 --- a/app/src/main/java/com/viewpagerindicator/PageIndicator.java +++ b/app/src/main/java/com/viewpagerindicator/PageIndicator.java @@ -17,7 +17,8 @@ package com.viewpagerindicator; -import android.support.v4.view.ViewPager; + +import androidx.viewpager.widget.ViewPager; /** * A PageIndicator is responsible to show an visual indicator on the total views diff --git a/app/src/main/java/org/solovyev/android/Check.java b/app/src/main/java/org/solovyev/android/Check.java index 363639c3..df42b787 100644 --- a/app/src/main/java/org/solovyev/android/Check.java +++ b/app/src/main/java/org/solovyev/android/Check.java @@ -42,7 +42,8 @@ public final class Check { private static boolean isJunit() { final StackTraceElement[] stackTrace = currentThread().getStackTrace(); for (StackTraceElement element : stackTrace) { - if (element.getClassName().startsWith("org.junit.")) { + String className = element.getClassName(); + if (className.startsWith("org.junit.") || className.startsWith("org.robolectric.")) { return true; } } diff --git a/app/src/main/java/org/solovyev/android/calculator/ActivityLauncher.java b/app/src/main/java/org/solovyev/android/calculator/ActivityLauncher.java index 865a9d1d..ade54683 100644 --- a/app/src/main/java/org/solovyev/android/calculator/ActivityLauncher.java +++ b/app/src/main/java/org/solovyev/android/calculator/ActivityLauncher.java @@ -27,7 +27,7 @@ import android.app.Application; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import dagger.Lazy; import jscl.math.Generic; diff --git a/app/src/main/java/org/solovyev/android/calculator/App.java b/app/src/main/java/org/solovyev/android/calculator/App.java index 9698125e..4f6a0d57 100644 --- a/app/src/main/java/org/solovyev/android/calculator/App.java +++ b/app/src/main/java/org/solovyev/android/calculator/App.java @@ -36,13 +36,8 @@ import android.net.Uri; import android.os.Build; import android.os.IBinder; import android.os.Looper; -import android.support.annotation.ColorInt; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.support.v7.view.ContextThemeWrapper; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ForegroundColorSpan; @@ -54,6 +49,11 @@ import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; +import androidx.appcompat.view.ContextThemeWrapper; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import org.solovyev.android.Check; import org.solovyev.android.calculator.floating.FloatingCalculatorService; @@ -312,7 +312,7 @@ public final class App { @Nonnull public static ArrayAdapter makeSimpleSpinnerAdapter(@NonNull Context context) { - return new ArrayAdapter<>(context, R.layout.support_simple_spinner_dropdown_item); + return new ArrayAdapter<>(context, androidx.appcompat.R.layout.support_simple_spinner_dropdown_item); } public interface ViewProcessor { @@ -366,4 +366,4 @@ public final class App { public static int toPixels(@Nonnull View view, float dps) { return toPixels(view.getContext(), dps); } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/AppModule.java b/app/src/main/java/org/solovyev/android/calculator/AppModule.java index d17cedd6..75e7c292 100644 --- a/app/src/main/java/org/solovyev/android/calculator/AppModule.java +++ b/app/src/main/java/org/solovyev/android/calculator/AppModule.java @@ -7,12 +7,12 @@ import android.graphics.Typeface; import android.os.Handler; import android.os.Looper; import android.preference.PreferenceManager; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import com.squareup.otto.Bus; -import com.squareup.otto.GeneratedHandlerFinder; +import com.squareup.otto.GeneratedHandlerFinder; import org.solovyev.android.calculator.language.Languages; import org.solovyev.android.calculator.wizard.CalculatorWizards; import org.solovyev.android.checkout.Billing; diff --git a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java index 92a1d6cb..d1eb4146 100644 --- a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java @@ -5,40 +5,33 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static org.solovyev.android.calculator.App.cast; import static org.solovyev.android.calculator.Preferences.Gui.keepScreenOn; - -import android.app.Activity; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.DrawableRes; -import android.support.annotation.LayoutRes; -import android.support.annotation.StringRes; -import android.support.design.widget.AppBarLayout; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.TextView; - +import androidx.annotation.DrawableRes; +import androidx.annotation.LayoutRes; +import androidx.annotation.StringRes; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import dagger.Lazy; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.inject.Inject; import org.solovyev.android.Check; import org.solovyev.android.calculator.language.Language; import org.solovyev.android.calculator.language.Languages; import org.solovyev.android.calculator.view.Tabs; import org.solovyev.android.views.dragbutton.DirectionDragImageButton; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.inject.Inject; - -import butterknife.BindView; -import butterknife.ButterKnife; -import dagger.Lazy; - public abstract class BaseActivity extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener { @Nonnull @@ -55,13 +48,10 @@ public abstract class BaseActivity extends AppCompatActivity implements SharedPr Calculator calculator; @Inject Typeface typeface; - @BindView(R.id.main) ViewGroup mainView; @Nullable - @BindView(R.id.toolbar) Toolbar toolbar; @Nullable - @BindView(R.id.fab) FloatingActionButton fab; @Nonnull private Preferences.Gui.Theme theme = Preferences.Gui.Theme.material_theme; @@ -148,12 +138,16 @@ public abstract class BaseActivity extends AppCompatActivity implements SharedPr private void createView() { setContentView(layoutId); + View contentView = findViewById(android.R.id.content); + mainView = contentView.findViewById(R.id.main); + toolbar = contentView.findViewById(R.id.toolbar); + fab = contentView.findViewById(R.id.fab); + bindViews(contentView); // title must be updated as if a non-system language is used the value from AndroidManifest // might be cached if (titleId != 0) { setTitle(titleId); } - ButterKnife.bind(this, this); fixFonts(mainView, typeface); initToolbar(); @@ -161,6 +155,8 @@ public abstract class BaseActivity extends AppCompatActivity implements SharedPr tabs.onCreate(); } + protected void bindViews(@Nonnull View contentView) {} + private void initToolbar() { if (toolbar == null) { return; diff --git a/app/src/main/java/org/solovyev/android/calculator/BaseDialogFragment.java b/app/src/main/java/org/solovyev/android/calculator/BaseDialogFragment.java index 1a1a8deb..ec2c56bc 100644 --- a/app/src/main/java/org/solovyev/android/calculator/BaseDialogFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/BaseDialogFragment.java @@ -5,17 +5,17 @@ import android.content.DialogInterface; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.design.widget.TextInputLayout; -import android.support.v4.app.DialogFragment; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.Button; +import androidx.annotation.StringRes; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; +import com.google.android.material.textfield.TextInputLayout; import javax.inject.Inject; @@ -71,11 +71,6 @@ public abstract class BaseDialogFragment extends DialogFragment implements View. return dialog; } - @Override - public void onResume() { - super.onResume(); - } - protected void onShowDialog(@NonNull AlertDialog dialog, boolean firstTime) { } diff --git a/app/src/main/java/org/solovyev/android/calculator/BaseFragment.java b/app/src/main/java/org/solovyev/android/calculator/BaseFragment.java index 01853c47..4248b31d 100644 --- a/app/src/main/java/org/solovyev/android/calculator/BaseFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/BaseFragment.java @@ -3,11 +3,11 @@ package org.solovyev.android.calculator; import android.graphics.Typeface; import android.os.Bundle; import android.os.Parcelable; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.v4.app.Fragment; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; import android.view.*; +import androidx.annotation.StringRes; +import androidx.fragment.app.Fragment; import org.solovyev.android.plotter.Check; import javax.annotation.Nonnull; diff --git a/app/src/main/java/org/solovyev/android/calculator/Calculator.java b/app/src/main/java/org/solovyev/android/calculator/Calculator.java index f9253dd4..3590fad2 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Calculator.java +++ b/app/src/main/java/org/solovyev/android/calculator/Calculator.java @@ -23,8 +23,8 @@ package org.solovyev.android.calculator; import android.content.SharedPreferences; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import android.text.TextUtils; import android.util.Log; diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 6f44507e..c070b8ed 100644 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -25,11 +25,6 @@ package org.solovyev.android.calculator; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.StringRes; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.support.v4.view.GravityCompat; -import android.support.v7.widget.PopupMenu; import android.text.SpannableString; import android.text.Spanned; import android.text.style.StyleSpan; @@ -38,17 +33,21 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.FrameLayout; -import butterknife.BindView; -import jscl.AngleUnit; -import jscl.NumeralBase; -import org.solovyev.android.calculator.converter.ConverterFragment; -import org.solovyev.android.calculator.history.History; -import org.solovyev.android.calculator.keyboard.PartialKeyboardUi; -import org.solovyev.android.widget.menu.CustomPopupMenu; - +import androidx.annotation.StringRes; +import androidx.appcompat.widget.PopupMenu; +import androidx.core.view.GravityCompat; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; +import jscl.AngleUnit; +import jscl.NumeralBase; +import org.solovyev.android.calculator.converter.ConverterFragment; +import org.solovyev.android.calculator.databinding.ActivityMainBinding; +import org.solovyev.android.calculator.history.History; +import org.solovyev.android.calculator.keyboard.PartialKeyboardUi; +import org.solovyev.android.widget.menu.CustomPopupMenu; public class CalculatorActivity extends BaseActivity implements View.OnClickListener { @@ -65,11 +64,8 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList @Inject StartupHelper startupHelper; @Nullable - @BindView(R.id.partial_keyboard) View partialKeyboard; - @BindView(R.id.editor) FrameLayout editor; - @BindView(R.id.main_menu) View mainMenuButton; private boolean useBackAsPrevious; @@ -77,6 +73,14 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList super(R.layout.activity_main, R.string.cpp_app_name); } + @Override + protected void bindViews(@Nonnull View contentView) { + ActivityMainBinding binding = ActivityMainBinding.bind(contentView.findViewById(R.id.main)); + partialKeyboard = binding.partialKeyboard; + editor = binding.editorContainer.editor; + mainMenuButton = binding.editorContainer.mainMenu; + } + @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -149,10 +153,8 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList @Override public void onClick(View v) { - switch (v.getId()) { - case R.id.main_menu: - mainMenu.toggle(); - break; + if (v.getId() == R.id.main_menu) { + mainMenu.toggle(); } } @@ -171,7 +173,7 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList public void toggle() { if (popup == null) { - popup = new CustomPopupMenu(CalculatorActivity.this, mainMenuButton, GravityCompat.END, R.attr.actionOverflowMenuStyle, 0); + popup = new CustomPopupMenu(CalculatorActivity.this, mainMenuButton, GravityCompat.END, android.R.attr.actionOverflowMenuStyle, 0); popup.inflate(R.menu.main); popup.setOnMenuItemClickListener(this); popup.setKeepOnSubMenu(true); @@ -227,45 +229,45 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList @Override public boolean onMenuItemClick(MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_settings: - launcher.showSettings(); - return true; - case R.id.menu_history: - launcher.showHistory(); - return true; - case R.id.menu_plotter: - launcher.showPlotter(); - return true; - case R.id.menu_conversion_tool: - ConverterFragment.show(CalculatorActivity.this); - return true; - case R.id.menu_about: - launcher.showAbout(); - return true; - case R.id.menu_mode_engineer: - Preferences.Gui.mode.putPreference(preferences, Preferences.Gui.Mode.engineer); - restartIfModeChanged(); - return true; - case R.id.menu_mode_simple: - Preferences.Gui.mode.putPreference(preferences, Preferences.Gui.Mode.simple); - restartIfModeChanged(); - return true; - case R.id.menu_au_deg: - Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.deg); - return true; - case R.id.menu_au_rad: - Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.rad); - return true; - case R.id.menu_nb_bin: - Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.bin); - return true; - case R.id.menu_nb_dec: - Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.dec); - return true; - case R.id.menu_nb_hex: - Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.hex); - return true; + int itemId = item.getItemId(); + if (itemId == R.id.menu_settings) { + launcher.showSettings(); + return true; + } else if (itemId == R.id.menu_history) { + launcher.showHistory(); + return true; + } else if (itemId == R.id.menu_plotter) { + launcher.showPlotter(); + return true; + } else if (itemId == R.id.menu_conversion_tool) { + ConverterFragment.show(CalculatorActivity.this); + return true; + } else if (itemId == R.id.menu_about) { + launcher.showAbout(); + return true; + } else if (itemId == R.id.menu_mode_engineer) { + Preferences.Gui.mode.putPreference(preferences, Preferences.Gui.Mode.engineer); + restartIfModeChanged(); + return true; + } else if (itemId == R.id.menu_mode_simple) { + Preferences.Gui.mode.putPreference(preferences, Preferences.Gui.Mode.simple); + restartIfModeChanged(); + return true; + } else if (itemId == R.id.menu_au_deg) { + Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.deg); + return true; + } else if (itemId == R.id.menu_au_rad) { + Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.rad); + return true; + } else if (itemId == R.id.menu_nb_bin) { + Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.bin); + return true; + } else if (itemId == R.id.menu_nb_dec) { + Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.dec); + return true; + } else if (itemId == R.id.menu_nb_hex) { + Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.hex); + return true; } return false; } @@ -280,4 +282,4 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index 2350fd64..e29748fa 100644 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -26,7 +26,7 @@ import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Handler; import android.preference.PreferenceManager; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import android.util.TimingLogger; diff --git a/app/src/main/java/org/solovyev/android/calculator/Clipboard.java b/app/src/main/java/org/solovyev/android/calculator/Clipboard.java index 4666e9c3..19af8bf0 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Clipboard.java +++ b/app/src/main/java/org/solovyev/android/calculator/Clipboard.java @@ -23,8 +23,9 @@ package org.solovyev.android.calculator; import android.app.Application; +import android.content.ClipData; +import android.content.ClipboardManager; import android.content.Context; -import android.text.ClipboardManager; import javax.annotation.Nonnull; import javax.inject.Inject; @@ -32,31 +33,30 @@ import javax.inject.Singleton; @Singleton public class Clipboard { - @SuppressWarnings("deprecation") @Nonnull private final ClipboardManager clipboard; - @SuppressWarnings("deprecation") @Inject public Clipboard(@Nonnull Application application) { clipboard = (ClipboardManager) application.getSystemService(Context.CLIPBOARD_SERVICE); } - @SuppressWarnings("deprecation") @Nonnull public String getText() { - if (clipboard.hasText()) { - return String.valueOf(clipboard.getText()); + ClipData primaryClip = clipboard.getPrimaryClip(); + if (primaryClip != null && primaryClip.getItemCount() > 0) { + final CharSequence text = primaryClip.getItemAt(0).getText(); + return text != null ? text.toString() : ""; } return ""; } public void setText(@Nonnull CharSequence text) { - clipboard.setText(text); + clipboard.setPrimaryClip(ClipData.newPlainText("", text)); } public void setText(@Nonnull String text) { - clipboard.setText(text); + setText((CharSequence) text); } } diff --git a/app/src/main/java/org/solovyev/android/calculator/Display.java b/app/src/main/java/org/solovyev/android/calculator/Display.java index 5c46f708..ee3848b8 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Display.java +++ b/app/src/main/java/org/solovyev/android/calculator/Display.java @@ -24,7 +24,7 @@ package org.solovyev.android.calculator; import android.app.Application; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; diff --git a/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java b/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java index a0bc62bc..7d8f5149 100644 --- a/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/DisplayFragment.java @@ -25,14 +25,12 @@ package org.solovyev.android.calculator; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; import android.view.*; -import butterknife.BindView; -import butterknife.ButterKnife; +import androidx.appcompat.app.AlertDialog; import com.squareup.otto.Bus; import jscl.NumeralBase; import jscl.math.Generic; @@ -63,19 +61,17 @@ public class DisplayFragment extends BaseFragment implements View.OnClickListene @Nullable public static ConversionMenuItem getByTitle(int title) { - switch (title) { - case R.string.convert_to_bin: - return to_bin; - case R.string.convert_to_dec: - return to_dec; - case R.string.convert_to_hex: - return to_hex; + if (title == R.string.convert_to_bin) { + return to_bin; + } else if (title == R.string.convert_to_dec) { + return to_dec; + } else if (title == R.string.convert_to_hex) { + return to_hex; } return null; } } - @BindView(R.id.calculator_display) DisplayView displayView; @Inject SharedPreferences preferences; @@ -106,7 +102,7 @@ public class DisplayFragment extends BaseFragment implements View.OnClickListene public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); + displayView = view.findViewById(R.id.calculator_display); display.setView(displayView); displayView.setOnClickListener(this); return view; @@ -181,30 +177,27 @@ public class DisplayFragment extends BaseFragment implements View.OnClickListene public boolean onMenuItemClick(MenuItem item) { final DisplayState state = display.getState(); final Generic result = state.getResult(); - switch (item.getItemId()) { - case R.string.cpp_copy: - display.copy(); - return true; - case R.string.convert_to_bin: - case R.string.convert_to_dec: - case R.string.convert_to_hex: - final ConversionMenuItem menuItem = ConversionMenuItem.getByTitle(item.getItemId()); - if (menuItem == null) { - return false; - } - if (result != null) { - calculator.convert(state, menuItem.toNumeralBase); - } - return true; - case R.string.c_convert: - ConverterFragment.show(getActivity(), getValue(result)); - return true; - case R.string.c_plot: - launcher.plot(result); - return true; - default: + int itemId = item.getItemId(); + if (itemId == R.string.cpp_copy) { + display.copy(); + return true; + } else if (itemId == R.string.convert_to_bin || itemId == R.string.convert_to_dec || itemId == R.string.convert_to_hex) { + final ConversionMenuItem menuItem = ConversionMenuItem.getByTitle(item.getItemId()); + if (menuItem == null) { return false; + } + if (result != null) { + calculator.convert(state, menuItem.toNumeralBase); + } + return true; + } else if (itemId == R.string.c_convert) { + ConverterFragment.show(getActivity(), getValue(result)); + return true; + } else if (itemId == R.string.c_plot) { + launcher.plot(result); + return true; } + return false; } private static double getValue(@Nullable Generic result) { diff --git a/app/src/main/java/org/solovyev/android/calculator/DisplayView.java b/app/src/main/java/org/solovyev/android/calculator/DisplayView.java index 2862953a..df3ae3af 100644 --- a/app/src/main/java/org/solovyev/android/calculator/DisplayView.java +++ b/app/src/main/java/org/solovyev/android/calculator/DisplayView.java @@ -28,8 +28,8 @@ import static android.util.TypedValue.applyDimension; import android.content.Context; import android.content.res.Resources; import android.os.AsyncTask; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import android.text.method.ScrollingMovementMethod; import android.util.AttributeSet; diff --git a/app/src/main/java/org/solovyev/android/calculator/Editor.java b/app/src/main/java/org/solovyev/android/calculator/Editor.java index 833b0c62..cbef5713 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Editor.java +++ b/app/src/main/java/org/solovyev/android/calculator/Editor.java @@ -27,8 +27,8 @@ import static java.lang.Math.min; import android.app.Application; import android.content.SharedPreferences; import android.os.AsyncTask; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import android.text.TextUtils; import com.squareup.otto.Bus; @@ -173,12 +173,13 @@ public class Editor { state = newState; cancelAsyncHighlightText(); - highlighterTask = new AsyncHighlighter(oldState, newState, force, textProcessor); - if (highlighterTask.shouldAsync()) { - highlighterTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + AsyncHighlighter newHighlighterTask = new AsyncHighlighter(oldState, newState, force, textProcessor); + highlighterTask = newHighlighterTask; + if (newHighlighterTask.shouldAsync()) { + newHighlighterTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); return; } - highlighterTask.onPostExecute(newState); + newHighlighterTask.onPostExecute(newState); Check.isNull(highlighterTask); } diff --git a/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java b/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java index 08e6c1c8..2f0b7712 100644 --- a/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/EditorFragment.java @@ -26,17 +26,15 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import butterknife.BindView; -import butterknife.ButterKnife; import javax.annotation.Nonnull; import javax.inject.Inject; +import org.solovyev.android.calculator.databinding.CppAppEditorBinding; public class EditorFragment extends BaseFragment { @Inject Editor editor; - @BindView(R.id.calculator_editor) EditorView editorView; public EditorFragment() { @@ -52,7 +50,8 @@ public class EditorFragment extends BaseFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); + CppAppEditorBinding binding = CppAppEditorBinding.bind(view); + editorView = binding.calculatorEditor; editor.setView(editorView); return view; } diff --git a/app/src/main/java/org/solovyev/android/calculator/Engine.java b/app/src/main/java/org/solovyev/android/calculator/Engine.java index 378c73ce..d384f7d8 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Engine.java +++ b/app/src/main/java/org/solovyev/android/calculator/Engine.java @@ -24,9 +24,9 @@ package org.solovyev.android.calculator; import android.content.Context; import android.content.SharedPreferences; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.annotation.VisibleForTesting; import android.text.TextUtils; import com.squareup.otto.Bus; diff --git a/app/src/main/java/org/solovyev/android/calculator/FloatingCalculatorKeyboard.java b/app/src/main/java/org/solovyev/android/calculator/FloatingCalculatorKeyboard.java index 422a3bc7..c9d1f9ae 100644 --- a/app/src/main/java/org/solovyev/android/calculator/FloatingCalculatorKeyboard.java +++ b/app/src/main/java/org/solovyev/android/calculator/FloatingCalculatorKeyboard.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import android.support.annotation.IdRes; -import android.support.annotation.NonNull; +import androidx.annotation.IdRes; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.view.View; import android.widget.Button; @@ -174,47 +174,34 @@ public class FloatingCalculatorKeyboard extends BaseFloatingKeyboard { if (user.isVibrateOnKeypress()) { v.performHapticFeedback(KEYBOARD_TAP, FLAG_IGNORE_GLOBAL_SETTING | FLAG_IGNORE_VIEW_SETTING); } - switch (v.getId()) { - case R.id.cpp_kb_button_divide: - user.insertOperator('/'); - break; - case R.id.cpp_kb_button_plus: - user.insertOperator('+'); - break; - case R.id.cpp_kb_button_minus: - user.insertOperator('-'); - break; - case R.id.cpp_kb_button_multiply: - user.insertOperator("×"); - break; - case R.id.cpp_kb_button_functions_constants: - user.showFunctionsConstants(v); - break; - case R.id.cpp_kb_button_functions: - user.showFunctions(v); - break; - case R.id.cpp_kb_button_constants: - user.showConstants(v); - break; - case R.id.cpp_kb_button_space: - user.insertText(" ", 0); - break; - case R.id.cpp_kb_button_keyboard: - user.showIme(); - break; - case R.id.cpp_kb_button_clear: - user.getEditor().setText(""); - user.getEditor().setSelection(0); - break; - case R.id.cpp_kb_button_brackets: - user.insertText("()", -1); - break; - case R.id.cpp_kb_button_close: - user.done(); - break; - default: - onDefaultClick(v); - break; + int id = v.getId(); + if (id == R.id.cpp_kb_button_divide) { + user.insertOperator('/'); + } else if (id == R.id.cpp_kb_button_plus) { + user.insertOperator('+'); + } else if (id == R.id.cpp_kb_button_minus) { + user.insertOperator('-'); + } else if (id == R.id.cpp_kb_button_multiply) { + user.insertOperator("×"); + } else if (id == R.id.cpp_kb_button_functions_constants) { + user.showFunctionsConstants(v); + } else if (id == R.id.cpp_kb_button_functions) { + user.showFunctions(v); + } else if (id == R.id.cpp_kb_button_constants) { + user.showConstants(v); + } else if (id == R.id.cpp_kb_button_space) { + user.insertText(" ", 0); + } else if (id == R.id.cpp_kb_button_keyboard) { + user.showIme(); + } else if (id == R.id.cpp_kb_button_clear) { + user.getEditor().setText(""); + user.getEditor().setSelection(0); + } else if (id == R.id.cpp_kb_button_brackets) { + user.insertText("()", -1); + } else if (id == R.id.cpp_kb_button_close) { + user.done(); + } else { + onDefaultClick(v); } user.getEditor().requestFocus(); } @@ -256,4 +243,4 @@ public class FloatingCalculatorKeyboard extends BaseFloatingKeyboard { return true; } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/FragmentTab.java b/app/src/main/java/org/solovyev/android/calculator/FragmentTab.java index cd574fa1..3cedcf85 100644 --- a/app/src/main/java/org/solovyev/android/calculator/FragmentTab.java +++ b/app/src/main/java/org/solovyev/android/calculator/FragmentTab.java @@ -22,8 +22,8 @@ package org.solovyev.android.calculator; -import android.support.annotation.StringRes; -import android.support.v4.app.Fragment; +import androidx.annotation.StringRes; +import androidx.fragment.app.Fragment; import org.solovyev.android.calculator.about.AboutFragment; import org.solovyev.android.calculator.about.ReleaseNotesFragment; import org.solovyev.android.calculator.functions.FunctionsFragment; diff --git a/app/src/main/java/org/solovyev/android/calculator/Keyboard.java b/app/src/main/java/org/solovyev/android/calculator/Keyboard.java index feaeaef7..08f9e97a 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Keyboard.java +++ b/app/src/main/java/org/solovyev/android/calculator/Keyboard.java @@ -25,7 +25,7 @@ package org.solovyev.android.calculator; import static org.solovyev.android.calculator.Engine.Preferences.numeralBase; import android.content.SharedPreferences; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.Spannable; import android.text.TextUtils; import android.util.Log; @@ -361,4 +361,4 @@ public class Keyboard implements SharedPreferences.OnSharedPreferenceChangeListe this.mode = mode; } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java b/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java index 2650c0f2..8d5e4ebb 100644 --- a/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/KeyboardFragment.java @@ -22,12 +22,10 @@ package org.solovyev.android.calculator; -import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import butterknife.ButterKnife; import org.solovyev.android.Check; import org.solovyev.android.calculator.keyboard.KeyboardUi; @@ -36,8 +34,6 @@ import javax.inject.Inject; public class KeyboardFragment extends BaseFragment { - @Inject - SharedPreferences preferences; @Inject KeyboardUi keyboardUi; @@ -54,7 +50,6 @@ public class KeyboardFragment extends BaseFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); Check.isNotNull(view); keyboardUi.onCreateView(getActivity(), view); return view; diff --git a/app/src/main/java/org/solovyev/android/calculator/Named.java b/app/src/main/java/org/solovyev/android/calculator/Named.java index bea042f6..b13f6aa5 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Named.java +++ b/app/src/main/java/org/solovyev/android/calculator/Named.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; import javax.annotation.Nonnull; diff --git a/app/src/main/java/org/solovyev/android/calculator/Notifier.java b/app/src/main/java/org/solovyev/android/calculator/Notifier.java index 0fc4d6d2..016d7609 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Notifier.java +++ b/app/src/main/java/org/solovyev/android/calculator/Notifier.java @@ -24,7 +24,7 @@ package org.solovyev.android.calculator; import android.app.Application; import android.os.Handler; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import android.widget.Toast; import org.solovyev.common.msg.Message; diff --git a/app/src/main/java/org/solovyev/android/calculator/Preferences.java b/app/src/main/java/org/solovyev/android/calculator/Preferences.java index 59872058..6969604d 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Preferences.java +++ b/app/src/main/java/org/solovyev/android/calculator/Preferences.java @@ -31,11 +31,11 @@ import android.content.SharedPreferences; import android.content.res.TypedArray; import android.graphics.Color; import android.provider.Settings; -import android.support.annotation.ColorRes; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.annotation.StyleRes; +import androidx.annotation.ColorRes; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.annotation.StyleRes; import android.text.TextUtils; import android.util.SparseArray; import android.view.ContextThemeWrapper; diff --git a/app/src/main/java/org/solovyev/android/calculator/PreparedExpression.java b/app/src/main/java/org/solovyev/android/calculator/PreparedExpression.java index cdc19d42..5d2cb6e7 100644 --- a/app/src/main/java/org/solovyev/android/calculator/PreparedExpression.java +++ b/app/src/main/java/org/solovyev/android/calculator/PreparedExpression.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import jscl.math.function.IConstant; import javax.annotation.Nonnull; diff --git a/app/src/main/java/org/solovyev/android/calculator/RemovalConfirmationDialog.java b/app/src/main/java/org/solovyev/android/calculator/RemovalConfirmationDialog.java index 0d2ace06..106b3f79 100644 --- a/app/src/main/java/org/solovyev/android/calculator/RemovalConfirmationDialog.java +++ b/app/src/main/java/org/solovyev/android/calculator/RemovalConfirmationDialog.java @@ -2,9 +2,9 @@ package org.solovyev.android.calculator; import android.app.Activity; import android.content.DialogInterface; -import android.support.annotation.StringRes; -import android.support.v7.app.AlertDialog; +import androidx.annotation.StringRes; +import androidx.appcompat.app.AlertDialog; import javax.annotation.Nonnull; public class RemovalConfirmationDialog { diff --git a/app/src/main/java/org/solovyev/android/calculator/Runnables.java b/app/src/main/java/org/solovyev/android/calculator/Runnables.java index 7b4470bd..02db9c07 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Runnables.java +++ b/app/src/main/java/org/solovyev/android/calculator/Runnables.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.Check; import java.util.ArrayList; diff --git a/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java b/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java index 6c6bfc22..cbce0678 100644 --- a/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java +++ b/app/src/main/java/org/solovyev/android/calculator/StartupHelper.java @@ -6,9 +6,9 @@ import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; import org.solovyev.android.calculator.wizard.CalculatorWizards; import org.solovyev.android.wizard.Wizard; import org.solovyev.android.wizard.Wizards; diff --git a/app/src/main/java/org/solovyev/android/calculator/TaskExecutor.java b/app/src/main/java/org/solovyev/android/calculator/TaskExecutor.java index 1a4a2b19..a1a9f3e5 100644 --- a/app/src/main/java/org/solovyev/android/calculator/TaskExecutor.java +++ b/app/src/main/java/org/solovyev/android/calculator/TaskExecutor.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; -import android.support.annotation.NonNull; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import android.util.Log; import org.solovyev.android.Check; @@ -118,4 +118,4 @@ class TaskExecutor { void setSynchronous() { synchronous = true; } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java b/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java index 4ab0fe64..93472565 100644 --- a/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java +++ b/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java @@ -41,7 +41,7 @@ public class ToJsclTextProcessor implements TextProcessor undefinedVars, @Nonnull Engine engine) throws ParseException { - return replaceVariables(processExpression(s, engine).toString(), depth, undefinedVars, engine); + return replaceVariables(processExpression(removeWhitespaces(s), engine).toString(), depth, undefinedVars, engine); + } + + private static String removeWhitespaces(String s) { + final StringBuilder res = new StringBuilder(s.length()); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (Character.isWhitespace(c)) continue; + res.append(c); + } + return res.toString(); } @Nonnull diff --git a/app/src/main/java/org/solovyev/android/calculator/UiPreferences.java b/app/src/main/java/org/solovyev/android/calculator/UiPreferences.java index 1668650e..d47fcaf7 100644 --- a/app/src/main/java/org/solovyev/android/calculator/UiPreferences.java +++ b/app/src/main/java/org/solovyev/android/calculator/UiPreferences.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator; import android.content.SharedPreferences; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.prefs.BooleanPreference; import org.solovyev.android.prefs.IntegerPreference; diff --git a/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java b/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java index 19063c67..3e169f24 100644 --- a/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.google.common.base.Strings; diff --git a/app/src/main/java/org/solovyev/android/calculator/WidgetReceiver.java b/app/src/main/java/org/solovyev/android/calculator/WidgetReceiver.java index 8c7ab933..2199bab5 100644 --- a/app/src/main/java/org/solovyev/android/calculator/WidgetReceiver.java +++ b/app/src/main/java/org/solovyev/android/calculator/WidgetReceiver.java @@ -4,7 +4,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Vibrator; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.solovyev.android.calculator.buttons.CppButton; @@ -40,7 +40,9 @@ public final class WidgetReceiver extends BroadcastReceiver { return; } - cast(context).getComponent().inject(this); + if (keyboard == null || history == null) { + cast(context).getComponent().inject(this); + } final int buttonId = intent.getIntExtra(ACTION_BUTTON_ID_EXTRA, 0); final CppButton button = CppButton.getById(buttonId); diff --git a/app/src/main/java/org/solovyev/android/calculator/about/AboutActivity.java b/app/src/main/java/org/solovyev/android/calculator/about/AboutActivity.java index 5bd6a65e..8e867cb3 100644 --- a/app/src/main/java/org/solovyev/android/calculator/about/AboutActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/about/AboutActivity.java @@ -23,7 +23,7 @@ package org.solovyev.android.calculator.about; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.BaseActivity; diff --git a/app/src/main/java/org/solovyev/android/calculator/about/AboutFragment.java b/app/src/main/java/org/solovyev/android/calculator/about/AboutFragment.java index ad83a71f..738aa090 100644 --- a/app/src/main/java/org/solovyev/android/calculator/about/AboutFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/about/AboutFragment.java @@ -29,24 +29,19 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; -import butterknife.BindView; -import butterknife.ButterKnife; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.BaseFragment; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.FragmentAboutBinding; import static android.view.View.GONE; import static org.solovyev.common.text.Strings.isEmpty; public class AboutFragment extends BaseFragment { - @BindView(R.id.about_image) ImageView imageView; - @BindView(R.id.about_text) TextView textView; - @BindView(R.id.about_translators_label) TextView translatorsLabel; - @BindView(R.id.about_translators) TextView translatorsView; public AboutFragment() { @@ -56,7 +51,11 @@ public class AboutFragment extends BaseFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); + final FragmentAboutBinding binding = FragmentAboutBinding.bind(view); + imageView = binding.aboutImage; + textView = binding.aboutText; + translatorsLabel = binding.aboutTranslatorsLabel; + translatorsView = binding.aboutTranslators; if (App.getTheme().light) { imageView.setImageResource(R.drawable.logo_wizard_light); } diff --git a/app/src/main/java/org/solovyev/android/calculator/about/ReleaseNotesFragment.java b/app/src/main/java/org/solovyev/android/calculator/about/ReleaseNotesFragment.java index 78e3e10a..6f2b3f92 100644 --- a/app/src/main/java/org/solovyev/android/calculator/about/ReleaseNotesFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/about/ReleaseNotesFragment.java @@ -29,15 +29,13 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import butterknife.BindView; -import butterknife.ButterKnife; import org.solovyev.android.calculator.BaseFragment; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.FragmentReleaseNotesBinding; import org.solovyev.android.calculator.release.ReleaseNotes; public class ReleaseNotesFragment extends BaseFragment { - @BindView(R.id.releasenotes_text) TextView text; public ReleaseNotesFragment() { @@ -47,7 +45,8 @@ public class ReleaseNotesFragment extends BaseFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); + final FragmentReleaseNotesBinding binding = FragmentReleaseNotesBinding.bind(view); + text = binding.releasenotesText; text.setMovementMethod(LinkMovementMethod.getInstance()); text.setText(Html.fromHtml(ReleaseNotes.getReleaseNotes(getActivity()))); return view; diff --git a/app/src/main/java/org/solovyev/android/calculator/calculations/BaseConversionEvent.java b/app/src/main/java/org/solovyev/android/calculator/calculations/BaseConversionEvent.java index 2d011639..d6d10889 100644 --- a/app/src/main/java/org/solovyev/android/calculator/calculations/BaseConversionEvent.java +++ b/app/src/main/java/org/solovyev/android/calculator/calculations/BaseConversionEvent.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.calculations; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.DisplayState; diff --git a/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFailedEvent.java b/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFailedEvent.java index 62636d8d..d689f317 100644 --- a/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFailedEvent.java +++ b/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFailedEvent.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.calculations; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.DisplayState; diff --git a/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFinishedEvent.java b/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFinishedEvent.java index 7c207923..50743a03 100644 --- a/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFinishedEvent.java +++ b/app/src/main/java/org/solovyev/android/calculator/calculations/ConversionFinishedEvent.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.calculations; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.DisplayState; diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/Converter.java b/app/src/main/java/org/solovyev/android/calculator/converter/Converter.java index bb2dc58d..8307be89 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/Converter.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/Converter.java @@ -1,14 +1,14 @@ package org.solovyev.android.calculator.converter; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import com.google.common.base.Strings; +import javax.measure.unit.Unit; import jscl.JsclMathEngine; import midpcalc.Real; import org.solovyev.android.calculator.R; import javax.annotation.Nonnull; -import javax.measure.unit.Unit; final class Converter { static int unitName(@Nonnull Unit unit, @Nonnull UnitDimension dimension) { diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java b/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java index 2cf22c3e..c51a2f8a 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/ConverterFragment.java @@ -6,11 +6,8 @@ import android.content.DialogInterface; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.design.widget.TextInputLayout; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.Editable; import android.text.InputType; import android.text.TextUtils; @@ -29,6 +26,9 @@ import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.FragmentActivity; +import com.google.android.material.textfield.TextInputLayout; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.AppModule; @@ -38,6 +38,7 @@ import org.solovyev.android.calculator.Editor; import org.solovyev.android.calculator.Keyboard; import org.solovyev.android.calculator.Named; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.CppUnitConverterBinding; import org.solovyev.android.calculator.keyboard.FloatingKeyboard; import org.solovyev.android.calculator.keyboard.FloatingKeyboardWindow; import org.solovyev.android.calculator.keyboard.FloatingNumberKeyboard; @@ -48,9 +49,6 @@ import org.solovyev.android.calculator.view.EditTextCompat; import javax.annotation.Nonnull; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; - import static org.solovyev.android.calculator.UiPreferences.Converter.lastDimension; import static org.solovyev.android.calculator.UiPreferences.Converter.lastUnitsFrom; import static org.solovyev.android.calculator.UiPreferences.Converter.lastUnitsTo; @@ -77,21 +75,13 @@ public class ConverterFragment extends BaseDialogFragment SharedPreferences uiPreferences; @Inject Editor editor; - @BindView(R.id.converter_dimensions_spinner) Spinner dimensionsSpinner; - @BindView(R.id.converter_spinner_from) Spinner spinnerFrom; - @BindView(R.id.converter_label_from) TextInputLayout labelFrom; - @BindView(R.id.converter_edittext_from) EditTextCompat editTextFrom; - @BindView(R.id.converter_spinner_to) Spinner spinnerTo; - @BindView(R.id.converter_label_to) TextInputLayout labelTo; - @BindView(R.id.converter_edittext_to) EditText editTextTo; - @BindView(R.id.converter_swap_button) ImageButton swapButton; private ArrayAdapter> dimensionsAdapter; private ArrayAdapter> adapterFrom; @@ -139,9 +129,15 @@ public class ConverterFragment extends BaseDialogFragment @Override protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @Nullable Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.cpp_unit_converter, null); - ButterKnife.bind(this, view); - + final CppUnitConverterBinding binding = CppUnitConverterBinding.inflate(inflater, null, false); + dimensionsSpinner = binding.converterDimensionsSpinner; + spinnerFrom = binding.converterSpinnerFrom; + labelFrom = binding.converterLabelFrom; + editTextFrom = binding.converterEdittextFrom; + spinnerTo = binding.converterSpinnerTo; + labelTo = binding.converterLabelTo; + editTextTo = binding.converterEdittextTo; + swapButton = binding.converterSwapButton; dimensionsAdapter = App.makeSimpleSpinnerAdapter(context); for (ConvertibleDimension dimension : UnitDimension.values()) { dimensionsAdapter.add(dimension.named(context)); @@ -177,7 +173,7 @@ public class ConverterFragment extends BaseDialogFragment pendingToSelection = savedInstanceState.getInt(STATE_SELECTION_TO, NONE); } - return view; + return binding.getRoot(); } @Override @@ -203,16 +199,13 @@ public class ConverterFragment extends BaseDialogFragment @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { - switch (parent.getId()) { - case R.id.converter_dimensions_spinner: - onDimensionChanged(dimensionsAdapter.getItem(position).item); - break; - case R.id.converter_spinner_from: - onUnitFromChanged(adapterFrom.getItem(position).item); - break; - case R.id.converter_spinner_to: - convert(); - break; + int parentId = parent.getId(); + if (parentId == R.id.converter_dimensions_spinner) { + onDimensionChanged(dimensionsAdapter.getItem(position).item); + } else if (parentId == R.id.converter_spinner_from) { + onUnitFromChanged(adapterFrom.getItem(position).item); + } else if (parentId == R.id.converter_spinner_to) { + convert(); } } @@ -299,15 +292,13 @@ public class ConverterFragment extends BaseDialogFragment @Override public void onFocusChange(View v, boolean hasFocus) { - switch (v.getId()) { - case R.id.converter_edittext_from: - if (!hasFocus) { - convert(); - } else { - clearError(labelFrom); - showKeyboard(); - } - break; + if (v.getId() == R.id.converter_edittext_from) { + if (!hasFocus) { + convert(); + } else { + clearError(labelFrom); + showKeyboard(); + } } } @@ -346,31 +337,26 @@ public class ConverterFragment extends BaseDialogFragment @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { - switch (v.getId()) { - case R.id.converter_edittext_from: - if (actionId == EditorInfo.IME_ACTION_DONE) { - App.hideIme(editTextFrom); - convert(); - return true; - } - break; + if (v.getId() == R.id.converter_edittext_from) { + if (actionId == EditorInfo.IME_ACTION_DONE) { + App.hideIme(editTextFrom); + convert(); + return true; + } } return false; } @Override public void onClick(View v) { - switch (v.getId()) { - case R.id.converter_swap_button: - keyboardWindow.hide(); - swap(); - break; - case R.id.converter_edittext_from: - showKeyboard(); - break; - default: - super.onClick(v); - break; + int id = v.getId(); + if (id == R.id.converter_swap_button) { + keyboardWindow.hide(); + swap(); + } else if (id == R.id.converter_edittext_from) { + showKeyboard(); + } else { + super.onClick(v); } } diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/Convertible.java b/app/src/main/java/org/solovyev/android/calculator/converter/Convertible.java index 701fe7b0..dbee74a1 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/Convertible.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/Convertible.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.converter; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.Named; diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/ConvertibleDimension.java b/app/src/main/java/org/solovyev/android/calculator/converter/ConvertibleDimension.java index f945b4dc..4e485141 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/ConvertibleDimension.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/ConvertibleDimension.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.converter; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.Named; diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseConvertible.java b/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseConvertible.java index 5c5dc63c..e5ba81f8 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseConvertible.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseConvertible.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.converter; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.Named; diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseDimension.java b/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseDimension.java index 8368101e..17c338ce 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseDimension.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/NumeralBaseDimension.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.converter; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import jscl.NumeralBase; import org.solovyev.android.calculator.Named; diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/UnitConvertible.java b/app/src/main/java/org/solovyev/android/calculator/converter/UnitConvertible.java index 91aadf3f..20ae3160 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/UnitConvertible.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/UnitConvertible.java @@ -1,15 +1,15 @@ package org.solovyev.android.calculator.converter; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; +import javax.measure.unit.Unit; import org.solovyev.android.calculator.Named; import jscl.JsclMathEngine; import jscl.NumeralBase; import javax.annotation.Nonnull; -import javax.measure.unit.Unit; final class UnitConvertible implements Convertible { @NonNull diff --git a/app/src/main/java/org/solovyev/android/calculator/converter/UnitDimension.java b/app/src/main/java/org/solovyev/android/calculator/converter/UnitDimension.java index 9fbd4b35..499fb0cf 100644 --- a/app/src/main/java/org/solovyev/android/calculator/converter/UnitDimension.java +++ b/app/src/main/java/org/solovyev/android/calculator/converter/UnitDimension.java @@ -1,9 +1,9 @@ package org.solovyev.android.calculator.converter; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; import org.solovyev.android.calculator.Named; import org.solovyev.android.calculator.R; diff --git a/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java b/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java index 56b432e2..dce928ba 100644 --- a/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java @@ -25,11 +25,11 @@ package org.solovyev.android.calculator.entities; import android.app.Activity; import android.content.Context; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; -import android.support.v7.widget.DividerItemDecoration; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.DividerItemDecoration; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.text.ClipboardManager; import android.text.TextUtils; import android.view.ContextMenu; @@ -45,6 +45,8 @@ import org.solovyev.android.calculator.BaseFragment; import org.solovyev.android.calculator.CalculatorActivity; import org.solovyev.android.calculator.Keyboard; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.FragmentEntitiesBinding; +import org.solovyev.android.calculator.databinding.FragmentEntitiesItemBinding; import org.solovyev.common.math.MathEntity; import org.solovyev.common.text.Strings; @@ -57,8 +59,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; public abstract class BaseEntitiesFragment extends BaseFragment { @@ -71,7 +71,6 @@ public abstract class BaseEntitiesFragment extends BaseFra } }; - @BindView(R.id.entities_recyclerview) public RecyclerView recyclerView; @Inject Keyboard keyboard; @@ -96,7 +95,8 @@ public abstract class BaseEntitiesFragment extends BaseFra @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); + final FragmentEntitiesBinding binding = FragmentEntitiesBinding.bind(view); + recyclerView = binding.entitiesRecyclerview; final Context context = inflater.getContext(); adapter = new EntitiesAdapter(context, TextUtils.isEmpty(category) ? getEntities() : getEntities(category)); recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); @@ -204,19 +204,18 @@ public abstract class BaseEntitiesFragment extends BaseFra protected abstract boolean onMenuItemClicked(@Nonnull MenuItem item, @Nonnull E entity); public class EntityViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener { - @BindView(R.id.entity_text) TextView textView; - @BindView(R.id.entity_description) TextView descriptionView; @Nullable private E entity; - public EntityViewHolder(@Nonnull View view) { - super(view); + public EntityViewHolder(@Nonnull FragmentEntitiesItemBinding binding) { + super(binding.getRoot()); BaseActivity.fixFonts(itemView, typeface); - ButterKnife.bind(this, view); - view.setOnClickListener(this); - view.setOnCreateContextMenuListener(this); + textView = binding.entityText; + descriptionView = binding.entityDescription; + itemView.setOnClickListener(this); + itemView.setOnCreateContextMenuListener(this); } public void bind(@Nonnull E entity) { @@ -266,7 +265,7 @@ public abstract class BaseEntitiesFragment extends BaseFra @Override public EntityViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - return new EntityViewHolder(inflater.inflate(R.layout.fragment_entities_item, parent, false)); + return new EntityViewHolder(FragmentEntitiesItemBinding.inflate(inflater, parent, false)); } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesRegistry.java b/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesRegistry.java index 01af496f..2ea1df86 100644 --- a/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesRegistry.java @@ -25,8 +25,8 @@ package org.solovyev.android.calculator.entities; import android.app.Application; import android.content.SharedPreferences; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; import com.squareup.otto.Bus; diff --git a/app/src/main/java/org/solovyev/android/calculator/entities/Category.java b/app/src/main/java/org/solovyev/android/calculator/entities/Category.java index bab2a075..0495dfca 100644 --- a/app/src/main/java/org/solovyev/android/calculator/entities/Category.java +++ b/app/src/main/java/org/solovyev/android/calculator/entities/Category.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.entities; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import org.solovyev.common.math.MathEntity; diff --git a/app/src/main/java/org/solovyev/android/calculator/entities/Entities.java b/app/src/main/java/org/solovyev/android/calculator/entities/Entities.java index 00fc61e9..1d96451b 100644 --- a/app/src/main/java/org/solovyev/android/calculator/entities/Entities.java +++ b/app/src/main/java/org/solovyev/android/calculator/entities/Entities.java @@ -1,6 +1,6 @@ package org.solovyev.android.calculator.entities; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.common.math.MathEntity; diff --git a/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorFragment.java b/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorFragment.java index a691dd25..61b18eba 100644 --- a/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorFragment.java @@ -3,10 +3,10 @@ package org.solovyev.android.calculator.errors; import android.app.Activity; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.FragmentManager; import org.solovyev.android.Check; import org.solovyev.android.calculator.*; diff --git a/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorsActivity.java b/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorsActivity.java index 4352314d..4a64da98 100644 --- a/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorsActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/errors/FixableErrorsActivity.java @@ -26,8 +26,8 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v7.app.AppCompatActivity; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.UiPreferences; import org.solovyev.common.msg.Message; diff --git a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorActivity.java b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorActivity.java index 020db385..730b8d52 100644 --- a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorActivity.java @@ -27,11 +27,11 @@ import android.content.DialogInterface; import android.os.Build; import android.os.Bundle; import android.provider.Settings; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.FragmentActivity; import org.solovyev.android.Check; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.BaseDialogFragment; diff --git a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java index 4a4fc719..2cd1ebd0 100644 --- a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java +++ b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java @@ -29,7 +29,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.IBinder; -import android.support.v4.app.NotificationCompat; +import androidx.core.app.NotificationCompat; import android.util.DisplayMetrics; import android.view.WindowManager; import com.squareup.otto.Bus; @@ -173,7 +173,7 @@ public class FloatingCalculatorService extends Service implements FloatingViewLi builder.setOngoing(true); final Intent intent = createShowWindowIntent(this); - builder.setContentIntent(PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)); + builder.setContentIntent(PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE)); final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(NOTIFICATION_ID, builder.build()); diff --git a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorView.java b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorView.java index f1cdd753..d1fe5005 100644 --- a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorView.java +++ b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorView.java @@ -32,7 +32,7 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.DisplayMetrics; import android.view.ContextThemeWrapper; import android.view.Display; @@ -209,7 +209,7 @@ public class FloatingCalculatorView { y = in.readInt(); } - @android.support.annotation.Nullable + @androidx.annotation.Nullable public static State fromPrefs(@NonNull SharedPreferences prefs) { if(!prefs.contains("width")) { return null; diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/BaseFunctionFragment.java b/app/src/main/java/org/solovyev/android/calculator/functions/BaseFunctionFragment.java index 1ff41561..51be036e 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/BaseFunctionFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/BaseFunctionFragment.java @@ -27,10 +27,8 @@ import android.content.Context; import android.content.DialogInterface; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.design.widget.TextInputLayout; -import android.support.v7.app.AlertDialog; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; import android.text.Editable; import android.text.TextUtils; import android.view.ContextMenu; @@ -44,6 +42,8 @@ import android.view.ViewParent; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; +import androidx.appcompat.app.AlertDialog; +import com.google.android.material.textfield.TextInputLayout; import org.solovyev.android.Check; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.BaseDialogFragment; @@ -69,8 +69,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; import jscl.math.function.IConstant; import static org.solovyev.android.calculator.functions.CppFunction.NO_ID; @@ -86,20 +84,12 @@ public abstract class BaseFunctionFragment extends BaseDialogFragment implements private final FloatingKeyboardWindow keyboardWindow = new FloatingKeyboardWindow(null); @NonNull private final KeyboardUser keyboardUser = new KeyboardUser(); - @BindView(R.id.function_params) - public - FunctionParamsView paramsView; - @BindView(R.id.function_name_label) - TextInputLayout nameLabel; - @BindView(R.id.function_name) + public FunctionParamsView paramsView; + public TextInputLayout nameLabel; public EditText nameView; - @BindView(R.id.function_body_label) public TextInputLayout bodyLabel; - @BindView(R.id.function_body) public EditTextCompat bodyView; - @BindView(R.id.function_description_label) public TextInputLayout descriptionLabel; - @BindView(R.id.function_description) public EditText descriptionView; @Inject Calculator calculator; @@ -181,23 +171,20 @@ public abstract class BaseFunctionFragment extends BaseDialogFragment implements } final int id = v.getId(); - switch (id) { - case R.id.function_name: - if (hasFocus) { - clearError(nameLabel); - } else { - validateName(); - } - break; - case R.id.function_body: - if (hasFocus) { - clearError(bodyLabel); - showKeyboard(); - } else { - keyboardWindow.hide(); - validateBody(); - } - break; + if (id == R.id.function_name) { + if (hasFocus) { + clearError(nameLabel); + } else { + validateName(); + } + } else if (id == R.id.function_body) { + if (hasFocus) { + clearError(bodyLabel); + showKeyboard(); + } else { + keyboardWindow.hide(); + validateBody(); + } } } @@ -219,13 +206,10 @@ public abstract class BaseFunctionFragment extends BaseDialogFragment implements @Override public void onClick(View v) { - switch (v.getId()) { - case R.id.function_body: - showKeyboard(); - break; - default: - super.onClick(v); - break; + if (v.getId() == R.id.function_body) { + showKeyboard(); + } else { + super.onClick(v); } } @@ -348,7 +332,13 @@ public abstract class BaseFunctionFragment extends BaseDialogFragment implements @Override protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @Nullable Bundle savedInstanceState) { final View view = inflater.inflate(layout, null); - ButterKnife.bind(this, view); + paramsView = view.findViewById(R.id.function_params); + nameLabel = view.findViewById(R.id.function_name_label); + nameView = view.findViewById(R.id.function_name); + bodyLabel = view.findViewById(R.id.function_body_label); + bodyView = view.findViewById(R.id.function_body); + descriptionLabel = view.findViewById(R.id.function_description_label); + descriptionView = view.findViewById(R.id.function_description); if (savedInstanceState == null && function != null) { paramsView.addParams(function.getParameters()); diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/CppFunction.java b/app/src/main/java/org/solovyev/android/calculator/functions/CppFunction.java index bce2c93b..1d39104f 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/CppFunction.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/CppFunction.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.functions; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import jscl.math.function.CustomFunction; import jscl.math.function.IFunction; diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/EditFunctionFragment.java b/app/src/main/java/org/solovyev/android/calculator/functions/EditFunctionFragment.java index 23452fa5..9cb51356 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/EditFunctionFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/EditFunctionFragment.java @@ -4,10 +4,10 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; +import androidx.annotation.NonNull; import android.text.TextUtils; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; import jscl.math.function.Function; import org.solovyev.android.Check; import org.solovyev.android.calculator.App; diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionCategory.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionCategory.java index eb0b9739..290ed5eb 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionCategory.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionCategory.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator.functions; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.entities.Category; diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionParamsView.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionParamsView.java index 1ff24d46..062e8646 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionParamsView.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionParamsView.java @@ -22,6 +22,7 @@ package org.solovyev.android.calculator.functions; +import com.google.android.material.textfield.TextInputLayout; import org.solovyev.android.Check; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.Preferences; @@ -33,8 +34,7 @@ import android.content.res.Resources; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; -import android.support.design.widget.TextInputLayout; +import androidx.annotation.NonNull; import android.util.AttributeSet; import android.util.TypedValue; import android.view.Gravity; @@ -132,7 +132,7 @@ public class FunctionParamsView extends LinearLayout { addButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE); addButton.setPadding(imageButtonPadding, imageButtonPadding, imageButtonPadding, imageButtonPadding); final TypedValue value = new TypedValue(); - if (getContext().getTheme().resolveAttribute(R.attr.selectableItemBackgroundBorderless, value, true)) { + if (getContext().getTheme().resolveAttribute(androidx.appcompat.R.attr.selectableItemBackgroundBorderless, value, true)) { addButton.setBackgroundResource(value.resourceId); } return addButton; diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsActivity.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsActivity.java index 44edd40e..50b29ecd 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsActivity.java @@ -24,7 +24,7 @@ package org.solovyev.android.calculator.functions; import android.content.Context; import android.os.Bundle; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.View; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.BaseActivity; @@ -91,4 +91,4 @@ public class FunctionsActivity extends BaseActivity { public static final class Dialog extends FunctionsActivity { } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsFragment.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsFragment.java index 1b71abe9..cd770676 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsFragment.java @@ -24,9 +24,9 @@ package org.solovyev.android.calculator.functions; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; import android.view.*; +import androidx.fragment.app.FragmentActivity; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import jscl.math.function.Function; @@ -79,25 +79,25 @@ public class FunctionsFragment extends BaseEntitiesFragment { @Override protected boolean onMenuItemClicked(@Nonnull MenuItem item, @Nonnull final Function function) { final FragmentActivity activity = getActivity(); - switch (item.getItemId()) { - case R.string.c_use: - onClick(function); - return true; - case R.string.cpp_edit: - if (function instanceof IFunction) { - EditFunctionFragment.show(CppFunction.builder((IFunction) function).build(), + int itemId = item.getItemId(); + if (itemId == R.string.c_use) { + onClick(function); + return true; + } else if (itemId == R.string.cpp_edit) { + if (function instanceof IFunction) { + EditFunctionFragment.show(CppFunction.builder((IFunction) function).build(), activity.getSupportFragmentManager()); + } + return true; + } else if (itemId == R.string.cpp_delete) { + RemovalConfirmationDialog.showForFunction(getActivity(), function.getName(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Check.isTrue(which == DialogInterface.BUTTON_POSITIVE); + registry.remove(function); } - return true; - case R.string.cpp_delete: - RemovalConfirmationDialog.showForFunction(getActivity(), function.getName(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Check.isTrue(which == DialogInterface.BUTTON_POSITIVE); - registry.remove(function); - } - }); - return true; + }); + return true; } return false; } diff --git a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsRegistry.java index 5800fc1d..f286d5de 100644 --- a/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsRegistry.java @@ -24,7 +24,7 @@ package org.solovyev.android.calculator.functions; import static android.text.TextUtils.isEmpty; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; diff --git a/app/src/main/java/org/solovyev/android/calculator/history/BaseHistoryFragment.java b/app/src/main/java/org/solovyev/android/calculator/history/BaseHistoryFragment.java index aef25408..162dbb71 100644 --- a/app/src/main/java/org/solovyev/android/calculator/history/BaseHistoryFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/history/BaseHistoryFragment.java @@ -29,11 +29,7 @@ import android.app.Activity; import android.content.Context; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; -import android.support.v7.widget.DividerItemDecoration; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; import android.text.ClipboardManager; import android.text.format.DateUtils; import android.view.ContextMenu; @@ -43,6 +39,10 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.FragmentActivity; +import androidx.recyclerview.widget.DividerItemDecoration; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; @@ -53,6 +53,8 @@ import org.solovyev.android.calculator.BaseFragment; import org.solovyev.android.calculator.CalculatorActivity; import org.solovyev.android.calculator.Editor; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.FragmentHistoryBinding; +import org.solovyev.android.calculator.databinding.FragmentHistoryItemBinding; import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.common.text.Strings; @@ -62,8 +64,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; public abstract class BaseHistoryFragment extends BaseFragment { private final boolean recentHistory; @@ -75,7 +75,6 @@ public abstract class BaseHistoryFragment extends BaseFragment { Bus bus; @Inject Typeface typeface; - @BindView(R.id.history_recyclerview) RecyclerView recyclerView; private HistoryAdapter adapter; @@ -111,7 +110,8 @@ public abstract class BaseHistoryFragment extends BaseFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); + FragmentHistoryBinding binding = FragmentHistoryBinding.bind(view); + recyclerView = binding.historyRecyclerview; final Context context = inflater.getContext(); adapter = new HistoryAdapter(context); bus.register(adapter); @@ -156,21 +156,20 @@ public abstract class BaseHistoryFragment extends BaseFragment { public class HistoryViewHolder extends RecyclerView.ViewHolder implements View.OnCreateContextMenuListener, View.OnClickListener, MenuItem.OnMenuItemClickListener { private static final int DATETIME_FORMAT = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_ABBREV_TIME; - @BindView(R.id.history_item_value) TextView valueView; - @BindView(R.id.history_item_comment) TextView commentView; - @BindView(R.id.history_item_time) TextView timeView; @Nullable private HistoryState state; - public HistoryViewHolder(View view) { - super(view); - BaseActivity.fixFonts(view, typeface); - ButterKnife.bind(this, view); - view.setOnCreateContextMenuListener(this); - view.setOnClickListener(this); + public HistoryViewHolder(@NonNull FragmentHistoryItemBinding binding) { + super(binding.getRoot()); + BaseActivity.fixFonts(binding.getRoot(), typeface); + valueView = binding.historyItemValue; + commentView = binding.historyItemComment; + timeView = binding.historyItemTime; + itemView.setOnCreateContextMenuListener(this); + itemView.setOnClickListener(this); } void bind(@Nonnull HistoryState state) { @@ -217,25 +216,25 @@ public abstract class BaseHistoryFragment extends BaseFragment { @Override public boolean onMenuItemClick(MenuItem item) { Check.isNotNull(state); - switch (item.getItemId()) { - case R.string.c_use: - useState(state); - return true; - case R.string.c_copy_expression: - copyExpression(state); - return true; - case R.string.c_copy_result: - copyResult(state); - return true; - case R.string.cpp_edit: - EditHistoryFragment.show(state, false, getFragmentManager()); - return true; - case R.string.c_save: - EditHistoryFragment.show(state, true, getFragmentManager()); - return true; - case R.string.cpp_delete: - history.removeSaved(state); - return true; + int itemId = item.getItemId(); + if (itemId == R.string.c_use) { + useState(state); + return true; + } else if (itemId == R.string.c_copy_expression) { + copyExpression(state); + return true; + } else if (itemId == R.string.c_copy_result) { + copyResult(state); + return true; + } else if (itemId == R.string.cpp_edit) { + EditHistoryFragment.show(state, false, getParentFragmentManager()); + return true; + } else if (itemId == R.string.c_save) { + EditHistoryFragment.show(state, true, getParentFragmentManager()); + return true; + } else if (itemId == R.string.cpp_delete) { + history.removeSaved(state); + return true; } return false; } @@ -262,7 +261,7 @@ public abstract class BaseHistoryFragment extends BaseFragment { @Override public HistoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - return new HistoryViewHolder(inflater.inflate(R.layout.fragment_history_item, parent, false)); + return new HistoryViewHolder(FragmentHistoryItemBinding.inflate(inflater, parent, false)); } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/history/EditHistoryFragment.java b/app/src/main/java/org/solovyev/android/calculator/history/EditHistoryFragment.java index ed9e0dda..34426baf 100644 --- a/app/src/main/java/org/solovyev/android/calculator/history/EditHistoryFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/history/EditHistoryFragment.java @@ -4,22 +4,21 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.TextView; -import butterknife.BindView; -import butterknife.ButterKnife; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.FragmentManager; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.BaseDialogFragment; import org.solovyev.android.calculator.R; import javax.inject.Inject; +import org.solovyev.android.calculator.databinding.FragmentHistoryEditBinding; public class EditHistoryFragment extends BaseDialogFragment { @@ -33,10 +32,7 @@ public class EditHistoryFragment extends BaseDialogFragment { boolean newState; - @BindView(R.id.history_expression) TextView expressionView; - - @BindView(R.id.history_comment) EditText commentView; public static void show(@NonNull HistoryState state, boolean newState, @NonNull FragmentManager fm) { @@ -95,12 +91,13 @@ public class EditHistoryFragment extends BaseDialogFragment { @NonNull @Override protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @Nullable Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.fragment_history_edit, null); - ButterKnife.bind(this, view); + final FragmentHistoryEditBinding binding = FragmentHistoryEditBinding.inflate(inflater, null, false); + expressionView = binding.historyExpression; + commentView = binding.historyComment; if (savedInstanceState == null) { expressionView.setText(BaseHistoryFragment.getHistoryText(state)); commentView.setText(state.getComment()); } - return view; + return binding.getRoot(); } } diff --git a/app/src/main/java/org/solovyev/android/calculator/history/History.java b/app/src/main/java/org/solovyev/android/calculator/history/History.java index 76d2b2c7..7c30afab 100644 --- a/app/src/main/java/org/solovyev/android/calculator/history/History.java +++ b/app/src/main/java/org/solovyev/android/calculator/history/History.java @@ -27,7 +27,7 @@ import static android.text.TextUtils.isEmpty; import android.app.Application; import android.content.SharedPreferences; import android.os.Handler; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import com.google.common.base.Strings; @@ -466,4 +466,4 @@ public class History { }); } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/history/HistoryActivity.java b/app/src/main/java/org/solovyev/android/calculator/history/HistoryActivity.java index 62953c93..932386d5 100644 --- a/app/src/main/java/org/solovyev/android/calculator/history/HistoryActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/history/HistoryActivity.java @@ -25,11 +25,11 @@ package org.solovyev.android.calculator.history; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; import android.view.View; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.Fragment; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.BaseActivity; diff --git a/app/src/main/java/org/solovyev/android/calculator/history/HistoryState.java b/app/src/main/java/org/solovyev/android/calculator/history/HistoryState.java index 9124d9a5..0ad322f4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/history/HistoryState.java +++ b/app/src/main/java/org/solovyev/android/calculator/history/HistoryState.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.history; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.json.JSONException; diff --git a/app/src/main/java/org/solovyev/android/calculator/history/RecentHistory.java b/app/src/main/java/org/solovyev/android/calculator/history/RecentHistory.java index 6b966500..01445640 100644 --- a/app/src/main/java/org/solovyev/android/calculator/history/RecentHistory.java +++ b/app/src/main/java/org/solovyev/android/calculator/history/RecentHistory.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.history; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.solovyev.android.Check; import java.util.Collections; diff --git a/app/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java b/app/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java index 13cfec2d..a8b8ea4a 100644 --- a/app/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java +++ b/app/src/main/java/org/solovyev/android/calculator/jscl/JsclOperation.java @@ -23,7 +23,7 @@ package org.solovyev.android.calculator.jscl; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import jscl.MathEngine; import jscl.math.Generic; import jscl.text.ParseException; diff --git a/app/src/main/java/org/solovyev/android/calculator/json/Json.java b/app/src/main/java/org/solovyev/android/calculator/json/Json.java index e65ad179..98f11754 100644 --- a/app/src/main/java/org/solovyev/android/calculator/json/Json.java +++ b/app/src/main/java/org/solovyev/android/calculator/json/Json.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.json; import static android.text.TextUtils.isEmpty; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Log; import org.json.JSONArray; diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseFloatingKeyboard.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseFloatingKeyboard.java index bbe53867..66322da1 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseFloatingKeyboard.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseFloatingKeyboard.java @@ -3,10 +3,10 @@ package org.solovyev.android.calculator.keyboard; import android.content.res.Resources; import android.graphics.Color; import android.os.Build; -import android.support.annotation.ColorInt; -import android.support.annotation.DrawableRes; -import android.support.annotation.IdRes; -import android.support.annotation.NonNull; +import androidx.annotation.ColorInt; +import androidx.annotation.DrawableRes; +import androidx.annotation.IdRes; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.util.TypedValue; import android.view.View; diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java index 8801cfcb..d75bc3f4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/BaseKeyboardUi.java @@ -11,8 +11,8 @@ import android.app.Activity; import android.app.Application; import android.content.Context; import android.content.SharedPreferences; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.TypedValue; diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboard.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboard.java index b1eeed64..d22c017a 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboard.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboard.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.keyboard; import android.content.Context; import android.graphics.Typeface; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.ViewGroup; import android.widget.EditText; diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java index 3a71f1c5..3ee7e6c6 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingKeyboardWindow.java @@ -4,8 +4,8 @@ import android.app.Dialog; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.Gravity; import android.view.View; import android.view.Window; diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingNumberKeyboard.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingNumberKeyboard.java index 17c130f4..e2757bcc 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingNumberKeyboard.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/FloatingNumberKeyboard.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.keyboard; -import android.support.annotation.IdRes; -import android.support.annotation.NonNull; +import androidx.annotation.IdRes; +import androidx.annotation.NonNull; import android.view.View; import android.widget.EditText; import android.widget.LinearLayout; @@ -93,13 +93,13 @@ public class FloatingNumberKeyboard extends BaseFloatingKeyboard { @Override public void onClick(View v) { final EditText editor = getUser().getEditor(); - switch (v.getId()) { - case R.id.cpp_kb_button_clear: - editor.setText(""); - return; - case R.id.cpp_kb_button_close: - getUser().done(); - return; + int id = v.getId(); + if (id == R.id.cpp_kb_button_clear) { + editor.setText(""); + return; + } else if (id == R.id.cpp_kb_button_close) { + getUser().done(); + return; } if (v instanceof TextView) { insertText(((TextView) v).getText()); diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java index f6eba6cc..6d33d37f 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/KeyboardUi.java @@ -3,10 +3,8 @@ package org.solovyev.android.calculator.keyboard; import android.app.Activity; import android.app.Application; import android.content.SharedPreferences; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.view.View; -import butterknife.BindView; -import butterknife.ButterKnife; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import jscl.NumeralBase; @@ -24,25 +22,15 @@ import static org.solovyev.android.views.dragbutton.DragDirection.*; public class KeyboardUi extends BaseKeyboardUi { - @BindView(R.id.cpp_button_0) public DirectionDragButton button0; - @BindView(R.id.cpp_button_1) public DirectionDragButton button1; - @BindView(R.id.cpp_button_2) public DirectionDragButton button2; - @BindView(R.id.cpp_button_3) public DirectionDragButton button3; - @BindView(R.id.cpp_button_4) public DirectionDragButton button4; - @BindView(R.id.cpp_button_5) public DirectionDragButton button5; - @BindView(R.id.cpp_button_6) public DirectionDragButton button6; - @BindView(R.id.cpp_button_7) public DirectionDragButton button7; - @BindView(R.id.cpp_button_8) public DirectionDragButton button8; - @BindView(R.id.cpp_button_9) public DirectionDragButton button9; @Inject Engine engine; @@ -52,35 +40,22 @@ public class KeyboardUi extends BaseKeyboardUi { Bus bus; @Inject PartialKeyboardUi partialUi; - @BindView(R.id.cpp_button_vars) DirectionDragButton variablesButton; @Nullable - @BindView(R.id.cpp_button_operators) DirectionDragButton operatorsButton; - @BindView(R.id.cpp_button_functions) DirectionDragButton functionsButton; - @BindView(R.id.cpp_button_history) DirectionDragButton historyButton; - @BindView(R.id.cpp_button_multiplication) DirectionDragButton multiplicationButton; - @BindView(R.id.cpp_button_plus) DirectionDragButton plusButton; - @BindView(R.id.cpp_button_subtraction) DirectionDragButton subtractionButton; - @BindView(R.id.cpp_button_division) DirectionDragButton divisionButton; - @BindView(R.id.cpp_button_period) DirectionDragButton periodButton; - @BindView(R.id.cpp_button_round_brackets) DirectionDragButton bracketsButton; @Nullable - @BindView(R.id.cpp_button_like) DirectionDragButton likeButton; @Nullable - @BindView(R.id.cpp_button_percent) DirectionDragButton percentButton; @Nullable - @BindView(R.id.cpp_button_memory) DirectionDragButton memoryButton; @Inject @@ -101,7 +76,30 @@ public class KeyboardUi extends BaseKeyboardUi { public void onCreateView(@Nonnull Activity activity, @Nonnull View view) { super.onCreateView(activity, view); partialUi.onCreateView(activity, view); - ButterKnife.bind(this, view); + button0 = view.findViewById(R.id.cpp_button_0); + button1 = view.findViewById(R.id.cpp_button_1); + button2 = view.findViewById(R.id.cpp_button_2); + button3 = view.findViewById(R.id.cpp_button_3); + button4 = view.findViewById(R.id.cpp_button_4); + button5 = view.findViewById(R.id.cpp_button_5); + button6 = view.findViewById(R.id.cpp_button_6); + button7 = view.findViewById(R.id.cpp_button_7); + button8 = view.findViewById(R.id.cpp_button_8); + button9 = view.findViewById(R.id.cpp_button_9); + + variablesButton = view.findViewById(R.id.cpp_button_vars); + operatorsButton = view.findViewById(R.id.cpp_button_operators); + functionsButton = view.findViewById(R.id.cpp_button_functions); + historyButton = view.findViewById(R.id.cpp_button_history); + multiplicationButton = view.findViewById(R.id.cpp_button_multiplication); + plusButton = view.findViewById(R.id.cpp_button_plus); + subtractionButton = view.findViewById(R.id.cpp_button_subtraction); + divisionButton = view.findViewById(R.id.cpp_button_division); + periodButton = view.findViewById(R.id.cpp_button_period); + bracketsButton = view.findViewById(R.id.cpp_button_round_brackets); + likeButton = view.findViewById(R.id.cpp_button_like); + percentButton = view.findViewById(R.id.cpp_button_percent); + memoryButton = view.findViewById(R.id.cpp_button_memory); prepareButton(variablesButton); prepareButton(operatorsButton); @@ -169,4 +167,4 @@ public class KeyboardUi extends BaseKeyboardUi { public void onNumberModeChanged(@Nonnull Keyboard.NumberModeChangedEvent e) { updateNumberMode(e.mode); } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java b/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java index 1905d6ec..58d041cc 100644 --- a/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java +++ b/app/src/main/java/org/solovyev/android/calculator/keyboard/PartialKeyboardUi.java @@ -3,8 +3,8 @@ package org.solovyev.android.calculator.keyboard; import android.app.Activity; import android.app.Application; import android.content.SharedPreferences; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.View; import org.solovyev.android.calculator.R; @@ -14,28 +14,20 @@ import org.solovyev.android.views.dragbutton.DirectionDragButton; import javax.annotation.Nonnull; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; - import static org.solovyev.android.calculator.Preferences.Gui.vibrateOnKeypress; import static org.solovyev.android.views.dragbutton.DragDirection.down; public class PartialKeyboardUi extends BaseKeyboardUi { @Nullable - @BindView(R.id.cpp_button_right) DirectionDragButton rightButton; @Nullable - @BindView(R.id.cpp_button_left) DirectionDragButton leftButton; @Nullable - @BindView(R.id.cpp_button_clear) DirectionDragButton clearButton; @Nullable - @BindView(R.id.cpp_button_erase) DirectionDragButton eraseButton; @Nullable - @BindView(R.id.cpp_button_equals) DirectionDragButton equalsButton; @Nullable EditorLongClickEraser longClickEraser; @@ -48,7 +40,11 @@ public class PartialKeyboardUi extends BaseKeyboardUi { @Override public void onCreateView(@Nonnull Activity activity, @Nonnull View view) { super.onCreateView(activity, view); - ButterKnife.bind(this, view); + rightButton = view.findViewById(R.id.cpp_button_right); + leftButton = view.findViewById(R.id.cpp_button_left); + clearButton = view.findViewById(R.id.cpp_button_clear); + eraseButton = view.findViewById(R.id.cpp_button_erase); + equalsButton = view.findViewById(R.id.cpp_button_equals); prepareButton(rightButton); prepareButton(leftButton); prepareButton(equalsButton); diff --git a/app/src/main/java/org/solovyev/android/calculator/language/Language.java b/app/src/main/java/org/solovyev/android/calculator/language/Language.java index 21d0a2a0..3eefc4f9 100644 --- a/app/src/main/java/org/solovyev/android/calculator/language/Language.java +++ b/app/src/main/java/org/solovyev/android/calculator/language/Language.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.language; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.preferences.PreferenceEntry; diff --git a/app/src/main/java/org/solovyev/android/calculator/math/MathType.java b/app/src/main/java/org/solovyev/android/calculator/math/MathType.java index 89e464a9..2979863b 100644 --- a/app/src/main/java/org/solovyev/android/calculator/math/MathType.java +++ b/app/src/main/java/org/solovyev/android/calculator/math/MathType.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator.math; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import jscl.JsclMathEngine; import jscl.NumeralBase; import jscl.math.function.Constants; diff --git a/app/src/main/java/org/solovyev/android/calculator/memory/Memory.java b/app/src/main/java/org/solovyev/android/calculator/memory/Memory.java index 197c0ed1..5f49dbfa 100644 --- a/app/src/main/java/org/solovyev/android/calculator/memory/Memory.java +++ b/app/src/main/java/org/solovyev/android/calculator/memory/Memory.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.memory; import android.os.Handler; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.util.Log; diff --git a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorCategory.java b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorCategory.java index e546a883..be39a7a0 100644 --- a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorCategory.java +++ b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorCategory.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator.operators; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import jscl.math.operator.*; import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.entities.Category; diff --git a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsActivity.java b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsActivity.java index 0664d5e0..03cc0a3c 100644 --- a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsActivity.java @@ -23,7 +23,7 @@ package org.solovyev.android.calculator.operators; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.BaseActivity; diff --git a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsFragment.java b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsFragment.java index 5b4b6a40..73f3bab9 100644 --- a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsFragment.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator.operators; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.ContextMenu; import android.view.MenuItem; import jscl.math.operator.Operator; @@ -78,10 +78,9 @@ public class OperatorsFragment extends BaseEntitiesFragment { @Override protected boolean onMenuItemClicked(@Nonnull MenuItem item, @Nonnull Operator operator) { - switch (item.getItemId()) { - case R.string.c_use: - onClick(operator); - return true; + if (item.getItemId() == R.string.c_use) { + onClick(operator); + return true; } return false; diff --git a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsRegistry.java index 0332b271..30bb634d 100644 --- a/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsRegistry.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator.operators; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import jscl.JsclMathEngine; import jscl.math.operator.Operator; import org.solovyev.android.calculator.R; diff --git a/app/src/main/java/org/solovyev/android/calculator/operators/PostfixFunctionsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/operators/PostfixFunctionsRegistry.java index 74d61221..cea54e10 100644 --- a/app/src/main/java/org/solovyev/android/calculator/operators/PostfixFunctionsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/operators/PostfixFunctionsRegistry.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator.operators; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import jscl.JsclMathEngine; import jscl.math.operator.Operator; import org.solovyev.android.calculator.R; diff --git a/app/src/main/java/org/solovyev/android/calculator/plot/PlotActivity.java b/app/src/main/java/org/solovyev/android/calculator/plot/PlotActivity.java index 4a084e46..77024558 100644 --- a/app/src/main/java/org/solovyev/android/calculator/plot/PlotActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/plot/PlotActivity.java @@ -1,18 +1,19 @@ package org.solovyev.android.calculator.plot; import android.os.Bundle; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.BaseActivity; import org.solovyev.android.calculator.BaseFragment; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.FragmentPlotBinding; import org.solovyev.android.plotter.Dimensions; import org.solovyev.android.plotter.PlotData; import org.solovyev.android.plotter.PlotViewFrame; @@ -21,8 +22,6 @@ import org.solovyev.android.plotter.Plotter; import javax.annotation.Nonnull; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; public class PlotActivity extends BaseActivity { @@ -32,7 +31,6 @@ public class PlotActivity extends BaseActivity { @Inject Plotter plotter; - @BindView(R.id.plot_view_frame) PlotViewFrame plotView; public MyFragment() { @@ -49,7 +47,8 @@ public class PlotActivity extends BaseActivity { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = super.onCreateView(inflater, container, savedInstanceState); - ButterKnife.bind(this, view); + final FragmentPlotBinding binding = FragmentPlotBinding.bind(view); + plotView = binding.plotViewFrame; final PlotData pd = plotter.getPlotData(); pd.axisStyle.backgroundColor = ContextCompat.getColor(getActivity(), R.color.cpp_bg); diff --git a/app/src/main/java/org/solovyev/android/calculator/plot/PlotDimensionsFragment.java b/app/src/main/java/org/solovyev/android/calculator/plot/PlotDimensionsFragment.java index bb03376f..0af3d2bf 100644 --- a/app/src/main/java/org/solovyev/android/calculator/plot/PlotDimensionsFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/plot/PlotDimensionsFragment.java @@ -1,14 +1,10 @@ package org.solovyev.android.calculator.plot; -import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; import android.graphics.RectF; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.design.widget.TextInputLayout; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -19,24 +15,22 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.TextView; - +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.FragmentManager; +import com.google.android.material.textfield.TextInputLayout; +import java.util.Locale; +import javax.annotation.Nonnull; +import javax.inject.Inject; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.BaseDialogFragment; import org.solovyev.android.calculator.BaseFragment; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.FragmentPlotDimensionsBinding; import org.solovyev.android.plotter.Check; import org.solovyev.android.plotter.Plot; import org.solovyev.android.plotter.Plotter; -import java.util.Locale; - -import javax.annotation.Nonnull; -import javax.inject.Inject; - -import butterknife.BindView; -import butterknife.ButterKnife; - public class PlotDimensionsFragment extends BaseDialogFragment implements TextView.OnEditorActionListener { private static final String ARG_BOUNDS = "arg-bounds"; @@ -77,23 +71,14 @@ public class PlotDimensionsFragment extends BaseDialogFragment @Inject Plotter plotter; - @BindView(R.id.plot_x_min) EditText xMin; - @BindView(R.id.plot_x_min_label) TextInputLayout xMinLabel; - @BindView(R.id.plot_x_max) EditText xMax; - @BindView(R.id.plot_x_max_label) TextInputLayout xMaxLabel; - @BindView(R.id.plot_y_min) EditText yMin; - @BindView(R.id.plot_y_min_label) TextInputLayout yMinLabel; - @BindView(R.id.plot_y_max) EditText yMax; - @BindView(R.id.plot_y_max_label) TextInputLayout yMaxLabel; - @BindView(R.id.y_bounds) View yBounds; @NonNull private RectF bounds = new RectF(); @@ -160,9 +145,17 @@ public class PlotDimensionsFragment extends BaseDialogFragment @Override protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, Bundle savedInstanceState) { - @SuppressLint("InflateParams") final View view = - LayoutInflater.from(context).inflate(R.layout.fragment_plot_dimensions, null); - ButterKnife.bind(this, view); + final FragmentPlotDimensionsBinding binding = FragmentPlotDimensionsBinding.inflate(inflater, null, false); + + xMin = binding.plotXMin; + xMinLabel = binding.plotXMinLabel; + xMax = binding.plotXMax; + xMaxLabel = binding.plotXMaxLabel; + yMin = binding.plotYMin; + yMinLabel = binding.plotYMinLabel; + yMax = binding.plotYMax; + yMaxLabel = binding.plotYMaxLabel; + yBounds = binding.yBounds; setDimension(xMin, bounds.left); setDimension(xMax, bounds.right); @@ -175,7 +168,7 @@ public class PlotDimensionsFragment extends BaseDialogFragment if (d3) { yBounds.setVisibility(View.GONE); } - return view; + return binding.getRoot(); } @Override @@ -284,4 +277,4 @@ public class PlotDimensionsFragment extends BaseDialogFragment } return false; } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragment.java b/app/src/main/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragment.java index a388ace6..db5ebd55 100644 --- a/app/src/main/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/plot/PlotEditFunctionFragment.java @@ -3,19 +3,20 @@ package org.solovyev.android.calculator.plot; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentManager; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.widget.SeekBar; import android.widget.TextView; +import androidx.fragment.app.FragmentManager; import org.solovyev.android.Check; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.RemovalConfirmationDialog; +import org.solovyev.android.calculator.databinding.FragmentPlotFunctionEditBinding; import org.solovyev.android.calculator.functions.BaseFunctionFragment; import org.solovyev.android.calculator.functions.CppFunction; import org.solovyev.android.plotter.Color; @@ -30,7 +31,6 @@ import java.util.List; import javax.annotation.Nonnull; import javax.inject.Inject; -import butterknife.BindView; import jscl.math.function.CustomFunction; import uz.shift.colorpicker.LineColorPicker; import uz.shift.colorpicker.OnColorChangedListener; @@ -39,17 +39,11 @@ public class PlotEditFunctionFragment extends BaseFunctionFragment implements SeekBar.OnSeekBarChangeListener { @Inject Plotter plotter; - @BindView(R.id.fn_meshspec_views) View meshSpecViews; - @BindView(R.id.fn_color_label) TextView colorLabel; - @BindView(R.id.fn_color_picker) LineColorPicker colorPicker; - @BindView(R.id.fn_linewidth_label) TextView lineWidthLabel; - @BindView(R.id.fn_linewidth_seekbar) SeekBar lineWidthSeekBar; - @BindView(R.id.fn_iconview) PlotIconView iconView; private PlotFunction plotFunction; @@ -101,6 +95,13 @@ public class PlotEditFunctionFragment extends BaseFunctionFragment protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @Nullable Bundle savedInstanceState) { final View view = super.onCreateDialogView(context, inflater, savedInstanceState); + FragmentPlotFunctionEditBinding binding = FragmentPlotFunctionEditBinding.bind(view); + meshSpecViews = binding.fnMeshspecViews; + colorLabel = binding.fnColorLabel; + colorPicker = binding.fnColorPicker; + lineWidthLabel = binding.fnLinewidthLabel; + lineWidthSeekBar = binding.fnLinewidthSeekbar; + iconView = binding.fnIconview; colorPicker.setOnColorChangedListener(new OnColorChangedListener() { @Override public void onColorChanged(int c) { diff --git a/app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionsFragment.java b/app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionsFragment.java index 062e2e95..e38c0493 100644 --- a/app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionsFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/plot/PlotFunctionsFragment.java @@ -1,6 +1,5 @@ package org.solovyev.android.calculator.plot; -import static android.support.v7.widget.LinearLayoutManager.VERTICAL; import static android.view.Menu.NONE; import android.annotation.SuppressLint; @@ -8,13 +7,8 @@ import android.content.Context; import android.content.DialogInterface; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.DividerItemDecoration; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.MenuItem; @@ -22,11 +16,17 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.FragmentManager; +import androidx.recyclerview.widget.DividerItemDecoration; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.BaseActivity; import org.solovyev.android.calculator.BaseDialogFragment; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.databinding.FragmentFunctionsFunctionBinding; import org.solovyev.android.plotter.BasePlotterListener; import org.solovyev.android.plotter.PlotFunction; import org.solovyev.android.plotter.PlotIconView; @@ -37,8 +37,6 @@ import java.util.List; import javax.annotation.Nonnull; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; public class PlotFunctionsFragment extends BaseDialogFragment { @@ -75,7 +73,7 @@ public class PlotFunctionsFragment extends BaseDialogFragment { protected RecyclerView onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, Bundle savedInstanceState) { @SuppressLint("InflateParams") final RecyclerView view = (RecyclerView) inflater.inflate(R.layout.fragment_plot_functions, null); - view.setLayoutManager(new LinearLayoutManager(context, VERTICAL, false)); + view.setLayoutManager(new LinearLayoutManager(context, RecyclerView.VERTICAL, false)); view.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL)); adapter = new Adapter(plotter.getPlotData().functions); view.setAdapter(adapter); @@ -107,17 +105,16 @@ public class PlotFunctionsFragment extends BaseDialogFragment { public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener { - @BindView(R.id.function_icon) PlotIconView icon; - @BindView(R.id.function_name) TextView name; private PlotFunction function; - private ViewHolder(@NonNull View itemView) { - super(itemView); + private ViewHolder(@NonNull FragmentFunctionsFunctionBinding binding) { + super(binding.getRoot()); BaseActivity.fixFonts(itemView, typeface); - ButterKnife.bind(this, itemView); + icon = binding.functionIcon; + name = binding.functionName; itemView.setOnClickListener(this); itemView.setOnCreateContextMenuListener(this); } @@ -159,7 +156,7 @@ public class PlotFunctionsFragment extends BaseDialogFragment { @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { final LayoutInflater inflater = LayoutInflater.from(parent.getContext()); - return new ViewHolder(inflater.inflate(R.layout.fragment_functions_function, parent, false)); + return new ViewHolder(FragmentFunctionsFunctionBinding.inflate(inflater, parent, false)); } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/preferences/NumberFormatExamplesPreference.java b/app/src/main/java/org/solovyev/android/calculator/preferences/NumberFormatExamplesPreference.java index 9eabbbfe..9f53aa1e 100644 --- a/app/src/main/java/org/solovyev/android/calculator/preferences/NumberFormatExamplesPreference.java +++ b/app/src/main/java/org/solovyev/android/calculator/preferences/NumberFormatExamplesPreference.java @@ -4,10 +4,11 @@ import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; -import android.view.ViewGroup; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.preference.Preference; +import androidx.preference.PreferenceViewHolder; import jscl.JsclMathEngine; -import org.solovyev.android.material.preferences.Preference; @SuppressWarnings("unused") public class NumberFormatExamplesPreference extends Preference { @@ -45,15 +46,14 @@ public class NumberFormatExamplesPreference extends Preference { } @Override - protected View onCreateView(ViewGroup parent) { - final View view = super.onCreateView(parent); - final View summary = view.findViewById(android.R.id.summary); + public void onBindViewHolder(@NonNull PreferenceViewHolder holder) { + super.onBindViewHolder(holder); + final View summary = holder.findViewById(android.R.id.summary); if (summary instanceof TextView) { final TextView textView = (TextView) summary; textView.setMaxLines(12); textView.setLines(12); textView.setTypeface(Typeface.MONOSPACE); } - return view; } } diff --git a/app/src/main/java/org/solovyev/android/calculator/preferences/PrecisionPreference.java b/app/src/main/java/org/solovyev/android/calculator/preferences/PrecisionPreference.java index 49b7196d..4afb9da6 100644 --- a/app/src/main/java/org/solovyev/android/calculator/preferences/PrecisionPreference.java +++ b/app/src/main/java/org/solovyev/android/calculator/preferences/PrecisionPreference.java @@ -1,26 +1,83 @@ package org.solovyev.android.calculator.preferences; +import static org.solovyev.common.NumberFormatter.MAX_PRECISION; +import static org.solovyev.common.NumberFormatter.MIN_PRECISION; import android.annotation.TargetApi; import android.content.Context; import android.content.SharedPreferences; import android.os.Build; -import android.preference.DialogPreference; +import android.os.Bundle; import android.util.AttributeSet; import android.view.View; -import butterknife.BindView; -import butterknife.ButterKnife; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.preference.DialogPreference; +import androidx.preference.PreferenceDialogFragmentCompat; import org.solovyev.android.calculator.Engine; import org.solovyev.android.calculator.R; import org.solovyev.android.views.DiscreteSeekBar; -import static org.solovyev.common.NumberFormatter.MAX_PRECISION; -import static org.solovyev.common.NumberFormatter.MIN_PRECISION; - @SuppressWarnings("unused") public class PrecisionPreference extends DialogPreference { - @BindView(R.id.precision_seekbar) - DiscreteSeekBar seekBar; + public static class Dialog extends PreferenceDialogFragmentCompat { + private static final String SAVE_STATE_PRECISION = "PrecisionPreferenceDialog.precision"; + + private DiscreteSeekBar seekBar; + private int precision; + + public Dialog() { + final Bundle args = new Bundle(); + args.putString(ARG_KEY, Engine.Preferences.Output.precision.getKey()); + setArguments(args); + } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + if (seekBar != null) { + outState.putInt(SAVE_STATE_PRECISION, seekBar.getCurrentTick() + 1); + } + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (savedInstanceState == null) { + precision = readPrecision(); + } else { + precision = savedInstanceState.getInt(SAVE_STATE_PRECISION, readPrecision()); + } + } + + @Override + protected void onBindDialogView(@NonNull View view) { + super.onBindDialogView(view); + seekBar = (DiscreteSeekBar) view.findViewById(R.id.precision_seekbar); + + seekBar.setMax(MAX_PRECISION - 1); + seekBar.setCurrentTick(precision - 1); + } + + private int readPrecision() { + final DialogPreference preference = getPreference(); + final SharedPreferences preferences = preference.getSharedPreferences(); + return Math.max(MIN_PRECISION, Math.min(MAX_PRECISION, Engine.Preferences.Output.precision.getPreference(preferences))); + } + + @Override + public void onDialogClosed(boolean save) { + if (!save) return; + final int precision = seekBar.getCurrentTick() + 1; + final DialogPreference preference = getPreference(); + if (preference.callChangeListener(precision)) { + final SharedPreferences preferences = preference.getSharedPreferences(); + final SharedPreferences.Editor editor = preferences.edit(); + Engine.Preferences.Output.precision.putPreference(editor, precision); + editor.apply(); + } + } + } { setPersistent(false); @@ -44,29 +101,4 @@ public class PrecisionPreference extends DialogPreference { public PrecisionPreference(Context context) { super(context); } - - @Override - protected void onBindDialogView(View view) { - super.onBindDialogView(view); - ButterKnife.bind(this, view); - - final SharedPreferences preferences = getSharedPreferences(); - seekBar.setMax(MAX_PRECISION - 1); - final int precision = Math.max(MIN_PRECISION, Math.min(MAX_PRECISION, Engine.Preferences.Output.precision.getPreference(preferences))); - seekBar.setCurrentTick(precision - 1); - } - - @Override - protected void onDialogClosed(boolean save) { - super.onDialogClosed(save); - if (!save) { - return; - } - final int precision = seekBar.getCurrentTick() + 1; - if (callChangeListener(precision)) { - final SharedPreferences.Editor editor = getSharedPreferences().edit(); - Engine.Preferences.Output.precision.putPreference(editor, precision); - editor.apply(); - } - } } diff --git a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferenceEntry.java b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferenceEntry.java index 21aebcb2..ad0a6e4a 100644 --- a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferenceEntry.java +++ b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferenceEntry.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.preferences; import android.content.Context; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; public interface PreferenceEntry { @NonNull diff --git a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java index 22f5aaf7..3c966e7d 100644 --- a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesActivity.java @@ -4,9 +4,9 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.annotation.XmlRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.annotation.XmlRes; import android.util.SparseArray; import org.solovyev.android.calculator.App; @@ -81,7 +81,7 @@ public class PreferencesActivity extends BaseActivity implements SharedPreferenc if (savedInstanceState == null) { final int preference = intent.getIntExtra(EXTRA_PREFERENCE, R.xml.preferences); getSupportFragmentManager().beginTransaction() - .add(R.id.main, PreferencesFragment.create(preference, R.layout.fragment_preferences)) + .add(R.id.main, PreferencesFragment.create(preference)) .commit(); } diff --git a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesFragment.java b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesFragment.java index 9697e166..1c31b5a0 100644 --- a/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/preferences/PreferencesFragment.java @@ -5,22 +5,31 @@ import static org.solovyev.android.calculator.Engine.Preferences.angleUnitName; import static org.solovyev.android.calculator.Engine.Preferences.numeralBaseName; import static org.solovyev.android.calculator.wizard.CalculatorWizards.DEFAULT_WIZARD_FLOW; import static org.solovyev.android.wizard.WizardUi.startWizard; - import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.os.Build; import android.os.Bundle; -import android.preference.ListPreference; -import android.preference.Preference; -import android.support.v4.app.FragmentActivity; import android.util.SparseArray; import android.view.View; -import android.widget.ListView; - +import android.view.ViewGroup; +import android.view.ViewParent; +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; +import androidx.preference.ListPreference; +import androidx.preference.Preference; +import androidx.preference.PreferenceDialogFragmentCompat; +import androidx.preference.PreferenceFragmentCompat; +import androidx.recyclerview.widget.RecyclerView; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; - +import java.util.Arrays; +import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.inject.Inject; +import jscl.AngleUnit; +import jscl.JsclMathEngine; +import jscl.NumeralBase; import org.solovyev.android.calculator.ActivityLauncher; import org.solovyev.android.calculator.Engine; import org.solovyev.android.calculator.Preferences; @@ -37,20 +46,10 @@ import org.solovyev.android.prefs.StringPreference; import org.solovyev.android.wizard.Wizards; import org.solovyev.common.text.CharacterMapper; -import java.util.Arrays; -import java.util.List; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.inject.Inject; - -import jscl.AngleUnit; -import jscl.JsclMathEngine; -import jscl.NumeralBase; - -public class PreferencesFragment extends org.solovyev.android.material.preferences.PreferencesFragment implements SharedPreferences.OnSharedPreferenceChangeListener { - - private static boolean SUPPORT_HEADERS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; +public class PreferencesFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { + @Nonnull + private static String ARG_PREFERENCES = "preferences"; @Inject SharedPreferences preferences; @Inject @@ -67,9 +66,11 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc Bus bus; @Nonnull - public static PreferencesFragment create(int preferences, int layout) { + public static PreferencesFragment create(int preferences) { final PreferencesFragment fragment = new PreferencesFragment(); - fragment.setArguments(createArguments(preferences, layout, NO_THEME)); + final Bundle args = new Bundle(); + args.putInt(ARG_PREFERENCES, preferences); + fragment.setArguments(args); return fragment; } @@ -82,6 +83,12 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc bus.register(this); } + @Override + public void onCreatePreferences(@androidx.annotation.Nullable Bundle savedInstanceState, @androidx.annotation.Nullable String rootKey) { + int preferencesResId = getArguments().getInt(ARG_PREFERENCES); + addPreferencesFromResource(preferencesResId); + } + private void setPreferenceIntent(int xml, @Nonnull PreferencesActivity.PrefDef def) { final Preference preference = findPreference(def.id); if (preference != null) { @@ -93,11 +100,26 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } } + /** @noinspection deprecation*/ + @Override + public void onDisplayPreferenceDialog(@NonNull Preference preference) { + String fragmentTag = "fragment:" + preference.getKey(); + if (getParentFragmentManager().findFragmentByTag(fragmentTag) != null) return; + + if (preference instanceof PrecisionPreference) { + final PreferenceDialogFragmentCompat f = new PrecisionPreference.Dialog(); + f.setTargetFragment(this, 0); + f.show(getParentFragmentManager(), fragmentTag); + } else { + super.onDisplayPreferenceDialog(preference); + } + } + @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - final int preference = getPreferencesResId(); + final int preference = getArguments().getInt(ARG_PREFERENCES); if (preference == R.xml.preferences) { prepareScreens(); prepareIntroduction(); @@ -195,7 +217,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } private void prepareNumberFormatExamplesPreference() { - final NumberFormatExamplesPreference preference = (NumberFormatExamplesPreference) preferenceManager.findPreference("numberFormat.examples"); + final NumberFormatExamplesPreference preference = (NumberFormatExamplesPreference) getPreferenceManager().findPreference("numberFormat.examples"); if (preference == null) { return; } @@ -203,7 +225,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } private void prepareSeparatorPreference() { - final ListPreference preference = (ListPreference) preferenceManager.findPreference(Engine.Preferences.Output.separator.getKey()); + final ListPreference preference = (ListPreference) getPreferenceManager().findPreference(Engine.Preferences.Output.separator.getKey()); preference.setSummary(separatorName(Engine.Preferences.Output.separator.getPreference(preferences))); preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -227,7 +249,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } private void preparePrecisionPreference() { - final PrecisionPreference preference = (PrecisionPreference) preferenceManager.findPreference(Engine.Preferences.Output.precision.getKey()); + final PrecisionPreference preference = (PrecisionPreference) getPreferenceManager().findPreference(Engine.Preferences.Output.precision.getKey()); preference.setSummary(String.valueOf(Engine.Preferences.Output.precision.getPreference(preferences))); preference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -239,7 +261,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } private & PreferenceEntry> void prepareListPreference(@Nonnull final StringPreference p, @Nonnull Class type) { - final ListPreference preference = (ListPreference) preferenceManager.findPreference(p.getKey()); + final ListPreference preference = (ListPreference) getPreferenceManager().findPreference(p.getKey()); if (preference == null) { return; } @@ -262,7 +284,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } private void prepareMode() { - final ListPreference mode = (ListPreference) preferenceManager.findPreference(Preferences.Gui.mode.getKey()); + final ListPreference mode = (ListPreference) getPreferenceManager().findPreference(Preferences.Gui.mode.getKey()); mode.setSummary(Preferences.Gui.getMode(preferences).name); mode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -274,7 +296,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } private void prepareAngles() { - final ListPreference angles = (ListPreference) preferenceManager.findPreference(Engine.Preferences.angleUnit.getKey()); + final ListPreference angles = (ListPreference) getPreferenceManager().findPreference(Engine.Preferences.angleUnit.getKey()); angles.setSummary(angleUnitName(Engine.Preferences.angleUnit.getPreference(preferences))); angles.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -286,7 +308,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc } private void prepareRadix() { - final ListPreference radix = (ListPreference) preferenceManager.findPreference(Engine.Preferences.numeralBase.getKey()); + final ListPreference radix = (ListPreference) getPreferenceManager().findPreference(Engine.Preferences.numeralBase.getKey()); radix.setSummary(numeralBaseName(Engine.Preferences.numeralBase.getPreference(preferences))); radix.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -301,7 +323,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc if (preference != R.xml.preferences_appearance) { return; } - final ListPreference theme = (ListPreference) preferenceManager.findPreference(Preferences.Gui.theme.getKey()); + final ListPreference theme = (ListPreference) getPreferenceManager().findPreference(Preferences.Gui.theme.getKey()); final FragmentActivity context = getActivity(); populate(theme, Theme.material_theme, @@ -344,7 +366,7 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc return; } - final ListPreference language = (ListPreference) preferenceManager.findPreference(Preferences.Gui.language.getKey()); + final ListPreference language = (ListPreference) getPreferenceManager().findPreference(Preferences.Gui.language.getKey()); populate(language, languages.getList()); language.setSummary(languages.getCurrent().getName(getActivity())); language.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -387,9 +409,4 @@ public class PreferencesFragment extends org.solovyev.android.material.preferenc preferences.unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); } - - private boolean supportsHeaders() { - return SUPPORT_HEADERS; - } - } diff --git a/app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java b/app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java index 3ba25894..2afc9a9e 100644 --- a/app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/preferences/PurchaseDialogActivity.java @@ -28,11 +28,11 @@ import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.BaseDialogFragment; import org.solovyev.android.calculator.R; diff --git a/app/src/main/java/org/solovyev/android/calculator/release/ChooseThemeReleaseNoteStep.java b/app/src/main/java/org/solovyev/android/calculator/release/ChooseThemeReleaseNoteStep.java index fca8315f..9dcdfa82 100644 --- a/app/src/main/java/org/solovyev/android/calculator/release/ChooseThemeReleaseNoteStep.java +++ b/app/src/main/java/org/solovyev/android/calculator/release/ChooseThemeReleaseNoteStep.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator.release; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import javax.annotation.Nonnull; public class ChooseThemeReleaseNoteStep extends ReleaseNoteStep { diff --git a/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNote.java b/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNote.java index aadb626b..5b435991 100644 --- a/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNote.java +++ b/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNote.java @@ -1,7 +1,7 @@ package org.solovyev.android.calculator.release; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; public class ReleaseNote { @NonNull diff --git a/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNoteStep.java b/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNoteStep.java index a5a41064..9d450ffd 100644 --- a/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNoteStep.java +++ b/app/src/main/java/org/solovyev/android/calculator/release/ReleaseNoteStep.java @@ -1,8 +1,8 @@ package org.solovyev.android.calculator.release; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import org.solovyev.android.wizard.WizardStep; import javax.annotation.Nonnull; diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/CppVariable.java b/app/src/main/java/org/solovyev/android/calculator/variables/CppVariable.java index f8b838a6..2af38caa 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/CppVariable.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/CppVariable.java @@ -2,7 +2,7 @@ package org.solovyev.android.calculator.variables; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import jscl.math.function.IConstant; import org.json.JSONException; diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/EditVariableFragment.java b/app/src/main/java/org/solovyev/android/calculator/variables/EditVariableFragment.java index 43df0b41..793f6eba 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/EditVariableFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/EditVariableFragment.java @@ -28,11 +28,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.design.widget.TextInputLayout; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; import android.text.Editable; import android.text.InputFilter; import android.text.SpannableStringBuilder; @@ -45,6 +41,10 @@ import android.widget.Button; import android.widget.EditText; import android.widget.PopupWindow; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; +import com.google.android.material.textfield.TextInputLayout; import org.solovyev.android.Check; import org.solovyev.android.calculator.App; import org.solovyev.android.calculator.AppComponent; @@ -57,6 +57,7 @@ import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.RemovalConfirmationDialog; import org.solovyev.android.calculator.ToJsclTextProcessor; import org.solovyev.android.calculator.VariablesRegistry; +import org.solovyev.android.calculator.databinding.FragmentVariableEditBinding; import org.solovyev.android.calculator.functions.FunctionsRegistry; import org.solovyev.android.calculator.keyboard.FloatingKeyboard; import org.solovyev.android.calculator.keyboard.FloatingKeyboardWindow; @@ -72,8 +73,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; -import butterknife.BindView; -import butterknife.ButterKnife; import dagger.Lazy; import jscl.math.function.IConstant; @@ -85,10 +84,13 @@ public class EditVariableFragment extends BaseDialogFragment implements View.OnF private final static List ACCEPTABLE_CHARACTERS = Arrays.asList(Strings.toObjects(("1234567890abcdefghijklmnopqrstuvwxyzйцукенгшщзхъфывапролджэячсмитьбюё_" + GreekFloatingKeyboard.ALPHABET).toCharArray())); @NonNull private final KeyboardUser keyboardUser = new KeyboardUser(); - @BindView(R.id.variable_name_label) TextInputLayout nameLabel; - @BindView(R.id.variable_name) EditTextCompat nameView; + Button keyboardButton; + TextInputLayout valueLabel; + EditText valueView; + Button exponentButton; + EditText descriptionView; @NonNull private final FloatingKeyboardWindow keyboardWindow = new FloatingKeyboardWindow(new PopupWindow.OnDismissListener() { @Override @@ -96,16 +98,6 @@ public class EditVariableFragment extends BaseDialogFragment implements View.OnF nameView.setShowSoftInputOnFocusCompat(true); } }); - @BindView(R.id.variable_keyboard_button) - Button keyboardButton; - @BindView(R.id.variable_value_label) - TextInputLayout valueLabel; - @BindView(R.id.variable_value) - EditText valueView; - @BindView(R.id.variable_exponent_button) - Button exponentButton; - @BindView(R.id.variable_description) - EditText descriptionView; @Inject Calculator calculator; @Inject @@ -167,7 +159,7 @@ public class EditVariableFragment extends BaseDialogFragment implements View.OnF } @Override - public void onCreate(@android.support.annotation.Nullable Bundle savedInstanceState) { + public void onCreate(@androidx.annotation.Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle arguments = getArguments(); if (arguments != null) { @@ -309,9 +301,15 @@ public class EditVariableFragment extends BaseDialogFragment implements View.OnF @SuppressLint("InflateParams") @NonNull @Override - protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @android.support.annotation.Nullable Bundle savedInstanceState) { - final View view = inflater.inflate(R.layout.fragment_variable_edit, null); - ButterKnife.bind(this, view); + protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @androidx.annotation.Nullable Bundle savedInstanceState) { + final FragmentVariableEditBinding binding = FragmentVariableEditBinding.inflate(inflater, null, false); + nameLabel = binding.variableNameLabel; + nameView = binding.variableName; + keyboardButton = binding.variableKeyboardButton; + valueLabel = binding.variableValueLabel; + valueView = binding.variableValue; + exponentButton = binding.variableExponentButton; + descriptionView = binding.variableDescription; if (savedInstanceState == null && variable != null) { nameView.setText(variable.name); @@ -331,26 +329,24 @@ public class EditVariableFragment extends BaseDialogFragment implements View.OnF descriptionView.setOnFocusChangeListener(this); keyboardButton.setOnClickListener(this); - return view; + return binding.getRoot(); } @Override public void onFocusChange(View v, boolean hasFocus) { - switch (v.getId()) { - case R.id.variable_name: - if (hasFocus) { - clearError(nameLabel); - } else { - keyboardUser.done(); - } - break; - case R.id.variable_value: - if (hasFocus) { - clearError(valueLabel); - } else { - validateValue(); - } - break; + int id = v.getId(); + if (id == R.id.variable_name) { + if (hasFocus) { + clearError(nameLabel); + } else { + keyboardUser.done(); + } + } else if (id == R.id.variable_value) { + if (hasFocus) { + clearError(valueLabel); + } else { + validateValue(); + } } } @@ -368,22 +364,19 @@ public class EditVariableFragment extends BaseDialogFragment implements View.OnF @Override public void onClick(View v) { - switch (v.getId()) { - case R.id.variable_keyboard_button: - if (keyboardWindow.isShown()) { - keyboardUser.showIme(); - } else { - showKeyboard(); - } - break; - case R.id.variable_exponent_button: - final int start = Math.max(valueView.getSelectionStart(), 0); - final int end = Math.max(valueView.getSelectionEnd(), 0); - valueView.getText().replace(Math.min(start, end), Math.max(start, end), "E", 0, 1); - break; - default: - super.onClick(v); - break; + int id = v.getId(); + if (id == R.id.variable_keyboard_button) { + if (keyboardWindow.isShown()) { + keyboardUser.showIme(); + } else { + showKeyboard(); + } + } else if (id == R.id.variable_exponent_button) { + final int start = Math.max(valueView.getSelectionStart(), 0); + final int end = Math.max(valueView.getSelectionEnd(), 0); + valueView.getText().replace(Math.min(start, end), Math.max(start, end), "E", 0, 1); + } else { + super.onClick(v); } } diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/GreekFloatingKeyboard.java b/app/src/main/java/org/solovyev/android/calculator/variables/GreekFloatingKeyboard.java index da9e23f5..b56fcc94 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/GreekFloatingKeyboard.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/GreekFloatingKeyboard.java @@ -2,8 +2,8 @@ package org.solovyev.android.calculator.variables; import android.annotation.TargetApi; import android.os.Build; -import android.support.annotation.IdRes; -import android.support.annotation.NonNull; +import androidx.annotation.IdRes; +import androidx.annotation.NonNull; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; @@ -122,23 +122,18 @@ public class GreekFloatingKeyboard extends BaseFloatingKeyboard implements View. if (user.isVibrateOnKeypress()) { v.performHapticFeedback(KEYBOARD_TAP, FLAG_IGNORE_GLOBAL_SETTING | FLAG_IGNORE_VIEW_SETTING); } - switch (v.getId()) { - case R.id.cpp_kb_button_close: - user.done(); - break; - case R.id.cpp_kb_button_change_case: - changeCase((Button) v); - break; - case R.id.cpp_kb_button_keyboard: - user.showIme(); - break; - case R.id.cpp_kb_button_clear: - user.getEditor().setText(""); - user.getEditor().setSelection(0); - break; - default: - user.getEditor().append(((TextView) v).getText()); - break; + int id = v.getId(); + if (id == R.id.cpp_kb_button_close) { + user.done(); + } else if (id == R.id.cpp_kb_button_change_case) { + changeCase((Button) v); + } else if (id == R.id.cpp_kb_button_keyboard) { + user.showIme(); + } else if (id == R.id.cpp_kb_button_clear) { + user.getEditor().setText(""); + user.getEditor().setSelection(0); + } else { + user.getEditor().append(((TextView) v).getText()); } user.getEditor().requestFocus(); } @@ -165,4 +160,4 @@ public class GreekFloatingKeyboard extends BaseFloatingKeyboard implements View. button.setText("↑"); } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/VariableCategory.java b/app/src/main/java/org/solovyev/android/calculator/variables/VariableCategory.java index e40a1097..abd3473e 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/VariableCategory.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/VariableCategory.java @@ -22,7 +22,7 @@ package org.solovyev.android.calculator.variables; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import jscl.math.function.IConstant; import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.entities.Category; diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesActivity.java b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesActivity.java index 11043a82..722730b9 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesActivity.java @@ -24,7 +24,7 @@ package org.solovyev.android.calculator.variables; import android.content.Context; import android.os.Bundle; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.View; import org.solovyev.android.calculator.App; diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java index 0b602ff1..1ce46550 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java @@ -24,10 +24,10 @@ package org.solovyev.android.calculator.variables; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.NonNull; import android.text.TextUtils; import android.view.*; +import androidx.fragment.app.FragmentActivity; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import jscl.math.function.IConstant; @@ -110,25 +110,25 @@ public class VariablesFragment extends BaseEntitiesFragment { @Override protected boolean onMenuItemClicked(@Nonnull MenuItem item, @Nonnull final IConstant variable) { FragmentActivity activity = getActivity(); - switch (item.getItemId()) { - case R.string.c_use: - onClick(variable); - return true; - case R.string.cpp_edit: - EditVariableFragment.showDialog(CppVariable.builder(variable).build(), activity); - return true; - case R.string.cpp_delete: - RemovalConfirmationDialog.showForVariable(getActivity(), variable.getName(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Check.isTrue(which == DialogInterface.BUTTON_POSITIVE); - registry.remove(variable); - } - }); - return true; - case R.string.cpp_copy: - copyText(variable.getValue()); - return true; + int itemId = item.getItemId(); + if (itemId == R.string.c_use) { + onClick(variable); + return true; + } else if (itemId == R.string.cpp_edit) { + EditVariableFragment.showDialog(CppVariable.builder(variable).build(), activity); + return true; + } else if (itemId == R.string.cpp_delete) { + RemovalConfirmationDialog.showForVariable(getActivity(), variable.getName(), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Check.isTrue(which == DialogInterface.BUTTON_POSITIVE); + registry.remove(variable); + } + }); + return true; + } else if (itemId == R.string.cpp_copy) { + copyText(variable.getValue()); + return true; } return false; } diff --git a/app/src/main/java/org/solovyev/android/calculator/view/EditTextCompat.java b/app/src/main/java/org/solovyev/android/calculator/view/EditTextCompat.java index ac7e10c8..4eeb5502 100644 --- a/app/src/main/java/org/solovyev/android/calculator/view/EditTextCompat.java +++ b/app/src/main/java/org/solovyev/android/calculator/view/EditTextCompat.java @@ -2,12 +2,12 @@ package org.solovyev.android.calculator.view; import android.content.Context; import android.os.Build; -import android.support.design.widget.TextInputEditText; import android.text.Editable; import android.text.InputType; import android.util.AttributeSet; import android.util.Log; import android.widget.EditText; +import com.google.android.material.textfield.TextInputEditText; import org.solovyev.android.Check; import javax.annotation.Nullable; diff --git a/app/src/main/java/org/solovyev/android/calculator/view/PagerViewFabBehavior.java b/app/src/main/java/org/solovyev/android/calculator/view/PagerViewFabBehavior.java index d13d0ed9..670944b4 100644 --- a/app/src/main/java/org/solovyev/android/calculator/view/PagerViewFabBehavior.java +++ b/app/src/main/java/org/solovyev/android/calculator/view/PagerViewFabBehavior.java @@ -1,14 +1,14 @@ package org.solovyev.android.calculator.view; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.design.widget.CoordinatorLayout; -import android.support.design.widget.FloatingActionButton; -import android.support.v4.view.ViewCompat; -import android.support.v4.view.ViewPager; -import android.support.v7.widget.RecyclerView; +import androidx.annotation.NonNull; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.view.ViewCompat; +import androidx.recyclerview.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; +import androidx.viewpager.widget.ViewPager; +import com.google.android.material.floatingactionbutton.FloatingActionButton; public class PagerViewFabBehavior extends FloatingActionButton.Behavior { @@ -34,7 +34,7 @@ public class PagerViewFabBehavior extends FloatingActionButton.Behavior { @Override public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, - FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) { + FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) { if (!child.isClickable()) { return false; } diff --git a/app/src/main/java/org/solovyev/android/calculator/view/Tabs.java b/app/src/main/java/org/solovyev/android/calculator/view/Tabs.java index c06d18a1..38fc1354 100644 --- a/app/src/main/java/org/solovyev/android/calculator/view/Tabs.java +++ b/app/src/main/java/org/solovyev/android/calculator/view/Tabs.java @@ -3,16 +3,14 @@ package org.solovyev.android.calculator.view; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.design.widget.TabLayout; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.Nullable; import android.view.View; -import butterknife.BindView; -import butterknife.ButterKnife; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; +import com.google.android.material.tabs.TabLayout; import org.solovyev.android.calculator.AppModule; import org.solovyev.android.calculator.FragmentTab; import org.solovyev.android.calculator.R; @@ -37,10 +35,8 @@ public class Tabs { @Named(AppModule.PREFS_TABS) SharedPreferences preferences; @Nullable - @BindView(R.id.tabs) TabLayout tabLayout; @Nullable - @BindView(R.id.viewPager) ViewPager viewPager; private int defaultSelectedTab = -1; @@ -56,7 +52,8 @@ public class Tabs { public void onCreate() { cast(activity.getApplicationContext()).getComponent().inject(this); - ButterKnife.bind(this, activity); + tabLayout = activity.findViewById(R.id.tabs); + viewPager = activity.findViewById(R.id.viewPager); if (tabLayout == null || viewPager == null) { return; diff --git a/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java b/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java index 5e6f4d55..51f7e157 100644 --- a/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java +++ b/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java @@ -23,7 +23,7 @@ package org.solovyev.android.calculator.view; import android.graphics.Typeface; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; diff --git a/app/src/main/java/org/solovyev/android/calculator/view/TouchExpander.java b/app/src/main/java/org/solovyev/android/calculator/view/TouchExpander.java index 0ea80b75..90132cc1 100644 --- a/app/src/main/java/org/solovyev/android/calculator/view/TouchExpander.java +++ b/app/src/main/java/org/solovyev/android/calculator/view/TouchExpander.java @@ -1,10 +1,10 @@ package org.solovyev.android.calculator.view; import android.graphics.Rect; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.Px; -import android.support.v4.view.ViewCompat; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.Px; +import androidx.core.view.ViewCompat; import android.view.TouchDelegate; import android.view.View; import android.view.ViewTreeObserver; diff --git a/app/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidget.java b/app/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidget.java index d88eb39b..2eb7705f 100644 --- a/app/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidget.java +++ b/app/src/main/java/org/solovyev/android/calculator/widget/CalculatorWidget.java @@ -31,8 +31,8 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.ColorInt; -import android.support.v4.content.ContextCompat; +import androidx.annotation.ColorInt; +import androidx.core.content.ContextCompat; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.SpannedString; @@ -139,7 +139,7 @@ public class CalculatorWidget extends AppWidgetProvider { if (!partially) { for (CppButton button : CppButton.values()) { - final PendingIntent intent = PendingIntent.getBroadcast(context, button.id, newButtonClickedIntent(context, button), PendingIntent.FLAG_UPDATE_CURRENT); + final PendingIntent intent = PendingIntent.getBroadcast(context, button.id, newButtonClickedIntent(context, button), PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); if (intent != null) { final int buttonId; if (button == CppButton.settings_widget) { diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java b/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java index 79fbec59..235274cb 100644 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java +++ b/app/src/main/java/org/solovyev/android/calculator/wizard/CalculatorWizardStep.java @@ -23,8 +23,8 @@ package org.solovyev.android.calculator.wizard; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import org.solovyev.android.calculator.R; import javax.annotation.Nonnull; diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/DragButtonWizardStep.java b/app/src/main/java/org/solovyev/android/calculator/wizard/DragButtonWizardStep.java index 9aae8364..974f77e3 100644 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/DragButtonWizardStep.java +++ b/app/src/main/java/org/solovyev/android/calculator/wizard/DragButtonWizardStep.java @@ -24,7 +24,7 @@ package org.solovyev.android.calculator.wizard; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.view.View; import android.widget.TextView; diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/WizardActivity.java b/app/src/main/java/org/solovyev/android/calculator/wizard/WizardActivity.java index 4bd3f474..6322b4be 100644 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/WizardActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/wizard/WizardActivity.java @@ -3,11 +3,11 @@ package org.solovyev.android.calculator.wizard; import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v7.app.AlertDialog; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; +import androidx.viewpager.widget.ViewPager; import com.viewpagerindicator.PageIndicator; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.language.Languages; diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/WizardArrayAdapter.java b/app/src/main/java/org/solovyev/android/calculator/wizard/WizardArrayAdapter.java index 65b74207..5c4a5b57 100644 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/WizardArrayAdapter.java +++ b/app/src/main/java/org/solovyev/android/calculator/wizard/WizardArrayAdapter.java @@ -13,11 +13,11 @@ import java.util.List; final class WizardArrayAdapter extends ArrayAdapter { public WizardArrayAdapter(@Nonnull Context context, @Nonnull T[] items) { - super(context, R.layout.support_simple_spinner_dropdown_item, items); + super(context, androidx.appcompat.R.layout.support_simple_spinner_dropdown_item, items); } public WizardArrayAdapter(@Nonnull Context context, @Nonnull List items) { - super(context, R.layout.support_simple_spinner_dropdown_item, items); + super(context, androidx.appcompat.R.layout.support_simple_spinner_dropdown_item, items); } @Nonnull diff --git a/app/src/main/java/org/solovyev/android/calculator/wizard/WizardFragment.java b/app/src/main/java/org/solovyev/android/calculator/wizard/WizardFragment.java index 9a810b2a..247745cb 100644 --- a/app/src/main/java/org/solovyev/android/calculator/wizard/WizardFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/wizard/WizardFragment.java @@ -3,13 +3,13 @@ package org.solovyev.android.calculator.wizard; import android.content.SharedPreferences; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.v4.app.Fragment; +import androidx.annotation.LayoutRes; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.Fragment; import org.solovyev.android.calculator.AppComponent; import org.solovyev.android.calculator.BaseActivity; import org.solovyev.android.calculator.R; @@ -117,7 +117,7 @@ public abstract class WizardFragment extends Fragment implements View.OnClickLis } @Override - public void onViewCreated(View view, @android.support.annotation.Nullable Bundle savedInstanceState) { + public void onViewCreated(View view, @androidx.annotation.Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); BaseActivity.fixFonts(view, typeface); } @@ -141,21 +141,18 @@ public abstract class WizardFragment extends Fragment implements View.OnClickLis public void onClick(View v) { final int id = v.getId(); final WizardActivity activity = getWizardActivity(); - switch (id) { - case R.id.wizard_next: - if (activity.canGoNext()) { - activity.goNext(); - } else { - activity.finishWizard(); - } - break; - case R.id.wizard_prev: - if (activity.canGoPrev()) { - activity.goPrev(); - } else { - activity.finishWizardAbruptly(); - } - break; + if (id == R.id.wizard_next) { + if (activity.canGoNext()) { + activity.goNext(); + } else { + activity.finishWizard(); + } + } else if (id == R.id.wizard_prev) { + if (activity.canGoPrev()) { + activity.goPrev(); + } else { + activity.finishWizardAbruptly(); + } } } diff --git a/app/src/main/java/org/solovyev/android/checkout/CppCheckout.java b/app/src/main/java/org/solovyev/android/checkout/CppCheckout.java index a0945076..d26a4020 100644 --- a/app/src/main/java/org/solovyev/android/checkout/CppCheckout.java +++ b/app/src/main/java/org/solovyev/android/checkout/CppCheckout.java @@ -1,6 +1,6 @@ package org.solovyev.android.checkout; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/app/src/main/java/org/solovyev/android/io/BaseIoLoader.java b/app/src/main/java/org/solovyev/android/io/BaseIoLoader.java index 63da799a..dfe728fa 100644 --- a/app/src/main/java/org/solovyev/android/io/BaseIoLoader.java +++ b/app/src/main/java/org/solovyev/android/io/BaseIoLoader.java @@ -1,6 +1,6 @@ package org.solovyev.android.io; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import java.io.BufferedReader; import java.io.IOException; diff --git a/app/src/main/java/org/solovyev/android/io/BaseIoSaver.java b/app/src/main/java/org/solovyev/android/io/BaseIoSaver.java index 055b17c3..7860b238 100644 --- a/app/src/main/java/org/solovyev/android/io/BaseIoSaver.java +++ b/app/src/main/java/org/solovyev/android/io/BaseIoSaver.java @@ -1,6 +1,6 @@ package org.solovyev.android.io; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import java.io.FileNotFoundException; import java.io.FileOutputStream; diff --git a/app/src/main/java/org/solovyev/android/io/FileLoader.java b/app/src/main/java/org/solovyev/android/io/FileLoader.java index ecb9346a..8bbe7dac 100644 --- a/app/src/main/java/org/solovyev/android/io/FileLoader.java +++ b/app/src/main/java/org/solovyev/android/io/FileLoader.java @@ -1,7 +1,7 @@ package org.solovyev.android.io; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.io.File; import java.io.FileInputStream; diff --git a/app/src/main/java/org/solovyev/android/io/FileSaver.java b/app/src/main/java/org/solovyev/android/io/FileSaver.java index 0657d8ba..1025bc5f 100644 --- a/app/src/main/java/org/solovyev/android/io/FileSaver.java +++ b/app/src/main/java/org/solovyev/android/io/FileSaver.java @@ -1,6 +1,6 @@ package org.solovyev.android.io; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import java.io.File; import java.io.FileNotFoundException; diff --git a/app/src/main/java/org/solovyev/android/io/FileSystem.java b/app/src/main/java/org/solovyev/android/io/FileSystem.java index 0bfbf225..1918dc02 100644 --- a/app/src/main/java/org/solovyev/android/io/FileSystem.java +++ b/app/src/main/java/org/solovyev/android/io/FileSystem.java @@ -1,7 +1,7 @@ package org.solovyev.android.io; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.solovyev.android.calculator.ErrorReporter; diff --git a/app/src/main/java/org/solovyev/android/prefs/CachingMapper.java b/app/src/main/java/org/solovyev/android/prefs/CachingMapper.java index be360ffc..e5139737 100644 --- a/app/src/main/java/org/solovyev/android/prefs/CachingMapper.java +++ b/app/src/main/java/org/solovyev/android/prefs/CachingMapper.java @@ -1,6 +1,6 @@ package org.solovyev.android.prefs; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.solovyev.common.text.Mapper; diff --git a/app/src/main/java/org/solovyev/android/sherlock/FragmentItem.java b/app/src/main/java/org/solovyev/android/sherlock/FragmentItem.java deleted file mode 100644 index 09e17ef8..00000000 --- a/app/src/main/java/org/solovyev/android/sherlock/FragmentItem.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.sherlock; - -import android.support.v4.app.FragmentTransaction; - -import javax.annotation.Nonnull; - -/** - * User: serso - * Date: 8/7/12 - * Time: 11:57 AM - */ -public interface FragmentItem { - - void onSelected(@Nonnull FragmentTransaction ft); - - void onUnselected(@Nonnull FragmentTransaction ft); -} diff --git a/app/src/main/java/org/solovyev/android/sherlock/FragmentItemImpl.java b/app/src/main/java/org/solovyev/android/sherlock/FragmentItemImpl.java deleted file mode 100644 index 3b276c61..00000000 --- a/app/src/main/java/org/solovyev/android/sherlock/FragmentItemImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.sherlock; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.support.v7.app.AppCompatActivity; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -/** - * User: serso - * Date: 8/7/12 - * Time: 11:55 AM - */ -public class FragmentItemImpl implements FragmentItem { - - @Nonnull - private final AppCompatActivity activity; - - // Fragment - - @Nonnull - private final String tag; - - @Nonnull - private final Class fragmentClass; - @Nullable - private final Integer parentViewId; - @Nullable - private Bundle fragmentArgs; - @Nullable - private Fragment fragment; - - /** - * Constructor used each time a new tab is created. - * - * @param activity The host Activity, used to instantiate the fragment - * @param tag The identifier tag for the fragment - * @param fragmentClass The fragment's Class, used to instantiate the fragment - * @param fragmentArgs arguments to be passed to fragment - * @param parentViewId parent view id - */ - - public FragmentItemImpl(@Nonnull AppCompatActivity activity, - @Nonnull String tag, - @Nonnull Class fragmentClass, - @Nullable Bundle fragmentArgs, - @Nullable Integer parentViewId) { - this.activity = activity; - this.tag = tag; - this.fragmentClass = fragmentClass; - this.fragmentArgs = fragmentArgs; - this.parentViewId = parentViewId; - - final FragmentManager supportFragmentManager = activity.getSupportFragmentManager(); - this.fragment = supportFragmentManager.findFragmentByTag(tag); - } - - - @Override - public void onSelected(@Nonnull FragmentTransaction ft) { - if (fragment == null) { - fragment = activity.getSupportFragmentManager().findFragmentByTag(this.tag); - } - - // Check if the fragment is already initialized - if (fragment == null) { - // If not, instantiate and add it to the activity - fragment = Fragment.instantiate(activity, fragmentClass.getName(), fragmentArgs); - if (parentViewId != null) { - ft.add(parentViewId, fragment, tag); - } else { - ft.add(fragment, tag); - } - } else { - if (fragment.isDetached()) { - // If it exists, simply attach it in order to show it - ft.attach(fragment); - } - } - } - - @Override - public void onUnselected(@Nonnull FragmentTransaction ft) { - if (fragment != null) { - ft.detach(fragment); - } - } -} diff --git a/app/src/main/java/org/solovyev/android/sherlock/tabs/ActionBarFragmentTabListener.java b/app/src/main/java/org/solovyev/android/sherlock/tabs/ActionBarFragmentTabListener.java deleted file mode 100644 index 695726d2..00000000 --- a/app/src/main/java/org/solovyev/android/sherlock/tabs/ActionBarFragmentTabListener.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2013 serso aka se.solovyev - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Contact details - * - * Email: se.solovyev@gmail.com - * Site: http://se.solovyev.org - */ - -package org.solovyev.android.sherlock.tabs; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import org.solovyev.android.sherlock.FragmentItem; -import org.solovyev.android.sherlock.FragmentItemImpl; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -/** - * User: serso - * Date: 8/4/12 - * Time: 12:42 PM - */ -public class ActionBarFragmentTabListener implements ActionBar.TabListener { - - private final FragmentItem fragmentItem; - - /** - * Constructor used each time a new tab is created. - * - * @param activity The host Activity, used to instantiate the fragment - * @param tag The identifier tag for the fragment - * @param fragmentClass The fragment's Class, used to instantiate the fragment - * @param fragmentArgs arguments to be passed to fragment - * @param parentViewId parent view id - */ - - public ActionBarFragmentTabListener(@Nonnull AppCompatActivity activity, - @Nonnull String tag, - @Nonnull Class fragmentClass, - @Nullable Bundle fragmentArgs, - @Nullable Integer parentViewId) { - this.fragmentItem = new FragmentItemImpl(activity, tag, fragmentClass, fragmentArgs, parentViewId); - } - - - /* The following are each of the ActionBar.TabListener callbacks */ - - public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { - this.fragmentItem.onSelected(ft); - } - - public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { - this.fragmentItem.onUnselected(ft); - } - - public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { - } -} diff --git a/app/src/main/java/org/solovyev/android/text/method/NumberInputFilter.java b/app/src/main/java/org/solovyev/android/text/method/NumberInputFilter.java index f7114173..35f8cd7d 100644 --- a/app/src/main/java/org/solovyev/android/text/method/NumberInputFilter.java +++ b/app/src/main/java/org/solovyev/android/text/method/NumberInputFilter.java @@ -1,7 +1,7 @@ package org.solovyev.android.text.method; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.InputFilter; import android.text.SpannableStringBuilder; import android.text.Spanned; diff --git a/app/src/main/java/org/solovyev/android/views/Adjuster.java b/app/src/main/java/org/solovyev/android/views/Adjuster.java index badc339f..e1387bef 100644 --- a/app/src/main/java/org/solovyev/android/views/Adjuster.java +++ b/app/src/main/java/org/solovyev/android/views/Adjuster.java @@ -3,9 +3,9 @@ package org.solovyev.android.views; import static android.graphics.Matrix.MSCALE_Y; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.view.ViewCompat; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.view.ViewCompat; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java b/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java index 3825e5bf..6fe1265a 100644 --- a/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java +++ b/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java @@ -21,7 +21,6 @@ import static android.util.TypedValue.applyDimension; import android.annotation.SuppressLint; import android.content.Context; -import android.support.v7.widget.AppCompatTextView; import android.text.Layout.Alignment; import android.text.StaticLayout; import android.text.TextPaint; @@ -29,6 +28,7 @@ import android.util.AttributeSet; import android.util.TimingLogger; import android.util.TypedValue; import android.widget.TextView; +import androidx.appcompat.widget.AppCompatTextView; /** * Text view that auto adjusts text size to fit within the view. @@ -343,4 +343,4 @@ public class AutoResizeTextView extends AppCompatTextView { void onTextResize(TextView textView, float oldSize, float newSize); } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java b/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java index ed96e579..adcc1762 100644 --- a/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java +++ b/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java @@ -9,11 +9,11 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.os.Build; -import android.support.v7.widget.AppCompatSeekBar; import android.util.AttributeSet; import android.view.animation.DecelerateInterpolator; import android.widget.SeekBar; +import androidx.appcompat.widget.AppCompatSeekBar; import org.solovyev.android.Check; import org.solovyev.android.calculator.R; diff --git a/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenu.java b/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenu.java index ae47174f..38e260d5 100644 --- a/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenu.java +++ b/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenu.java @@ -17,20 +17,19 @@ package org.solovyev.android.widget.menu; */ import android.content.Context; -import android.support.annotation.MenuRes; -import android.support.v7.appcompat.R; -import android.support.v7.view.SupportMenuInflater; -import android.support.v7.view.menu.MenuBuilder; -import android.support.v7.view.menu.MenuPresenter; -import android.support.v7.view.menu.SubMenuBuilder; -import android.support.v7.widget.ForwardingListener; -import android.support.v7.widget.ListPopupWindow; -import android.support.v7.widget.PopupMenu; +import androidx.annotation.MenuRes; import android.view.Gravity; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; +import androidx.appcompat.view.SupportMenuInflater; +import androidx.appcompat.view.menu.MenuBuilder; +import androidx.appcompat.view.menu.MenuPresenter; +import androidx.appcompat.view.menu.SubMenuBuilder; +import androidx.appcompat.widget.ForwardingListener; +import androidx.appcompat.widget.ListPopupWindow; +import androidx.appcompat.widget.PopupMenu; /** * Static library support version of the framework's {@link android.widget.PopupMenu}. @@ -72,7 +71,7 @@ public class CustomPopupMenu implements MenuBuilder.Callback, MenuPresenter.Call * anchor. */ public CustomPopupMenu(Context context, View anchor, int gravity) { - this(context, anchor, gravity, R.attr.popupMenuStyle, 0); + this(context, anchor, gravity, androidx.appcompat.R.attr.popupMenuStyle, 0); } /** @@ -281,4 +280,4 @@ public class CustomPopupMenu implements MenuBuilder.Callback, MenuPresenter.Call public void onMenuModeChange(MenuBuilder menu) { } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenuHelper.java b/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenuHelper.java index c4d4aa4c..ac0131ba 100644 --- a/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenuHelper.java +++ b/app/src/main/java/org/solovyev/android/widget/menu/CustomPopupMenuHelper.java @@ -23,17 +23,6 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Parcelable; -import android.support.v4.graphics.drawable.DrawableCompat; -import android.support.v4.view.ActionProvider; -import android.support.v4.view.MenuItemCompat; -import android.support.v7.appcompat.R; -import android.support.v7.view.menu.ListMenuItemView; -import android.support.v7.view.menu.MenuBuilder; -import android.support.v7.view.menu.MenuItemImpl; -import android.support.v7.view.menu.MenuPresenter; -import android.support.v7.view.menu.MenuView; -import android.support.v7.view.menu.SubMenuBuilder; -import android.support.v7.widget.ListPopupWindow; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -51,6 +40,16 @@ import android.widget.FrameLayout; import android.widget.ListAdapter; import android.widget.PopupWindow; +import androidx.appcompat.view.menu.ListMenuItemView; +import androidx.appcompat.view.menu.MenuBuilder; +import androidx.appcompat.view.menu.MenuItemImpl; +import androidx.appcompat.view.menu.MenuPresenter; +import androidx.appcompat.view.menu.MenuView; +import androidx.appcompat.view.menu.SubMenuBuilder; +import androidx.appcompat.widget.ListPopupWindow; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.core.view.ActionProvider; +import androidx.core.view.MenuItemCompat; import org.solovyev.android.Check; import java.util.ArrayList; @@ -69,7 +68,7 @@ public class CustomPopupMenuHelper implements AdapterView.OnItemClickListener, V MenuPresenter { private static final int DEFAULT_VIEW_TAG_KEY = org.solovyev.android.calculator.R.id.cpm_default_view_tag_key; - private static final int[] COLOR_ATTRS = new int[]{R.attr.colorControlNormal}; + private static final int[] COLOR_ATTRS = new int[]{androidx.appcompat.R.attr.colorControlNormal}; private static final Object DEFAULT_VIEW_TAG = new Object(); private final Context mContext; @@ -101,11 +100,11 @@ public class CustomPopupMenuHelper implements AdapterView.OnItemClickListener, V private int mGravity = Gravity.NO_GRAVITY; public CustomPopupMenuHelper(Context context, MenuBuilder menu) { - this(context, menu, null, false, R.attr.popupMenuStyle); + this(context, menu, null, false, androidx.appcompat.R.attr.popupMenuStyle); } public CustomPopupMenuHelper(Context context, MenuBuilder menu, View anchorView) { - this(context, menu, anchorView, false, R.attr.popupMenuStyle); + this(context, menu, anchorView, false, androidx.appcompat.R.attr.popupMenuStyle); } public CustomPopupMenuHelper(Context context, MenuBuilder menu, View anchorView, @@ -125,7 +124,7 @@ public class CustomPopupMenuHelper implements AdapterView.OnItemClickListener, V final Resources res = context.getResources(); mPopupMaxWidth = Math.max(res.getDisplayMetrics().widthPixels / 2, - res.getDimensionPixelSize(R.dimen.abc_config_prefDialogWidth)); + res.getDimensionPixelSize(androidx.appcompat.R.dimen.abc_config_prefDialogWidth)); mAnchorView = anchorView; @@ -482,7 +481,7 @@ public class CustomPopupMenuHelper implements AdapterView.OnItemClickListener, V @Nonnull private View getDefaultView(MenuItemImpl item, View convertView, ViewGroup parent) { if (convertView == null || convertView.getTag(DEFAULT_VIEW_TAG_KEY) != DEFAULT_VIEW_TAG) { - convertView = mInflater.inflate(R.layout.abc_popup_menu_item_layout, parent, false); + convertView = mInflater.inflate(androidx.appcompat.R.layout.abc_popup_menu_item_layout, parent, false); convertView.setTag(DEFAULT_VIEW_TAG_KEY, DEFAULT_VIEW_TAG); } diff --git a/app/src/main/java/org/solovyev/android/widget/menu/ListMenuItemViewCompat.java b/app/src/main/java/org/solovyev/android/widget/menu/ListMenuItemViewCompat.java index d1e92b9f..95a83c6f 100644 --- a/app/src/main/java/org/solovyev/android/widget/menu/ListMenuItemViewCompat.java +++ b/app/src/main/java/org/solovyev/android/widget/menu/ListMenuItemViewCompat.java @@ -1,10 +1,10 @@ package org.solovyev.android.widget.menu; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.view.menu.ListMenuItemView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.util.Log; +import androidx.appcompat.view.menu.ListMenuItemView; import java.lang.reflect.Field; final class ListMenuItemViewCompat { diff --git a/app/src/main/java/org/solovyev/android/widget/menu/MenuItemDivider.java b/app/src/main/java/org/solovyev/android/widget/menu/MenuItemDivider.java index d7901673..b8330e34 100644 --- a/app/src/main/java/org/solovyev/android/widget/menu/MenuItemDivider.java +++ b/app/src/main/java/org/solovyev/android/widget/menu/MenuItemDivider.java @@ -5,11 +5,11 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Build; -import android.support.annotation.Nullable; -import android.support.v7.view.menu.MenuItemImpl; -import android.support.v7.view.menu.MenuView; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.View; +import androidx.appcompat.view.menu.MenuItemImpl; +import androidx.appcompat.view.menu.MenuView; @SuppressWarnings("unused") public class MenuItemDivider extends View implements MenuView.ItemView { diff --git a/app/src/main/java/org/solovyev/android/wizard/WizardStep.java b/app/src/main/java/org/solovyev/android/wizard/WizardStep.java index bbfeb3dc..846eab9b 100644 --- a/app/src/main/java/org/solovyev/android/wizard/WizardStep.java +++ b/app/src/main/java/org/solovyev/android/wizard/WizardStep.java @@ -1,8 +1,8 @@ package org.solovyev.android.wizard; import android.os.Bundle; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/app/src/main/java/org/solovyev/android/wizard/WizardUi.java b/app/src/main/java/org/solovyev/android/wizard/WizardUi.java index 34aa8f2f..4763ea4b 100644 --- a/app/src/main/java/org/solovyev/android/wizard/WizardUi.java +++ b/app/src/main/java/org/solovyev/android/wizard/WizardUi.java @@ -3,9 +3,9 @@ package org.solovyev.android.wizard; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.FragmentActivity; -import android.support.v4.app.FragmentManager; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/app/src/main/res/color/cpp_wizard_button_selector.xml b/app/src/main/res/color/cpp_wizard_button_selector.xml index 5070e788..68746f53 100644 --- a/app/src/main/res/color/cpp_wizard_button_selector.xml +++ b/app/src/main/res/color/cpp_wizard_button_selector.xml @@ -4,4 +4,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/color/cpp_wizard_button_selector_light.xml b/app/src/main/res/color/cpp_wizard_button_selector_light.xml index 05caf3b1..2f10669c 100644 --- a/app/src/main/res/color/cpp_wizard_button_selector_light.xml +++ b/app/src/main/res/color/cpp_wizard_button_selector_light.xml @@ -4,4 +4,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/drawable-v21/button_no_bg.xml b/app/src/main/res/drawable-v21/button_no_bg.xml index 2f43878c..7fdf82e0 100644 --- a/app/src/main/res/drawable-v21/button_no_bg.xml +++ b/app/src/main/res/drawable-v21/button_no_bg.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/material_blue_button.xml b/app/src/main/res/drawable-v21/material_blue_button.xml index 6f41bfd6..7c51a268 100644 --- a/app/src/main/res/drawable-v21/material_blue_button.xml +++ b/app/src/main/res/drawable-v21/material_blue_button.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/material_blue_button_lighter.xml b/app/src/main/res/drawable-v21/material_blue_button_lighter.xml index f3251db0..501eae9b 100644 --- a/app/src/main/res/drawable-v21/material_blue_button_lighter.xml +++ b/app/src/main/res/drawable-v21/material_blue_button_lighter.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/material_button_black.xml b/app/src/main/res/drawable-v21/material_button_black.xml index 8e356adc..2d1e33c9 100644 --- a/app/src/main/res/drawable-v21/material_button_black.xml +++ b/app/src/main/res/drawable-v21/material_button_black.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/material_button_black_lighter.xml b/app/src/main/res/drawable-v21/material_button_black_lighter.xml index 00a5d097..8e233792 100644 --- a/app/src/main/res/drawable-v21/material_button_black_lighter.xml +++ b/app/src/main/res/drawable-v21/material_button_black_lighter.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/material_button_dark.xml b/app/src/main/res/drawable-v21/material_button_dark.xml index 00a5d097..8e233792 100644 --- a/app/src/main/res/drawable-v21/material_button_dark.xml +++ b/app/src/main/res/drawable-v21/material_button_dark.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/material_button_dark_lighter.xml b/app/src/main/res/drawable-v21/material_button_dark_lighter.xml index 2c820789..333f673a 100644 --- a/app/src/main/res/drawable-v21/material_button_dark_lighter.xml +++ b/app/src/main/res/drawable-v21/material_button_dark_lighter.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/material_button_deep_blue.xml b/app/src/main/res/drawable-v21/material_button_deep_blue.xml index 9725d015..9e075b25 100644 --- a/app/src/main/res/drawable-v21/material_button_deep_blue.xml +++ b/app/src/main/res/drawable-v21/material_button_deep_blue.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/material_button_deep_blue_lighter.xml b/app/src/main/res/drawable-v21/material_button_deep_blue_lighter.xml index d4702044..3bad269a 100644 --- a/app/src/main/res/drawable-v21/material_button_deep_blue_lighter.xml +++ b/app/src/main/res/drawable-v21/material_button_deep_blue_lighter.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/material_button_light.xml b/app/src/main/res/drawable-v21/material_button_light.xml index f4941ddb..9201bea1 100644 --- a/app/src/main/res/drawable-v21/material_button_light.xml +++ b/app/src/main/res/drawable-v21/material_button_light.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/material_button_light_darker.xml b/app/src/main/res/drawable-v21/material_button_light_darker.xml index 2c820789..333f673a 100644 --- a/app/src/main/res/drawable-v21/material_button_light_darker.xml +++ b/app/src/main/res/drawable-v21/material_button_light_darker.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/material_button_light_primary.xml b/app/src/main/res/drawable-v21/material_button_light_primary.xml index 0d2ff8c4..8e3d9a9d 100644 --- a/app/src/main/res/drawable-v21/material_button_light_primary.xml +++ b/app/src/main/res/drawable-v21/material_button_light_primary.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/material_button_light_primary_darker.xml b/app/src/main/res/drawable-v21/material_button_light_primary_darker.xml index a9831441..9a4b1b6e 100644 --- a/app/src/main/res/drawable-v21/material_button_light_primary_darker.xml +++ b/app/src/main/res/drawable-v21/material_button_light_primary_darker.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/metro_blue_button.xml b/app/src/main/res/drawable-v21/metro_blue_button.xml index 2dcb5c44..2c289534 100644 --- a/app/src/main/res/drawable-v21/metro_blue_button.xml +++ b/app/src/main/res/drawable-v21/metro_blue_button.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/metro_button_dark.xml b/app/src/main/res/drawable-v21/metro_button_dark.xml index 2d7d7087..f594e9e4 100644 --- a/app/src/main/res/drawable-v21/metro_button_dark.xml +++ b/app/src/main/res/drawable-v21/metro_button_dark.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/metro_button_green.xml b/app/src/main/res/drawable-v21/metro_button_green.xml index f7a722b3..a2449206 100644 --- a/app/src/main/res/drawable-v21/metro_button_green.xml +++ b/app/src/main/res/drawable-v21/metro_button_green.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/metro_button_light.xml b/app/src/main/res/drawable-v21/metro_button_light.xml index 691e0ba5..c28ebd2c 100644 --- a/app/src/main/res/drawable-v21/metro_button_light.xml +++ b/app/src/main/res/drawable-v21/metro_button_light.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/metro_button_purple.xml b/app/src/main/res/drawable-v21/metro_button_purple.xml index 462a9f73..6c19b3ef 100644 --- a/app/src/main/res/drawable-v21/metro_button_purple.xml +++ b/app/src/main/res/drawable-v21/metro_button_purple.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/metro_widget_button.xml b/app/src/main/res/drawable-v21/metro_widget_button.xml index 2b054b8a..2c289534 100644 --- a/app/src/main/res/drawable-v21/metro_widget_button.xml +++ b/app/src/main/res/drawable-v21/metro_widget_button.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable-v21/metro_widget_button_dark.xml b/app/src/main/res/drawable-v21/metro_widget_button_dark.xml index d0fe7057..f594e9e4 100644 --- a/app/src/main/res/drawable-v21/metro_widget_button_dark.xml +++ b/app/src/main/res/drawable-v21/metro_widget_button_dark.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/metro_widget_button_light.xml b/app/src/main/res/drawable-v21/metro_widget_button_light.xml index cc00d1ba..c28ebd2c 100644 --- a/app/src/main/res/drawable-v21/metro_widget_button_light.xml +++ b/app/src/main/res/drawable-v21/metro_widget_button_light.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/widget_button_no_bg.xml b/app/src/main/res/drawable-v21/widget_button_no_bg.xml index 25fea48a..9f2dfc93 100644 --- a/app/src/main/res/drawable-v21/widget_button_no_bg.xml +++ b/app/src/main/res/drawable-v21/widget_button_no_bg.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable-v21/widget_button_no_bg_light.xml b/app/src/main/res/drawable-v21/widget_button_no_bg_light.xml index 75158fa4..b6ce69f9 100644 --- a/app/src/main/res/drawable-v21/widget_button_no_bg_light.xml +++ b/app/src/main/res/drawable-v21/widget_button_no_bg_light.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable/blue_button.xml b/app/src/main/res/drawable/blue_button.xml index 60ccdebd..a6725593 100644 --- a/app/src/main/res/drawable/blue_button.xml +++ b/app/src/main/res/drawable/blue_button.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/blue_button_dark.xml b/app/src/main/res/drawable/blue_button_dark.xml index a32e69f5..c4e14688 100644 --- a/app/src/main/res/drawable/blue_button_dark.xml +++ b/app/src/main/res/drawable/blue_button_dark.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/blue_button_dark_shape.xml b/app/src/main/res/drawable/blue_button_dark_shape.xml index 2fe73a7b..28866ee8 100644 --- a/app/src/main/res/drawable/blue_button_dark_shape.xml +++ b/app/src/main/res/drawable/blue_button_dark_shape.xml @@ -22,16 +22,16 @@ ~ Site: http://se.solovyev.org --> - + - + android:angle="90" + android:endColor="#002255" + android:startColor="#000d1f" /> + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/blue_button_shape.xml b/app/src/main/res/drawable/blue_button_shape.xml index 22461e07..8048b835 100644 --- a/app/src/main/res/drawable/blue_button_shape.xml +++ b/app/src/main/res/drawable/blue_button_shape.xml @@ -22,16 +22,16 @@ ~ Site: http://se.solovyev.org --> - + - + android:angle="90" + android:endColor="#003481" + android:startColor="#001c45" /> + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/button_no_bg.xml b/app/src/main/res/drawable/button_no_bg.xml index ed867670..3b744d14 100644 --- a/app/src/main/res/drawable/button_no_bg.xml +++ b/app/src/main/res/drawable/button_no_bg.xml @@ -22,13 +22,13 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/button_no_bg_pressed.xml b/app/src/main/res/drawable/button_no_bg_pressed.xml index 84bc16fe..7734ff19 100644 --- a/app/src/main/res/drawable/button_no_bg_pressed.xml +++ b/app/src/main/res/drawable/button_no_bg_pressed.xml @@ -20,6 +20,6 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable/gray_button.xml b/app/src/main/res/drawable/gray_button.xml index b2dfcdc6..d6c3267f 100644 --- a/app/src/main/res/drawable/gray_button.xml +++ b/app/src/main/res/drawable/gray_button.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/gray_button_dark.xml b/app/src/main/res/drawable/gray_button_dark.xml index 6fea30d8..da386d0a 100644 --- a/app/src/main/res/drawable/gray_button_dark.xml +++ b/app/src/main/res/drawable/gray_button_dark.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/gray_button_dark_shape.xml b/app/src/main/res/drawable/gray_button_dark_shape.xml index 2957eebf..5f201a1c 100644 --- a/app/src/main/res/drawable/gray_button_dark_shape.xml +++ b/app/src/main/res/drawable/gray_button_dark_shape.xml @@ -22,16 +22,16 @@ ~ Site: http://se.solovyev.org --> - + - + android:angle="90" + android:endColor="#333333" + android:startColor="#000000" /> + diff --git a/app/src/main/res/drawable/gray_button_shape.xml b/app/src/main/res/drawable/gray_button_shape.xml index 48acde4e..2dd3b220 100644 --- a/app/src/main/res/drawable/gray_button_shape.xml +++ b/app/src/main/res/drawable/gray_button_shape.xml @@ -22,16 +22,16 @@ ~ Site: http://se.solovyev.org --> - + - + android:angle="90" + android:endColor="#253541" + android:startColor="#071622" /> + diff --git a/app/src/main/res/drawable/material_blue_button.xml b/app/src/main/res/drawable/material_blue_button.xml index 0846505a..ab494f81 100644 --- a/app/src/main/res/drawable/material_blue_button.xml +++ b/app/src/main/res/drawable/material_blue_button.xml @@ -22,18 +22,18 @@ ~ Site: http://se.solovyev.org --> - + - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_blue_button_lighter.xml b/app/src/main/res/drawable/material_blue_button_lighter.xml index 5f27ae6e..034113ba 100644 --- a/app/src/main/res/drawable/material_blue_button_lighter.xml +++ b/app/src/main/res/drawable/material_blue_button_lighter.xml @@ -22,18 +22,18 @@ ~ Site: http://se.solovyev.org --> - + - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_black.xml b/app/src/main/res/drawable/material_button_black.xml index 5d7dd74b..a867238e 100644 --- a/app/src/main/res/drawable/material_button_black.xml +++ b/app/src/main/res/drawable/material_button_black.xml @@ -22,14 +22,14 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_black_lighter.xml b/app/src/main/res/drawable/material_button_black_lighter.xml index 610a3db0..5d789b71 100644 --- a/app/src/main/res/drawable/material_button_black_lighter.xml +++ b/app/src/main/res/drawable/material_button_black_lighter.xml @@ -22,14 +22,14 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_dark.xml b/app/src/main/res/drawable/material_button_dark.xml index 610a3db0..5d789b71 100644 --- a/app/src/main/res/drawable/material_button_dark.xml +++ b/app/src/main/res/drawable/material_button_dark.xml @@ -22,14 +22,14 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_dark_lighter.xml b/app/src/main/res/drawable/material_button_dark_lighter.xml index ef145a86..99f00e9c 100644 --- a/app/src/main/res/drawable/material_button_dark_lighter.xml +++ b/app/src/main/res/drawable/material_button_dark_lighter.xml @@ -22,14 +22,14 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_deep_blue.xml b/app/src/main/res/drawable/material_button_deep_blue.xml index 5880c0de..5ea0b10b 100644 --- a/app/src/main/res/drawable/material_button_deep_blue.xml +++ b/app/src/main/res/drawable/material_button_deep_blue.xml @@ -22,18 +22,18 @@ ~ Site: http://se.solovyev.org --> - + - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_deep_blue_lighter.xml b/app/src/main/res/drawable/material_button_deep_blue_lighter.xml index 000bc4a6..a1537413 100644 --- a/app/src/main/res/drawable/material_button_deep_blue_lighter.xml +++ b/app/src/main/res/drawable/material_button_deep_blue_lighter.xml @@ -22,18 +22,18 @@ ~ Site: http://se.solovyev.org --> - + - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_light.xml b/app/src/main/res/drawable/material_button_light.xml index 5e858ed1..bf1d9c9c 100644 --- a/app/src/main/res/drawable/material_button_light.xml +++ b/app/src/main/res/drawable/material_button_light.xml @@ -21,14 +21,14 @@ ~ Email: se.solovyev@gmail.com ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_light_darker.xml b/app/src/main/res/drawable/material_button_light_darker.xml index 77dc1816..1aa8a2b4 100644 --- a/app/src/main/res/drawable/material_button_light_darker.xml +++ b/app/src/main/res/drawable/material_button_light_darker.xml @@ -21,14 +21,14 @@ ~ Email: se.solovyev@gmail.com ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_light_primary.xml b/app/src/main/res/drawable/material_button_light_primary.xml index fe12e0cc..11cc2182 100644 --- a/app/src/main/res/drawable/material_button_light_primary.xml +++ b/app/src/main/res/drawable/material_button_light_primary.xml @@ -22,18 +22,18 @@ ~ Site: http://se.solovyev.org --> - + - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_light_primary_darker.xml b/app/src/main/res/drawable/material_button_light_primary_darker.xml index 26459f54..8f728f47 100644 --- a/app/src/main/res/drawable/material_button_light_primary_darker.xml +++ b/app/src/main/res/drawable/material_button_light_primary_darker.xml @@ -22,18 +22,18 @@ ~ Site: http://se.solovyev.org --> - + - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/material_button_pressed.xml b/app/src/main/res/drawable/material_button_pressed.xml index 0be8adff..26bbb05c 100644 --- a/app/src/main/res/drawable/material_button_pressed.xml +++ b/app/src/main/res/drawable/material_button_pressed.xml @@ -20,6 +20,6 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/drawable/metro_blue_button.xml b/app/src/main/res/drawable/metro_blue_button.xml index fda89f8b..26fa4236 100644 --- a/app/src/main/res/drawable/metro_blue_button.xml +++ b/app/src/main/res/drawable/metro_blue_button.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_blue_button_shape.xml b/app/src/main/res/drawable/metro_blue_button_shape.xml index 98ffd8f7..072ca291 100644 --- a/app/src/main/res/drawable/metro_blue_button_shape.xml +++ b/app/src/main/res/drawable/metro_blue_button_shape.xml @@ -19,13 +19,13 @@ ~ Email: se.solovyev@gmail.com ~ Site: http://se.solovyev.org --> - + - - + + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_button_dark.xml b/app/src/main/res/drawable/metro_button_dark.xml index f9b789be..911474a6 100644 --- a/app/src/main/res/drawable/metro_button_dark.xml +++ b/app/src/main/res/drawable/metro_button_dark.xml @@ -22,9 +22,9 @@ ~ Site: http://se.solovyev.org --> - + - + - - \ No newline at end of file + + diff --git a/app/src/main/res/drawable/metro_button_dark_shape.xml b/app/src/main/res/drawable/metro_button_dark_shape.xml index 2f78b88c..aad57063 100644 --- a/app/src/main/res/drawable/metro_button_dark_shape.xml +++ b/app/src/main/res/drawable/metro_button_dark_shape.xml @@ -20,14 +20,14 @@ ~ Site: http://se.solovyev.org --> - + - - + + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_button_green.xml b/app/src/main/res/drawable/metro_button_green.xml index 29cb8939..7e5ee310 100644 --- a/app/src/main/res/drawable/metro_button_green.xml +++ b/app/src/main/res/drawable/metro_button_green.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_button_green_shape.xml b/app/src/main/res/drawable/metro_button_green_shape.xml index 8cd8ac64..bad056f0 100644 --- a/app/src/main/res/drawable/metro_button_green_shape.xml +++ b/app/src/main/res/drawable/metro_button_green_shape.xml @@ -20,13 +20,13 @@ ~ Site: http://se.solovyev.org --> - + - - + + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_button_light.xml b/app/src/main/res/drawable/metro_button_light.xml index e55c0f3e..9e5688e7 100644 --- a/app/src/main/res/drawable/metro_button_light.xml +++ b/app/src/main/res/drawable/metro_button_light.xml @@ -22,8 +22,8 @@ ~ Site: http://se.solovyev.org --> - + - - - \ No newline at end of file + + + diff --git a/app/src/main/res/drawable/metro_button_light_shape.xml b/app/src/main/res/drawable/metro_button_light_shape.xml index d0b6d80a..7210e106 100644 --- a/app/src/main/res/drawable/metro_button_light_shape.xml +++ b/app/src/main/res/drawable/metro_button_light_shape.xml @@ -20,13 +20,13 @@ ~ Site: http://se.solovyev.org --> - + - - + + diff --git a/app/src/main/res/drawable/metro_button_pressed.xml b/app/src/main/res/drawable/metro_button_pressed.xml index e7aa9e6a..2d984ab5 100644 --- a/app/src/main/res/drawable/metro_button_pressed.xml +++ b/app/src/main/res/drawable/metro_button_pressed.xml @@ -20,13 +20,13 @@ ~ Site: http://se.solovyev.org --> - + - - + + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_button_purple.xml b/app/src/main/res/drawable/metro_button_purple.xml index 379d802a..2ed6104c 100644 --- a/app/src/main/res/drawable/metro_button_purple.xml +++ b/app/src/main/res/drawable/metro_button_purple.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_button_purple_shape.xml b/app/src/main/res/drawable/metro_button_purple_shape.xml index a9bdbb48..ea9d8c74 100644 --- a/app/src/main/res/drawable/metro_button_purple_shape.xml +++ b/app/src/main/res/drawable/metro_button_purple_shape.xml @@ -20,13 +20,13 @@ ~ Site: http://se.solovyev.org --> - + - - + + diff --git a/app/src/main/res/drawable/metro_widget_button.xml b/app/src/main/res/drawable/metro_widget_button.xml index fda89f8b..26fa4236 100644 --- a/app/src/main/res/drawable/metro_widget_button.xml +++ b/app/src/main/res/drawable/metro_widget_button.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/metro_widget_button_dark.xml b/app/src/main/res/drawable/metro_widget_button_dark.xml index f9b789be..911474a6 100644 --- a/app/src/main/res/drawable/metro_widget_button_dark.xml +++ b/app/src/main/res/drawable/metro_widget_button_dark.xml @@ -22,9 +22,9 @@ ~ Site: http://se.solovyev.org --> - + - + - - \ No newline at end of file + + diff --git a/app/src/main/res/drawable/metro_widget_button_light.xml b/app/src/main/res/drawable/metro_widget_button_light.xml index b244d178..735f09cc 100644 --- a/app/src/main/res/drawable/metro_widget_button_light.xml +++ b/app/src/main/res/drawable/metro_widget_button_light.xml @@ -22,9 +22,9 @@ ~ Site: http://se.solovyev.org --> - + - + - - \ No newline at end of file + + diff --git a/app/src/main/res/drawable/violet_button.xml b/app/src/main/res/drawable/violet_button.xml index 52d014d8..74bf22e5 100644 --- a/app/src/main/res/drawable/violet_button.xml +++ b/app/src/main/res/drawable/violet_button.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/violet_button_dark.xml b/app/src/main/res/drawable/violet_button_dark.xml index 49a7ceba..3b75dac1 100644 --- a/app/src/main/res/drawable/violet_button_dark.xml +++ b/app/src/main/res/drawable/violet_button_dark.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/violet_button_dark_shape.xml b/app/src/main/res/drawable/violet_button_dark_shape.xml index 2b11013c..bdeea8d5 100644 --- a/app/src/main/res/drawable/violet_button_dark_shape.xml +++ b/app/src/main/res/drawable/violet_button_dark_shape.xml @@ -22,16 +22,16 @@ ~ Site: http://se.solovyev.org --> - + - + android:angle="90" + android:endColor="#4f1c47" + android:startColor="#2b0325" /> + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/violet_button_shape.xml b/app/src/main/res/drawable/violet_button_shape.xml index 495949b1..32ed48fd 100644 --- a/app/src/main/res/drawable/violet_button_shape.xml +++ b/app/src/main/res/drawable/violet_button_shape.xml @@ -22,16 +22,16 @@ ~ Site: http://se.solovyev.org --> - + - + android:angle="90" + android:endColor="#8a307c" + android:startColor="#520546" /> + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/widget_button_no_bg.xml b/app/src/main/res/drawable/widget_button_no_bg.xml index e343e5c7..08fedae8 100644 --- a/app/src/main/res/drawable/widget_button_no_bg.xml +++ b/app/src/main/res/drawable/widget_button_no_bg.xml @@ -22,13 +22,13 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/widget_button_no_bg_light.xml b/app/src/main/res/drawable/widget_button_no_bg_light.xml index e343e5c7..08fedae8 100644 --- a/app/src/main/res/drawable/widget_button_no_bg_light.xml +++ b/app/src/main/res/drawable/widget_button_no_bg_light.xml @@ -22,13 +22,13 @@ ~ Site: http://se.solovyev.org --> - + - + - + - \ No newline at end of file + diff --git a/app/src/main/res/drawable/widget_button_no_bg_pressed.xml b/app/src/main/res/drawable/widget_button_no_bg_pressed.xml index 84bc16fe..7734ff19 100644 --- a/app/src/main/res/drawable/widget_button_no_bg_pressed.xml +++ b/app/src/main/res/drawable/widget_button_no_bg_pressed.xml @@ -20,6 +20,6 @@ ~ Site: http://se.solovyev.org --> - - + + diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index 0a2d67d9..64703956 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -22,53 +22,53 @@ ~ Site: http://se.solovyev.org --> + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical"> - + + android:id="@+id/partial_keyboard" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:baselineAligned="false" + android:orientation="horizontal"> + android:id="@+id/display" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="5" + android:orientation="horizontal" /> + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" /> + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" /> + android:id="@+id/keyboard" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="3" /> diff --git a/app/src/main/res/layout-land/activity_tabs_tablayout.xml b/app/src/main/res/layout-land/activity_tabs_tablayout.xml index 3038c097..947e39ac 100644 --- a/app/src/main/res/layout-land/activity_tabs_tablayout.xml +++ b/app/src/main/res/layout-land/activity_tabs_tablayout.xml @@ -2,14 +2,15 @@ - - - + - \ No newline at end of file + diff --git a/app/src/main/res/layout-land/cpp_app_keyboard.xml b/app/src/main/res/layout-land/cpp_app_keyboard.xml index e40d246f..416ce020 100644 --- a/app/src/main/res/layout-land/cpp_app_keyboard.xml +++ b/app/src/main/res/layout-land/cpp_app_keyboard.xml @@ -22,17 +22,17 @@ ~ Site: http://se.solovyev.org --> - + + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:baselineAligned="false" + android:orientation="horizontal"> @@ -53,11 +53,11 @@ + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:baselineAligned="false" + android:orientation="horizontal"> @@ -78,11 +78,11 @@ + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:baselineAligned="false" + android:orientation="horizontal"> @@ -102,4 +102,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/layout/activity_empty.xml b/app/src/main/res/layout/activity_empty.xml index 96f472fa..44d6b953 100644 --- a/app/src/main/res/layout/activity_empty.xml +++ b/app/src/main/res/layout/activity_empty.xml @@ -28,9 +28,9 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"> - - \ No newline at end of file + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 11e6e204..bba82ca8 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -22,42 +22,42 @@ ~ Site: http://se.solovyev.org --> - + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - + + android:id="@+id/partial_keyboard" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:baselineAligned="false"> + android:id="@+id/display" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="4" /> + android:id="@+id/keyboard" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="5" /> diff --git a/app/src/main/res/layout/activity_main_editor_with_overflow_menu.xml b/app/src/main/res/layout/activity_main_editor_with_overflow_menu.xml index 45fb1bf5..731f2e16 100644 --- a/app/src/main/res/layout/activity_main_editor_with_overflow_menu.xml +++ b/app/src/main/res/layout/activity_main_editor_with_overflow_menu.xml @@ -1,36 +1,36 @@ - + android:id="@+id/editor" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + android:layout_width="40dp" + android:layout_height="?attr/actionBarSize" + android:layout_gravity="top|end" + android:background="@null" + android:paddingLeft="0dp" + android:paddingRight="0dp" /> + android:layout_width="20dp" + android:layout_height="36dp" + android:layout_gravity="top|end" + android:tooltipText="@null" + android:clickable="false" + android:focusable="false" + android:focusableInTouchMode="false" + android:paddingLeft="0dp" + android:paddingRight="0dp" /> diff --git a/app/src/main/res/layout/activity_tabs.xml b/app/src/main/res/layout/activity_tabs.xml index 6c1f2b04..d899e78c 100644 --- a/app/src/main/res/layout/activity_tabs.xml +++ b/app/src/main/res/layout/activity_tabs.xml @@ -22,7 +22,7 @@ ~ Site: http://se.solovyev.org --> - - - - + - - \ No newline at end of file + diff --git a/app/src/main/res/layout/activity_tabs_tablayout.xml b/app/src/main/res/layout/activity_tabs_tablayout.xml index b21c8bff..bf31d60d 100644 --- a/app/src/main/res/layout/activity_tabs_tablayout.xml +++ b/app/src/main/res/layout/activity_tabs_tablayout.xml @@ -2,14 +2,14 @@ - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/cpp_activity_wizard.xml b/app/src/main/res/layout/cpp_activity_wizard.xml index 6f9fa7c2..4f9288e7 100644 --- a/app/src/main/res/layout/cpp_activity_wizard.xml +++ b/app/src/main/res/layout/cpp_activity_wizard.xml @@ -1,13 +1,13 @@ - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/cpp_app_button_0.xml b/app/src/main/res/layout/cpp_app_button_0.xml index 070151ea..60e1868d 100644 --- a/app/src/main/res/layout/cpp_app_button_0.xml +++ b/app/src/main/res/layout/cpp_app_button_0.xml @@ -23,12 +23,12 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_1.xml b/app/src/main/res/layout/cpp_app_button_1.xml index a4a9df5e..69cb2ece 100644 --- a/app/src/main/res/layout/cpp_app_button_1.xml +++ b/app/src/main/res/layout/cpp_app_button_1.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_2.xml b/app/src/main/res/layout/cpp_app_button_2.xml index 8d896df2..337a0e0b 100644 --- a/app/src/main/res/layout/cpp_app_button_2.xml +++ b/app/src/main/res/layout/cpp_app_button_2.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_3.xml b/app/src/main/res/layout/cpp_app_button_3.xml index 49092575..aa7cbdd1 100644 --- a/app/src/main/res/layout/cpp_app_button_3.xml +++ b/app/src/main/res/layout/cpp_app_button_3.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_4.xml b/app/src/main/res/layout/cpp_app_button_4.xml index f75f3620..ab1161f2 100644 --- a/app/src/main/res/layout/cpp_app_button_4.xml +++ b/app/src/main/res/layout/cpp_app_button_4.xml @@ -22,13 +22,13 @@ ~ Site: http://se.solovyev.org --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_5.xml b/app/src/main/res/layout/cpp_app_button_5.xml index f762e287..b72f7afc 100644 --- a/app/src/main/res/layout/cpp_app_button_5.xml +++ b/app/src/main/res/layout/cpp_app_button_5.xml @@ -22,13 +22,13 @@ ~ Site: http://se.solovyev.org --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_6.xml b/app/src/main/res/layout/cpp_app_button_6.xml index cb0768a0..1b08f758 100644 --- a/app/src/main/res/layout/cpp_app_button_6.xml +++ b/app/src/main/res/layout/cpp_app_button_6.xml @@ -23,12 +23,12 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_7.xml b/app/src/main/res/layout/cpp_app_button_7.xml index 3da38729..a744a093 100644 --- a/app/src/main/res/layout/cpp_app_button_7.xml +++ b/app/src/main/res/layout/cpp_app_button_7.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_8.xml b/app/src/main/res/layout/cpp_app_button_8.xml index efc4c5ca..5ea18a97 100644 --- a/app/src/main/res/layout/cpp_app_button_8.xml +++ b/app/src/main/res/layout/cpp_app_button_8.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_9.xml b/app/src/main/res/layout/cpp_app_button_9.xml index 5dfa09b1..b0aafec7 100644 --- a/app/src/main/res/layout/cpp_app_button_9.xml +++ b/app/src/main/res/layout/cpp_app_button_9.xml @@ -23,11 +23,11 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_clear.xml b/app/src/main/res/layout/cpp_app_button_clear.xml index 4012f5a1..c9381403 100644 --- a/app/src/main/res/layout/cpp_app_button_clear.xml +++ b/app/src/main/res/layout/cpp_app_button_clear.xml @@ -23,10 +23,10 @@ --> \ No newline at end of file + android:textStyle="bold"/> diff --git a/app/src/main/res/layout/cpp_app_button_division.xml b/app/src/main/res/layout/cpp_app_button_division.xml index 4d42b243..bda618d2 100644 --- a/app/src/main/res/layout/cpp_app_button_division.xml +++ b/app/src/main/res/layout/cpp_app_button_division.xml @@ -23,11 +23,11 @@ --> \ No newline at end of file + android:text="/" + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_dot.xml b/app/src/main/res/layout/cpp_app_button_dot.xml index 426ed501..c8b9fad6 100644 --- a/app/src/main/res/layout/cpp_app_button_dot.xml +++ b/app/src/main/res/layout/cpp_app_button_dot.xml @@ -23,12 +23,12 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_equals_no_bg.xml b/app/src/main/res/layout/cpp_app_button_equals_no_bg.xml index f846d4f9..e103921e 100644 --- a/app/src/main/res/layout/cpp_app_button_equals_no_bg.xml +++ b/app/src/main/res/layout/cpp_app_button_equals_no_bg.xml @@ -22,15 +22,15 @@ ~ Site: http://se.solovyev.org --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_erase.xml b/app/src/main/res/layout/cpp_app_button_erase.xml index 5dd168f1..72e26992 100644 --- a/app/src/main/res/layout/cpp_app_button_erase.xml +++ b/app/src/main/res/layout/cpp_app_button_erase.xml @@ -26,4 +26,4 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/cpp_button_erase" style="?attr/cpp_button_style_operation_highlighted" - android:text="@string/cpp_glyph_backspace"/> \ No newline at end of file + android:text="@string/cpp_glyph_backspace"/> diff --git a/app/src/main/res/layout/cpp_app_button_functions.xml b/app/src/main/res/layout/cpp_app_button_functions.xml index 445d9c16..743e4e57 100644 --- a/app/src/main/res/layout/cpp_app_button_functions.xml +++ b/app/src/main/res/layout/cpp_app_button_functions.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_history.xml b/app/src/main/res/layout/cpp_app_button_history.xml index 3710be8d..4d295c91 100644 --- a/app/src/main/res/layout/cpp_app_button_history.xml +++ b/app/src/main/res/layout/cpp_app_button_history.xml @@ -22,11 +22,11 @@ ~ Site: http://se.solovyev.org --> \ No newline at end of file + app:directionTextUp="@string/cpp_glyph_undo" /> diff --git a/app/src/main/res/layout/cpp_app_button_left.xml b/app/src/main/res/layout/cpp_app_button_left.xml index 21447121..851bd585 100644 --- a/app/src/main/res/layout/cpp_app_button_left.xml +++ b/app/src/main/res/layout/cpp_app_button_left.xml @@ -22,12 +22,12 @@ ~ Site: http://se.solovyev.org --> - \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_like.xml b/app/src/main/res/layout/cpp_app_button_like.xml index 05363467..5827f6dc 100644 --- a/app/src/main/res/layout/cpp_app_button_like.xml +++ b/app/src/main/res/layout/cpp_app_button_like.xml @@ -26,4 +26,4 @@ android:id="@id/cpp_button_like" style="?attr/cpp_button_style_control" xmlns:android="http://schemas.android.com/apk/res/android" - android:text="@string/cpp_glyph_heart"/> \ No newline at end of file + android:text="@string/cpp_glyph_heart"/> diff --git a/app/src/main/res/layout/cpp_app_button_memory.xml b/app/src/main/res/layout/cpp_app_button_memory.xml index 89ec2124..53d120ac 100644 --- a/app/src/main/res/layout/cpp_app_button_memory.xml +++ b/app/src/main/res/layout/cpp_app_button_memory.xml @@ -21,11 +21,11 @@ ~ Email: se.solovyev@gmail.com ~ Site: http://se.solovyev.org --> - \ No newline at end of file + android:textStyle="bold"/> diff --git a/app/src/main/res/layout/cpp_app_button_minus.xml b/app/src/main/res/layout/cpp_app_button_minus.xml index 5672279f..b8589ca0 100644 --- a/app/src/main/res/layout/cpp_app_button_minus.xml +++ b/app/src/main/res/layout/cpp_app_button_minus.xml @@ -22,10 +22,10 @@ ~ Site: http://se.solovyev.org --> \ No newline at end of file + android:text="−" + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_multiplication.xml b/app/src/main/res/layout/cpp_app_button_multiplication.xml index 66623666..af4c571e 100644 --- a/app/src/main/res/layout/cpp_app_button_multiplication.xml +++ b/app/src/main/res/layout/cpp_app_button_multiplication.xml @@ -23,12 +23,12 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_percent.xml b/app/src/main/res/layout/cpp_app_button_percent.xml index 361b5440..bacb9ade 100644 --- a/app/src/main/res/layout/cpp_app_button_percent.xml +++ b/app/src/main/res/layout/cpp_app_button_percent.xml @@ -23,9 +23,9 @@ --> \ No newline at end of file + android:text="%" + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_plus.xml b/app/src/main/res/layout/cpp_app_button_plus.xml index 99fccc8c..a698a5fa 100644 --- a/app/src/main/res/layout/cpp_app_button_plus.xml +++ b/app/src/main/res/layout/cpp_app_button_plus.xml @@ -22,11 +22,11 @@ ~ Site: http://se.solovyev.org --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_right.xml b/app/src/main/res/layout/cpp_app_button_right.xml index 6ddeff76..ea92d5c7 100644 --- a/app/src/main/res/layout/cpp_app_button_right.xml +++ b/app/src/main/res/layout/cpp_app_button_right.xml @@ -30,4 +30,4 @@ android:text="@string/cpp_glyph_right" app:directionTextUp="@string/cpp_glyph_fast_forward" app:directionTextDown="@string/cpp_glyph_paste" - tools:ignore="HardcodedText" /> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_round_brackets.xml b/app/src/main/res/layout/cpp_app_button_round_brackets.xml index 06dac7c6..a1114f19 100644 --- a/app/src/main/res/layout/cpp_app_button_round_brackets.xml +++ b/app/src/main/res/layout/cpp_app_button_round_brackets.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_button_vars.xml b/app/src/main/res/layout/cpp_app_button_vars.xml index bf077783..aab5c483 100644 --- a/app/src/main/res/layout/cpp_app_button_vars.xml +++ b/app/src/main/res/layout/cpp_app_button_vars.xml @@ -23,13 +23,13 @@ --> \ No newline at end of file + tools:ignore="HardcodedText" /> diff --git a/app/src/main/res/layout/cpp_app_display.xml b/app/src/main/res/layout/cpp_app_display.xml index c4608f24..9515221b 100644 --- a/app/src/main/res/layout/cpp_app_display.xml +++ b/app/src/main/res/layout/cpp_app_display.xml @@ -27,4 +27,4 @@ style="@style/CppText.Display" android:paddingLeft="@dimen/cpp_display_padding_side" android:paddingRight="@dimen/cpp_display_padding_side" - xmlns:android="http://schemas.android.com/apk/res/android"/> \ No newline at end of file + xmlns:android="http://schemas.android.com/apk/res/android"/> diff --git a/app/src/main/res/layout/cpp_app_editor.xml b/app/src/main/res/layout/cpp_app_editor.xml index 8f5eaec8..0c779676 100644 --- a/app/src/main/res/layout/cpp_app_editor.xml +++ b/app/src/main/res/layout/cpp_app_editor.xml @@ -22,8 +22,8 @@ ~ Site: http://se.solovyev.org --> \ No newline at end of file + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" /> diff --git a/app/src/main/res/layout/cpp_app_keyboard.xml b/app/src/main/res/layout/cpp_app_keyboard.xml index 533c6fa3..68b2f783 100644 --- a/app/src/main/res/layout/cpp_app_keyboard.xml +++ b/app/src/main/res/layout/cpp_app_keyboard.xml @@ -22,15 +22,15 @@ ~ Site: http://se.solovyev.org --> - + + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> @@ -45,9 +45,9 @@ + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> @@ -63,9 +63,9 @@ + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> @@ -80,9 +80,9 @@ + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> @@ -98,9 +98,9 @@ + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> @@ -114,4 +114,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/layout/cpp_release_note_step.xml b/app/src/main/res/layout/cpp_release_note_step.xml index 773ea11c..fa891ef3 100644 --- a/app/src/main/res/layout/cpp_release_note_step.xml +++ b/app/src/main/res/layout/cpp_release_note_step.xml @@ -22,24 +22,24 @@ ~ Site: http://se.solovyev.org --> - + + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="@android:style/TextAppearance.Large" /> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="@android:style/TextAppearance.Medium" /> diff --git a/app/src/main/res/layout/cpp_simple_button_0.xml b/app/src/main/res/layout/cpp_simple_button_0.xml index bee37500..e30b3708 100644 --- a/app/src/main/res/layout/cpp_simple_button_0.xml +++ b/app/src/main/res/layout/cpp_simple_button_0.xml @@ -23,9 +23,9 @@ -->