Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC-1047: Migrate providermanagerdashboard package from MVP to MVVM architecture #968

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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