<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".SimpleActivity">
<com.sap.cloud.mobile.fiori.indicator.FioriProgressBar
android:id="@+id/progressBar"
android:layout_margin="8dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:indeterminate="true"
style="@style/FioriProgressbar.Horizontal" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginStart="8dp"
android:text="Hello World!" />
</LinearLayout>
var progressBar: FioriProgressBar = findViewById(R.id.progressBar)
progressBar.visibility = View.GONE
<?xml version="1.0" encoding="utf-8"?>
<com.sap.cloud.mobile.fiori.contact.ContactCell
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:headlineLines="1"
app:lines="2"
app:detailImageShape="oval"
app:preserveDetailImageSpacing="true"
app:contactActions="CALL,EMAIL"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
fun showRecycler(suppliers: List<Supplier>) {
val recycler = RecyclerView(this)
recycler.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false)
recycler.adapter = ContactCellAdapter(suppliers)
setContentView(recycler)
}
class ContactCellAdapter(private val values: List<Supplier>) : RecyclerView.Adapter<ContactCellAdapter.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.contactcell,
parent,
false
) as ContactCell
)
}
override fun getItemCount(): Int = values.size
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = values[position]
with(holder.view) {
headline = item.supplierName
subheadline = item.city + ", " + item.country
detailImageCharacter = item.supplierName?.substring(0, 1)
getContactActionView(0)?.setOnClickListener { view: View ->
val intent = Intent(Intent.ACTION_DIAL,
Uri.fromParts("tel",
item.phoneNumber,
null))
view.context.startActivity(intent)
}
getContactActionView(1)?.setOnClickListener { view: View ->
val uri = Uri.parse("mailto: " + item.emailAddress)
val intent = Intent(Intent.ACTION_SENDTO, uri)
view.context.startActivity(intent)
}
}
}
class ViewHolder(val view: ContactCell) : RecyclerView.ViewHolder(view)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
18 | |
12 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |