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-809 Create allergy based on server configuration #796

Merged
merged 10 commits into from
Aug 9, 2020
4 changes: 4 additions & 0 deletions openmrs-client/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@
android:name=".activities.community.contact.ContactUsActivity"
android:theme="@style/AppThemeOrig"
android:label="@string/contact_us"/>
<activity
android:name=".activities.addallergy.AddEditAllergyActivity"
android:theme="@style/AppThemeOrig"
android:label="@string/allergy_heading"/>

<activity
android:name="com.yalantis.ucrop.UCropActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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.addallergy;

import android.os.Bundle;
import android.view.Menu;

import androidx.appcompat.app.ActionBar;

import org.openmrs.mobile.R;
import org.openmrs.mobile.activities.ACBaseActivity;
import org.openmrs.mobile.utilities.ApplicationConstants;

public class AddEditAllergyActivity extends ACBaseActivity {
private Long patientID;

public static AddEditAllergyFragment newInstance() {
return new AddEditAllergyFragment();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_allergy_info);
ActionBar actionBar = getSupportActionBar();

if (actionBar != null) {
actionBar.setElevation(0);
actionBar.setDisplayHomeAsUpEnabled(true);
}
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
patientID = bundle.getLong(ApplicationConstants.BundleKeys.PATIENT_ID_BUNDLE);
}

AddEditAllergyFragment addEditAllergyFragment = (AddEditAllergyFragment) getSupportFragmentManager().findFragmentById(R.id.allergyFrame);
if (addEditAllergyFragment == null) {
addEditAllergyFragment = AddEditAllergyFragment.newInstance();
}
if (!addEditAllergyFragment.isActive()) {
addFragmentToActivity(getSupportFragmentManager(),
addEditAllergyFragment, R.id.allergyFrame);
}

new AddEditAllergyPresenter(addEditAllergyFragment, patientID);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
return true;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.addallergy;

import androidx.fragment.app.Fragment;

import org.openmrs.mobile.activities.BasePresenterContract;
import org.openmrs.mobile.activities.BaseView;
import org.openmrs.mobile.models.AllergyCreate;
import org.openmrs.mobile.models.ConceptMembers;
import org.openmrs.mobile.models.SystemProperty;

public interface AddEditAllergyContract {
interface View extends BaseView<AddEditAllergyContract.Presenter> {

void setConceptMembers(ConceptMembers conceptMembers, String reactions);

void setSeverity(SystemProperty systemProperty);

void showLoading(boolean loading, boolean exitScreen);
}

interface Presenter extends BasePresenterContract {
void fetchSystemProperties(Fragment fragment);

void createAllergy(AllergyCreate allergyCreate);
}
}

Loading