Skip to content

Commit

Permalink
Adds fav menu
Browse files Browse the repository at this point in the history
  • Loading branch information
meh430 committed Nov 22, 2020
1 parent 983872c commit d7f5165
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ class FavImageActivity : AppCompatActivity() {
binding = ActivityFavImageBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true);
supportActionBar?.setDisplayShowHomeEnabled(true);
supportActionBar?.elevation = 0F
supportActionBar?.apply {
setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.elevation = 0F
}
favViewModel = ViewModelProvider(this).get(FavViewModel::class.java)
favAdapter = FavAdapter(this, ArrayList())
val recycler = binding.favRecycler.apply {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/mehul/redditwall/adapters/FavAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class FavAdapter(private val con: Context, lis: ArrayList<BitURL>) : RecyclerVie
isLongClickable = true
isClickable = true
}


holder.itemView.setOnClickListener {
val wallIntent = Intent(con, WallActivity::class.java)
val gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create()
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_close.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z" />
</vector>
17 changes: 17 additions & 0 deletions app/src/main/res/menu/fav_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--suppress ALL -->
<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=".activities.FavImageActivity">
<item
android:id="@+id/delete"
android:orderInCategory="60"
android:title="delete"
app:showAsAction="always" />

<item
android:id="@+id/close"
android:orderInCategory="50"
android:title="close"
app:showAsAction="always" />
</menu>

0 comments on commit d7f5165

Please sign in to comment.