-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cdf857
commit 99fbdae
Showing
36 changed files
with
463 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/benrostudios/enchante/ui/nearby/NearbyFragmentHolder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.benrostudios.enchante.ui.nearby | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import com.benrostudios.enchante.R | ||
import com.benrostudios.enchante.databinding.ActivityNearbyFragmentHolderBinding | ||
import com.benrostudios.enchante.databinding.ActivityNearbyPaymentBinding | ||
import com.bumptech.glide.Glide | ||
import com.google.firebase.auth.ktx.auth | ||
import com.google.firebase.ktx.Firebase | ||
|
||
class NearbyFragmentHolder : AppCompatActivity() { | ||
private lateinit var binding: ActivityNearbyFragmentHolderBinding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityNearbyFragmentHolderBinding.inflate(layoutInflater) | ||
val view = binding.root | ||
setContentView(view) | ||
Glide.with(this).load(Firebase.auth.currentUser?.photoUrl) | ||
.into(binding.nearbyPaymentUserImg) | ||
Glide.with(this).load(R.drawable.ic_avatar).into(binding.nearbyPaymentTosendImg4) | ||
binding.nearbyPaymentDescription.text = this.getString(R.string.pay_to) | ||
} | ||
} |
76 changes: 73 additions & 3 deletions
76
app/src/main/java/com/benrostudios/enchante/ui/nearby/NearbyPaymentActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,96 @@ | ||
package com.benrostudios.enchante.ui.nearby | ||
|
||
import android.content.Intent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.os.Handler | ||
import android.os.Looper | ||
import android.util.Log | ||
import com.benrostudios.enchante.R | ||
import com.benrostudios.enchante.SplashActivity | ||
import com.benrostudios.enchante.databinding.ActivityMainBinding | ||
import com.benrostudios.enchante.databinding.ActivityNearbyPaymentBinding | ||
import com.benrostudios.enchante.ui.TestActivity | ||
import com.benrostudios.enchante.ui.auth.AuthActivity | ||
import com.benrostudios.enchante.ui.home.HomeActivity | ||
import com.benrostudios.enchante.ui.onboarding.OnboardingActivity | ||
import com.benrostudios.enchante.utils.SharedPrefManager | ||
import com.benrostudios.enchante.utils.show | ||
import com.bumptech.glide.Glide | ||
import com.google.android.gms.nearby.Nearby | ||
import com.google.android.gms.nearby.messages.* | ||
import com.google.firebase.auth.FirebaseAuth | ||
import com.google.firebase.auth.ktx.auth | ||
import com.google.firebase.ktx.Firebase | ||
import org.koin.android.ext.android.inject | ||
|
||
class NearbyPaymentActivity : AppCompatActivity() { | ||
|
||
//Nearby | ||
private lateinit var messageListener: MessageListener | ||
private lateinit var messageClient: MessagesClient | ||
|
||
private lateinit var binding: ActivityNearbyPaymentBinding | ||
private val sharedPrefManager: SharedPrefManager by inject() | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = ActivityNearbyPaymentBinding.inflate(layoutInflater) | ||
val view = binding.root | ||
setContentView(view) | ||
Glide.with(this).load(Firebase.auth.currentUser?.photoUrl).circleCrop() | ||
.into(binding.nearbyPaymentUserImg) | ||
Glide.with(this).load(Firebase.auth.currentUser?.photoUrl).circleCrop() | ||
.into(binding.nearbyPaymentTosendImg4) | ||
.into(binding.nearbyUserImage) | ||
messageListener = object : MessageListener() { | ||
override fun onFound(p0: Message) { | ||
Log.d(TAG, "Found message: ${String(p0.content)}"); | ||
} | ||
|
||
override fun onLost(p0: Message) { | ||
Log.d(TAG, "Lost message: ${String(p0.content)}"); | ||
} | ||
|
||
override fun onBleSignalChanged(message: Message, bleSignal: BleSignal) { | ||
Log.i( | ||
TAG, | ||
"Message: $message has new BLE signal information: $bleSignal" | ||
) | ||
} | ||
|
||
|
||
override fun onDistanceChanged(p0: Message, p1: Distance) { | ||
Log.d(TAG, "Found Distance: ${p0.content}"); | ||
} | ||
} | ||
Nearby.getMessagesClient( | ||
this | ||
).publish(Message(sharedPrefManager.userPhoneNumber.toByteArray())) | ||
.addOnSuccessListener { | ||
Log.d(TAG, "Publishing Nearby") | ||
} | ||
.addOnFailureListener { | ||
Log.d(TAG, it.toString()) | ||
}; | ||
Nearby.getMessagesClient(this).subscribe(messageListener); | ||
|
||
Handler(Looper.getMainLooper()).postDelayed( | ||
{ | ||
binding.senderImage.show() | ||
binding.senderName.show() | ||
binding.senderImage.setOnClickListener { | ||
startActivity(Intent(this, NearbyFragmentHolder::class.java)) | ||
this.finish() | ||
} | ||
}, 5000 | ||
) | ||
} | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
|
||
} | ||
|
||
companion object { | ||
private const val TAG = "nearby_activity" | ||
} | ||
|
||
} |
60 changes: 0 additions & 60 deletions
60
app/src/main/java/com/benrostudios/enchante/ui/nearby/fragments/NearbyDiscoveryFragment.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.