Commit a0a60ff8 by Paktalin

Added sort option to actionBar menu

parent fccb0efd
......@@ -14,8 +14,8 @@
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ic_close_icon" />
<entry key="sourceFile" value="C:\Users\litak\Desktop\close_icon.svg" />
<entry key="outputName" value="ic_sort_icon" />
<entry key="sourceFile" value="C:\Users\litak\Desktop\sort_icon.svg" />
</map>
</option>
</PersistentState>
......
......@@ -75,7 +75,7 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va
container.id = View.generateViewId()
} else container.id = 18071999
// start fragment
// start EditWordFragment
val wordInfoFragment = EditWordFragment()
val arguments = Bundle()
arguments.putSerializable("wordItem", wordItem)
......
......@@ -11,9 +11,10 @@ import com.paktalin.vocabularynotebook.R
import kotlinx.android.synthetic.main.activity_main.*
import android.view.WindowManager
import android.app.Activity
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.inputmethod.InputMethodManager
import com.paktalin.vocabularynotebook.WordItem
import com.paktalin.vocabularynotebook.appsetup.ConfiguredFirestore
class MainActivity : AppCompatActivity() {
......@@ -30,6 +31,17 @@ class MainActivity : AppCompatActivity() {
extractVocabularyData()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.actionbar_menu, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (item!!.itemId == R.id.sort)
Log.d(TAG, "sort")
return super.onOptionsItemSelected(item)
}
private fun logOut() {
Log.i(TAG, "User logged out")
FirebaseAuth.getInstance()!!.signOut()
......
<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="M3,18h6v-2L3,16v2zM3,6v2h18L21,6L3,6zM3,13h12v-2L3,11v2z"/>
</vector>
......@@ -8,7 +8,6 @@
tools:openDrawer="start">
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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="300dp"
android:layout_height="200dp"
android:background="@android:color/white"
android:layout_gravity="center">
<TextView
android:id="@+id/word"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolBar" />
<TextView
android:id="@+id/translation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/word" />
<LinearLayout
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/colorPrimary">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageButton
android:id="@+id/btnEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:srcCompat="@drawable/ic_edit_icon"
tools:ignore="ContentDescription"
android:background="@android:color/transparent" />
<ImageButton
android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:srcCompat="@drawable/ic_delete_icon"
tools:ignore="ContentDescription"
android:background="@android:color/transparent" />
<ImageButton
android:id="@+id/btnClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_cancel_icon"
tools:ignore="ContentDescription" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/sort"
android:title="@string/option_sort"
android:icon="@drawable/ic_sort_icon"
app:showAsAction="ifRoom">
</item>
</menu>
\ No newline at end of file
......@@ -13,4 +13,5 @@
<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>
</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