Skip to content
Snippets Groups Projects
Verified Commit f6566eae authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fixes #172 and #174

parent 17cf4bc0
No related branches found
No related tags found
No related merge requests found
Showing
with 311 additions and 174 deletions
...@@ -74,7 +74,7 @@ class BufferViewConfigFragment : ServiceBoundFragment() { ...@@ -74,7 +74,7 @@ class BufferViewConfigFragment : ServiceBoundFragment() {
lateinit var chatList: RecyclerView lateinit var chatList: RecyclerView
@BindView(R.id.feature_context_bufferactivitysync) @BindView(R.id.feature_context_bufferactivitysync)
lateinit var featureContextBufferactivitysync: WarningBarView lateinit var featureContextBufferActivitySync: WarningBarView
@Inject @Inject
lateinit var appearanceSettings: AppearanceSettings lateinit var appearanceSettings: AppearanceSettings
...@@ -286,7 +286,7 @@ class BufferViewConfigFragment : ServiceBoundFragment() { ...@@ -286,7 +286,7 @@ class BufferViewConfigFragment : ServiceBoundFragment() {
} }
viewModel.features.toLiveData().observe(this, Observer { viewModel.features.toLiveData().observe(this, Observer {
featureContextBufferactivitysync.setMode( featureContextBufferActivitySync.setMode(
if (it.hasFeature(ExtendedFeature.BufferActivitySync)) WarningBarView.MODE_NONE if (it.hasFeature(ExtendedFeature.BufferActivitySync)) WarningBarView.MODE_NONE
else WarningBarView.MODE_ICON else WarningBarView.MODE_ICON
) )
......
...@@ -48,10 +48,18 @@ import de.kuschku.quasseldroid.ui.coresettings.network.NetworkEditActivity ...@@ -48,10 +48,18 @@ import de.kuschku.quasseldroid.ui.coresettings.network.NetworkEditActivity
import de.kuschku.quasseldroid.ui.coresettings.networkconfig.NetworkConfigActivity import de.kuschku.quasseldroid.ui.coresettings.networkconfig.NetworkConfigActivity
import de.kuschku.quasseldroid.util.helper.combineLatest import de.kuschku.quasseldroid.util.helper.combineLatest
import de.kuschku.quasseldroid.util.helper.toLiveData import de.kuschku.quasseldroid.util.helper.toLiveData
import de.kuschku.quasseldroid.util.helper.visibleIf
import de.kuschku.quasseldroid.util.missingfeatures.MissingFeature
import de.kuschku.quasseldroid.util.missingfeatures.MissingFeaturesDialog
import de.kuschku.quasseldroid.util.missingfeatures.RequiredFeatures
import de.kuschku.quasseldroid.util.service.ServiceBoundFragment import de.kuschku.quasseldroid.util.service.ServiceBoundFragment
import de.kuschku.quasseldroid.util.ui.BannerView
import io.reactivex.Observable import io.reactivex.Observable
class CoreSettingsFragment : ServiceBoundFragment() { class CoreSettingsFragment : ServiceBoundFragment() {
@BindView(R.id.feature_context_missing)
lateinit var featureContextMissing: BannerView
@BindView(R.id.coreinfo) @BindView(R.id.coreinfo)
lateinit var coreinfo: View lateinit var coreinfo: View
...@@ -161,6 +169,21 @@ class CoreSettingsFragment : ServiceBoundFragment() { ...@@ -161,6 +169,21 @@ class CoreSettingsFragment : ServiceBoundFragment() {
chatListAdapter.submitList(it.orEmpty()) chatListAdapter.submitList(it.orEmpty())
}) })
var missingFeatureList: List<MissingFeature> = emptyList()
viewModel.features.toLiveData().observe(this, Observer { features ->
missingFeatureList = RequiredFeatures.features.filter {
it.feature !in features.enabledFeatures
}
featureContextMissing.visibleIf(missingFeatureList.isNotEmpty())
})
featureContextMissing.setOnClickListener {
MissingFeaturesDialog.Builder(requireActivity())
.missingFeatures(missingFeatureList)
.readOnly(true)
.show()
}
networkconfig.setOnClickListener { networkconfig.setOnClickListener {
NetworkConfigActivity.launch(requireContext()) NetworkConfigActivity.launch(requireContext())
} }
......
...@@ -35,6 +35,7 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -35,6 +35,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView import butterknife.BindView
import butterknife.ButterKnife import butterknife.ButterKnife
import de.kuschku.libquassel.quassel.ExtendedFeature
import de.kuschku.libquassel.quassel.syncables.HighlightRuleManager import de.kuschku.libquassel.quassel.syncables.HighlightRuleManager
import de.kuschku.libquassel.quassel.syncables.interfaces.IHighlightRuleManager import de.kuschku.libquassel.quassel.syncables.interfaces.IHighlightRuleManager
import de.kuschku.libquassel.util.Optional import de.kuschku.libquassel.util.Optional
...@@ -42,9 +43,13 @@ import de.kuschku.quasseldroid.R ...@@ -42,9 +43,13 @@ import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.ui.coresettings.SettingsFragment import de.kuschku.quasseldroid.ui.coresettings.SettingsFragment
import de.kuschku.quasseldroid.ui.coresettings.highlightrule.HighlightRuleActivity import de.kuschku.quasseldroid.ui.coresettings.highlightrule.HighlightRuleActivity
import de.kuschku.quasseldroid.util.helper.toLiveData import de.kuschku.quasseldroid.util.helper.toLiveData
import de.kuschku.quasseldroid.util.ui.WarningBarView
class HighlightListFragment : SettingsFragment(), SettingsFragment.Savable, class HighlightListFragment : SettingsFragment(), SettingsFragment.Savable,
SettingsFragment.Changeable { SettingsFragment.Changeable {
@BindView(R.id.feature_context_coresidehighlights)
lateinit var featureContextCoreSideHighlights: WarningBarView
@BindView(R.id.highlight_nick_type) @BindView(R.id.highlight_nick_type)
lateinit var highlightNickType: Spinner lateinit var highlightNickType: Spinner
...@@ -140,6 +145,13 @@ class HighlightListFragment : SettingsFragment(), SettingsFragment.Savable, ...@@ -140,6 +145,13 @@ class HighlightListFragment : SettingsFragment(), SettingsFragment.Savable,
} }
}) })
viewModel.features.toLiveData().observe(this, Observer {
featureContextCoreSideHighlights.setMode(
if (it.hasFeature(ExtendedFeature.CoreSideHighlights)) WarningBarView.MODE_NONE
else WarningBarView.MODE_ICON
)
})
return view return view
} }
......
package de.kuschku.quasseldroid.util.ui
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import android.widget.TextView
import androidx.annotation.StringRes
import androidx.appcompat.widget.AppCompatImageView
import butterknife.BindView
import butterknife.ButterKnife
import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.util.helper.use
class BannerView : FrameLayout {
@BindView(R.id.icon)
lateinit var icon: AppCompatImageView
@BindView(R.id.text)
lateinit var text: TextView
@BindView(R.id.button)
lateinit var button: TextView
constructor(context: Context) :
this(context, null)
constructor(context: Context, attrs: AttributeSet?) :
this(context, attrs, 0)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
super(context, attrs, defStyleAttr) {
LayoutInflater.from(context).inflate(R.layout.widget_banner, this, true)
ButterKnife.bind(this)
context.theme.obtainStyledAttributes(attrs, R.styleable.BannerView, 0, 0).use {
if (it.hasValue(R.styleable.BannerView_icon))
icon.setImageDrawable(it.getDrawable(R.styleable.BannerView_icon))
if (it.hasValue(R.styleable.BannerView_text))
text.text = it.getString(R.styleable.BannerView_text)
if (it.hasValue(R.styleable.BannerView_buttonText))
button.text = it.getString(R.styleable.BannerView_buttonText)
}
}
fun setText(content: String) {
text.text = content
}
fun setText(@StringRes content: Int) {
text.setText(content)
}
}
...@@ -5,7 +5,7 @@ import android.content.Context ...@@ -5,7 +5,7 @@ import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.LinearLayout import android.widget.FrameLayout
import android.widget.TextView import android.widget.TextView
import androidx.annotation.IntDef import androidx.annotation.IntDef
import androidx.annotation.StringRes import androidx.annotation.StringRes
...@@ -15,7 +15,7 @@ import butterknife.ButterKnife ...@@ -15,7 +15,7 @@ import butterknife.ButterKnife
import de.kuschku.quasseldroid.R import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.util.helper.use import de.kuschku.quasseldroid.util.helper.use
class WarningBarView : LinearLayout { class WarningBarView : FrameLayout {
@BindView(R.id.icon) @BindView(R.id.icon)
lateinit var icon: AppCompatImageView lateinit var icon: AppCompatImageView
......
...@@ -24,6 +24,19 @@ ...@@ -24,6 +24,19 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:scrollbars="vertical"> android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<de.kuschku.quasseldroid.util.ui.WarningBarView
android:id="@+id/feature_context_coresidehighlights"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_alert"
app:mode="none"
app:text="@string/label_feature_context_coresidehighlights" />
<LinearLayout style="@style/Widget.CoreSettings.Wrapper"> <LinearLayout style="@style/Widget.CoreSettings.Wrapper">
<LinearLayout <LinearLayout
...@@ -131,4 +144,5 @@ ...@@ -131,4 +144,5 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
...@@ -29,6 +29,15 @@ ...@@ -29,6 +29,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<de.kuschku.quasseldroid.util.ui.BannerView
android:id="@+id/feature_context_missing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:buttonText="@string/label_feature_context_missing_button"
app:icon="@drawable/ic_alert"
app:text="@string/label_feature_context_missing" />
<LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader"> <LinearLayout style="@style/Widget.CoreSettings.PrimaryItemGroupHeader">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
...@@ -76,8 +85,8 @@ ...@@ -76,8 +85,8 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_marginStart="72dp" android:layout_marginStart="72dp"
android:layout_marginLeft="72dp"
android:orientation="vertical"> android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <de.kuschku.quasseldroid.util.ui.BannerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorBackgroundSnackbar" app:buttonText="@string/advertisement_support_button"
android:baselineAligned="false" app:icon="@drawable/ic_splash"
android:clipToPadding="false" app:text="@string/advertisement_support_patreon" />
android:focusable="true"
android:foreground="?selectableItemBackground"
android:orientation="vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingLeft"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:paddingEnd="?android:attr/listPreferredItemPaddingRight"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:theme="?attr/actionBarTheme">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-4dp"
android:layout_marginLeft="-4dp"
android:baselineAligned="false"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:orientation="horizontal">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:minWidth="60dp"
android:orientation="horizontal"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingTop="4dp"
android:paddingEnd="12dp"
android:paddingRight="12dp"
android:paddingBottom="4dp">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="32dp"
android:layout_height="32dp"
app:srcCompat="@drawable/ic_splash"
app:tint="?android:textColorPrimary" />
</FrameLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
style="@style/Widget.RtlConformTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="10"
android:text="@string/advertisement_support_patreon"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:textColorPrimary" />
</LinearLayout>
</LinearLayout>
<TextView
style="@style/Widget.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:clickable="false"
android:text="@string/advertisement_support_button"
android:textColor="?android:textColorPrimary" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorBackgroundSnackbar"
android:baselineAligned="false"
android:clipToPadding="false"
android:focusable="true"
android:foreground="?selectableItemBackground"
android:orientation="vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingLeft"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:paddingEnd="?android:attr/listPreferredItemPaddingRight"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:theme="?attr/actionBarTheme">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-4dp"
android:layout_marginLeft="-4dp"
android:baselineAligned="false"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:orientation="horizontal">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:minWidth="60dp"
android:orientation="horizontal"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingTop="4dp"
android:paddingEnd="12dp"
android:paddingRight="12dp"
android:paddingBottom="4dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/icon"
android:layout_width="32dp"
android:layout_height="32dp"
app:tint="?android:textColorPrimary"
tools:srcCompat="@drawable/ic_alert" />
</FrameLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@+id/text"
style="@style/Widget.RtlConformTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="10"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:textColorPrimary"
tools:text="Your core is missing features that are required for Quasseldroid to work correctly." />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/button"
style="@style/Widget.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:clickable="false"
android:textColor="?android:textColorPrimary"
tools:text="Details" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?colorBackgroundSnackbar" android:background="?colorBackgroundSnackbar"
...@@ -18,9 +17,7 @@ ...@@ -18,9 +17,7 @@
android:layout_height="20dp" android:layout_height="20dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:visibility="gone" android:visibility="gone"
app:tint="?android:textColorPrimary" app:tint="?android:textColorPrimary" />
tools:srcCompat="@drawable/ic_alert"
tools:visibility="visible" />
<me.zhanghai.android.materialprogressbar.MaterialProgressBar <me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progress" android:id="@+id/progress"
...@@ -37,7 +34,6 @@ ...@@ -37,7 +34,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary" />
tools:text="@string/label_feature_context_bufferactivitysync" />
</LinearLayout> </LinearLayout>
...@@ -138,6 +138,9 @@ ...@@ -138,6 +138,9 @@
<string name="label_feature_backlogfiltertype">Required for receiving past notifications after connecting</string> <string name="label_feature_backlogfiltertype">Required for receiving past notifications after connecting</string>
<string name="label_feature_context_bufferactivitysync">Quasseldroid cannot highlight unread chats. Upgrade your core to Quassel v0.13 to resolve this.</string> <string name="label_feature_context_bufferactivitysync">Quasseldroid cannot highlight unread chats. Upgrade your core to Quassel v0.13 to resolve this.</string>
<string name="label_feature_context_coresidehighlights">Quasseldroid cannot configure highlights. Upgrade your core to Quassel v0.13 to resolve this.</string>
<string name="label_feature_context_missing">Your core is missing features that are required for Quasseldroid to work correctly.</string>
<string name="label_feature_context_missing_button">Details</string>
<string name="notification_channel_background" translatable="false">background</string> <string name="notification_channel_background" translatable="false">background</string>
<string name="notification_channel_connection_title">Connection</string> <string name="notification_channel_connection_title">Connection</string>
......
...@@ -336,8 +336,6 @@ ...@@ -336,8 +336,6 @@
<item name="insetBackground">#4000</item> <item name="insetBackground">#4000</item>
</style> </style>
<!-- NavigationDrawerLayout -->
<declare-styleable name="WarningBarView">
<attr name="icon" format="reference" /> <attr name="icon" format="reference" />
<attr name="text" format="string" /> <attr name="text" format="string" />
<attr name="mode"> <attr name="mode">
...@@ -346,5 +344,19 @@ ...@@ -346,5 +344,19 @@
<enum name="icon" value="2" /> <enum name="icon" value="2" />
<enum name="progress" value="3" /> <enum name="progress" value="3" />
</attr> </attr>
<attr name="buttonText" format="string" />
<!-- WarningBarView -->
<declare-styleable name="WarningBarView">
<attr name="icon" />
<attr name="text" />
<attr name="mode" />
</declare-styleable>
<!-- BannerView -->
<declare-styleable name="BannerView">
<attr name="icon" />
<attr name="text" />
<attr name="buttonText" />
</declare-styleable> </declare-styleable>
</resources> </resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment