Various UI fixes

This commit is contained in:
Sylvain Berfini 2023-11-16 12:52:30 +01:00
parent b66a40fa41
commit 297eb71ff7
6 changed files with 14 additions and 8 deletions

View file

@ -34,7 +34,7 @@ class CallLogHistoryModel @WorkerThread constructor(val callLog: CallLog) {
} else if (TimestampUtils.isYesterday(startDate)) {
AppUtils.getString(R.string.yesterday)
} else {
TimestampUtils.dateToString(callLog.startDate)
TimestampUtils.toString(startDate, onlyDate = true, shortDate = false, hideYear = true)
}
val time = TimestampUtils.timeToString(startDate)
dateTime.postValue("$date | $time")

View file

@ -41,15 +41,15 @@ class CallLogModel @WorkerThread constructor(private val callLog: CallLog) {
var friendExists: Boolean = false
init {
val timestamp = timestamp
val displayedDate = if (TimestampUtils.isToday(timestamp)) {
TimestampUtils.timeToString(timestamp)
val date = if (TimestampUtils.isToday(timestamp)) {
AppUtils.getString(R.string.today)
} else if (TimestampUtils.isYesterday(timestamp)) {
AppUtils.getString(R.string.yesterday)
} else {
TimestampUtils.dateToString(timestamp)
TimestampUtils.toString(timestamp, onlyDate = true, shortDate = true, hideYear = true)
}
dateTime.postValue(displayedDate)
val time = TimestampUtils.timeToString(timestamp)
dateTime.postValue("$date | $time")
if (callLog.wasConference()) {

View file

@ -173,7 +173,10 @@ class TimestampUtils {
}
} as SimpleDateFormat
if (hideYear) {
val cal = Calendar.getInstance()
cal.timeInMillis = if (timestampInSecs) timestamp * 1000 else timestamp
val now = Calendar.getInstance()
if (hideYear && isSameYear(cal, now)) {
// Remove the year part of the format
dateFormat.applyPattern(
dateFormat.toPattern().replace(

View file

@ -29,7 +29,7 @@
android:id="@+id/copy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/menu_copy_sip_address"
android:text="@{isSip ? @string/menu_copy_sip_address : @string/menu_copy_phone_number, default=@string/menu_copy_sip_address}"
android:background="@drawable/menu_item_background"
android:layout_marginBottom="1dp"
android:drawableStart="@drawable/copy"

View file

@ -46,10 +46,12 @@
app:layout_constraintBottom_toBottomOf="parent"/>
<View
android:id="@+id/separator"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginEnd="10dp"
android:background="@color/gray_main2_200"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@id/name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>

View file

@ -289,6 +289,7 @@
<string name="menu_add_address_to_contacts">Add to contacts</string>
<string name="menu_see_existing_contact">See contact</string>
<string name="menu_copy_sip_address">Copy SIP address</string>
<string name="menu_copy_phone_number">Copy phone number</string>
<string name="menu_delete_history">Delete history</string>
<string name="menu_delete_selected_item">Delete</string>
<string name="menu_invite">Invite</string>