-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Home Fragment, Profile Fragment and Account Fragment
- Loading branch information
Showing
51 changed files
with
1,147 additions
and
85 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
20 changes: 20 additions & 0 deletions
20
app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/Account.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,20 @@ | ||
package org.mifos.mobile.cn.ui.mifos | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.base.MifosBaseFragment | ||
|
||
class Account : MifosBaseFragment() { | ||
companion object { | ||
fun newInstance(): Account = Account() | ||
} | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle?): View? { | ||
// Inflate the layout for this fragment | ||
getToolbar().setVisibility(View.GONE); | ||
return inflater.inflate(R.layout.fragment_account, container, false) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.mifos.mobile.cn.ui.mifos | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.Test1 | ||
import org.mifos.mobile.cn.ui.base.MifosBaseFragment | ||
|
||
class Home : MifosBaseFragment() { | ||
companion object { | ||
fun newInstance(): Home = Home() | ||
} | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle?): View? { | ||
// Inflate the layout for this fragment | ||
getToolbar().setVisibility(View.GONE); | ||
return inflater.inflate(R.layout.fragment_home, container, false) | ||
} | ||
} |
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,71 @@ | ||
package org.mifos.mobile.cn.ui.mifos | ||
|
||
import android.os.Bundle | ||
import androidx.annotation.NonNull | ||
import androidx.fragment.app.Fragment | ||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout | ||
import com.google.android.material.bottomnavigation.BottomNavigationView | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.Test1 | ||
import org.mifos.mobile.cn.ui.base.MifosBaseActivity | ||
import android.view.MenuItem as MenuItem1 | ||
|
||
|
||
class Main : MifosBaseActivity(), BottomNavigationView.OnNavigationItemSelectedListener { | ||
private var bottomNavigationView: BottomNavigationView? = null | ||
private var menuItem = -1 | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_home) | ||
|
||
bottomNavigationView = findViewById(R.id.bottom_navigation) | ||
setupNavigationBar() | ||
bottomNavigationView?.run { setSelectedItemId(R.id.action_home) | ||
} | ||
|
||
|
||
} | ||
|
||
override fun onNavigationItemSelected(item: MenuItem1): Boolean { | ||
clearFragmentBackStack() | ||
setToolbarElevation() | ||
menuItem = item.itemId | ||
navigateFragment(item.itemId,false) | ||
return true | ||
} | ||
private fun setupNavigationBar() { | ||
|
||
bottomNavigationView?.setOnNavigationItemSelectedListener(object : BottomNavigationView.OnNavigationItemSelectedListener { | ||
override fun onNavigationItemSelected(@NonNull item: android.view.MenuItem): Boolean { | ||
navigateFragment(item.itemId, false) | ||
return true | ||
} | ||
}) | ||
|
||
} | ||
override fun onBackPressed() { | ||
val fragment: Fragment? = supportFragmentManager | ||
.findFragmentById(R.id.bottom_navigation_fragment_container) | ||
if (fragment != null && fragment !is Home && fragment.isVisible()) { | ||
navigateFragment(R.id.action_home, true) | ||
return | ||
} | ||
super.onBackPressed() | ||
} | ||
private fun navigateFragment(id: Int, shouldSelect: Boolean) { | ||
if (shouldSelect) { | ||
bottomNavigationView?.setSelectedItemId(id) | ||
} else { | ||
when (id) { | ||
R.id.action_home -> replaceFragment(Home.newInstance(), false, | ||
R.id.bottom_navigation_fragment_container) | ||
R.id.action_acounts -> replaceFragment(Account.newInstance(), false, | ||
R.id.bottom_navigation_fragment_container) | ||
R.id.action_transfer -> replaceFragment(Test1.newInstance(), false, | ||
R.id.bottom_navigation_fragment_container) | ||
R.id.action_profile -> replaceFragment(Profile.newInstance(), false, | ||
R.id.bottom_navigation_fragment_container) | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/Profile.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,20 @@ | ||
package org.mifos.mobile.cn.ui.mifos | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.base.MifosBaseFragment | ||
|
||
class Profile : MifosBaseFragment() { | ||
companion object { | ||
fun newInstance(): Profile = Profile() | ||
} | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle?): View? { | ||
// Inflate the layout for this fragment | ||
getToolbar().setVisibility(View.GONE); | ||
return inflater.inflate(R.layout.fragment_profile, container, false) | ||
} | ||
} |
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,26 @@ | ||
package org.mifos.mobile.cn.ui | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import kotlinx.android.synthetic.main.toolbar.* | ||
import org.mifos.mobile.cn.R | ||
import org.mifos.mobile.cn.ui.base.MifosBaseFragment | ||
import org.mifos.mobile.cn.ui.mifos.accounts.AccountsFragment | ||
import org.mifos.mobile.cn.ui.mifos.recentTransactions.RecentTransactionsFragment | ||
import org.mifos.mobile.cn.ui.utils.ConstantKeys | ||
|
||
class Test1 : MifosBaseFragment() { | ||
companion object { | ||
fun newInstance(): Test1 = Test1() | ||
} | ||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle?): View? { | ||
// Inflate the layout for this fragment | ||
setToolbarTitle("Recent Transactions") | ||
getToolbar().setVisibility(View.GONE); | ||
return inflater.inflate(R.layout.fragment_home, container, false) | ||
} | ||
} |
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,4 @@ | ||
package org.mifos.mobile.cn.ui.mifos | ||
|
||
class Transfer { | ||
} |
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
Oops, something went wrong.