Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.WindowManager
import android.widget.EditText
Expand All @@ -16,16 +17,19 @@ class DetailsActivity : AppCompatActivity() {

private var data: ImageData? = null

//sets layout up JBG
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_details)

//Makes it possible to return to Main activity by pressing back button JBG
val intent = intent
data = intent.getSerializableExtra("object") as ImageData
val context = this

this.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)

//gives the ability to enter fullscreen activity by clicking image JBG
image.setOnClickListener {
val intent = Intent(context, FullscreenActivity::class.java)
intent.putExtra("image", data?.fileUriString)
Expand All @@ -34,8 +38,10 @@ class DetailsActivity : AppCompatActivity() {

}

//collects image and data to display JBG
override fun onStart() {
super.onStart()
Log.i(javaClass.simpleName, "onStart")

image.setImageURI(data?.fileUri)
// image.setImageDrawable(getResources().getDrawable(android.R.drawable.btn_star));
Expand All @@ -46,6 +52,7 @@ class DetailsActivity : AppCompatActivity() {
edit_description.setText(data?.description)
}

// makes it possible to return to Main activity by pressing back button. JBG
override fun onBackPressed() {
data?.name = edit_name.text.toString()
data?.description = edit_description.text.toString()
Expand All @@ -54,4 +61,29 @@ class DetailsActivity : AppCompatActivity() {
setResult(Activity.RESULT_OK, resultIntent)
finish()
}

override fun onResume() {
super.onResume()
Log.i(javaClass.simpleName, "onResume")
}

override fun onPause() {
super.onPause()
Log.i(javaClass.simpleName, "onPause")
}

override fun onDestroy() {
super.onDestroy()
Log.i(javaClass.simpleName, "onDestroy")
}

override fun onStop() {
super.onStop()
Log.i(javaClass.simpleName, "onStop")
}

override fun onRestart() {
super.onRestart()
Log.i(javaClass.simpleName, "onRestart")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.net.Uri
import android.os.Bundle
import android.os.Handler
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.widget.ImageView
Expand Down Expand Up @@ -46,6 +47,7 @@ class FullscreenActivity : AppCompatActivity() {
* system UI. This is to prevent the jarring behavior of controls going away
* while interacting with activity UI.
*/
// opens actionbar briefly when image clicked before hiding again JBG
private val mDelayHideTouchListener = View.OnTouchListener { view, motionEvent ->
if (AUTO_HIDE) {
delayedHide(AUTO_HIDE_DELAY_MILLIS)
Expand Down Expand Up @@ -145,4 +147,34 @@ class FullscreenActivity : AppCompatActivity() {
*/
private val UI_ANIMATION_DELAY = 300
}

override fun onStart() {
super.onStart()
Log.i(javaClass.simpleName, "onStart")
}

override fun onResume() {
super.onResume()
Log.i(javaClass.simpleName, "onResume")
}

override fun onPause() {
super.onPause()
Log.i(javaClass.simpleName, "onPause")
}

override fun onDestroy() {
super.onDestroy()
Log.i(javaClass.simpleName, "onDestroy")
}

override fun onStop() {
super.onStop()
Log.i(javaClass.simpleName, "onStop")
}

override fun onRestart() {
super.onRestart()
Log.i(javaClass.simpleName, "onRestart")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.net.Uri

import java.io.Serializable

//collects image information to display to screen JBG
class ImageData(fullPhotoUri: Uri) : Serializable {
var name: String? = null
var description: String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import java.util.ArrayList
/**
* Not required for intent assignment
*/
//helps make the layout for MainActivity with Images and details JBG
class ImageListAdapter// Provide a suitable constructor (depends on the kind of dataset)
(private val imageList: ArrayList<ImageData>, private val activity: Activity) : RecyclerView.Adapter<ImageListAdapter.ViewHolder>() {
private var context: Context? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class MainActivity : AppCompatActivity() {

imageList = ArrayList()

//makes image and it's details clickable to enter detail activity JBG
button_add.setOnClickListener {
val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.type = "image/*"
Expand Down Expand Up @@ -59,6 +60,7 @@ class MainActivity : AppCompatActivity() {
listAdapter!!.notifyDataSetChanged()
}

//if new image was pulled in with data will update image list JBG
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == REQUEST_IMAGE_GET && resultCode == RESULT_OK) {
val fullPhotoUri = data!!.data
Expand Down Expand Up @@ -86,4 +88,34 @@ class MainActivity : AppCompatActivity() {
internal const val REQUEST_IMAGE_GET = 1
internal const val EDIT_IMAGE_REQUEST = 2
}

override fun onStart() {
super.onStart()
Log.i(javaClass.simpleName, "onStart")
}

override fun onResume() {
super.onResume()
Log.i(javaClass.simpleName, "onResume")
}

override fun onPause() {
super.onPause()
Log.i(javaClass.simpleName, "onPause")
}

override fun onDestroy() {
super.onDestroy()
Log.i(javaClass.simpleName, "onDestroy")
}

override fun onStop() {
super.onStop()
Log.i(javaClass.simpleName, "onStop")
}

override fun onRestart() {
super.onRestart()
Log.i(javaClass.simpleName, "onRestart")
}
}