-
Notifications
You must be signed in to change notification settings - Fork 600
Project architecture overview
MifosBaseActivity
- base class for all activities.
It contains a bunch of helpful methods for your implementation:
protected void showBackButton()
protected void setActionBarTitle(String title)
protected void setActionBarTitle(int title)
protected void showProgress(String message)
protected void hideProgress()
protected void logout()
protected void replaceFragment(Fragment fragment, boolean addToBackStack, int containerId)
replaceFragment
- method handles fragment manipulations, and stack storage.
BaseActivityCallback
- this interface is implemented by MifosBaseActivity
by default. This allows to make a single communication link Fragment
<-> Activity
and remove duplicating functionality.
MifosBaseFragment
- base component for fragments.
Using BaseActivityCallback
it can communicate with parent activity anytime. Through this link, have almost the same functionality as MifosBaseActivity
.
MifosBaseListAdapter
- It is a generic adapter, that should be subclassed for all adapters in the project.
public MifosBaseListAdapter(Context context, List<T> list, int layoutId) {
...
}
It incapsulates the most of calculations, elements additions, inflater creation. Implementation sample:
public class ClientSearchAdapter extends MifosBaseListAdapter<SearchedEntity> {
// layoutId - your layout identifier
public ClientSearchAdapter(Context context, List<SearchedEntity> list, int layoutId) {
super(context, list, layoutId);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
final SearchedEntity item;
if (convertView == null) {
convertView = getLayout();
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
item = getItem(position);
holder.name.setText(item.getDescription());
return convertView;
}
// Don't forget to use ViewHolder to prevent performance issues
class ViewHolder {
private TextView name;
public ViewHolder(View view) {
name = (TextView) view.findViewById(R.id.name);
}
}
}
ApiManager
- base class for implementing server requests, it's located in package com.mifos.api
.
BaseApiManager
- superclass for ApiManager
, and it handles interface (API services) creation, request interception, logging, etc.
To add new request you should modify corresponding service interface, and then call it from ApiManager
. Consider not using direct Callback
into your UI controller.
ApiManager
instance can be accessed from App
class.
Example:
App.apiManager.login(username, password, this);
PrefManager
- preferences management utility. It allows to reduce boilerplate code with creating SharedPreferences instance.
- Android-Client API Documentation - https://demo.mifos.io/api-docs/apiLive.htm
- Kotlin Multiplatform - https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html
- JetBrains Toolbox - https://www.jetbrains.com/toolbox-app/
- Compose Multiplatform - https://www.jetbrains.com/compose-multiplatform/
- Fastlane - https://docs.fastlane.tools/