Skip to content

Commit

Permalink
Additional ImageViewer added at Main Thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
Satellite-system committed Jan 6, 2022
1 parent b4feac1 commit b3a08ff
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 0 deletions.
49 changes: 49 additions & 0 deletions app/src/main/java/com/assistant/android/bolchal/ImageViewer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.assistant.android.bolchal;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import java.util.Objects;

public class ImageViewer extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_image_viewer);

/**
* Toolbar/ActionBar transparent
*/
Objects.requireNonNull(getSupportActionBar()).hide();

ImageView image = (ImageView) findViewById(R.id.image_view_holder);
TextView name = findViewById(R.id.img_action_name);
TextView timeDate = findViewById(R.id.img_action_date);
ImageView back = findViewById(R.id.img_action_back);
ImageView menu = findViewById(R.id.img_action_menu);

Message message = getIntent().getParcelableExtra("ImageRes");
Glide.with(image.getContext()).load(message.getPhotoUrl()).into(image);

name.setText(message.getName());
timeDate.setText(message.getTime());

back.setOnClickListener(view -> {
finish();
});

}



}
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_baseline_arrow_back_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="124dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="124dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_baseline_delete_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="124dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="124dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>
Binary file added app/src/main/res/drawable/three_dots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions app/src/main/res/layout/image_action_bar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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="?attr/actionBarSize"
android:background="@color/purple_700">

<ImageView
android:id="@+id/img_action_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_baseline_arrow_back_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/img_action_date"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/img_action_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="name"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="@+id/img_action_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.01" />

<TextView
android:id="@+id/img_action_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12/11/21, 11:45 PM"
android:textColor="@color/white"
android:textSize="15sp"
app:layout_constraintEnd_toEndOf="@+id/img_action_name"
app:layout_constraintStart_toStartOf="@+id/img_action_name"
app:layout_constraintTop_toBottomOf="@+id/img_action_name" />

<ImageView
android:id="@+id/img_action_menu"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/three_dots"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/img_action_date"
app:layout_constraintTop_toTopOf="parent" />



</androidx.constraintlayout.widget.ConstraintLayout>
27 changes: 27 additions & 0 deletions app/src/main/res/layout/layout_image_viewer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ImageViewer"
android:background="@color/black">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_centerInParent="true"
android:id="@+id/image_view_holder"
tools:src="@drawable/placeholder"/>

<include
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
layout="@layout/image_action_bar"
android:id="@+id/tool_bar"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:background="@color/purple_700"/>

</RelativeLayout>
5 changes: 5 additions & 0 deletions app/src/main/res/menu/delete_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/delete" android:title="delete" android:orderInCategory="1" />

</menu>

0 comments on commit b3a08ff

Please sign in to comment.