From 89d2893522db174881a283e3baf2640d7c67cb03 Mon Sep 17 00:00:00 2001 From: Sid Parikh <23442190+sid-parikh@users.noreply.github.com> Date: Mon, 24 Feb 2020 17:46:04 -0500 Subject: [PATCH 1/4] add multidex support (for all API) --- app/build.gradle | 5 +++++ app/src/main/AndroidManifest.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 4b4f39a..4d8da67 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -44,6 +44,8 @@ dependencies { def room_version = "2.2.4" def permissions_version = "4.6.0" + def multidex_version = "2.0.1" + implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "androidx.appcompat:appcompat:$appcompat_version" @@ -63,6 +65,9 @@ dependencies { // Java language implementation implementation "androidx.activity:activity:$activity_version" + // Multidex support for splitting app + implementation "androidx.multidex:multidex:$multidex_version" + // ViewModel implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version" // LiveData diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c77c9af..bf76cf4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ Date: Mon, 24 Feb 2020 21:01:35 -0500 Subject: [PATCH 2/4] Update build.gradle --- app/build.gradle | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 4d8da67..38321c1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,6 +9,7 @@ android { versionCode 5 versionName "1.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + multiDexEnabled true javaCompileOptions { annotationProcessorOptions { arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] @@ -26,6 +27,17 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + testOptions { + animationsDisabled true + + unitTests { + includeAndroidResources = true + } + } +} + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs << "-Xlint:all" } configurations { @@ -43,7 +55,6 @@ dependencies { def fragment_version = "1.2.2" def room_version = "2.2.4" def permissions_version = "4.6.0" - def multidex_version = "2.0.1" implementation fileTree(dir: 'libs', include: ['*.jar']) @@ -55,6 +66,7 @@ dependencies { implementation 'com.google.android.material:material:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation "androidx.navigation:navigation-fragment:$nav_version" implementation "androidx.navigation:navigation-ui:$nav_version" From aecbd0ef370aa46433d63714e8f21e3dadd5c5b0 Mon Sep 17 00:00:00 2001 From: Sid Parikh <23442190+sid-parikh@users.noreply.github.com> Date: Fri, 28 Feb 2020 11:08:42 -0500 Subject: [PATCH 3/4] inflate the fragment programmaticaly the issue no longer appears on pranav's phone --- .idea/gradle.xml | 13 +++++++++---- app/build.gradle | 1 + app/multidex-config.txt | 1 + .../java/org/stormroboticsnj/ui/MapFragment.java | 7 ++++--- .../stormroboticsnj/ui/display/DisplayFragment.java | 6 ++++++ app/src/main/res/layout/fragment_display.xml | 1 - 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 app/multidex-config.txt diff --git a/.idea/gradle.xml b/.idea/gradle.xml index d291b3d..674414f 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,15 +1,20 @@ + diff --git a/app/build.gradle b/app/build.gradle index 38321c1..4a61dc8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,6 +25,7 @@ android { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + multiDexKeepFile file('multidex-config.txt') } } testOptions { diff --git a/app/multidex-config.txt b/app/multidex-config.txt new file mode 100644 index 0000000..d014cb3 --- /dev/null +++ b/app/multidex-config.txt @@ -0,0 +1 @@ +org/stormroboticsnj/ui/display/whoosh/WhooshListFragment.class diff --git a/app/src/main/java/org/stormroboticsnj/ui/MapFragment.java b/app/src/main/java/org/stormroboticsnj/ui/MapFragment.java index 3c1dbdf..2355a70 100644 --- a/app/src/main/java/org/stormroboticsnj/ui/MapFragment.java +++ b/app/src/main/java/org/stormroboticsnj/ui/MapFragment.java @@ -7,6 +7,7 @@ import android.view.View; import android.view.ViewGroup; +import androidx.core.content.res.ResourcesCompat; import androidx.fragment.app.Fragment; import org.stormroboticsnj.R; @@ -73,10 +74,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (Objects.equals(view.getBackground().getConstantState(), getResources().getDrawable(R.drawable.field_map_blue).getConstantState())) { - view.setBackground(getResources().getDrawable(R.drawable.field_map_red)); + if (Objects.equals(view.getBackground().getConstantState(), ResourcesCompat.getDrawable(getResources(), R.drawable.field_map_blue, null).getConstantState())) { + view.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.field_map_red, null)); } else { - view.setBackground(getResources().getDrawable(R.drawable.field_map_blue)); + view.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.field_map_blue, null)); } } }); diff --git a/app/src/main/java/org/stormroboticsnj/ui/display/DisplayFragment.java b/app/src/main/java/org/stormroboticsnj/ui/display/DisplayFragment.java index 925ae0e..0ef0698 100644 --- a/app/src/main/java/org/stormroboticsnj/ui/display/DisplayFragment.java +++ b/app/src/main/java/org/stormroboticsnj/ui/display/DisplayFragment.java @@ -12,6 +12,8 @@ import android.widget.Toast; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.ViewModelProvider; import org.stormroboticsnj.MainActivity; @@ -83,6 +85,10 @@ public void onClick(View view) { onButtonPressed(colSpinner.getSelectedItemPosition() == 0, filterVal); } }); + + FragmentManager fm = getChildFragmentManager(); + FragmentTransaction fragmentTransaction = fm.beginTransaction(); + fragmentTransaction.replace(R.id.frag1, DisplayFragment.newInstance()); return v; } diff --git a/app/src/main/res/layout/fragment_display.xml b/app/src/main/res/layout/fragment_display.xml index ba8f3d2..1d60781 100644 --- a/app/src/main/res/layout/fragment_display.xml +++ b/app/src/main/res/layout/fragment_display.xml @@ -10,7 +10,6 @@ Date: Fri, 28 Feb 2020 11:17:54 -0500 Subject: [PATCH 4/4] up version --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4a61dc8..2580943 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "org.stormroboticsnj" minSdkVersion 19 targetSdkVersion 29 - versionCode 5 - versionName "1.4" + versionCode 6 + versionName "1.4.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled true javaCompileOptions {