show the time zone offset at time zones list too
This commit is contained in:
parent
9a281fbe58
commit
30511d284e
|
@ -21,7 +21,7 @@ class SelectTimeZoneActivity : SimpleActivity() {
|
|||
setContentView(R.layout.activity_select_time_zone)
|
||||
title = ""
|
||||
|
||||
SelectTimeZoneAdapter(this, getAllTimeZones(), select_time_zone_list) {
|
||||
SelectTimeZoneAdapter(this, getAllTimeZones()) {
|
||||
|
||||
}.apply {
|
||||
select_time_zone_list.adapter = this
|
||||
|
|
|
@ -5,13 +5,14 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.calendar.pro.extensions.config
|
||||
import com.simplemobiletools.calendar.pro.models.MyTimeZone
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import kotlinx.android.synthetic.main.item_select_time_zone.view.*
|
||||
import java.util.*
|
||||
|
||||
class SelectTimeZoneAdapter(val activity: SimpleActivity, val timeZones: ArrayList<MyTimeZone>, recyclerView: MyRecyclerView, val itemClick: (Any) -> Unit) :
|
||||
class SelectTimeZoneAdapter(val activity: SimpleActivity, val timeZones: ArrayList<MyTimeZone>, val itemClick: (Any) -> Unit) :
|
||||
RecyclerView.Adapter<SelectTimeZoneAdapter.ViewHolder>() {
|
||||
val textColor = activity.config.textColor
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = activity.layoutInflater.inflate(R.layout.item_select_time_zone, parent, false)
|
||||
|
@ -29,6 +30,11 @@ class SelectTimeZoneAdapter(val activity: SimpleActivity, val timeZones: ArrayLi
|
|||
fun bindView(timeZone: MyTimeZone): View {
|
||||
itemView.apply {
|
||||
item_time_zone_title.text = timeZone.zoneName
|
||||
item_time_zone_shift.text = timeZone.title
|
||||
|
||||
item_time_zone_title.setTextColor(textColor)
|
||||
item_time_zone_shift.setTextColor(textColor)
|
||||
|
||||
item_select_time_zone_holder.setOnClickListener {
|
||||
itemClick(timeZone)
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ fun getNowSeconds() = System.currentTimeMillis() / 1000L
|
|||
|
||||
// timezones fetched from https://www.joda.org/joda-time/timezones.html
|
||||
fun getAllTimeZones() = arrayListOf(
|
||||
MyTimeZone(1, "GMT-11:00", "Pacific/Midway"),
|
||||
MyTimeZone(2, "GMT-11:00", "Pacific/Niue"),
|
||||
MyTimeZone(3, "GMT-11:00", "Pacific/Pago_Pago")
|
||||
MyTimeZone(1, "GMT-11", "Pacific/Midway"),
|
||||
MyTimeZone(2, "GMT-11", "Pacific/Niue"),
|
||||
MyTimeZone(3, "GMT-11", "Pacific/Pago_Pago")
|
||||
)
|
||||
|
|
|
@ -1,18 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/item_select_time_zone_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin">
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/normal_margin"
|
||||
android:paddingEnd="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/normal_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_time_zone_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
tools:text="Europe/Bratislava" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_time_zone_shift"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/item_time_zone_title"
|
||||
android:alpha="0.8"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="GMT+1" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in New Issue