From 67f4479e86df05c099bdfd6a4ecdffd81ecea495 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Mon, 23 Jul 2018 15:18:33 +0200 Subject: [PATCH] fix some lint warnings, use kotlin view imports in ModalTimeLineActivity --- .../tusky/ModalTimelineActivity.kt | 17 +++++------------ .../tusky/fragment/PreferencesFragment.java | 1 - .../com/keylesspalace/tusky/util/ListUtils.java | 12 +----------- .../main/res/layout/activity_modal_timeline.xml | 2 +- app/src/main/res/menu/view_media_toolbar.xml | 2 +- app/src/main/res/values-de/strings.xml | 2 +- build.gradle | 2 +- 7 files changed, 10 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ModalTimelineActivity.kt b/app/src/main/java/com/keylesspalace/tusky/ModalTimelineActivity.kt index 5f5a122a6..cb6f37ead 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ModalTimelineActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/ModalTimelineActivity.kt @@ -5,21 +5,17 @@ import android.content.Intent import android.os.Bundle import android.support.design.widget.FloatingActionButton import android.support.v4.app.Fragment -import android.support.v7.widget.Toolbar import android.view.MenuItem -import android.widget.FrameLayout import com.keylesspalace.tusky.fragment.TimelineFragment import com.keylesspalace.tusky.interfaces.ActionButtonActivity import dagger.android.AndroidInjector import dagger.android.DispatchingAndroidInjector import dagger.android.support.HasSupportFragmentInjector +import kotlinx.android.synthetic.main.toolbar_basic.* import javax.inject.Inject class ModalTimelineActivity : BottomSheetActivity(), ActionButtonActivity, HasSupportFragmentInjector { - @Inject - lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector - companion object { private const val ARG_KIND = "kind" private const val ARG_ARG = "arg" @@ -34,15 +30,13 @@ class ModalTimelineActivity : BottomSheetActivity(), ActionButtonActivity, HasSu } } - - lateinit var contentFrame: FrameLayout + @Inject + lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_modal_timeline) - contentFrame = findViewById(R.id.content_frame) - val toolbar = findViewById(R.id.toolbar) setSupportActionBar(toolbar) val bar = supportActionBar if (bar != null) { @@ -51,19 +45,18 @@ class ModalTimelineActivity : BottomSheetActivity(), ActionButtonActivity, HasSu bar.setDisplayShowHomeEnabled(true) } - if (supportFragmentManager.findFragmentById(R.id.content_frame) == null) { + if (supportFragmentManager.findFragmentById(R.id.contentFrame) == null) { val kind = intent?.getSerializableExtra(ARG_KIND) as? TimelineFragment.Kind ?: TimelineFragment.Kind.HOME val argument = intent?.getStringExtra(ARG_ARG) supportFragmentManager.beginTransaction() - .replace(R.id.content_frame, TimelineFragment.newInstance(kind, argument)) + .replace(R.id.contentFrame, TimelineFragment.newInstance(kind, argument)) .commit() } } override fun getActionButton(): FloatingActionButton? = null - override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { onBackPressed() diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/PreferencesFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/PreferencesFragment.java index c5bc4ff65..e36d7cb61 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/PreferencesFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/PreferencesFragment.java @@ -23,7 +23,6 @@ import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.Preference; -import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import android.support.annotation.XmlRes; import android.text.Editable; diff --git a/app/src/main/java/com/keylesspalace/tusky/util/ListUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/ListUtils.java index 76623f2ee..5c9c34b08 100644 --- a/app/src/main/java/com/keylesspalace/tusky/util/ListUtils.java +++ b/app/src/main/java/com/keylesspalace/tusky/util/ListUtils.java @@ -27,19 +27,9 @@ public class ListUtils { return list == null || list.isEmpty(); } - /** @return 0 if list is null, or else return list.size() */ - public static int getSize(@Nullable List list) { - if (list == null) { - return 0; - } else { - return list.size(); - } - } - /** @return a new ArrayList containing the elements without duplicates in the same order */ public static ArrayList removeDuplicates(List list) { - LinkedHashSet set = new LinkedHashSet<>(); - set.addAll(list); + LinkedHashSet set = new LinkedHashSet<>(list); return new ArrayList<>(set); } } diff --git a/app/src/main/res/layout/activity_modal_timeline.xml b/app/src/main/res/layout/activity_modal_timeline.xml index cd565ac1c..64274efce 100644 --- a/app/src/main/res/layout/activity_modal_timeline.xml +++ b/app/src/main/res/layout/activity_modal_timeline.xml @@ -10,7 +10,7 @@ diff --git a/app/src/main/res/menu/view_media_toolbar.xml b/app/src/main/res/menu/view_media_toolbar.xml index 927584290..eb55440fb 100644 --- a/app/src/main/res/menu/view_media_toolbar.xml +++ b/app/src/main/res/menu/view_media_toolbar.xml @@ -5,7 +5,7 @@ android:id="@+id/action_download" android:icon="@drawable/ic_file_download_black_24dp" android:title="@string/dialog_download_image" - app:showAsAction="always" /> + app:showAsAction="ifRoom" /> nicht mehr teilen Tusky enthält Code und Inhalte von den folgenden Open-Source-Projekten: - Lizensiert unter der Apache-Lizenz (s. u.) + Lizenziert unter der Apache-Lizenz (s. u.) CC-BY 4.0 Beitrag öffnen Geteilte Beiträge verbergen diff --git a/build.gradle b/build.gradle index 0098725dd..57baaa696 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.50' + ext.kotlin_version = '1.2.51' repositories { jcenter() google()