-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
127 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/root14/flashlightappsmarket/model/CategoryItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.root14.flashlightappsmarket.model | ||
|
||
import android.graphics.drawable.Drawable | ||
|
||
/** | ||
* Created by ilkay on 17,May, 2023 | ||
*/ | ||
data class CategoryItem( | ||
val icon: Drawable?, | ||
val name: String | ||
) |
5 changes: 4 additions & 1 deletion
5
...4/flashlightappsmarket/view/AppAdapter.kt → ...view/ui/applicationFragment/AppAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...lashlightappsmarket/view/AppViewHolder.kt → ...w/ui/applicationFragment/AppViewHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/root14/flashlightappsmarket/view/ui/mainfragment/CategoryAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.root14.flashlightappsmarket.view.ui.mainfragment | ||
|
||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.root14.flashlightappsmarket.model.CategoryItem | ||
|
||
/** | ||
* Created by ilkay on 17,May, 2023 | ||
*/ | ||
class CategoryAdapter(private val categoryItem: List<CategoryItem>) : | ||
RecyclerView.Adapter<CategoryViewHolder>() { | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CategoryViewHolder { | ||
return CategoryViewHolder.create(parent) | ||
} | ||
|
||
override fun onBindViewHolder(holder: CategoryViewHolder, position: Int) { | ||
val categoryItem = categoryItem[position] | ||
holder.bind(categoryItem) | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return categoryItem.size | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/root14/flashlightappsmarket/view/ui/mainfragment/CategoryViewHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.root14.flashlightappsmarket.view.ui.mainfragment | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.root14.flashlightappsmarket.databinding.ItemAppBinding | ||
import com.root14.flashlightappsmarket.databinding.ListCategoriesBinding | ||
import com.root14.flashlightappsmarket.model.AppItem | ||
import com.root14.flashlightappsmarket.model.CategoryItem | ||
|
||
/** | ||
* Created by ilkay on 17,May, 2023 | ||
*/ | ||
class CategoryViewHolder(private val binding: ListCategoriesBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(categoryItem: CategoryItem) { | ||
binding.imageViewIcon.setImageDrawable(categoryItem.icon) | ||
binding.textViewCategoryName.text = categoryItem.name | ||
} | ||
|
||
companion object { | ||
fun create(parent: ViewGroup): CategoryViewHolder { | ||
val inflater = LayoutInflater.from(parent.context) | ||
val binding = ListCategoriesBinding.inflate(inflater, parent, false) | ||
return CategoryViewHolder(binding) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal" | ||
android:padding="16dp"> | ||
|
||
|
||
<ImageView | ||
android:id="@+id/imageViewIcon" | ||
android:layout_width="48dp" | ||
android:layout_height="48dp" | ||
android:src="@drawable/baseline_photo_24" /> | ||
|
||
<TextView | ||
android:id="@+id/textViewCategoryName" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/category_name" | ||
android:textSize="16sp" | ||
android:textStyle="bold" /> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters