Skip to content

Commit

Permalink
add option menu
Browse files Browse the repository at this point in the history
  • Loading branch information
SubhamTyagi committed Jun 22, 2024
1 parent 7517ab5 commit b3a27e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import android.net.Uri
import android.os.Bundle
import android.provider.ContactsContract
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
Expand Down Expand Up @@ -75,6 +77,17 @@ class MainActivity : AppCompatActivity() {
}
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu,menu)
return true
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
when(item.itemId){
R.id.action_about -> startActivity(Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://github.com/subhamtyagi/openinwa")))
}
return super.onOptionsItemSelected(item)
}

private fun handleActionSend(intent: Intent) {
val type = intent.type
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/menu/menu.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<menu 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"
tools:context=".FlagsActivity">
>
<item
android:id="@+id/action_about"
android:orderInCategory="100"
Expand Down

0 comments on commit b3a27e7

Please sign in to comment.