-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from Trendyol/Feature/eventPlatformFilter
Develop filter by event platform feature
- Loading branch information
Showing
14 changed files
with
204 additions
and
30 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
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
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
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
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
52 changes: 52 additions & 0 deletions
52
.../com/trendyol/android/devtools/analyticslogger/internal/ui/events/EventPlatformAdapter.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,52 @@ | ||
package com.trendyol.android.devtools.analyticslogger.internal.ui.events | ||
|
||
import android.content.res.ColorStateList | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.trendyol.android.devtools.analyticslogger.databinding.AnalyticsLoggerItemEventPlatformBinding | ||
import com.trendyol.android.devtools.analyticslogger.internal.factory.ColorFactory | ||
|
||
class EventPlatformAdapter( | ||
): RecyclerView.Adapter<EventPlatformAdapter.EventPlatformViewHolder>() { | ||
|
||
private val platforms: MutableList<String> = mutableListOf() | ||
var onItemSelected: ((platform: String) -> Unit)? = null | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EventPlatformViewHolder { | ||
return EventPlatformViewHolder( | ||
AnalyticsLoggerItemEventPlatformBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false | ||
) | ||
) | ||
} | ||
|
||
override fun onBindViewHolder(holder: EventPlatformViewHolder, position: Int) { | ||
platforms[position].let { holder.bind(it) } | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return platforms.size | ||
} | ||
|
||
fun submitData(data: List<String>) { | ||
platforms.addAll(data) | ||
notifyDataSetChanged() | ||
} | ||
|
||
inner class EventPlatformViewHolder( | ||
private val binding: AnalyticsLoggerItemEventPlatformBinding | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(platform: String) = with(binding) { | ||
chipPlatform.text = platform | ||
chipPlatform.chipBackgroundColor = ColorStateList.valueOf(ColorFactory.getColor(platform)) | ||
|
||
chipPlatform.setOnClickListener { | ||
onItemSelected?.invoke(platform) | ||
} | ||
} | ||
} | ||
} |
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
15 changes: 12 additions & 3 deletions
15
libraries/analytics-logger/src/main/res/layout/analytics_logger_fragment_events.xml
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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/platformsRecyclerView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal" | ||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/recyclerView" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
</FrameLayout> | ||
</LinearLayout> |
19 changes: 19 additions & 0 deletions
19
libraries/analytics-logger/src/main/res/layout/analytics_logger_item_event_platform.xml
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,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<com.google.android.material.chip.Chip | ||
android:id="@+id/chipPlatform" | ||
app:chipBackgroundColor="@color/colorAccent" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:padding="8dp" | ||
android:layout_marginTop="8dp" | ||
android:layout_marginEnd="8dp" | ||
android:textSize="12sp" | ||
tools:text="Firebase" /> | ||
|
||
</FrameLayout> |
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 |
---|---|---|
@@ -1,10 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<style name="Theme.AnalyticsReporter" parent="Theme.AppCompat.DayNight"> | ||
<style name="Theme.AnalyticsReporter" parent="Theme.MaterialComponents.DayNight"> | ||
<item name="colorPrimary">@color/colorPrimary</item> | ||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||
<item name="android:windowLightStatusBar" tools:targetApi="m">?attr/isLightTheme</item> | ||
|
||
<item name="materialButtonStyle">@style/Widget.App.Button</item> | ||
</style> | ||
|
||
<style name="Widget.App.Button" parent="Widget.MaterialComponents.Button"> | ||
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Button</item> | ||
</style> | ||
|
||
<style name="ThemeOverlay.App.Button" parent=""> | ||
<item name="colorPrimary">@color/colorAccent</item> | ||
<item name="colorOnPrimary">@color/colorPrimary</item> | ||
</style> | ||
|
||
</resources> |