1
0
Fork 1

enlarge status image when long clicked

This commit is contained in:
Arne 2024-03-18 15:16:44 +01:00
parent fa233f1f2a
commit 751bf29ef8
4 changed files with 50 additions and 13 deletions

View file

@ -28,6 +28,19 @@
"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": [
@ -53,19 +66,6 @@
"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

@ -763,6 +763,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
startActivity(intent);
}
});
binding.statusImage.setOnLongClickListener(v -> {
ShowStatusImagePopup(ContactDetailsActivity.this, url.get(0));
return true;
});
}
}
}
@ -787,6 +791,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
startActivity(intent);
}
});
binding.statusImage.setOnLongClickListener(v -> {
ShowStatusImagePopup(ContactDetailsActivity.this, url.get(0));
return true;
});
}
}
builder.append("\n");

View file

@ -3,6 +3,7 @@ package eu.siacs.conversations.ui;
import static de.monocles.chat.ui.PermissionsActivity.permissions;
import static eu.siacs.conversations.ui.SettingsActivity.USE_INTERNAL_UPDATER;
import android.graphics.BitmapFactory;
import android.graphics.drawable.AnimatedImageDrawable;
import android.telephony.TelephonyManager;
import eu.siacs.conversations.utils.Compatibility;
@ -70,6 +71,8 @@ import androidx.databinding.DataBindingUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Collections2;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.io.File;
import java.util.PriorityQueue;
@ -1588,4 +1591,29 @@ public abstract class XmppActivity extends ActionBarActivity {
AvatarPopup.cancel();
}
}
public void ShowStatusImagePopup(final Activity activity, final String imageUrl) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
AvatarPopup = builder.create();
final LayoutInflater inflater = getLayoutInflater();
final View dialogLayout = inflater.inflate(R.layout.avatar_dialog, null);
AvatarPopup.setView(dialogLayout);
AvatarPopup.requestWindowFeature(Window.FEATURE_NO_TITLE);
ImageView statusimage = new ImageView(this);
Thread imageDataThread = new Thread(() -> {
try {
URL url = new URL(imageUrl);
Bitmap image = BitmapFactory.decodeStream(url.openConnection().getInputStream());
statusimage.setImageBitmap(image);
statusimage.setScaleType(ImageView.ScaleType.FIT_XY);
statusimage.setAdjustViewBounds(true);
AvatarPopup.setView(statusimage);
runOnUiThread(() -> AvatarPopup.show());
} catch (IOException e) {
throw new RuntimeException(e);
}
});
imageDataThread.start();
}
}

View file

@ -260,6 +260,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/status_image"
android:layout_width="wrap_content"