Skip to content

Commit

Permalink
Merge pull request #1544 from robustTechie/docConversion
Browse files Browse the repository at this point in the history
Conversion: Client Signature, datatable, document, and Notes
  • Loading branch information
Grandolf49 authored Feb 15, 2021
2 parents 58aa1c1 + 2126ff0 commit 3dade74
Show file tree
Hide file tree
Showing 36 changed files with 1,871 additions and 2,287 deletions.

This file was deleted.

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
}
}
}

This file was deleted.

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)
}
Loading

0 comments on commit 3dade74

Please sign in to comment.