From 05050860d4575dcccfa419ccbf841cea85d1a09b Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 30 Aug 2020 14:44:06 +0200 Subject: [PATCH 01/23] Bump minSdk to 21. As described in #317, out networking library will drop support at the end of 2020. Additionally, the number of users on API < 21 is rather small. This version will be version 3.0, so we can always continue support for older devices if necessary via the api-16 branch. Fixes #317. --- app/build.gradle | 2 +- app/src/test/resources/robolectric.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b2ccb9477..cf633921f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,7 +16,7 @@ android { //noinspection GroovyMissingReturnStatement defaultConfig { applicationId "be.ugent.zeus.hydra" - minSdkVersion 16 + minSdkVersion 21 targetSdkVersion 29 versionCode 21402 versionName "2.14.2" diff --git a/app/src/test/resources/robolectric.properties b/app/src/test/resources/robolectric.properties index 5bee0d088..cf83f3953 100644 --- a/app/src/test/resources/robolectric.properties +++ b/app/src/test/resources/robolectric.properties @@ -1,2 +1,2 @@ application = be.ugent.zeus.hydra.TestApp -sdk=16,29 +sdk=21,29 From 10fdf944c3c87c40ca7962c244a9ecaa87f0106b Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 30 Aug 2020 15:06:17 +0200 Subject: [PATCH 02/23] Fix SQLite tests --- app/build.gradle | 1 + .../common/database/migrations/MigrationTest.java | 14 ++++++++++++++ .../database/migrations/TestMigration_10_11.java | 2 +- .../database/migrations/TestMigration_11_12.java | 6 +----- .../database/migrations/TestMigration_12_13.java | 6 +----- .../database/migrations/TestMigration_13_14.java | 10 +--------- .../database/migrations/TestMigration_14_15.java | 12 ++---------- .../database/migrations/TestMigration_15_16.java | 9 +-------- .../database/migrations/TestMigration_9_10.java | 2 +- 9 files changed, 23 insertions(+), 39 deletions(-) create mode 100644 app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/MigrationTest.java diff --git a/app/build.gradle b/app/build.gradle index cf633921f..0ed75c1e7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -181,6 +181,7 @@ dependencies { testImplementation 'junit:junit:4.13' testImplementation 'org.mockito:mockito-core:3.5.7' testImplementation 'org.robolectric:robolectric:4.4' + testImplementation 'com.github.guness:RobolectricSQLite:1.0.2' testImplementation 'androidx.test:core:1.3.0' testImplementation 'androidx.test.ext:junit:1.1.2' testImplementation 'androidx.test:rules:1.3.0' diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/MigrationTest.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/MigrationTest.java new file mode 100644 index 000000000..8a98166c1 --- /dev/null +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/MigrationTest.java @@ -0,0 +1,14 @@ +package be.ugent.zeus.hydra.common.database.migrations; + +import com.guness.robolectric.sqlite.library.SQLiteLibraryLoader; +import org.junit.Before; + +/** + * @author Niko Strijbol + */ +public abstract class MigrationTest { + @Before + public void setUp() { + SQLiteLibraryLoader.load(); + } +} diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_10_11.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_10_11.java index 0749dc69c..a0d7e4335 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_10_11.java +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_10_11.java @@ -29,7 +29,7 @@ * @author Niko Strijbol */ @RunWith(RobolectricTestRunner.class) -public class TestMigration_10_11 { +public class TestMigration_10_11 extends MigrationTest { @Rule public final LocalMigrationTestHelper testHelper; diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_11_12.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_11_12.java index 28f86ced4..960e9f460 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_11_12.java +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_11_12.java @@ -1,8 +1,6 @@ package be.ugent.zeus.hydra.common.database.migrations; import android.app.Instrumentation; -import android.os.Build; - import androidx.room.testing.LocalMigrationTestHelper; import androidx.test.core.app.ApplicationProvider; @@ -13,7 +11,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -22,7 +19,7 @@ * @author Niko Strijbol */ @RunWith(RobolectricTestRunner.class) -public class TestMigration_11_12 { +public class TestMigration_11_12 extends MigrationTest { @Rule public final LocalMigrationTestHelper testHelper; @@ -35,7 +32,6 @@ public class TestMigration_11_12 { } @Test - @Config(sdk = Build.VERSION_CODES.KITKAT) // TODO: Sqlite version is too old in robolectric! public void testMigration() throws IOException { // There is no data to test, since we just add a new table. testHelper.createDatabase("test-db", 11).close(); diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_12_13.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_12_13.java index f31dcb2b6..9f58acdda 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_12_13.java +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_12_13.java @@ -1,8 +1,6 @@ package be.ugent.zeus.hydra.common.database.migrations; import android.app.Instrumentation; -import android.os.Build; - import androidx.room.testing.LocalMigrationTestHelper; import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.test.core.app.ApplicationProvider; @@ -14,7 +12,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -23,7 +20,7 @@ * @author Niko Strijbol */ @RunWith(RobolectricTestRunner.class) -public class TestMigration_12_13 { +public class TestMigration_12_13 extends MigrationTest { @Rule public final LocalMigrationTestHelper testHelper; @@ -36,7 +33,6 @@ public class TestMigration_12_13 { } @Test - @Config(sdk = Build.VERSION_CODES.KITKAT) // TODO: Sqlite version is too old in robolectric! public void testMigration() throws IOException { // There is no data to test, since we just add a new column. SupportSQLiteDatabase version12 = testHelper.createDatabase("test-db", 12); diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_13_14.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_13_14.java index 07138e21c..b8877ccbd 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_13_14.java +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_13_14.java @@ -1,22 +1,17 @@ package be.ugent.zeus.hydra.common.database.migrations; import android.app.Instrumentation; -import android.os.Build; - -import androidx.annotation.RequiresApi; import androidx.room.testing.LocalMigrationTestHelper; import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.test.core.app.ApplicationProvider; import java.io.IOException; -import be.ugent.zeus.hydra.TestApp; import be.ugent.zeus.hydra.common.database.Database; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -24,10 +19,8 @@ /** * @author Niko Strijbol */ -@RequiresApi(api = 26) @RunWith(RobolectricTestRunner.class) -@Config(application = TestApp.class) -public class TestMigration_13_14 { +public class TestMigration_13_14 extends MigrationTest { @Rule public final LocalMigrationTestHelper testHelper; @@ -40,7 +33,6 @@ public class TestMigration_13_14 { } @Test - @Config(sdk = Build.VERSION_CODES.KITKAT) // TODO: Sqlite version is too old in robolectric! public void testMigration() throws IOException { // There is no data to test, since we just add a new column. SupportSQLiteDatabase version12 = testHelper.createDatabase("test-db", 13); diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_14_15.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_14_15.java index b88557e3a..2d84f118f 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_14_15.java +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_14_15.java @@ -1,33 +1,26 @@ package be.ugent.zeus.hydra.common.database.migrations; import android.app.Instrumentation; -import android.os.Build; - -import androidx.annotation.RequiresApi; import androidx.room.testing.LocalMigrationTestHelper; import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.test.core.app.ApplicationProvider; import java.io.IOException; -import be.ugent.zeus.hydra.TestApp; import be.ugent.zeus.hydra.common.database.Database; - import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; + import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author Niko Strijbol */ -@RequiresApi(api = 26) @RunWith(RobolectricTestRunner.class) -@Config(application = TestApp.class) -public class TestMigration_14_15 { +public class TestMigration_14_15 extends MigrationTest { @Rule public final LocalMigrationTestHelper testHelper; @@ -40,7 +33,6 @@ public class TestMigration_14_15 { } @Test - @Config(sdk = Build.VERSION_CODES.KITKAT) // TODO: Sqlite version is too old in robolectric! public void testMigration() throws IOException { // There is no data to test, since we just add a new column. SupportSQLiteDatabase version14 = testHelper.createDatabase("test-db", 14); diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_15_16.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_15_16.java index 328bf752b..4fbae3e11 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_15_16.java +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_15_16.java @@ -1,21 +1,17 @@ package be.ugent.zeus.hydra.common.database.migrations; import android.app.Instrumentation; -import android.os.Build; -import androidx.annotation.RequiresApi; import androidx.room.testing.LocalMigrationTestHelper; import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.test.core.app.ApplicationProvider; import java.io.IOException; -import be.ugent.zeus.hydra.TestApp; import be.ugent.zeus.hydra.common.database.Database; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import org.robolectric.annotation.Config; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -23,10 +19,8 @@ /** * @author Niko Strijbol */ -@RequiresApi(api = 26) @RunWith(RobolectricTestRunner.class) -@Config(application = TestApp.class) -public class TestMigration_15_16 { +public class TestMigration_15_16 extends MigrationTest { @Rule public final LocalMigrationTestHelper testHelper; @@ -39,7 +33,6 @@ public class TestMigration_15_16 { } @Test - @Config(sdk = Build.VERSION_CODES.KITKAT) // TODO: Sqlite version is too old in robolectric! public void testMigration() throws IOException { // There is no data to test, since we just add a new column. SupportSQLiteDatabase version14 = testHelper.createDatabase("test-db", 15); diff --git a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_9_10.java b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_9_10.java index a103c287e..b4f7b1cf9 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_9_10.java +++ b/app/src/test/java/be/ugent/zeus/hydra/common/database/migrations/TestMigration_9_10.java @@ -33,7 +33,7 @@ * @author Niko Strijbol */ @RunWith(RobolectricTestRunner.class) -public class TestMigration_9_10 { +public class TestMigration_9_10 extends MigrationTest { private static final String TEST_DATABASE_NAME = "test-db"; From 8811ed21712288d560d193f81a48a504fc97c7bf Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 30 Aug 2020 15:09:57 +0200 Subject: [PATCH 03/23] Remove support for multidex Since we now target API 21, we don't need the library anymore. See https://developer.android.com/studio/build/multidex#mdex-on-l --- app/build.gradle | 2 -- .../be/ugent/zeus/hydra/HydraApplication.java | 16 ---------------- .../test/java/be/ugent/zeus/hydra/TestApp.java | 5 ----- 3 files changed, 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0ed75c1e7..5470f8cc7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -102,7 +102,6 @@ android { } debug { - multiDexEnabled true // Disable crashlytics in debug builds if necessary. ext.enableCrashlytics = Boolean.parseBoolean(props.getProperty("hydra.debug.reporting")) } @@ -137,7 +136,6 @@ android { } dependencies { - implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.core:core:1.3.1' implementation 'androidx.media:media:1.1.0' implementation 'androidx.fragment:fragment:1.2.5' diff --git a/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java b/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java index ba9f820aa..5b9dd6394 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java +++ b/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java @@ -2,7 +2,6 @@ import android.annotation.SuppressLint; import android.app.Application; -import android.content.Context; import android.os.StrictMode; import android.util.Log; import androidx.appcompat.app.AppCompatDelegate; @@ -24,21 +23,6 @@ public class HydraApplication extends Application { private static final String TAG = "HydraApplication"; - @Override - protected void attachBaseContext(Context base) { - super.attachBaseContext(base); - onAttachBaseContextInitialize(base); - } - - /** - * This method allows us to override this in Robolectric. - */ - protected void onAttachBaseContextInitialize(Context base) { - if (BuildConfig.DEBUG) { - androidx.multidex.MultiDex.install(this); - } - } - @Override public void onCreate() { super.onCreate(); diff --git a/app/src/test/java/be/ugent/zeus/hydra/TestApp.java b/app/src/test/java/be/ugent/zeus/hydra/TestApp.java index dc39eb477..3b6388a3f 100644 --- a/app/src/test/java/be/ugent/zeus/hydra/TestApp.java +++ b/app/src/test/java/be/ugent/zeus/hydra/TestApp.java @@ -21,11 +21,6 @@ public void onCreate() { setTheme(R.style.Hydra_DayNight); } - @Override - protected void onAttachBaseContextInitialize(Context base) { - // Do nothing. - } - @Override protected void onCreateInitialise() { Once.initialise(this); From 9793d46d013c7f46849a1b1b62fb67cef5598154 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 30 Aug 2020 15:13:31 +0200 Subject: [PATCH 04/23] Upgrade OkHttp libraries --- app/build.gradle | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5470f8cc7..161161520 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -151,9 +151,7 @@ dependencies { implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0" implementation 'androidx.room:room-runtime:2.2.5' annotationProcessor 'androidx.room:room-compiler:2.2.5' - // Do not upgrade beyond 3.12.x until we require API 21+ - //noinspection GradleDependency - implementation 'com.squareup.okhttp3:okhttp:3.12.12' + implementation 'com.squareup.okhttp3:okhttp:4.8.1' implementation 'com.squareup.moshi:moshi:1.10.0' implementation 'com.jakewharton.threetenabp:threetenabp:1.2.4' implementation 'net.sourceforge.streamsupport:android-retrostreams:1.7.2' @@ -192,8 +190,7 @@ dependencies { testImplementation('org.threeten:threetenbp:1.4.4') { exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp' } - //noinspection GradleDependency - testImplementation 'com.squareup.okhttp3:mockwebserver:3.12.12' + testImplementation 'com.squareup.okhttp3:mockwebserver:4.8.1' testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.4.2' testImplementation 'com.github.niknetniko:GetterSetterVerifier:0.0.11' testImplementation 'com.shazam:shazamcrest:0.11' From de015bb483eaa65f54ab3fed88d7fa1e1c0e36a2 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 30 Aug 2020 16:40:06 +0200 Subject: [PATCH 05/23] Migrate to built-in desugaring We no longer need the retrostreams and threeten backports. See https://developer.android.com/studio/write/java8-support-table. --- app/build.gradle | 21 +-- app/src/main/AndroidManifest.xml | 12 +- .../be/ugent/zeus/hydra/HydraApplication.java | 42 +++-- .../be/ugent/zeus/hydra/MainActivity.java | 88 +++++----- .../zeus/hydra/association/Association.java | 41 ++--- .../event/DisabledEventRemover.java | 13 +- .../zeus/hydra/association/event/Event.java | 57 +++--- .../event/EventDetailsActivity.java | 3 +- .../hydra/association/event/EventSorter.java | 8 +- .../association/event/RawEventRequest.java | 33 ++-- .../event/list/DateHeaderViewHolder.java | 15 +- .../association/event/list/EventAdapter.java | 4 +- .../association/event/list/EventItem.java | 5 +- .../event/list/EventListConverter.java | 8 +- .../event/list/EventSearchFilter.java | 3 +- .../event/list/EventSearchPredicate.java | 2 +- .../event/list/EventViewHolder.java | 5 +- .../event/list/EventViewModel.java | 4 +- .../preference/AssociationsRequest.java | 10 +- .../SearchableAssociationsAdapter.java | 13 +- .../zeus/hydra/common/ChannelCreator.java | 1 - .../hydra/common/ExtendedSparseArray.java | 2 +- .../hydra/common/arch/data/BaseLiveData.java | 19 +- .../zeus/hydra/common/arch/data/Event.java | 2 +- .../common/arch/data/RequestLiveData.java | 2 +- .../arch/observers/AdapterObserver.java | 2 +- .../common/arch/observers/ErrorObserver.java | 23 +-- .../common/arch/observers/EventObserver.java | 21 +-- .../arch/observers/PartialErrorObserver.java | 23 +-- .../arch/observers/ProgressObserver.java | 7 +- .../arch/observers/SuccessObserver.java | 26 +-- .../common/converter/DateThreeTenAdapter.java | 3 +- .../common/converter/DateTypeConverters.java | 11 +- .../hydra/common/converter/IntBoolean.java | 4 +- .../common/converter/LocalZonedDateTime.java | 6 +- .../zeus/hydra/common/database/Database.java | 4 +- .../database/migrations/Migration_10_11.java | 109 ++++++------ .../database/migrations/Migration_11_12.java | 6 +- .../database/migrations/Migration_12_13.java | 6 +- .../database/migrations/Migration_13_14.java | 6 +- .../database/migrations/Migration_6_7.java | 6 +- .../database/migrations/Migration_7_8.java | 6 +- .../database/migrations/Migration_8_9.java | 6 +- .../database/migrations/Migration_9_10.java | 6 +- .../common/network/InstanceProvider.java | 6 +- .../network/InterceptingWebViewClient.java | 6 +- .../common/network/JsonArrayRequest.java | 4 +- .../common/network/JsonOkHttpRequest.java | 16 +- .../hydra/common/reporting/BaseEvents.java | 1 - .../zeus/hydra/common/reporting/Event.java | 2 +- .../zeus/hydra/common/reporting/Tracker.java | 1 - .../zeus/hydra/common/request/Request.java | 6 +- .../zeus/hydra/common/request/Result.java | 7 +- .../zeus/hydra/common/ui/BaseActivity.java | 55 +++--- .../zeus/hydra/common/ui/HackedViewPager.java | 1 - .../common/ui/NoPaddingArrayAdapter.java | 5 +- .../hydra/common/ui/RefreshViewModel.java | 4 +- .../hydra/common/ui/RequestViewModel.java | 1 - .../common/ui/customtabs/ActivityHelper.java | 2 +- .../ui/customtabs/CustomTabsHelper.java | 10 +- .../ui/customtabs/HasTabActivityHelper.java | 65 +++---- .../ui/customtabs/NoTabActivityHelper.java | 5 +- .../hydra/common/ui/html/DrawableWrapper.java | 18 +- .../hydra/common/ui/html/HtmlTagHandler.java | 85 ++++----- .../zeus/hydra/common/ui/html/Utils.java | 4 +- .../SpanItemSpacingDecoration.java | 3 +- .../recyclerview/adapters/AdapterUpdate.java | 5 +- .../ui/recyclerview/adapters/DataAdapter.java | 5 +- .../recyclerview/adapters/DataContainer.java | 48 +++--- .../ui/recyclerview/adapters/DiffAdapter.java | 4 +- .../ui/recyclerview/adapters/DiffUpdate.java | 6 +- .../adapters/MultiSelectAdapter.java | 69 ++++---- .../MultiSelectSearchableAdapter.java | 22 ++- .../adapters/SearchableAdapter.java | 26 ++- .../viewholders/DataViewHolder.java | 3 +- .../viewholders/DateHeaderViewHolder.java | 18 +- .../DescriptionMultiSelectListViewHolder.java | 3 +- .../common/ui/widgets/ButtonBarLayout.java | 12 +- .../common/ui/widgets/DisplayableMenu.java | 88 +++++----- .../hydra/common/ui/widgets/MenuTable.java | 49 +++--- .../hydra/common/ui/widgets/NowToolbar.java | 4 +- .../common/ui/widgets/TimePreference.java | 55 +++--- .../TimePreferenceDialogFragmentCompat.java | 4 +- .../zeus/hydra/common/utils/DateUtils.java | 17 +- .../ugent/zeus/hydra/feed/FeedCollection.java | 2 +- .../ugent/zeus/hydra/feed/FeedException.java | 4 +- .../ugent/zeus/hydra/feed/FeedLiveData.java | 132 +++++++------- .../hydra/feed/HideableHomeFeedRequest.java | 10 +- .../zeus/hydra/feed/HomeFeedAdapter.java | 8 +- .../zeus/hydra/feed/HomeFeedFragment.java | 8 +- .../zeus/hydra/feed/HomeFeedRequest.java | 2 +- .../feed/SwipeDismissableViewHolder.java | 1 + .../be/ugent/zeus/hydra/feed/cards/Card.java | 40 ++--- .../zeus/hydra/feed/cards/PriorityUtils.java | 2 +- .../hydra/feed/cards/debug/WaitRequest.java | 12 +- .../feed/cards/dismissal/CardDismissal.java | 4 +- .../feed/cards/dismissal/CardIdentifier.java | 6 +- .../feed/cards/dismissal/DismissalDao.java | 8 +- .../feed/cards/dismissal/DismissalTable.java | 4 +- .../hydra/feed/cards/event/EventCard.java | 7 +- .../feed/cards/event/EventCardViewHolder.java | 2 +- .../hydra/feed/cards/event/EventRequest.java | 12 +- .../hydra/feed/cards/library/LibraryCard.java | 3 +- .../feed/cards/library/LibraryRequest.java | 10 +- .../feed/cards/library/LibraryViewHolder.java | 2 +- .../hydra/feed/cards/news/NewsItemCard.java | 9 +- .../feed/cards/news/NewsItemViewHolder.java | 4 +- .../hydra/feed/cards/news/NewsRequest.java | 16 +- .../feed/cards/resto/RestoCardViewHolder.java | 16 +- .../feed/cards/resto/RestoKindCommand.java | 1 + .../hydra/feed/cards/resto/RestoMenuCard.java | 6 +- .../hydra/feed/cards/resto/RestoRequest.java | 6 +- .../feed/cards/schamper/SchamperCard.java | 7 +- .../feed/cards/schamper/SchamperRequest.java | 11 +- .../cards/schamper/SchamperViewHolder.java | 8 +- .../LimitingSpecialEventRequest.java | 37 ++-- .../cards/specialevent/SpecialEventCard.java | 3 +- .../SpecialEventCardViewHolder.java | 6 +- .../feed/cards/urgent/UrgentRequest.java | 5 +- .../feed/cards/urgent/UrgentViewHolder.java | 5 +- .../hydra/feed/commands/CommandResult.java | 19 +- .../commands/DisableAssociationCommand.java | 4 +- .../feed/commands/DisableIndividualCard.java | 4 +- .../feed/commands/DisableTypeCommand.java | 4 +- .../hydra/feed/commands/DismissalEvent.java | 1 + .../zeus/hydra/feed/commands/FeedCommand.java | 2 +- .../feed/operations/OperationFactory.java | 4 +- .../feed/operations/RemoveOperation.java | 8 +- .../feed/operations/RequestOperation.java | 8 +- .../preferences/HomeFeedSelectFragment.java | 10 +- .../hydra/feed/preferences/HomeFragment.java | 70 ++++---- .../be/ugent/zeus/hydra/info/InfoItem.java | 52 +++--- .../zeus/hydra/info/InfoListAdapter.java | 4 +- .../be/ugent/zeus/hydra/info/InfoRequest.java | 17 +- .../zeus/hydra/info/InfoSubItemActivity.java | 4 +- .../be/ugent/zeus/hydra/info/InfoType.java | 12 +- .../ugent/zeus/hydra/info/InfoViewHolder.java | 2 +- .../ugent/zeus/hydra/info/InfoViewModel.java | 6 +- .../be/ugent/zeus/hydra/library/Library.java | 95 +++++----- .../library/details/FavouriteViewModel.java | 2 +- .../hydra/library/details/HoursViewModel.java | 5 +- .../details/LibraryDetailActivity.java | 7 +- .../hydra/library/details/OpeningHours.java | 5 +- .../library/details/OpeningHoursRequest.java | 9 +- .../library/favourites/FavouritesTable.java | 4 +- .../library/favourites/LibraryFavourite.java | 12 +- .../zeus/hydra/library/list/LibraryList.java | 47 +++-- .../library/list/LibraryListAdapter.java | 6 +- .../library/list/LibraryListRequest.java | 5 +- .../hydra/library/list/LibraryLiveData.java | 75 ++++---- .../hydra/library/list/LibraryViewHolder.java | 2 +- .../hydra/library/list/LibraryViewModel.java | 8 +- .../be/ugent/zeus/hydra/news/NewsAdapter.java | 4 +- .../zeus/hydra/news/UgentNewsArticle.java | 73 ++++---- .../zeus/hydra/news/UgentNewsRequest.java | 12 +- .../hydra/onboarding/HomeFeedFragment.java | 9 +- .../hydra/onboarding/OnboardingActivity.java | 2 - .../hydra/preferences/OverviewFragment.java | 2 +- .../hydra/preferences/PreferenceActivity.java | 6 +- .../hydra/preferences/PreferenceEntry.java | 28 ++- .../hydra/preferences/ReportingFragment.java | 1 - .../zeus/hydra/preferences/ThemeFragment.java | 49 +++--- .../ugent/zeus/hydra/resto/RestoChoice.java | 2 +- .../be/ugent/zeus/hydra/resto/RestoMeal.java | 62 +++---- .../be/ugent/zeus/hydra/resto/RestoMenu.java | 50 +++--- .../hydra/resto/RestoPreferenceFragment.java | 22 ++- .../zeus/hydra/resto/SingleDayFragment.java | 8 +- .../zeus/hydra/resto/extrafood/ExtraFood.java | 27 ++- .../resto/extrafood/ExtraFoodRequest.java | 5 +- .../resto/extrafood/ExtraFoodViewModel.java | 21 +-- .../zeus/hydra/resto/extrafood/Food.java | 36 ++-- .../hydra/resto/extrafood/FoodAdapter.java | 4 +- .../zeus/hydra/resto/history/DayRequest.java | 3 +- .../hydra/resto/history/HistoryActivity.java | 6 +- .../resto/history/SingleDayLiveData.java | 3 +- .../resto/history/SingleDayViewModel.java | 3 +- .../zeus/hydra/resto/menu/LegendFragment.java | 8 +- .../zeus/hydra/resto/menu/MenuFilter.java | 23 ++- .../hydra/resto/menu/MenuPagerAdapter.java | 6 +- .../zeus/hydra/resto/menu/MenuRequest.java | 2 +- .../zeus/hydra/resto/menu/MenuViewModel.java | 4 +- .../zeus/hydra/resto/menu/RestoFragment.java | 6 +- .../zeus/hydra/resto/meta/MetaRequest.java | 5 +- .../zeus/hydra/resto/meta/MetaViewModel.java | 2 +- .../be/ugent/zeus/hydra/resto/meta/Resto.java | 25 ++- .../zeus/hydra/resto/meta/RestoMeta.java | 34 ++-- .../selectable/SelectableMetaRequest.java | 13 +- .../selectable/SelectableMetaViewModel.java | 6 +- .../resto/meta/selectable/SelectedResto.java | 16 +- .../resto/sandwich/SandwichActivity.java | 2 +- .../ecological/EcologicalAdapter.java | 2 +- .../ecological/EcologicalRequest.java | 10 +- .../ecological/EcologicalSandwich.java | 56 +++--- .../ecological/EcologicalViewHolder.java | 3 +- .../ecological/EcologicalViewModel.java | 2 +- .../sandwich/regular/RegularAdapter.java | 4 +- .../sandwich/regular/RegularRequest.java | 10 +- .../sandwich/regular/RegularSandwich.java | 49 +++--- .../sandwich/regular/RegularViewModel.java | 6 +- .../be/ugent/zeus/hydra/schamper/Article.java | 67 ++++---- .../schamper/SchamperArticlesRequest.java | 4 +- .../hydra/schamper/SchamperListAdapter.java | 4 +- .../hydra/schamper/SchamperViewHolder.java | 21 ++- .../hydra/schamper/SchamperViewModel.java | 6 +- .../java/be/ugent/zeus/hydra/sko/Artist.java | 63 ++++--- .../ugent/zeus/hydra/sko/ArtistOrTitle.java | 2 +- .../zeus/hydra/sko/ArtistViewHolder.java | 2 +- .../ugent/zeus/hydra/sko/LineupAdapter.java | 4 +- .../ugent/zeus/hydra/sko/LineupFragment.java | 12 +- .../ugent/zeus/hydra/sko/LineupRequest.java | 4 +- .../ugent/zeus/hydra/sko/LineupViewModel.java | 5 +- .../zeus/hydra/sko/OverviewActivity.java | 1 - .../zeus/hydra/specialevent/SpecialEvent.java | 13 +- .../specialevent/SpecialEventRequest.java | 3 +- .../specialevent/SpecialEventWrapper.java | 2 +- .../ugent/zeus/hydra/urgent/MusicService.java | 19 +- .../hydra/urgent/ProgrammeInformation.java | 3 +- .../zeus/hydra/urgent/UrgentFragment.java | 61 ++++--- .../ugent/zeus/hydra/urgent/UrgentInfo.java | 5 +- .../hydra/urgent/player/InternalPlayer.java | 25 ++- .../hydra/urgent/player/MetadataListener.java | 2 +- .../zeus/hydra/urgent/player/Player.java | 39 ++--- .../urgent/player/PlayerSessionCallback.java | 7 +- .../urgent/player/SessionPlayerCallback.java | 4 +- .../urgent/player/UrgentTrackProvider.java | 9 +- app/src/main/res/drawable-en/logo_ugent.xml | 110 ++++++------ .../res/drawable/gradient_black_bottom.xml | 4 +- .../drawable/gradient_black_bottom_top.xml | 4 +- app/src/main/res/drawable/ic_album.xml | 10 +- .../main/res/drawable/ic_calendar_clock.xml | 6 +- app/src/main/res/drawable/ic_email.xml | 10 +- app/src/main/res/drawable/ic_event_add.xml | 2 +- app/src/main/res/drawable/ic_explore.xml | 6 +- app/src/main/res/drawable/ic_food_variant.xml | 2 +- app/src/main/res/drawable/ic_history.xml | 10 +- app/src/main/res/drawable/ic_home.xml | 10 +- app/src/main/res/drawable/ic_info_outline.xml | 10 +- .../main/res/drawable/ic_library_music.xml | 10 +- .../main/res/drawable/ic_multiline_chart.xml | 10 +- .../main/res/drawable/ic_navigate_before.xml | 10 +- .../main/res/drawable/ic_navigate_next.xml | 10 +- app/src/main/res/drawable/ic_news.xml | 2 +- .../main/res/drawable/ic_play_arrow_24dp.xml | 10 +- app/src/main/res/drawable/ic_restaurant.xml | 10 +- app/src/main/res/drawable/ic_search.xml | 10 +- app/src/main/res/drawable/ic_select_none.xml | 2 +- .../res/drawable/ic_social_facebook_inner.xml | 6 +- .../main/res/drawable/ic_social_instagram.xml | 2 +- .../main/res/drawable/ic_social_youtube.xml | 6 +- app/src/main/res/drawable/ic_stop.xml | 10 +- .../main/res/drawable/ic_theme_light_dark.xml | 2 +- .../res/drawable/info_academiccalendar.xml | 8 +- app/src/main/res/drawable/info_bicycle.xml | 8 +- app/src/main/res/drawable/info_doctors.xml | 2 +- app/src/main/res/drawable/info_guide.xml | 8 +- app/src/main/res/drawable/info_library.xml | 8 +- app/src/main/res/drawable/info_mapmarker.xml | 8 +- app/src/main/res/drawable/info_more.xml | 8 +- app/src/main/res/drawable/info_sports.xml | 2 +- app/src/main/res/drawable/info_ufora.xml | 16 +- .../res/drawable/logo_onboarding_ugent.xml | 48 +++--- app/src/main/res/drawable/logo_ugent.xml | 114 ++++++------ app/src/main/res/drawable/logo_zeus.xml | 13 +- .../res/drawable/noti_ic_play_arrow_24dp.xml | 10 +- app/src/main/res/drawable/noti_ic_stop.xml | 10 +- app/src/main/res/drawable/resto_fish.xml | 24 +-- app/src/main/res/drawable/resto_meat.xml | 16 +- .../main/res/drawable/resto_vegetables.xml | 72 ++++---- .../main/res/drawable/resto_vegetarian.xml | 82 ++++----- .../main/res/drawable/shortcut_background.xml | 4 +- app/src/main/res/drawable/shortcut_events.xml | 4 +- .../main/res/drawable/shortcut_libraries.xml | 4 +- app/src/main/res/drawable/shortcut_resto.xml | 4 +- app/src/main/res/drawable/shortcut_urgent.xml | 4 +- app/src/main/res/drawable/tabs_info.xml | 2 +- app/src/main/res/drawable/tabs_library.xml | 6 +- app/src/main/res/drawable/tabs_menu.xml | 8 +- app/src/main/res/drawable/tabs_news.xml | 2 +- app/src/main/res/drawable/tabs_resto.xml | 6 +- app/src/main/res/drawable/tabs_ufora.xml | 10 +- .../layout-land/fragment_onboarding_home.xml | 35 ++-- .../activity_event_detail.xml | 156 ++++++++--------- .../activity_library_details.xml | 162 +++++++++--------- .../layout-sw900dp/activity_event_detail.xml | 156 ++++++++--------- .../activity_library_details.xml | 162 +++++++++--------- .../main/res/layout/activity_event_detail.xml | 144 ++++++++-------- .../main/res/layout/activity_extra_food.xml | 12 +- .../res/layout/activity_info_sub_item.xml | 6 +- .../res/layout/activity_library_details.xml | 158 ++++++++--------- app/src/main/res/layout/activity_main.xml | 26 +-- .../main/res/layout/activity_preferences.xml | 6 +- .../layout/activity_preferences_homefeed.xml | 24 +-- .../res/layout/activity_resto_history.xml | 48 +++--- .../res/layout/activity_resto_sandwich.xml | 10 +- .../main/res/layout/activity_sko_artist.xml | 126 +++++++------- app/src/main/res/layout/activity_sko_main.xml | 14 +- app/src/main/res/layout/activity_webview.xml | 14 +- app/src/main/res/layout/drawer_header.xml | 20 +-- .../main/res/layout/fragment_activities.xml | 28 +-- app/src/main/res/layout/fragment_home.xml | 14 +- .../res/layout/fragment_home_feed_select.xml | 8 +- app/src/main/res/layout/fragment_infos.xml | 9 +- .../main/res/layout/fragment_library_list.xml | 12 +- app/src/main/res/layout/fragment_menu.xml | 12 +- app/src/main/res/layout/fragment_news.xml | 18 +- .../res/layout/fragment_onboarding_home.xml | 29 ++-- .../layout/fragment_onboarding_reporting.xml | 84 ++++----- .../fragment_preferences_associations.xml | 22 +-- app/src/main/res/layout/fragment_resto.xml | 2 +- .../main/res/layout/fragment_resto_extra.xml | 8 +- .../res/layout/fragment_resto_menu_legend.xml | 70 ++++---- app/src/main/res/layout/fragment_schamper.xml | 16 +- .../main/res/layout/fragment_sko_lineup.xml | 14 +- app/src/main/res/layout/fragment_urgent.xml | 104 +++++------ app/src/main/res/layout/home_card_event.xml | 42 ++--- app/src/main/res/layout/home_card_library.xml | 20 +-- .../main/res/layout/home_card_news_item.xml | 28 +-- app/src/main/res/layout/home_card_resto.xml | 14 +- .../main/res/layout/home_card_schamper.xml | 42 ++--- app/src/main/res/layout/home_card_special.xml | 36 ++-- app/src/main/res/layout/home_card_urgent.xml | 40 ++--- app/src/main/res/layout/info_card.xml | 22 +-- .../main/res/layout/item_checkbox_string.xml | 20 +-- .../item_checkbox_string_description.xml | 32 ++-- app/src/main/res/layout/item_date_header.xml | 10 +- .../res/layout/item_event_date_header.xml | 14 +- app/src/main/res/layout/item_event_item.xml | 36 ++-- app/src/main/res/layout/item_library.xml | 40 ++--- app/src/main/res/layout/item_news.xml | 30 ++-- app/src/main/res/layout/item_no_data.xml | 8 +- .../main/res/layout/item_resto_fooditem.xml | 14 +- app/src/main/res/layout/item_sandwich.xml | 36 ++-- app/src/main/res/layout/item_sandwich_eco.xml | 48 +++--- app/src/main/res/layout/item_schamper.xml | 40 ++--- .../res/layout/item_sko_lineup_artist.xml | 40 ++--- app/src/main/res/layout/item_title.xml | 6 +- app/src/main/res/layout/x_now_toolbar.xml | 33 ++-- app/src/main/res/layout/x_progress_bar.xml | 2 +- .../layout/x_simple_spinner_dropdown_item.xml | 9 +- .../main/res/layout/x_spinner_title_main.xml | 4 +- .../main/res/layout/x_spinner_title_resto.xml | 4 +- app/src/main/res/layout/x_toolbar.xml | 3 +- .../main/res/layout/x_toolbar_no_scroll.xml | 4 +- app/src/main/res/menu/bottom_resto.xml | 2 +- app/src/main/res/menu/drawer_items.xml | 2 +- app/src/main/res/menu/menu_event.xml | 18 +- app/src/main/res/menu/menu_library_list.xml | 19 +- app/src/main/res/menu/menu_main_events.xml | 13 +- app/src/main/res/menu/menu_news.xml | 6 +- app/src/main/res/menu/menu_pref_selectors.xml | 15 +- app/src/main/res/menu/menu_refresh.xml | 4 +- app/src/main/res/menu/menu_resto.xml | 36 ++-- app/src/main/res/menu/menu_resto_location.xml | 26 +-- app/src/main/res/menu/menu_sandwhich.xml | 6 +- app/src/main/res/menu/menu_schamper.xml | 12 +- app/src/main/res/menu/menu_sko.xml | 5 +- app/src/main/res/menu/menu_sko_artist.xml | 6 +- .../res/mipmap-anydpi-v26/ic_launcher.xml | 4 +- .../main/res/values-anydpi-v26/mipmaps.xml | 2 +- app/src/main/res/values/array.xml | 3 +- app/src/main/res/values/attrs.xml | 8 +- app/src/main/res/values/shapes.xml | 1 + app/src/main/res/values/styles.xml | 2 +- app/src/main/res/xml/pref_about.xml | 26 +-- app/src/main/res/xml/pref_headers.xml | 28 +-- app/src/main/res/xml/pref_home_feed.xml | 30 ++-- app/src/main/res/xml/pref_reporting.xml | 4 +- app/src/main/res/xml/pref_resto.xml | 20 +-- app/src/main/res/xml/pref_theme.xml | 28 +-- app/src/main/res/xml/shortcuts.xml | 60 ++++--- app/src/open/AndroidManifest.xml | 2 +- .../hydra/common/reporting/DummyHolder.java | 91 +++++----- .../hydra/common/reporting/Reporting.java | 7 +- .../res/layout/activity_resto_location.xml | 15 +- .../common/reporting/FirebaseEvents.java | 10 +- .../hydra/common/reporting/Reporting.java | 3 +- .../res/layout/activity_resto_location.xml | 10 +- .../testing/LocalMigrationTestHelper.java | 138 +++++++-------- .../be/ugent/zeus/hydra/MainActivityTest.java | 2 - .../java/be/ugent/zeus/hydra/TestApp.java | 2 - .../association/UgentNewsArticleTest.java | 2 +- .../event/EventDetailsActivityDeviceTest.java | 1 + .../event/EventDetailsActivityTest.java | 1 - .../association/event/EventSorterTest.java | 10 +- .../hydra/association/event/EventTest.java | 10 +- .../event/list/DateHeaderViewHolderTest.java | 1 - .../event/list/EventListConverterTest.java | 16 +- .../event/list/EventSearchFilterTest.java | 6 +- .../event/list/EventSearchPredicateTest.java | 8 +- .../event/list/EventViewHolderTest.java | 39 +++-- .../preference/AssociationViewHolderTest.java | 10 +- .../zeus/hydra/common/ArticleViewerTest.java | 2 +- .../ugent/zeus/hydra/common/MockParcel.java | 53 +++--- .../converter/DateTypeConvertersTest.java | 5 +- .../zeus/hydra/common/database/TestUtils.java | 14 +- .../migrations/TestMigration_10_11.java | 66 ++++--- .../migrations/TestMigration_9_10.java | 70 ++++---- .../migrations/Version9SqlHelper.java | 32 ++-- .../network/AbstractJsonRequestTest.java | 11 +- .../common/network/JsonOkHttpRequestTest.java | 28 ++- .../recyclerview/adapters/DiffUpdateTest.java | 14 +- .../recyclerview/adapters/DumbUpdateTest.java | 6 +- .../hydra/common/utils/ColourUtilsTest.java | 1 - .../hydra/common/utils/FriendlyDateTest.java | 17 +- .../common/utils/FullFriendlyDateTest.java | 20 +-- .../cards/dismissal/DismissalDaoTest.java | 16 +- .../cards/news/NewsItemViewHolderTest.java | 2 +- .../commands/DisableIndividualCardTest.java | 13 +- .../zeus/hydra/info/InfoViewHolderTest.java | 3 +- .../hydra/news/NewsItemViewHolderTest.java | 12 +- .../hydra/resto/history/DayRequestTest.java | 3 +- .../zeus/hydra/resto/menu/MenuFilterTest.java | 2 +- .../regular/RegularViewHolderTest.java | 8 +- .../schamper/SchamperArticlesRequestTest.java | 2 - .../schamper/SchamperViewHolderTest.java | 2 - .../be/ugent/zeus/hydra/sko/ArtistTest.java | 1 - .../zeus/hydra/sko/ArtistViewHolderTest.java | 4 - .../zeus/hydra/sko/LineupRequestTest.java | 2 - .../be/ugent/zeus/hydra/testing/Assert.java | 8 +- .../be/ugent/zeus/hydra/testing/DateTest.java | 1 - .../hydra/testing/NoNetworkInterceptor.java | 4 +- .../zeus/hydra/testing/RobolectricUtils.java | 9 +- .../be/ugent/zeus/hydra/testing/Utils.java | 17 +- .../zeus/hydra/testing/matcher/Fields.java | 3 +- .../testing/matcher/ShallowButFullEqual.java | 47 ++--- app/src/test/resources/robolectric.properties | 2 +- 426 files changed, 3913 insertions(+), 4048 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 161161520..fe746bcfc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,9 +10,6 @@ android { compileSdkVersion 29 buildToolsVersion "29.0.3" - // Use resources in robolectric - testOptions.unitTests.includeAndroidResources = true - //noinspection GroovyMissingReturnStatement defaultConfig { applicationId "be.ugent.zeus.hydra" @@ -40,10 +37,6 @@ android { } } - viewBinding { - enabled = true - } - lintOptions { warningsAsErrors true // We don't support Right to Left layouts. @@ -91,6 +84,7 @@ android { //noinspection GroovyMissingReturnStatement compileOptions { + coreLibraryDesugaringEnabled true sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } @@ -107,7 +101,6 @@ android { } } - //noinspection GroovyMissingReturnStatement testOptions { unitTests { includeAndroidResources = true @@ -117,6 +110,10 @@ android { systemProperty 'robolectric.logging.enabled', 'true' } } + + buildFeatures { + viewBinding = true + } //noinspection GroovyMissingReturnStatement packagingOptions { @@ -136,6 +133,8 @@ android { } dependencies { + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9' + implementation 'androidx.core:core:1.3.1' implementation 'androidx.media:media:1.1.0' implementation 'androidx.fragment:fragment:1.2.5' @@ -153,8 +152,6 @@ dependencies { annotationProcessor 'androidx.room:room-compiler:2.2.5' implementation 'com.squareup.okhttp3:okhttp:4.8.1' implementation 'com.squareup.moshi:moshi:1.10.0' - implementation 'com.jakewharton.threetenabp:threetenabp:1.2.4' - implementation 'net.sourceforge.streamsupport:android-retrostreams:1.7.2' implementation 'com.squareup.picasso:picasso:2.8' implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2' implementation 'com.github.niknetniko:material-intro:9903deb6c4' @@ -186,10 +183,6 @@ dependencies { testImplementation 'androidx.test.espresso:espresso-contrib:3.3.0' testImplementation 'androidx.arch.core:core-testing:2.1.0' testImplementation 'androidx.room:room-testing:2.2.5' - // Enable the normal library for unit tests. - testImplementation('org.threeten:threetenbp:1.4.4') { - exclude group: 'com.jakewharton.threetenabp', module: 'threetenabp' - } testImplementation 'com.squareup.okhttp3:mockwebserver:4.8.1' testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.4.2' testImplementation 'com.github.niknetniko:GetterSetterVerifier:0.0.11' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3fc82b9c2..058e1d2cb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ - + @@ -18,14 +18,14 @@ - GoogleAppIndexingWarning: not currently used --> @@ -131,9 +131,9 @@ diff --git a/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java b/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java index 5b9dd6394..0e5a6c5e8 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java +++ b/app/src/main/java/be/ugent/zeus/hydra/HydraApplication.java @@ -10,7 +10,6 @@ import be.ugent.zeus.hydra.common.reporting.Reporting; import be.ugent.zeus.hydra.common.reporting.Tracker; import be.ugent.zeus.hydra.preferences.ThemeFragment; -import com.jakewharton.threetenabp.AndroidThreeTen; import jonathanfinerty.once.Once; /** @@ -23,6 +22,26 @@ public class HydraApplication extends Application { private static final String TAG = "HydraApplication"; + /** + * Used to enable {@link StrictMode} for debug builds. + */ + private static void enableStrictModeInDebug() { + if (!BuildConfig.DEBUG || !BuildConfig.DEBUG_ENABLE_STRICT_MODE) { + return; + } + + Log.d(TAG, "Enabling strict mode..."); + + StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() + .detectAll() + .penaltyLog() + .build()); + StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() + .detectAll() + .penaltyLog() + .build()); + } + @Override public void onCreate() { super.onCreate(); @@ -44,7 +63,6 @@ protected void onCreateInitialise() { AppCompatDelegate.setDefaultNightMode(ThemeFragment.getNightMode(this)); trackTheme(); - AndroidThreeTen.init(this); Once.initialise(this); } @@ -66,24 +84,4 @@ private void trackTheme() { break; } } - - /** - * Used to enable {@link StrictMode} for debug builds. - */ - private static void enableStrictModeInDebug() { - if (!BuildConfig.DEBUG || !BuildConfig.DEBUG_ENABLE_STRICT_MODE) { - return; - } - - Log.d(TAG, "Enabling strict mode..."); - - StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() - .detectAll() - .penaltyLog() - .build()); - StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() - .detectAll() - .penaltyLog() - .build()); - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/MainActivity.java b/app/src/main/java/be/ugent/zeus/hydra/MainActivity.java index 6bdcff82c..19aa5f330 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/MainActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/MainActivity.java @@ -156,20 +156,14 @@ public class MainActivity extends BaseActivity implements N public static final String ARG_TAB = "argTab"; @SuppressWarnings("WeakerAccess") public static final String ARG_TAB_SHORTCUT = "argTabShortcut"; - - private static final String TAG = "BaseActivity"; - - private static final String UFORA = "com.d2l.brightspace.student.android"; - @VisibleForTesting static final String ONCE_ONBOARDING = "once_onboarding_v1"; - private static final int ONBOARDING_REQUEST = 5; - - private static final String STATE_IS_ONBOARDING_OPEN = "state_is_onboarding_open"; - @VisibleForTesting static final String ONCE_DRAWER = "once_drawer"; - + private static final String TAG = "BaseActivity"; + private static final String UFORA = "com.d2l.brightspace.student.android"; + private static final int ONBOARDING_REQUEST = 5; + private static final String STATE_IS_ONBOARDING_OPEN = "state_is_onboarding_open"; private static final String FRAGMENT_MENU_ID = "backStack"; private static final String SHORTCUT_RESTO = "resto"; @@ -188,6 +182,14 @@ public class MainActivity extends BaseActivity implements N @Nullable private DrawerUpdate scheduledContentUpdate; + /** + * Get the position of a fragment in the menu. While stupid, there is no other way to do this. + */ + @IdRes + private static int getFragmentMenuId(Fragment fragment) { + return requireArguments(fragment).getInt(FRAGMENT_MENU_ID); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -291,7 +293,7 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) { * Note: this function does not update the drawer if the fragment should be adjusted, only if another activity * should be opened. * - * @param menuItem The item to display. + * @param menuItem The item to display. * @param navigationSource Where the navigation originates from. */ private void selectDrawerItem(MenuItem menuItem, @NavigationSource int navigationSource) { @@ -408,8 +410,8 @@ private void updateDrawer(Fragment fragment, MenuItem item) { /** * Set the current displayed fragment. This method is executed immediately. * - * @param fragment The new fragment. - * @param menuItem The menu item corresponding to the fragment. + * @param fragment The new fragment. + * @param menuItem The menu item corresponding to the fragment. * @param navigationSource Where this navigation originates. This determines the behaviour with the back stack. */ private void setFragment(Fragment fragment, MenuItem menuItem, @NavigationSource int navigationSource) { @@ -474,7 +476,7 @@ public void onBackPressed() { * Set the menu ID as argument for a fragment. * * @param fragment The fragment. - * @param id The id. + * @param id The id. */ private void setArguments(Fragment fragment, @IdRes int id) { Bundle arguments = new Bundle(); @@ -485,14 +487,6 @@ private void setArguments(Fragment fragment, @IdRes int id) { fragment.setArguments(arguments); } - /** - * Get the position of a fragment in the menu. While stupid, there is no other way to do this. - */ - @IdRes - private static int getFragmentMenuId(Fragment fragment) { - return requireArguments(fragment).getInt(FRAGMENT_MENU_ID); - } - @Override protected boolean hasParent() { return false; @@ -528,14 +522,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } - private static final class TutorialEndEvent implements Event { - @Nullable - @Override - public String getEventName() { - return Reporting.getEvents().tutorialComplete(); - } - } - @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); @@ -573,22 +559,6 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) { int INITIALISATION = 2; } - /** - * Groups an update for the navigation drawer. - */ - private static class DrawerUpdate { - @NavigationSource - final int navigationSource; - final Fragment fragment; - final MenuItem menuItem; - - private DrawerUpdate(int navigationSource, Fragment fragment, MenuItem menuItem) { - this.navigationSource = navigationSource; - this.fragment = fragment; - this.menuItem = menuItem; - } - } - /** * Allow fragments to extract arguments from the activity. * @@ -605,7 +575,7 @@ public interface ArgumentsReceiver { * This function should be a pure function, meaning there should be no side effects in the fragment. Side-effects * resulting from this function may cause undefined behaviour. * - * @param activityIntent The intent of the activity. + * @param activityIntent The intent of the activity. * @param existingArguments The bundle to put the arguments in. */ void fillArguments(Intent activityIntent, Bundle existingArguments); @@ -627,4 +597,28 @@ public interface ScheduledRemovalListener { */ void onRemovalScheduled(); } + + private static final class TutorialEndEvent implements Event { + @Nullable + @Override + public String getEventName() { + return Reporting.getEvents().tutorialComplete(); + } + } + + /** + * Groups an update for the navigation drawer. + */ + private static class DrawerUpdate { + @NavigationSource + final int navigationSource; + final Fragment fragment; + final MenuItem menuItem; + + private DrawerUpdate(int navigationSource, Fragment fragment, MenuItem menuItem) { + this.navigationSource = navigationSource; + this.fragment = fragment; + this.menuItem = menuItem; + } + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/Association.java b/app/src/main/java/be/ugent/zeus/hydra/association/Association.java index 9d59035c5..54895dbd9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/Association.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/Association.java @@ -5,10 +5,10 @@ import androidx.annotation.NonNull; import java.util.Locale; +import java.util.Objects; import be.ugent.zeus.hydra.common.network.Endpoints; import com.squareup.moshi.Json; -import java9.util.Objects; /** * Represents an association registered with the DSA. @@ -19,11 +19,20 @@ * @author feliciaan * @author Niko Strijbol */ -@SuppressWarnings("unused") public final class Association implements Parcelable { - private static final String IMAGE_LINK = Endpoints.ZEUS_V2 + "association/logo/%s.png"; + public static final Creator CREATOR = new Creator() { + @Override + public Association createFromParcel(Parcel in) { + return new Association(in); + } + @Override + public Association[] newArray(int size) { + return new Association[size]; + } + }; + private static final String IMAGE_LINK = Endpoints.ZEUS_V2 + "association/logo/%s.png"; @Json(name = "internal_name") private String internalName; @Json(name = "full_name") @@ -37,6 +46,13 @@ public Association() { // Moshi uses this! } + protected Association(Parcel in) { + internalName = in.readString(); + fullName = in.readString(); + displayName = in.readString(); + parentAssociation = in.readString(); + } + /** * @return A name for this association. If a full name is available, that is returned. If not, the display name is. */ @@ -68,18 +84,6 @@ public String getImageLink() { return String.format(IMAGE_LINK, internalName.toLowerCase(Locale.ROOT)); } - public static final Creator CREATOR = new Creator() { - @Override - public Association createFromParcel(Parcel in) { - return new Association(in); - } - - @Override - public Association[] newArray(int size) { - return new Association[size]; - } - }; - @Override public int describeContents() { return 0; @@ -93,13 +97,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(parentAssociation); } - protected Association(Parcel in) { - internalName = in.readString(); - fullName = in.readString(); - displayName = in.readString(); - parentAssociation = in.readString(); - } - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/DisabledEventRemover.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/DisabledEventRemover.java index f316c0cbf..2dae263ee 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/DisabledEventRemover.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/DisabledEventRemover.java @@ -2,14 +2,13 @@ import android.content.Context; -import be.ugent.zeus.hydra.common.utils.PreferencesUtils; -import java9.util.function.Function; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; - import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; + +import be.ugent.zeus.hydra.common.utils.PreferencesUtils; import static be.ugent.zeus.hydra.association.preference.AssociationSelectionPreferenceFragment.PREF_ASSOCIATIONS_SHOWING; @@ -28,10 +27,10 @@ class DisabledEventRemover implements Function, List> { @Override public List apply(List events) { - Set disabled = StreamSupport.stream(PreferencesUtils.getStringSet(context, PREF_ASSOCIATIONS_SHOWING)) + Set disabled = PreferencesUtils.getStringSet(context, PREF_ASSOCIATIONS_SHOWING).stream() .map(String::toLowerCase) .collect(Collectors.toSet()); - return StreamSupport.stream(events) + return events.stream() .filter(event -> !disabled.contains(event.getAssociation().getInternalName().toLowerCase(Locale.ROOT))) .collect(Collectors.toList()); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/Event.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/Event.java index 50d5f13d8..1c9ed4a64 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/Event.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/Event.java @@ -2,17 +2,16 @@ import android.os.Parcel; import android.os.Parcelable; - import androidx.annotation.Nullable; -import java9.util.Objects; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.util.Objects; import be.ugent.zeus.hydra.association.Association; import be.ugent.zeus.hydra.common.converter.DateTypeConverters; import be.ugent.zeus.hydra.common.utils.DateUtils; import com.squareup.moshi.Json; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.OffsetDateTime; /** * Event from an {@link Association}. @@ -22,6 +21,17 @@ */ public final class Event implements Parcelable, Comparable { + public static final Creator CREATOR = new Creator() { + @Override + public Event createFromParcel(Parcel source) { + return new Event(source); + } + + @Override + public Event[] newArray(int size) { + return new Event[size]; + } + }; private String title; private OffsetDateTime start; @Nullable @@ -35,11 +45,23 @@ public final class Event implements Parcelable, Comparable { @Json(name = "facebook_id") private String facebookId; - @SuppressWarnings("unused") public Event() { // Moshi uses this! } + protected Event(Parcel in) { + this.title = in.readString(); + this.start = DateTypeConverters.toOffsetDateTime(in.readString()); + this.end = DateTypeConverters.toOffsetDateTime(in.readString()); + this.location = in.readString(); + this.latitude = in.readDouble(); + this.longitude = in.readDouble(); + this.description = in.readString(); + this.url = in.readString(); + this.facebookId = in.readString(); + this.association = in.readParcelable(Association.class.getClassLoader()); + } + /** * Get the start date, converted to the local time zone. The resulting DateTime is the time as it is used * in the current time zone. @@ -140,31 +162,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(this.association, flags); } - protected Event(Parcel in) { - this.title = in.readString(); - this.start = DateTypeConverters.toOffsetDateTime(in.readString()); - this.end = DateTypeConverters.toOffsetDateTime(in.readString()); - this.location = in.readString(); - this.latitude = in.readDouble(); - this.longitude = in.readDouble(); - this.description = in.readString(); - this.url = in.readString(); - this.facebookId = in.readString(); - this.association = in.readParcelable(Association.class.getClassLoader()); - } - - public static final Creator CREATOR = new Creator() { - @Override - public Event createFromParcel(Parcel source) { - return new Event(source); - } - - @Override - public Event[] newArray(int size) { - return new Event[size]; - } - }; - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/EventDetailsActivity.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/EventDetailsActivity.java index 6e4ae830a..b6b12b3f5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/EventDetailsActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/EventDetailsActivity.java @@ -14,6 +14,8 @@ import androidx.annotation.Nullable; import androidx.core.text.util.LinkifyCompat; +import java.time.format.DateTimeFormatter; + import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.reporting.BaseEvents; import be.ugent.zeus.hydra.common.reporting.Reporting; @@ -22,7 +24,6 @@ import be.ugent.zeus.hydra.databinding.ActivityEventDetailBinding; import com.squareup.picasso.Callback; import com.squareup.picasso.Picasso; -import org.threeten.bp.format.DateTimeFormatter; /** * Activity to show details of an association's event. diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/EventSorter.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/EventSorter.java index 344f97934..af88d6f2c 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/EventSorter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/EventSorter.java @@ -1,10 +1,8 @@ package be.ugent.zeus.hydra.association.event; -import java9.util.function.Function; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; - import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; /** * Sorts the events according to their natural ordening. @@ -14,7 +12,7 @@ class EventSorter implements Function, List> { @Override public List apply(List events) { - return StreamSupport.stream(events) + return events.stream() .sorted() .collect(Collectors.toList()); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/RawEventRequest.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/RawEventRequest.java index e397e0779..3e11cae75 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/RawEventRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/RawEventRequest.java @@ -3,13 +3,13 @@ import android.content.Context; import androidx.annotation.NonNull; +import java.time.Duration; +import java.util.List; +import java.util.function.Function; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; import be.ugent.zeus.hydra.common.request.Request; -import java9.util.function.Function; -import org.threeten.bp.Duration; - -import java.util.List; /** * Get the events for all associations. This will get all events returned by the API, without any filtering. @@ -27,17 +27,6 @@ public class RawEventRequest extends JsonArrayRequest { super(context, Event.class); } - @NonNull - @Override - protected String getAPIUrl() { - return Endpoints.DSA_V3 + FILENAME; - } - - @Override - public Duration getCacheDuration() { - return Duration.ofHours(1); - } - /** * Transform by applying: * - {@link Request#map(Function)} with {@link DisabledEventRemover} @@ -49,7 +38,17 @@ public Duration getCacheDuration() { */ public static Request> cachedFilteredSortedRequest(Context context) { return new RawEventRequest(context) - .map(new DisabledEventRemover(context)) - .map(new EventSorter()); + .map(new DisabledEventRemover(context)); + } + + @NonNull + @Override + protected String getAPIUrl() { + return Endpoints.DSA_V3 + FILENAME; + } + + @Override + public Duration getCacheDuration() { + return Duration.ofHours(1); } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/DateHeaderViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/DateHeaderViewHolder.java index b664e84db..cbbcf3f81 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/DateHeaderViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/DateHeaderViewHolder.java @@ -1,14 +1,15 @@ package be.ugent.zeus.hydra.association.event.list; import android.content.Context; -import androidx.annotation.VisibleForTesting; import android.view.View; import android.widget.TextView; +import androidx.annotation.VisibleForTesting; + +import java.time.LocalDate; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; -import org.threeten.bp.LocalDate; /** * For date headers. @@ -24,13 +25,13 @@ class DateHeaderViewHolder extends DataViewHolder { headerText = v.findViewById(R.id.date_header); } - @Override - public void populate(EventItem eventItem) { - headerText.setText(formatDate(headerText.getContext(), eventItem.getHeader())); - } - @VisibleForTesting static String formatDate(Context context, LocalDate localDate) { return be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DateHeaderViewHolder.format(context, localDate); } + + @Override + public void populate(EventItem eventItem) { + headerText.setText(formatDate(headerText.getContext(), eventItem.getHeader())); + } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventAdapter.java index 45442ef8c..bdd7de56e 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventAdapter.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.association.event.list; -import androidx.annotation.NonNull; import android.view.ViewGroup; +import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.SearchableAdapter; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * Adapter for the list of activities. diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventItem.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventItem.java index 4955691b3..3684fe084 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventItem.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventItem.java @@ -1,8 +1,9 @@ package be.ugent.zeus.hydra.association.event.list; +import java.time.LocalDate; +import java.util.Objects; + import be.ugent.zeus.hydra.association.event.Event; -import java9.util.Objects; -import org.threeten.bp.LocalDate; /** * Data structure for a list of events. The contains an item, a header or a footer, but only one of the elements. diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventListConverter.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventListConverter.java index 5af213dad..7ba39cc1f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventListConverter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventListConverter.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.association.event.list; -import be.ugent.zeus.hydra.association.event.Event; -import java9.util.function.Function; -import org.threeten.bp.LocalDate; - +import java.time.LocalDate; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.function.Function; + +import be.ugent.zeus.hydra.association.event.Event; /** * Convert events to EventItems. The list of events MUST be sorted by start date. diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchFilter.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchFilter.java index 3e46d6b35..4d70ca5ef 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchFilter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchFilter.java @@ -1,9 +1,8 @@ package be.ugent.zeus.hydra.association.event.list; -import java9.util.function.Function; - import java.util.ArrayList; import java.util.List; +import java.util.function.Function; /** * Remove headers that have no more events. diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchPredicate.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchPredicate.java index ed1c1010f..f28f244f5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchPredicate.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventSearchPredicate.java @@ -1,10 +1,10 @@ package be.ugent.zeus.hydra.association.event.list; import java.util.Locale; +import java.util.function.BiPredicate; import be.ugent.zeus.hydra.association.Association; import be.ugent.zeus.hydra.association.event.Event; -import java9.util.function.BiPredicate; /** * Searches a list of events for things that match. diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewHolder.java index aeedf002f..f4170fa95 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewHolder.java @@ -5,15 +5,16 @@ import android.view.ViewGroup; import android.widget.TextView; +import java.time.format.DateTimeFormatter; + import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.association.event.Event; import be.ugent.zeus.hydra.association.event.EventDetailsActivity; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; +import be.ugent.zeus.hydra.common.utils.ViewUtils; import com.google.android.material.card.MaterialCardView; import com.google.android.material.shape.RoundedCornerTreatment; import com.google.android.material.shape.ShapeAppearanceModel; -import org.threeten.bp.format.DateTimeFormatter; /** * View holder for an event in the event tab. diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewModel.java index c03a0cd1b..370dd2d8b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/event/list/EventViewModel.java @@ -2,12 +2,12 @@ import android.app.Application; +import java.util.List; + import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.common.ui.RefreshViewModel; -import java.util.List; - /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/preference/AssociationsRequest.java b/app/src/main/java/be/ugent/zeus/hydra/association/preference/AssociationsRequest.java index 6aba929c5..098c6e895 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/preference/AssociationsRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/preference/AssociationsRequest.java @@ -2,20 +2,18 @@ import android.content.Context; import android.os.Bundle; - import androidx.annotation.NonNull; +import java.time.Duration; +import java.time.temporal.ChronoUnit; import java.util.Collections; +import java.util.Comparator; import java.util.List; -import java9.util.Comparators; - import be.ugent.zeus.hydra.association.Association; import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; import be.ugent.zeus.hydra.common.request.Result; -import org.threeten.bp.Duration; -import org.threeten.bp.temporal.ChronoUnit; /** * Request to get all associations registered with the DSA. @@ -46,7 +44,7 @@ public Duration getCacheDuration() { @Override public Result> execute(@NonNull Bundle args) { return super.execute(args).map(associations -> { - Collections.sort(associations, Comparators.comparing(Association::getName)); + Collections.sort(associations, Comparator.comparing(Association::getName)); return associations; }); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/association/preference/SearchableAssociationsAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/association/preference/SearchableAssociationsAdapter.java index e7b7b3bc7..6cfa8e938 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/association/preference/SearchableAssociationsAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/association/preference/SearchableAssociationsAdapter.java @@ -1,19 +1,18 @@ package be.ugent.zeus.hydra.association.preference; -import androidx.annotation.NonNull; import android.util.Pair; import android.view.ViewGroup; +import androidx.annotation.NonNull; + +import java.util.Collections; +import java.util.Locale; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.association.Association; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.MultiSelectSearchableAdapter; - -import java.util.Collections; -import java.util.Locale; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** - * * @author Niko Strijbol */ class SearchableAssociationsAdapter extends MultiSelectSearchableAdapter { @@ -27,7 +26,7 @@ class SearchableAssociationsAdapter extends MultiSelectSearchableAdapter> getItemsAndState() { diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ChannelCreator.java b/app/src/main/java/be/ugent/zeus/hydra/common/ChannelCreator.java index 48765d7e5..b918469d5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ChannelCreator.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ChannelCreator.java @@ -5,7 +5,6 @@ import android.app.NotificationManager; import android.content.Context; import android.os.Build; - import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ExtendedSparseArray.java b/app/src/main/java/be/ugent/zeus/hydra/common/ExtendedSparseArray.java index eddb07544..3c93ec9cb 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ExtendedSparseArray.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ExtendedSparseArray.java @@ -1,7 +1,7 @@ package be.ugent.zeus.hydra.common; -import androidx.annotation.NonNull; import android.util.SparseArray; +import androidx.annotation.NonNull; import java.util.ArrayList; import java.util.Iterator; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/BaseLiveData.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/BaseLiveData.java index 6a5b0dfa0..5b16b6ca0 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/BaseLiveData.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/BaseLiveData.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.arch.data; -import androidx.lifecycle.LiveData; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.lifecycle.LiveData; /** * A basic live data, that supports requesting a refresh of the data. @@ -12,17 +12,16 @@ */ public abstract class BaseLiveData extends LiveData { - @Nullable - private Bundle queuedRefresh; - @Nullable - private OnRefreshStartListener onRefreshStartListener; - /** * Set this argument to {@code true} in the arguments for a request to bypass any potential cache. Note that this * is more of a suggestion than a requirement: the underling data provider may still return cached data if it deems * it appropriate, e.g. when there is no network. */ public static final String REFRESH_COLD = "be.ugent.zeus.hydra.data.refresh.cold"; + @Nullable + private Bundle queuedRefresh; + @Nullable + private OnRefreshStartListener onRefreshStartListener; /** * Same as {@link #flagForRefresh(Bundle)}, using {@link Bundle#EMPTY} as argument. @@ -79,6 +78,10 @@ protected void loadData() { this.loadData(Bundle.EMPTY); } + public void registerRefreshListener(OnRefreshStartListener listener) { + onRefreshStartListener = listener; + } + @FunctionalInterface public interface OnRefreshStartListener { @@ -87,8 +90,4 @@ public interface OnRefreshStartListener { */ void onRefreshStart(); } - - public void registerRefreshListener(OnRefreshStartListener listener) { - onRefreshStartListener = listener; - } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/Event.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/Event.java index fe230b49c..ce7aaf4ee 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/Event.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/Event.java @@ -1,6 +1,6 @@ package be.ugent.zeus.hydra.common.arch.data; -import java9.util.Optional; +import java.util.Optional; /** * An event represents an one-off user action. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/RequestLiveData.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/RequestLiveData.java index ed35988c5..829bb5064 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/RequestLiveData.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/data/RequestLiveData.java @@ -51,7 +51,7 @@ protected void onPostExecute(Result m) { setValue(m); } } - .execute(); + .execute(); } protected Context getContext() { diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/AdapterObserver.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/AdapterObserver.java index f3a7ce934..5c8a06d67 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/AdapterObserver.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/AdapterObserver.java @@ -1,7 +1,7 @@ package be.ugent.zeus.hydra.common.arch.observers; -import androidx.lifecycle.Observer; import androidx.annotation.NonNull; +import androidx.lifecycle.Observer; import java.util.List; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ErrorObserver.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ErrorObserver.java index 6f3d7302e..77a8757cf 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ErrorObserver.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ErrorObserver.java @@ -1,11 +1,12 @@ package be.ugent.zeus.hydra.common.arch.observers; -import androidx.lifecycle.Observer; import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; + +import java.util.function.Consumer; import be.ugent.zeus.hydra.common.request.RequestException; import be.ugent.zeus.hydra.common.request.Result; -import java9.util.function.Consumer; /** * Calls the listener if the result has no data and only an exception. @@ -17,15 +18,6 @@ */ public abstract class ErrorObserver implements Observer> { - @Override - public void onChanged(@Nullable Result e) { - if (e != null && !e.hasData()) { - onError(e.getError()); - } - } - - protected abstract void onError(RequestException throwable); - public static ErrorObserver with(Consumer consumer) { return new ErrorObserver() { @Override @@ -34,4 +26,13 @@ protected void onError(RequestException throwable) { } }; } + + @Override + public void onChanged(@Nullable Result e) { + if (e != null && !e.hasData()) { + onError(e.getError()); + } + } + + protected abstract void onError(RequestException throwable); } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/EventObserver.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/EventObserver.java index 273ae66ff..459c9ae32 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/EventObserver.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/EventObserver.java @@ -2,8 +2,9 @@ import androidx.lifecycle.Observer; +import java.util.function.Consumer; + import be.ugent.zeus.hydra.common.arch.data.Event; -import java9.util.function.Consumer; /** * Observer that will only handle non-handled events. @@ -12,15 +13,6 @@ */ public abstract class EventObserver implements Observer> { - @Override - public void onChanged(Event e) { - if (e != null) { - e.handleData().ifPresent(this::onUnhandled); - } - } - - protected abstract void onUnhandled(D data); - public static EventObserver with(Consumer consumer) { return new EventObserver() { @Override @@ -29,4 +21,13 @@ protected void onUnhandled(D data) { } }; } + + @Override + public void onChanged(Event e) { + if (e != null) { + e.handleData().ifPresent(this::onUnhandled); + } + } + + protected abstract void onUnhandled(D data); } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/PartialErrorObserver.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/PartialErrorObserver.java index a6dde5beb..2709b9c5a 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/PartialErrorObserver.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/PartialErrorObserver.java @@ -1,11 +1,12 @@ package be.ugent.zeus.hydra.common.arch.observers; -import androidx.lifecycle.Observer; import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; + +import java.util.function.Consumer; import be.ugent.zeus.hydra.common.request.RequestException; import be.ugent.zeus.hydra.common.request.Result; -import java9.util.function.Consumer; /** * Calls the listener when the result has an exception, even if it has data as well. @@ -14,15 +15,6 @@ */ public abstract class PartialErrorObserver implements Observer> { - @Override - public void onChanged(@Nullable Result e) { - if (e != null && e.hasException()) { - onPartialError(e.getError()); - } - } - - protected abstract void onPartialError(RequestException throwable); - public static PartialErrorObserver with(Consumer consumer) { return new PartialErrorObserver() { @Override @@ -31,4 +23,13 @@ protected void onPartialError(RequestException throwable) { } }; } + + @Override + public void onChanged(@Nullable Result e) { + if (e != null && e.hasException()) { + onPartialError(e.getError()); + } + } + + protected abstract void onPartialError(RequestException throwable); } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ProgressObserver.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ProgressObserver.java index 1034c1f71..2dee0e14f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ProgressObserver.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/ProgressObserver.java @@ -1,10 +1,11 @@ package be.ugent.zeus.hydra.common.arch.observers; -import androidx.annotation.NonNull; -import androidx.lifecycle.Observer; -import androidx.annotation.Nullable; import android.view.View; import android.widget.ProgressBar; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; + import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.databinding.XProgressBarBinding; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/SuccessObserver.java b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/SuccessObserver.java index 6b050fc53..35343fc8b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/SuccessObserver.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/arch/observers/SuccessObserver.java @@ -1,11 +1,12 @@ package be.ugent.zeus.hydra.common.arch.observers; -import androidx.lifecycle.Observer; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.lifecycle.Observer; + +import java.util.function.Consumer; import be.ugent.zeus.hydra.common.request.Result; -import java9.util.function.Consumer; /** * Observes successful loading of data. @@ -14,6 +15,15 @@ */ public abstract class SuccessObserver implements Observer> { + public static SuccessObserver with(Consumer onSuccess) { + return new SuccessObserver() { + @Override + protected void onSuccess(@NonNull D data) { + onSuccess.accept(data); + } + }; + } + @Override public void onChanged(@Nullable Result result) { @@ -28,7 +38,8 @@ public void onChanged(@Nullable Result result) { /** * Called when there is no result, so nothing should be shown. The default method will do nothing. */ - protected void onEmpty() {} + protected void onEmpty() { + } /** * Called when the result was successful and there is data. @@ -36,13 +47,4 @@ protected void onEmpty() {} * @param data The data. */ protected abstract void onSuccess(@NonNull D data); - - public static SuccessObserver with(Consumer onSuccess) { - return new SuccessObserver() { - @Override - protected void onSuccess(@NonNull D data) { - onSuccess.accept(data); - } - }; - } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateThreeTenAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateThreeTenAdapter.java index 8185dcbfc..3c3fb8535 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateThreeTenAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateThreeTenAdapter.java @@ -1,8 +1,9 @@ package be.ugent.zeus.hydra.common.converter; +import java.time.LocalDate; + import com.squareup.moshi.FromJson; import com.squareup.moshi.ToJson; -import org.threeten.bp.LocalDate; /** * Adapter for {@link LocalDate}s. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateTypeConverters.java b/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateTypeConverters.java index 2a1fbb6a3..7d44397ab 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateTypeConverters.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/converter/DateTypeConverters.java @@ -3,13 +3,14 @@ import androidx.annotation.Nullable; import androidx.room.TypeConverter; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + import com.squareup.moshi.FromJson; import com.squareup.moshi.ToJson; -import org.threeten.bp.Instant; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.ZonedDateTime; -import org.threeten.bp.format.DateTimeFormatter; /** * Converts for various date-related classes. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/converter/IntBoolean.java b/app/src/main/java/be/ugent/zeus/hydra/common/converter/IntBoolean.java index 28cbb0db9..a3c6227c9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/converter/IntBoolean.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/converter/IntBoolean.java @@ -1,10 +1,10 @@ package be.ugent.zeus.hydra.common.converter; -import com.squareup.moshi.JsonQualifier; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import com.squareup.moshi.JsonQualifier; + /** * Used to indicate that integers (0 or 1) should be parsed as a boolean. * diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/converter/LocalZonedDateTime.java b/app/src/main/java/be/ugent/zeus/hydra/common/converter/LocalZonedDateTime.java index 6ed11d7dd..eb3b55fcc 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/converter/LocalZonedDateTime.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/converter/LocalZonedDateTime.java @@ -1,10 +1,10 @@ package be.ugent.zeus.hydra.common.converter; -import com.squareup.moshi.JsonQualifier; -import org.threeten.bp.ZoneId; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.time.ZoneId; + +import com.squareup.moshi.JsonQualifier; /** * Annotation for dates that do not include timezone data. This annotation assumes they use the "Europe\Brussels" diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/Database.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/Database.java index 4bed7ba83..9c2178d15 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/Database.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/Database.java @@ -1,7 +1,6 @@ package be.ugent.zeus.hydra.common.database; import android.content.Context; - import androidx.annotation.VisibleForTesting; import androidx.room.Room; import androidx.room.RoomDatabase; @@ -30,13 +29,12 @@ @TypeConverters(DateTypeConverters.class) public abstract class Database extends RoomDatabase { - private static final Object LOCK = new Object(); - /** * The current version of the database. When changing this value, you must provide a appropriate migration, or the * app will crash. */ static final int VERSION = 16; + private static final Object LOCK = new Object(); /** * The current name of the database. Should not change. * diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_10_11.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_10_11.java index 6381e3b65..89cb366d2 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_10_11.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_10_11.java @@ -1,20 +1,20 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; import android.content.ContentValues; import android.database.Cursor; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabase; +import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import android.util.Log; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; -import org.threeten.bp.Instant; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.ZoneOffset; -import org.threeten.bp.ZonedDateTime; -import org.threeten.bp.format.DateTimeFormatter; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; /** * Migrate the types of the dates. @@ -29,11 +29,57 @@ public class Migration_10_11 extends Migration { private static final String TAG = "Migration_10_11"; + private static final ZoneOffset ZONE = ZoneOffset.UTC; + private static final DateTimeFormatter OFFSET_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME; public Migration_10_11() { super(10, 11); } + /** + * Unserialize a calculated epoch to a ZonedDateTime. + * + * @return A ZonedDateTime representing the epoch milli. + */ + private static ZonedDateTime legacyUnserialize(long epochMilli) { + if (epochMilli == -1) { + return null; + } + return Instant.ofEpochMilli(epochMilli).atZone(ZONE); + } + + /** + * Converts an instant to a string. + * + * @param instant The instant. + * + * @return The string value. + */ + @Nullable + private static String fromInstant(Instant instant) { + if (instant == null) { + return null; + } else { + return instant.toString(); + } + } + + /** + * Converts a offset date time to a string in the format specified by {@link #OFFSET_FORMATTER}. + * + * @param dateTime The date time or {@code null}. + * + * @return The string or {@code null} if the input was {@code null}. + */ + @Nullable + private static String fromOffsetDateTime(OffsetDateTime dateTime) { + if (dateTime == null) { + return null; + } else { + return dateTime.format(OFFSET_FORMATTER); + } + } + @Override public void migrate(@NonNull SupportSQLiteDatabase database) { @@ -130,51 +176,4 @@ public void migrate(@NonNull SupportSQLiteDatabase database) { Log.i(TAG, "Migration completed."); } - - private static final ZoneOffset ZONE = ZoneOffset.UTC; - private static final DateTimeFormatter OFFSET_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME; - - /** - * Unserialize a calculated epoch to a ZonedDateTime. - * - * @return A ZonedDateTime representing the epoch milli. - */ - private static ZonedDateTime legacyUnserialize(long epochMilli) { - if (epochMilli == -1) { - return null; - } - return Instant.ofEpochMilli(epochMilli).atZone(ZONE); - } - - /** - * Converts an instant to a string. - * - * @param instant The instant. - * - * @return The string value. - */ - @Nullable - private static String fromInstant(Instant instant) { - if (instant == null) { - return null; - } else { - return instant.toString(); - } - } - - /** - * Converts a offset date time to a string in the format specified by {@link #OFFSET_FORMATTER}. - * - * @param dateTime The date time or {@code null}. - * - * @return The string or {@code null} if the input was {@code null}. - */ - @Nullable - private static String fromOffsetDateTime(OffsetDateTime dateTime) { - if (dateTime == null) { - return null; - } else { - return dateTime.format(OFFSET_FORMATTER); - } - } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_11_12.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_11_12.java index c9475cc42..9fcfc9ad3 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_11_12.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_11_12.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; import be.ugent.zeus.hydra.feed.cards.dismissal.CardDismissal; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_12_13.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_12_13.java index f610b278a..810f1cf28 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_12_13.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_12_13.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_13_14.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_13_14.java index 369248047..ae3ae492c 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_13_14.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_13_14.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_6_7.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_6_7.java index 0ebd76dc3..f63a6ddd9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_6_7.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_6_7.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; /** * An older migration, kept for compatibility reasons. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_7_8.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_7_8.java index bf41daa4e..e9ede73cc 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_7_8.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_7_8.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; /** * An older migration, kept for compatibility reasons. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_8_9.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_8_9.java index 6067908d0..742383cb9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_8_9.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_8_9.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; /** * This is a legacy migration. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_9_10.java b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_9_10.java index 324b211cd..222b05e90 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_9_10.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/database/migrations/Migration_9_10.java @@ -1,9 +1,9 @@ package be.ugent.zeus.hydra.common.database.migrations; -import androidx.sqlite.db.SupportSQLiteDatabase; -import androidx.room.migration.Migration; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; /** * Actually adjust the scheme to support Room. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/network/InstanceProvider.java b/app/src/main/java/be/ugent/zeus/hydra/common/network/InstanceProvider.java index e3423072c..b84bb1398 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/network/InstanceProvider.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/network/InstanceProvider.java @@ -20,9 +20,9 @@ */ public final class InstanceProvider { - private static OkHttpClient client; - private static final long CACHE_SIZE = 20 * 1024 * 1024; // 20 MiB + private static OkHttpClient client; + private static Moshi moshi; private InstanceProvider() { } @@ -61,8 +61,6 @@ public static synchronized OkHttpClient getClient(Context context) { return getClient(cacheDir); } - private static Moshi moshi; - @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public static synchronized Moshi getMoshi() { if (moshi == null) { diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/network/InterceptingWebViewClient.java b/app/src/main/java/be/ugent/zeus/hydra/common/network/InterceptingWebViewClient.java index b4a069c8e..b92052845 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/network/InterceptingWebViewClient.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/network/InterceptingWebViewClient.java @@ -9,13 +9,13 @@ import android.webkit.WebView; import android.webkit.WebViewClient; +import java.io.IOException; +import java.net.URL; + import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; -import java.io.IOException; -import java.net.URL; - /** * WebView client that intercepts the requests and executes it with OkHTTP to enable TLSv1.2. * diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonArrayRequest.java b/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonArrayRequest.java index 8821cb73e..71e380f6f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonArrayRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonArrayRequest.java @@ -2,10 +2,10 @@ import android.content.Context; -import com.squareup.moshi.Types; - import java.util.List; +import com.squareup.moshi.Types; + /** * This is very small class whose only purpose is making the constructor more type safe. * diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonOkHttpRequest.java b/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonOkHttpRequest.java index 58a1f2f8d..6526bdf56 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonOkHttpRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/network/JsonOkHttpRequest.java @@ -3,26 +3,24 @@ import android.content.Context; import android.os.Bundle; import android.util.Log; - -import com.squareup.moshi.JsonAdapter; -import com.squareup.moshi.JsonDataException; -import com.squareup.moshi.Moshi; - -import org.threeten.bp.Duration; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import androidx.annotation.WorkerThread; import java.io.IOException; import java.lang.reflect.Type; import java.net.UnknownServiceException; +import java.time.Duration; import java.util.concurrent.TimeUnit; -import androidx.annotation.NonNull; -import androidx.annotation.VisibleForTesting; -import androidx.annotation.WorkerThread; import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; import be.ugent.zeus.hydra.common.reporting.Reporting; import be.ugent.zeus.hydra.common.reporting.Tracker; import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.request.Result; +import com.squareup.moshi.JsonAdapter; +import com.squareup.moshi.JsonDataException; +import com.squareup.moshi.Moshi; import okhttp3.CacheControl; import okhttp3.OkHttpClient; import okhttp3.Response; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/reporting/BaseEvents.java b/app/src/main/java/be/ugent/zeus/hydra/common/reporting/BaseEvents.java index 0a22fca8e..4835219f1 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/reporting/BaseEvents.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/reporting/BaseEvents.java @@ -89,7 +89,6 @@ public interface BaseEvents { *
  • {@link Params#cardType()}
  • *
  • {@link Params#cardIdentifier()}
  • * - * */ String cardDismissal(); diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Event.java b/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Event.java index fd741d03f..8affdfe5b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Event.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Event.java @@ -4,7 +4,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import java9.util.Optional; +import java.util.Optional; /** * An analytics event. This event is implementation-independent; at the same time the values are defined by the diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Tracker.java b/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Tracker.java index 3bb30ee62..5cb86e48d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Tracker.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/reporting/Tracker.java @@ -1,7 +1,6 @@ package be.ugent.zeus.hydra.common.reporting; import android.app.Activity; - import androidx.annotation.MainThread; import androidx.annotation.NonNull; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/request/Request.java b/app/src/main/java/be/ugent/zeus/hydra/common/request/Request.java index 73681e2bc..20ee49cfe 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/request/Request.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/request/Request.java @@ -1,10 +1,9 @@ package be.ugent.zeus.hydra.common.request; import android.os.Bundle; - import androidx.annotation.NonNull; -import java9.util.function.Function; +import java.util.function.Function; /** * The basis interface for a request. A request is something that returns data. @@ -46,8 +45,7 @@ default Result execute() { * For example, if this request is cached, the resulting request will be cached. * * @param function The function to apply to the result of the original request. - * - * @param The type of the resulting request's result. + * @param The type of the resulting request's result. * * @return The new request. */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/request/Result.java b/app/src/main/java/be/ugent/zeus/hydra/common/request/Result.java index bf5055bf4..089163b91 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/request/Result.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/request/Result.java @@ -3,10 +3,9 @@ import androidx.annotation.NonNull; import java.util.NoSuchElementException; - -import java9.util.Objects; -import java9.util.function.Consumer; -import java9.util.function.Function; +import java.util.Objects; +import java.util.function.Consumer; +import java.util.function.Function; /** * The result of a {@link Request}. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/BaseActivity.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/BaseActivity.java index addf490e0..e3a3ecb93 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/BaseActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/BaseActivity.java @@ -12,7 +12,7 @@ import androidx.core.graphics.drawable.DrawableCompat; import androidx.viewbinding.ViewBinding; -import java9.util.function.Function; +import java.util.function.Function; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.utils.ColourUtils; @@ -40,11 +40,38 @@ public abstract class BaseActivity extends AppCompatActiv protected B binding; + /** + * Replace an icon with given ID by the same icon but in the correct colour. + * + * @param toolbar The toolbar to extract the colour from. + * @param menu The menu. + * @param ids The ids of the icon. + */ + public static void tintToolbarIcons(ActionBar toolbar, Menu menu, int... ids) { + tintToolbarIcons(ColourUtils.resolveColour(toolbar.getThemedContext(), R.attr.colorControlNormal), menu, ids); + } + + /** + * Replace an icon with given ID by the same icon but in the given colour. + * + * @param colour The colour int. + * @param menu The menu. + * @param ids The ids of the icon. + */ + public static void tintToolbarIcons(@ColorInt int colour, Menu menu, int... ids) { + for (int id : ids) { + Drawable drawable = DrawableCompat.wrap(menu.findItem(id).getIcon()); + DrawableCompat.setTint(drawable, colour); + menu.findItem(id).setIcon(drawable); + } + } + /** * Returns the action bar of this activity. If the ActionBar is not present or the method is called at the wrong * time, an {@link IllegalStateException} is thrown. * * @return The ActionBar. + * * @throws IllegalStateException If the method is called at the wrong time or there is no ActionBar. */ @NonNull @@ -87,32 +114,6 @@ public void tintToolbarIcons(Menu menu, int... ids) { tintToolbarIcons(requireToolbar(), menu, ids); } - /** - * Replace an icon with given ID by the same icon but in the correct colour. - * - * @param toolbar The toolbar to extract the colour from. - * @param menu The menu. - * @param ids The ids of the icon. - */ - public static void tintToolbarIcons(ActionBar toolbar, Menu menu, int... ids) { - tintToolbarIcons(ColourUtils.resolveColour(toolbar.getThemedContext(), R.attr.colorControlNormal), menu, ids); - } - - /** - * Replace an icon with given ID by the same icon but in the given colour. - * - * @param colour The colour int. - * @param menu The menu. - * @param ids The ids of the icon. - */ - public static void tintToolbarIcons(@ColorInt int colour, Menu menu, int... ids) { - for (int id : ids) { - Drawable drawable = DrawableCompat.wrap(menu.findItem(id).getIcon()); - DrawableCompat.setTint(drawable, colour); - menu.findItem(id).setIcon(drawable); - } - } - /** * Set if the activity has a parent or not. */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/HackedViewPager.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/HackedViewPager.java index 49f34bb60..92acf3a48 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/HackedViewPager.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/HackedViewPager.java @@ -3,7 +3,6 @@ import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.viewpager.widget.ViewPager; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/NoPaddingArrayAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/NoPaddingArrayAdapter.java index e90ec6872..b4b2a88fc 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/NoPaddingArrayAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/NoPaddingArrayAdapter.java @@ -1,19 +1,18 @@ package be.ugent.zeus.hydra.common.ui; import android.content.Context; -import androidx.annotation.NonNull; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import androidx.annotation.NonNull; import java.util.List; /** * Removes padding from the items. * - * @see StackOverflow question - * * @author Niko Strijbol + * @see StackOverflow question */ public class NoPaddingArrayAdapter extends ArrayAdapter { diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/RefreshViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/RefreshViewModel.java index 51a6143ad..164d8d158 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/RefreshViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/RefreshViewModel.java @@ -1,13 +1,13 @@ package be.ugent.zeus.hydra.common.ui; import android.app.Application; +import android.os.Bundle; +import android.util.Log; import androidx.lifecycle.AndroidViewModel; import androidx.lifecycle.LiveData; import androidx.lifecycle.MediatorLiveData; import androidx.lifecycle.MutableLiveData; -import android.os.Bundle; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; -import android.util.Log; import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; import be.ugent.zeus.hydra.common.request.Result; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/RequestViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/RequestViewModel.java index c736a49cc..dee315221 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/RequestViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/RequestViewModel.java @@ -1,7 +1,6 @@ package be.ugent.zeus.hydra.common.ui; import android.app.Application; - import androidx.annotation.NonNull; import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/ActivityHelper.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/ActivityHelper.java index 445fb9adc..e11aef691 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/ActivityHelper.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/ActivityHelper.java @@ -45,7 +45,6 @@ public interface ActivityHelper { /** * Show the default share menu or not. This is disabled by default. - * */ void setShareMenu(); @@ -63,6 +62,7 @@ public interface ActivityHelper { */ interface ConnectionCallback { void onCustomTabsConnected(ActivityHelper helper); + void onCustomTabsDisconnected(ActivityHelper helper); } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/CustomTabsHelper.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/CustomTabsHelper.java index 9b6acb29d..01d501000 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/CustomTabsHelper.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/CustomTabsHelper.java @@ -9,7 +9,6 @@ import android.net.Uri; import android.text.TextUtils; import android.util.Log; - import androidx.annotation.Nullable; import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsService; @@ -48,6 +47,7 @@ public class CustomTabsHelper { * This is not threadsafe. * * @param context {@link Context} to use for accessing {@link PackageManager}. + * * @return The package name recommended to use for connecting to custom tabs related components. */ static String getPackageNameToUse(Context context) { @@ -137,13 +137,13 @@ private static boolean hasSupport(Context context) { * it will open urls in a new browser window. When {@code nativeApp} is true, custom tabs will not be used when * an app is available that can handle a certain url. A normal intent will be launched then. * - * @param activity The activity that calls the custom tab. - * @param callback The callback. + * @param activity The activity that calls the custom tab. + * @param callback The callback. * * @return The helper. */ public static ActivityHelper initHelper(Activity activity, @Nullable ActivityHelper.ConnectionCallback callback) { - if(hasSupport(activity)) { + if (hasSupport(activity)) { return new HasTabActivityHelper(activity, callback); } else { return new NoTabActivityHelper(activity, callback); @@ -154,7 +154,7 @@ public static ActivityHelper initHelper(Activity activity, @Nullable ActivityHel * Open an URI in a Custom Tab if supported. Otherwise, an attempt is made to open a browser. * * @param context Context to use. - * @param uri The URI to open. + * @param uri The URI to open. */ public static void openUri(Context context, Uri uri) { if (hasSupport(context)) { diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/HasTabActivityHelper.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/HasTabActivityHelper.java index abf2733d9..636153cfa 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/HasTabActivityHelper.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/HasTabActivityHelper.java @@ -8,19 +8,22 @@ import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Bundle; +import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.browser.customtabs.*; -import android.util.Log; - -import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ColourUtils; +import androidx.browser.customtabs.CustomTabsClient; +import androidx.browser.customtabs.CustomTabsIntent; +import androidx.browser.customtabs.CustomTabsServiceConnection; +import androidx.browser.customtabs.CustomTabsSession; import java.lang.ref.WeakReference; import java.util.HashSet; import java.util.List; import java.util.Set; +import be.ugent.zeus.hydra.R; +import be.ugent.zeus.hydra.common.utils.ColourUtils; + /** * Helper for activities that use custom tabs. * @@ -50,6 +53,31 @@ class HasTabActivityHelper implements ActivityHelper { this.connectionCallback = connectionCallback; } + private static Set getNativeAppPackage(Context context, Uri uri) { + PackageManager pm = context.getPackageManager(); + + //Get all Apps that resolve a generic url + Intent browserActivityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")); + Set genericResolvedList = extractPackageNames(pm.queryIntentActivities(browserActivityIntent, 0)); + + //Get all apps that resolve the specific Url + Intent specializedActivityIntent = new Intent(Intent.ACTION_VIEW, uri); + Set resolvedSpecializedList = extractPackageNames(pm.queryIntentActivities(specializedActivityIntent, 0)); + + //Keep only the Urls that resolve the specific, but not the generic urls + resolvedSpecializedList.removeAll(genericResolvedList); + + return resolvedSpecializedList; + } + + private static Set extractPackageNames(List resolveInfos) { + Set packageNameSet = new HashSet<>(); + for (ResolveInfo ri : resolveInfos) { + packageNameSet.add(ri.activityInfo.packageName); + } + return packageNameSet; + } + @Override public void setIntentFlags(int flags) { this.intentFlags = flags; @@ -85,7 +113,7 @@ public void openCustomTab(Uri uri) { customTabsIntent.intent.setFlags(this.intentFlags); customTabsIntent.intent.setPackage(packageName); customTabsIntent.launchUrl(activity.get(), uri); - } + } } /** @@ -183,29 +211,4 @@ public boolean mayLaunchUrl(Uri uri, Bundle extras, List otherLikelyBund CustomTabsSession session = getSession(); return session != null && session.mayLaunchUrl(uri, extras, otherLikelyBundles); } - - private static Set getNativeAppPackage(Context context, Uri uri) { - PackageManager pm = context.getPackageManager(); - - //Get all Apps that resolve a generic url - Intent browserActivityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")); - Set genericResolvedList = extractPackageNames(pm.queryIntentActivities(browserActivityIntent, 0)); - - //Get all apps that resolve the specific Url - Intent specializedActivityIntent = new Intent(Intent.ACTION_VIEW, uri); - Set resolvedSpecializedList = extractPackageNames(pm.queryIntentActivities(specializedActivityIntent, 0)); - - //Keep only the Urls that resolve the specific, but not the generic urls - resolvedSpecializedList.removeAll(genericResolvedList); - - return resolvedSpecializedList; - } - - private static Set extractPackageNames(List resolveInfos) { - Set packageNameSet = new HashSet<>(); - for (ResolveInfo ri : resolveInfos) { - packageNameSet.add(ri.activityInfo.packageName); - } - return packageNameSet; - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/NoTabActivityHelper.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/NoTabActivityHelper.java index a8503ba49..01bb4786c 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/NoTabActivityHelper.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/customtabs/NoTabActivityHelper.java @@ -19,8 +19,8 @@ class NoTabActivityHelper implements ActivityHelper { private final WeakReference activity; - private int intentFlags; private final ConnectionCallback connectionCallback; + private int intentFlags; NoTabActivityHelper(Activity activity, @Nullable ConnectionCallback connectionCallback) { this.activity = new WeakReference<>(activity); @@ -59,7 +59,8 @@ public void bindCustomTabsService(Activity activity) { } @Override - public void setShareMenu() {} + public void setShareMenu() { + } @Override public boolean mayLaunchUrl(Uri uri, Bundle extras, List otherLikelyBundles) { diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/DrawableWrapper.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/DrawableWrapper.java index ee8c07f02..a8a7d242e 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/DrawableWrapper.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/DrawableWrapper.java @@ -18,9 +18,9 @@ import android.content.res.ColorStateList; import android.graphics.*; import android.graphics.drawable.Drawable; +import android.view.View; import androidx.annotation.NonNull; import androidx.core.graphics.drawable.DrawableCompat; -import android.view.View; /** * Drawable which delegates all calls to its wrapped {@link Drawable}. @@ -49,13 +49,13 @@ protected void onBoundsChange(Rect bounds) { } @Override - public void setChangingConfigurations(int configs) { - mDrawable.setChangingConfigurations(configs); + public int getChangingConfigurations() { + return mDrawable.getChangingConfigurations(); } @Override - public int getChangingConfigurations() { - return mDrawable.getChangingConfigurations(); + public void setChangingConfigurations(int configs) { + mDrawable.setChangingConfigurations(configs); } @Override @@ -169,13 +169,13 @@ protected boolean onLevelChange(int level) { } @Override - public void setAutoMirrored(boolean mirrored) { - DrawableCompat.setAutoMirrored(mDrawable, mirrored); + public boolean isAutoMirrored() { + return DrawableCompat.isAutoMirrored(mDrawable); } @Override - public boolean isAutoMirrored() { - return DrawableCompat.isAutoMirrored(mDrawable); + public void setAutoMirrored(boolean mirrored) { + DrawableCompat.setAutoMirrored(mDrawable, mirrored); } @Override diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/HtmlTagHandler.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/HtmlTagHandler.java index 0309a1315..86ddb6014 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/HtmlTagHandler.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/HtmlTagHandler.java @@ -17,7 +17,6 @@ */ package be.ugent.zeus.hydra.common.ui.html; -import androidx.annotation.Nullable; import android.text.Editable; import android.text.Html; import android.text.Layout; @@ -27,11 +26,13 @@ import android.text.style.LeadingMarginSpan; import android.text.style.TypefaceSpan; import android.util.Log; -import org.xml.sax.XMLReader; +import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.List; +import org.xml.sax.XMLReader; + /** * Custom HTML tag handler to support more tags. * @@ -57,47 +58,8 @@ public class HtmlTagHandler implements Html.TagHandler { private static final String TAG = "TagHandler"; - - private int listItemCount; private final List listParents = new ArrayList<>(); - - private static class Code { - } - - private static class Center { - } - - @Override - public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) { - boolean isList = tag.equalsIgnoreCase("ul") || tag.equalsIgnoreCase("ol") || tag.equalsIgnoreCase("dd"); - if (opening) { - // opening tag - Log.v(TAG, "opening, output: " + output.toString()); - - if (isList) { - listParents.add(tag); - listItemCount = 0; - } else if (tag.equalsIgnoreCase("code")) { - start(output, new Code()); - } else if (tag.equalsIgnoreCase("center")) { - start(output, new Center()); - } - } else { - // closing tag - Log.v(TAG, "closing, output: " + output.toString()); - - if (isList) { - listParents.remove(tag); - listItemCount = 0; - } else if (tag.equalsIgnoreCase("li")) { - handleListTag(output); - } else if (tag.equalsIgnoreCase("code")) { - end(output, Code.class, new TypefaceSpan("monospace"), false); - } else if (tag.equalsIgnoreCase("center")) { - end(output, Center.class, new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER), true); - } - } - } + private int listItemCount; /** * Mark the opening tag by using private classes @@ -136,6 +98,7 @@ private static void end(Editable output, Class kind, Object repl, boolean * * @param text The text. * @param kind The kind of tag. + * * @return The last marked position. */ @Nullable @@ -151,6 +114,38 @@ private static T getLast(Editable text, Class kind) { return null; } + @Override + public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) { + boolean isList = tag.equalsIgnoreCase("ul") || tag.equalsIgnoreCase("ol") || tag.equalsIgnoreCase("dd"); + if (opening) { + // opening tag + Log.v(TAG, "opening, output: " + output.toString()); + + if (isList) { + listParents.add(tag); + listItemCount = 0; + } else if (tag.equalsIgnoreCase("code")) { + start(output, new Code()); + } else if (tag.equalsIgnoreCase("center")) { + start(output, new Center()); + } + } else { + // closing tag + Log.v(TAG, "closing, output: " + output.toString()); + + if (isList) { + listParents.remove(tag); + listItemCount = 0; + } else if (tag.equalsIgnoreCase("li")) { + handleListTag(output); + } else if (tag.equalsIgnoreCase("code")) { + end(output, Code.class, new TypefaceSpan("monospace"), false); + } else if (tag.equalsIgnoreCase("center")) { + end(output, Center.class, new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER), true); + } + } + } + private void handleListTag(Editable output) { if (listParents.get(listParents.size() - 1).equals("ul")) { output.append("\n"); @@ -171,4 +166,10 @@ private void handleListTag(Editable output) { output.setSpan(new LeadingMarginSpan.Standard(15 * listParents.size()), start, output.length(), 0); } } + + private static class Code { + } + + private static class Center { + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/Utils.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/Utils.java index e1926464c..b3843f1b8 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/Utils.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/html/Utils.java @@ -16,14 +16,14 @@ public class Utils { /** * Helper with older version support. If the html is null, an empty Spannable will be returned. * - * @param html The HTML to strip. + * @param html The HTML to strip. * @param getter The image getter. I suggest using {@link PicassoImageGetter} if you don't need anything special. * * @return Stripped HTML. */ public static Spanned fromHtml(String html, Html.ImageGetter getter) { - if(html == null) { + if (html == null) { return new SpannableString(""); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/SpanItemSpacingDecoration.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/SpanItemSpacingDecoration.java index 59faa2544..e1a0f7348 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/SpanItemSpacingDecoration.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/SpanItemSpacingDecoration.java @@ -2,11 +2,12 @@ import android.content.Context; import android.graphics.Rect; +import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.StaggeredGridLayoutManager; -import android.view.View; + import be.ugent.zeus.hydra.R; /** diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/AdapterUpdate.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/AdapterUpdate.java index 10429e807..5bee9a076 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/AdapterUpdate.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/AdapterUpdate.java @@ -1,11 +1,11 @@ package be.ugent.zeus.hydra.common.ui.recyclerview.adapters; -import java.util.List; - import androidx.annotation.AnyThread; import androidx.annotation.MainThread; import androidx.annotation.Nullable; +import java.util.List; + /** * Represents a data update for an {@link DiffAdapter}. */ @@ -16,6 +16,7 @@ interface AdapterUpdate { * {@link #applyUpdatesTo(ListUpdateCallback)} is called. * * @param existingData The existing data. Will no longer be used after this call. Null if there is no existing data. + * * @return The new data. May be the same as the existing data. Null if no data is available. */ @Nullable diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataAdapter.java index d5c43e4db..f8b6ef294 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataAdapter.java @@ -2,11 +2,12 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; -import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; -import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.RecycleViewHolder; import java.util.List; +import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; +import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.RecycleViewHolder; + /** * Defines the basic adapter methods to work with {@link DataViewHolder}. * diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataContainer.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataContainer.java index c2aa1abf0..94b7e2141 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataContainer.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DataContainer.java @@ -20,18 +20,19 @@ */ public class DataContainer { + private static Executor backgroundExecutorSingleton; // Threading-related stuff. private final Executor backgroundExecutor = getDefaultBackgroundExecutor(); private final Handler handler = new Handler(Looper.getMainLooper()); private final Executor mainThreadExecutor = handler::post; - + private final ListUpdateCallback callback; // Data stuff. @Nullable private List internalData; @NonNull private List readOnly = Collections.emptyList(); - - private final ListUpdateCallback callback; + // Max generation of currently scheduled runnable + private int maxScheduledGeneration; /** * @param callback The callback to which updates will be dispatched. @@ -40,8 +41,23 @@ public class DataContainer { this.callback = callback; } - // Max generation of currently scheduled runnable - private int maxScheduledGeneration; + /** + * Construct a default background executor. + *

    + * The default executor has a fixed thread pool with 2 threads. This is both the suggested and maximal amount of + * threads. The thread pool has a bounded queue of size 1. The rejected policy is discarding the oldest first. + * + * @return The executor. + */ + private static Executor getDefaultBackgroundExecutor() { + if (backgroundExecutorSingleton == null) { + backgroundExecutorSingleton = new ThreadPoolExecutor(2, 2, + 0, TimeUnit.MILLISECONDS, + new ArrayBlockingQueue<>(1), + new ThreadPoolExecutor.DiscardOldestPolicy()); + } + return backgroundExecutorSingleton; + } /** * Submit an update to the data. @@ -85,30 +101,10 @@ private void applyResult(@Nullable List newData, AdapterUpdate update) { /** * @return Get a read-only copy of the current data. When the data in the container is updated, - * this may or may not be updated. + * this may or may not be updated. */ @NonNull public List getData() { return readOnly; } - - private static Executor backgroundExecutorSingleton; - - /** - * Construct a default background executor. - *

    - * The default executor has a fixed thread pool with 2 threads. This is both the suggested and maximal amount of - * threads. The thread pool has a bounded queue of size 1. The rejected policy is discarding the oldest first. - * - * @return The executor. - */ - private static Executor getDefaultBackgroundExecutor() { - if (backgroundExecutorSingleton == null) { - backgroundExecutorSingleton = new ThreadPoolExecutor(2, 2, - 0, TimeUnit.MILLISECONDS, - new ArrayBlockingQueue<>(1), - new ThreadPoolExecutor.DiscardOldestPolicy()); - } - return backgroundExecutorSingleton; - } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffAdapter.java index 1407222ad..d19c58191 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffAdapter.java @@ -1,10 +1,11 @@ package be.ugent.zeus.hydra.common.ui.recyclerview.adapters; import androidx.recyclerview.widget.DiffUtil; -import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; import java.util.List; +import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; + /** * Generic adapter with support for calculating diffs on a background thread for data updates. * @@ -23,6 +24,7 @@ * @param The type of the items this adapter will contain. If multiple view types are needed, it is recommended * to create a custom superclass of all the types. * @param The type of the view holder. + * * @author Niko Strijbol */ public abstract class DiffAdapter> extends DataAdapter { diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffUpdate.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffUpdate.java index cacb5f0ca..efd9d6a4d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffUpdate.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/DiffUpdate.java @@ -5,10 +5,9 @@ import androidx.annotation.WorkerThread; import androidx.recyclerview.widget.DiffUtil; -import java9.util.Objects; - import java.util.EnumSet; import java.util.List; +import java.util.Objects; import java.util.Set; /** @@ -23,10 +22,9 @@ class DiffUpdate implements AdapterUpdate { private final DiffUtil.ItemCallback callback; private final List newData; - + private final Set status = EnumSet.noneOf(Empty.class); private DiffUtil.DiffResult result; private int existingDataSize = -1; - private final Set status = EnumSet.noneOf(Empty.class); DiffUpdate(@Nullable List newData) { this(new EqualsItemCallback<>(), newData); diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectAdapter.java index cb0de7c84..617a3d96a 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectAdapter.java @@ -1,34 +1,33 @@ package be.ugent.zeus.hydra.common.ui.recyclerview.adapters; -import androidx.annotation.NonNull; import android.util.Log; import android.util.Pair; import android.util.SparseBooleanArray; - -import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; -import java9.lang.Iterables; +import androidx.annotation.NonNull; import java.util.*; +import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; + /** * Adapter with items that are checkable. An item is considered checked if the state is {@code true}. * * @author Niko Strijbol */ -@SuppressWarnings({"WeakerAccess", "unused"}) +@SuppressWarnings("WeakerAccess") public abstract class MultiSelectAdapter extends DiffAdapter> { + private static final String TAG = "MultiSelectAdapter"; /** * This keeps track of which elements are selected and which are not. */ protected final SparseBooleanArray booleanArray = new SparseBooleanArray(); + private final Collection> callbacks = new HashSet<>(); /** * The default value for the selection. */ private boolean defaultValue = false; - private final Collection> callbacks = new HashSet<>(); - /** * @return The default state. */ @@ -40,7 +39,9 @@ public boolean getDefaultValue() { public void clear() { booleanArray.clear(); super.clear(); - Iterables.forEach(callbacks, c -> c.onStateChanged(MultiSelectAdapter.this)); + for (Callback c : callbacks) { + c.onStateChanged(MultiSelectAdapter.this); + } } /** @@ -52,15 +53,17 @@ public void clear() { public void submitData(List values, boolean initial) { this.defaultValue = initial; this.submitData(values); - Iterables.forEach(callbacks, c -> c.onStateChanged(MultiSelectAdapter.this)); + for (Callback c : callbacks) { + c.onStateChanged(MultiSelectAdapter.this); + } } /** * Set the values to use. * - * @param values The values. + * @param values The values. * @param nonInitials The indices of the items of {@code values} that should not receive the default value. - * @param initial The initial value. + * @param initial The initial value. */ public void submitData(List values, Set nonInitials, boolean initial) { this.defaultValue = initial; @@ -70,7 +73,9 @@ public void submitData(List values, Set nonInitials, boolean initial notifyItemChanged(index); } - Iterables.forEach(callbacks, c -> c.onStateChanged(MultiSelectAdapter.this)); + for (Callback c : callbacks) { + c.onStateChanged(MultiSelectAdapter.this); + } } /** @@ -84,8 +89,6 @@ public void submitData(List items) { super.submitData(items); } - private static final String TAG = "MultiSelectAdapter"; - /** * Change the boolean value at the given position to the reverse value. This operation DOES NOT trigger a change in * the recycler view data, so the methods for changed items is not called. The rationale behind this is that this @@ -94,7 +97,7 @@ public void submitData(List items) { * @param position The position. */ public void setChecked(int position) { - Log.d(TAG, "setChecked: " + position + ", current is: " + isChecked(position)); + Log.d(TAG, "setChecked: " + position + ", current is: " + isChecked(position)); if (!isChecked(position) == getDefaultValue()) { booleanArray.delete(position); Log.d(TAG, "setChecked: setting to " + getDefaultValue()); @@ -102,7 +105,9 @@ public void setChecked(int position) { Log.d(TAG, "setChecked: setting to " + !getDefaultValue()); booleanArray.put(position, !getDefaultValue()); } - Iterables.forEach(callbacks, c -> c.onStateChanged(MultiSelectAdapter.this)); + for (Callback c : callbacks) { + c.onStateChanged(MultiSelectAdapter.this); + } } /** @@ -117,7 +122,9 @@ value and remove all saved states. This used to be a O(n) operation, now it is a */ this.defaultValue = checked; this.booleanArray.clear(); - Iterables.forEach(callbacks, c -> c.onStateChanged(MultiSelectAdapter.this)); + for (Callback c : callbacks) { + c.onStateChanged(MultiSelectAdapter.this); + } notifyDataSetChanged(); } @@ -170,7 +177,9 @@ public void setItemsAndState(List> values) { booleanArray.append(i, value.second); } } - Iterables.forEach(callbacks, c -> c.onStateChanged(MultiSelectAdapter.this)); + for (Callback c : callbacks) { + c.onStateChanged(MultiSelectAdapter.this); + } } /** @@ -208,18 +217,6 @@ public Collection getSelectedItems() { return Collections.unmodifiableCollection(list); } - @FunctionalInterface - public interface Callback { - - /** - * Is called when the state changes. There is no guarantee when this will be called: when multiple items - * are changed, it might be called for each item, or only once. - * - * @param adapter Can be used by the client to query things. - */ - void onStateChanged(MultiSelectAdapter adapter); - } - /** * Adds a new callback. If the callback already exists, the behaviour is safe, but undefined. This means the * callback could be registered again and called twice, or the calls with an existing callback could be ignored. @@ -244,4 +241,16 @@ public void addCallback(@NonNull Callback callback) { public void removeCallback(@NonNull Callback callback) { this.callbacks.remove(callback); } + + @FunctionalInterface + public interface Callback { + + /** + * Is called when the state changes. There is no guarantee when this will be called: when multiple items + * are changed, it might be called for each item, or only once. + * + * @param adapter Can be used by the client to query things. + */ + void onStateChanged(MultiSelectAdapter adapter); + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectSearchableAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectSearchableAdapter.java index 2ddb97c6a..abccfb245 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectSearchableAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/MultiSelectSearchableAdapter.java @@ -1,18 +1,17 @@ package be.ugent.zeus.hydra.common.ui.recyclerview.adapters; +import android.util.Pair; import androidx.annotation.Nullable; import androidx.appcompat.widget.SearchView; -import android.util.Pair; - -import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; -import java9.util.function.Function; -import java9.util.function.Predicate; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; /** * Basic searchable adapter with basic multi-select support. Extending a {@link SearchableAdapter} to be multi-select @@ -24,9 +23,8 @@ public abstract class MultiSelectSearchableAdapter>> extends DataAdapter, VH> implements SearchView.OnQueryTextListener, android.widget.SearchView.OnQueryTextListener { - protected List> allData = Collections.emptyList(); - private final Function> searchPredicate; + protected List> allData = Collections.emptyList(); protected MultiSelectSearchableAdapter(Function> searchPredicate) { this.searchPredicate = searchPredicate; @@ -104,11 +102,11 @@ public List> getNewData(@Nullable List> existi return null; } - allData = StreamSupport.stream(allData) + allData = allData.stream() .map(p -> new Pair<>(p.first, checked)) .collect(Collectors.toList()); - return StreamSupport.stream(existingData) + return existingData.stream() .map(p -> new Pair<>(p.first, checked)) .collect(Collectors.toList()); } @@ -128,7 +126,7 @@ public boolean shouldUseMultiThreading() { @Override public boolean onQueryTextChange(String newText) { Predicate predicate = searchPredicate.apply(newText); - List> newData = StreamSupport.stream(allData) + List> newData = allData.stream() .filter(dBooleanPair -> predicate.test(dBooleanPair.first)) .collect(Collectors.toList()); dataContainer.submitUpdate(new DumbUpdate<>(newData)); diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/SearchableAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/SearchableAdapter.java index 7fdaaa738..02e07b5d8 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/SearchableAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/adapters/SearchableAdapter.java @@ -3,12 +3,9 @@ import androidx.appcompat.widget.SearchView; import java.util.*; - -import java9.lang.Iterables; -import java9.util.function.BiPredicate; -import java9.util.function.Function; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.function.BiPredicate; +import java.util.function.Function; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; @@ -37,13 +34,11 @@ public abstract class SearchableAdapter> extends DiffAdapter implements SearchView.OnQueryTextListener, SearchView.OnCloseListener, android.widget.SearchView.OnQueryTextListener, android.widget.SearchView.OnCloseListener { - private List allData = Collections.emptyList(); private final BiPredicate searchPredicate; private final Function, List> filter; - - private boolean isSearching; - private final Set listeners = Collections.newSetFromMap(new WeakHashMap<>()); + private List allData = Collections.emptyList(); + private boolean isSearching; /** * @param searchPredicate The predicate used when searching. The predicate receives an item and the search query and @@ -67,7 +62,6 @@ protected SearchableAdapter(BiPredicate searchPredicate, Function stringifier) { this((d, s) -> stringifier.apply(d).contains(s)); } @@ -86,10 +80,10 @@ public void submitData(List data) { @Override public boolean onQueryTextChange(String newText) { if (!isSearching) { - Iterables.forEach(listeners, listener -> listener.onSearchStateChange(true)); + listeners.forEach(listener -> listener.onSearchStateChange(true)); } this.isSearching = true; - List filtered = StreamSupport.stream(allData) + List filtered = allData.stream() .filter(s -> searchPredicate.test(s, newText.toLowerCase(Locale.getDefault()))) .collect(Collectors.toList()); filtered = filter.apply(filtered); @@ -100,7 +94,7 @@ public boolean onQueryTextChange(String newText) { @Override public boolean onClose() { if (isSearching) { - Iterables.forEach(listeners, listener -> listener.onSearchStateChange(false)); + listeners.forEach(listener -> listener.onSearchStateChange(false)); } this.isSearching = false; return false; @@ -111,9 +105,9 @@ public boolean onClose() { */ public void onOpen() { if (!isSearching) { - Iterables.forEach(listeners, listener -> listener.onSearchStateChange(true)); + listeners.forEach(listener -> listener.onSearchStateChange(true)); } this.isSearching = true; - Iterables.forEach(listeners, listener -> listener.onSearchStateChange(isSearching)); + listeners.forEach(listener -> listener.onSearchStateChange(isSearching)); } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DataViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DataViewHolder.java index 87c4d3a81..428e7dadc 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DataViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DataViewHolder.java @@ -1,7 +1,8 @@ package be.ugent.zeus.hydra.common.ui.recyclerview.viewholders; -import androidx.recyclerview.widget.RecyclerView; import android.view.View; +import androidx.recyclerview.widget.RecyclerView; + import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.DataAdapter; /** diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DateHeaderViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DateHeaderViewHolder.java index 185a08a7b..4b626b70b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DateHeaderViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DateHeaderViewHolder.java @@ -1,18 +1,16 @@ package be.ugent.zeus.hydra.common.ui.recyclerview.viewholders; import android.content.Context; -import android.text.TextUtils; import android.view.View; import android.widget.TextView; -import java.util.Locale; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.FormatStyle; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.utils.DateUtils; import be.ugent.zeus.hydra.common.utils.StringUtils; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.FormatStyle; /** * For date headers. @@ -28,14 +26,14 @@ public DateHeaderViewHolder(View v) { headerText = v.findViewById(R.id.date_header); } - @Override - public void populate(OffsetDateTime date) { - headerText.setText(format(headerText.getContext(), date.toLocalDate())); - } - public static String format(Context context, LocalDate localDate) { String date = DateUtils.getFriendlyDate(context, localDate, FormatStyle.LONG); date = StringUtils.capitaliseFirst(date); return date; } + + @Override + public void populate(OffsetDateTime date) { + headerText.setText(format(headerText.getContext(), date.toLocalDate())); + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DescriptionMultiSelectListViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DescriptionMultiSelectListViewHolder.java index a94e30a43..8e468c93d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DescriptionMultiSelectListViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/recyclerview/viewholders/DescriptionMultiSelectListViewHolder.java @@ -6,9 +6,10 @@ import android.widget.LinearLayout; import android.widget.TextView; +import java.util.function.Function; + import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.MultiSelectAdapter; -import java9.util.function.Function; /* * ViewHolder for MultiSelectLists with both a title and description for each item. diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/ButtonBarLayout.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/ButtonBarLayout.java index 96c8886f5..57a4a679b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/ButtonBarLayout.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/ButtonBarLayout.java @@ -33,7 +33,9 @@ * Modified from the Android source code. */ public class ButtonBarLayout extends LinearLayout { - /** Amount of the second button to "peek" above the fold when stacked. */ + /** + * Amount of the second button to "peek" above the fold when stacked. + */ private static final int PEEK_BUTTON_DP = 16; private int mLastWidthSize = -1; @@ -133,6 +135,10 @@ public int getMinimumHeight() { return Math.max(mMinimumHeight, super.getMinimumHeight()); } + private boolean isStacked() { + return getOrientation() == LinearLayout.VERTICAL; + } + private void setStacked(boolean stacked) { setOrientation(stacked ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL); setGravity(stacked ? Gravity.RIGHT : Gravity.BOTTOM); @@ -149,8 +155,4 @@ private void setStacked(boolean stacked) { bringChildToFront(getChildAt(i)); } } - - private boolean isStacked() { - return getOrientation() == LinearLayout.VERTICAL; - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/DisplayableMenu.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/DisplayableMenu.java index 6422a0079..16390199b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/DisplayableMenu.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/DisplayableMenu.java @@ -42,6 +42,50 @@ public class DisplayableMenu { normalStyle = ViewUtils.getAttr(context, R.attr.textAppearanceBody2); } + /** + * Make an image view. This image view has attributes set that are useful in the context of displaying it in the + * menu. + * + * @param id The ID of the drawable. Can be a vector. + * + * @return The image view. + */ + private static ImageView makeImageView(Context context, @DrawableRes int id) { + ImageView imageView = new ImageView(context); + imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); + imageView.setImageDrawable(AppCompatResources.getDrawable(context, id)); + TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.MATCH_PARENT); + imageView.setLayoutParams(params); + return imageView; + } + + @DrawableRes + public static int getDrawable(RestoMeal meal) { + //Set the correct image. + @DrawableRes int id; + if (meal.getKind() == null) { + return R.drawable.resto_meat; + } + switch (meal.getKind()) { + case "fish": + id = R.drawable.resto_fish; + break; + case "vegan": + id = R.drawable.resto_vegan; + break; + case "vegetarian": + id = R.drawable.resto_vegetarian; + break; + case "soup": + id = R.drawable.resto_soup; + break; + default: + case "meat": + id = R.drawable.resto_meat; + } + return id; + } + /** * Add the view responsible for displaying the vegetables to the {@code parent} view. * @@ -110,23 +154,6 @@ boolean hasVegetables() { return !menu.getVegetables().isEmpty(); } - /** - * Make an image view. This image view has attributes set that are useful in the context of displaying it in the - * menu. - * - * @param id The ID of the drawable. Can be a vector. - * - * @return The image view. - */ - private static ImageView makeImageView(Context context, @DrawableRes int id) { - ImageView imageView = new ImageView(context); - imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); - imageView.setImageDrawable(AppCompatResources.getDrawable(context, id)); - TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.MATCH_PARENT); - imageView.setLayoutParams(params); - return imageView; - } - /** * Make center text. * @@ -179,31 +206,4 @@ private void addMealViews(ViewGroup parent, List meals) { parent.addView(tr); } } - - @DrawableRes - public static int getDrawable(RestoMeal meal) { - //Set the correct image. - @DrawableRes int id; - if (meal.getKind() == null) { - return R.drawable.resto_meat; - } - switch (meal.getKind()) { - case "fish": - id = R.drawable.resto_fish; - break; - case "vegan": - id = R.drawable.resto_vegan; - break; - case "vegetarian": - id = R.drawable.resto_vegetarian; - break; - case "soup": - id = R.drawable.resto_soup; - break; - default: - case "meat": - id = R.drawable.resto_meat; - } - return id; - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/MenuTable.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/MenuTable.java index 921aad16a..ec3c202f4 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/MenuTable.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/MenuTable.java @@ -29,21 +29,6 @@ */ public class MenuTable extends TableLayout { - /** - * Flags to indicate what should be displayed by the menu. - */ - @IntDef( - flag = true, - value = {DisplayKind.MAIN, DisplayKind.SOUP, DisplayKind.VEGETABLES, DisplayKind.ALL} - ) - @Retention(RetentionPolicy.SOURCE) - public @interface DisplayKind { - int MAIN = 1; // 001 - int SOUP = 1 << 1; // 010 - int VEGETABLES = 1 << 2; // 100 - int ALL = 7; // 111 - } - private DisplayableMenu menu; @DisplayKind private int displayedKinds; @@ -51,7 +36,6 @@ public class MenuTable extends TableLayout { private boolean showTitles; private boolean messagePaddingTop; private int normalStyle; - public MenuTable(Context context) { super(context); init(context, null); @@ -86,9 +70,9 @@ private void init(Context context, @Nullable AttributeSet attrs) { /** * Create and insert a text view. * - * @param text The text to add. + * @param text The text to add. * @param isTitle If the text is a title and should be styled as such. - * @param isHtml If the text contains basic html. + * @param isHtml If the text contains basic html. */ private void createText(String text, boolean isTitle, boolean isHtml) { @@ -151,13 +135,6 @@ private void createTitle(String title) { createText(title, true, false); } - /** - * @param menu The menu to display. - */ - public void setMenu(RestoMenu menu) { - setMenu(menu, this.displayedKinds); - } - /** * @param menu The menu to display. */ @@ -176,6 +153,13 @@ public RestoMenu getMenu() { return menu.menu; } + /** + * @param menu The menu to display. + */ + public void setMenu(RestoMenu menu) { + setMenu(menu, this.displayedKinds); + } + /** * Add content. */ @@ -222,4 +206,19 @@ private void populate() { menu.addVegetableViews(this); } } + + /** + * Flags to indicate what should be displayed by the menu. + */ + @IntDef( + flag = true, + value = {DisplayKind.MAIN, DisplayKind.SOUP, DisplayKind.VEGETABLES, DisplayKind.ALL} + ) + @Retention(RetentionPolicy.SOURCE) + public @interface DisplayKind { + int MAIN = 1; // 001 + int SOUP = 1 << 1; // 010 + int VEGETABLES = 1 << 2; // 100 + int ALL = 7; // 111 + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/NowToolbar.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/NowToolbar.java index ce040a7a2..17181af58 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/NowToolbar.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/NowToolbar.java @@ -2,13 +2,13 @@ import android.content.Context; import android.content.res.TypedArray; -import androidx.annotation.DrawableRes; -import androidx.annotation.MenuRes; import android.util.AttributeSet; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupMenu; import android.widget.TextView; +import androidx.annotation.DrawableRes; +import androidx.annotation.MenuRes; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.feed.cards.MenuHandler; diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreference.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreference.java index 99459533a..1132f0611 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreference.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreference.java @@ -9,9 +9,10 @@ import androidx.annotation.Nullable; import androidx.preference.DialogPreference; +import java.time.LocalTime; + import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.utils.ViewUtils; -import org.threeten.bp.LocalTime; /** * Custom dialog to select a time in the preferences. @@ -26,7 +27,7 @@ * @see Based on this library * @see LocalTime#toString() The exact documentation on how the value is saved. */ -@SuppressWarnings({"WeakerAccess", "unused"}) +@SuppressWarnings({"WeakerAccess"}) public class TimePreference extends DialogPreference { public TimePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { @@ -52,6 +53,7 @@ public TimePreference(Context context, AttributeSet attrs) { android.R.attr.dialogPreferenceStyle)); } + @SuppressWarnings({"unused", "RedundantSuppression"}) public TimePreference(Context context) { this(context, null); } @@ -91,18 +93,6 @@ protected void onSetInitialValue(Object defaultValueObj) { } } - private static final class TimeSummaryProvider implements SummaryProvider { - @Override - public CharSequence provideSummary(TimePreference preference) { - LocalTime time = preference.getTime(); - if (time != null) { - return time.toString(); - } else { - return ""; - } - } - } - @Override protected Parcelable onSaveInstanceState() { final Parcelable superState = super.onSaveInstanceState(); @@ -129,7 +119,31 @@ protected void onRestoreInstanceState(Parcelable state) { setTime(myState.time); } + private static final class TimeSummaryProvider implements SummaryProvider { + @Override + public CharSequence provideSummary(TimePreference preference) { + LocalTime time = preference.getTime(); + if (time != null) { + return time.toString(); + } else { + return ""; + } + } + } + private static class SavedState extends BaseSavedState { + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator() { + @Override + public SavedState createFromParcel(Parcel in) { + return new SavedState(in); + } + + @Override + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }; private LocalTime time; public SavedState(Parcel source) { @@ -146,18 +160,5 @@ public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); dest.writeSerializable(time); } - - public static final Parcelable.Creator CREATOR = - new Parcelable.Creator() { - @Override - public SavedState createFromParcel(Parcel in) { - return new SavedState(in); - } - - @Override - public SavedState[] newArray(int size) { - return new SavedState[size]; - } - }; } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreferenceDialogFragmentCompat.java b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreferenceDialogFragmentCompat.java index 5faf3eeb7..6d8d029be 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreferenceDialogFragmentCompat.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/ui/widgets/TimePreferenceDialogFragmentCompat.java @@ -6,11 +6,10 @@ import android.os.Bundle; import android.text.format.DateFormat; import android.widget.TimePicker; - import androidx.annotation.NonNull; import androidx.preference.PreferenceDialogFragmentCompat; -import org.threeten.bp.LocalTime; +import java.time.LocalTime; /** * Custom dialog to select a time in the preferences. This works together with {@link TimePreference}. @@ -18,7 +17,6 @@ * This dialogs uses {@link LocalTime} as the object. * * @author Niko Strijbol - * * @see Based on this library * @see LocalTime#toString() The exact documentation on how the value is saved. */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/common/utils/DateUtils.java b/app/src/main/java/be/ugent/zeus/hydra/common/utils/DateUtils.java index 80fd70c6f..039f15e6d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/common/utils/DateUtils.java +++ b/app/src/main/java/be/ugent/zeus/hydra/common/utils/DateUtils.java @@ -4,15 +4,18 @@ import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; -import be.ugent.zeus.hydra.R; -import org.threeten.bp.*; -import org.threeten.bp.format.DateTimeFormatter; -import org.threeten.bp.format.FormatStyle; -import org.threeten.bp.format.TextStyle; -import org.threeten.bp.temporal.ChronoUnit; - +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.time.format.FormatStyle; +import java.time.format.TextStyle; +import java.time.temporal.ChronoUnit; import java.util.Locale; +import be.ugent.zeus.hydra.R; + /** * Date utilities. * diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/FeedCollection.java b/app/src/main/java/be/ugent/zeus/hydra/feed/FeedCollection.java index 15a3030c2..b652c7667 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/FeedCollection.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/FeedCollection.java @@ -1,7 +1,7 @@ package be.ugent.zeus.hydra.feed; -import be.ugent.zeus.hydra.feed.operations.FeedOperation; import be.ugent.zeus.hydra.common.ExtendedSparseArray; +import be.ugent.zeus.hydra.feed.operations.FeedOperation; /** * A dict or {@link java.util.Map}-like data structure that maps the {@link be.ugent.zeus.hydra.feed.cards.Card.Type} diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/FeedException.java b/app/src/main/java/be/ugent/zeus/hydra/feed/FeedException.java index f2acaf9d0..5a33af3a5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/FeedException.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/FeedException.java @@ -1,10 +1,10 @@ package be.ugent.zeus.hydra.feed; -import be.ugent.zeus.hydra.common.request.RequestException; - import java.util.Arrays; import java.util.Set; +import be.ugent.zeus.hydra.common.request.RequestException; + /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/FeedLiveData.java b/app/src/main/java/be/ugent/zeus/hydra/feed/FeedLiveData.java index cabe79038..be603b4db 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/FeedLiveData.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/FeedLiveData.java @@ -11,11 +11,8 @@ import androidx.preference.PreferenceManager; import java.util.*; - -import java9.util.J8Arrays; -import java9.util.function.IntPredicate; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.function.IntPredicate; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.BuildConfig; import be.ugent.zeus.hydra.association.preference.AssociationSelectionPreferenceFragment; @@ -23,9 +20,10 @@ import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; import be.ugent.zeus.hydra.common.database.Database; import be.ugent.zeus.hydra.common.request.Result; +import be.ugent.zeus.hydra.common.utils.NetworkUtils; import be.ugent.zeus.hydra.feed.cards.Card; -import be.ugent.zeus.hydra.feed.cards.dismissal.DismissalDao; import be.ugent.zeus.hydra.feed.cards.debug.WaitRequest; +import be.ugent.zeus.hydra.feed.cards.dismissal.DismissalDao; import be.ugent.zeus.hydra.feed.cards.event.EventRequest; import be.ugent.zeus.hydra.feed.cards.library.LibraryRequest; import be.ugent.zeus.hydra.feed.cards.news.NewsRequest; @@ -35,7 +33,6 @@ import be.ugent.zeus.hydra.feed.cards.urgent.UrgentRequest; import be.ugent.zeus.hydra.feed.operations.FeedOperation; import be.ugent.zeus.hydra.resto.RestoPreferenceFragment; -import be.ugent.zeus.hydra.common.utils.NetworkUtils; import static be.ugent.zeus.hydra.feed.operations.OperationFactory.add; import static be.ugent.zeus.hydra.feed.operations.OperationFactory.get; @@ -63,10 +60,6 @@ public class FeedLiveData extends BaseLiveData>> { private static final int REFRESH_ALL_CARDS = -20; private static final String TAG = "HomeFeedLoader"; - private final SharedPreferences.OnSharedPreferenceChangeListener restoListener = new RestoListener(); - - private final Context applicationContext; - // For which settings the loader must refresh. private static final String[] watchedPreferences = { HomeFeedFragment.PREF_DISABLED_CARD_TYPES, @@ -75,7 +68,8 @@ public class FeedLiveData extends BaseLiveData>> { RestoPreferenceFragment.PREF_RESTO_NAME, HomeFeedFragment.PREF_DISABLED_CARD_HACK }; - + private final SharedPreferences.OnSharedPreferenceChangeListener restoListener = new RestoListener(); + private final Context applicationContext; private final Map oldPreferences = new HashMap<>(); FeedLiveData(Context context) { @@ -83,6 +77,47 @@ public class FeedLiveData extends BaseLiveData>> { loadData(); } + private static List executeOperation(@Nullable Bundle args, + FeedOperation operation, + Collection errors, + List results) { + + Result> result = operation.transform(args, results); + + if (result.hasException()) { + errors.add(operation.getCardType()); + } + + return result.orElse(results); + } + + /** + * Filter the requests to only include the requests that should be executed. + * + * @param allOperations A list of all possible operations. + * @param args The arguments to determine which requests will be executed. + * + * @return The requests to be executed. + */ + private static Iterable findOperations(ExtendedSparseArray allOperations, @NonNull Bundle args) { + + // If there are no arguments, or we must do all operations, do nothing. + if (args.getInt(REFRESH_HOMECARD_TYPE, REFRESH_ALL_CARDS) == REFRESH_ALL_CARDS) { + Log.i(TAG, "Returning all card types."); + return allOperations; + } + + int cardType = args.getInt(REFRESH_HOMECARD_TYPE, -50); + FeedOperation operation = allOperations.get(cardType); + if (operation == null) { + // Something went wrong. + Log.w(TAG, "Invalid card type " + cardType + " was passed. Defaulting to all types."); + return allOperations; + } + Log.i(TAG, "Returning card type " + cardType); + return Collections.singleton(operation); + } + @Override protected void onActive() { super.onActive(); @@ -111,36 +146,6 @@ protected void onInactive() { preferences.unregisterOnSharedPreferenceChangeListener(restoListener); } - private class RestoListener implements SharedPreferences.OnSharedPreferenceChangeListener { - @Override - public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { - // If it is a value we are looking for, save the value. - // We don't need to update for these values anymore, since we already do this manually. - if (J8Arrays.stream(watchedPreferences).anyMatch(key::contains)) { - oldPreferences.put(key, sharedPreferences.getAll().get(key)); - } - if (RestoPreferenceFragment.PREF_RESTO_KEY.equals(key) || RestoPreferenceFragment.PREF_RESTO_NAME.equals(key)) { - Bundle ex = new Bundle(); - ex.putInt(REFRESH_HOMECARD_TYPE, Card.Type.RESTO); - flagForRefresh(ex); - } - } - } - - private static List executeOperation(@Nullable Bundle args, - FeedOperation operation, - Collection errors, - List results) { - - Result> result = operation.transform(args, results); - - if (result.hasException()) { - errors.add(operation.getCardType()); - } - - return result.orElse(results); - } - /** * Load the actual data. * @@ -219,9 +224,9 @@ private ExtendedSparseArray scheduleOperations() { FeedCollection operations = new FeedCollection(); Context c = applicationContext; - Set disabled = StreamSupport.stream(PreferenceManager - .getDefaultSharedPreferences(c) - .getStringSet(HomeFeedFragment.PREF_DISABLED_CARD_TYPES, Collections.emptySet())) + Set disabled = PreferenceManager.getDefaultSharedPreferences(c) + .getStringSet(HomeFeedFragment.PREF_DISABLED_CARD_TYPES, Collections.emptySet()) + .stream() .map(Integer::parseInt) .collect(Collectors.toSet()); @@ -255,30 +260,19 @@ private ExtendedSparseArray scheduleOperations() { return operations; } - /** - * Filter the requests to only include the requests that should be executed. - * - * @param allOperations A list of all possible operations. - * @param args The arguments to determine which requests will be executed. - * - * @return The requests to be executed. - */ - private static Iterable findOperations(ExtendedSparseArray allOperations, @NonNull Bundle args) { - - // If there are no arguments, or we must do all operations, do nothing. - if (args.getInt(REFRESH_HOMECARD_TYPE, REFRESH_ALL_CARDS) == REFRESH_ALL_CARDS) { - Log.i(TAG, "Returning all card types."); - return allOperations; - } - - int cardType = args.getInt(REFRESH_HOMECARD_TYPE, -50); - FeedOperation operation = allOperations.get(cardType); - if (operation == null) { - // Something went wrong. - Log.w(TAG, "Invalid card type " + cardType + " was passed. Defaulting to all types."); - return allOperations; + private class RestoListener implements SharedPreferences.OnSharedPreferenceChangeListener { + @Override + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { + // If it is a value we are looking for, save the value. + // We don't need to update for these values anymore, since we already do this manually. + if (Arrays.stream(watchedPreferences).anyMatch(key::contains)) { + oldPreferences.put(key, sharedPreferences.getAll().get(key)); + } + if (RestoPreferenceFragment.PREF_RESTO_KEY.equals(key) || RestoPreferenceFragment.PREF_RESTO_NAME.equals(key)) { + Bundle ex = new Bundle(); + ex.putInt(REFRESH_HOMECARD_TYPE, Card.Type.RESTO); + flagForRefresh(ex); + } } - Log.i(TAG, "Returning card type " + cardType); - return Collections.singleton(operation); } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/HideableHomeFeedRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/HideableHomeFeedRequest.java index b9ef07418..3d64db751 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/HideableHomeFeedRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/HideableHomeFeedRequest.java @@ -6,10 +6,8 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; - -import java9.util.stream.Collectors; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; +import java.util.stream.Collectors; +import java.util.stream.Stream; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.cards.Card; @@ -41,11 +39,11 @@ public final Result> execute(@NonNull Bundle args) { List hiddenList = dismissalDao.getIdsForType(getCardType()); // If hidden is empty, we don't do anything for performance reasons. if (hiddenList.isEmpty()) { - return StreamSupport.stream(cards); + return cards.stream(); } else { // Wrap in a set for fast contains. Collection fastHidden = new HashSet<>(hiddenList); - return StreamSupport.stream(cards) + return cards.stream() .filter(card -> !fastHidden.contains(new CardIdentifier(card.getCardType(), card.getIdentifier()))); } }); diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedAdapter.java index f8d9fcd18..1708f0ed9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedAdapter.java @@ -38,6 +38,10 @@ public class HomeFeedAdapter extends DiffAdapter> { setHasStableIds(true); } + private static View view(int rLayout, ViewGroup parent) { + return LayoutInflater.from(parent.getContext()).inflate(rLayout, parent, false); + } + public AdapterCompanion getCompanion() { return companion; } @@ -71,10 +75,6 @@ public DataViewHolder onCreateViewHolder(@NonNull ViewGroup parent, @Card. } } - private static View view(int rLayout, ViewGroup parent) { - return LayoutInflater.from(parent.getContext()).inflate(rLayout, parent, false); - } - @Override @Card.Type public int getItemViewType(int position) { diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedFragment.java b/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedFragment.java index 75bd05844..93cac18b9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedFragment.java @@ -18,13 +18,13 @@ import be.ugent.zeus.hydra.common.ui.customtabs.ActivityHelper; import be.ugent.zeus.hydra.common.ui.customtabs.CustomTabsHelper; import be.ugent.zeus.hydra.common.ui.recyclerview.SpanItemSpacingDecoration; +import be.ugent.zeus.hydra.common.utils.ColourUtils; import be.ugent.zeus.hydra.feed.commands.CommandResult; import be.ugent.zeus.hydra.feed.commands.FeedCommand; -import be.ugent.zeus.hydra.common.utils.ColourUtils; import com.google.android.material.snackbar.Snackbar; -import static be.ugent.zeus.hydra.feed.FeedLiveData.REFRESH_HOMECARD_TYPE; import static be.ugent.zeus.hydra.common.utils.FragmentUtils.requireBaseActivity; +import static be.ugent.zeus.hydra.feed.FeedLiveData.REFRESH_HOMECARD_TYPE; /** * The fragment showing the home feed. @@ -44,12 +44,10 @@ */ public class HomeFeedFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, HomeFeedAdapter.AdapterCompanion, MainActivity.ScheduledRemovalListener { - private static final String TAG = "HomeFeedFragment"; - public static final String PREF_DISABLED_CARD_TYPES = "pref_disabled_cards"; // TODO: replace this by proper listener to database. public static final String PREF_DISABLED_CARD_HACK = "pref_disabled_specials_hack"; - + private static final String TAG = "HomeFeedFragment"; private static final int REQUEST_HOMECARD_ID = 5050; private boolean firstRun; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedRequest.java index a82aa0702..7d3503d04 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/HomeFeedRequest.java @@ -1,6 +1,6 @@ package be.ugent.zeus.hydra.feed; -import java9.util.stream.Stream; +import java.util.stream.Stream; import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.feed.cards.Card; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/SwipeDismissableViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/SwipeDismissableViewHolder.java index 009f77038..921a71a0d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/SwipeDismissableViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/SwipeDismissableViewHolder.java @@ -2,6 +2,7 @@ /** * A view holder for things that are dismissable by swipe. + * * @author Niko Strijbol */ public interface SwipeDismissableViewHolder { diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/Card.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/Card.java index 680a39bbb..acbb22d84 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/Card.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/Card.java @@ -6,8 +6,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java9.lang.Integers; - import static be.ugent.zeus.hydra.feed.cards.Card.Type.*; /** @@ -57,24 +55,6 @@ public abstract class Card implements Comparable { */ public abstract String getIdentifier(); - /** - * Note: the numbers are not sequential due to removed types. - * DO NOT re-use numbers: these are saved in the database. - * Next free number: 12 - */ - @Retention(RetentionPolicy.SOURCE) - @IntDef({RESTO, ACTIVITY, SPECIAL_EVENT, SCHAMPER, NEWS_ITEM, URGENT_FM, LIBRARY, DEBUG}) - public @interface Type { - int RESTO = 1; - int ACTIVITY = 2; - int SPECIAL_EVENT = 3; - int SCHAMPER = 4; - int NEWS_ITEM = 5; - int URGENT_FM = 9; - int LIBRARY = 11; - int DEBUG = 100; - } - @Override public abstract int hashCode(); @@ -92,7 +72,7 @@ public abstract class Card implements Comparable { */ @Override public int compareTo(@NonNull Card card) { - return Integers.compare(this.getPriority(), card.getPriority()); + return Integer.compare(this.getPriority(), card.getPriority()); } /** @@ -113,4 +93,22 @@ public C checkCard(@Type int type) { //noinspection unchecked return (C) this; } + + /** + * Note: the numbers are not sequential due to removed types. + * DO NOT re-use numbers: these are saved in the database. + * Next free number: 12 + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({RESTO, ACTIVITY, SPECIAL_EVENT, SCHAMPER, NEWS_ITEM, URGENT_FM, LIBRARY, DEBUG}) + public @interface Type { + int RESTO = 1; + int ACTIVITY = 2; + int SPECIAL_EVENT = 3; + int SCHAMPER = 4; + int NEWS_ITEM = 5; + int URGENT_FM = 9; + int LIBRARY = 11; + int DEBUG = 100; + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/PriorityUtils.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/PriorityUtils.java index 99597b74c..425d0cdf5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/PriorityUtils.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/PriorityUtils.java @@ -5,8 +5,8 @@ import android.widget.ImageView; import androidx.preference.PreferenceManager; -import be.ugent.zeus.hydra.feed.preferences.HomeFragment; import be.ugent.zeus.hydra.common.utils.NetworkUtils; +import be.ugent.zeus.hydra.feed.preferences.HomeFragment; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import com.squareup.picasso.RequestCreator; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/debug/WaitRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/debug/WaitRequest.java index 70d6040cb..7e81a91a9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/debug/WaitRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/debug/WaitRequest.java @@ -1,17 +1,15 @@ package be.ugent.zeus.hydra.feed.cards.debug; import android.os.Bundle; -import androidx.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; + +import java.util.stream.Stream; -import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.common.request.RequestException; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.HomeFeedRequest; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; - -import java.util.Collections; +import be.ugent.zeus.hydra.feed.cards.Card; import static be.ugent.zeus.hydra.feed.cards.Card.Type.DEBUG; @@ -33,7 +31,7 @@ public Result> execute(@NonNull Bundle args) { try { Log.i(TAG, "execute: sleep 5 seconds."); Thread.sleep(5000); //Sleep 5 seconds - return Result.Builder.fromData(StreamSupport.stream(Collections.emptyList())); + return Result.Builder.fromData(Stream.empty()); } catch (InterruptedException e) { return Result.Builder.fromException(new RequestException(e)); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardDismissal.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardDismissal.java index 773e08364..73baf600e 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardDismissal.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardDismissal.java @@ -3,10 +3,10 @@ import androidx.annotation.NonNull; import androidx.room.*; -import java9.util.Objects; +import java.time.Instant; +import java.util.Objects; import be.ugent.zeus.hydra.feed.cards.Card; -import org.threeten.bp.Instant; /** * Records a dismissal of a card from the user. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardIdentifier.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardIdentifier.java index 218a3e07d..241849140 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardIdentifier.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/CardIdentifier.java @@ -1,11 +1,11 @@ package be.ugent.zeus.hydra.feed.cards.dismissal; -import androidx.room.ColumnInfo; import androidx.annotation.NonNull; +import androidx.room.ColumnInfo; -import be.ugent.zeus.hydra.feed.cards.Card; +import java.util.Objects; -import java9.util.Objects; +import be.ugent.zeus.hydra.feed.cards.Card; /** * Identifies a single card in the home feed. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalDao.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalDao.java index 7bba890ff..7095923c9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalDao.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalDao.java @@ -6,9 +6,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; - -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.feed.cards.Card; @@ -74,13 +72,13 @@ public void deleteByIdentifier(Collection identifiers) { /** * Remove all saved dismissals for cards that are not in the given list of cards. * - * @param type The card type of the given cards. + * @param type The card type of the given cards. * @param allCards All cards. Cards not present in this list will be removed from the repository. */ public void prune(@Card.Type int type, List allCards) { Set dismissals = new HashSet<>(getIdsForType(type)); - Set retained = StreamSupport.stream(allCards) + Set retained = allCards.stream() .map(c -> new CardIdentifier(c.getCardType(), c.getIdentifier())) .collect(Collectors.toSet()); diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalTable.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalTable.java index 47074adb2..77c594cf7 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalTable.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/dismissal/DismissalTable.java @@ -10,12 +10,12 @@ */ public final class DismissalTable { + public static final String TABLE_NAME = "feed_dismissals"; + private DismissalTable() { // No instances. } - public static final String TABLE_NAME = "feed_dismissals"; - public interface Columns { String CARD_TYPE = "card_type"; String IDENTIFIER = "card_identifier"; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCard.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCard.java index 8ed0c1449..d7824d78d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCard.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCard.java @@ -1,11 +1,12 @@ package be.ugent.zeus.hydra.feed.cards.event; +import java.time.Duration; +import java.time.ZonedDateTime; +import java.util.Objects; + import be.ugent.zeus.hydra.association.event.Event; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.PriorityUtils; -import java9.util.Objects; -import org.threeten.bp.Duration; -import org.threeten.bp.ZonedDateTime; /** * Home card for {@link Event}. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCardViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCardViewHolder.java index ddbcadcf5..10a2c17ec 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCardViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventCardViewHolder.java @@ -9,12 +9,12 @@ import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.association.event.Event; import be.ugent.zeus.hydra.association.event.EventDetailsActivity; +import be.ugent.zeus.hydra.common.utils.DateUtils; import be.ugent.zeus.hydra.feed.HomeFeedAdapter; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.CardViewHolder; import be.ugent.zeus.hydra.feed.cards.PriorityUtils; import be.ugent.zeus.hydra.feed.commands.DisableAssociationCommand; -import be.ugent.zeus.hydra.common.utils.DateUtils; /** * View holder for cards containing events. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventRequest.java index aec8be251..2a6ab531e 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/event/EventRequest.java @@ -4,6 +4,10 @@ import android.os.Bundle; import androidx.annotation.NonNull; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.stream.Stream; + import be.ugent.zeus.hydra.association.event.Event; import be.ugent.zeus.hydra.association.event.RawEventRequest; import be.ugent.zeus.hydra.common.request.Request; @@ -11,12 +15,6 @@ import be.ugent.zeus.hydra.feed.HideableHomeFeedRequest; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.dismissal.DismissalDao; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; - -import org.threeten.bp.OffsetDateTime; - -import java.util.List; /** * Home feed request for association events. We only display events between now and 1 months from now. @@ -43,7 +41,7 @@ protected Result> performRequestCards(@NonNull Bundle args) { OffsetDateTime now = OffsetDateTime.now(); OffsetDateTime plusOne = now.plusMonths(1); - return request.execute(args).map(events -> StreamSupport.stream(events) + return request.execute(args).map(events -> events.stream() .filter(c -> c.getStart().isAfter(now) && c.getStart().isBefore(plusOne)) .map(EventCard::new)); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryCard.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryCard.java index 8fe1dd8dd..e8f4634f5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryCard.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryCard.java @@ -3,8 +3,7 @@ import android.util.Pair; import java.util.List; - -import java9.util.Optional; +import java.util.Optional; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.cards.Card; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryRequest.java index 3b0d15327..6d9b18140 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryRequest.java @@ -6,11 +6,10 @@ import android.util.Pair; import androidx.annotation.NonNull; +import java.time.LocalDate; import java.util.List; - -import java9.util.stream.Collectors; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; +import java.util.stream.Collectors; +import java.util.stream.Stream; import be.ugent.zeus.hydra.common.database.Database; import be.ugent.zeus.hydra.common.request.Result; @@ -19,7 +18,6 @@ import be.ugent.zeus.hydra.library.details.OpeningHoursRequest; import be.ugent.zeus.hydra.library.favourites.FavouritesRepository; import be.ugent.zeus.hydra.library.favourites.LibraryFavourite; -import org.threeten.bp.LocalDate; /** * This request will retrieve a list of opening hours for each library that is marked as favourite by the user. @@ -61,7 +59,7 @@ public Result> execute(@NonNull Bundle args) { // Get the opening hours for each library. LocalDate today = LocalDate.now(); - return Result.Builder.fromData(Stream.of(new LibraryCard(StreamSupport.stream(favourites) + return Result.Builder.fromData(Stream.of(new LibraryCard(favourites.stream() .map(favourite -> { OpeningHoursRequest r = new OpeningHoursRequest(context, favourite.getCode()); return Pair.create(favourite.getName(), r.forDay(today).execute()); diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryViewHolder.java index 71baf81cb..cc67b32a3 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/library/LibraryViewHolder.java @@ -8,7 +8,7 @@ import android.widget.TableRow; import android.widget.TextView; -import java9.util.Optional; +import java.util.Optional; import be.ugent.zeus.hydra.MainActivity; import be.ugent.zeus.hydra.R; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemCard.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemCard.java index 3975c0c67..74b37d378 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemCard.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemCard.java @@ -1,11 +1,12 @@ package be.ugent.zeus.hydra.feed.cards.news; -import be.ugent.zeus.hydra.news.UgentNewsArticle; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Objects; + import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.PriorityUtils; -import java9.util.Objects; -import org.threeten.bp.Duration; -import org.threeten.bp.OffsetDateTime; +import be.ugent.zeus.hydra.news.UgentNewsArticle; /** * Home card for {@link UgentNewsArticle}. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemViewHolder.java index b036f93b4..a4db3de09 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsItemViewHolder.java @@ -4,12 +4,12 @@ import android.widget.TextView; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.news.UgentNewsArticle; import be.ugent.zeus.hydra.common.ArticleViewer; +import be.ugent.zeus.hydra.common.utils.DateUtils; import be.ugent.zeus.hydra.feed.HomeFeedAdapter; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.CardViewHolder; -import be.ugent.zeus.hydra.common.utils.DateUtils; +import be.ugent.zeus.hydra.news.UgentNewsArticle; /** * View holder for the news card in the home feed. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsRequest.java index 2164b94f0..83c34ef03 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/news/NewsRequest.java @@ -4,19 +4,17 @@ import android.os.Bundle; import androidx.annotation.NonNull; -import be.ugent.zeus.hydra.news.UgentNewsArticle; -import be.ugent.zeus.hydra.news.UgentNewsRequest; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Stream; + import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.HideableHomeFeedRequest; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.dismissal.DismissalDao; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; - -import org.threeten.bp.LocalDateTime; - -import java.util.List; +import be.ugent.zeus.hydra.news.UgentNewsArticle; +import be.ugent.zeus.hydra.news.UgentNewsRequest; /** * @author Niko Strijbol @@ -41,7 +39,7 @@ protected Result> performRequestCards(@NonNull Bundle args) { LocalDateTime now = LocalDateTime.now(); LocalDateTime sixMonthsAgo = now.minusWeeks(2); - return request.execute(args).map(ugentNewsItems -> StreamSupport.stream(ugentNewsItems) + return request.execute(args).map(ugentNewsItems -> ugentNewsItems.stream() .filter(ugentNewsItem -> sixMonthsAgo.isBefore(ugentNewsItem.getLocalModified())) .map(NewsItemCard::new)); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoCardViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoCardViewHolder.java index 212fd14ac..644ed60e8 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoCardViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoCardViewHolder.java @@ -8,6 +8,7 @@ import be.ugent.zeus.hydra.MainActivity; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.ui.widgets.MenuTable; +import be.ugent.zeus.hydra.common.utils.DateUtils; import be.ugent.zeus.hydra.feed.HomeFeedAdapter; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.CardViewHolder; @@ -15,7 +16,6 @@ import be.ugent.zeus.hydra.resto.RestoChoice; import be.ugent.zeus.hydra.resto.RestoMenu; import be.ugent.zeus.hydra.resto.menu.RestoFragment; -import be.ugent.zeus.hydra.common.utils.DateUtils; import static android.view.Menu.NONE; @@ -27,13 +27,6 @@ */ public class RestoCardViewHolder extends CardViewHolder { - @interface KindMenu { - int HIDE_SOUP = 1; - int HIDE_MAIN = 2; - int SHOW_SOUP = 3; - int SHOW_MAIN = 4; - } - private final MenuTable table; public RestoCardViewHolder(View v, HomeFeedAdapter adapter) { @@ -102,4 +95,11 @@ public boolean onMenuItemClick(MenuItem item) { return super.onMenuItemClick(item); } } + + @interface KindMenu { + int HIDE_SOUP = 1; + int HIDE_MAIN = 2; + int SHOW_SOUP = 3; + int SHOW_MAIN = 4; + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoKindCommand.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoKindCommand.java index 4b1415527..4f8275212 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoKindCommand.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoKindCommand.java @@ -37,6 +37,7 @@ class RestoKindCommand implements FeedCommand { * Maps menu items to their message of completion, i.e. the message shown when the action has been performed. */ private static final SparseIntArray MENU_TO_ITEM = new SparseIntArray(); + static { // When hiding soup, only main dishes remain. MENU_TO_FORWARD.append(HIDE_SOUP, HomeFragment.FeedRestoKind.MAIN); diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoMenuCard.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoMenuCard.java index a9a452939..b96916235 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoMenuCard.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoMenuCard.java @@ -1,13 +1,13 @@ package be.ugent.zeus.hydra.feed.cards.resto; -import java9.util.Objects; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Objects; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.PriorityUtils; import be.ugent.zeus.hydra.resto.RestoChoice; import be.ugent.zeus.hydra.resto.RestoMenu; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.temporal.ChronoUnit; /** * Home card for {@link RestoMenu}. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoRequest.java index bfd0dd8fe..183da4bab 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/resto/RestoRequest.java @@ -7,9 +7,7 @@ import androidx.preference.PreferenceManager; import java.util.List; - -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; +import java.util.stream.Stream; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.request.Request; @@ -52,7 +50,7 @@ protected Result> performRequestCards(@NonNull Bundle args) { String restoName = preferences.getString(RestoPreferenceFragment.PREF_RESTO_NAME, context.getString(R.string.resto_default_name)); RestoChoice choice = new RestoChoice(restoName, restoKey); String feedRestoKind = HomeFragment.getFeedRestoKindRaw(context); - return request.execute(args).map(restoMenus -> StreamSupport.stream(restoMenus) + return request.execute(args).map(restoMenus -> restoMenus.stream() .map(restoMenu -> new RestoMenuCard(restoMenu, choice, feedRestoKind))); } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperCard.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperCard.java index c1bfbd593..4181d6018 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperCard.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperCard.java @@ -1,11 +1,12 @@ package be.ugent.zeus.hydra.feed.cards.schamper; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Objects; + import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.PriorityUtils; import be.ugent.zeus.hydra.schamper.Article; -import java9.util.Objects; -import org.threeten.bp.Duration; -import org.threeten.bp.OffsetDateTime; import static be.ugent.zeus.hydra.feed.cards.Card.Type.SCHAMPER; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperRequest.java index 1e71e7200..5b84d32e3 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperRequest.java @@ -4,6 +4,10 @@ import android.os.Bundle; import androidx.annotation.NonNull; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Stream; + import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.HideableHomeFeedRequest; @@ -11,11 +15,6 @@ import be.ugent.zeus.hydra.feed.cards.dismissal.DismissalDao; import be.ugent.zeus.hydra.schamper.Article; import be.ugent.zeus.hydra.schamper.SchamperArticlesRequest; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; -import org.threeten.bp.LocalDateTime; - -import java.util.List; /** * @author Niko Strijbol @@ -39,7 +38,7 @@ public int getCardType() { protected Result> performRequestCards(@NonNull Bundle args) { LocalDateTime twoMonthsAgo = LocalDateTime.now().minusMonths(1); - return request.execute(args).map(articles -> StreamSupport.stream(articles) + return request.execute(args).map(articles -> articles.stream() .filter(a -> a.getLocalPubDate().isAfter(twoMonthsAgo)) .map(SchamperCard::new)); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperViewHolder.java index ad8401a72..858d8644f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/schamper/SchamperViewHolder.java @@ -10,13 +10,13 @@ import android.widget.TextView; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.feed.cards.Card; -import be.ugent.zeus.hydra.feed.cards.CardViewHolder; -import be.ugent.zeus.hydra.schamper.Article; import be.ugent.zeus.hydra.common.ArticleViewer; +import be.ugent.zeus.hydra.common.utils.DateUtils; import be.ugent.zeus.hydra.feed.HomeFeedAdapter; +import be.ugent.zeus.hydra.feed.cards.Card; +import be.ugent.zeus.hydra.feed.cards.CardViewHolder; import be.ugent.zeus.hydra.feed.cards.PriorityUtils; -import be.ugent.zeus.hydra.common.utils.DateUtils; +import be.ugent.zeus.hydra.schamper.Article; /** * Home feed view holder for Schamper articles. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/LimitingSpecialEventRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/LimitingSpecialEventRequest.java index 59eb006ba..f63784c96 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/LimitingSpecialEventRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/LimitingSpecialEventRequest.java @@ -4,6 +4,11 @@ import android.os.Bundle; import androidx.annotation.NonNull; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + import be.ugent.zeus.hydra.BuildConfig; import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.request.Result; @@ -13,12 +18,6 @@ import be.ugent.zeus.hydra.specialevent.SpecialEvent; import be.ugent.zeus.hydra.specialevent.SpecialEventRequest; import be.ugent.zeus.hydra.specialevent.SpecialEventWrapper; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; -import org.threeten.bp.OffsetDateTime; - -import java.util.ArrayList; -import java.util.List; /** * Request wrapper to limit the number of requests that are shown. @@ -34,6 +33,18 @@ public LimitingSpecialEventRequest(Context context, DismissalDao dismissalDao) { this.remoteEventRequest = new SpecialEventRequest(context); } + private static SpecialEvent buildDebugSko() { + SpecialEvent event = new SpecialEvent(); + event.setId(-5); + event.setName("Student Kick-Off"); + event.setSimpleText("Ga naar de info voor de Student Kick-Off"); + event.setImage("http://blog.studentkickoff.be/wp-content/uploads/2016/07/logo.png"); + event.setPriority(1010); + event.setInApp(SpecialEvent.SKO_IN_APP); + event.setDevelopment(true); + return event; + } + @NonNull @Override protected Result> performRequestCards(@NonNull Bundle args) { @@ -57,7 +68,7 @@ protected Result> performRequestCards(@NonNull Bundle args) { } } - return StreamSupport.stream(list); + return list.stream(); }); } @@ -65,16 +76,4 @@ protected Result> performRequestCards(@NonNull Bundle args) { public int getCardType() { return Card.Type.SPECIAL_EVENT; } - - private static SpecialEvent buildDebugSko() { - SpecialEvent event = new SpecialEvent(); - event.setId(-5); - event.setName("Student Kick-Off"); - event.setSimpleText("Ga naar de info voor de Student Kick-Off"); - event.setImage("http://blog.studentkickoff.be/wp-content/uploads/2016/07/logo.png"); - event.setPriority(1010); - event.setInApp(SpecialEvent.SKO_IN_APP); - event.setDevelopment(true); - return event; - } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCard.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCard.java index b1aa1916a..4bcf51f38 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCard.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCard.java @@ -1,9 +1,10 @@ package be.ugent.zeus.hydra.feed.cards.specialevent; +import java.util.Objects; + import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.PriorityUtils; import be.ugent.zeus.hydra.specialevent.SpecialEvent; -import java9.util.Objects; /** * Home card for a {@link SpecialEvent}. diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCardViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCardViewHolder.java index 3184831f5..4097f0274 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCardViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/specialevent/SpecialEventCardViewHolder.java @@ -6,12 +6,12 @@ import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; -import be.ugent.zeus.hydra.feed.cards.Card; -import be.ugent.zeus.hydra.specialevent.SpecialEvent; +import be.ugent.zeus.hydra.common.utils.NetworkUtils; import be.ugent.zeus.hydra.feed.HomeFeedAdapter; import be.ugent.zeus.hydra.feed.SwipeDismissableViewHolder; +import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.commands.DisableIndividualCard; -import be.ugent.zeus.hydra.common.utils.NetworkUtils; +import be.ugent.zeus.hydra.specialevent.SpecialEvent; import com.squareup.picasso.Picasso; /** diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentRequest.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentRequest.java index 15d213288..a58b08e7a 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentRequest.java @@ -3,10 +3,11 @@ import android.os.Bundle; import androidx.annotation.NonNull; -import be.ugent.zeus.hydra.feed.cards.Card; +import java.util.stream.Stream; + import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.HomeFeedRequest; -import java9.util.stream.Stream; +import be.ugent.zeus.hydra.feed.cards.Card; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentViewHolder.java index 408092a53..85ca58bb7 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/cards/urgent/UrgentViewHolder.java @@ -2,11 +2,12 @@ import android.content.Intent; import android.view.View; + +import be.ugent.zeus.hydra.MainActivity; import be.ugent.zeus.hydra.R; +import be.ugent.zeus.hydra.feed.HomeFeedAdapter; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.CardViewHolder; -import be.ugent.zeus.hydra.MainActivity; -import be.ugent.zeus.hydra.feed.HomeFeedAdapter; import be.ugent.zeus.hydra.feed.commands.DisableTypeCommand; /** diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/CommandResult.java b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/CommandResult.java index a089860a0..d2453c669 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/CommandResult.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/CommandResult.java @@ -3,8 +3,9 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import java.util.Objects; + import be.ugent.zeus.hydra.feed.cards.Card; -import java9.util.Objects; /** * @author Niko Strijbol @@ -20,6 +21,14 @@ private CommandResult(@Card.Type int cardType, @Nullable FeedCommand command) { this.command = command; } + public static CommandResult forUndo(@Card.Type int cardType) { + return new CommandResult(cardType, null); + } + + public static CommandResult forExecute(FeedCommand command, @Card.Type int cardType) { + return new CommandResult(cardType, command); + } + @Card.Type public int getCardType() { return cardType; @@ -34,12 +43,4 @@ public FeedCommand getCommand() { //noinspection ConstantConditions return Objects.requireNonNull(command); } - - public static CommandResult forUndo(@Card.Type int cardType) { - return new CommandResult(cardType, null); - } - - public static CommandResult forExecute(FeedCommand command, @Card.Type int cardType) { - return new CommandResult(cardType, command); - } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableAssociationCommand.java b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableAssociationCommand.java index d06561192..4a38fe71d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableAssociationCommand.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableAssociationCommand.java @@ -4,10 +4,10 @@ import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.association.Association; -import be.ugent.zeus.hydra.common.reporting.Reporting; -import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.association.preference.AssociationSelectionPreferenceFragment; +import be.ugent.zeus.hydra.common.reporting.Reporting; import be.ugent.zeus.hydra.common.utils.PreferencesUtils; +import be.ugent.zeus.hydra.feed.cards.Card; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableIndividualCard.java b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableIndividualCard.java index ed68c9880..b4526989b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableIndividualCard.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableIndividualCard.java @@ -2,11 +2,11 @@ import android.content.Context; -import be.ugent.zeus.hydra.common.reporting.Reporting; -import java9.util.function.Function; +import java.util.function.Function; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.database.Database; +import be.ugent.zeus.hydra.common.reporting.Reporting; import be.ugent.zeus.hydra.feed.cards.Card; import be.ugent.zeus.hydra.feed.cards.dismissal.CardDismissal; import be.ugent.zeus.hydra.feed.cards.dismissal.DismissalDao; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableTypeCommand.java b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableTypeCommand.java index 9426459b2..37b7552d2 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableTypeCommand.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DisableTypeCommand.java @@ -5,9 +5,9 @@ import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.reporting.Reporting; -import be.ugent.zeus.hydra.feed.cards.Card; -import be.ugent.zeus.hydra.feed.HomeFeedFragment; import be.ugent.zeus.hydra.common.utils.PreferencesUtils; +import be.ugent.zeus.hydra.feed.HomeFeedFragment; +import be.ugent.zeus.hydra.feed.cards.Card; /** * This will add a certain {@link Card.Type} to the list of hidden diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DismissalEvent.java b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DismissalEvent.java index fa5954560..55fad2602 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DismissalEvent.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/DismissalEvent.java @@ -2,6 +2,7 @@ import android.os.Bundle; import androidx.annotation.Nullable; + import be.ugent.zeus.hydra.association.Association; import be.ugent.zeus.hydra.common.reporting.BaseEvents; import be.ugent.zeus.hydra.common.reporting.Event; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/FeedCommand.java b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/FeedCommand.java index b7e2e400a..450537d12 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/commands/FeedCommand.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/commands/FeedCommand.java @@ -19,7 +19,7 @@ public interface FeedCommand { /** * Execute the command. * - * @return Returns the type of card that should be refreshed. + * @return Returns the type of card that should be refreshed. */ @Card.Type int execute(Context context); diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/operations/OperationFactory.java b/app/src/main/java/be/ugent/zeus/hydra/feed/operations/OperationFactory.java index 26e1fbe99..688b483ad 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/operations/OperationFactory.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/operations/OperationFactory.java @@ -1,7 +1,7 @@ package be.ugent.zeus.hydra.feed.operations; -import java9.util.function.IntPredicate; -import java9.util.function.Supplier; +import java.util.function.IntPredicate; +import java.util.function.Supplier; import be.ugent.zeus.hydra.feed.HomeFeedRequest; import be.ugent.zeus.hydra.feed.cards.Card; diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RemoveOperation.java b/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RemoveOperation.java index c44f25d57..d31408c83 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RemoveOperation.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RemoveOperation.java @@ -4,10 +4,8 @@ import androidx.annotation.NonNull; import java.util.List; - -import java9.util.function.Predicate; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.function.Predicate; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.cards.Card; @@ -35,7 +33,7 @@ private RemoveOperation(@Card.Type int cardType, Predicate predicate) { @NonNull @Override public Result> transform(Bundle args, List current) { - return Result.Builder.fromData(StreamSupport.stream(current).filter(predicate.negate()).collect(Collectors.toList())); + return Result.Builder.fromData(current.stream().filter(predicate.negate()).collect(Collectors.toList())); } @Override diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RequestOperation.java b/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RequestOperation.java index f9206816e..38a43c8f5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RequestOperation.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/operations/RequestOperation.java @@ -4,10 +4,8 @@ import androidx.annotation.NonNull; import java.util.List; - -import java9.util.stream.Collectors; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; +import java.util.stream.Collectors; +import java.util.stream.Stream; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.feed.HomeFeedRequest; @@ -41,7 +39,7 @@ class RequestOperation implements FeedOperation { public Result> transform(Bundle args, final List current) { // Filter existing cards away. - Stream temp = StreamSupport.stream(current) + Stream temp = current.stream() .filter(c -> c.getCardType() != request.getCardType()); return request.execute(args).map(homeCardStream -> diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFeedSelectFragment.java b/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFeedSelectFragment.java index 5a5e14b90..0778cf503 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFeedSelectFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFeedSelectFragment.java @@ -14,16 +14,14 @@ import androidx.recyclerview.widget.RecyclerView; import java.util.*; - -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.MultiSelectAdapter; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DescriptionMultiSelectListViewHolder; import be.ugent.zeus.hydra.common.utils.PreferencesUtils; +import be.ugent.zeus.hydra.common.utils.ViewUtils; import static be.ugent.zeus.hydra.feed.HomeFeedFragment.PREF_DISABLED_CARD_TYPES; @@ -34,8 +32,8 @@ */ public class HomeFeedSelectFragment extends Fragment { - private FeedOptionsAdapter adapter; private final Map valueMapper = new HashMap<>(); + private FeedOptionsAdapter adapter; @Nullable @Override @@ -67,7 +65,7 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat List cardTypesList = Arrays.asList(ints); - Set unwanted = StreamSupport.stream(PreferencesUtils.getStringSet(getContext(), PREF_DISABLED_CARD_TYPES)) + Set unwanted = PreferencesUtils.getStringSet(getContext(), PREF_DISABLED_CARD_TYPES).stream() .map(cardTypesList::indexOf) .filter(integer -> integer != -1) // Non-existing ones are gone .collect(Collectors.toSet()); diff --git a/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFragment.java b/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFragment.java index e5065e4a6..45e199d16 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/feed/preferences/HomeFragment.java @@ -30,14 +30,46 @@ public class HomeFragment extends PreferenceFragment { public static final String PREF_DATA_SAVER = "pref_home_feed_save_data"; public static final boolean PREF_DATA_SAVER_DEFAULT = false; - + private static final String PREF_RESTO_KINDS = "pref_feed_resto_kinds"; + private static final String PREF_RESTO_KINDS_DEFAULT = FeedRestoKind.ALL; private DeleteViewModel viewModel; + @MenuTable.DisplayKind + public static int getFeedRestoKind(Context context) { + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); + @FeedRestoKind + String value = pref.getString(PREF_RESTO_KINDS, PREF_RESTO_KINDS_DEFAULT); + + switch (value) { + case FeedRestoKind.SOUP: + return MenuTable.DisplayKind.SOUP; + case FeedRestoKind.MAIN: + return MenuTable.DisplayKind.MAIN; + case FeedRestoKind.ALL: + default: + // Don't show vegetables. + return MenuTable.DisplayKind.ALL & ~MenuTable.DisplayKind.VEGETABLES; + } + } + + @FeedRestoKind + public static String getFeedRestoKindRaw(Context context) { + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); + return pref.getString(PREF_RESTO_KINDS, PREF_RESTO_KINDS_DEFAULT); + } + + public static void setFeedRestoKind(Context context, @FeedRestoKind String kind) { + SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); + pref.edit() + .putString(PREF_RESTO_KINDS, kind) + .apply(); + } + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.pref_home_feed, rootKey); - + } @Override @@ -58,9 +90,6 @@ protected void onUnhandled(Context data) { return v; } - private static final String PREF_RESTO_KINDS = "pref_feed_resto_kinds"; - private static final String PREF_RESTO_KINDS_DEFAULT = FeedRestoKind.ALL; - /** * The possible values for the {@link #PREF_RESTO_KINDS} preference. These are also defined in an XML array * resource. @@ -72,35 +101,4 @@ protected void onUnhandled(Context data) { String SOUP = "soup"; String MAIN = "main"; } - - @MenuTable.DisplayKind - public static int getFeedRestoKind(Context context) { - SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); - @FeedRestoKind - String value = pref.getString(PREF_RESTO_KINDS, PREF_RESTO_KINDS_DEFAULT); - - switch (value) { - case FeedRestoKind.SOUP: - return MenuTable.DisplayKind.SOUP; - case FeedRestoKind.MAIN: - return MenuTable.DisplayKind.MAIN; - case FeedRestoKind.ALL: - default: - // Don't show vegetables. - return MenuTable.DisplayKind.ALL & ~MenuTable.DisplayKind.VEGETABLES; - } - } - - @FeedRestoKind - public static String getFeedRestoKindRaw(Context context) { - SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); - return pref.getString(PREF_RESTO_KINDS, PREF_RESTO_KINDS_DEFAULT); - } - - public static void setFeedRestoKind(Context context, @FeedRestoKind String kind) { - SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); - pref.edit() - .putString(PREF_RESTO_KINDS, kind) - .apply(); - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/info/InfoItem.java b/app/src/main/java/be/ugent/zeus/hydra/info/InfoItem.java index e6324c590..a477b7478 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/info/InfoItem.java +++ b/app/src/main/java/be/ugent/zeus/hydra/info/InfoItem.java @@ -4,8 +4,7 @@ import android.os.Parcelable; import java.util.List; - -import java9.util.Objects; +import java.util.Objects; import com.squareup.moshi.Json; @@ -18,6 +17,17 @@ @SuppressWarnings("unused") public final class InfoItem implements Parcelable { + public static final Creator CREATOR = new Creator() { + @Override + public InfoItem createFromParcel(Parcel in) { + return new InfoItem(in); + } + + @Override + public InfoItem[] newArray(int size) { + return new InfoItem[size]; + } + }; private String title; private String image; private String html; @@ -27,6 +37,19 @@ public final class InfoItem implements Parcelable { @Json(name = "subcontent") private List subContent; + public InfoItem() { + // Used by Moshi. + } + + protected InfoItem(Parcel in) { + title = in.readString(); + image = in.readString(); + html = in.readString(); + url = in.readString(); + urlAndroid = in.readString(); + subContent = in.createTypedArrayList(CREATOR); + } + public String getTitle() { return title; } @@ -90,31 +113,6 @@ public InfoType getType() { } } - public InfoItem() { - // Used by Moshi. - } - - protected InfoItem(Parcel in) { - title = in.readString(); - image = in.readString(); - html = in.readString(); - url = in.readString(); - urlAndroid = in.readString(); - subContent = in.createTypedArrayList(CREATOR); - } - - public static final Creator CREATOR = new Creator() { - @Override - public InfoItem createFromParcel(Parcel in) { - return new InfoItem(in); - } - - @Override - public InfoItem[] newArray(int size) { - return new InfoItem[size]; - } - }; - @Override public int describeContents() { return 0; diff --git a/app/src/main/java/be/ugent/zeus/hydra/info/InfoListAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/info/InfoListAdapter.java index 379464ef0..2562a765d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/info/InfoListAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/info/InfoListAdapter.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.info; -import androidx.annotation.NonNull; import android.view.ViewGroup; +import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.customtabs.ActivityHelper; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.DiffAdapter; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * Adapter for the list of information items. diff --git a/app/src/main/java/be/ugent/zeus/hydra/info/InfoRequest.java b/app/src/main/java/be/ugent/zeus/hydra/info/InfoRequest.java index 545527c4c..b54ec51b9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/info/InfoRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/info/InfoRequest.java @@ -3,11 +3,12 @@ import android.content.Context; import androidx.annotation.NonNull; +import java.time.Duration; +import java.time.temporal.ChronoUnit; + import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; -import org.threeten.bp.Duration; -import org.threeten.bp.temporal.ChronoUnit; /** * Request to get the information from the Zeus API. @@ -23,12 +24,6 @@ class InfoRequest extends JsonArrayRequest { this.context = context.getApplicationContext(); } - @NonNull - @Override - protected String getAPIUrl() { - return getBaseApiUrl(context) + "info-content.json"; - } - /** * Get the base API path for information. This is locale aware. */ @@ -37,6 +32,12 @@ static String getBaseApiUrl(Context context) { return Endpoints.ZEUS_V2 + "info/" + infoEndpoint + "/"; } + @NonNull + @Override + protected String getAPIUrl() { + return getBaseApiUrl(context) + "info-content.json"; + } + @Override public Duration getCacheDuration() { return ChronoUnit.WEEKS.getDuration().multipliedBy(4); diff --git a/app/src/main/java/be/ugent/zeus/hydra/info/InfoSubItemActivity.java b/app/src/main/java/be/ugent/zeus/hydra/info/InfoSubItemActivity.java index 86dedb2e6..362fd9ef5 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/info/InfoSubItemActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/info/InfoSubItemActivity.java @@ -3,12 +3,12 @@ import android.content.Intent; import android.os.Bundle; +import java.util.ArrayList; + import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.ui.BaseActivity; import be.ugent.zeus.hydra.databinding.ActivityInfoSubItemBinding; -import java.util.ArrayList; - public class InfoSubItemActivity extends BaseActivity { public static final String INFO_TITLE = "be.ugent.zeus.hydra.infoTitle"; diff --git a/app/src/main/java/be/ugent/zeus/hydra/info/InfoType.java b/app/src/main/java/be/ugent/zeus/hydra/info/InfoType.java index d857fb767..902a37702 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/info/InfoType.java +++ b/app/src/main/java/be/ugent/zeus/hydra/info/InfoType.java @@ -9,13 +9,13 @@ import androidx.annotation.DrawableRes; import androidx.annotation.Nullable; +import java.util.ArrayList; + import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.WebViewActivity; import be.ugent.zeus.hydra.common.ui.customtabs.ActivityHelper; import be.ugent.zeus.hydra.common.utils.NetworkUtils; - -import java.util.ArrayList; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * The type of information (external url/app, internal url, ...). @@ -76,8 +76,8 @@ public void doOnClick(Context context, ActivityHelper helper, InfoItem infoItem) } }; - private final int drawable; private static final int NO_DRAWABLE = 0; + private final int drawable; /** * @param drawable The ID of the vector drawable. @@ -96,7 +96,7 @@ public void doOnClick(Context context, ActivityHelper helper, InfoItem infoItem) /** * Get the drawable for this category. * - * @param context The context. + * @param context The context. * @param attribute The attribute to colour the drawable in. * * @return The drawable or null if there is no drawable. @@ -115,7 +115,7 @@ public Drawable getDrawable(Context context, @AttrRes int attribute) { /** * The intent to be started for this type. * - * @param context The context to launch the intent. + * @param context The context to launch the intent. * @param infoItem The item. */ public abstract void doOnClick(Context context, ActivityHelper helper, InfoItem infoItem); diff --git a/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewHolder.java index 290ee7fb7..a4fb69ddb 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewHolder.java @@ -8,9 +8,9 @@ import android.widget.TextView; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.customtabs.ActivityHelper; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * View holder for info items. diff --git a/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewModel.java index 926fd5ee0..6af9880f4 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/info/InfoViewModel.java @@ -1,13 +1,13 @@ package be.ugent.zeus.hydra.info; import android.app.Application; - import androidx.annotation.NonNull; -import be.ugent.zeus.hydra.common.request.Request; -import be.ugent.zeus.hydra.common.ui.RequestViewModel; import java.util.List; +import be.ugent.zeus.hydra.common.request.Request; +import be.ugent.zeus.hydra.common.ui.RequestViewModel; + /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/Library.java b/app/src/main/java/be/ugent/zeus/hydra/library/Library.java index c53c817a0..78eda4e7c 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/Library.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/Library.java @@ -3,19 +3,18 @@ import android.content.Context; import android.os.Parcel; import android.os.Parcelable; +import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; -import android.text.TextUtils; import java.util.List; import java.util.Locale; +import java.util.Objects; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.common.converter.IntBoolean; import be.ugent.zeus.hydra.common.utils.NetworkUtils; import com.squareup.moshi.Json; -import java9.util.Objects; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; /** * Model for a library. @@ -27,9 +26,19 @@ @SuppressWarnings("WeakerAccess") public final class Library implements Parcelable { + public static final Creator CREATOR = new Creator() { + @Override + public Library createFromParcel(Parcel source) { + return new Library(source); + } + + @Override + public Library[] newArray(int size) { + return new Library[size]; + } + }; private static final String FALLBACK_HEADER = "https://picsum.photos/800/450?image=1073"; private static final String FALLBACK_HEADER_SMALL = "https://picsum.photos/400/225?image=1073"; - private String department; private String email; private List address; @@ -55,13 +64,34 @@ public final class Library implements Parcelable { private String campus; private String faculty; private String link; - private boolean favourite; public Library() { // No-args constructor } + protected Library(Parcel in) { + this.department = in.readString(); + this.email = in.readString(); + this.address = in.createStringArrayList(); + this.name = in.readString(); + this.code = in.readString(); + this.telephone = in.createStringArrayList(); + this.active = in.readByte() != 0; + this.thumbnail = in.readString(); + this.image = in.readString(); + this.latitude = in.readString(); + this.longitude = in.readString(); + this.comments = in.createStringArrayList(); + this.contact = in.readString(); + this.campus = in.readString(); + this.faculty = in.readString(); + this.link = in.readString(); + this.favourite = in.readByte() != 0; + this.nameEnglish = in.readString(); + this.nameDutch = in.readString(); + } + public String getDepartment() { return department; } @@ -92,17 +122,19 @@ public void setTestName(String name) { this.nameDutch = name; } + public String getCode() { + return code; + } + @VisibleForTesting public void setCode(String code) { this.code = code; } - public String getCode() { - return code; + public boolean isFacultyBib() { + return this.name.contains("Faculteitsbibliotheek"); } - public boolean isFacultyBib() { return this.name.contains("Faculteitsbibliotheek"); } - public List getTelephone() { return telephone; } @@ -150,7 +182,8 @@ public String getCommentsAsString() { if (comments == null) { return null; } else { - return StreamSupport.stream(comments).collect(Collectors.joining()); + //noinspection SimplifyStreamApiCallChains + return comments.stream().collect(Collectors.joining()); } } @@ -161,7 +194,8 @@ public String getPhones() { if (getTelephone() == null) { return null; } else { - return StreamSupport.stream(getTelephone()).collect(Collectors.joining("; ")); + //noinspection SimplifyStreamApiCallChains + return getTelephone().stream().collect(Collectors.joining("; ")); } } @@ -201,7 +235,8 @@ public String addressAsString() { if (getAddress() == null) { return ""; } else { - return StreamSupport.stream(getAddress()).collect(Collectors.joining("\n")); + //noinspection SimplifyStreamApiCallChains + return getAddress().stream().collect(Collectors.joining("\n")); } } @@ -252,38 +287,4 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.nameEnglish); dest.writeString(this.nameDutch); } - - protected Library(Parcel in) { - this.department = in.readString(); - this.email = in.readString(); - this.address = in.createStringArrayList(); - this.name = in.readString(); - this.code = in.readString(); - this.telephone = in.createStringArrayList(); - this.active = in.readByte() != 0; - this.thumbnail = in.readString(); - this.image = in.readString(); - this.latitude = in.readString(); - this.longitude = in.readString(); - this.comments = in.createStringArrayList(); - this.contact = in.readString(); - this.campus = in.readString(); - this.faculty = in.readString(); - this.link = in.readString(); - this.favourite = in.readByte() != 0; - this.nameEnglish = in.readString(); - this.nameDutch = in.readString(); - } - - public static final Creator CREATOR = new Creator() { - @Override - public Library createFromParcel(Parcel source) { - return new Library(source); - } - - @Override - public Library[] newArray(int size) { - return new Library[size]; - } - }; } diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/details/FavouriteViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/library/details/FavouriteViewModel.java index 9dd4c292c..0639ec430 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/details/FavouriteViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/details/FavouriteViewModel.java @@ -14,8 +14,8 @@ */ public class FavouriteViewModel extends AndroidViewModel { - private Library library; private final FavouritesRepository repository; + private Library library; public FavouriteViewModel(@NonNull Application application) { super(application); diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/details/HoursViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/library/details/HoursViewModel.java index 5ce2c1be3..bc2339d30 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/details/HoursViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/details/HoursViewModel.java @@ -1,15 +1,14 @@ package be.ugent.zeus.hydra.library.details; import android.app.Application; - import androidx.annotation.NonNull; +import java.util.List; + import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.ui.RequestViewModel; import be.ugent.zeus.hydra.library.Library; -import java.util.List; - /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/details/LibraryDetailActivity.java b/app/src/main/java/be/ugent/zeus/hydra/library/details/LibraryDetailActivity.java index 2731d4ed1..d34475de6 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/details/LibraryDetailActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/details/LibraryDetailActivity.java @@ -23,9 +23,7 @@ import java.util.ArrayList; import java.util.List; - -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.arch.observers.PartialErrorObserver; @@ -273,7 +271,8 @@ private String makeFullAddressText() { parts.add(campus); } parts.addAll(library.getAddress()); - return StreamSupport.stream(parts).collect(Collectors.joining("\n")); + //noinspection SimplifyStreamApiCallChains + return parts.stream().collect(Collectors.joining("\n")); } private void onError(Throwable throwable) { diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHours.java b/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHours.java index 65428a6ba..586aa7b9e 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHours.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHours.java @@ -1,8 +1,9 @@ package be.ugent.zeus.hydra.library.details; +import java.time.LocalDate; +import java.util.Objects; + import com.squareup.moshi.Json; -import java9.util.Objects; -import org.threeten.bp.LocalDate; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHoursRequest.java b/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHoursRequest.java index ccf0b9530..919712ae7 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHoursRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/details/OpeningHoursRequest.java @@ -3,15 +3,14 @@ import android.content.Context; import androidx.annotation.NonNull; -import java9.util.Optional; -import java9.util.stream.StreamSupport; +import java.time.Duration; +import java.time.LocalDate; +import java.util.Optional; import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.library.Library; -import org.threeten.bp.Duration; -import org.threeten.bp.LocalDate; /** * Get the opening hours for one library. @@ -43,7 +42,7 @@ protected String getAPIUrl() { } public Request> forDay(LocalDate date) { - return map(openingHours -> StreamSupport.stream(openingHours) + return map(openingHours -> openingHours.stream() .filter(o -> date.equals(o.getDate())) .findFirst()); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/favourites/FavouritesTable.java b/app/src/main/java/be/ugent/zeus/hydra/library/favourites/FavouritesTable.java index 1ce58779a..a9ea699e0 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/favourites/FavouritesTable.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/favourites/FavouritesTable.java @@ -10,12 +10,12 @@ */ public final class FavouritesTable { + public static final String TABLE_NAME = "library_favourites"; + private FavouritesTable() { // No instances. } - public static final String TABLE_NAME = "library_favourites"; - public interface Columns { String LIBRARY_ID = "id"; String LIBRARY_NAME = "name"; diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/favourites/LibraryFavourite.java b/app/src/main/java/be/ugent/zeus/hydra/library/favourites/LibraryFavourite.java index 8eeb7d178..a1ffca4dc 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/favourites/LibraryFavourite.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/favourites/LibraryFavourite.java @@ -5,7 +5,7 @@ import androidx.room.Entity; import androidx.room.PrimaryKey; -import java9.util.Objects; +import java.util.Objects; import be.ugent.zeus.hydra.library.Library; @@ -38,6 +38,11 @@ public LibraryFavourite(@NonNull String name, @NonNull String code) { this.code = code; } + @NonNull + public static LibraryFavourite from(@NonNull Library library) { + return new LibraryFavourite(library.getName(), library.getCode()); + } + @NonNull public String getCode() { return code; @@ -60,9 +65,4 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(code); } - - @NonNull - public static LibraryFavourite from(@NonNull Library library) { - return new LibraryFavourite(library.getName(), library.getCode()); - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryList.java b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryList.java index 72fd59d69..b801ed529 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryList.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryList.java @@ -4,8 +4,7 @@ import android.os.Parcelable; import java.util.List; - -import java9.util.Objects; +import java.util.Objects; import be.ugent.zeus.hydra.library.Library; import com.squareup.moshi.Json; @@ -17,12 +16,32 @@ */ public final class LibraryList implements Parcelable { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public LibraryList createFromParcel(Parcel source) { + return new LibraryList(source); + } + + @Override + public LibraryList[] newArray(int size) { + return new LibraryList[size]; + } + }; private String name; @Json(name = "libraries_total") private int totalLibraries; - private List libraries; + @SuppressWarnings("unused") // Used by Moshi. + public LibraryList() { + } + + private LibraryList(Parcel in) { + this.name = in.readString(); + this.libraries = in.createTypedArrayList(Library.CREATOR); + this.totalLibraries = in.readInt(); + } + public String getName() { return name; } @@ -62,26 +81,4 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeTypedList(this.libraries); dest.writeInt(totalLibraries); } - - @SuppressWarnings("unused") // Used by Moshi. - public LibraryList() { - } - - private LibraryList(Parcel in) { - this.name = in.readString(); - this.libraries = in.createTypedArrayList(Library.CREATOR); - this.totalLibraries = in.readInt(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public LibraryList createFromParcel(Parcel source) { - return new LibraryList(source); - } - - @Override - public LibraryList[] newArray(int size) { - return new LibraryList[size]; - } - }; } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListAdapter.java index 51e8282e3..12efae5f3 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListAdapter.java @@ -11,9 +11,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; - -import java9.util.Optional; -import java9.util.stream.StreamSupport; +import java.util.Optional; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.request.Result; @@ -60,7 +58,7 @@ void registerListener(Library library, Observer>> void unregisterListener(Observer>> listener) { // Find the pair. - StreamSupport.stream(listeners) + listeners.stream() .filter(p -> p.second == listener) .findFirst().ifPresent(p -> { p.first.removeObserver(p.second); diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListRequest.java b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListRequest.java index d1a38bd67..6b84b05c6 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryListRequest.java @@ -3,10 +3,11 @@ import android.content.Context; import androidx.annotation.NonNull; +import java.time.Duration; +import java.time.temporal.ChronoUnit; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonOkHttpRequest; -import org.threeten.bp.Duration; -import org.threeten.bp.temporal.ChronoUnit; /** * Get the list of libraries. diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryLiveData.java b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryLiveData.java index f29dd5835..bd9134839 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryLiveData.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryLiveData.java @@ -6,15 +6,12 @@ import androidx.lifecycle.Observer; import androidx.lifecycle.Transformations; +import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; - -import java9.util.Comparators; -import java9.util.Lists; -import java9.util.function.Function; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.function.Function; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.common.arch.data.RequestLiveData; import be.ugent.zeus.hydra.common.database.Database; @@ -33,6 +30,36 @@ class LibraryLiveData extends RequestLiveData>> impl super(context, makeRequest(context)); } + /** + * Construct the request we want to use. This method is static because we need to call it in the constructor. + * + * @param context The context. + * + * @return The request. + */ + private static Request>> makeRequest(Context context) { + + FavouritesRepository repository = Database.get(context).getFavouritesRepository(); + + return new LibraryListRequest(context).map(libraryList -> { + Set favourites = new HashSet<>(repository.getFavouriteIds()); + // We sort favourites first and then faculty libraries and then by name. + return libraryList.getLibraries().stream() + .map(library -> Pair.create(library, favourites.contains(library.getCode()))) + .sorted(Comparator.comparing(statusExtractor()).reversed() + .thenComparing(Comparator.comparing(libraryExtractor().andThen(Library::isFacultyBib)).reversed()) + .thenComparing(libraryExtractor().andThen(Library::getName))).collect(Collectors.toList()); + }); + } + + private static Function, Boolean> statusExtractor() { + return libraryBooleanPair -> libraryBooleanPair.second; + } + + private static Function, Library> libraryExtractor() { + return libraryBooleanPair -> libraryBooleanPair.first; + } + @Override protected void onActive() { super.onActive(); @@ -59,40 +86,4 @@ private void maybeUnregister() { public void onChanged(Integer integer) { loadData(); } - - /** - * Construct the request we want to use. This method is static because we need to call it in the constructor. - * - * @param context The context. - * - * @return The request. - */ - private static Request>> makeRequest(Context context) { - - FavouritesRepository repository = Database.get(context).getFavouritesRepository(); - - return new LibraryListRequest(context).map(libraryList -> { - Set favourites = new HashSet<>(repository.getFavouriteIds()); - List> libraries = StreamSupport.stream(libraryList.getLibraries()) - .map(library -> Pair.create(library, favourites.contains(library.getCode()))) - .collect(Collectors.toList()); - // We sort favourites first and then faculty libraries and then by name. - Lists.sort(libraries, Comparators.thenComparing( - Comparators.reversed(Comparators.comparing(statusExtractor())), - Comparators.thenComparing( - Comparators.reversed(Comparators.comparing(libraryExtractor().andThen(Library::isFacultyBib))), - Comparators.comparing(libraryExtractor().andThen(Library::getName)) - ))); - - return libraries; - }); - } - - private static Function, Boolean> statusExtractor() { - return libraryBooleanPair -> libraryBooleanPair.second; - } - - private static Function, Library> libraryExtractor() { - return libraryBooleanPair -> libraryBooleanPair.first; - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewHolder.java index f1b399ece..01c8a0ffa 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewHolder.java @@ -7,7 +7,7 @@ import androidx.annotation.Nullable; import androidx.lifecycle.Observer; -import java9.util.Optional; +import java.util.Optional; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.request.Result; diff --git a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewModel.java index a0fb9fa48..bc833939e 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/library/list/LibraryViewModel.java @@ -5,12 +5,11 @@ import android.util.Pair; import androidx.lifecycle.LiveData; +import java.time.LocalDate; import java.util.HashMap; import java.util.List; import java.util.Map; - -import java9.util.Maps; -import java9.util.Optional; +import java.util.Optional; import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; import be.ugent.zeus.hydra.common.arch.data.RequestLiveData; @@ -19,7 +18,6 @@ import be.ugent.zeus.hydra.library.Library; import be.ugent.zeus.hydra.library.details.OpeningHours; import be.ugent.zeus.hydra.library.details.OpeningHoursRequest; -import org.threeten.bp.LocalDate; /** * @author Niko Strijbol @@ -38,7 +36,7 @@ protected BaseLiveData>>> constructDataInstan } LiveData>> getOpeningHours(Library library) { - return Maps.computeIfAbsent(mapping, library.getCode(), s -> { + return mapping.computeIfAbsent(library.getCode(), s -> { OpeningHoursRequest request = new OpeningHoursRequest(getApplication(), library); LocalDate today = LocalDate.now(); return new RequestLiveData<>(getApplication(), request.forDay(today)); diff --git a/app/src/main/java/be/ugent/zeus/hydra/news/NewsAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/news/NewsAdapter.java index 42c763411..eb6d7d698 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/news/NewsAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/news/NewsAdapter.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.news; -import androidx.annotation.NonNull; import android.view.ViewGroup; +import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.customtabs.ActivityHelper; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.DiffAdapter; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsArticle.java b/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsArticle.java index b06461086..c4b59ebcd 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsArticle.java +++ b/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsArticle.java @@ -3,20 +3,31 @@ import android.os.Parcel; import android.os.Parcelable; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; import java.util.List; +import java.util.Objects; import be.ugent.zeus.hydra.common.ArticleViewer; import be.ugent.zeus.hydra.common.converter.DateTypeConverters; import be.ugent.zeus.hydra.common.utils.DateUtils; -import java9.util.Objects; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.OffsetDateTime; /** * @author Niko Strijbol */ public final class UgentNewsArticle implements Parcelable, ArticleViewer.Article { + public static final Creator CREATOR = new Creator() { + @Override + public UgentNewsArticle createFromParcel(Parcel source) { + return new UgentNewsArticle(source); + } + + @Override + public UgentNewsArticle[] newArray(int size) { + return new UgentNewsArticle[size]; + } + }; private String description; private List contributors; private String text; @@ -31,8 +42,24 @@ public final class UgentNewsArticle implements Parcelable, ArticleViewer.Article private String title; private List creators; - @SuppressWarnings("unused") // Moshi uses this! - public UgentNewsArticle() {} + public UgentNewsArticle() { + } + + protected UgentNewsArticle(Parcel in) { + this.description = in.readString(); + this.contributors = in.createStringArrayList(); + this.text = in.readString(); + this.subject = in.createStringArrayList(); + this.identifier = in.readString(); + this.effective = in.readString(); + this.language = in.readString(); + this.rights = in.readString(); + this.created = DateTypeConverters.toOffsetDateTime(in.readString()); + this.modified = DateTypeConverters.toOffsetDateTime(in.readString()); + this.expiration = in.readString(); + this.title = in.readString(); + this.creators = in.createStringArrayList(); + } public String getDescription() { return description; @@ -82,6 +109,10 @@ public OffsetDateTime getModified() { return modified; } + public void setModified(OffsetDateTime modified) { + this.modified = modified; + } + public String getExpiration() { return expiration; } @@ -100,10 +131,6 @@ public List getCreators() { return creators; } - public void setModified(OffsetDateTime modified) { - this.modified = modified; - } - @Override public int describeContents() { return 0; @@ -126,34 +153,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeStringList(this.creators); } - protected UgentNewsArticle(Parcel in) { - this.description = in.readString(); - this.contributors = in.createStringArrayList(); - this.text = in.readString(); - this.subject = in.createStringArrayList(); - this.identifier = in.readString(); - this.effective = in.readString(); - this.language = in.readString(); - this.rights = in.readString(); - this.created = DateTypeConverters.toOffsetDateTime(in.readString()); - this.modified = DateTypeConverters.toOffsetDateTime(in.readString()); - this.expiration = in.readString(); - this.title = in.readString(); - this.creators = in.createStringArrayList(); - } - - public static final Creator CREATOR = new Creator() { - @Override - public UgentNewsArticle createFromParcel(Parcel source) { - return new UgentNewsArticle(source); - } - - @Override - public UgentNewsArticle[] newArray(int size) { - return new UgentNewsArticle[size]; - } - }; - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsRequest.java b/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsRequest.java index 82f3d156c..70642eb1a 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/news/UgentNewsRequest.java @@ -4,14 +4,14 @@ import android.os.Bundle; import androidx.annotation.NonNull; +import java.time.Duration; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; import be.ugent.zeus.hydra.common.request.Result; -import java9.util.Comparators; -import org.threeten.bp.Duration; - -import java.util.Collections; -import java.util.List; /** * Request to get UGent news. @@ -28,7 +28,7 @@ public UgentNewsRequest(Context context) { @Override public Result> execute(@NonNull Bundle args) { return super.execute(args).map(ugentNewsItems -> { - Collections.sort(ugentNewsItems, Comparators.reversed(Comparators.comparing(UgentNewsArticle::getModified))); + Collections.sort(ugentNewsItems, Comparator.comparing(UgentNewsArticle::getModified).reversed()); return ugentNewsItems; }); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/onboarding/HomeFeedFragment.java b/app/src/main/java/be/ugent/zeus/hydra/onboarding/HomeFeedFragment.java index 456a5baef..fc7d98b6b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/onboarding/HomeFeedFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/onboarding/HomeFeedFragment.java @@ -1,18 +1,15 @@ package be.ugent.zeus.hydra.onboarding; import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.FragmentManager; - import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentManager; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.feed.preferences.HomeFeedSelectFragment; - import com.heinrichreimersoftware.materialintro.app.SlideFragment; /** diff --git a/app/src/main/java/be/ugent/zeus/hydra/onboarding/OnboardingActivity.java b/app/src/main/java/be/ugent/zeus/hydra/onboarding/OnboardingActivity.java index 4af744ef5..c06297943 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/onboarding/OnboardingActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/onboarding/OnboardingActivity.java @@ -1,13 +1,11 @@ package be.ugent.zeus.hydra.onboarding; import android.os.Bundle; - import androidx.annotation.Nullable; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.reporting.Event; import be.ugent.zeus.hydra.common.reporting.Reporting; - import com.heinrichreimersoftware.materialintro.app.IntroActivity; import com.heinrichreimersoftware.materialintro.slide.FragmentSlide; import com.heinrichreimersoftware.materialintro.slide.SimpleSlide; diff --git a/app/src/main/java/be/ugent/zeus/hydra/preferences/OverviewFragment.java b/app/src/main/java/be/ugent/zeus/hydra/preferences/OverviewFragment.java index 0a700fa9b..40150a165 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/preferences/OverviewFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/preferences/OverviewFragment.java @@ -9,8 +9,8 @@ import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.reporting.Reporting; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.utils.ColourUtils; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * Display an overview of the settings. diff --git a/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceActivity.java b/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceActivity.java index c009a5c30..67c9da1ec 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceActivity.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.os.Bundle; import android.os.Parcelable; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; @@ -26,6 +25,8 @@ public class PreferenceActivity extends BaseActivity public final static String ARG_FRAGMENT = "be.ugent.zeus.hydra.preferences.id"; private static final int settingsTitle = R.string.action_view_settings; + @Nullable + private PreferenceEntry entry; public static void start(@NonNull Context context, @Nullable PreferenceEntry entry) { Intent intent = new Intent(context, PreferenceActivity.class); @@ -35,9 +36,6 @@ public static void start(@NonNull Context context, @Nullable PreferenceEntry ent context.startActivity(intent); } - @Nullable - private PreferenceEntry entry; - @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceEntry.java b/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceEntry.java index 8d80f9e66..94bfa07d2 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceEntry.java +++ b/app/src/main/java/be/ugent/zeus/hydra/preferences/PreferenceEntry.java @@ -6,7 +6,7 @@ import androidx.annotation.StringRes; import androidx.fragment.app.Fragment; -import java9.util.function.Supplier; +import java.util.function.Supplier; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.association.preference.AssociationSelectionPreferenceFragment; @@ -55,15 +55,23 @@ public enum PreferenceEntry implements Parcelable { R.drawable.ic_info_outline, AboutFragment::new ); + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public PreferenceEntry createFromParcel(Parcel in) { + return PreferenceEntry.values()[in.readInt()]; + } + + @Override + public PreferenceEntry[] newArray(int size) { + return new PreferenceEntry[size]; + } + }; @StringRes private final int name; - @StringRes private final int description; - @DrawableRes private final int icon; - private final Supplier fragmentSupplier; PreferenceEntry(@StringRes int name, @StringRes int description, @DrawableRes int icon, Supplier fragmentSupplier) { @@ -100,16 +108,4 @@ public int describeContents() { public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.ordinal()); } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public PreferenceEntry createFromParcel(Parcel in) { - return PreferenceEntry.values()[in.readInt()]; - } - - @Override - public PreferenceEntry[] newArray(int size) { - return new PreferenceEntry[size]; - } - }; } diff --git a/app/src/main/java/be/ugent/zeus/hydra/preferences/ReportingFragment.java b/app/src/main/java/be/ugent/zeus/hydra/preferences/ReportingFragment.java index 091257e62..ca3c3f7de 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/preferences/ReportingFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/preferences/ReportingFragment.java @@ -1,7 +1,6 @@ package be.ugent.zeus.hydra.preferences; import android.os.Bundle; - import androidx.preference.PreferenceFragmentCompat; import be.ugent.zeus.hydra.R; diff --git a/app/src/main/java/be/ugent/zeus/hydra/preferences/ThemeFragment.java b/app/src/main/java/be/ugent/zeus/hydra/preferences/ThemeFragment.java index 5e7cf84c6..7c9a43a7b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/preferences/ThemeFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/preferences/ThemeFragment.java @@ -5,7 +5,6 @@ import android.os.Build; import android.os.Bundle; import android.widget.Toast; - import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatDelegate; import androidx.preference.ListPreference; @@ -28,6 +27,30 @@ public class ThemeFragment extends PreferenceFragment { private String existing = null; private String updated = null; + private static String defaultValue() { + if (Build.VERSION.SDK_INT < 29) { + return "battery"; + } else { + return "system"; + } + } + + @AppCompatDelegate.NightMode + public static int getNightMode(Context context) { + String value = PreferenceManager.getDefaultSharedPreferences(context).getString(PREF_THEME_NIGHT_MODE, defaultValue()); + switch (value) { + case "battery": + return AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; + case "dark": + return AppCompatDelegate.MODE_NIGHT_NO; + case "light": + return AppCompatDelegate.MODE_NIGHT_YES; + case "system": + default: + return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; + } + } + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.pref_theme, rootKey); @@ -70,30 +93,6 @@ public void onStop() { } } - private static String defaultValue() { - if (Build.VERSION.SDK_INT < 29) { - return "battery"; - } else { - return "system"; - } - } - - @AppCompatDelegate.NightMode - public static int getNightMode(Context context) { - String value = PreferenceManager.getDefaultSharedPreferences(context).getString(PREF_THEME_NIGHT_MODE, defaultValue()); - switch (value) { - case "battery": - return AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; - case "dark": - return AppCompatDelegate.MODE_NIGHT_NO; - case "light": - return AppCompatDelegate.MODE_NIGHT_YES; - case "system": - default: - return AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; - } - } - private static class ThemeChanged implements Event { private final String newValue; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoChoice.java b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoChoice.java index b0c291870..2ed979020 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoChoice.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoChoice.java @@ -1,6 +1,6 @@ package be.ugent.zeus.hydra.resto; -import java9.util.Objects; +import java.util.Objects; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMeal.java b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMeal.java index f8f2892ad..289975311 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMeal.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMeal.java @@ -3,8 +3,9 @@ import android.os.Parcel; import android.os.Parcelable; +import java.util.Objects; + import com.squareup.moshi.Json; -import java9.util.Objects; /** * Represents a meal. @@ -14,13 +15,32 @@ */ public final class RestoMeal implements Parcelable { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public RestoMeal createFromParcel(Parcel source) { + return new RestoMeal(source); + } + + @Override + public RestoMeal[] newArray(int size) { + return new RestoMeal[size]; + } + }; private String name; private String price; private MealType type; private String kind; - @SuppressWarnings("unused") // Moshi uses this. - public RestoMeal() {} + public RestoMeal() { + } + + private RestoMeal(Parcel in) { + this.name = in.readString(); + this.price = in.readString(); + int tmpType = in.readInt(); + this.type = tmpType == -1 ? null : MealType.values()[tmpType]; + this.kind = in.readString(); + } public String getName() { return name; @@ -54,14 +74,6 @@ public void setType(MealType type) { this.type = type; } - // TODO: replace by string to make extensible, as required per the API docs - public enum MealType { - @Json(name = "main") - MAIN, - @Json(name = "side") - SIDE - } - @Override public int describeContents() { return 0; @@ -75,26 +87,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.kind); } - private RestoMeal(Parcel in) { - this.name = in.readString(); - this.price = in.readString(); - int tmpType = in.readInt(); - this.type = tmpType == -1 ? null : MealType.values()[tmpType]; - this.kind = in.readString(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public RestoMeal createFromParcel(Parcel source) { - return new RestoMeal(source); - } - - @Override - public RestoMeal[] newArray(int size) { - return new RestoMeal[size]; - } - }; - @Override public boolean equals(Object o) { if (this == o) return true; @@ -110,4 +102,12 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(name, price, type, kind); } + + // TODO: replace by string to make extensible, as required per the API docs + public enum MealType { + @Json(name = "main") + MAIN, + @Json(name = "side") + SIDE + } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMenu.java b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMenu.java index 7c81d2e4a..4b79cbb2f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMenu.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoMenu.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.resto; -import java.util.ArrayList; -import java.util.List; - import android.os.Parcel; import android.os.Parcelable; -import java9.util.Objects; -import org.threeten.bp.LocalDate; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; /** * Represents a menu for a single day. @@ -16,6 +16,17 @@ */ public final class RestoMenu implements Parcelable { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public RestoMenu createFromParcel(Parcel source) { + return new RestoMenu(source); + } + + @Override + public RestoMenu[] newArray(int size) { + return new RestoMenu[size]; + } + }; private boolean open; private LocalDate date; private List meals; @@ -24,10 +35,17 @@ public final class RestoMenu implements Parcelable { private List vegetables; private String message; - @SuppressWarnings("unused") // Moshi uses this. public RestoMenu() { } + protected RestoMenu(Parcel in) { + this.open = in.readByte() != 0; + this.date = (LocalDate) in.readSerializable(); + this.meals = in.createTypedArrayList(RestoMeal.CREATOR); + this.vegetables = in.createStringArrayList(); + this.message = in.readString(); + } + /** * Sort the meals available in the menu. */ @@ -138,24 +156,4 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeStringList(this.vegetables); dest.writeString(this.message); } - - protected RestoMenu(Parcel in) { - this.open = in.readByte() != 0; - this.date = (LocalDate) in.readSerializable(); - this.meals = in.createTypedArrayList(RestoMeal.CREATOR); - this.vegetables = in.createStringArrayList(); - this.message = in.readString(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public RestoMenu createFromParcel(Parcel source) { - return new RestoMenu(source); - } - - @Override - public RestoMenu[] newArray(int size) { - return new RestoMenu[size]; - } - }; } diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoPreferenceFragment.java b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoPreferenceFragment.java index f36f54051..3fb0bb725 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/RestoPreferenceFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/RestoPreferenceFragment.java @@ -12,8 +12,6 @@ import java.util.Arrays; import java.util.List; -import java9.util.stream.StreamSupport; - import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.arch.observers.SuccessObserver; import be.ugent.zeus.hydra.common.reporting.Reporting; @@ -42,6 +40,15 @@ public class RestoPreferenceFragment extends PreferenceFragment { public static final String DEFAULT_CLOSING_TIME = "21:00"; public static final String PREF_RESTO_CLOSING_HOUR = "pref_resto_closing_hour"; + public static String getDefaultResto(Context context) { + return context.getString(R.string.value_resto_default_endpoint); + } + + public static String getRestoEndpoint(Context context, SharedPreferences preferences) { + String defaultResto = getDefaultResto(context); + return preferences.getString(PREF_RESTO_KEY, defaultResto); + } + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.pref_resto, rootKey); @@ -58,15 +65,6 @@ public void onResume() { .setCurrentScreen(requireActivity(), "Settings > Resto", getClass().getSimpleName()); } - public static String getDefaultResto(Context context) { - return context.getString(R.string.value_resto_default_endpoint); - } - - public static String getRestoEndpoint(Context context, SharedPreferences preferences) { - String defaultResto = getDefaultResto(context); - return preferences.getString(PREF_RESTO_KEY, defaultResto); - } - @Override public void onDisplayPreferenceDialog(Preference preference) { @@ -86,7 +84,7 @@ private void receiveResto(@NonNull List restos) { ListPreference selector = requirePreference("pref_choice_resto_select"); selector.setVisible(true); - String[] names = StreamSupport.stream(restos) + String[] names = restos.stream() .map(RestoChoice::getName) .toArray(String[]::new); selector.setEntries(names); diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/SingleDayFragment.java b/app/src/main/java/be/ugent/zeus/hydra/resto/SingleDayFragment.java index 6a38154b1..12adf15b3 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/SingleDayFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/SingleDayFragment.java @@ -50,14 +50,14 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, return view; } - public void setData(RestoMenu data) { - this.data = data; - } - public RestoMenu getData() { return data; } + public void setData(RestoMenu data) { + this.data = data; + } + @Override public void onResume() { super.onResume(); diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFood.java b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFood.java index fef8db216..817d9cd9d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFood.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFood.java @@ -1,8 +1,7 @@ package be.ugent.zeus.hydra.resto.extrafood; import java.util.List; - -import java9.util.Objects; +import java.util.Objects; /** * Contains all extra food items. @@ -19,14 +18,26 @@ List getBreakfast() { return breakfast; } + public void setBreakfast(List breakfast) { + this.breakfast = breakfast; + } + List getDesserts() { return desserts; } + public void setDesserts(List desserts) { + this.desserts = desserts; + } + List getDrinks() { return drinks; } + public void setDrinks(List drinks) { + this.drinks = drinks; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -41,16 +52,4 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(breakfast, desserts, drinks); } - - public void setDrinks(List drinks) { - this.drinks = drinks; - } - - public void setDesserts(List desserts) { - this.desserts = desserts; - } - - public void setBreakfast(List breakfast) { - this.breakfast = breakfast; - } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodRequest.java b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodRequest.java index b62ee2e4a..f307b9c68 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodRequest.java @@ -3,10 +3,11 @@ import android.content.Context; import androidx.annotation.NonNull; +import java.time.Duration; +import java.time.temporal.ChronoUnit; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonOkHttpRequest; -import org.threeten.bp.Duration; -import org.threeten.bp.temporal.ChronoUnit; /** * Request to get the extra food. diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodViewModel.java index 84427b775..b6d2e82c2 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/ExtraFoodViewModel.java @@ -1,14 +1,14 @@ package be.ugent.zeus.hydra.resto.extrafood; import android.app.Application; - import androidx.annotation.NonNull; + +import java.util.List; + import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.ui.AdapterOutOfBoundsException; import be.ugent.zeus.hydra.common.ui.RequestViewModel; -import java.util.List; - /** * @author Niko Strijbol */ @@ -18,17 +18,12 @@ public ExtraFoodViewModel(Application application) { super(application); } - @NonNull - @Override - protected Request getRequest() { - return new ExtraFoodRequest(getApplication()); - } - /** * Gets the data depending on the position of the tab. Must agree with the {@link ExtraFoodPagerAdapter}. * * @param position The position. Must be [0-2]. - * @param data The data. + * @param data The data. + * * @return The result. */ static List getFor(int position, ExtraFood data) { @@ -43,4 +38,10 @@ static List getFor(int position, ExtraFood data) { throw new AdapterOutOfBoundsException(position, 3); } } + + @NonNull + @Override + protected Request getRequest() { + return new ExtraFoodRequest(getApplication()); + } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/Food.java b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/Food.java index 90ec4cb72..dba2334de 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/Food.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/Food.java @@ -3,7 +3,7 @@ import android.os.Parcel; import android.os.Parcelable; -import java9.util.Objects; +import java.util.Objects; /** * Represents a food item. A food item is defined by the tuple ({@link #name}, {@link #price}). The {@link #equals(Object)} and @@ -13,9 +13,25 @@ */ public final class Food implements Parcelable { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public Food createFromParcel(Parcel source) { + return new Food(source); + } + + @Override + public Food[] newArray(int size) { + return new Food[size]; + } + }; private String name; private String price; + protected Food(Parcel in) { + this.name = in.readString(); + this.price = in.readString(); + } + public String getName() { return name; } @@ -46,7 +62,6 @@ public int hashCode() { return Objects.hash(name, price); } - @Override public int describeContents() { return 0; @@ -57,21 +72,4 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.name); dest.writeString(this.price); } - - protected Food(Parcel in) { - this.name = in.readString(); - this.price = in.readString(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public Food createFromParcel(Parcel source) { - return new Food(source); - } - - @Override - public Food[] newArray(int size) { - return new Food[size]; - } - }; } diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/FoodAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/FoodAdapter.java index d774d1bb8..4addd2826 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/FoodAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/extrafood/FoodAdapter.java @@ -1,11 +1,11 @@ package be.ugent.zeus.hydra.resto.extrafood; -import androidx.annotation.NonNull; import android.view.ViewGroup; +import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.DiffAdapter; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * Adapter for food items. diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/history/DayRequest.java b/app/src/main/java/be/ugent/zeus/hydra/resto/history/DayRequest.java index 91d088d3a..d7a53504d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/history/DayRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/history/DayRequest.java @@ -3,8 +3,7 @@ import android.content.Context; import androidx.annotation.NonNull; -import org.threeten.bp.LocalDate; - +import java.time.LocalDate; import java.util.Locale; import be.ugent.zeus.hydra.common.network.Endpoints; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/history/HistoryActivity.java b/app/src/main/java/be/ugent/zeus/hydra/resto/history/HistoryActivity.java index d1caca73e..873b9063b 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/history/HistoryActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/history/HistoryActivity.java @@ -12,6 +12,9 @@ import androidx.fragment.app.FragmentManager; import androidx.lifecycle.ViewModelProvider; +import java.time.LocalDate; +import java.time.Month; +import java.time.ZoneId; import java.util.List; import be.ugent.zeus.hydra.R; @@ -28,9 +31,6 @@ import be.ugent.zeus.hydra.resto.SingleDayFragment; import be.ugent.zeus.hydra.resto.meta.selectable.SelectableMetaViewModel; import be.ugent.zeus.hydra.resto.meta.selectable.SelectedResto; -import org.threeten.bp.LocalDate; -import org.threeten.bp.Month; -import org.threeten.bp.ZoneId; public class HistoryActivity extends BaseActivity diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayLiveData.java b/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayLiveData.java index 12ec05347..2b62fadcf 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayLiveData.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayLiveData.java @@ -4,11 +4,12 @@ import android.content.SharedPreferences; import androidx.preference.PreferenceManager; +import java.time.LocalDate; + import be.ugent.zeus.hydra.common.arch.data.RequestLiveData; import be.ugent.zeus.hydra.resto.RestoChoice; import be.ugent.zeus.hydra.resto.RestoMenu; import be.ugent.zeus.hydra.resto.RestoPreferenceFragment; -import org.threeten.bp.LocalDate; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayViewModel.java index 96a4a49e8..4b802df4f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/history/SingleDayViewModel.java @@ -2,12 +2,13 @@ import android.app.Application; +import java.time.LocalDate; + import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.common.ui.RefreshViewModel; import be.ugent.zeus.hydra.resto.RestoChoice; import be.ugent.zeus.hydra.resto.RestoMenu; -import org.threeten.bp.LocalDate; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/LegendFragment.java b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/LegendFragment.java index 319c58469..c9c2bcabb 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/LegendFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/LegendFragment.java @@ -1,17 +1,17 @@ package be.ugent.zeus.hydra.resto.menu; import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.reporting.Reporting; import be.ugent.zeus.hydra.common.reporting.BaseEvents; import be.ugent.zeus.hydra.common.reporting.Event; +import be.ugent.zeus.hydra.common.reporting.Reporting; import be.ugent.zeus.hydra.resto.RestoMenu; /** diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuFilter.java b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuFilter.java index 532e9de91..c117f4b48 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuFilter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuFilter.java @@ -2,24 +2,21 @@ import android.content.Context; import android.content.SharedPreferences; -import androidx.preference.PreferenceManager; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; +import androidx.preference.PreferenceManager; + +import java.time.Clock; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.resto.RestoMenu; import be.ugent.zeus.hydra.resto.RestoPreferenceFragment; -import java9.util.function.Function; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; - -import org.threeten.bp.Clock; -import org.threeten.bp.LocalDate; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.LocalTime; - -import java.util.List; - /** * Filters a list of menu's to only retain the useful ones. * @@ -78,7 +75,7 @@ public List apply(@NonNull List restoMenus) { LocalDate today = LocalDate.now(clock); boolean isEarlyEnough = LocalDateTime.now(clock).isBefore(LocalDateTime.of(today, closingHour)); - return StreamSupport.stream(restoMenus) + return restoMenus.stream() .filter(m -> m.getDate().isAfter(today) || (m.getDate().isEqual(today) && isEarlyEnough)) .collect(Collectors.toList()); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuPagerAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuPagerAdapter.java index 7ef5c7755..07159f686 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuPagerAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuPagerAdapter.java @@ -7,14 +7,14 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentStatePagerAdapter; +import java.time.LocalDate; import java.util.Collections; import java.util.List; import be.ugent.zeus.hydra.R; +import be.ugent.zeus.hydra.common.utils.DateUtils; import be.ugent.zeus.hydra.resto.RestoMenu; import be.ugent.zeus.hydra.resto.SingleDayFragment; -import be.ugent.zeus.hydra.common.utils.DateUtils; -import org.threeten.bp.LocalDate; /** * This class provides the tabs in the resto activity. @@ -23,8 +23,8 @@ */ class MenuPagerAdapter extends FragmentStatePagerAdapter { - private List data = Collections.emptyList(); private final Context context; + private List data = Collections.emptyList(); MenuPagerAdapter(FragmentManager fm, Context context) { super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT); diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuRequest.java b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuRequest.java index 9d46d8ec9..65e8a6bc3 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuRequest.java @@ -6,13 +6,13 @@ import androidx.annotation.VisibleForTesting; import androidx.preference.PreferenceManager; +import java.time.Duration; import java.util.Locale; import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; import be.ugent.zeus.hydra.resto.RestoMenu; import be.ugent.zeus.hydra.resto.RestoPreferenceFragment; -import org.threeten.bp.Duration; /** * Request for the menu's of the resto's. diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuViewModel.java index 92ec338cc..dd2a55b98 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/MenuViewModel.java @@ -2,13 +2,13 @@ import android.app.Application; +import java.util.List; + import be.ugent.zeus.hydra.common.arch.data.BaseLiveData; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.common.ui.RefreshViewModel; import be.ugent.zeus.hydra.resto.RestoMenu; -import java.util.List; - /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/RestoFragment.java b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/RestoFragment.java index 3d1e2b53e..d4597ba32 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/menu/RestoFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/menu/RestoFragment.java @@ -13,6 +13,7 @@ import androidx.preference.PreferenceManager; import androidx.viewpager.widget.ViewPager; +import java.time.LocalDate; import java.util.Collections; import java.util.List; @@ -36,7 +37,6 @@ import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.tabs.TabLayout; -import org.threeten.bp.LocalDate; import static be.ugent.zeus.hydra.common.utils.FragmentUtils.requireBaseActivity; @@ -51,10 +51,8 @@ public class RestoFragment extends Fragment implements BottomNavigationView.OnNavigationItemSelectedListener, MainActivity.ScheduledRemovalListener { - private static final String TAG = "RestoFragment"; - public static final String ARG_DATE = "start_date"; - + private static final String TAG = "RestoFragment"; private static final String ARG_POSITION = "arg_pos"; private static final String URL = "https://www.ugent.be/student/nl/meer-dan-studeren/resto"; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaRequest.java b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaRequest.java index 016710272..2add52d33 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaRequest.java @@ -3,10 +3,11 @@ import android.content.Context; import androidx.annotation.NonNull; +import java.time.Duration; +import java.time.temporal.ChronoUnit; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonOkHttpRequest; -import org.threeten.bp.Duration; -import org.threeten.bp.temporal.ChronoUnit; /** * Request for meta information about the resto. diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaViewModel.java index 5d25db04f..bf28bf89d 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/MetaViewModel.java @@ -1,8 +1,8 @@ package be.ugent.zeus.hydra.resto.meta; import android.app.Application; - import androidx.annotation.NonNull; + import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.ui.RequestViewModel; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/Resto.java b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/Resto.java index c27681063..206cf412a 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/Resto.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/Resto.java @@ -4,7 +4,7 @@ import android.os.Parcelable; import androidx.annotation.Nullable; -import java9.util.Objects; +import java.util.Objects; /** * A restaurant. @@ -14,6 +14,17 @@ @SuppressWarnings("WeakerAccess") public final class Resto implements Parcelable { + public static final Creator CREATOR = new Creator() { + @Override + public Resto createFromParcel(Parcel in) { + return new Resto(in); + } + + @Override + public Resto[] newArray(int size) { + return new Resto[size]; + } + }; private String name; private String address; private double latitude; @@ -50,18 +61,6 @@ public int describeContents() { return 0; } - public static final Creator CREATOR = new Creator() { - @Override - public Resto createFromParcel(Parcel in) { - return new Resto(in); - } - - @Override - public Resto[] newArray(int size) { - return new Resto[size]; - } - }; - public String getName() { return name; } diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/RestoMeta.java b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/RestoMeta.java index 12e583c39..88f537be4 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/RestoMeta.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/RestoMeta.java @@ -4,20 +4,34 @@ import android.os.Parcelable; import java.util.List; - -import java9.util.Objects; +import java.util.Objects; /** * Created by feliciaan on 04/02/16. */ public final class RestoMeta implements Parcelable { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public RestoMeta createFromParcel(Parcel source) { + return new RestoMeta(source); + } + + @Override + public RestoMeta[] newArray(int size) { + return new RestoMeta[size]; + } + }; public List locations; @SuppressWarnings("unused") // Used by Moshi. public RestoMeta() { } + private RestoMeta(Parcel in) { + this.locations = in.createTypedArrayList(Resto.CREATOR); + } + @Override public int describeContents() { return 0; @@ -28,22 +42,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeTypedList(this.locations); } - private RestoMeta(Parcel in) { - this.locations = in.createTypedArrayList(Resto.CREATOR); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public RestoMeta createFromParcel(Parcel source) { - return new RestoMeta(source); - } - - @Override - public RestoMeta[] newArray(int size) { - return new RestoMeta[size]; - } - }; - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaRequest.java b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaRequest.java index 2995e94dd..e81ade8ab 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaRequest.java @@ -2,19 +2,18 @@ import android.content.Context; import android.os.Bundle; -import androidx.annotation.NonNull; import android.text.TextUtils; +import androidx.annotation.NonNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.request.Result; import be.ugent.zeus.hydra.resto.RestoChoice; import be.ugent.zeus.hydra.resto.meta.MetaRequest; import be.ugent.zeus.hydra.resto.meta.RestoMeta; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; - -import java.util.ArrayList; -import java.util.List; /** * @author Niko Strijbol @@ -30,7 +29,7 @@ public SelectableMetaRequest(Context context) { @NonNull @Override public Result> execute(@NonNull Bundle args) { - return resultRequest.execute(args).map(restoMeta -> StreamSupport.stream(restoMeta.locations) + return resultRequest.execute(args).map(restoMeta -> restoMeta.locations.stream() .filter(resto -> !TextUtils.isEmpty(resto.getEndpoint())) .map(resto -> new RestoChoice(resto.getName(), resto.getEndpoint())) .collect(Collectors.toCollection(ArrayList::new))); diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaViewModel.java index 8c0bbefd3..a7aa6c88a 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectableMetaViewModel.java @@ -1,14 +1,14 @@ package be.ugent.zeus.hydra.resto.meta.selectable; import android.app.Application; - import androidx.annotation.NonNull; + +import java.util.List; + import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.ui.RequestViewModel; import be.ugent.zeus.hydra.resto.RestoChoice; -import java.util.List; - /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectedResto.java b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectedResto.java index 91f2c8768..18b1ce976 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectedResto.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/meta/selectable/SelectedResto.java @@ -5,10 +5,8 @@ import androidx.preference.PreferenceManager; import java.util.List; - -import java9.util.Objects; -import java9.util.stream.Collectors; -import java9.util.stream.StreamSupport; +import java.util.Objects; +import java.util.stream.Collectors; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.resto.RestoChoice; @@ -58,10 +56,6 @@ public void setData(List receivedRestos) { } } - public void setSelected(RestoChoice selected) { - this.selected = selected; - } - public int getSelectedIndex() { return selectedIndex; } @@ -70,8 +64,12 @@ public RestoChoice getSelected() { return selected; } + public void setSelected(RestoChoice selected) { + this.selected = selected; + } + public List getAsWrappers() { - return StreamSupport.stream(choices).map(Wrapper::new).collect(Collectors.toList()); + return choices.stream().map(Wrapper::new).collect(Collectors.toList()); } public static class Wrapper { diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/SandwichActivity.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/SandwichActivity.java index 565d8637f..032d21053 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/SandwichActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/SandwichActivity.java @@ -15,7 +15,7 @@ /** * Activity for the sandwiches. */ -public class SandwichActivity extends BaseActivity{ +public class SandwichActivity extends BaseActivity { public static final String URL = "https://www.ugent.be/student/nl/meer-dan-studeren/resto/broodjes"; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalAdapter.java index 992ca1e51..1eb879b9f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalAdapter.java @@ -4,8 +4,8 @@ import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.MultiSelectAdapter; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * Adapter for sandwiches. diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalRequest.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalRequest.java index 577bad628..db3bfe2d1 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalRequest.java @@ -4,16 +4,14 @@ import android.os.Bundle; import androidx.annotation.NonNull; -import java.util.Collections; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.Comparator; import java.util.List; -import java9.util.Comparators; - import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; import be.ugent.zeus.hydra.common.request.Result; -import org.threeten.bp.Duration; -import org.threeten.bp.temporal.ChronoUnit; /** * Get the ecological sandwich of the week. @@ -30,7 +28,7 @@ class EcologicalRequest extends JsonArrayRequest { @Override public Result> execute(@NonNull Bundle args) { return super.execute(args).map(sandwiches -> { - Collections.sort(sandwiches, Comparators.comparing(EcologicalSandwich::getStart)); + sandwiches.sort(Comparator.comparing(EcologicalSandwich::getStart)); return sandwiches; }); } diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalSandwich.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalSandwich.java index 2833c8300..0d41bb001 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalSandwich.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalSandwich.java @@ -3,11 +3,9 @@ import android.os.Parcel; import android.os.Parcelable; +import java.time.LocalDate; import java.util.List; - -import java9.util.Objects; - -import org.threeten.bp.LocalDate; +import java.util.Objects; /** * Ecological sandwich of the week. @@ -15,13 +13,36 @@ @SuppressWarnings("WeakerAccess") public final class EcologicalSandwich implements Parcelable { + public static final Creator CREATOR = new Creator() { + @Override + public EcologicalSandwich createFromParcel(Parcel source) { + return new EcologicalSandwich(source); + } + + @Override + public EcologicalSandwich[] newArray(int size) { + return new EcologicalSandwich[size]; + } + }; private String name; private boolean vegan; private List ingredients; - private LocalDate start; private LocalDate end; + @SuppressWarnings("unused") + public EcologicalSandwich() { + // Json + } + + protected EcologicalSandwich(Parcel in) { + this.name = in.readString(); + this.ingredients = in.createStringArrayList(); + this.start = (LocalDate) in.readSerializable(); + this.end = (LocalDate) in.readSerializable(); + this.vegan = in.readInt() == 1; + } + public String getName() { return name; } @@ -56,31 +77,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.vegan ? 1 : 0); } - @SuppressWarnings("unused") - public EcologicalSandwich() { - // Json - } - - protected EcologicalSandwich(Parcel in) { - this.name = in.readString(); - this.ingredients = in.createStringArrayList(); - this.start = (LocalDate) in.readSerializable(); - this.end = (LocalDate) in.readSerializable(); - this.vegan = in.readInt() == 1; - } - - public static final Creator CREATOR = new Creator() { - @Override - public EcologicalSandwich createFromParcel(Parcel source) { - return new EcologicalSandwich(source); - } - - @Override - public EcologicalSandwich[] newArray(int size) { - return new EcologicalSandwich[size]; - } - }; - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewHolder.java index 1d80c7e35..039a7a890 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewHolder.java @@ -5,7 +5,6 @@ import android.text.TextUtils; import android.view.View; import android.widget.TextView; - import androidx.appcompat.content.res.AppCompatResources; import be.ugent.zeus.hydra.R; @@ -45,7 +44,7 @@ public void populate(EcologicalSandwich sandwich) { Drawable image = AppCompatResources.getDrawable(c, R.drawable.resto_vegan); name.setCompoundDrawablesWithIntrinsicBounds(null, null, image, null); } else { - name.setCompoundDrawables(null ,null, null, null); + name.setCompoundDrawables(null, null, null, null); } dates.setText(String.format(c.getString(R.string.date_between), start, end)); String ingredientsString = TextUtils.join(", ", sandwich.getIngredients()); diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewModel.java index 77e3e603c..9b72cf51f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/ecological/EcologicalViewModel.java @@ -1,10 +1,10 @@ package be.ugent.zeus.hydra.resto.sandwich.ecological; import android.app.Application; +import androidx.annotation.NonNull; import java.util.List; -import androidx.annotation.NonNull; import be.ugent.zeus.hydra.common.request.Request; import be.ugent.zeus.hydra.common.ui.RequestViewModel; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularAdapter.java index 79d82287d..cf08f7a41 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularAdapter.java @@ -1,11 +1,11 @@ package be.ugent.zeus.hydra.resto.sandwich.regular; -import androidx.annotation.NonNull; import android.view.ViewGroup; +import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.MultiSelectAdapter; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * Adapter for sandwiches. diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularRequest.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularRequest.java index f56d10233..6fae0a343 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularRequest.java @@ -4,14 +4,14 @@ import android.os.Bundle; import androidx.annotation.NonNull; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.Collections; +import java.util.List; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; import be.ugent.zeus.hydra.common.request.Result; -import org.threeten.bp.Duration; -import org.threeten.bp.temporal.ChronoUnit; - -import java.util.Collections; -import java.util.List; /** * CacheRequest the list of sandwiches. diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularSandwich.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularSandwich.java index b6a0abf9a..cf8dfffd8 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularSandwich.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularSandwich.java @@ -4,9 +4,9 @@ import android.os.Parcelable; import java.util.List; +import java.util.Objects; import com.squareup.moshi.Json; -import java9.util.Objects; /** * Created by feliciaan on 04/02/16. @@ -14,6 +14,17 @@ @SuppressWarnings("WeakerAccess") public final class RegularSandwich implements Parcelable { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + @Override + public RegularSandwich createFromParcel(Parcel source) { + return new RegularSandwich(source); + } + + @Override + public RegularSandwich[] newArray(int size) { + return new RegularSandwich[size]; + } + }; private String name; private List ingredients; @Json(name = "price_small") @@ -21,6 +32,18 @@ public final class RegularSandwich implements Parcelable { @Json(name = "price_medium") private String priceMedium; + @SuppressWarnings("unused") + public RegularSandwich() { + + } + + public RegularSandwich(Parcel in) { + this.name = in.readString(); + this.ingredients = in.createStringArrayList(); + this.priceSmall = in.readString(); + this.priceMedium = in.readString(); + } + public String getName() { return name; } @@ -50,30 +73,6 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.priceMedium); } - @SuppressWarnings("unused") - public RegularSandwich() { - - } - - public RegularSandwich(Parcel in) { - this.name = in.readString(); - this.ingredients = in.createStringArrayList(); - this.priceSmall = in.readString(); - this.priceMedium = in.readString(); - } - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - @Override - public RegularSandwich createFromParcel(Parcel source) { - return new RegularSandwich(source); - } - - @Override - public RegularSandwich[] newArray(int size) { - return new RegularSandwich[size]; - } - }; - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularViewModel.java index 00a6b24c3..d4f577168 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/resto/sandwich/regular/RegularViewModel.java @@ -1,13 +1,13 @@ package be.ugent.zeus.hydra.resto.sandwich.regular; import android.app.Application; - import androidx.annotation.NonNull; -import be.ugent.zeus.hydra.common.request.Request; -import be.ugent.zeus.hydra.common.ui.RequestViewModel; import java.util.List; +import be.ugent.zeus.hydra.common.request.Request; +import be.ugent.zeus.hydra.common.ui.RequestViewModel; + /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/schamper/Article.java b/app/src/main/java/be/ugent/zeus/hydra/schamper/Article.java index bb609341e..c26ba27bf 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/schamper/Article.java +++ b/app/src/main/java/be/ugent/zeus/hydra/schamper/Article.java @@ -4,6 +4,9 @@ import android.os.Parcelable; import android.text.TextUtils; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -11,23 +14,29 @@ import be.ugent.zeus.hydra.common.converter.DateTypeConverters; import be.ugent.zeus.hydra.common.utils.DateUtils; import com.squareup.moshi.Json; -import java9.util.Objects; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.OffsetDateTime; /** * A Schamper article. * - * @see The Schamper website - * * @author Niko Strijbol * @author Feliciaan + * @see The Schamper website */ @SuppressWarnings("unused") public final class Article implements Parcelable, ArticleViewer.Article { - private static final Pattern IMAGE_REPLACEMENT = Pattern.compile("/regulier/", Pattern.LITERAL); + public static final Creator

    CREATOR = new Creator
    () { + @Override + public Article createFromParcel(Parcel in) { + return new Article(in); + } + @Override + public Article[] newArray(int size) { + return new Article[size]; + } + }; + private static final Pattern IMAGE_REPLACEMENT = Pattern.compile("/regulier/", Pattern.LITERAL); private String title; private String link; @Json(name = "pub_date") @@ -43,6 +52,22 @@ public final class Article implements Parcelable, ArticleViewer.Article { public Article() { } + private Article(Parcel in) { + title = in.readString(); + link = in.readString(); + pubDate = DateTypeConverters.toOffsetDateTime(in.readString()); + author = in.readString(); + body = in.readString(); + image = in.readString(); + category = in.readString(); + intro = in.readString(); + categoryColour = in.readString(); + } + + static String getLargeImage(String url) { + return IMAGE_REPLACEMENT.matcher(url).replaceAll(Matcher.quoteReplacement("/preview/")); + } + @Override public String getTitle() { return title; @@ -90,17 +115,13 @@ public boolean hasCategoryColour() { } public String getLargeImage() { - if(getImage() != null) { + if (getImage() != null) { return getLargeImage(getImage()); } else { return null; } } - static String getLargeImage(String url) { - return IMAGE_REPLACEMENT.matcher(url).replaceAll(Matcher.quoteReplacement("/preview/")); - } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -119,18 +140,6 @@ public int hashCode() { return Objects.hash(link, pubDate); } - private Article(Parcel in) { - title = in.readString(); - link = in.readString(); - pubDate = DateTypeConverters.toOffsetDateTime(in.readString()); - author = in.readString(); - body = in.readString(); - image = in.readString(); - category = in.readString(); - intro = in.readString(); - categoryColour = in.readString(); - } - @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(title); @@ -148,16 +157,4 @@ public void writeToParcel(Parcel dest, int flags) { public int describeContents() { return 0; } - - public static final Creator
    CREATOR = new Creator
    () { - @Override - public Article createFromParcel(Parcel in) { - return new Article(in); - } - - @Override - public Article[] newArray(int size) { - return new Article[size]; - } - }; } diff --git a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperArticlesRequest.java b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperArticlesRequest.java index 686e2c822..ded7f663f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperArticlesRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperArticlesRequest.java @@ -3,10 +3,10 @@ import android.content.Context; import androidx.annotation.NonNull; +import java.time.Duration; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; -import be.ugent.zeus.hydra.schamper.Article; -import org.threeten.bp.Duration; /** * Request to get Schamper articles. diff --git a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperListAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperListAdapter.java index 8eff04d27..2f5672ffd 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperListAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperListAdapter.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.schamper; -import androidx.annotation.NonNull; import android.view.ViewGroup; +import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.customtabs.ActivityHelper; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.DiffAdapter; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewHolder.java index 7aaa77f09..17c3d6e80 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewHolder.java @@ -1,16 +1,16 @@ package be.ugent.zeus.hydra.schamper; import android.graphics.Color; -import androidx.annotation.ColorInt; -import androidx.cardview.widget.CardView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.ColorInt; +import androidx.cardview.widget.CardView; import be.ugent.zeus.hydra.R; +import be.ugent.zeus.hydra.common.ArticleViewer; import be.ugent.zeus.hydra.common.ui.customtabs.ActivityHelper; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; -import be.ugent.zeus.hydra.common.ArticleViewer; import be.ugent.zeus.hydra.common.utils.ColourUtils; import be.ugent.zeus.hydra.common.utils.DateUtils; import be.ugent.zeus.hydra.common.utils.NetworkUtils; @@ -32,11 +32,16 @@ class SchamperViewHolder extends DataViewHolder
    { private final ActivityHelper helper; - @ColorInt private final int initialTitleColour; - @ColorInt private final int initialDateColour; - @ColorInt private final int initialAuthorColour; - @ColorInt private final int initialCategoryColour; - @ColorInt private final int initialCardViewColour; + @ColorInt + private final int initialTitleColour; + @ColorInt + private final int initialDateColour; + @ColorInt + private final int initialAuthorColour; + @ColorInt + private final int initialCategoryColour; + @ColorInt + private final int initialCardViewColour; SchamperViewHolder(View itemView, ActivityHelper helper) { super(itemView); diff --git a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewModel.java index eecc859b9..09dd4f0d6 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/schamper/SchamperViewModel.java @@ -1,13 +1,13 @@ package be.ugent.zeus.hydra.schamper; import android.app.Application; - import androidx.annotation.NonNull; -import be.ugent.zeus.hydra.common.request.Request; -import be.ugent.zeus.hydra.common.ui.RequestViewModel; import java.util.List; +import be.ugent.zeus.hydra.common.request.Request; +import be.ugent.zeus.hydra.common.ui.RequestViewModel; + /** * @author Niko Strijbol */ diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/Artist.java b/app/src/main/java/be/ugent/zeus/hydra/sko/Artist.java index bb10fb791..0fad5871c 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/Artist.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/Artist.java @@ -5,16 +5,15 @@ import android.os.Parcel; import android.os.Parcelable; import android.provider.CalendarContract; - import androidx.annotation.Nullable; -import java9.util.Objects; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.utils.DateUtils; -import org.threeten.bp.LocalDateTime; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; /** * An SKO artist. @@ -25,8 +24,18 @@ */ final class Artist implements Parcelable { - private static final String LOCATION = "Sint-Pietersplein, Gent"; + public static final Creator CREATOR = new Creator() { + @Override + public Artist createFromParcel(Parcel source) { + return new Artist(source); + } + @Override + public Artist[] newArray(int size) { + return new Artist[size]; + } + }; + private static final String LOCATION = "Sint-Pietersplein, Gent"; private String name; private String title; private OffsetDateTime start; @@ -37,6 +46,21 @@ final class Artist implements Parcelable { private String stage; private int index; + public Artist() { + } + + protected Artist(Parcel in) { + this.name = in.readString(); + this.title = in.readString(); + this.start = (OffsetDateTime) in.readSerializable(); + this.end = (OffsetDateTime) in.readSerializable(); + this.image = in.readString(); + this.content = in.readString(); + this.stage = in.readString(); + this.description = in.readString(); + this.index = in.readInt(); + } + /** * @return The name of the act. */ @@ -207,31 +231,4 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.description); dest.writeInt(this.index); } - - public Artist() { - } - - protected Artist(Parcel in) { - this.name = in.readString(); - this.title = in.readString(); - this.start = (OffsetDateTime) in.readSerializable(); - this.end = (OffsetDateTime) in.readSerializable(); - this.image = in.readString(); - this.content = in.readString(); - this.stage = in.readString(); - this.description = in.readString(); - this.index = in.readInt(); - } - - public static final Creator CREATOR = new Creator() { - @Override - public Artist createFromParcel(Parcel source) { - return new Artist(source); - } - - @Override - public Artist[] newArray(int size) { - return new Artist[size]; - } - }; } diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistOrTitle.java b/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistOrTitle.java index fda4ae0e2..538e526ef 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistOrTitle.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistOrTitle.java @@ -2,7 +2,7 @@ import androidx.annotation.NonNull; -import java9.util.Objects; +import java.util.Objects; /** * Contains an artist or a title, but not both and not neither. diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistViewHolder.java b/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistViewHolder.java index a27598dac..3f59e528f 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistViewHolder.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/ArtistViewHolder.java @@ -1,13 +1,13 @@ package be.ugent.zeus.hydra.sko; import android.content.Intent; -import androidx.annotation.VisibleForTesting; import android.view.ContextMenu; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.TextView; +import androidx.annotation.VisibleForTesting; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupAdapter.java b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupAdapter.java index 2fc2cf2f6..826a25616 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupAdapter.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupAdapter.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.sko; -import androidx.annotation.NonNull; import android.view.ViewGroup; +import androidx.annotation.NonNull; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.utils.ViewUtils; import be.ugent.zeus.hydra.common.ui.recyclerview.adapters.DiffAdapter; import be.ugent.zeus.hydra.common.ui.recyclerview.viewholders.DataViewHolder; +import be.ugent.zeus.hydra.common.utils.ViewUtils; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupFragment.java b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupFragment.java index 761b307af..9b793adcc 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupFragment.java @@ -12,10 +12,8 @@ import java.util.List; import java.util.Map; - -import java9.util.stream.Collectors; -import java9.util.stream.Stream; -import java9.util.stream.StreamSupport; +import java.util.stream.Collectors; +import java.util.stream.Stream; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.arch.observers.PartialErrorObserver; @@ -71,16 +69,16 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat private void receiveData(@NonNull List data) { // Sort the artists into stages. - Map> stages = StreamSupport.stream(data) + Map> stages = data.stream() .collect(Collectors.groupingBy(Artist::getStage)); // Merge the sorted stages back into one flat list while prepending the stage as a title for each section. // This might be faster with a traditional loop, but streams are fancier. - List masterList = StreamSupport.stream(stages.entrySet()) + List masterList = stages.entrySet().stream() .flatMap(e -> Stream.concat( Stream.of(new ArtistOrTitle(e.getKey())), - StreamSupport.stream(e.getValue()).map(ArtistOrTitle::new) + e.getValue().stream().map(ArtistOrTitle::new) )) .collect(Collectors.toList()); diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupRequest.java b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupRequest.java index 61108ca5a..e191fbe69 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupRequest.java @@ -1,12 +1,12 @@ package be.ugent.zeus.hydra.sko; import android.content.Context; - import androidx.annotation.NonNull; +import java.time.Duration; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonArrayRequest; -import org.threeten.bp.Duration; /** * Request SKO lineup data. diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupViewModel.java b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupViewModel.java index 6874e4309..9085a0081 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/LineupViewModel.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/LineupViewModel.java @@ -2,11 +2,12 @@ import android.app.Application; import androidx.annotation.NonNull; -import be.ugent.zeus.hydra.common.request.Request; -import be.ugent.zeus.hydra.common.ui.RequestViewModel; import java.util.List; +import be.ugent.zeus.hydra.common.request.Request; +import be.ugent.zeus.hydra.common.ui.RequestViewModel; + /** * This class cannot be package private due to technical limitations. * diff --git a/app/src/main/java/be/ugent/zeus/hydra/sko/OverviewActivity.java b/app/src/main/java/be/ugent/zeus/hydra/sko/OverviewActivity.java index 7ff8bb7c7..611e2a955 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/sko/OverviewActivity.java +++ b/app/src/main/java/be/ugent/zeus/hydra/sko/OverviewActivity.java @@ -5,7 +5,6 @@ import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; - import androidx.annotation.Nullable; import be.ugent.zeus.hydra.R; diff --git a/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEvent.java b/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEvent.java index cec9cfeda..6ae07ac29 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEvent.java +++ b/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEvent.java @@ -5,10 +5,11 @@ import android.net.Uri; import androidx.annotation.NonNull; +import java.time.OffsetDateTime; +import java.util.Objects; + import be.ugent.zeus.hydra.sko.OverviewActivity; import com.squareup.moshi.Json; -import java9.util.Objects; -import org.threeten.bp.OffsetDateTime; /** * Model for special events. @@ -105,6 +106,10 @@ public boolean isDevelopment() { return development; } + public void setDevelopment(boolean development) { + this.development = development; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -138,8 +143,4 @@ public void setId(long id) { public void setInApp(String inApp) { this.inApp = inApp; } - - public void setDevelopment(boolean development) { - this.development = development; - } } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventRequest.java b/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventRequest.java index d017a3440..e1ed6ae08 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventRequest.java +++ b/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventRequest.java @@ -3,9 +3,10 @@ import android.content.Context; import androidx.annotation.NonNull; +import java.time.Duration; + import be.ugent.zeus.hydra.common.network.Endpoints; import be.ugent.zeus.hydra.common.network.JsonOkHttpRequest; -import org.threeten.bp.Duration; /** * Request to get special events (such as the 12urenloop). diff --git a/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventWrapper.java b/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventWrapper.java index 6937ddc02..400c024a8 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventWrapper.java +++ b/app/src/main/java/be/ugent/zeus/hydra/specialevent/SpecialEventWrapper.java @@ -4,9 +4,9 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import com.squareup.moshi.Json; -import java9.util.Objects; /** * Created by feliciaan on 06/04/16. diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/MusicService.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/MusicService.java index d4aeb43a3..892b4f8a9 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/MusicService.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/MusicService.java @@ -6,24 +6,27 @@ import android.content.Intent; import android.net.wifi.WifiManager; import android.os.Bundle; +import android.support.v4.media.MediaBrowserCompat; +import android.support.v4.media.session.MediaSessionCompat; +import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.NotificationManagerCompat; -import android.support.v4.media.MediaBrowserCompat; import androidx.core.content.ContextCompat; import androidx.media.MediaBrowserServiceCompat; import androidx.media.session.MediaButtonReceiver; -import android.support.v4.media.session.MediaSessionCompat; -import android.util.Log; + +import java.util.Collections; +import java.util.List; import be.ugent.zeus.hydra.MainActivity; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.common.reporting.Reporting; import be.ugent.zeus.hydra.common.reporting.Event; -import be.ugent.zeus.hydra.urgent.player.*; - -import java.util.Collections; -import java.util.List; +import be.ugent.zeus.hydra.common.reporting.Reporting; +import be.ugent.zeus.hydra.urgent.player.Player; +import be.ugent.zeus.hydra.urgent.player.PlayerSessionServiceCallback; +import be.ugent.zeus.hydra.urgent.player.SessionPlayerServiceCallback; +import be.ugent.zeus.hydra.urgent.player.UrgentTrackProvider; /** * Service for streaming audio from Urgent.fm. diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/ProgrammeInformation.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/ProgrammeInformation.java index 4881477e4..310d33303 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/ProgrammeInformation.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/ProgrammeInformation.java @@ -1,7 +1,8 @@ package be.ugent.zeus.hydra.urgent; +import java.util.Objects; + import com.squareup.moshi.Json; -import java9.util.Objects; /** * The information about a programme on Urgent.fm. diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentFragment.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentFragment.java index 16c268691..7e5207a22 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentFragment.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentFragment.java @@ -28,8 +28,8 @@ import java.util.List; import be.ugent.zeus.hydra.R; -import be.ugent.zeus.hydra.urgent.player.UrgentTrackProvider; import be.ugent.zeus.hydra.common.utils.NetworkUtils; +import be.ugent.zeus.hydra.urgent.player.UrgentTrackProvider; /** * Fragment that displays the Urgent.fm player, meaning controls and track information. Note that while we implement @@ -61,8 +61,35 @@ public class UrgentFragment extends Fragment { private View progressBar; private MediaBrowserCompat mediaBrowser; - private boolean shouldUpdateButton = false; + private final MediaBrowserCompat.ConnectionCallback connectionCallback = + new MediaBrowserCompat.ConnectionCallback() { + @Override + public void onConnected() { + mediaBrowser.subscribe(mediaBrowser.getRoot(), subscriptionCallback); + try { + MediaControllerCompat mediaController = + new MediaControllerCompat(requireActivity(), mediaBrowser.getSessionToken()); + MediaControllerCompat.setMediaController(requireActivity(), mediaController); + // Register a Callback to stay in sync + mediaController.registerCallback(mediaControllerCallback); + } catch (RemoteException e) { + Log.e(TAG, "Failed to connect to MediaController", e); + } + } + + @Override + public void onConnectionFailed() { + Log.e(TAG, "onConnectionFailed"); + } + + @Override + public void onConnectionSuspended() { + Log.d(TAG, "onConnectionSuspended"); + disconnect(); + } + }; + private boolean shouldUpdateButton = false; // Receive callbacks from the MediaController. Here we update our state such as which queue // is being shown, the current title and description and the PlaybackState. private final MediaControllerCompat.Callback mediaControllerCallback = new MediaControllerCompat.Callback() { @@ -83,7 +110,6 @@ public void onMetadataChanged(MediaMetadataCompat metadata) { readMetadata(metadata); } }; - private final MediaBrowserCompat.SubscriptionCallback subscriptionCallback = new MediaBrowserCompat.SubscriptionCallback() { @Override @@ -98,35 +124,6 @@ public void onError(@NonNull String id) { } }; - private final MediaBrowserCompat.ConnectionCallback connectionCallback = - new MediaBrowserCompat.ConnectionCallback() { - @Override - public void onConnected() { - mediaBrowser.subscribe(mediaBrowser.getRoot(), subscriptionCallback); - try { - MediaControllerCompat mediaController = - new MediaControllerCompat(requireActivity(), mediaBrowser.getSessionToken()); - MediaControllerCompat.setMediaController(requireActivity(), mediaController); - - // Register a Callback to stay in sync - mediaController.registerCallback(mediaControllerCallback); - } catch (RemoteException e) { - Log.e(TAG, "Failed to connect to MediaController", e); - } - } - - @Override - public void onConnectionFailed() { - Log.e(TAG, "onConnectionFailed"); - } - - @Override - public void onConnectionSuspended() { - Log.d(TAG, "onConnectionSuspended"); - disconnect(); - } - }; - @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_urgent, container, false); diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentInfo.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentInfo.java index 26079a1fb..d582b3189 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentInfo.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/UrgentInfo.java @@ -1,8 +1,9 @@ package be.ugent.zeus.hydra.urgent; +import java.time.ZonedDateTime; +import java.util.Objects; + import be.ugent.zeus.hydra.common.converter.LocalZonedDateTime; -import java9.util.Objects; -import org.threeten.bp.ZonedDateTime; /** * Information about the Urgent.fm stream. diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/InternalPlayer.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/InternalPlayer.java index dbb7180a0..ddbc3f448 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/InternalPlayer.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/InternalPlayer.java @@ -5,18 +5,16 @@ import android.media.MediaPlayer; import android.os.Build; import android.os.PowerManager; -import androidx.annotation.Nullable; -import androidx.media.AudioAttributesCompat; import android.support.v4.media.MediaMetadataCompat; import android.util.Log; - -import java9.lang.Iterables; -import java9.util.stream.IntStream; +import androidx.annotation.Nullable; +import androidx.media.AudioAttributesCompat; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.IntStream; import static be.ugent.zeus.hydra.urgent.player.MediaStateListener.State.*; @@ -28,20 +26,17 @@ class InternalPlayer { private static final String TAG = "InternalPlayer"; - + /** + * Listeners for this state. + */ + private final List listeners = new ArrayList<>(); /** * The current state of the media player. */ @MediaStateListener.State private int state = IDLE; - private MediaPlayer mediaPlayer; - /** - * Listeners for this state. - */ - private final List listeners = new ArrayList<>(); - InternalPlayer(Context context) { createNew(context); } @@ -78,7 +73,7 @@ void createNew(Context context) { * @param states One of these. */ private void checkStateIsOneOf(@MediaStateListener.State int... states) { - if (!IntStream.of(states).anyMatch(i -> i == state)) { + if (IntStream.of(states).noneMatch(i -> i == state)) { throw new IllegalStateException("Illegal state: " + state + ", allowed are " + Arrays.toString(states)); } } @@ -93,7 +88,9 @@ private void setState(@MediaStateListener.State int newState) { if (newState != state) { int oldState = this.state; this.state = newState; - Iterables.forEach(listeners, l -> l.onStateChanged(oldState, state)); + for (MediaStateListener l : listeners) { + l.onStateChanged(oldState, state); + } } } diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/MetadataListener.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/MetadataListener.java index a18b1f7ca..f6ac3e36e 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/MetadataListener.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/MetadataListener.java @@ -1,7 +1,7 @@ package be.ugent.zeus.hydra.urgent.player; -import androidx.annotation.Nullable; import android.support.v4.media.MediaMetadataCompat; +import androidx.annotation.Nullable; /** * @author Niko Strijbol diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/Player.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/Player.java index 76da76412..f91044122 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/Player.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/Player.java @@ -6,16 +6,15 @@ import android.media.AudioFocusRequest; import android.media.AudioManager; import android.os.Build; -import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; -import androidx.media.AudioAttributesCompat; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaSessionCompat; import android.util.Log; - -import java9.util.stream.IntStream; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; +import androidx.media.AudioAttributesCompat; import java.util.Objects; +import java.util.stream.IntStream; import static be.ugent.zeus.hydra.urgent.player.MediaStateListener.State.*; @@ -48,51 +47,41 @@ public class Player { private static final float MEDIA_VOLUME_DEFAULT = 1.0f; private static final float MEDIA_VOLUME_DUCK = 0.2f; - - /** - * Indicates if the player should start playing if the state becomes - * {@link be.ugent.zeus.hydra.urgent.player.MediaStateListener.State#PREPARED}. - * - * This is modifiable in this package. - */ - boolean shouldPlayWhenReady = false; - /** * The internal media player. */ private final InternalPlayer mediaPlayer; - /** * The internal audio manager. */ private final AudioManager audioManager; - /** * The internal audio attributes. */ private final AudioAttributesCompat audioAttributes; - /** * Listener for audio focus changes. */ private final AudioManager.OnAudioFocusChangeListener focusChangeListener; - + private final UrgentTrackProvider provider; + private final Context context; + private final MetadataListener metadataListener; + /** + * Indicates if the player should start playing if the state becomes + * {@link be.ugent.zeus.hydra.urgent.player.MediaStateListener.State#PREPARED}. + * + * This is modifiable in this package. + */ + boolean shouldPlayWhenReady = false; /** * Internal request. */ private AudioFocusRequest audioFocusRequest; - - private final UrgentTrackProvider provider; - - private final Context context; - /** * The volume we want. This is changed as a response to audio focus things. */ private float volume = MEDIA_VOLUME_DEFAULT; - private final MetadataListener metadataListener; - private Player(Context context, AudioManager manager, AudioAttributesCompat audioAttributes, diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/PlayerSessionCallback.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/PlayerSessionCallback.java index 5d3132f32..c31e2f3f1 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/PlayerSessionCallback.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/PlayerSessionCallback.java @@ -2,19 +2,18 @@ import android.os.Bundle; import android.os.Handler; -import androidx.annotation.NonNull; import android.support.v4.media.session.MediaSessionCompat; import android.util.Log; +import androidx.annotation.NonNull; -import org.threeten.bp.Instant; -import org.threeten.bp.temporal.ChronoUnit; +import java.time.Instant; +import java.time.temporal.ChronoUnit; /** * Connects a {@link Player} to a {@link MediaSessionCompat} with the callback, in one direction: it passes commands * from the media session to the player. * * @author Niko Strijbol - * * @see SessionPlayerCallback for the reverse mapping. */ class PlayerSessionCallback extends MediaSessionCompat.Callback { diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/SessionPlayerCallback.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/SessionPlayerCallback.java index 43c5daa63..72afbc143 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/SessionPlayerCallback.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/SessionPlayerCallback.java @@ -1,11 +1,11 @@ package be.ugent.zeus.hydra.urgent.player; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaSessionCompat; import android.support.v4.media.session.PlaybackStateCompat; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import static be.ugent.zeus.hydra.urgent.player.MediaStateListener.State.*; diff --git a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/UrgentTrackProvider.java b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/UrgentTrackProvider.java index b2e465f2a..17b807fcc 100644 --- a/app/src/main/java/be/ugent/zeus/hydra/urgent/player/UrgentTrackProvider.java +++ b/app/src/main/java/be/ugent/zeus/hydra/urgent/player/UrgentTrackProvider.java @@ -11,8 +11,7 @@ import java.io.IOException; import java.io.InputStream; - -import java9.util.function.Consumer; +import java.util.function.Consumer; import be.ugent.zeus.hydra.R; import be.ugent.zeus.hydra.common.network.InstanceProvider; @@ -28,12 +27,10 @@ */ public class UrgentTrackProvider { - static final String URGENT_ID = "be.ugent.zeus.hydra.urgent"; - public static final String METADATA_DESCRIPTION = "meta_description"; - - private MediaMetadataCompat track; + static final String URGENT_ID = "be.ugent.zeus.hydra.urgent"; private final Context context; + private MediaMetadataCompat track; UrgentTrackProvider(Context context) { this.context = context.getApplicationContext(); diff --git a/app/src/main/res/drawable-en/logo_ugent.xml b/app/src/main/res/drawable-en/logo_ugent.xml index 529ea9d3d..b2e7d11e1 100644 --- a/app/src/main/res/drawable-en/logo_ugent.xml +++ b/app/src/main/res/drawable-en/logo_ugent.xml @@ -1,9 +1,9 @@ + android:height="63.69533dp" + android:viewportWidth="73.26814" + android:viewportHeight="63.69533"> + android:fillColor="#1476C6" + android:pathData="M325.133 605.922H312.66v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M300.191 605.922h-12.472v-80.957h12.472v80.957" /> + android:fillColor="#1476C6" + android:pathData="M275.25 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M250.309 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M350.074 605.922h-12.472v-80.957h12.472v80.957" /> + android:fillColor="#1476C6" + android:pathData="M375.016 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M399.957 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M412.727 500.016H225.066v12.48h187.661v-12.48" /> + android:fillColor="#1476C6" + android:pathData="M399.957 618.395H237.836l-12.469 12.468h187.059l-12.469 -12.468" /> + android:fillColor="#1476C6" + android:pathData="M425.195 475.074H212.598v12.481h212.597v-12.481" /> + android:fillColor="#1476C6" + android:pathData="M425.195 651.035l-106.3 37.649 -106.297 -37.649v-13.242l106.297 37.641 106.3 -37.641v13.242" /> + android:fillColor="#1476C6" + android:pathData="M315.801 377.043h-26.86v-40.02h-12.48v88.172h12.48v-37.578h26.86v37.578h12.48v-88.172h-12.48v40.02" /> + android:fillColor="#1476C6" + android:pathData="M589.086 291.73c5.508 0.016 10.703 -1.789 13.086 -3.664v11.243c-2.383 1.464 -8.242 3.093 -14.18 3.093 -16.551 0 -25.664 -9.414 -25.664 -23.066 0 -11.387 4.824 -16.856 12.59 -23.555l7.098 -6.133c5.859 -4.902 9.492 -8.679 9.492 -16.015 0 -8.574 -5.664 -11.973 -14.168 -11.973 -6.445 0 -11.797 1.789 -14.883 3.918v-11.437c2.715 -1.563 8.367 -3.172 15.996 -3.153 16.512 0.039 25.625 9.422 25.645 23.067 0.011 11.375 -4.825 16.855 -12.59 23.543l-7.09 6.144c-5.879 5.028 -9.52 8.66 -9.5 15.985 0.023 8.613 5.645 11.984 14.168 12.003" /> + android:fillColor="#1476C6" + android:pathData="M512.457 290.195v-31.074h6.648c9.766 0 16.282 2.051 16.282 15.606 0 13.437 -6.516 15.468 -16.282 15.468zm-12.48 10.586h20.351c16.277 0 27.938 -6.113 27.938 -26.054 0 -13.965 -6.778 -20.743 -15.321 -23.868l18.719 -38.261h-14.246l-16.555 35.957h-8.406v-35.957h-12.48v88.183" /> + android:fillColor="#1476C6" + android:pathData="M212.598 239.191v61.582h12.48v-62.128c0 -13.028 4.477 -16.817 13.567 -16.817 9.089 0 13.562 3.789 13.562 16.817v62.128h12.481v-61.582c0 -20.078 -8.411 -28.222 -26.043 -28.222 -17.907 0 -26.047 7.871 -26.047 28.222" /> + android:fillColor="#1476C6" + android:pathData="M280.828 300.773h14.383l27.809 -70.265c-0.95 7.187 -1.766 15.597 -1.766 23.469v46.796h11.937v-88.175h-14.378l-28.083 70.539c1.086 -7.188 2.04 -15.735 2.04 -23.742v-46.797h-11.942v88.175" /> + android:fillColor="#1476C6" + android:pathData="M350.859 300.773h12.481v-88.175h-12.481v88.175" /> + android:fillColor="#1476C6" + android:pathData="M374.938 300.773h13.023l11.121 -45.851c1.633 -6.926 3.66 -18.582 4.883 -27.813 1.223 9.231 3.258 20.887 5.156 27.813l10.984 45.851h12.622L410.344 212.598H397.32l-22.382 88.175" /> + android:fillColor="#1476C6" + android:pathData="M444.32 300.773h41.243V290.188H456.801V263.195H480v-10.441h-23.199v-29.578h28.762V212.598H444.32v88.175" /> + android:fillColor="#1476C6" + android:pathData="M618.906 300.773h12.481v-88.175h-12.481v88.175" /> + android:fillColor="#1476C6" + android:pathData="M209.887 381.105c0 34.723 9.222 45.723 32.148 45.723 6.512 0 13.43 -1.769 16.41 -3.535V411.77c-3.25 1.89 -9.492 3.933 -15.461 3.933 -14.648 0 -20.211 -5.43 -20.211 -34.598 0 -28.886 3.938 -34.855 16.684 -34.855 3.938 0 7.188 0.535 9.629 1.223v29.433h-13.023v10.574h25.503v-47.609c-2.578 -1.629 -12.882 -4.48 -21.972 -4.48 -23.875 0 -29.707 12.48 -29.707 45.714" /> + android:fillColor="#1476C6" + android:pathData="M345.945 425.195h41.243V414.609H358.43v-26.992h23.195V377.18H358.43v-29.582h28.758v-10.575h-41.243v88.172" /> + android:fillColor="#1476C6" + android:pathData="M401.602 425.195h14.378l27.809 -70.261c-0.945 7.187 -1.762 15.593 -1.762 23.464v46.797h11.938v-88.172h-14.379l-28.082 70.536c1.086 -7.188 2.035 -15.731 2.035 -23.739v-46.797h-11.937v88.172" /> + android:fillColor="#1476C6" + android:pathData="M465.391 425.195h50.593v-10.586h-19.125v-77.586h-12.48v77.586h-18.988v10.586" /> + android:fillColor="#1476C6" + android:pathData="M722.906 249.219l-24.144 51.554h13.699l10.445 -23.742c2.442 -5.691 4.75 -11.797 6.239 -17.226 1.632 5.429 4.074 11.535 6.515 17.226l10.445 23.742h13.293l-24.011 -51.554v-36.621h-12.481v36.621" /> + android:fillColor="#1476C6" + android:pathData="M643.238 300.773h50.594v-10.585h-19.125v-77.59h-12.48v77.59h-18.989v10.585" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/gradient_black_bottom.xml b/app/src/main/res/drawable/gradient_black_bottom.xml index 9e00cf1f5..ab99e763c 100644 --- a/app/src/main/res/drawable/gradient_black_bottom.xml +++ b/app/src/main/res/drawable/gradient_black_bottom.xml @@ -2,8 +2,8 @@ + android:startColor="#99000000" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/gradient_black_bottom_top.xml b/app/src/main/res/drawable/gradient_black_bottom_top.xml index dd0754935..c00849549 100644 --- a/app/src/main/res/drawable/gradient_black_bottom_top.xml +++ b/app/src/main/res/drawable/gradient_black_bottom_top.xml @@ -2,8 +2,8 @@ + android:startColor="#99000000" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_album.xml b/app/src/main/res/drawable/ic_album.xml index 9cc85ec81..e45ef59c8 100644 --- a/app/src/main/res/drawable/ic_album.xml +++ b/app/src/main/res/drawable/ic_album.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,16.5c-2.49,0 -4.5,-2.01 -4.5,-4.5S9.51,7.5 12,7.5s4.5,2.01 4.5,4.5 -2.01,4.5 -4.5,4.5zM12,11c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1z" /> diff --git a/app/src/main/res/drawable/ic_calendar_clock.xml b/app/src/main/res/drawable/ic_calendar_clock.xml index f69186ea2..322065cb7 100644 --- a/app/src/main/res/drawable/ic_calendar_clock.xml +++ b/app/src/main/res/drawable/ic_calendar_clock.xml @@ -1,7 +1,9 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_email.xml b/app/src/main/res/drawable/ic_email.xml index ce97ab859..65f32169d 100644 --- a/app/src/main/res/drawable/ic_email.xml +++ b/app/src/main/res/drawable/ic_email.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z" /> diff --git a/app/src/main/res/drawable/ic_event_add.xml b/app/src/main/res/drawable/ic_event_add.xml index 4f50db349..4ed5565ff 100644 --- a/app/src/main/res/drawable/ic_event_add.xml +++ b/app/src/main/res/drawable/ic_event_add.xml @@ -1,7 +1,7 @@ + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/ic_food_variant.xml b/app/src/main/res/drawable/ic_food_variant.xml index 8bc6433fc..43f7d0399 100644 --- a/app/src/main/res/drawable/ic_food_variant.xml +++ b/app/src/main/res/drawable/ic_food_variant.xml @@ -1,7 +1,7 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z" /> diff --git a/app/src/main/res/drawable/ic_home.xml b/app/src/main/res/drawable/ic_home.xml index 70fb2910c..f8bb0b556 100644 --- a/app/src/main/res/drawable/ic_home.xml +++ b/app/src/main/res/drawable/ic_home.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" /> diff --git a/app/src/main/res/drawable/ic_info_outline.xml b/app/src/main/res/drawable/ic_info_outline.xml index cf53e145c..9c51a4ffb 100644 --- a/app/src/main/res/drawable/ic_info_outline.xml +++ b/app/src/main/res/drawable/ic_info_outline.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z" /> diff --git a/app/src/main/res/drawable/ic_library_music.xml b/app/src/main/res/drawable/ic_library_music.xml index 3de22fe82..6046503f8 100644 --- a/app/src/main/res/drawable/ic_library_music.xml +++ b/app/src/main/res/drawable/ic_library_music.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM18,7h-3v5.5c0,1.38 -1.12,2.5 -2.5,2.5S10,13.88 10,12.5s1.12,-2.5 2.5,-2.5c0.57,0 1.08,0.19 1.5,0.51L14,5h4v2zM4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6z" /> diff --git a/app/src/main/res/drawable/ic_multiline_chart.xml b/app/src/main/res/drawable/ic_multiline_chart.xml index d521bd0ef..4c42b0926 100644 --- a/app/src/main/res/drawable/ic_multiline_chart.xml +++ b/app/src/main/res/drawable/ic_multiline_chart.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M22,6.92l-1.41,-1.41 -2.85,3.21C15.68,6.4 12.83,5 9.61,5 6.72,5 4.07,6.16 2,8l1.42,1.42C5.12,7.93 7.27,7 9.61,7c2.74,0 5.09,1.26 6.77,3.24l-2.88,3.24 -4,-4L2,16.99l1.5,1.5 6,-6.01 4,4 4.05,-4.55c0.75,1.35 1.25,2.9 1.44,4.55H21c-0.22,-2.3 -0.95,-4.39 -2.04,-6.14L22,6.92z" /> diff --git a/app/src/main/res/drawable/ic_navigate_before.xml b/app/src/main/res/drawable/ic_navigate_before.xml index 4763a6452..03506e445 100644 --- a/app/src/main/res/drawable/ic_navigate_before.xml +++ b/app/src/main/res/drawable/ic_navigate_before.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z" /> diff --git a/app/src/main/res/drawable/ic_navigate_next.xml b/app/src/main/res/drawable/ic_navigate_next.xml index e7c0b53ac..8dbbbabfc 100644 --- a/app/src/main/res/drawable/ic_navigate_next.xml +++ b/app/src/main/res/drawable/ic_navigate_next.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z" /> diff --git a/app/src/main/res/drawable/ic_news.xml b/app/src/main/res/drawable/ic_news.xml index c4ef18461..c574c2420 100644 --- a/app/src/main/res/drawable/ic_news.xml +++ b/app/src/main/res/drawable/ic_news.xml @@ -1,7 +1,7 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M8,5v14l11,-7z" /> diff --git a/app/src/main/res/drawable/ic_restaurant.xml b/app/src/main/res/drawable/ic_restaurant.xml index e14429d09..51f1145c6 100644 --- a/app/src/main/res/drawable/ic_restaurant.xml +++ b/app/src/main/res/drawable/ic_restaurant.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M11,9L9,9L9,2L7,2v7L5,9L5,2L3,2v7c0,2.12 1.66,3.84 3.75,3.97L6.75,22h2.5v-9.03C11.34,12.84 13,11.12 13,9L13,2h-2v7zM16,6v8h2.5v8L21,22L21,2c-2.76,0 -5,2.24 -5,4z" /> diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml index affc7ba26..d23ea57f8 100644 --- a/app/src/main/res/drawable/ic_search.xml +++ b/app/src/main/res/drawable/ic_search.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z" /> diff --git a/app/src/main/res/drawable/ic_select_none.xml b/app/src/main/res/drawable/ic_select_none.xml index a5266f0f0..dc745281a 100644 --- a/app/src/main/res/drawable/ic_select_none.xml +++ b/app/src/main/res/drawable/ic_select_none.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_social_instagram.xml b/app/src/main/res/drawable/ic_social_instagram.xml index f5d5236c3..d8a9ddf63 100644 --- a/app/src/main/res/drawable/ic_social_instagram.xml +++ b/app/src/main/res/drawable/ic_social_instagram.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_stop.xml b/app/src/main/res/drawable/ic_stop.xml index c428d728d..01940d9b6 100644 --- a/app/src/main/res/drawable/ic_stop.xml +++ b/app/src/main/res/drawable/ic_stop.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M6,6h12v12H6z" /> diff --git a/app/src/main/res/drawable/ic_theme_light_dark.xml b/app/src/main/res/drawable/ic_theme_light_dark.xml index d530c3e8f..51470615a 100644 --- a/app/src/main/res/drawable/ic_theme_light_dark.xml +++ b/app/src/main/res/drawable/ic_theme_light_dark.xml @@ -1,7 +1,7 @@ - + android:height="32dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/info_bicycle.xml b/app/src/main/res/drawable/info_bicycle.xml index 34db37655..20e0923ff 100644 --- a/app/src/main/res/drawable/info_bicycle.xml +++ b/app/src/main/res/drawable/info_bicycle.xml @@ -1,9 +1,9 @@ - + android:height="32dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/info_doctors.xml b/app/src/main/res/drawable/info_doctors.xml index b3689b18f..a5d33f635 100644 --- a/app/src/main/res/drawable/info_doctors.xml +++ b/app/src/main/res/drawable/info_doctors.xml @@ -1,7 +1,7 @@ - + android:height="32dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/info_library.xml b/app/src/main/res/drawable/info_library.xml index 2cb7b0571..1888dd8ca 100644 --- a/app/src/main/res/drawable/info_library.xml +++ b/app/src/main/res/drawable/info_library.xml @@ -1,9 +1,9 @@ - + android:height="32dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/info_mapmarker.xml b/app/src/main/res/drawable/info_mapmarker.xml index ef5596fb0..068bc5002 100644 --- a/app/src/main/res/drawable/info_mapmarker.xml +++ b/app/src/main/res/drawable/info_mapmarker.xml @@ -1,9 +1,9 @@ - + android:height="32dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/info_more.xml b/app/src/main/res/drawable/info_more.xml index 1dff60485..6104b7a6d 100644 --- a/app/src/main/res/drawable/info_more.xml +++ b/app/src/main/res/drawable/info_more.xml @@ -1,9 +1,9 @@ - + android:height="32dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/info_sports.xml b/app/src/main/res/drawable/info_sports.xml index fda220c94..7f680c897 100644 --- a/app/src/main/res/drawable/info_sports.xml +++ b/app/src/main/res/drawable/info_sports.xml @@ -1,7 +1,7 @@ + android:height="32dp" + android:viewportWidth="240" + android:viewportHeight="240"> + android:strokeWidth="0.26458332" + android:strokeColor="#00000000" /> + android:strokeWidth="0.26458332" + android:strokeColor="#00000000" /> diff --git a/app/src/main/res/drawable/logo_onboarding_ugent.xml b/app/src/main/res/drawable/logo_onboarding_ugent.xml index b4f3551d3..12e517b76 100644 --- a/app/src/main/res/drawable/logo_onboarding_ugent.xml +++ b/app/src/main/res/drawable/logo_onboarding_ugent.xml @@ -8,58 +8,58 @@ + android:pathData="M0.838663,54.0995 L69.8647,54.0995 L69.8647,52.3495 L0.8387,52.3495 Z" + android:strokeWidth="1" /> + android:pathData="M0.838663,18.8505 L69.8647,18.8505 L69.8647,17.1032 L0.8387,17.1032 Z" + android:strokeWidth="1" /> + android:pathData="M2.89333,50.9563 L67.8231,50.9563 L67.8231,49.1948 L2.8933,49.1948 Z" + android:strokeWidth="1" /> + android:pathData="M2.89333,22.1083 L67.8231,22.1083 L67.8231,20.3515 L2.8933,20.3515 Z" + android:strokeWidth="1" /> +L42.2865,23.3396" + android:strokeWidth="1" /> +L32.1095,23.3396" + android:strokeWidth="1" /> +L52.4048,23.3396" + android:strokeWidth="1" /> +L62.5235,23.3396" + android:strokeWidth="1" /> +L22.0443,23.3396" + android:strokeWidth="1" /> +L11.8709,23.3396" + android:strokeWidth="1" /> + android:pathData="M35.4625,3.45879 L4.4245,15.6183 L66.3215,15.6183 L35.4625,3.4588" + android:strokeWidth="1" /> +L69.9141,15.4177 L70.5991,13.8052" + android:strokeWidth="1" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/logo_ugent.xml b/app/src/main/res/drawable/logo_ugent.xml index 8845cb7aa..6f68ec177 100644 --- a/app/src/main/res/drawable/logo_ugent.xml +++ b/app/src/main/res/drawable/logo_ugent.xml @@ -1,9 +1,9 @@ + android:height="63.69533dp" + android:viewportWidth="83.3848" + android:viewportHeight="63.69533"> + android:fillColor="#1476C6" + android:pathData="M325.133 605.922H312.66v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M300.191 605.922h-12.472v-80.957h12.472v80.957" /> + android:fillColor="#1476C6" + android:pathData="M275.25 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M250.309 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M350.074 605.922h-12.472v-80.957h12.472v80.957" /> + android:fillColor="#1476C6" + android:pathData="M375.016 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M399.957 605.922h-12.473v-80.957h12.473v80.957" /> + android:fillColor="#1476C6" + android:pathData="M412.727 500.016H225.066v12.48h187.661v-12.48" /> + android:fillColor="#1476C6" + android:pathData="M399.957 618.395H237.836l-12.469 12.468h187.059l-12.469 -12.468" /> + android:fillColor="#1476C6" + android:pathData="M425.195 475.074H212.598v12.481h212.597v-12.481" /> + android:fillColor="#1476C6" + android:pathData="M425.195 651.035l-106.3 37.649 -106.297 -37.649v-13.242l106.297 37.641 106.3 -37.641v13.242" /> + android:fillColor="#1476C6" + android:pathData="M589.082 416.145c5.508 0.011 10.703 -1.79 13.086 -3.665v11.243c-2.383 1.465 -8.242 3.093 -14.18 3.093 -16.55 0 -25.664 -9.414 -25.664 -23.066 0 -11.387 4.824 -16.855 12.586 -23.555l7.102 -6.132c5.859 -4.903 9.492 -8.68 9.492 -16.016 0 -8.574 -5.664 -11.973 -14.168 -11.973 -6.445 0 -11.801 1.789 -14.887 3.918v-11.437c2.719 -1.563 8.371 -3.172 15.996 -3.153 16.516 0.043 25.625 9.422 25.649 23.067 0.011 11.375 -4.824 16.855 -12.59 23.543l-7.09 6.144c-5.879 5.028 -9.519 8.66 -9.504 15.985 0.028 8.613 5.649 11.98 14.172 12.004" /> + android:fillColor="#1476C6" + android:pathData="M212.598 363.613v61.582h12.48v-62.129c0 -13.027 4.473 -16.816 13.567 -16.816 9.089 0 13.562 3.789 13.562 16.816v62.129h12.481v-61.582c0 -20.078 -8.411 -28.222 -26.043 -28.222 -17.915 0 -26.047 7.871 -26.047 28.222" /> + android:fillColor="#1476C6" + android:pathData="M280.828 425.195h14.375l27.817 -70.273c-0.95 7.187 -1.77 15.605 -1.77 23.476v46.797h11.941v-88.183h-14.382l-28.079 70.547c1.086 -7.188 2.036 -15.743 2.036 -23.75v-46.797h-11.938v88.183" /> + android:fillColor="#1476C6" + android:pathData="M350.859 425.195h12.481v-88.183h-12.481v88.183" /> + android:fillColor="#1476C6" + android:pathData="M374.934 425.195h13.027l11.121 -45.859c1.633 -6.914 3.66 -18.574 4.883 -27.813 1.223 9.239 3.254 20.899 5.156 27.813l10.984 45.859h12.622l-22.383 -88.183h-13.031l-22.379 88.183" /> + android:fillColor="#1476C6" + android:pathData="M444.316 425.195h41.243V414.609H456.797V387.617H480v-10.449h-23.203v-29.57h28.762v-10.586h-41.243v88.183" /> + android:fillColor="#1476C6" + android:pathData="M512.449 414.609v-31.074h6.653c9.765 0 16.281 2.051 16.281 15.606 0 13.437 -6.516 15.468 -16.281 15.468zm-12.476 10.586h20.347c16.282 0 27.942 -6.113 27.942 -26.054 0 -13.965 -6.778 -20.743 -15.324 -23.868l18.722 -38.261h-14.25l-16.551 35.957h-8.41v-35.957h-12.476v88.183" /> + android:fillColor="#1476C6" + android:pathData="M618.906 425.195h12.481v-88.183h-12.481v88.183" /> + android:fillColor="#1476C6" + android:pathData="M643.23 425.195h50.598v-10.586h-19.121v-77.597h-12.48v77.597H643.23v10.586" /> + android:fillColor="#1476C6" + android:pathData="M705.254 425.195h41.238v-10.586h-28.758v-26.992h23.204v-10.449h-23.204v-29.57h28.758v-10.586h-41.238v88.183" /> + android:fillColor="#1476C6" + android:pathData="M760.77 425.195h12.484V337.012H760.77v88.183" /> + android:fillColor="#1476C6" + android:pathData="M784.68 425.195h50.593V414.609H816.145V337.012H803.66v77.597h-18.98v10.586" /> + android:fillColor="#1476C6" + android:pathData="M209.887 256.68c0 34.726 9.222 45.722 32.148 45.722 6.512 0 13.43 -1.765 16.41 -3.535v-11.523c-3.25 1.894 -9.492 3.937 -15.461 3.937 -14.648 0 -20.211 -5.429 -20.211 -34.601 0 -28.887 3.938 -34.852 16.684 -34.852 3.938 0 7.188 0.535 9.629 1.219v29.433h-13.023v10.579h25.503v-47.61c-2.578 -1.629 -12.882 -4.48 -21.972 -4.48 -23.875 0 -29.707 12.48 -29.707 45.711" /> + android:fillColor="#1476C6" + android:pathData="M276.461 300.773h41.238v-10.585h-28.758v-26.993h23.2v-10.441h-23.2v-29.578h28.758v-10.578h-41.238v88.175" /> + android:fillColor="#1476C6" + android:pathData="M332.113 300.773h14.379l27.809 -70.265c-0.946 7.187 -1.762 15.597 -1.762 23.469v46.796h11.938v-88.175h-14.379l-28.082 70.539c1.086 -7.188 2.039 -15.735 2.039 -23.742v-46.797h-11.942v88.175" /> + android:fillColor="#1476C6" + android:pathData="M395.902 300.773H446.5v-10.585h-19.129v-77.59h-12.476v77.59h-18.993v10.585" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/logo_zeus.xml b/app/src/main/res/drawable/logo_zeus.xml index d08f52f78..2a5ea417f 100644 --- a/app/src/main/res/drawable/logo_zeus.xml +++ b/app/src/main/res/drawable/logo_zeus.xml @@ -1,22 +1,21 @@ + android:height="557.83002dp" + android:viewportWidth="899.6" + android:viewportHeight="557.83"> - + + android:fillColor="#FF7F00" + android:pathData="M0 0l159.742 0 -162.886 -195.099 0 -46.891 263.987 0 0 59.714 -167.631 0 164.49 195.098 0 46.889L0 59.711 0 0Zm609.684 -336.269l40.855 0 0 131.994 -40.855 0 0 -131.994zm-72.188 103.709c9.177 0 16.151 -3.236 20.962 -9.68 4.808 -6.411 7.228 -15.745 7.228 -28.032 0 -12.29 -2.42 -21.653 -7.228 -28.097 -4.811 -6.409 -11.785 -9.616 -20.962 -9.616 -9.146 0 -16.153 3.237 -21.058 9.711 -4.871 6.505 -7.321 15.808 -7.321 28.002 0 12.192 2.45 21.496 7.321 28.001 4.905 6.474 11.913 9.711 21.058 9.711m-28.378 -84.852c5.906 -7.543 12.414 -13.073 19.548 -16.655 7.134 -3.554 15.336 -5.345 24.639 -5.345 16.467 0 29.981 6.441 40.509 19.357 10.593 12.887 15.871 29.48 15.871 49.782 0 20.302 -5.278 36.895 -15.871 49.778 -10.526 12.918 -24.042 19.359 -40.509 19.359 -9.303 0 -17.505 -1.791 -24.639 -5.342 -7.134 -3.584 -13.642 -9.113 -19.548 -16.656l0 18.856 -40.855 0 0 -182.278 40.855 0 0 69.144zm-207.514 -18.857l45.664 0 21.937 90.762 22.062 -90.762 45.664 0 34.477 131.993 -40.667 0 -22.03 -90.069 -21.968 90.069 -34.946 0 -22.062 -90.981 -21.937 90.983 -40.667 0 34.473 -131.995zM703.965 -12.57c-13.388 3.236 -25.802 5.625 -37.21 7.133 -11.408 1.541 -22.281 2.294 -32.621 2.294 -26.367 0 -45.946 -4.557 -58.738 -13.639 -12.758 -9.081 -19.138 -23.035 -19.138 -41.861 0 -17.41 5.248 -30.39 15.714 -38.968 10.465 -8.549 28.755 -14.426 54.81 -17.6l9.333 -1.227c10.748 -1.319 17.944 -3.206 21.56 -5.625 3.613 -2.419 5.437 -6.097 5.437 -11 0 -5.907 -2.797 -10.339 -8.358 -13.324 -5.562 -2.985 -13.828 -4.463 -24.827 -4.463 -12.194 0 -24.199 1.321 -36.016 3.929 -11.785 2.608 -23.287 6.537 -34.508 11.785l0 -43.998c13.105 -3.144 25.864 -5.5 38.311 -7.072 12.445 -1.569 24.45 -2.355 36.078 -2.355 27.467 0 48.115 4.684 61.974 14.079 13.859 9.429 20.773 23.506 20.773 42.208 0 17.851 -4.902 30.986 -14.739 39.314 -9.773 8.359 -28.881 14.361 -57.26 18.039l-9.334 1.353c-9.585 1.193 -16.248 3.017 -19.956 5.467 -3.708 2.452 -5.562 5.972 -5.562 10.561 0 5.688 2.482 9.898 7.479 12.602 4.966 2.734 12.57 4.085 22.814 4.085 9.556 0 19.737 -1.319 30.485 -3.927 10.779 -2.609 21.936 -6.537 33.501 -11.785l-0.002 43.995zM380.267 -117.16c0 -23.256 5.248 -40.948 15.776 -53.142 10.528 -12.162 25.833 -18.26 45.946 -18.26 11.281 0 21.652 2.545 31.05 7.668 9.396 5.092 18.259 13.012 26.649 23.759l0 -28.285 56.568 0 0 175.992 -56.568 0 0 -87.116c0 -16.06 -3.3 -28.63 -9.867 -37.648 -6.537 -9.021 -15.59 -13.515 -27.122 -13.515 -4.714 0 -8.895 1.005 -12.57 2.984 -3.614 2.012 -6.568 4.841 -8.831 8.518 -1.729 2.828 -2.954 7.386 -3.677 13.576 -0.725 6.254 -1.069 16.468 -1.069 30.643 0 4.87 0.032 14.487 0.126 28.943 0.094 14.425 0.157 26.431 0.157 35.983l0 17.632 -56.568 0 0 -107.732zm-128.223 41.736c1.696 11.155 6.034 19.705 13.011 25.645 6.979 5.939 16.061 8.925 27.216 8.925 10.277 0 18.605 -3.174 24.985 -9.522 6.379 -6.35 9.585 -14.708 9.585 -25.048l-74.797 0zM383.41 -94.029c0 27.592 -8.297 49.654 -24.891 66.122 -16.562 16.53 -38.654 24.764 -66.248 24.764 -30.358 0 -54.181 -8.233 -71.497 -24.764 -17.285 -16.468 -25.928 -39.127 -25.928 -67.945 0 -29.32 8.769 -52.105 26.272 -68.353 17.506 -16.248 42.051 -24.355 73.666 -24.355 13.168 0 26.366 1.318 39.565 3.991 13.23 2.64 26.432 6.536 39.63 11.722l0 43.997c-13.043 -7.384 -25.708 -12.917 -38.059 -16.562 -12.352 -3.613 -24.419 -5.438 -36.172 -5.438 -14.614 0 -25.99 3.395 -34.13 10.214 -8.14 6.82 -12.853 17.033 -14.205 30.642l131.995 0 0 15.965 0.002 0z" /> diff --git a/app/src/main/res/drawable/noti_ic_play_arrow_24dp.xml b/app/src/main/res/drawable/noti_ic_play_arrow_24dp.xml index 1f75805f1..ece912c9a 100644 --- a/app/src/main/res/drawable/noti_ic_play_arrow_24dp.xml +++ b/app/src/main/res/drawable/noti_ic_play_arrow_24dp.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M8,5v14l11,-7z" /> diff --git a/app/src/main/res/drawable/noti_ic_stop.xml b/app/src/main/res/drawable/noti_ic_stop.xml index d66f0158b..834bc18d2 100644 --- a/app/src/main/res/drawable/noti_ic_stop.xml +++ b/app/src/main/res/drawable/noti_ic_stop.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M6,6h12v12H6z" /> diff --git a/app/src/main/res/drawable/resto_fish.xml b/app/src/main/res/drawable/resto_fish.xml index eba9b04a6..0e2ded94c 100644 --- a/app/src/main/res/drawable/resto_fish.xml +++ b/app/src/main/res/drawable/resto_fish.xml @@ -15,18 +15,18 @@ C3.93807,5.83195,9.15804,8.05797,12.2381,8.03496 C10.128,4.96996,10.528,2.88896,12.158,0.32396 C8.98811,0.344956,3.8581,2.37297,2.048,3.59099 Z" /> - + + android:strokeColor="#245b8d" /> - + + android:strokeColor="#245b8d" /> +C9.06487,4.62601,9.6049,4.978,10.0051,5.936 Z" + android:strokeWidth=".60004" + android:strokeColor="#245b8d" + android:strokeLineCap="round" + android:strokeLineJoin="round" /> +C8.8549,18.471,12.0649,7.32199,9.3549,5.00003 Z" + android:strokeWidth=".90005" + android:strokeColor="#245b8d" /> +C11.8502,8.41699,11.95,1.03302,4.56015,2.56 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C1.93002,3.375,3.24008,3.33502,4.56015,2.77002 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C3.12021,4.33002,2.95004,3.38,4.46005,2.88 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C8.02011,2.94501,6.68002,2.52802,4.56015,2.81 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C7.16,2.05701,6.02011,2.56598,4.56015,2.79999 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C3.99008,1.12103,4.2601,1.97198,4.56015,2.79999 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> android:pathData="M3.66,2.79999 C-3.4899,5.341,1.95004,11.142,6.06015,9.90002 C-2.46988,6.10498,3.85019,4.78601,3.66,2.79999 Z" /> +C11.8502,8.41699,11.95,1.03302,4.56015,2.56 Z" + android:strokeWidth=".5" + android:strokeColor="#245b8d" /> +C1.93002,3.375,3.24008,3.33502,4.56015,2.77002 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C3.12021,4.33002,2.95004,3.38,4.46005,2.88 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C8.02011,2.94501,6.68002,2.52802,4.56015,2.81 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C7.16,2.05701,6.02011,2.56598,4.56015,2.79999 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> +C3.99008,1.12103,4.2601,1.97198,4.56015,2.79999 Z" + android:strokeWidth=".22248" + android:strokeColor="#245b8d" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/resto_vegetarian.xml b/app/src/main/res/drawable/resto_vegetarian.xml index 2588e4c8a..5ed370a57 100644 --- a/app/src/main/res/drawable/resto_vegetarian.xml +++ b/app/src/main/res/drawable/resto_vegetarian.xml @@ -1,9 +1,9 @@ + android:height="12.0249113989711dp" + android:viewportWidth="17.75765" + android:viewportHeight="12.02503"> + android:fillColor="#245b8d" + android:pathData="M1811.9 676.06c-5.7944 -0.0101 -11.914 2.0864 -9.096 6.3181 -1.0892 1.3654 -2.3861 2.6756 -2.3705 4.3356l1.3006 0.11625c-0.4777 -1.3501 0.7063 -2.6577 1.8497 -3.8451 5.8356 3.0068 6.3384 -2.2659 10.753 -6.7923 -0.7874 -0.0874 -1.6086 -0.13127 -2.4364 -0.13271zm-8.8507 6.5644l0.2453 0.18763c-0.9688 1.1947 -2.2279 2.3895 -2.0658 3.5842l-0.3615 -0.0439c-0.1037 -0.92323 0.7863 -2.228 2.182 -3.7279z" /> + android:fillColor="#fdb822" + android:pathData="M1803.6 682.22c1.4198 -1.5936 5.3732 -3.8895 8.3677 -5.2461 -2.9667 1.0068 -7.8853 3.1221 -8.3677 5.2461z" /> + android:fillColor="#fdb822" + android:pathData="M1804 681.51c0.1735 -0.95384 0.1751 -1.9077 0.159 -2.8615 0.083 0.88346 0.2545 1.7542 0.087 2.6736 1.5115 0.0538 2.4643 0.51395 3.5841 0.85267 -1.2544 -0.2883 -2.501 -0.5997 -3.8298 -0.66479z" /> + android:fillColor="#fdb822" + android:pathData="M1806.75 679.5721C1807.528 679.1603 1809.262 679.347 1810.241 679.4844C1809.339 679.2899 1808.429 679.1188 1807.452 679.152L1807.524 677.3455C1807.348 678.3448 1807.162 679.3142 1806.75 679.5721" /> + android:fillColor="#b4c55a" + android:pathData="M1803.6 682.98c5.8356 3.0068 6.3378 -2.2646 10.752 -6.791 -0.7874 -0.0874 -1.6079 -0.13137 -2.4356 -0.13281 -5.7944 -0.0101 -11.916 2.0847 -9.0976 6.3164z" /> + android:fillColor="#245b8d" + android:pathData="M1811.9 676.41c0.4898 0.003 0.994 0.0229 1.5117 0.0605 -3.7861 3.79 -4.9077 9.72 -9.9433 5.8887 -2.9915 -2.276 1.0849 -5.9909 8.4316 -5.9492zm-0.051 -0.35352c-5.7944 -0.0101 -11.916 2.0847 -9.0976 6.3164 -1.0892 1.3654 -2.3847 2.6759 -2.3692 4.3359l1.3008 0.11719c-0.4776 -1.3501 0.7061 -2.6583 1.8496 -3.8457 5.8356 3.0068 6.3378 -2.2646 10.752 -6.791 -0.7874 -0.0874 -1.6079 -0.13137 -2.4356 -0.13281z" /> + android:fillColor="#a85700" + android:pathData="M1803 682.62l0.2461 0.1875c-0.9687 1.1947 -2.2286 2.3893 -2.0664 3.584l-0.3614 -0.0449c-0.1036 -0.92323 0.786 -2.2267 2.1817 -3.7266z" /> + android:fillColor="#245b8d" + android:pathData="M1803.6 682.22c1.4198 -1.5936 5.3732 -3.8895 8.3677 -5.2461 -2.9667 1.0068 -7.8853 3.1221 -8.3677 5.2461z" /> + android:fillColor="#245b8d" + android:pathData="M1804 681.51c0.1735 -0.95384 0.1751 -1.9077 0.159 -2.8615 0.083 0.88346 0.2545 1.7542 0.087 2.6736 1.5115 0.0538 2.4643 0.51395 3.5841 0.85267 -1.2544 -0.2883 -2.5011 -0.5997 -3.8298 -0.66479z" /> + android:fillColor="#245b8d" + android:pathData="M1806.75 679.5723C1807.528 679.1602 1809.262 679.347 1810.241 679.4844C1809.339 679.2899 1808.429 679.1188 1807.451 679.152L1807.523 677.3455C1807.347 678.3452 1807.162 679.3148 1806.75 679.5723" /> + android:fillColor="#fdb822" + android:pathData="M1803.6 682.22c1.4198 -1.5936 5.3732 -3.8895 8.3677 -5.2461 -2.9667 1.0068 -7.8853 3.1221 -8.3677 5.2461z" /> + android:fillColor="#fdb822" + android:pathData="M1804 681.51c0.1735 -0.95384 0.1751 -1.9077 0.159 -2.8615 0.083 0.88346 0.2545 1.7542 0.087 2.6736 1.5115 0.0538 2.4643 0.51395 3.5841 0.85267 -1.2544 -0.2883 -2.501 -0.5997 -3.8298 -0.66479z" /> + android:fillColor="#fdb822" + android:pathData="M1806.75 679.5721C1807.528 679.1603 1809.262 679.347 1810.241 679.4844C1809.339 679.2899 1808.429 679.1188 1807.452 679.152L1807.524 677.3455C1807.348 678.3448 1807.162 679.3142 1806.75 679.5721" /> + android:fillColor="#b4c55a" + android:pathData="M1803.6 682.98c5.8356 3.0068 6.3378 -2.2646 10.752 -6.791 -0.7874 -0.0874 -1.6079 -0.13137 -2.4356 -0.13281 -5.7944 -0.0101 -11.916 2.0847 -9.0976 6.3164z" /> + android:fillColor="#245b8d" + android:pathData="M1811.9 676.41c0.4898 0.003 0.994 0.0229 1.5117 0.0605 -3.7861 3.79 -4.9077 9.72 -9.9433 5.8887 -2.9915 -2.276 1.0849 -5.9909 8.4316 -5.9492zm-0.051 -0.35352c-5.7944 -0.0101 -11.9159 2.0256 -9.0975 6.2573 -1.2729 1.16074 -2.9607 1.18876 -4.67 1.65936l0.4718 1.79205c0.9428 -0.6372 3.763 -1.62509 4.9807 -2.78492 5.8356 3.0068 6.3378 -2.2646 10.752 -6.791 -0.7874 -0.0874 -1.6079 -0.13137 -2.4356 -0.13281z" /> + android:fillColor="#a85700" + android:pathData="M1803 682.62l0.2461 0.1875c-1.1606 1.00325 -4.4975 2.11645 -5.5596 2.66464l-0.083 -0.81068c1.1552 -0.27361 3.821 -0.87128 5.3962 -2.04146z" /> + android:fillColor="#245b8d" + android:pathData="M1803.6 682.22c1.4198 -1.5936 5.3732 -3.8895 8.3677 -5.2461 -2.9667 1.0068 -7.8853 3.1221 -8.3677 5.2461z" /> + android:fillColor="#245b8d" + android:pathData="M1804 681.51c0.1735 -0.95384 0.1751 -1.9077 0.159 -2.8615 0.083 0.88346 0.2545 1.7542 0.087 2.6736 1.5115 0.0538 2.4643 0.51395 3.5841 0.85267 -1.2544 -0.2883 -2.5011 -0.5997 -3.8298 -0.66479z" /> + android:fillColor="#245b8d" + android:pathData="M1806.75 679.5723C1807.528 679.1602 1809.262 679.347 1810.241 679.4844C1809.339 679.2899 1808.429 679.1188 1807.451 679.152L1807.523 677.3455C1807.347 678.3452 1807.162 679.3148 1806.75 679.5723" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/shortcut_background.xml b/app/src/main/res/drawable/shortcut_background.xml index c3c10fce1..39d62a115 100644 --- a/app/src/main/res/drawable/shortcut_background.xml +++ b/app/src/main/res/drawable/shortcut_background.xml @@ -2,5 +2,7 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/shortcut_events.xml b/app/src/main/res/drawable/shortcut_events.xml index f9bdc9099..3163f5191 100644 --- a/app/src/main/res/drawable/shortcut_events.xml +++ b/app/src/main/res/drawable/shortcut_events.xml @@ -2,11 +2,11 @@ + android:top="2dp" /> diff --git a/app/src/main/res/drawable/shortcut_libraries.xml b/app/src/main/res/drawable/shortcut_libraries.xml index 6a93ab675..c9beb8704 100644 --- a/app/src/main/res/drawable/shortcut_libraries.xml +++ b/app/src/main/res/drawable/shortcut_libraries.xml @@ -2,11 +2,11 @@ + android:top="2dp" /> diff --git a/app/src/main/res/drawable/shortcut_resto.xml b/app/src/main/res/drawable/shortcut_resto.xml index 7c43fd525..4a1b75ba1 100644 --- a/app/src/main/res/drawable/shortcut_resto.xml +++ b/app/src/main/res/drawable/shortcut_resto.xml @@ -2,11 +2,11 @@ + android:top="2dp" /> diff --git a/app/src/main/res/drawable/shortcut_urgent.xml b/app/src/main/res/drawable/shortcut_urgent.xml index e7a48f743..886a0d971 100644 --- a/app/src/main/res/drawable/shortcut_urgent.xml +++ b/app/src/main/res/drawable/shortcut_urgent.xml @@ -2,11 +2,11 @@ + android:top="2dp" /> diff --git a/app/src/main/res/drawable/tabs_info.xml b/app/src/main/res/drawable/tabs_info.xml index 90d67ab00..fbb54579d 100644 --- a/app/src/main/res/drawable/tabs_info.xml +++ b/app/src/main/res/drawable/tabs_info.xml @@ -1,7 +1,7 @@ + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/tabs_menu.xml b/app/src/main/res/drawable/tabs_menu.xml index 80c7b8471..d52ddc33f 100644 --- a/app/src/main/res/drawable/tabs_menu.xml +++ b/app/src/main/res/drawable/tabs_menu.xml @@ -1,9 +1,9 @@ - + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/tabs_news.xml b/app/src/main/res/drawable/tabs_news.xml index ba6f50d34..e9ee7c7ea 100644 --- a/app/src/main/res/drawable/tabs_news.xml +++ b/app/src/main/res/drawable/tabs_news.xml @@ -1,7 +1,7 @@ + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> diff --git a/app/src/main/res/drawable/tabs_ufora.xml b/app/src/main/res/drawable/tabs_ufora.xml index 60b75a549..b8d8c28a4 100644 --- a/app/src/main/res/drawable/tabs_ufora.xml +++ b/app/src/main/res/drawable/tabs_ufora.xml @@ -1,9 +1,9 @@ + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + android:pathData="M19,19H5V5h7V3H5c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2v7zM14,3v2h3.59l-9.83,9.83 1.41,1.41L19,6.41V10h2V3h-7z" /> diff --git a/app/src/main/res/layout-land/fragment_onboarding_home.xml b/app/src/main/res/layout-land/fragment_onboarding_home.xml index a29fc1a14..92edb3a8d 100644 --- a/app/src/main/res/layout-land/fragment_onboarding_home.xml +++ b/app/src/main/res/layout-land/fragment_onboarding_home.xml @@ -1,10 +1,9 @@ - + android:layout_height="match_parent" + android:orientation="horizontal"> + android:textColor="?android:textColorPrimary" /> + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding" + android:text="@string/onboarding_feed_desc" + android:textAppearance="@style/TextAppearance.AppCompat.Subhead" /> + android:layout_height="match_parent" + android:paddingLeft="@dimen/vertical_padding" + android:paddingTop="@dimen/large_horizontal_padding" + android:paddingRight="@dimen/vertical_padding" /> \ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp-land/activity_event_detail.xml b/app/src/main/res/layout-sw600dp-land/activity_event_detail.xml index 170c07f08..6ba424cc8 100644 --- a/app/src/main/res/layout-sw600dp-land/activity_event_detail.xml +++ b/app/src/main/res/layout-sw600dp-land/activity_event_detail.xml @@ -1,15 +1,15 @@ + android:layout_height="wrap_content"> + tools:src="@drawable/ic_event_note" /> @@ -68,19 +68,19 @@ + android:layout_marginBottom="@dimen/card_spacing" + android:layout_weight="0.3"> + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + tools:src="@drawable/ic_place" /> + android:layout_gravity="center_vertical" + tools:text="Locatie van het evenement" /> + style="@style/Divider" + android:layout_marginLeft="@dimen/keyline_fixed" /> + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + tools:src="@drawable/ic_schedule" /> + android:columnCount="2"> + android:text="@string/event_detail_from" /> + android:layout_gravity="center_vertical" + tools:text="Starttijd van het evenement" /> + android:layout_gravity="center_vertical" + android:paddingTop="4dp" + tools:text="Endtijd van het evenement" /> @@ -188,25 +188,25 @@ + style="@style/Divider" /> + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + android:contentDescription="@string/content_desc_hydra_logo" + tools:src="@drawable/logo_hydra" /> + tools:text="Kleine organisator" /> @@ -236,43 +236,43 @@ + android:layout_height="wrap_content" + android:orientation="vertical"> + android:height="48dp" + android:gravity="center_vertical" + android:text="@string/event_detail_description_title" /> + android:textIsSelectable="true" /> diff --git a/app/src/main/res/layout-sw600dp-land/activity_library_details.xml b/app/src/main/res/layout-sw600dp-land/activity_library_details.xml index 34f8983ab..a3cba8eec 100644 --- a/app/src/main/res/layout-sw600dp-land/activity_library_details.xml +++ b/app/src/main/res/layout-sw600dp-land/activity_library_details.xml @@ -1,56 +1,56 @@ + tools:context=".library.details.LibraryDetailActivity" + tools:targetApi="lollipop"> + android:fitsSystemWindows="true" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed|snap"> + android:scaleType="centerCrop" + app:layout_collapseMode="parallax" + tools:src="@drawable/tabs_library" /> + app:layout_collapseMode="parallax" /> @@ -67,48 +67,48 @@ + android:paddingRight="@dimen/card_small_vertical_margin"> + android:layout_marginTop="@dimen/card_small_horizontal_margin" + android:layout_marginRight="@dimen/card_small_vertical_margin" + android:layout_marginBottom="@dimen/card_spacing"> + android:layout_height="wrap_content" + android:orientation="vertical"> - - + + + android:foreground="?android:attr/selectableItemBackground" + android:paddingLeft="@dimen/card_text_padding_vertical" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/card_text_padding_bottom" + tools:ignore="UnusedAttribute" + tools:text="Het adres van de bibliotheek!" /> @@ -119,19 +119,19 @@ + android:text="@string/library_favourite" /> + android:text="@string/library_more" /> @@ -151,41 +151,41 @@ - - + + + android:height="48dp" + android:gravity="center_vertical" + android:paddingLeft="@dimen/card_text_padding_vertical" + android:paddingRight="@dimen/card_text_padding_vertical" + android:text="@string/library_info_details" /> + android:paddingBottom="@dimen/card_text_padding_bottom"> @@ -215,15 +215,15 @@ style="?textAppearanceBody2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/library_details_phone" - android:paddingRight="4dp" /> + android:paddingRight="4dp" + android:text="@string/library_details_phone" /> @@ -233,15 +233,15 @@ style="?textAppearanceBody2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/library_details_contact" - android:paddingRight="4dp" /> + android:paddingRight="4dp" + android:text="@string/library_details_contact" /> @@ -257,21 +257,21 @@ + android:paddingLeft="@dimen/card_small_vertical_margin" + android:paddingRight="@dimen/card_small_vertical_margin"> + android:height="48dp" + android:gravity="center_vertical" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding" + android:text="@string/library_opening_hours_title" /> + android:id="@+id/progress_bar" + layout="@layout/x_progress_bar" /> diff --git a/app/src/main/res/layout-sw900dp/activity_event_detail.xml b/app/src/main/res/layout-sw900dp/activity_event_detail.xml index 170c07f08..6ba424cc8 100644 --- a/app/src/main/res/layout-sw900dp/activity_event_detail.xml +++ b/app/src/main/res/layout-sw900dp/activity_event_detail.xml @@ -1,15 +1,15 @@ + android:layout_height="wrap_content"> + tools:src="@drawable/ic_event_note" /> @@ -68,19 +68,19 @@ + android:layout_marginBottom="@dimen/card_spacing" + android:layout_weight="0.3"> + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + tools:src="@drawable/ic_place" /> + android:layout_gravity="center_vertical" + tools:text="Locatie van het evenement" /> + style="@style/Divider" + android:layout_marginLeft="@dimen/keyline_fixed" /> + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + tools:src="@drawable/ic_schedule" /> + android:columnCount="2"> + android:text="@string/event_detail_from" /> + android:layout_gravity="center_vertical" + tools:text="Starttijd van het evenement" /> + android:layout_gravity="center_vertical" + android:paddingTop="4dp" + tools:text="Endtijd van het evenement" /> @@ -188,25 +188,25 @@ + style="@style/Divider" /> + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + android:contentDescription="@string/content_desc_hydra_logo" + tools:src="@drawable/logo_hydra" /> + tools:text="Kleine organisator" /> @@ -236,43 +236,43 @@ + android:layout_height="wrap_content" + android:orientation="vertical"> + android:height="48dp" + android:gravity="center_vertical" + android:text="@string/event_detail_description_title" /> + android:textIsSelectable="true" /> diff --git a/app/src/main/res/layout-sw900dp/activity_library_details.xml b/app/src/main/res/layout-sw900dp/activity_library_details.xml index 34f8983ab..a3cba8eec 100644 --- a/app/src/main/res/layout-sw900dp/activity_library_details.xml +++ b/app/src/main/res/layout-sw900dp/activity_library_details.xml @@ -1,56 +1,56 @@ + tools:context=".library.details.LibraryDetailActivity" + tools:targetApi="lollipop"> + android:fitsSystemWindows="true" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed|snap"> + android:scaleType="centerCrop" + app:layout_collapseMode="parallax" + tools:src="@drawable/tabs_library" /> + app:layout_collapseMode="parallax" /> @@ -67,48 +67,48 @@ + android:paddingRight="@dimen/card_small_vertical_margin"> + android:layout_marginTop="@dimen/card_small_horizontal_margin" + android:layout_marginRight="@dimen/card_small_vertical_margin" + android:layout_marginBottom="@dimen/card_spacing"> + android:layout_height="wrap_content" + android:orientation="vertical"> - - + + + android:foreground="?android:attr/selectableItemBackground" + android:paddingLeft="@dimen/card_text_padding_vertical" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/card_text_padding_bottom" + tools:ignore="UnusedAttribute" + tools:text="Het adres van de bibliotheek!" /> @@ -119,19 +119,19 @@ + android:text="@string/library_favourite" /> + android:text="@string/library_more" /> @@ -151,41 +151,41 @@ - - + + + android:height="48dp" + android:gravity="center_vertical" + android:paddingLeft="@dimen/card_text_padding_vertical" + android:paddingRight="@dimen/card_text_padding_vertical" + android:text="@string/library_info_details" /> + android:paddingBottom="@dimen/card_text_padding_bottom"> @@ -215,15 +215,15 @@ style="?textAppearanceBody2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/library_details_phone" - android:paddingRight="4dp" /> + android:paddingRight="4dp" + android:text="@string/library_details_phone" /> @@ -233,15 +233,15 @@ style="?textAppearanceBody2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/library_details_contact" - android:paddingRight="4dp" /> + android:paddingRight="4dp" + android:text="@string/library_details_contact" /> @@ -257,21 +257,21 @@ + android:paddingLeft="@dimen/card_small_vertical_margin" + android:paddingRight="@dimen/card_small_vertical_margin"> + android:height="48dp" + android:gravity="center_vertical" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding" + android:text="@string/library_opening_hours_title" /> + android:id="@+id/progress_bar" + layout="@layout/x_progress_bar" /> diff --git a/app/src/main/res/layout/activity_event_detail.xml b/app/src/main/res/layout/activity_event_detail.xml index fa13e1af6..99904240d 100644 --- a/app/src/main/res/layout/activity_event_detail.xml +++ b/app/src/main/res/layout/activity_event_detail.xml @@ -1,15 +1,15 @@ + android:layout_height="@dimen/material_app_bar_extended_height"> + app:expandedTitleMarginStart="@dimen/keyline" + app:expandedTitleTextAppearance="@style/Hydra.Text.Transparent" + app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> + tools:src="@drawable/ic_event_note" /> @@ -69,25 +69,25 @@ + android:paddingRight="@dimen/card_small_vertical_margin"> + android:layout_marginTop="@dimen/card_spacing" + android:layout_marginBottom="@dimen/card_spacing"> + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + tools:src="@drawable/ic_place" /> + style="@style/Divider" + android:layout_marginLeft="@dimen/keyline_fixed" /> + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + tools:src="@drawable/ic_schedule" /> + android:text="@string/event_detail_from" /> @@ -201,19 +201,19 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:paddingTop="@dimen/list_two_line_padding_horizontal" - android:paddingBottom="@dimen/list_two_line_padding_horizontal" android:paddingLeft="@dimen/card_text_padding_vertical" - android:paddingRight="@dimen/card_text_padding_vertical"> + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + android:contentDescription="@string/content_desc_hydra_logo" + tools:src="@drawable/logo_hydra" /> @@ -245,34 +245,34 @@ + android:layout_height="wrap_content" + android:orientation="vertical"> + android:height="48dp" + android:gravity="center_vertical" + android:text="@string/event_detail_description_title" /> + android:textIsSelectable="true" /> diff --git a/app/src/main/res/layout/activity_extra_food.xml b/app/src/main/res/layout/activity_extra_food.xml index 81818a3ab..ef61a7b3a 100644 --- a/app/src/main/res/layout/activity_extra_food.xml +++ b/app/src/main/res/layout/activity_extra_food.xml @@ -1,16 +1,16 @@ + android:layout_height="wrap_content"> @@ -27,7 +27,7 @@ android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior" - android:animateLayoutChanges="true" /> + android:animateLayoutChanges="true" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_info_sub_item.xml b/app/src/main/res/layout/activity_info_sub_item.xml index b9eb8c9a6..fd0c590ed 100644 --- a/app/src/main/res/layout/activity_info_sub_item.xml +++ b/app/src/main/res/layout/activity_info_sub_item.xml @@ -1,15 +1,15 @@ + android:layout_height="wrap_content"> diff --git a/app/src/main/res/layout/activity_library_details.xml b/app/src/main/res/layout/activity_library_details.xml index 1c86b0558..169267112 100644 --- a/app/src/main/res/layout/activity_library_details.xml +++ b/app/src/main/res/layout/activity_library_details.xml @@ -1,7 +1,7 @@ + app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed|snap" + app:statusBarScrim="?colorPrimarySurface"> + android:scaleType="centerCrop" + app:layout_collapseMode="parallax" + tools:src="@drawable/tabs_library" /> + app:layout_collapseMode="parallax" /> @@ -69,46 +69,46 @@ + android:focusableInTouchMode="true" + android:orientation="vertical"> + android:layout_marginTop="@dimen/card_small_horizontal_margin" + android:layout_marginRight="@dimen/card_small_vertical_margin" + android:layout_marginBottom="@dimen/card_spacing"> + android:layout_height="wrap_content" + android:orientation="vertical"> - - + + + android:foreground="?android:attr/selectableItemBackground" + android:paddingLeft="@dimen/card_text_padding_vertical" + android:paddingRight="@dimen/card_text_padding_vertical" + android:paddingBottom="@dimen/card_text_padding_bottom" + tools:ignore="UnusedAttribute" + tools:text="Het adres van de bibliotheek!" /> @@ -119,19 +119,19 @@ + android:text="@string/library_favourite" /> + android:text="@string/library_more" /> @@ -151,41 +151,41 @@ - - + + + android:height="48dp" + android:gravity="center_vertical" + android:paddingLeft="@dimen/card_text_padding_vertical" + android:paddingRight="@dimen/card_text_padding_vertical" + android:text="@string/library_info_details" /> + android:paddingBottom="@dimen/card_text_padding_bottom"> @@ -215,15 +215,15 @@ style="?textAppearanceBody2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/library_details_phone" - android:paddingRight="4dp" /> + android:paddingRight="4dp" + android:text="@string/library_details_phone" /> @@ -233,15 +233,15 @@ style="?textAppearanceBody2" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/library_details_contact" - android:paddingRight="4dp" /> + android:paddingRight="4dp" + android:text="@string/library_details_contact" /> @@ -256,25 +256,25 @@ + android:height="48dp" + android:gravity="center_vertical" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding" + android:text="@string/library_opening_hours_title" /> + android:layout_height="wrap_content" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding"> + android:id="@+id/progress_bar" + layout="@layout/x_progress_bar" /> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 9f5ad6113..72ca6323b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -12,37 +12,37 @@ android:layout_height="match_parent"> + android:layout_height="wrap_content" + android:visibility="gone" /> + android:layout_height="24dp" + android:visibility="gone" /> @@ -55,19 +55,19 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"> + android:visibility="gone" /> @@ -77,11 +77,11 @@ diff --git a/app/src/main/res/layout/activity_preferences.xml b/app/src/main/res/layout/activity_preferences.xml index 31a772a03..495e228cd 100644 --- a/app/src/main/res/layout/activity_preferences.xml +++ b/app/src/main/res/layout/activity_preferences.xml @@ -1,15 +1,15 @@ + android:layout_height="wrap_content"> diff --git a/app/src/main/res/layout/activity_preferences_homefeed.xml b/app/src/main/res/layout/activity_preferences_homefeed.xml index 7f2204ea6..d95aab2e4 100644 --- a/app/src/main/res/layout/activity_preferences_homefeed.xml +++ b/app/src/main/res/layout/activity_preferences_homefeed.xml @@ -1,17 +1,17 @@ + android:layout_height="wrap_content"> @@ -24,23 +24,23 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"> + android:text="@string/feed_pref_card_types_description" /> + android:layout_height="match_parent" + android:paddingTop="@dimen/content_spacing" /> diff --git a/app/src/main/res/layout/activity_resto_history.xml b/app/src/main/res/layout/activity_resto_history.xml index 4501b51c4..37c02d89a 100644 --- a/app/src/main/res/layout/activity_resto_history.xml +++ b/app/src/main/res/layout/activity_resto_history.xml @@ -1,17 +1,17 @@ + tools:menu="@menu/menu_resto"> + android:layout_height="wrap_content"> @@ -24,24 +24,24 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"> + android:layout_height="wrap_content" + android:paddingTop="@dimen/activity_horizontal_margin" + android:paddingBottom="@dimen/bottom_toolbar_height"> + android:id="@+id/progress_bar" + layout="@layout/x_progress_bar" /> + android:layout_height="wrap_content" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding" + android:visibility="gone" /> @@ -49,14 +49,14 @@ + android:paddingEnd="88dp" + android:paddingRight="88dp"> diff --git a/app/src/main/res/layout/activity_resto_sandwich.xml b/app/src/main/res/layout/activity_resto_sandwich.xml index 6808d8a4e..80ea4f2f9 100644 --- a/app/src/main/res/layout/activity_resto_sandwich.xml +++ b/app/src/main/res/layout/activity_resto_sandwich.xml @@ -5,8 +5,8 @@ android:id="@+id/swipeRefreshLayout" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".resto.sandwich.regular.RegularFragment" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> + app:layout_behavior="@string/appbar_scrolling_view_behavior" + tools:context=".resto.sandwich.regular.RegularFragment"> + android:scrollbars="none" + app:layoutManager="@string/app_layout_manager_linear" + tools:listitem="@layout/item_sandwich" /> diff --git a/app/src/main/res/layout/activity_sko_artist.xml b/app/src/main/res/layout/activity_sko_artist.xml index 4a0ef2e1a..8920bade1 100644 --- a/app/src/main/res/layout/activity_sko_artist.xml +++ b/app/src/main/res/layout/activity_sko_artist.xml @@ -1,8 +1,8 @@ + android:fitsSystemWindows="true" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> + app:expandedTitleMarginStart="48dp" + app:expandedTitleTextAppearance="@style/Hydra.Text.Transparent" + app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed|snap|exitUntilCollapsed" + app:statusBarScrim="?colorPrimarySurface"> + android:scaleType="centerCrop" + app:layout_collapseMode="parallax" + tools:src="@drawable/tabs_schamper" /> + app:layout_collapseMode="parallax" /> + app:layout_collapseMode="parallax"> @@ -106,102 +106,102 @@ + android:layout_height="wrap_content" + android:orientation="vertical"> + android:height="48dp" + android:gravity="center_vertical" + android:text="@string/sko_artist_info" /> + tools:text="Informatie en dergelijke over de artiest." /> + android:height="48dp" + android:gravity="center_vertical" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding" + android:text="@string/sko_artist_more" /> + android:focusable="true" + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding"> + android:focusable="true" + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding"> + android:layout_weight="1" + android:paddingLeft="32dp" + android:text="@string/sko_artist_search_music" /> diff --git a/app/src/main/res/layout/activity_sko_main.xml b/app/src/main/res/layout/activity_sko_main.xml index 0eeb95d7a..b571ecbd6 100644 --- a/app/src/main/res/layout/activity_sko_main.xml +++ b/app/src/main/res/layout/activity_sko_main.xml @@ -1,26 +1,26 @@ + android:orientation="vertical" + tools:context=".sko.OverviewActivity"> + android:layout_height="wrap_content"> + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> diff --git a/app/src/main/res/layout/activity_webview.xml b/app/src/main/res/layout/activity_webview.xml index c17c0d222..78ada3967 100644 --- a/app/src/main/res/layout/activity_webview.xml +++ b/app/src/main/res/layout/activity_webview.xml @@ -1,15 +1,15 @@ + android:layout_height="wrap_content"> @@ -22,13 +22,13 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"> + android:layout_height="match_parent" /> + android:id="@+id/progress_bar" + layout="@layout/x_progress_bar" /> diff --git a/app/src/main/res/layout/drawer_header.xml b/app/src/main/res/layout/drawer_header.xml index 132fdb6c3..ffce07e92 100644 --- a/app/src/main/res/layout/drawer_header.xml +++ b/app/src/main/res/layout/drawer_header.xml @@ -1,27 +1,27 @@ + android:layout_height="wrap_content" + android:fitsSystemWindows="true"> + android:scaleType="fitStart" + app:srcCompat="@drawable/logo_hydra" + app:tint="@color/white" + tools:src="@drawable/logo_hydra" /> diff --git a/app/src/main/res/layout/fragment_activities.xml b/app/src/main/res/layout/fragment_activities.xml index 51183a322..98b503531 100644 --- a/app/src/main/res/layout/fragment_activities.xml +++ b/app/src/main/res/layout/fragment_activities.xml @@ -1,9 +1,9 @@ + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/swipeRefreshLayout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:scrollbars="vertical" + app:layoutManager="@string/app_layout_manager_linear" + tools:listitem="@layout/item_event_item" /> + android:layout_marginBottom="16dp" + android:text="@string/event_no_data" /> + android:text="@string/action_refresh" /> + app:spanCount="@integer/span_count_normal" + tools:listitem="@layout/home_card_schamper" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home_feed_select.xml b/app/src/main/res/layout/fragment_home_feed_select.xml index 866ca203a..f7b4dafc9 100644 --- a/app/src/main/res/layout/fragment_home_feed_select.xml +++ b/app/src/main/res/layout/fragment_home_feed_select.xml @@ -1,11 +1,11 @@ \ No newline at end of file + android:scrollbars="vertical" + app:layoutManager="@string/app_layout_manager_linear" + tools:listitem="@layout/item_checkbox_string" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_infos.xml b/app/src/main/res/layout/fragment_infos.xml index 9e3e52c3f..4c766a104 100644 --- a/app/src/main/res/layout/fragment_infos.xml +++ b/app/src/main/res/layout/fragment_infos.xml @@ -1,16 +1,17 @@ + android:layout_height="match_parent"> + diff --git a/app/src/main/res/layout/fragment_library_list.xml b/app/src/main/res/layout/fragment_library_list.xml index 225fca10d..e3e9ab851 100644 --- a/app/src/main/res/layout/fragment_library_list.xml +++ b/app/src/main/res/layout/fragment_library_list.xml @@ -1,6 +1,6 @@ - + app:fastScrollVerticalTrackDrawable="@drawable/fast_scroll_track" + app:layoutManager="@string/app_layout_manager_linear" + tools:listitem="@layout/item_library" /> diff --git a/app/src/main/res/layout/fragment_menu.xml b/app/src/main/res/layout/fragment_menu.xml index 63e61ed43..c38a24133 100644 --- a/app/src/main/res/layout/fragment_menu.xml +++ b/app/src/main/res/layout/fragment_menu.xml @@ -2,18 +2,18 @@ + android:layout_width="match_parent" + android:layout_height="match_parent"> + app:showKind="all" + app:showTitles="true" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_news.xml b/app/src/main/res/layout/fragment_news.xml index 28286e6b6..8db12d413 100644 --- a/app/src/main/res/layout/fragment_news.xml +++ b/app/src/main/res/layout/fragment_news.xml @@ -1,9 +1,9 @@ + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/swipeRefreshLayout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + app:spanCount="@integer/span_count_normal" + tools:listitem="@layout/item_news" /> diff --git a/app/src/main/res/layout/fragment_onboarding_home.xml b/app/src/main/res/layout/fragment_onboarding_home.xml index bea34b260..4637bf9cd 100644 --- a/app/src/main/res/layout/fragment_onboarding_home.xml +++ b/app/src/main/res/layout/fragment_onboarding_home.xml @@ -1,39 +1,38 @@ - - - + + + android:paddingLeft="@dimen/vertical_padding" + android:paddingRight="@dimen/vertical_padding" + android:text="@string/onboarding_feed_desc" /> diff --git a/app/src/main/res/layout/fragment_onboarding_reporting.xml b/app/src/main/res/layout/fragment_onboarding_reporting.xml index 553d37f82..bea294fbf 100644 --- a/app/src/main/res/layout/fragment_onboarding_reporting.xml +++ b/app/src/main/res/layout/fragment_onboarding_reporting.xml @@ -1,59 +1,59 @@ - - + + + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingLeft="@dimen/vertical_padding" + android:paddingTop="@dimen/content_spacing" + android:paddingRight="@dimen/vertical_padding" + android:paddingBottom="@dimen/content_spacing"> + app:switchTextAppearance="?textAppearanceBody1" /> + app:strokeColor="?colorSecondary" /> diff --git a/app/src/main/res/layout/fragment_preferences_associations.xml b/app/src/main/res/layout/fragment_preferences_associations.xml index 553a557a4..3c140ba61 100644 --- a/app/src/main/res/layout/fragment_preferences_associations.xml +++ b/app/src/main/res/layout/fragment_preferences_associations.xml @@ -1,10 +1,10 @@ + android:layout_height="wrap_content" + app:iconifiedByDefault="false" /> @@ -39,12 +39,12 @@ android:layout_height="match_parent"> diff --git a/app/src/main/res/layout/fragment_resto_extra.xml b/app/src/main/res/layout/fragment_resto_extra.xml index 1a4e25ad4..9f1bc4c9a 100644 --- a/app/src/main/res/layout/fragment_resto_extra.xml +++ b/app/src/main/res/layout/fragment_resto_extra.xml @@ -1,5 +1,5 @@ - @@ -8,8 +8,8 @@ android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" - tools:listitem="@layout/item_resto_fooditem" - app:layoutManager="@string/app_layout_manager_linear" /> + app:layoutManager="@string/app_layout_manager_linear" + tools:listitem="@layout/item_resto_fooditem" /> diff --git a/app/src/main/res/layout/fragment_resto_menu_legend.xml b/app/src/main/res/layout/fragment_resto_menu_legend.xml index 748575f56..466b489f9 100644 --- a/app/src/main/res/layout/fragment_resto_menu_legend.xml +++ b/app/src/main/res/layout/fragment_resto_menu_legend.xml @@ -1,23 +1,23 @@ + android:paddingLeft="@dimen/activity_vertical_margin" + android:paddingRight="@dimen/activity_vertical_margin"> + android:text="@string/resto_legend_msc_abbr" /> + android:layout_weight="1" + android:text="@string/resto_legend_msc_desc" + android:textIsSelectable="true" /> + android:paddingEnd="16dp" + android:paddingRight="16dp" + android:text="@string/resto_legend_asc_abbr" /> + android:layout_weight="1" + android:text="@string/resto_legend_asc_desc" + android:textIsSelectable="true" /> + android:text="@string/resto_legend_gap_abbr" /> + android:layout_weight="1" + android:text="@string/resto_legend_gap_desc" + android:textIsSelectable="true" /> diff --git a/app/src/main/res/layout/fragment_schamper.xml b/app/src/main/res/layout/fragment_schamper.xml index 0258f98e3..fc890fdb1 100644 --- a/app/src/main/res/layout/fragment_schamper.xml +++ b/app/src/main/res/layout/fragment_schamper.xml @@ -1,9 +1,9 @@ + android:id="@+id/swipeRefreshLayout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + app:spanCount="@integer/span_count_large" + tools:listitem="@layout/item_schamper" /> diff --git a/app/src/main/res/layout/fragment_sko_lineup.xml b/app/src/main/res/layout/fragment_sko_lineup.xml index 7b825ead0..94b8cb5da 100644 --- a/app/src/main/res/layout/fragment_sko_lineup.xml +++ b/app/src/main/res/layout/fragment_sko_lineup.xml @@ -1,11 +1,11 @@ + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:scrollbarStyle="outsideOverlay" + android:scrollbars="vertical" + app:layoutManager="@string/app_layout_manager_linear" + tools:listitem="@layout/item_sko_lineup_artist" /> diff --git a/app/src/main/res/layout/fragment_urgent.xml b/app/src/main/res/layout/fragment_urgent.xml index d1c8c3f42..ed36e8d21 100644 --- a/app/src/main/res/layout/fragment_urgent.xml +++ b/app/src/main/res/layout/fragment_urgent.xml @@ -1,52 +1,52 @@ + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> - - + + + android:paddingLeft="@dimen/activity_vertical_margin" + android:paddingRight="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/content_spacing" + android:text="@string/urgent_fm" + android:textColor="?colorPrimary" + android:textStyle="bold" /> + android:layout_height="wrap_content" + android:layout_gravity="center" /> + app:srcCompat="@drawable/ic_play_arrow_24dp" /> + android:layout_height="wrap_content" + android:orientation="vertical"> + tools:visibility="visible" /> + android:visibility="gone" + tools:text="De beschrijving van het programma." + tools:visibility="visible" /> + android:paddingTop="@dimen/vertical_padding"> + app:srcCompat="@drawable/ic_social_facebook_inner" /> + app:srcCompat="@drawable/ic_social_instagram" /> + app:srcCompat="@drawable/tabs_urgent" /> + app:srcCompat="@drawable/ic_social_youtube" /> diff --git a/app/src/main/res/layout/home_card_event.xml b/app/src/main/res/layout/home_card_event.xml index b4d1e181a..c09cec93e 100644 --- a/app/src/main/res/layout/home_card_event.xml +++ b/app/src/main/res/layout/home_card_event.xml @@ -1,7 +1,7 @@ - + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingLeft="@dimen/card_title_padding_vertical" + android:paddingRight="@dimen/card_title_padding_vertical"> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxLines="1" + tools:text="Starttijd" /> + android:contentDescription="@string/content_desc_association_icon" + android:scaleType="fitCenter" + tools:src="@drawable/ic_event" /> diff --git a/app/src/main/res/layout/home_card_library.xml b/app/src/main/res/layout/home_card_library.xml index dea3cf4cb..98b6e992e 100644 --- a/app/src/main/res/layout/home_card_library.xml +++ b/app/src/main/res/layout/home_card_library.xml @@ -1,13 +1,13 @@ - + android:focusable="true" + app:contentPaddingBottom="@dimen/card_title_padding_bottom_no_content"> + app:menu="@menu/now_toolbar_single" + app:title="@string/drawer_title_library" /> + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="@dimen/card_title_padding_vertical" + android:paddingRight="@dimen/card_title_padding_vertical"> diff --git a/app/src/main/res/layout/home_card_news_item.xml b/app/src/main/res/layout/home_card_news_item.xml index 8177e89ce..6fd7af4ce 100644 --- a/app/src/main/res/layout/home_card_news_item.xml +++ b/app/src/main/res/layout/home_card_news_item.xml @@ -1,7 +1,7 @@ - + android:layout_height="wrap_content" + android:orientation="vertical"> - - + + + tools:text="11 maart 2014 door Zeus WPI" /> diff --git a/app/src/main/res/layout/home_card_resto.xml b/app/src/main/res/layout/home_card_resto.xml index 2a44721f9..ba89462ba 100644 --- a/app/src/main/res/layout/home_card_resto.xml +++ b/app/src/main/res/layout/home_card_resto.xml @@ -1,7 +1,7 @@ - diff --git a/app/src/main/res/layout/home_card_schamper.xml b/app/src/main/res/layout/home_card_schamper.xml index 431eea0e2..e22c2cf48 100644 --- a/app/src/main/res/layout/home_card_schamper.xml +++ b/app/src/main/res/layout/home_card_schamper.xml @@ -1,14 +1,14 @@ - + android:focusable="true" + android:foreground="?android:attr/selectableItemBackground"> + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingLeft="@dimen/card_title_padding_vertical" + android:paddingRight="@dimen/card_title_padding_vertical"> + android:contentDescription="@string/content_desc_schamper_image" + android:scaleType="fitCenter" + tools:src="@drawable/tabs_schamper" /> diff --git a/app/src/main/res/layout/home_card_special.xml b/app/src/main/res/layout/home_card_special.xml index 7acf93fc6..985c14d6f 100644 --- a/app/src/main/res/layout/home_card_special.xml +++ b/app/src/main/res/layout/home_card_special.xml @@ -1,7 +1,7 @@ - + android:layout_height="wrap_content" + android:orientation="horizontal"> + android:orientation="vertical"> + android:paddingTop="@dimen/card_title_padding_top" + tools:text="12urenloop" /> + tools:text="Volg live de tussenstanden van de 12urenloop!" /> + android:scaleType="fitEnd" /> diff --git a/app/src/main/res/layout/home_card_urgent.xml b/app/src/main/res/layout/home_card_urgent.xml index 4efc0b690..8901ba3a3 100644 --- a/app/src/main/res/layout/home_card_urgent.xml +++ b/app/src/main/res/layout/home_card_urgent.xml @@ -1,7 +1,7 @@ - + app:menu="@menu/now_toolbar_single" + app:title="@string/drawer_title_urgent" /> + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingLeft="@dimen/card_title_padding_vertical" + android:paddingRight="@dimen/card_title_padding_vertical"> + android:text="@string/feed_urgent_player_desc" /> + android:contentDescription="@string/content_desc_urgent_icon" + android:scaleType="fitCenter" + android:src="@drawable/logo_urgent" /> - + diff --git a/app/src/main/res/layout/info_card.xml b/app/src/main/res/layout/info_card.xml index c9a939659..aacf9ede9 100644 --- a/app/src/main/res/layout/info_card.xml +++ b/app/src/main/res/layout/info_card.xml @@ -1,19 +1,19 @@ - + tools:text="Informatienaam" /> diff --git a/app/src/main/res/layout/item_checkbox_string.xml b/app/src/main/res/layout/item_checkbox_string.xml index 063333cba..23b01c372 100644 --- a/app/src/main/res/layout/item_checkbox_string.xml +++ b/app/src/main/res/layout/item_checkbox_string.xml @@ -4,27 +4,27 @@ android:id="@+id/parent_layout" android:layout_width="match_parent" android:layout_height="@dimen/material_list_single_line_with_avatar_normal_height" - android:orientation="horizontal" - android:gravity="center_vertical" android:background="?android:attr/selectableItemBackground" android:clickable="true" android:focusable="true" - android:paddingLeft="@dimen/material_list_icon_first_position_margin_start" - android:paddingStart="@dimen/material_list_icon_first_position_margin_start"> + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingStart="@dimen/material_list_icon_first_position_margin_start" + android:paddingLeft="@dimen/material_list_icon_first_position_margin_start"> + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/material_list_icon_last_position_margin_horizontal" + android:layout_marginRight="@dimen/material_list_icon_last_position_margin_horizontal" /> diff --git a/app/src/main/res/layout/item_checkbox_string_description.xml b/app/src/main/res/layout/item_checkbox_string_description.xml index c06a6360b..02cb30dad 100644 --- a/app/src/main/res/layout/item_checkbox_string_description.xml +++ b/app/src/main/res/layout/item_checkbox_string_description.xml @@ -4,45 +4,45 @@ android:id="@+id/parent_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingLeft="@dimen/material_list_icon_first_position_margin_start" - android:paddingTop="@dimen/list_two_line_padding_horizontal" - android:paddingBottom="@dimen/list_two_line_padding_horizontal" - android:orientation="horizontal" - android:gravity="center_vertical" android:background="?android:attr/selectableItemBackground" android:clickable="true" - android:focusable="true"> + android:focusable="true" + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="@dimen/material_list_icon_first_position_margin_start" + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + android:baselineAligned="false" + android:clickable="false" + android:orientation="vertical"> + android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/material_list_icon_last_position_margin_horizontal" + android:layout_marginRight="@dimen/material_list_icon_last_position_margin_horizontal" /> diff --git a/app/src/main/res/layout/item_date_header.xml b/app/src/main/res/layout/item_date_header.xml index 8b5958571..9e3819a69 100644 --- a/app/src/main/res/layout/item_date_header.xml +++ b/app/src/main/res/layout/item_date_header.xml @@ -1,20 +1,18 @@ - + android:paddingRight="@dimen/activity_vertical_margin"> diff --git a/app/src/main/res/layout/item_event_date_header.xml b/app/src/main/res/layout/item_event_date_header.xml index 5394574f3..b1ab5c817 100644 --- a/app/src/main/res/layout/item_event_date_header.xml +++ b/app/src/main/res/layout/item_event_date_header.xml @@ -3,31 +3,33 @@ + app:contentPaddingRight="@dimen/card_text_padding_vertical" + app:shapeAppearanceOverlay="@style/EventTopShape"> - + diff --git a/app/src/main/res/layout/item_event_item.xml b/app/src/main/res/layout/item_event_item.xml index a77491905..0b938f4b2 100644 --- a/app/src/main/res/layout/item_event_item.xml +++ b/app/src/main/res/layout/item_event_item.xml @@ -1,58 +1,58 @@ + app:contentPaddingTop="@dimen/card_text_padding_top"> + android:layout_height="wrap_content" + android:orientation="horizontal"> + android:orientation="vertical"> + tools:text="Titel en naam" /> diff --git a/app/src/main/res/layout/item_library.xml b/app/src/main/res/layout/item_library.xml index 7956cbada..d46a596d8 100644 --- a/app/src/main/res/layout/item_library.xml +++ b/app/src/main/res/layout/item_library.xml @@ -1,59 +1,59 @@ + android:focusable="true" + android:gravity="center_vertical" + android:orientation="horizontal" + android:paddingLeft="@dimen/material_list_text_only_margin_horizontal"> + android:layout_weight="1" + android:orientation="vertical" + android:paddingTop="@dimen/list_two_line_padding_horizontal" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + android:visibility="gone" + app:srcCompat="@drawable/ic_star" + app:tint="?colorSecondary" + tools:visibility="visible" /> diff --git a/app/src/main/res/layout/item_news.xml b/app/src/main/res/layout/item_news.xml index aaccec255..cda07a926 100644 --- a/app/src/main/res/layout/item_news.xml +++ b/app/src/main/res/layout/item_news.xml @@ -9,38 +9,38 @@ android:focusable="true"> + android:orientation="vertical" + android:paddingLeft="@dimen/material_card_title_block_padding_horizontal" + android:paddingRight="@dimen/material_card_title_block_padding_horizontal"> + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingTop="@dimen/material_card_title_block_large_subtitle_margin_top" + android:paddingBottom="@dimen/material_card_title_block_large_padding_bottom" + tools:text="Informatie over het artikel" /> + android:paddingBottom="@dimen/card_text_padding_bottom_no_content" + tools:text="Heel mooie text over het artikel!" /> diff --git a/app/src/main/res/layout/item_no_data.xml b/app/src/main/res/layout/item_no_data.xml index c9ddef02a..fd247ebe1 100644 --- a/app/src/main/res/layout/item_no_data.xml +++ b/app/src/main/res/layout/item_no_data.xml @@ -1,12 +1,12 @@ \ No newline at end of file + android:text="@string/no_items" + android:textSize="@dimen/material_list_normal_primary_text_size" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_resto_fooditem.xml b/app/src/main/res/layout/item_resto_fooditem.xml index 9fbf48758..aaf2b216d 100644 --- a/app/src/main/res/layout/item_resto_fooditem.xml +++ b/app/src/main/res/layout/item_resto_fooditem.xml @@ -1,27 +1,27 @@ diff --git a/app/src/main/res/layout/item_sandwich.xml b/app/src/main/res/layout/item_sandwich.xml index d42fee030..2a7660465 100644 --- a/app/src/main/res/layout/item_sandwich.xml +++ b/app/src/main/res/layout/item_sandwich.xml @@ -1,50 +1,50 @@ + android:paddingRight="@dimen/list_two_line_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> + android:baselineAligned="false" + android:orientation="horizontal"> + android:gravity="end" + android:orientation="vertical"> @@ -56,12 +56,12 @@ android:layout_height="wrap_content"> + tools:text="Heel veel ingrediënten hier." /> diff --git a/app/src/main/res/layout/item_sandwich_eco.xml b/app/src/main/res/layout/item_sandwich_eco.xml index 80da69536..ff684e2fd 100644 --- a/app/src/main/res/layout/item_sandwich_eco.xml +++ b/app/src/main/res/layout/item_sandwich_eco.xml @@ -1,36 +1,36 @@ + android:paddingRight="@dimen/list_two_line_padding_vertical" + android:paddingBottom="@dimen/list_two_line_padding_horizontal"> - - - - + android:baselineAligned="false" + android:orientation="vertical"> + + + + @@ -40,12 +40,12 @@ android:layout_height="wrap_content"> + tools:text="Heel veel ingrediënten hier." /> diff --git a/app/src/main/res/layout/item_schamper.xml b/app/src/main/res/layout/item_schamper.xml index 5c2138c67..8e7b55b62 100644 --- a/app/src/main/res/layout/item_schamper.xml +++ b/app/src/main/res/layout/item_schamper.xml @@ -1,8 +1,8 @@ + android:contentDescription="@string/content_desc_schamper_article" + android:maxHeight="400dp" + android:scaleType="centerCrop" /> + android:layout_gravity="center_vertical" + android:text="@string/schamper_category_none" /> diff --git a/app/src/main/res/layout/item_sko_lineup_artist.xml b/app/src/main/res/layout/item_sko_lineup_artist.xml index f056acedd..4aaf1121d 100644 --- a/app/src/main/res/layout/item_sko_lineup_artist.xml +++ b/app/src/main/res/layout/item_sko_lineup_artist.xml @@ -8,8 +8,8 @@ android:layout_marginRight="@dimen/card_margin" android:layout_marginBottom="@dimen/card_spacing" android:clickable="true" - android:longClickable="true" - android:focusable="true"> + android:focusable="true" + android:longClickable="true"> + android:scaleType="centerCrop" /> + android:scaleType="centerCrop" + android:src="@drawable/gradient_black_bottom" /> + android:layout_gravity="bottom" + android:orientation="vertical"> + tools:text="Datum Gisteren" /> diff --git a/app/src/main/res/layout/item_title.xml b/app/src/main/res/layout/item_title.xml index dc517990e..fa337e4a3 100644 --- a/app/src/main/res/layout/item_title.xml +++ b/app/src/main/res/layout/item_title.xml @@ -1,19 +1,19 @@ diff --git a/app/src/main/res/layout/x_now_toolbar.xml b/app/src/main/res/layout/x_now_toolbar.xml index f850110ce..c989f3ed0 100644 --- a/app/src/main/res/layout/x_now_toolbar.xml +++ b/app/src/main/res/layout/x_now_toolbar.xml @@ -2,48 +2,47 @@ - + android:orientation="horizontal"> + android:padding="8dp" + app:tint="@color/hydra_color_primary_variant_light" + tools:ignore="MissingPrefix" + tools:src="@drawable/tabs_resto" /> diff --git a/app/src/main/res/layout/x_progress_bar.xml b/app/src/main/res/layout/x_progress_bar.xml index cfc6fcb96..c390081ed 100644 --- a/app/src/main/res/layout/x_progress_bar.xml +++ b/app/src/main/res/layout/x_progress_bar.xml @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/app/src/main/res/layout/x_simple_spinner_dropdown_item.xml b/app/src/main/res/layout/x_simple_spinner_dropdown_item.xml index 7d62c5fed..df196b037 100644 --- a/app/src/main/res/layout/x_simple_spinner_dropdown_item.xml +++ b/app/src/main/res/layout/x_simple_spinner_dropdown_item.xml @@ -1,5 +1,4 @@ - - diff --git a/app/src/main/res/layout/x_spinner_title_main.xml b/app/src/main/res/layout/x_spinner_title_main.xml index a5032034b..ef7eef06f 100644 --- a/app/src/main/res/layout/x_spinner_title_main.xml +++ b/app/src/main/res/layout/x_spinner_title_main.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" + android:textAlignment="inherit" android:textAppearance="?attr/textAppearanceHeadline6" android:textColor="?colorControlNormal" - tools:text="Selected spinner item" - android:textAlignment="inherit" /> + tools:text="Selected spinner item" /> diff --git a/app/src/main/res/layout/x_spinner_title_resto.xml b/app/src/main/res/layout/x_spinner_title_resto.xml index f8addb0f8..0f6589fb5 100644 --- a/app/src/main/res/layout/x_spinner_title_resto.xml +++ b/app/src/main/res/layout/x_spinner_title_resto.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:singleLine="true" + android:textAlignment="inherit" android:textAppearance="?attr/textAppearanceBody2" android:textColor="?colorControlNormal" - tools:text="Selected spinner item" - android:textAlignment="inherit" /> + tools:text="Selected spinner item" /> diff --git a/app/src/main/res/layout/x_toolbar.xml b/app/src/main/res/layout/x_toolbar.xml index f91f093fd..e662a5a88 100644 --- a/app/src/main/res/layout/x_toolbar.xml +++ b/app/src/main/res/layout/x_toolbar.xml @@ -1,7 +1,6 @@ - \ No newline at end of file + android:ellipsize="marquee" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_resto.xml b/app/src/main/res/menu/bottom_resto.xml index 2d08d72ba..933d8b668 100644 --- a/app/src/main/res/menu/bottom_resto.xml +++ b/app/src/main/res/menu/bottom_resto.xml @@ -3,8 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> diff --git a/app/src/main/res/menu/drawer_items.xml b/app/src/main/res/menu/drawer_items.xml index 73c037e26..d24e3a153 100644 --- a/app/src/main/res/menu/drawer_items.xml +++ b/app/src/main/res/menu/drawer_items.xml @@ -28,7 +28,7 @@ + android:title="@string/drawer_title_library" /> + android:orderInCategory="50" + android:title="@string/action_open_map" + app:showAsAction="ifRoom" /> + android:orderInCategory="60" + android:title="@string/action_add_to_calendar" + app:showAsAction="ifRoom" /> + android:orderInCategory="100" + android:title="@string/action_view_link" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_library_list.xml b/app/src/main/res/menu/menu_library_list.xml index a08de6db3..2f6d9ade3 100644 --- a/app/src/main/res/menu/menu_library_list.xml +++ b/app/src/main/res/menu/menu_library_list.xml @@ -2,25 +2,26 @@ - + app:showAsAction="always" /> + android:title="@string/action_refresh" + app:showAsAction="ifRoom" /> + android:orderInCategory="110" + android:title="@string/library_action_open_catalogue" + app:showAsAction="never" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main_events.xml b/app/src/main/res/menu/menu_main_events.xml index b5b1624e0..d48dc350c 100644 --- a/app/src/main/res/menu/menu_main_events.xml +++ b/app/src/main/res/menu/menu_main_events.xml @@ -2,17 +2,18 @@ - + app:showAsAction="always" /> + android:title="@string/action_refresh" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_news.xml b/app/src/main/res/menu/menu_news.xml index df11d159a..54be7e533 100644 --- a/app/src/main/res/menu/menu_news.xml +++ b/app/src/main/res/menu/menu_news.xml @@ -3,9 +3,9 @@ + android:orderInCategory="100" + android:title="@string/action_open_browser" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_pref_selectors.xml b/app/src/main/res/menu/menu_pref_selectors.xml index 963c2b722..dbecf270a 100644 --- a/app/src/main/res/menu/menu_pref_selectors.xml +++ b/app/src/main/res/menu/menu_pref_selectors.xml @@ -1,20 +1,19 @@ - + android:orderInCategory="50" + android:title="@string/select_all" + app:showAsAction="ifRoom" /> + android:orderInCategory="60" + android:title="@string/select_none" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_refresh.xml b/app/src/main/res/menu/menu_refresh.xml index 7f841d612..bb3a8b820 100644 --- a/app/src/main/res/menu/menu_refresh.xml +++ b/app/src/main/res/menu/menu_refresh.xml @@ -5,6 +5,6 @@ android:id="@+id/action_refresh" android:icon="@drawable/ic_refresh" android:orderInCategory="50" - app:showAsAction="ifRoom" - android:title="@string/action_refresh" /> + android:title="@string/action_refresh" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_resto.xml b/app/src/main/res/menu/menu_resto.xml index 31b6e57e6..8dac6a03a 100644 --- a/app/src/main/res/menu/menu_resto.xml +++ b/app/src/main/res/menu/menu_resto.xml @@ -1,20 +1,20 @@ - - - + xmlns:app="http://schemas.android.com/apk/res-auto"> + + + diff --git a/app/src/main/res/menu/menu_resto_location.xml b/app/src/main/res/menu/menu_resto_location.xml index bc3017a5a..8a49eb32c 100644 --- a/app/src/main/res/menu/menu_resto_location.xml +++ b/app/src/main/res/menu/menu_resto_location.xml @@ -1,17 +1,17 @@ + xmlns:app="http://schemas.android.com/apk/res-auto"> - + - + diff --git a/app/src/main/res/menu/menu_sandwhich.xml b/app/src/main/res/menu/menu_sandwhich.xml index e7b776a12..58f7bd6a6 100644 --- a/app/src/main/res/menu/menu_sandwhich.xml +++ b/app/src/main/res/menu/menu_sandwhich.xml @@ -2,8 +2,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> + android:orderInCategory="100" + android:title="@string/action_view_website" + app:showAsAction="ifRoom" /> diff --git a/app/src/main/res/menu/menu_schamper.xml b/app/src/main/res/menu/menu_schamper.xml index 49c6f54bf..6822897b9 100644 --- a/app/src/main/res/menu/menu_schamper.xml +++ b/app/src/main/res/menu/menu_schamper.xml @@ -4,16 +4,16 @@ + android:orderInCategory="50" + android:title="@string/action_open_browser" + app:showAsAction="ifRoom" /> + android:orderInCategory="100" + android:title="@string/action_share" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_sko.xml b/app/src/main/res/menu/menu_sko.xml index 6814398ef..450a3d8db 100644 --- a/app/src/main/res/menu/menu_sko.xml +++ b/app/src/main/res/menu/menu_sko.xml @@ -1,12 +1,11 @@ - diff --git a/app/src/main/res/menu/menu_sko_artist.xml b/app/src/main/res/menu/menu_sko_artist.xml index cea9285e5..3f84d6e8e 100644 --- a/app/src/main/res/menu/menu_sko_artist.xml +++ b/app/src/main/res/menu/menu_sko_artist.xml @@ -4,9 +4,9 @@ + android:orderInCategory="100" + android:title="@string/action_add_to_calendar" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 64c7b2035..579522a8d 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/values-anydpi-v26/mipmaps.xml b/app/src/main/res/values-anydpi-v26/mipmaps.xml index 5e0acc9fa..3af30cc0f 100644 --- a/app/src/main/res/values-anydpi-v26/mipmaps.xml +++ b/app/src/main/res/values-anydpi-v26/mipmaps.xml @@ -1,4 +1,4 @@ - @mipmap/ic_launcher + @mipmap/ic_launcher \ No newline at end of file diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index 6b662b8e2..b97ddb113 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -8,7 +8,8 @@ 5 9 11 - -array> + + -array> @string/feed_card_type_title_resto diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index adba4bbb0..f4af87c88 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -17,7 +17,7 @@ - + @@ -32,7 +32,7 @@ --> - - - + + + diff --git a/app/src/main/res/values/shapes.xml b/app/src/main/res/values/shapes.xml index ba3972a39..accc47794 100644 --- a/app/src/main/res/values/shapes.xml +++ b/app/src/main/res/values/shapes.xml @@ -1,5 +1,6 @@ + - - - @@ -63,11 +63,10 @@ @dimen/material_emphasis_medium @dimen/material_emphasis_disabled - ?colorPrimarySurface + ?colorPrimarySurface false - ?android:colorBackground - true - ?colorControlHighlight + @color/black + false ?colorPrimaryVariant From ba8f5228d57e9ffb2897d415721ced71a87915a8 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 6 Sep 2020 22:36:01 +0200 Subject: [PATCH 22/23] No HTTP traffic to DSA --- app/src/main/res/xml/network_security_config.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml index f7761b8c5..5f18e75f1 100644 --- a/app/src/main/res/xml/network_security_config.xml +++ b/app/src/main/res/xml/network_security_config.xml @@ -3,6 +3,7 @@ hydra.ugent.be studentkickoff.be + dsa.ugent.be From ba12233b8673aa4f6b7be53dffb71cdafb7e3cc5 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Sun, 6 Sep 2020 22:34:04 +0200 Subject: [PATCH 23/23] Update version to 30000 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5e1f42251..e3422d691 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "be.ugent.zeus.hydra" minSdkVersion 21 targetSdkVersion 29 - versionCode 21402 - versionName "2.14.2" + versionCode 30000 + versionName "3.0.0" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"