From f24de686183b62ec919b3deb2bf8d387ccf8e44c Mon Sep 17 00:00:00 2001 From: Amine Bou Date: Sun, 25 Mar 2018 21:11:47 +0200 Subject: [PATCH] Code cleaning and versions updates. --- app/build.gradle | 10 +++++----- .../amine/bou/readerforselfoss/AddSourceActivity.kt | 2 +- .../apps/amine/bou/readerforselfoss/HomeActivity.kt | 3 --- .../apps/amine/bou/readerforselfoss/ReaderActivity.kt | 3 +-- .../bou/readerforselfoss/api/selfoss/SelfossModels.kt | 2 +- .../bou/readerforselfoss/fragments/ArticleFragment.kt | 3 --- .../utils/customtabs/CustomTabActivityHelper.java | 3 +-- app/src/main/res/layout/activity_reader.xml | 1 - app/src/main/res/layout/activity_sources.xml | 6 ++---- app/src/main/res/menu/reader_toolbar.xml | 3 +-- 10 files changed, 12 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 16f29c2..dc981aa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -130,15 +130,15 @@ dependencies { compile 'com.android.support.constraint:constraint-layout:1.0.2' // Firebase + crashlytics - compile 'com.google.firebase:firebase-core:11.8.0' - compile 'com.google.firebase:firebase-config:11.8.0' - compile 'com.google.firebase:firebase-invites:11.8.0' + compile 'com.google.firebase:firebase-core:12.0.0' + compile 'com.google.firebase:firebase-config:12.0.0' + compile 'com.google.firebase:firebase-invites:12.0.0' compile('com.crashlytics.sdk.android:crashlytics:2.9.0@aar') { - transitive = true; + transitive = true } //multidex - compile 'com.android.support:multidex:1.0.2' + compile 'com.android.support:multidex:1.0.3' // Intro compile 'agency.tango.android:material-intro-screen:0.0.5' diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt index 94ed77a..0bf3de9 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/AddSourceActivity.kt @@ -99,7 +99,7 @@ class AddSourceActivity : AppCompatActivity() { val itemsStrings = items.map { it.value.name } for ((key, value) in items) { - spoutsKV.put(value.name, key) + spoutsKV[value.name] = key } mProgress.visibility = View.GONE diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt index e0e2e04..d19e6b7 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -2,7 +2,6 @@ package apps.amine.bou.readerforselfoss import android.app.Activity import android.content.Context -import android.content.DialogInterface import android.content.Intent import android.content.SharedPreferences import android.graphics.Color @@ -52,7 +51,6 @@ import com.anupcowkur.reservoir.ReservoirPutCallback import com.ashokvarma.bottomnavigation.BottomNavigationBar import com.ashokvarma.bottomnavigation.BottomNavigationItem import com.ashokvarma.bottomnavigation.TextBadgeItem -import com.crashlytics.android.Crashlytics import com.crashlytics.android.answers.Answers import com.crashlytics.android.answers.InviteEvent import com.ftinc.scoop.Scoop @@ -664,7 +662,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { recyclerView.layoutManager = layoutManager } } else { - Unit } } } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt index 94aa9a3..1a937e0 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt @@ -79,8 +79,7 @@ class ReaderActivity : AppCompatActivity() { currentItem = intent.getIntExtra("currentItem", 0) - var adapter = ScreenSlidePagerAdapter(supportFragmentManager) - pager.adapter = adapter + pager.adapter = ScreenSlidePagerAdapter(supportFragmentManager) pager.currentItem = currentItem } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/api/selfoss/SelfossModels.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/api/selfoss/SelfossModels.kt index 8e5ac7f..01e6add 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/api/selfoss/SelfossModels.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/api/selfoss/SelfossModels.kt @@ -145,7 +145,7 @@ data class Item( // handle url not starting with http if (stringUrl.startsWith("//")) { - stringUrl = "http:" + stringUrl + stringUrl = "http:$stringUrl" } return stringUrl diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt index c4962a5..d1d73eb 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt @@ -1,7 +1,6 @@ package apps.amine.bou.readerforselfoss.fragments import android.content.Context -import android.content.DialogInterface import android.content.Intent import android.content.SharedPreferences import android.net.Uri @@ -14,13 +13,11 @@ import android.support.v4.app.Fragment import android.support.v4.content.ContextCompat import android.support.v4.widget.NestedScrollView import android.support.v7.app.AlertDialog -import android.support.v7.view.ContextThemeWrapper import android.view.LayoutInflater import android.view.MenuItem import android.view.View import android.view.ViewGroup import android.webkit.WebSettings -import android.widget.Toast import apps.amine.bou.readerforselfoss.BuildConfig import apps.amine.bou.readerforselfoss.R import apps.amine.bou.readerforselfoss.api.mercury.MercuryApi diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/customtabs/CustomTabActivityHelper.java b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/customtabs/CustomTabActivityHelper.java index 5e7740d..004eb0f 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/customtabs/CustomTabActivityHelper.java +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/customtabs/CustomTabActivityHelper.java @@ -105,9 +105,8 @@ public class CustomTabActivityHelper implements ServiceConnectionCallback { if (mClient == null) return false; CustomTabsSession session = getSession(); - if (session == null) return false; + return session != null && session.mayLaunchUrl(uri, extras, otherLikelyBundles); - return session.mayLaunchUrl(uri, extras, otherLikelyBundles); } @Override diff --git a/app/src/main/res/layout/activity_reader.xml b/app/src/main/res/layout/activity_reader.xml index 7dd6c6a..90db78e 100644 --- a/app/src/main/res/layout/activity_reader.xml +++ b/app/src/main/res/layout/activity_reader.xml @@ -1,7 +1,6 @@ diff --git a/app/src/main/res/layout/activity_sources.xml b/app/src/main/res/layout/activity_sources.xml index 9d8be0d..471d5b0 100644 --- a/app/src/main/res/layout/activity_sources.xml +++ b/app/src/main/res/layout/activity_sources.xml @@ -1,13 +1,11 @@ - + tools:context="apps.amine.bou.readerforselfoss.SourcesActivity"> diff --git a/app/src/main/res/menu/reader_toolbar.xml b/app/src/main/res/menu/reader_toolbar.xml index 3127f7c..7729742 100644 --- a/app/src/main/res/menu/reader_toolbar.xml +++ b/app/src/main/res/menu/reader_toolbar.xml @@ -1,6 +1,5 @@ -