Commit 38c1cff9 by Paktalin

Changed sort button design

parent 8807a572
......@@ -19,8 +19,8 @@
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ic_time" />
<entry key="sourceFile" value="C:\Users\litak\Desktop\baseline-access_time-24px.svg" />
<entry key="outputName" value="ic_sort" />
<entry key="sourceFile" value="C:\Users\litak\Desktop\baseline-sort-24px.svg" />
</map>
</option>
</PersistentState>
......
......@@ -42,29 +42,17 @@ class MainActivity : AppCompatActivity() {
optionsMenu = menu!!
menuInflater.inflate(R.menu.options_menu, menu)
searchView = menu.findItem(R.id.search).actionView as SearchView
optionsMenu.findItem(R.id.sortByWord).isVisible = false
optionsMenu.findItem(R.id.sortByTranslation).isVisible = false
return true
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
val vocabularyAdapter = recyclerView.adapter as VocabularyAdapter
if (item!!.itemId == R.id.sortByTime) {
if (item!!.itemId == R.id.sortByTime)
vocabularyAdapter.sortOrder = SORT_BY_TIME
if (item.itemId == R.id.sortByWord)
vocabularyAdapter.sortOrder = SORT_BY_WORD
hideMenuItem(optionsMenu, false, true, false)
highlight(fragmentAddWord.view!!.word)
}
if (item.itemId == R.id.sortByWord) {
if (item.itemId == R.id.sortByTranslation)
vocabularyAdapter.sortOrder = SORT_BY_TRANSLATION
hideMenuItem(optionsMenu, false, false, true)
transparent(fragmentAddWord.view!!.word)
highlight(fragmentAddWord.view!!.translation)
}
if (item.itemId == R.id.sortByTranslation) {
vocabularyAdapter.sortOrder = SORT_BY_TIME
hideMenuItem(optionsMenu, true, false, false)
transparent(fragmentAddWord.view!!.translation)
}
return super.onOptionsItemSelected(item)
}
......
......@@ -60,17 +60,3 @@ fun invisible(view: View) {
fun gone(view: View) {
view.visibility = View.GONE
}
\ No newline at end of file
fun hideMenuItem(menu: Menu, time: Boolean, word: Boolean, translation: Boolean) {
menu.findItem(R.id.sortByTime).isVisible = time
menu.findItem(R.id.sortByWord).isVisible = word
menu.findItem(R.id.sortByTranslation).isVisible = translation
}
fun highlight(view: View) {
view.setBackgroundResource(R.color.green_highlight)
}
fun transparent(view: View) {
view.setBackgroundResource(android.R.color.transparent)
}
\ No newline at end of file
......@@ -5,5 +5,5 @@
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M14.94,4.66h-4.72l2.36,-2.36zM10.25,19.37h4.66l-2.33,2.33zM6.1,6.27L1.6,17.73h1.84l0.92,-2.45h5.11l0.92,2.45h1.84L7.74,6.27L6.1,6.27zM4.97,13.64l1.94,-5.18 1.94,5.18L4.97,13.64zM15.73,16.14h6.12v1.59h-8.53v-1.29l5.92,-8.56h-5.88v-1.6h8.3v1.26l-5.93,8.6z"/>
android:pathData="M3,18h6v-2L3,16v2zM3,6v2h18L21,6L3,6zM3,13h12v-2L3,11v2z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
<path
android:fillColor="#FF000000"
android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
</vector>
......@@ -44,7 +44,7 @@
android:inputType="text"
android:textSize="22sp"
app:fontFamily="@font/neucha"
android:textColor="#000F55"
android:textColor="@color/text_color"
tools:ignore="LabelFor" />
<EditText
......@@ -57,7 +57,7 @@
android:inputType="text"
android:textSize="22sp"
app:fontFamily="@font/neucha"
android:textColor="#000F55"
android:textColor="@color/text_color"
tools:ignore="LabelFor" />
</LinearLayout>
......
......@@ -42,7 +42,7 @@
android:layout_weight="1"
android:textSize="22sp"
app:fontFamily="@font/neucha"
android:textColor="#000F55"
android:textColor="@color/text_color"
tools:ignore="LabelFor" />
<TextView
......@@ -52,7 +52,7 @@
android:layout_weight="1"
android:textSize="22sp"
app:fontFamily="@font/neucha"
android:textColor="#000F55"
android:textColor="@color/text_color"
tools:ignore="LabelFor" />
</LinearLayout>
......
......@@ -2,28 +2,26 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/search"
android:title="@string/option_search"
<item
android:id="@+id/search"
android:icon="@drawable/ic_search_icon"
app:showAsAction="ifRoom|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView" />
android:title="@string/option_search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="ifRoom|collapseActionView" />
<item
android:id="@+id/sortByTime"
android:title="@string/option_sort"
android:icon="@drawable/ic_time"
app:showAsAction="always" />
android:title="@string/sort_by_time"
app:showAsAction="never" />
<item
android:id="@+id/sortByWord"
android:title="@string/option_sort"
android:icon="@drawable/ic_sort_az"
app:showAsAction="always" />
android:title="@string/sort_by_word"
app:showAsAction="never" />
<item
android:id="@+id/sortByTranslation"
android:title="@string/option_sort"
android:icon="@drawable/ic_sort_az"
app:showAsAction="always" />
android:title="@string/sort_by_translation"
app:showAsAction="never" />
</menu>
\ No newline at end of file
......@@ -5,4 +5,5 @@
<color name="colorAccent">#FF4081</color>
<color name="sheet_color">#FAFAFA</color>
<color name="green_highlight">#69B578</color>
<color name="text_color">#000F55</color>
</resources>
......@@ -13,7 +13,9 @@
<string name="hint_translation">translation</string>
<string name="menu_option_delete">Delete</string>
<string name="menu_option_edit">Edit</string>
<string name="option_sort">Sort</string>
<string name="sort_by_time">Sort by time</string>
<string name="sort_by_word">Sort by word</string>
<string name="sort_by_translation">Sort by translation</string>
<string name="option_search">Search</string>
<!--Toast messages-->
......
......@@ -7,6 +7,7 @@
<item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
<item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
</style>
<style name="Widget.Styled.ActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
......@@ -14,4 +15,9 @@
<item name="displayOptions">showHome|useLogo</item>
</style>
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">
<item name="android:src">@drawable/ic_sort</item>
<item name="android:background">?android:attr/actionBarItemBackground</item>
</style>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment