1
0
Fork 1

prepare status for multiple image links + Refactor status message in contact details + open image link when on image clicked

This commit is contained in:
Arne 2024-03-18 12:42:32 +01:00
parent 656585607d
commit fa233f1f2a
4 changed files with 152 additions and 66 deletions

View file

@ -28,19 +28,6 @@
"versionName": "1.7.9.4.1",
"outputFile": "monocles chat-1.7.9.4.1-git-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 16603,
"versionName": "1.7.9.4.1",
"outputFile": "monocles chat-1.7.9.4.1-git-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
@ -66,6 +53,19 @@
"versionCode": 16602,
"versionName": "1.7.9.4.1",
"outputFile": "monocles chat-1.7.9.4.1-git-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 16603,
"versionName": "1.7.9.4.1",
"outputFile": "monocles chat-1.7.9.4.1-git-x86_64-release.apk"
}
],
"elementType": "File"

View file

@ -39,6 +39,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.ArrayAdapter;
import android.widget.Toast;
@ -742,16 +743,26 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
binding.statusImage.setVisibility(View.VISIBLE);
final Spannable span = new SpannableString(message);
if (Emoticons.isOnlyEmoji(message)) {
span.setSpan(new RelativeSizeSpan(2.0f), 0, message.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
span.setSpan(new RelativeSizeSpan(3.0f), 0, message.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
binding.statusMessage.setText(span);
//find and show images from links
for (String statusMessage : statusMessages) {
if (containsLink(statusMessage)) {
List<String> url = extractUrls(statusMessage);
for (String imageurl : url) {
Picasso.get().load(imageurl).into(binding.statusImage);
int size = statusMessages.size();
for (int i = 0; i < size; ++i) {
if (containsLink(statusMessages.get(i))) {
List<String> url = extractUrls(statusMessages.get(i));
for (int j = 0; j < url.size(); j++) {
Picasso.get().load(url.get(0)).into(binding.statusImage);
binding.statusImage.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse(url.get(0)));
startActivity(intent);
}
});
}
}
}
@ -763,20 +774,27 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
for (int i = 0; i < s; ++i) {
builder.append(statusMessages.get(i));
if (i < s - 1) {
if (containsLink(statusMessages.get(i))) {
List<String> url = extractUrls(statusMessages.get(i));
for (int j = 0; j < url.size(); j++) {
Picasso.get().load(url.get(0)).into(binding.statusImage);
binding.statusImage.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse(url.get(0)));
startActivity(intent);
}
});
}
}
builder.append("\n");
}
}
binding.statusMessage.setText(builder);
//find and show images from links
for (String statusMessage : statusMessages) {
if (containsLink(statusMessage)) {
List<String> url = extractUrls(statusMessage);
for (String imageurl : url) {
Picasso.get().load(imageurl).into(binding.statusImage);
}
}
}
}
} else {
if (statusMessages.size() == 0) {
@ -786,7 +804,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
binding.statusMessage.setVisibility(View.VISIBLE);
final Spannable span = new SpannableString(message);
if (Emoticons.isOnlyEmoji(message)) {
span.setSpan(new RelativeSizeSpan(2.0f), 0, message.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
span.setSpan(new RelativeSizeSpan(3.0f), 0, message.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
binding.statusMessage.setText(span);
} else {

View file

@ -140,42 +140,6 @@
android:textAppearance="@style/TextAppearance.Conversations.Status" />
</LinearLayout>
<LinearLayout
android:layout_below="@+id/details_display"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<TextView
android:id="@+id/status_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:clickable="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:textAppearance="@style/TextAppearance.Conversations.Subhead" />
<ImageView
android:id="@+id/status_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxWidth="120dp"
android:maxHeight="120dp"
android:adjustViewBounds="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:scaleType="fitXY"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
@ -270,6 +234,111 @@
android:visibility="visible" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.05dp"
android:background="?attr/text_Color_Main" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/status_message"
android:textStyle="bold"
style="@style/TextAppearance.Conversations.Subhead" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/status_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxWidth="120dp"
android:maxHeight="120dp"
android:clickable="true"
android:adjustViewBounds="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:scaleType="fitXY"
android:visibility="gone" />
<ImageView
android:id="@+id/status_image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxWidth="120dp"
android:maxHeight="120dp"
android:adjustViewBounds="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:scaleType="fitXY"
android:visibility="gone" />
<ImageView
android:id="@+id/status_image2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxWidth="120dp"
android:maxHeight="120dp"
android:adjustViewBounds="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:scaleType="fitXY"
android:visibility="gone" />
<ImageView
android:id="@+id/status_image3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxWidth="120dp"
android:maxHeight="120dp"
android:adjustViewBounds="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:scaleType="fitXY"
android:visibility="gone" />
<ImageView
android:id="@+id/status_image4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxWidth="120dp"
android:maxHeight="120dp"
android:adjustViewBounds="true"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:scaleType="fitXY"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/status_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:autoLink="web"
android:clickable="true"
android:textAppearance="@style/TextAppearance.Conversations.Subhead" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.05dp"

View file

@ -68,7 +68,6 @@
android:ems="10"
android:maxLines="5"
android:hint="@string/status_message"
android:imeOptions="flagNoExtractUi"
android:inputType="textMultiLine|textCapSentences"
android:padding="16dp"
android:textColor="?attr/text_Color_Main" />