-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1544 from robustTechie/docConversion
Conversion: Client Signature, datatable, document, and Notes
- Loading branch information
Showing
36 changed files
with
1,871 additions
and
2,287 deletions.
There are no files selected for viewing
185 changes: 0 additions & 185 deletions
185
mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableFragment.java
This file was deleted.
Oops, something went wrong.
164 changes: 164 additions & 0 deletions
164
mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableFragment.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,164 @@ | ||
package com.mifos.mifosxdroid.online.datatable | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import android.widget.LinearLayout | ||
import android.widget.ProgressBar | ||
import android.widget.TextView | ||
import androidx.recyclerview.widget.LinearLayoutManager | ||
import androidx.recyclerview.widget.RecyclerView | ||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout | ||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener | ||
import butterknife.BindView | ||
import butterknife.ButterKnife | ||
import com.mifos.mifosxdroid.R | ||
import com.mifos.mifosxdroid.adapters.DataTableAdapter | ||
import com.mifos.mifosxdroid.core.MifosBaseActivity | ||
import com.mifos.mifosxdroid.core.MifosBaseFragment | ||
import com.mifos.mifosxdroid.core.RecyclerItemClickListener | ||
import com.mifos.mifosxdroid.core.util.Toaster | ||
import com.mifos.mifosxdroid.online.datatabledata.DataTableDataFragment | ||
import com.mifos.objects.noncore.DataTable | ||
import com.mifos.utils.Constants | ||
import com.mifos.utils.FragmentConstants | ||
import java.util.* | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Created by Rajan Maurya on 12/02/17. | ||
*/ | ||
class DataTableFragment : MifosBaseFragment(), DataTableMvpView, OnRefreshListener, RecyclerItemClickListener.OnItemClickListener { | ||
@JvmField | ||
@BindView(R.id.rv_data_table) | ||
var rvDataTable: RecyclerView? = null | ||
|
||
@JvmField | ||
@BindView(R.id.progressbar_data_table) | ||
var pbDataTable: ProgressBar? = null | ||
|
||
@JvmField | ||
@BindView(R.id.swipe_container) | ||
var swipeRefreshLayout: SwipeRefreshLayout? = null | ||
|
||
@JvmField | ||
@BindView(R.id.tv_error) | ||
var tvError: TextView? = null | ||
|
||
@JvmField | ||
@BindView(R.id.iv_error) | ||
var ivError: ImageView? = null | ||
|
||
@JvmField | ||
@BindView(R.id.ll_error) | ||
var ll_error: LinearLayout? = null | ||
|
||
@JvmField | ||
@Inject | ||
var dataTablePresenter: DataTablePresenter? = null | ||
|
||
@JvmField | ||
@Inject | ||
var dataTableAdapter: DataTableAdapter? = null | ||
lateinit var rootView: View | ||
private var tableName: String? = null | ||
private var entityId = 0 | ||
private var dataTables: List<DataTable>? = null | ||
override fun onItemClick(childView: View, position: Int) { | ||
val dataTableDataFragment: DataTableDataFragment = DataTableDataFragment.Companion.newInstance(dataTables!![position], entityId) | ||
val fragmentTransaction = activity!!.supportFragmentManager | ||
.beginTransaction() | ||
fragmentTransaction.addToBackStack(FragmentConstants.FRAG_CLIENT_DETAILS) | ||
fragmentTransaction.replace(R.id.container, dataTableDataFragment, FragmentConstants.FRAG_DATA_TABLE) | ||
fragmentTransaction.commit() | ||
} | ||
|
||
override fun onItemLongPress(childView: View, position: Int) {} | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
if (arguments != null) { | ||
tableName = arguments!!.getString(Constants.DATA_TABLE_NAME) | ||
entityId = arguments!!.getInt(Constants.ENTITY_ID) | ||
} | ||
dataTables = ArrayList() | ||
} | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
(activity as MifosBaseActivity?)!!.activityComponent.inject(this) | ||
rootView = inflater.inflate(R.layout.fragment_datatables, container, false) | ||
ButterKnife.bind(this, rootView) | ||
dataTablePresenter!!.attachView(this) | ||
showUserInterface() | ||
dataTablePresenter!!.loadDataTable(tableName) | ||
return rootView | ||
} | ||
|
||
override fun onRefresh() { | ||
dataTablePresenter!!.loadDataTable(tableName) | ||
} | ||
|
||
override fun showUserInterface() { | ||
setToolbarTitle(resources.getString(R.string.datatables)) | ||
val mLayoutManager = LinearLayoutManager(activity) | ||
mLayoutManager.orientation = LinearLayoutManager.VERTICAL | ||
rvDataTable!!.layoutManager = mLayoutManager | ||
rvDataTable!!.setHasFixedSize(true) | ||
rvDataTable!!.adapter = dataTableAdapter | ||
rvDataTable!!.addOnItemTouchListener(RecyclerItemClickListener(activity, this)) | ||
swipeRefreshLayout!!.setColorSchemeColors(*activity | ||
?.getResources()!!.getIntArray(R.array.swipeRefreshColors)) | ||
swipeRefreshLayout!!.setOnRefreshListener(this) | ||
} | ||
|
||
override fun showDataTables(dataTables: List<DataTable>?) { | ||
this.dataTables = dataTables | ||
dataTableAdapter!!.setDataTables(dataTables) | ||
} | ||
|
||
override fun showEmptyDataTables() { | ||
ll_error!!.visibility = View.VISIBLE | ||
rvDataTable!!.visibility = View.GONE | ||
tvError!!.setText(R.string.empty_data_table) | ||
} | ||
|
||
override fun showResetVisibility() { | ||
ll_error!!.visibility = View.GONE | ||
rvDataTable!!.visibility = View.VISIBLE | ||
} | ||
|
||
override fun showError(message: Int) { | ||
Toaster.show(rootView, message) | ||
ll_error!!.visibility = View.VISIBLE | ||
rvDataTable!!.visibility = View.GONE | ||
tvError!!.text = getString(R.string.failed_to_fetch_datatable) | ||
} | ||
|
||
override fun showProgressbar(show: Boolean) { | ||
if (show && dataTableAdapter!!.itemCount == 0) { | ||
pbDataTable!!.visibility = View.VISIBLE | ||
swipeRefreshLayout!!.isRefreshing = false | ||
} else { | ||
pbDataTable!!.visibility = View.GONE | ||
swipeRefreshLayout!!.isRefreshing = show | ||
} | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
dataTablePresenter!!.detachView() | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
fun newInstance(tableName: String?, entityId: Int): DataTableFragment { | ||
val arguments = Bundle() | ||
val dataTableFragment = DataTableFragment() | ||
arguments.putString(Constants.DATA_TABLE_NAME, tableName) | ||
arguments.putInt(Constants.ENTITY_ID, entityId) | ||
dataTableFragment.arguments = arguments | ||
return dataTableFragment | ||
} | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableMvpView.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
mifosng-android/src/main/java/com/mifos/mifosxdroid/online/datatable/DataTableMvpView.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,15 @@ | ||
package com.mifos.mifosxdroid.online.datatable | ||
|
||
import com.mifos.mifosxdroid.base.MvpView | ||
import com.mifos.objects.noncore.DataTable | ||
|
||
/** | ||
* Created by Rajan Maurya on 12/02/17. | ||
*/ | ||
interface DataTableMvpView : MvpView { | ||
fun showUserInterface() | ||
fun showDataTables(dataTables: List<DataTable>?) | ||
fun showEmptyDataTables() | ||
fun showResetVisibility() | ||
fun showError(message: Int) | ||
} |
Oops, something went wrong.