diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..decd5c8
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FullscreenActivity.java b/FullscreenActivity.java
new file mode 100644
index 0000000..6beeb77
--- /dev/null
+++ b/FullscreenActivity.java
@@ -0,0 +1,290 @@
+package com.lambda.imageviewer;
+
+import android.annotation.SuppressLint;
+import android.content.Intent;
+import android.net.Uri;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.content.Intent;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+
+/**
+ * An example full-screen activity that shows and hides the system UI (i.e.
+ * status bar and navigation/system bar) with user interaction.
+ */
+public class FullscreenActivity extends AppCompatActivity {
+ // public static final int REQUEST_CODE = REQUEST_CODE;
+ /**
+ * Whether or not the system UI should be auto-hidden after
+ * {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
+ */
+ private int mTransitionCount; // 遷移した回数
+ private static final boolean AUTO_HIDE = true;
+
+ /**
+ * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
+ * user interaction before hiding the system UI.
+ */
+ private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
+
+ /**
+ * Some older devices needs a small delay between UI widget updates
+ * and a change of the status and navigation bar.
+ */
+ private static final int UI_ANIMATION_DELAY = 300;
+ private final Handler mHideHandler = new Handler();
+ private View mContentView;
+ private final Runnable mHidePart2Runnable = new Runnable() {
+ @SuppressLint("InlinedApi")
+ @Override
+ public void run() {
+ // Delayed removal of status and navigation bar
+
+ // Note that some of these constants are new as of API 16 (Jelly Bean)
+ // and API 19 (KitKat). It is safe to use them, as they are inlined
+ // at compile-time and do nothing on earlier devices.
+ mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
+ }
+ };
+ private View mControlsView;
+ private final Runnable mShowPart2Runnable = new Runnable() {
+ @Override
+ public void run() {
+ // Delayed display of UI elements
+ ActionBar actionBar = getSupportActionBar();
+ if (actionBar != null) {
+ actionBar.show();
+ }
+ mControlsView.setVisibility(View.VISIBLE);
+ }
+ };
+ private boolean mVisible;
+ private final Runnable mHideRunnable = new Runnable() {
+ @Override
+ public void run() {
+ hide();
+ }
+ };
+ /**
+ * Touch listener to use for in-layout UI controls to delay hiding the
+ * system UI. This is to prevent the jarring behavior of controls going away
+ * while interacting with activity UI.
+ */
+ private final View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ if (AUTO_HIDE) {
+ delayedHide(AUTO_HIDE_DELAY_MILLIS);
+ }
+ return false;
+ }
+ };
+
+ @Override
+
+ protected void onStart() {
+
+ super.onStart();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onStart");
+ getIntent();
+
+
+ }
+
+
+ @Override
+
+ protected void onResume() {
+
+ super.onResume();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onResume");
+
+ }
+
+
+ // user interacting with app
+
+
+ @Override
+
+ protected void onPause() {
+
+ super.onPause();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onPause");
+
+ }
+
+
+ @Override
+
+ protected void onStop() {
+
+ super.onStop();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onStop");
+
+ }
+
+
+ @Override
+
+ protected void onDestroy() {
+
+ super.onDestroy();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onDestroy");
+
+ }
+
+
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onCreate");
+ setContentView(R.layout.activity_fullscreen2);
+
+ mVisible = true;
+ mControlsView = findViewById(R.id.fullscreen_content_controls);
+ mContentView = findViewById(R.id.fullscreen_content);
+
+
+ Bundle extras =getIntent().getExtras();
+ if(extras!=null) {
+ TextView tv = findViewById(R.id.fullscreen_content);
+
+ String stringNew = extras.getString("STRING_I_NEED");
+
+ tv.setText(stringNew);
+ ImageView iv=findViewById(R.id.fullscreen_image);
+ iv.setImageURI(Uri.parse(stringNew));
+ }
+
+
+
+ // Set up the user interaction to manually show or hide the system UI.
+ mContentView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ ProcessToGoback();
+
+ }
+ });
+
+
+ // Upon interacting with UI controls, delay any scheduled hide()
+ // operations to prevent the jarring behavior of controls going away
+ // while interacting with the UI.
+ findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
+ }
+
+ @Override
+ public void onBackPressed()
+ {
+ // do stuff
+ super.onBackPressed();
+ ProcessToGoback();
+
+
+ }
+
+
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+
+ // Trigger the initial hide() shortly after the activity has been
+ // created, to briefly hint to the user that UI controls
+ // are available.
+ delayedHide(100);
+ }
+
+ private void toggle() {
+ if (mVisible) {
+ hide();
+ } else {
+ show();
+ }
+ }
+
+ private void hide() {
+ // Hide UI first
+ ActionBar actionBar = getSupportActionBar();
+ if (actionBar != null) {
+ actionBar.hide();
+ }
+ mControlsView.setVisibility(View.GONE);
+ mVisible = false;
+
+ // Schedule a runnable to remove the status and navigation bar after a delay
+ mHideHandler.removeCallbacks(mShowPart2Runnable);
+ mHideHandler.postDelayed(mHidePart2Runnable, UI_ANIMATION_DELAY);
+ }
+
+ @SuppressLint("InlinedApi")
+ private void show() {
+ // Show the system bar
+ mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
+ mVisible = true;
+
+ // Schedule a runnable to display UI elements after a delay
+ mHideHandler.removeCallbacks(mHidePart2Runnable);
+ mHideHandler.postDelayed(mShowPart2Runnable, UI_ANIMATION_DELAY);
+ }
+
+ /**
+ * Schedules a call to hide() in delay milliseconds, canceling any
+ * previously scheduled calls.
+ */
+ private void delayedHide(int delayMillis) {
+ mHideHandler.removeCallbacks(mHideRunnable);
+ mHideHandler.postDelayed(mHideRunnable, delayMillis);
+ }
+
+ private void ProcessToGoback(){
+
+ // Intent のインスタンスを取得する
+ Intent intent = new Intent(getApplicationContext(), MainActivity.class);
+ // 渡したいデータとキーを指定する
+ intent.putExtra("COMING_BACK","I am back");
+ // 遷移先の画面を呼び出す
+ startActivity(intent);
+
+
+ }
+}
+
+
+
+
+
+
+
+
diff --git a/ImageData.java b/ImageData.java
new file mode 100644
index 0000000..ba99011
--- /dev/null
+++ b/ImageData.java
@@ -0,0 +1,56 @@
+package com.lambda.imageviewer;
+
+import android.net.Uri;
+import android.widget.TextView;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+
+import java.io.Serializable;
+
+class ImageData implements Serializable {
+ private String stringUri;
+ private TextView tV;
+ private int index;
+ ImageData(String stringUri, int index){
+ this.stringUri = stringUri;
+ this.index=index;
+
+
+ }
+
+ public void setIndex(int index){
+ this.index=index;
+
+ }
+
+ public int getIndex(){
+ return this.index;
+ }
+
+ public String getStringUri() {
+ return stringUri;
+ }
+
+ public void setStringUri(String stringUri) {
+ this.stringUri = stringUri;
+ }
+
+ public void setUri(Uri uriUri) {
+ this.stringUri=uriUri.toString();
+
+ }
+
+ public String toString(Uri uri) {
+ this.stringUri=uri.toString();
+ return super.toString();
+ }
+
+ public Uri getUri(){
+
+ Uri uriUri=Uri.parse(this.stringUri);
+
+ return uriUri;
+ }
+
+
+}
diff --git a/MainActivity.java b/MainActivity.java
new file mode 100644
index 0000000..bf4e411
--- /dev/null
+++ b/MainActivity.java
@@ -0,0 +1,298 @@
+package com.lambda.imageviewer;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Parcel;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ScrollView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import org.w3c.dom.Text;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+public class MainActivity extends AppCompatActivity {
+ private static final int IMAGE_REQUEST_CODE = 50;
+ private ImageView imageView;
+ private ImageData imageData;
+ private static ArrayList listImages = new ArrayList(50);
+ private static int iCounter = 1;
+ private static boolean fromOtherScreen=false;
+
+
+ @Override
+
+ protected void onStart() {
+
+ super.onStart();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onStart");
+
+ LinearLayout ll = findViewById(R.id.scrolling_view);
+
+
+
+
+
+
+
+ }
+
+
+ @Override
+
+ protected void onResume() {
+
+ super.onResume();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onResume");
+ PrecessOnResuming();
+
+ }
+
+
+
+
+
+ // user interacting with app
+
+
+ @Override
+
+ protected void onPause() {
+
+ super.onPause();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onPause");
+
+ }
+
+
+ @Override
+
+ protected void onStop() {
+
+ super.onStop();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onStop");
+
+ }
+
+
+ @Override
+
+ protected void onDestroy() {
+
+ super.onDestroy();
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onDestroy");
+
+ }
+
+ private int mTransitionCount; // 遷移した回数
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Log.i("ActivityLifecycle", getLocalClassName() + " - onCreate");
+
+ setContentView(R.layout.activity_main);
+
+ LinearLayout ll = findViewById(R.id.scrolling_view);
+
+
+ findViewById(R.id.add_image_button).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+
+ intent.setType("image/*");
+
+ startActivityForResult(intent, IMAGE_REQUEST_CODE);
+ }
+
+ });
+
+ }
+
+
+ @Override
+
+ protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+
+ if (resultCode == RESULT_OK && requestCode == IMAGE_REQUEST_CODE) {
+
+ if (data != null) {
+
+ Uri dataUri = data.getData();
+ listImages.add(ShowResult(iCounter++, dataUri));
+
+
+
+
+
+ }
+
+ }
+
+ }
+
+ private void PrecessOnResuming(){
+ // setContentView(R.layout.activity_main);
+ LinearLayout ll = findViewById(R.id.scrolling_view);
+ ll.invalidate();
+
+
+ Bundle extras =getIntent().getExtras();
+ if(extras!=null) {
+
+
+ String stringNew = extras.getString("COMING_BACK");
+ if (stringNew.equals("I am back")&&fromOtherScreen==true) {
+ ShowAllResult(listImages);
+
+ }
+
+ }
+ }
+
+ private ImageData ShowResult(int index, Uri dataUri) {
+ String name = "";
+ TextView tv = new TextView(getApplicationContext());
+
+ imageData = new ImageData(dataUri.toString(), index);
+ name = imageData.getStringUri();
+ tv.setText("[" + index + "] " + name);
+ LinearLayout ll = findViewById(R.id.scrolling_view);
+
+ ll.addView(tv);
+
+ imageData.setUri(dataUri);
+ imageView = new ImageView(getApplicationContext());
+ imageView.setImageURI(dataUri);
+ imageView.setTag(dataUri.toString());
+ ll.addView(imageView);
+
+ tv.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ TextView tva = findViewById(R.id.text_results);
+ sendData((TextView) v);
+
+
+ }
+ });
+ imageView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ sendDataforDetail(v.getTag().toString());
+ }
+ });
+ fromOtherScreen=false;
+ return imageData;
+ }
+
+ private void ShowAllResult(ArrayList listImages) {
+
+ LinearLayout ll = findViewById(R.id.scrolling_view);
+
+ ImageData imageData = new ImageData("", 0);
+ Context context=getApplicationContext();
+ if(ll.getContext()==null&&listImages.get(0).getIndex()!=1)return;
+ for (int i = 0; i < listImages.size(); i++) {
+ imageData = listImages.get(i);
+
+ TextView tv = new TextView(context);
+ imageView = new ImageView(context);
+ tv.setText("[" + imageData.getIndex() + "] " + imageData.getStringUri());
+ imageView.setImageURI(imageData.getUri());
+
+ ll.addView(tv);
+ ll.addView(imageView);
+
+ tv.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ sendData((TextView) v);
+ }
+ });
+ imageView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ sendDataforDetail(v.getTag().toString());
+ }
+ });
+
+ }
+ fromOtherScreen=false;
+
+ }
+
+ void sendDataforDetail(String str){
+ TextView tva = findViewById(R.id.text_results);
+
+
+ ImageData imageData = new ImageData(str, 0);
+
+ Context context= getApplicationContext();
+
+ Intent intent = new Intent(context, activity_detail.class);
+ intent.putExtra("DATA_I_NEED",imageData);
+ fromOtherScreen=true;
+ startActivity(intent);
+ }
+
+
+ void sendData(TextView tv) {
+
+
+ TextView tva = findViewById(R.id.text_results);
+
+
+ String stringUri = (String) tv.getText();
+ tva.setText(stringUri);
+ stringUri= ExtractUri(stringUri);
+
+
+ ImageData imageData = new ImageData(stringUri, 0);
+ imageData.setStringUri(stringUri);
+
+ Context context;
+ context= getApplicationContext();
+
+
+ Intent intent = new Intent(context, FullscreenActivity.class);
+ intent.putExtra("STRING_I_NEED",stringUri);
+ fromOtherScreen=true;
+ startActivity(intent);
+
+ }
+
+ //Remove index attached in front of URI
+ private String ExtractUri(String stringUri){
+ for(int i=0;i
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/activity_fullscreen2.xml b/activity_fullscreen2.xml
new file mode 100644
index 0000000..d1accb7
--- /dev/null
+++ b/activity_fullscreen2.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/activity_main.xml b/activity_main.xml
new file mode 100644
index 0000000..4923b86
--- /dev/null
+++ b/activity_main.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file