-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
138 changed files
with
17,725 additions
and
1,186 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
File renamed without changes.
49 changes: 49 additions & 0 deletions
49
apptentive-core-ui/src/main/java/apptentive/com/android/ui/ApptentivePagerAdapter.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,49 @@ | ||
package apptentive.com.android.ui | ||
|
||
import android.util.SparseArray | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import apptentive.com.android.util.InternalUseOnly | ||
|
||
@InternalUseOnly | ||
class ApptentivePagerAdapter : RecyclerView.Adapter<ApptentiveViewHolder<ListViewItem>>() { | ||
private val pages = mutableListOf<ListViewItem>() | ||
private val viewHolderFactoryLookup = SparseArray<ViewHolderFactory>() | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ApptentiveViewHolder<ListViewItem> { | ||
// resolve factory object | ||
val viewHolderFactory = viewHolderFactoryLookup.get(viewType) | ||
|
||
// create item view | ||
val itemView = viewHolderFactory.createItemView(parent) | ||
|
||
// create view holder | ||
@Suppress("UNCHECKED_CAST") | ||
return viewHolderFactory.createViewHolder(itemView) as ApptentiveViewHolder<ListViewItem> | ||
} | ||
|
||
override fun onBindViewHolder(holder: ApptentiveViewHolder<ListViewItem>, position: Int) { | ||
holder.bindView(pages[position], position) | ||
} | ||
|
||
override fun getItemCount(): Int = pages.size | ||
|
||
override fun getItemViewType(position: Int): Int { | ||
return pages[position].itemType | ||
} | ||
|
||
fun register(itemType: Int, factory: ViewHolderFactory) { | ||
viewHolderFactoryLookup.put(itemType, factory) | ||
} | ||
|
||
fun addOrUpdatePage(page: ListViewItem, isFocusEditText: Boolean) { | ||
val index = pages.indexOfFirst { it.id == page.id } | ||
if (index == -1) { | ||
pages.add(page) | ||
notifyItemInserted(pages.size - 1) | ||
} else { | ||
pages[index] = page | ||
if (!isFocusEditText) notifyItemChanged(index) | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
apptentive-core-ui/src/main/java/apptentive/com/android/ui/ApptentiveViewHolder.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,14 @@ | ||
package apptentive.com.android.ui | ||
|
||
import android.view.View | ||
import androidx.recyclerview.widget.RecyclerView | ||
import apptentive.com.android.util.InternalUseOnly | ||
|
||
@InternalUseOnly | ||
abstract class ApptentiveViewHolder<T : ListViewItem> constructor(itemView: View) : | ||
RecyclerView.ViewHolder(itemView) { | ||
abstract fun bindView(item: T, position: Int) | ||
open fun updateView(item: T, position: Int, changeMask: Int) { | ||
bindView(item, position) | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
apptentive-core-ui/src/main/res/drawable/apptentive_custom_focus_overlay.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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:state_focused="true"> | ||
<shape> | ||
<solid android:color="?attr/apptentiveCustomFocusForegroundColor" /> | ||
<stroke android:color="?attr/apptentiveCustomFocusForegroundColor" android:width="2dp" /> | ||
</shape> | ||
</item> | ||
</selector> |
6 changes: 6 additions & 0 deletions
6
apptentive-core-ui/src/main/res/drawable/apptentive_pill_current.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,6 @@ | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="?attr/apptentiveColorProgressBarCurrent" /> | ||
<corners android:radius="100dp" /> | ||
<size android:height="10dp"/> | ||
</shape> |
6 changes: 6 additions & 0 deletions
6
apptentive-core-ui/src/main/res/drawable/apptentive_pill_next.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,6 @@ | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="?attr/apptentiveColorProgressBarNext" /> | ||
<corners android:radius="100dp" /> | ||
<size android:height="6dp" /> | ||
</shape> |
6 changes: 6 additions & 0 deletions
6
apptentive-core-ui/src/main/res/drawable/apptentive_pill_previous.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,6 @@ | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="?attr/apptentiveColorProgressBarPrevious" /> | ||
<corners android:radius="100dp" /> | ||
<size android:height="6dp" /> | ||
</shape> |
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
Oops, something went wrong.