2021-04-22 11:47:18 +02:00
|
|
|
package org.pixeldroid.app.postCreation.camera
|
2020-10-04 23:27:06 +02:00
|
|
|
|
2022-06-21 18:19:54 +02:00
|
|
|
import android.content.Intent
|
2020-10-04 23:27:06 +02:00
|
|
|
import android.os.Bundle
|
2022-06-21 18:19:54 +02:00
|
|
|
import android.view.MenuItem
|
|
|
|
import org.pixeldroid.app.MainActivity
|
2021-04-22 11:47:18 +02:00
|
|
|
import org.pixeldroid.app.R
|
2022-07-10 13:42:19 +02:00
|
|
|
import org.pixeldroid.app.utils.BaseThemedWithBarActivity
|
2022-06-21 18:19:54 +02:00
|
|
|
|
2020-10-04 23:27:06 +02:00
|
|
|
|
2022-07-10 13:42:19 +02:00
|
|
|
class CameraActivity : BaseThemedWithBarActivity() {
|
2020-10-04 23:27:06 +02:00
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
setContentView(R.layout.activity_camera)
|
|
|
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
|
|
supportActionBar?.setTitle(R.string.add_photo)
|
|
|
|
|
|
|
|
val cameraFragment = CameraFragment()
|
|
|
|
|
|
|
|
val arguments = Bundle()
|
|
|
|
arguments.putBoolean("CameraActivity", true)
|
|
|
|
cameraFragment.arguments = arguments
|
|
|
|
|
|
|
|
supportFragmentManager.beginTransaction()
|
|
|
|
.add(R.id.camera_activity_fragment, cameraFragment).commit()
|
|
|
|
}
|
2022-06-21 18:19:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Launch without arguments so that it will open the
|
|
|
|
* [org.pixeldroid.app.postCreation.PostCreationActivity] instead of "returning" to a non-existent
|
|
|
|
* [org.pixeldroid.app.postCreation.PostCreationActivity]
|
|
|
|
*/
|
2022-07-10 13:42:19 +02:00
|
|
|
class CameraActivityShortcut : BaseThemedWithBarActivity() {
|
2022-06-21 18:19:54 +02:00
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
setContentView(R.layout.activity_camera)
|
|
|
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
|
|
|
supportActionBar?.setTitle(R.string.new_post_shortcut_long)
|
|
|
|
|
|
|
|
val cameraFragment = CameraFragment()
|
|
|
|
|
|
|
|
supportFragmentManager.beginTransaction()
|
|
|
|
.add(R.id.camera_activity_fragment, cameraFragment).commit()
|
|
|
|
}
|
|
|
|
|
|
|
|
//Start a new MainActivity when "going back" on this activity
|
|
|
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
|
|
when (item.itemId) {
|
|
|
|
android.R.id.home -> {
|
|
|
|
val intent = Intent(this, MainActivity::class.java)
|
|
|
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
|
|
|
super.startActivity(intent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2020-10-04 23:27:06 +02:00
|
|
|
}
|