Revive the project
This commit is contained in:
parent
22448df392
commit
1fc9ffef3a
@ -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 157
|
||||
versionName '2.2.7'
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
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,72 +52,70 @@ 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
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = ['library': '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 ':measure:'
|
||||
implementation ':square-otto:1.3.9-SNAPSHOT'
|
||||
annotationProcessor ':square-otto:1.3.9-SNAPSHOT'
|
||||
annotationProcessor ':square-otto-compiler:1.3.9-SNAPSHOT'
|
||||
annotationProcessor 'com.squareup:javapoet:1.9.0'
|
||||
kapt ':square-otto:1.3.9-SNAPSHOT'
|
||||
kapt ':square-otto-compiler:1.3.9-SNAPSHOT'
|
||||
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 "com.google.android.gms:play-services-ads:${versions.gpsLib}"
|
||||
implementation 'org.solovyev.android:checkout:1.3.0'
|
||||
implementation "com.google.android.gms:play-services-ads:22.2.0"
|
||||
implementation "com.google.android.gms:play-services-base:${versions.gpsLib}"
|
||||
implementation "com.google.android.gms:play-services-analytics:${versions.gpsLib}"
|
||||
implementation(name: 'plotter', ext: 'aar')
|
||||
implementation 'com.google.guava:guava:20.0'
|
||||
implementation('org.simpleframework:simple-xml:2.6.1') {
|
||||
implementation "com.google.android.gms:play-services-analytics:18.0.3"
|
||||
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'
|
||||
testImplementation(name: 'org.apache.http.legacy', ext: 'jar')
|
||||
|
||||
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'
|
||||
})}
|
||||
@ -122,6 +123,7 @@ dependencies {
|
||||
tasks.withType(Test) {
|
||||
scanForTestClasses = false
|
||||
include "**/*Test.class"
|
||||
exclude "**/*BaseCalculatorTest*"
|
||||
exclude "**/*AndroidCalculatorEditorViewTest*"
|
||||
exclude "**/*CalculatorWizardActivityTest*"
|
||||
exclude "**/*OnScreenCalculatorWizardStepTest*"
|
||||
@ -130,6 +132,7 @@ tasks.withType(Test) {
|
||||
exclude "**/*AngleUnitsButtonTest*"
|
||||
exclude "**/*NumeralBasesButtonTest*"
|
||||
}
|
||||
/*
|
||||
|
||||
task androidJavadocs(type: Javadoc) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
@ -213,3 +216,4 @@ uploadArchives {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
Binary file not shown.
@ -27,16 +27,16 @@ 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
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.solovyev.android.calculator"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
@ -31,7 +30,12 @@
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
||||
android:value="ca-app-pub-9736972200639245~6870320906"/>
|
||||
|
||||
<activity
|
||||
android:exported="true"
|
||||
android:name=".CalculatorActivity"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:label="@string/cpp_app_name"
|
||||
@ -55,6 +59,7 @@
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:exported="false"
|
||||
android:name=".preferences.PreferencesActivity"
|
||||
android:label="@string/cpp_settings">
|
||||
<intent-filter>
|
||||
@ -120,6 +125,7 @@
|
||||
android:theme="@style/Cpp.Theme.Dialog" />
|
||||
|
||||
<activity
|
||||
android:exported="false"
|
||||
android:name=".plot.PlotActivity"
|
||||
android:label="@string/cpp_plotter">
|
||||
<intent-filter>
|
||||
@ -128,6 +134,7 @@
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:exported="false"
|
||||
android:name=".wizard.WizardActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/Cpp.Theme.Wizard">
|
||||
@ -144,6 +151,7 @@
|
||||
<!-- ONSCREEN CONFIG -->
|
||||
|
||||
<activity
|
||||
android:exported="true"
|
||||
android:name=".floating.FloatingCalculatorActivity"
|
||||
android:icon="@drawable/ic_launcher_window"
|
||||
android:label="@string/cpp_app_name_on_screen"
|
||||
@ -176,6 +184,7 @@
|
||||
<!-- WIDGET CONFIG -->
|
||||
|
||||
<receiver
|
||||
android:exported="true"
|
||||
android:name=".widget.CalculatorWidget"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/cpp_app_name">
|
||||
@ -201,17 +210,9 @@
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
|
||||
android:theme="@android:style/Theme.Translucent" />
|
||||
|
||||
<!-- ACRA CONFIG -->
|
||||
|
||||
<activity
|
||||
android:name="org.acra.CrashReportDialog"
|
||||
android:excludeFromRecents="true"
|
||||
android:finishOnTaskLaunch="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Dialog" />
|
||||
|
||||
<!-- Google Analytics -->
|
||||
<receiver
|
||||
android:exported="true"
|
||||
tools:ignore="ExportedReceiver"
|
||||
android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
|
||||
android:enabled="true">
|
||||
@ -220,14 +221,6 @@
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
|
||||
<receiver
|
||||
tools:ignore="ExportedReceiver"
|
||||
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
|
||||
android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<service
|
||||
android:name="com.google.android.gms.analytics.AnalyticsService"
|
||||
android:enabled="true"
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -9,10 +9,12 @@ import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.gms.ads.AdListener;
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.AdSize;
|
||||
|
||||
import com.google.android.gms.ads.LoadAdError;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -81,11 +83,6 @@ public class AdView extends FrameLayout {
|
||||
admobView.setAdListener(admobListener);
|
||||
|
||||
final AdRequest.Builder b = new AdRequest.Builder();
|
||||
b.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
|
||||
if (BuildConfig.DEBUG) {
|
||||
// LG Nexus 5
|
||||
b.addTestDevice("B80E676D60CE6FDBE1B84A55464E3FE1");
|
||||
}
|
||||
admobView.loadAd(b.build());
|
||||
}
|
||||
|
||||
@ -127,7 +124,7 @@ public class AdView extends FrameLayout {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdFailedToLoad(int errorCode) {
|
||||
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
|
||||
if (adView != null) {
|
||||
adView.hide();
|
||||
adView = null;
|
||||
|
@ -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 <T> ArrayAdapter<T> 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<V> {
|
||||
|
@ -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;
|
||||
|
@ -10,14 +10,6 @@ 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;
|
||||
@ -25,6 +17,14 @@ 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 org.solovyev.android.Check;
|
||||
import org.solovyev.android.calculator.ga.Ga;
|
||||
import org.solovyev.android.calculator.language.Language;
|
||||
@ -36,8 +36,6 @@ 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 {
|
||||
@ -58,13 +56,10 @@ public abstract class BaseActivity extends AppCompatActivity implements SharedPr
|
||||
Lazy<Ga> ga;
|
||||
@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;
|
||||
@ -159,12 +154,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();
|
||||
@ -172,6 +171,8 @@ public abstract class BaseActivity extends AppCompatActivity implements SharedPr
|
||||
tabs.onCreate();
|
||||
}
|
||||
|
||||
protected void bindViews(@Nonnull View contentView) {}
|
||||
|
||||
private void initToolbar() {
|
||||
if (toolbar == null) {
|
||||
return;
|
||||
|
@ -5,19 +5,19 @@ 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.gms.analytics.HitBuilders;
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import org.solovyev.android.calculator.ga.Ga;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -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.calculator.ads.AdUi;
|
||||
import org.solovyev.android.plotter.Check;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -25,11 +25,9 @@ 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 androidx.annotation.StringRes;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
@ -38,10 +36,12 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import butterknife.BindView;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
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;
|
||||
@ -65,11 +65,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 +74,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 +154,8 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.main_menu:
|
||||
if (v.getId() == R.id.main_menu) {
|
||||
mainMenu.toggle();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +174,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,43 +230,43 @@ public class CalculatorActivity extends BaseActivity implements View.OnClickList
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.menu_settings:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.menu_settings) {
|
||||
launcher.showSettings();
|
||||
return true;
|
||||
case R.id.menu_history:
|
||||
} else if (itemId == R.id.menu_history) {
|
||||
launcher.showHistory();
|
||||
return true;
|
||||
case R.id.menu_plotter:
|
||||
} else if (itemId == R.id.menu_plotter) {
|
||||
launcher.showPlotter();
|
||||
return true;
|
||||
case R.id.menu_conversion_tool:
|
||||
} else if (itemId == R.id.menu_conversion_tool) {
|
||||
ConverterFragment.show(CalculatorActivity.this);
|
||||
return true;
|
||||
case R.id.menu_about:
|
||||
} else if (itemId == R.id.menu_about) {
|
||||
launcher.showAbout();
|
||||
return true;
|
||||
case R.id.menu_mode_engineer:
|
||||
} else if (itemId == R.id.menu_mode_engineer) {
|
||||
Preferences.Gui.mode.putPreference(preferences, Preferences.Gui.Mode.engineer);
|
||||
restartIfModeChanged();
|
||||
return true;
|
||||
case R.id.menu_mode_simple:
|
||||
} else if (itemId == R.id.menu_mode_simple) {
|
||||
Preferences.Gui.mode.putPreference(preferences, Preferences.Gui.Mode.simple);
|
||||
restartIfModeChanged();
|
||||
return true;
|
||||
case R.id.menu_au_deg:
|
||||
} else if (itemId == R.id.menu_au_deg) {
|
||||
Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.deg);
|
||||
return true;
|
||||
case R.id.menu_au_rad:
|
||||
} else if (itemId == R.id.menu_au_rad) {
|
||||
Engine.Preferences.angleUnit.putPreference(preferences, AngleUnit.rad);
|
||||
return true;
|
||||
case R.id.menu_nb_bin:
|
||||
} else if (itemId == R.id.menu_nb_bin) {
|
||||
Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.bin);
|
||||
return true;
|
||||
case R.id.menu_nb_dec:
|
||||
} else if (itemId == R.id.menu_nb_dec) {
|
||||
Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.dec);
|
||||
return true;
|
||||
case R.id.menu_nb_hex:
|
||||
} else if (itemId == R.id.menu_nb_hex) {
|
||||
Engine.Preferences.numeralBase.putPreference(preferences, NumeralBase.hex);
|
||||
return true;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
if (title == R.string.convert_to_bin) {
|
||||
return to_bin;
|
||||
case R.string.convert_to_dec:
|
||||
} else if (title == R.string.convert_to_dec) {
|
||||
return to_dec;
|
||||
case R.string.convert_to_hex:
|
||||
} 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,13 +177,11 @@ 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:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == 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:
|
||||
} 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;
|
||||
@ -196,15 +190,14 @@ public class DisplayFragment extends BaseFragment implements View.OnClickListene
|
||||
calculator.convert(state, menuItem.toNumeralBase);
|
||||
}
|
||||
return true;
|
||||
case R.string.c_convert:
|
||||
} else if (itemId == R.string.c_convert) {
|
||||
ConverterFragment.show(getActivity(), getValue(result));
|
||||
return true;
|
||||
case R.string.c_plot:
|
||||
} else if (itemId == R.string.c_plot) {
|
||||
launcher.plot(result);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static double getValue(@Nullable Generic result) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
int id = v.getId();
|
||||
if (id == R.id.cpp_kb_button_divide) {
|
||||
user.insertOperator('/');
|
||||
break;
|
||||
case R.id.cpp_kb_button_plus:
|
||||
} else if (id == R.id.cpp_kb_button_plus) {
|
||||
user.insertOperator('+');
|
||||
break;
|
||||
case R.id.cpp_kb_button_minus:
|
||||
} else if (id == R.id.cpp_kb_button_minus) {
|
||||
user.insertOperator('-');
|
||||
break;
|
||||
case R.id.cpp_kb_button_multiply:
|
||||
} else if (id == R.id.cpp_kb_button_multiply) {
|
||||
user.insertOperator("×");
|
||||
break;
|
||||
case R.id.cpp_kb_button_functions_constants:
|
||||
} else if (id == R.id.cpp_kb_button_functions_constants) {
|
||||
user.showFunctionsConstants(v);
|
||||
break;
|
||||
case R.id.cpp_kb_button_functions:
|
||||
} else if (id == R.id.cpp_kb_button_functions) {
|
||||
user.showFunctions(v);
|
||||
break;
|
||||
case R.id.cpp_kb_button_constants:
|
||||
} else if (id == R.id.cpp_kb_button_constants) {
|
||||
user.showConstants(v);
|
||||
break;
|
||||
case R.id.cpp_kb_button_space:
|
||||
} else if (id == R.id.cpp_kb_button_space) {
|
||||
user.insertText(" ", 0);
|
||||
break;
|
||||
case R.id.cpp_kb_button_keyboard:
|
||||
} else if (id == R.id.cpp_kb_button_keyboard) {
|
||||
user.showIme();
|
||||
break;
|
||||
case R.id.cpp_kb_button_clear:
|
||||
} else if (id == R.id.cpp_kb_button_clear) {
|
||||
user.getEditor().setText("");
|
||||
user.getEditor().setSelection(0);
|
||||
break;
|
||||
case R.id.cpp_kb_button_brackets:
|
||||
} else if (id == R.id.cpp_kb_button_brackets) {
|
||||
user.insertText("()", -1);
|
||||
break;
|
||||
case R.id.cpp_kb_button_close:
|
||||
} else if (id == R.id.cpp_kb_button_close) {
|
||||
user.done();
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
onDefaultClick(v);
|
||||
break;
|
||||
}
|
||||
user.getEditor().requestFocus();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -50,7 +50,17 @@ public class ToJsclTextProcessor implements TextProcessor<PreparedExpression, St
|
||||
}
|
||||
|
||||
private static PreparedExpression processWithDepth(@Nonnull String s, int depth, @Nonnull List<IConstant> 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
|
||||
|
@ -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;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -4,7 +4,7 @@ import static org.solovyev.android.checkout.ProductTypes.IN_APP;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.support.annotation.NonNull;
|
||||
import androidx.annotation.NonNull;
|
||||
import android.view.View;
|
||||
|
||||
import org.solovyev.android.calculator.AdView;
|
||||
@ -16,8 +16,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class AdUi {
|
||||
|
||||
@ -26,7 +24,6 @@ public class AdUi {
|
||||
@NonNull
|
||||
private final Handler handler;
|
||||
@Nullable
|
||||
@BindView(R.id.cpp_ad)
|
||||
AdView adView;
|
||||
@Nullable
|
||||
private Boolean adFree = null;
|
||||
@ -92,7 +89,7 @@ public class AdUi {
|
||||
}
|
||||
|
||||
public void onCreateView(@NonNull View view) {
|
||||
ButterKnife.bind(this, view);
|
||||
adView = view.findViewById(R.id.cpp_ad);
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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<Named<ConvertibleDimension>> dimensionsAdapter;
|
||||
private ArrayAdapter<Named<Convertible>> 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:
|
||||
int parentId = parent.getId();
|
||||
if (parentId == R.id.converter_dimensions_spinner) {
|
||||
onDimensionChanged(dimensionsAdapter.getItem(position).item);
|
||||
break;
|
||||
case R.id.converter_spinner_from:
|
||||
} else if (parentId == R.id.converter_spinner_from) {
|
||||
onUnitFromChanged(adapterFrom.getItem(position).item);
|
||||
break;
|
||||
case R.id.converter_spinner_to:
|
||||
} else if (parentId == R.id.converter_spinner_to) {
|
||||
convert();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 (v.getId() == R.id.converter_edittext_from) {
|
||||
if (!hasFocus) {
|
||||
convert();
|
||||
} else {
|
||||
clearError(labelFrom);
|
||||
showKeyboard();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 (v.getId() == R.id.converter_edittext_from) {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
App.hideIme(editTextFrom);
|
||||
convert();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.converter_swap_button:
|
||||
int id = v.getId();
|
||||
if (id == R.id.converter_swap_button) {
|
||||
keyboardWindow.hide();
|
||||
swap();
|
||||
break;
|
||||
case R.id.converter_edittext_from:
|
||||
} else if (id == R.id.converter_edittext_from) {
|
||||
showKeyboard();
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
super.onClick(v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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<E extends MathEntity> extends BaseFragment {
|
||||
@ -71,7 +71,6 @@ public abstract class BaseEntitiesFragment<E extends MathEntity> extends BaseFra
|
||||
}
|
||||
};
|
||||
|
||||
@BindView(R.id.entities_recyclerview)
|
||||
public RecyclerView recyclerView;
|
||||
@Inject
|
||||
Keyboard keyboard;
|
||||
@ -96,7 +95,8 @@ public abstract class BaseEntitiesFragment<E extends MathEntity> 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<E extends MathEntity> 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<E extends MathEntity> 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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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.*;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -177,7 +177,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());
|
||||
|
@ -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;
|
||||
|
@ -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,15 +171,13 @@ public abstract class BaseFunctionFragment extends BaseDialogFragment implements
|
||||
}
|
||||
|
||||
final int id = v.getId();
|
||||
switch (id) {
|
||||
case R.id.function_name:
|
||||
if (id == R.id.function_name) {
|
||||
if (hasFocus) {
|
||||
clearError(nameLabel);
|
||||
} else {
|
||||
validateName();
|
||||
}
|
||||
break;
|
||||
case R.id.function_body:
|
||||
} else if (id == R.id.function_body) {
|
||||
if (hasFocus) {
|
||||
clearError(bodyLabel);
|
||||
showKeyboard();
|
||||
@ -197,7 +185,6 @@ public abstract class BaseFunctionFragment extends BaseDialogFragment implements
|
||||
keyboardWindow.hide();
|
||||
validateBody();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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:
|
||||
if (v.getId() == R.id.function_body) {
|
||||
showKeyboard();
|
||||
break;
|
||||
default:
|
||||
} else {
|
||||
super.onClick(v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,17 +79,17 @@ public class FunctionsFragment extends BaseEntitiesFragment<Function> {
|
||||
@Override
|
||||
protected boolean onMenuItemClicked(@Nonnull MenuItem item, @Nonnull final Function function) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
switch (item.getItemId()) {
|
||||
case R.string.c_use:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.string.c_use) {
|
||||
onClick(function);
|
||||
return true;
|
||||
case R.string.cpp_edit:
|
||||
} else if (itemId == R.string.cpp_edit) {
|
||||
if (function instanceof IFunction) {
|
||||
EditFunctionFragment.show(CppFunction.builder((IFunction) function).build(),
|
||||
activity.getSupportFragmentManager());
|
||||
}
|
||||
return true;
|
||||
case R.string.cpp_delete:
|
||||
} else if (itemId == R.string.cpp_delete) {
|
||||
RemovalConfirmationDialog.showForFunction(getActivity(), function.getName(), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
@ -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;
|
||||
|
@ -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,23 +216,23 @@ public abstract class BaseHistoryFragment extends BaseFragment {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Check.isNotNull(state);
|
||||
switch (item.getItemId()) {
|
||||
case R.string.c_use:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.string.c_use) {
|
||||
useState(state);
|
||||
return true;
|
||||
case R.string.c_copy_expression:
|
||||
} else if (itemId == R.string.c_copy_expression) {
|
||||
copyExpression(state);
|
||||
return true;
|
||||
case R.string.c_copy_result:
|
||||
} else if (itemId == R.string.c_copy_result) {
|
||||
copyResult(state);
|
||||
return true;
|
||||
case R.string.cpp_edit:
|
||||
EditHistoryFragment.show(state, false, getFragmentManager());
|
||||
} else if (itemId == R.string.cpp_edit) {
|
||||
EditHistoryFragment.show(state, false, getParentFragmentManager());
|
||||
return true;
|
||||
case R.string.c_save:
|
||||
EditHistoryFragment.show(state, true, getFragmentManager());
|
||||
} else if (itemId == R.string.c_save) {
|
||||
EditHistoryFragment.show(state, true, getParentFragmentManager());
|
||||
return true;
|
||||
case R.string.cpp_delete:
|
||||
} else if (itemId == R.string.cpp_delete) {
|
||||
history.removeSaved(state);
|
||||
return true;
|
||||
}
|
||||
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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,11 +93,11 @@ 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:
|
||||
int id = v.getId();
|
||||
if (id == R.id.cpp_kb_button_clear) {
|
||||
editor.setText("");
|
||||
return;
|
||||
case R.id.cpp_kb_button_close:
|
||||
} else if (id == R.id.cpp_kb_button_close) {
|
||||
getUser().done();
|
||||
return;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,8 +78,7 @@ public class OperatorsFragment extends BaseEntitiesFragment<Operator> {
|
||||
|
||||
@Override
|
||||
protected boolean onMenuItemClicked(@Nonnull MenuItem item, @Nonnull Operator operator) {
|
||||
switch (item.getItemId()) {
|
||||
case R.string.c_use:
|
||||
if (item.getItemId() == R.string.c_use) {
|
||||
onClick(operator);
|
||||
return true;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user