Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Added flag 15 to overview
Browse files Browse the repository at this point in the history
  • Loading branch information
B3nac committed Jul 20, 2020
1 parent 2b5d589 commit b8f071a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.snackbar.Snackbar
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ValueEventListener
import java.util.*

class AssemblyActivity : AppCompatActivity() {

Expand All @@ -38,6 +38,10 @@ class AssemblyActivity : AppCompatActivity() {
val tv = findViewById<TextView>(R.id.textView10)
setSupportActionBar(toolbar)

val mAuth: FirebaseAuth
mAuth = FirebaseAuth.getInstance()
mAuth.signInAnonymously()

val XORstring = stringFromJNI()
val bytes = XORstring.toByteArray()
tv.text = bytes.contentToString()
Expand Down Expand Up @@ -71,9 +75,9 @@ class AssemblyActivity : AppCompatActivity() {
override fun onDataChange(dataSnapshot: DataSnapshot) {
val value = dataSnapshot.value as String?
if (post == value) {
FlagsOverview.flagEightButtonColor = true
FlagsOverview.flagFifteenButtonColor = true
val secure = SecureSharedPrefs()
secure.editBoolean(applicationContext, "flagEightButtonColor", true)
secure.editBoolean(applicationContext, "flagFifteenButtonColor", true)
correctFlag()
} else {
Toast.makeText(this@AssemblyActivity, "Try again! :D",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,20 @@ protected void onCreate(Bundle savedInstanceState) {
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);

FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (click == 0) {
Snackbar.make(view, "Use the .json trick with database url", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
//Figure out how to login anonymously on click
click = click + 1;
} else if (click == 1) {
Snackbar.make(view, "Filenames.", Snackbar.LENGTH_LONG)
.setAction("Action",null).show();
click = click + 1;
} else if (click == 2) {
Snackbar.make(view, "Encoding.", Snackbar.LENGTH_LONG)
.setAction("Action",null).show();
click = 0;
}
fab.setOnClickListener(view -> {
if (click == 0) {
Snackbar.make(view, "Use the .json trick with database url", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
//Figure out how to login anonymously on click
click = click + 1;
} else if (click == 1) {
Snackbar.make(view, "Filenames.", Snackbar.LENGTH_LONG)
.setAction("Action",null).show();
click = click + 1;
} else if (click == 2) {
Snackbar.make(view, "Encoding.", Snackbar.LENGTH_LONG)
.setAction("Action",null).show();
click = 0;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class FlagsOverview : AppCompatActivity() {
flagThirteenButton = findViewById(R.id.button37)
val flagFourteenButton: Button
flagFourteenButton = findViewById(R.id.button38)
val flagFifteenButton: Button
flagFifteenButton = findViewById(R.id.button41)

//Start of flag one
if (sharedPreferences.getBoolean("flagOneButtonColor", false)) {
Expand Down Expand Up @@ -244,6 +246,18 @@ class FlagsOverview : AppCompatActivity() {
if (value != "Flag fourteen found!") {
flagFourteenButton.background.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP)
}
//Start of flag fifteen
if (sharedPreferences.getBoolean("flagFifteenButtonColor", false)) {
flagFifteenButtonColor = sharedPreferences.getBoolean("flagFifteenButtonColor", true)
flagFifteenButton.background.setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP)
}
if (sharedPreferences.getBoolean("flagFifteenButtonColor", true)) {
flagFifteenButtonColor = sharedPreferences.getBoolean("flagFifteenButtonColor", false)
flagFifteenButton.background.setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP)
}
if (!flagFifteenButtonColor) {
flagFifteenButton.background.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP)
}
}

private fun initEncryptedSharedPreferences() {
Expand Down Expand Up @@ -280,6 +294,9 @@ class FlagsOverview : AppCompatActivity() {

@kotlin.jvm.JvmField
var flagThirteenButtonColor = false

@kotlin.jvm.JvmField
var flagFifteenButtonColor = false
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
android:id="@+id/button40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="submitFlag"
android:text="@string/button_submit"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/flag_14" />

<Button
android:id="@+id/button41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="@string/flag_15" />
</TableRow>
</TableLayout>

Expand Down
1 change: 1 addition & 0 deletions InjuredAndroid/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@
<string name="title_activity_assembly">AssemblyActivity</string>
<string name="flag_15_assembly">Flag 15 - Assembly</string>
<string name="assemblytextview">AssemblyTextView</string>
<string name="flag_15">Flag 15</string>
</resources>

0 comments on commit b8f071a

Please sign in to comment.