update fork #128

Manually merged
tristan merged 181 commits from mirror/monocles_chat_clean:master into master 2026-01-23 14:02:38 +01:00
6 changed files with 38 additions and 9 deletions
Showing only changes of commit 99144f4340 - Show all commits

Show empty view in calls fragment, improve avatar shape fallback and fix rare crash in calls log

Arne 2026-01-06 20:04:50 +01:00

View file

@ -12,6 +12,7 @@ import android.os.IBinder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@ -40,6 +41,7 @@ public class CallsFragment extends Fragment implements CallsAdapter.OnCallAgainC
private XmppConnectionService xmppConnectionService;
private RecyclerView recyclerView;
private TextView emptyView;
private CallsAdapter adapter;
private final List<Message> calls = new ArrayList<>();
private Message mPendingCall;
@ -85,6 +87,7 @@ public class CallsFragment extends Fragment implements CallsAdapter.OnCallAgainC
View view = inflater.inflate(R.layout.fragment_calls, container, false);
recyclerView = view.findViewById(R.id.list);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
emptyView = view.findViewById(R.id.empty_view);
return view;
}
@ -104,12 +107,23 @@ public class CallsFragment extends Fragment implements CallsAdapter.OnCallAgainC
} else {
adapter.notifyDataSetChanged();
}
updateViewStates();
mCallsLoaded = true;
});
}
});
}
private void updateViewStates() {
if (calls.isEmpty()) {
recyclerView.setVisibility(View.GONE);
emptyView.setVisibility(View.VISIBLE);
} else {
recyclerView.setVisibility(View.VISIBLE);
emptyView.setVisibility(View.GONE);
}
}
private List<Message> getCalls() {
List<Message> calls = new ArrayList<>();
if (xmppConnectionService == null) {

View file

@ -8,4 +8,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/no_calls_yet"
android:visibility="gone" />
</FrameLayout>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="wrap_content"
android:padding="12dp">
@ -47,7 +46,7 @@
android:layout_height="2dp"
android:layout_gravity="center"
android:padding="2dp"
android:background="?android:attr/textColorPrimary" />
android:background="@color/sd_label_text_color" />
<TextView
android:id="@+id/call_date"
@ -67,7 +66,7 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:padding="4dp"
android:background="?selectableItemBackgroundBorderless"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_call_24dp" />
</RelativeLayout>

View file

@ -2,4 +2,5 @@
<dimen name="local_video_preview_height">96dp</dimen>
<dimen name="local_video_preview_width">128dp</dimen>
<dimen name="rtp_session_duration_top_margin">16dp</dimen>
<dimen name="avatar_corners_radius">8dp</dimen>
</resources>

View file

@ -1595,4 +1595,5 @@
<string name="error_creating_story">Could not create story</string>
<string name="calls">Calls</string>
<string name="disable_voice_and_video_calls">Disable voice and video calls</string>
<string name="no_calls_yet">No calls yet</string>
</resources>

View file

@ -2,6 +2,7 @@ package eu.siacs.conversations.ui.widget
import android.content.Context
import android.content.SharedPreferences
import android.content.res.Resources
import android.graphics.Outline
import androidx.preference.PreferenceManager
import android.util.AttributeSet
@ -35,14 +36,19 @@ class AvatarView : AppCompatImageView {
}
private fun invalidateShape() {
val shape = PreferenceManager.getDefaultSharedPreferences(context).getString("avatar_shape", context.getString(R.string.avatar_shape))
val defaultShape = try {
context.getString(R.string.avatar_shape)
} catch (e: Resources.NotFoundException) {
"oval"
}
val shape = PreferenceManager.getDefaultSharedPreferences(context).getString("avatar_shape", defaultShape)
if (shape == currentShape) {
return
}
when {
shape == "oval" -> {
when (shape) {
"oval" -> {
clipToOutline = true
outlineProvider = object : ViewOutlineProvider() {
override fun getOutline(view: View, outline: Outline) {
@ -50,7 +56,7 @@ class AvatarView : AppCompatImageView {
}
}
}
shape == "rounded_square" -> {
"rounded_square" -> {
clipToOutline = true
outlineProvider = object : ViewOutlineProvider() {
override fun getOutline(view: View, outline: Outline) {
@ -60,12 +66,12 @@ class AvatarView : AppCompatImageView {
}
}
}
shape == "square" -> {
"square" -> {
clipToOutline = false
outlineProvider = ViewOutlineProvider.BACKGROUND
}
}
currentShape = shape!!
currentShape = shape ?: defaultShape
}
}