Styled the SearchView #43

This commit is contained in:
amazing-username
2019-04-07 17:23:42 -04:00
parent 7a5f5bfe1f
commit 31bdc60e13
5 changed files with 41 additions and 21 deletions
@@ -5,7 +5,8 @@ import android.os.Bundle
import android.support.annotation.RequiresApi import android.support.annotation.RequiresApi
import android.support.v7.widget.LinearLayoutManager import android.support.v7.widget.LinearLayoutManager
import android.view.View import android.view.View
import android.widget.SearchView //import android.widget.SearchView
import android.support.v7.widget.SearchView
import java.lang.Exception import java.lang.Exception
import kotlinx.android.synthetic.main.activity_song_view.* import kotlinx.android.synthetic.main.activity_song_view.*
@@ -15,6 +16,10 @@ import com.example.mear.adapters.RecyclerAdapter
import com.example.mear.models.TrackItems import com.example.mear.models.TrackItems
import com.example.mear.R import com.example.mear.R
import com.example.mear.repositories.TrackRepository import com.example.mear.repositories.TrackRepository
import org.jetbrains.anko.appcompat.v7.tintedEditText
import org.jetbrains.anko.backgroundColorResource
import org.jetbrains.anko.editText
import org.jetbrains.anko.textView
import android.R as RDroid import android.R as RDroid
@@ -116,7 +121,13 @@ class SongViewActivity : BaseServiceActivity() {
} }
override fun onQueryTextChange(newText: String): Boolean { override fun onQueryTextChange(newText: String): Boolean {
// TODO: Implement text change try {
adapter.filter.filter(newText)
}
catch (ex: Exception) {
val exMsg = ex.message
}
return false return false
} }
}) })
+9 -18
View File
@@ -14,12 +14,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<SearchView <android.support.v7.widget.SearchView
android:id="@+id/songSearch" android:id="@+id/songSearch"
style="@style/SongSearchViewStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="@+id/trackList" android:backgroundTint="@color/color_background"
android:foregroundTint="@color/color_background"
android:theme="@style/SongSearchViewStyle"
app:layout_constraintTop_toBottomOf="@+id/space2" app:layout_constraintTop_toBottomOf="@+id/space2"
tools:layout_editor_absoluteX="8dp" /> tools:layout_editor_absoluteX="8dp" />
@@ -29,26 +32,14 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:layout_marginTop="15dp" android:layout_marginTop="8dp"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/space2" app:layout_constraintTop_toBottomOf="@+id/songSearch"
tools:itemCount="4" tools:itemCount="4"
tools:listitem="@layout/recycler_view_item" /> tools:listitem="@layout/recycler_view_item" />
<!--
<android.support.v7.widget.RecyclerView <!-- style="@style/SongSearchViewStyle" -->
android:id="@+id/trackList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.044"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
-->
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
+6 -1
View File
@@ -3,7 +3,7 @@
<color name="color_background">#262626</color> <color name="color_background">#262626</color>
<color name="colorPrimary">#6A6A6A</color> <color name="colorPrimary">#6A6A6A</color>
<color name="colorPrimaryDark">#00574B</color> <color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#8c8cd9</color> <color name="colorAccent">#AE18B1</color>
<color name="color_player_not_initialized">#585858</color> <color name="color_player_not_initialized">#585858</color>
<!-- Play Controls --> <!-- Play Controls -->
@@ -12,4 +12,9 @@
<!-- Popup colors --> <!-- Popup colors -->
<color name="popup_text">#FFFFFF</color> <color name="popup_text">#FFFFFF</color>
<!-- Song Searchview -->
<color name="song_searchView">@color/color_background</color>
<color name="song_searchView_hint_text">#FFFFFF</color>
<color name="song_searchView_text">#FFFFFF</color>
</resources> </resources>
+3
View File
@@ -33,6 +33,9 @@
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="song_view">Songs</string> <string name="song_view">Songs</string>
<!-- Song Search -->
<string name="song_search_hint">Search for songs or artists</string>
<!-- Example General settings --> <!-- Example General settings -->
<string name="pref_header_general">General</string> <string name="pref_header_general">General</string>
+10
View File
@@ -27,6 +27,16 @@
<item name="android:textSize">20sp</item> <item name="android:textSize">20sp</item>
</style> </style>
<!--<style name="SongSearchViewStyle" parent="Widget.AppCompat.SearchView"> -->
<style name="SongSearchViewStyle">
<!-- Gets rid of the "underline" in the text -->
<item name="queryBackground">@color/song_searchView</item>
<!-- The hint text that appears when the user has not typed anything -->
<item name="queryHint">@string/song_search_hint</item>
<item name="android:editTextColor">@color/song_searchView_text</item>
<item name="android:textColorHint">@color/song_searchView_hint_text</item>
</style>
<style name="AppTheme.NoActionBar"> <style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>