Created basic SendTransactionFragment and SendTransactionFragment with their respective layout files.

This commit is contained in:
Severiano Jaramillo 2018-12-03 15:37:27 -06:00
parent 70ebea75b0
commit 75bd1b2e03
8 changed files with 59 additions and 42 deletions

View file

@ -28,8 +28,6 @@
<activity
android:name=".activities.SettingsActivity"
android:label="@string/title_settings"/>
<activity android:name=".activities.SendTransactionActivity"/>
<activity android:name=".activities.ReceiveTransactionActivity"/>
</application>
</manifest>

View file

@ -8,11 +8,14 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import androidx.collection.LongSparseArray
import androidx.fragment.app.Fragment
import com.google.android.material.bottomnavigation.BottomNavigationView
import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.database.entities.Balance
import cy.agorise.bitsybitshareswallet.fragments.BalancesFragment
import cy.agorise.bitsybitshareswallet.fragments.MerchantsFragment
import cy.agorise.bitsybitshareswallet.fragments.ReceiveTransactionFragment
import cy.agorise.bitsybitshareswallet.fragments.SendTransactionFragment
import cy.agorise.bitsybitshareswallet.processors.TransfersLoader
import cy.agorise.bitsybitshareswallet.repositories.BalanceRepository
import cy.agorise.bitsybitshareswallet.utils.Constants
@ -39,19 +42,19 @@ class MainActivity : ConnectedActivity() {
private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item ->
when (item.itemId) {
R.id.navigation_receive -> {
Toast.makeText(this, "Receive Fragment", Toast.LENGTH_SHORT).show()
loadFragment(ReceiveTransactionFragment())
return@OnNavigationItemSelectedListener true
}
R.id.navigation_balances -> {
loadBalancesFragment()
loadFragment(BalancesFragment())
return@OnNavigationItemSelectedListener true
}
R.id.navigation_merchants -> {
loadMerchantsFragment()
loadFragment(MerchantsFragment())
return@OnNavigationItemSelectedListener true
}
R.id.navigation_send -> {
Toast.makeText(this, "Send Fragment", Toast.LENGTH_SHORT).show()
loadFragment(SendTransactionFragment())
return@OnNavigationItemSelectedListener true
}
}
@ -73,15 +76,9 @@ class MainActivity : ConnectedActivity() {
mBalanceRepository = BalanceRepository(this)
}
private fun loadBalancesFragment() {
private fun loadFragment(fragment: Fragment) {
val ft = supportFragmentManager.beginTransaction()
ft.replace(R.id.fragment_frame, BalancesFragment())
ft.commit()
}
private fun loadMerchantsFragment() {
val ft = supportFragmentManager.beginTransaction()
ft.replace(R.id.fragment_frame, MerchantsFragment())
ft.replace(R.id.fragment_frame, fragment)
ft.commit()
}

View file

@ -1,13 +0,0 @@
package cy.agorise.bitsybitshareswallet.activities
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import cy.agorise.bitsybitshareswallet.R
class ReceiveTransactionActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_receive_transaction)
}
}

View file

@ -1,13 +0,0 @@
package cy.agorise.bitsybitshareswallet.activities
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import cy.agorise.bitsybitshareswallet.R
class SendTransactionActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_send_transaction)
}
}

View file

@ -0,0 +1,19 @@
package cy.agorise.bitsybitshareswallet.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import cy.agorise.bitsybitshareswallet.R
class ReceiveTransactionFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_receive_transaction, container, false)
}
}

View file

@ -0,0 +1,19 @@
package cy.agorise.bitsybitshareswallet.fragments
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import cy.agorise.bitsybitshareswallet.R
class SendTransactionFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_send_transaction, container, false)
}
}

View file

@ -5,6 +5,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.SendTransactionActivity">
tools:context=".fragments.ReceiveTransactionFragment">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/title_receive"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -5,6 +5,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.ReceiveTransactionActivity">
tools:context=".fragments.SendTransactionFragment">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/title_send"/>
</androidx.constraintlayout.widget.ConstraintLayout>