Skip to content

Commit

Permalink
Merge pull request #9 from FlorianDitt/feature/no-screenshot
Browse files Browse the repository at this point in the history
feat: screenshot is diabled
  • Loading branch information
FlorianDitt authored Jan 19, 2024
2 parents af5e064 + 3eacb92 commit a0ce419
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class AddPasswordActivity : AppCompatActivity() {
username,
password
)
println("added")
val intent = Intent(this,MainActivity::class.java)//Declare target Activity
intent.putExtra("UserID", userID)//add userID to new Activity
intent.putExtra("Username", intentUsername)
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/java/com/example/myapplication/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.view.Gravity
import android.view.View.INVISIBLE
import android.view.View.VISIBLE
import android.view.View.generateViewId
import android.view.WindowManager
import android.widget.*
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -23,6 +24,11 @@ class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Use FLAG_SECURE to prevent screenshots
window.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
setContentView(R.layout.activity_main)
if (intent.extras != null){
userID = intent.getStringExtra("UserID").toString()
Expand All @@ -41,16 +47,12 @@ class MainActivity : AppCompatActivity() {
}

delButton.setOnClickListener {
println("2")
showDel = !showDel
for (i in tableLength.indices) {
val btn = findViewById<ImageButton>(tableLength.elementAt(i))
if (showDel){
println("1")
println(btn.visibility)
btn.visibility = VISIBLE
}else{
println("0")
btn.visibility = INVISIBLE
}
}
Expand Down Expand Up @@ -151,7 +153,6 @@ class MainActivity : AppCompatActivity() {
dialogBuilder.setMessage("You Want to delete that")
dialogBuilder.setPositiveButton("JA"
) { _, _ ->
println("1")
showDel = !showDel
for (i in tableLength.indices) {
findViewById<ImageButton>(tableLength.elementAt(i)).isVisible = showDel
Expand Down

0 comments on commit a0ce419

Please sign in to comment.