add image fullscreen

This commit is contained in:
akaessens 2020-09-26 15:20:14 +02:00
parent 63de4b4a4f
commit 6977fad449
3 changed files with 52 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package com.akdev.nofbeventscraper; package com.akdev.nofbeventscraper;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
@ -8,6 +9,8 @@ import android.provider.CalendarContract;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -146,6 +149,40 @@ public class EventAdapter extends
} }
}); });
/*
* Image dialog
*/
holder.image_view_event_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final Dialog dialog = new Dialog(view.getContext(),android.R.style.Theme_Translucent_NoTitleBar);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_image);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
ImageView image = (ImageView) dialog.findViewById(R.id.image_view_event_image_fullscreen);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
try {
Picasso.get()
.load(event.image_url)
.into(image);
dialog.show();
} catch (Exception e) {
e.printStackTrace();
}
}
}
);
} }

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_view_event_image_fullscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
tools:srcCompat="@tools:sample/avatars" />
</LinearLayout>

View File

@ -14,7 +14,6 @@
</style> </style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />
</resources> </resources>