Skip to content

Commit

Permalink
AC-1047: Migrate providermanagerdashboard package from MVP to MVVM ar…
Browse files Browse the repository at this point in the history
…chitecture
  • Loading branch information
amrsalah3 committed Oct 22, 2022
1 parent e832f0d commit 08ccfef
Show file tree
Hide file tree
Showing 17 changed files with 355 additions and 605 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public Observable<List<Provider>> getProviders() {
return createObservableIO(() -> {
// If not online, fetch providers locally
if (!NetworkUtils.isOnline()) {
ToastUtil.notify(context.getString(R.string.offline_provider_fetch));
logger.e("offline providers fetched couldn't sync with the database device offline");
logger.e("Offline providers fetched, couldn't sync with the database while offline");
return providerRoomDao.getProviderList().blockingGet();
}
providerRoomDao.deleteAll();
Expand Down
1 change: 1 addition & 0 deletions openmrs-client/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@
android:configChanges="keyboardHidden|screenSize"
android:label="@string/provider_manager"
android:launchMode="singleTop"
android:parentActivityName=".activities.dashboard.DashboardActivity"
android:theme="@style/AppThemeOrig" />
<activity
android:name=".activities.providermanagerdashboard.addprovider.AddProviderActivity"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package org.openmrs.mobile.activities.providermanagerdashboard

import android.graphics.Color
import android.os.Bundle
import android.widget.TextView
import com.google.android.material.snackbar.Snackbar
import dagger.hilt.android.AndroidEntryPoint
import org.openmrs.mobile.R
import org.openmrs.mobile.activities.ACBaseActivity

@AndroidEntryPoint
class ProviderManagerDashboardActivity : ACBaseActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_provider_management)

supportActionBar?.run {
elevation = 0f
setDisplayHomeAsUpEnabled(true)
setTitle(R.string.provider_manager)
}

// Create fragment
var providerManagerDashboardFragment = supportFragmentManager.findFragmentById(R.id.providerManagementContentFrame) as ProviderManagerDashboardFragment?
if (providerManagerDashboardFragment == null) {
providerManagerDashboardFragment = ProviderManagerDashboardFragment.newInstance()
}
if (!providerManagerDashboardFragment.isActive) {
addFragmentToActivity(supportFragmentManager, providerManagerDashboardFragment, R.id.providerManagementContentFrame)
}
}

/* Override to show the SnackBar under the floating action button, to not cover it */
override fun showNoInternetConnectionSnackbar() {
val fragment = supportFragmentManager.findFragmentById(R.id.providerManagementContentFrame)
mSnackbar = Snackbar.make(fragment!!.requireView(),
getString(R.string.no_internet_connection_message), Snackbar.LENGTH_INDEFINITE)
val sbView = mSnackbar.view
val textView = sbView.findViewById<TextView>(com.google.android.material.R.id.snackbar_text)
textView.setTextColor(Color.WHITE)
mSnackbar.show()
}
}

This file was deleted.

Loading

0 comments on commit 08ccfef

Please sign in to comment.