Skip to content

Commit

Permalink
0123
Browse files Browse the repository at this point in the history
  • Loading branch information
TheR20 committed Jul 14, 2021
1 parent 573e7e5 commit 0e367a4
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 34 additions & 17 deletions app/src/main/java/com/example/find_your_duo/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import java.io.ByteArrayOutputStream
import java.io.IOException

class SettingsActivity : AppCompatActivity() {


private var mNameField: EditText? = null
private var mPhoneField: EditText? = null
private var mBack: Button? = null
Expand All @@ -36,12 +34,13 @@ class SettingsActivity : AppCompatActivity() {
private var resultUri: Uri? = null
private var mRadioGroupBuscar: RadioGroup? = null
private var valormRadioGroupBuscar: RadioGroup? = null
private lateinit var radioButtonBuscaSexo: RadioButton
private lateinit var radioButtonBuscaSexo: RadioButton
private var PC: CheckBox?=null
private var Playstation: CheckBox?=null
private var Xbox : CheckBox?=null
private var Nintendo : CheckBox?=null
private var Movil: CheckBox?=null
private var aString: String?=null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
Expand All @@ -56,6 +55,19 @@ private lateinit var radioButtonBuscaSexo: RadioButton
mUserDatabase = FirebaseDatabase.getInstance().reference.child("Users").child(userId!!)
mRadioGroupBuscar = findViewById<View>(R.id.radioGroupBusca) as RadioGroup

val selectIdBuscaSexo = mRadioGroupBuscar!!.checkedRadioButtonId
// val radioButtonBuscaSexo = findViewById<View>(selectIdBuscaSexo) as RadioButton
PC = findViewById<View>(R.id.checkBoxPc) as CheckBox?

Xbox = findViewById<View>(R.id.checkBoxXbox) as CheckBox?
Nintendo = findViewById<View>(R.id.checkBoxNintendo) as CheckBox?
Movil = findViewById<View>(R.id.checkBoxMovil) as CheckBox?

Playstation = findViewById<View>(R.id.checkBoxPlaytation) as CheckBox?
// Playstation?.jumpDrawablesToCurrentState()
// Playstation?.isChecked = true
Playstation?.clearFocus()
Playstation?.isChecked
userInfo
mProfileImage!!.setOnClickListener {
val intent = Intent(Intent.ACTION_PICK)
Expand All @@ -69,6 +81,8 @@ private lateinit var radioButtonBuscaSexo: RadioButton
})
}



private val userInfo: Unit
private get() {
mUserDatabase!!.addListenerForSingleValueEvent(object : ValueEventListener {
Expand All @@ -86,6 +100,12 @@ private lateinit var radioButtonBuscaSexo: RadioButton
if (map["sexo"] != null) {
userSex = map["sexo"].toString()
}
if (map["Playstation"].toString() != "false") {
var aString = map["Playstation"].toString()
// Playstation?.isChecked
// Playstation?.isChecked = true
// Playstation?.jumpDrawablesToCurrentState()
}
Glide.with(mProfileImage!!.context).clear(mProfileImage!!)
if (map["profileImageUrl"] != null) {
profileImageUrl = map["profileImageUrl"].toString()
Expand All @@ -104,24 +124,18 @@ private lateinit var radioButtonBuscaSexo: RadioButton
private fun saveUserInformation() {
name = mNameField!!.text.toString()
biografia = mPhoneField!!.text.toString()
val selectIdBuscaSexo = mRadioGroupBuscar!!.checkedRadioButtonId
val radioButtonBuscaSexo = findViewById<View>(selectIdBuscaSexo) as RadioButton
PC = findViewById<View>(R.id.checkBoxPc) as CheckBox?
Playstation = findViewById<View>(R.id.checkBoxPlaytation) as CheckBox?
Xbox = findViewById<View>(R.id.checkBoxXbox) as CheckBox?
Nintendo = findViewById<View>(R.id.checkBoxNintendo) as CheckBox?
Movil = findViewById<View>(R.id.checkBoxMovil) as CheckBox?


var buscasex = radioButtonBuscaSexo.text.toString()
val userInfo: java.util.HashMap<Any?, Any?> = java.util.HashMap<Any?, Any?>()
userInfo["Name"] = name
userInfo["biografia"] = biografia
userInfo["buscarSexo"] = buscasex
userInfo["PC"] = checkIfItsChecked(PC!!)
userInfo["Playstation"] = checkIfItsChecked(Playstation!!)
userInfo["Xbox"] = checkIfItsChecked(Xbox!!)
userInfo["Nintendo"] = checkIfItsChecked(Nintendo!!)
userInfo["Movile"] = checkIfItsChecked(Movil!!)
// userInfo["buscarSexo"] = buscasex
// userInfo["PC"] = checkIfItsChecked(PC!!)
userInfo["Playstation"] = checkIfItsCheckedString(aString!!)
// userInfo["Xbox"] = checkIfItsChecked(Xbox!!)
// userInfo["Nintendo"] = checkIfItsChecked(Nintendo!!)
// userInfo["Movile"] = checkIfItsChecked(Movil!!)
mUserDatabase?.updateChildren(userInfo as Map<String, Any>)
val a = 1
if (resultUri != null) {
Expand All @@ -139,7 +153,7 @@ private lateinit var radioButtonBuscaSexo: RadioButton
uploadTask.addOnFailureListener { finish() }
uploadTask.addOnSuccessListener(OnSuccessListener { taskSnapshot ->
val downloadUrl = taskSnapshot.storage.downloadUrl
while (!downloadUrl.isSuccessful());
while (!downloadUrl.isSuccessful);
val resultdowloadUrl: Uri? = downloadUrl.getResult()
val userInfo: MutableMap<String, Any?> = HashMap<String, Any?>()
Log.e("uri12",resultdowloadUrl.toString()+"This is uri of image download");
Expand All @@ -165,5 +179,8 @@ private lateinit var radioButtonBuscaSexo: RadioButton
private fun checkIfItsChecked(checkBox: CheckBox): Boolean{
return checkBox.isChecked
}
private fun checkIfItsCheckedString(string: String): Boolean{
return string == "true"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.*
import kotlinx.android.synthetic.main.activity_chat.*


//
var mDatabaseUser: DatabaseReference? = null
var mDatabaseChat: DatabaseReference? = null
var mDatabaseChatChild: DatabaseReference? = null
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/item_matches.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
android:text="Match's ID"
android:layout_gravity="center"
android:id="@+id/Matchid"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:layout_gravity="center"
android:id="@+id/Bandeja"/>
</LinearLayout>


Expand Down

0 comments on commit 0e367a4

Please sign in to comment.