-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from OpenSRP/translation-fixes
Translation fixes
- Loading branch information
Showing
8 changed files
with
368 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
opensrp-chw-hf/src/main/java/org/smartregister/chw/hf/provider/HfOpdRegisterProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.smartregister.chw.hf.provider; | ||
|
||
import android.content.Context; | ||
import android.text.TextUtils; | ||
import android.view.View; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import org.smartregister.chw.core.utils.CoreConstants; | ||
import org.smartregister.chw.hf.R; | ||
import org.smartregister.commonregistry.CommonPersonObjectClient; | ||
import org.smartregister.family.util.DBConstants; | ||
import org.smartregister.family.util.Utils; | ||
import org.smartregister.opd.holders.OpdRegisterViewHolder; | ||
import org.smartregister.opd.provider.OpdRegisterProvider; | ||
import org.smartregister.opd.utils.OpdDbConstants; | ||
|
||
public class HfOpdRegisterProvider extends OpdRegisterProvider { | ||
private final Context context; | ||
|
||
public HfOpdRegisterProvider(@NonNull Context context, @NonNull View.OnClickListener onClickListener, @NonNull View.OnClickListener paginationClickListener) { | ||
super(context, onClickListener, paginationClickListener); | ||
this.context = context; | ||
} | ||
|
||
@Override | ||
public void populatePatientColumn(CommonPersonObjectClient commonPersonObjectClient, OpdRegisterViewHolder viewHolder) { | ||
super.populatePatientColumn(commonPersonObjectClient, viewHolder); | ||
String registerType = org.smartregister.util.Utils.getValue(commonPersonObjectClient.getColumnmaps(), | ||
OpdDbConstants.KEY.REGISTER_TYPE, true); | ||
|
||
if (!TextUtils.isEmpty(registerType)) { | ||
viewHolder.showRegisterType(); | ||
String type = getTranslatedRegisterType(registerType); | ||
fillValue(viewHolder.tvRegisterType, type); | ||
} else { | ||
viewHolder.hideRegisterType(); | ||
} | ||
} | ||
|
||
private String getTranslatedRegisterType(String registerType) { | ||
if (registerType.equalsIgnoreCase(CoreConstants.REGISTER_TYPE.CHILD)) { | ||
return context.getString(R.string.menu_child); | ||
} else if (registerType.equalsIgnoreCase(CoreConstants.REGISTER_TYPE.ANC)) { | ||
return context.getString(R.string.menu_anc); | ||
} else if (registerType.equalsIgnoreCase(CoreConstants.REGISTER_TYPE.PNC)) { | ||
return context.getString(R.string.menu_pnc); | ||
} else if (registerType.equalsIgnoreCase(CoreConstants.REGISTER_TYPE.FAMILY_PLANNING)) { | ||
return context.getString(R.string.menu_family_planning); | ||
} else if (registerType.equalsIgnoreCase(CoreConstants.REGISTER_TYPE.MALARIA)) { | ||
return context.getString(R.string.menu_malaria); | ||
} | ||
return registerType; | ||
} | ||
|
||
@Override | ||
public void setAddressAndGender(CommonPersonObjectClient pc, OpdRegisterViewHolder viewHolder) { | ||
super.setAddressAndGender(pc, viewHolder); | ||
String gender_key = Utils.getValue(pc.getColumnmaps(), DBConstants.KEY.GENDER, true); | ||
String gender = ""; | ||
if (gender_key.equalsIgnoreCase("Male")) { | ||
gender = context.getString(org.smartregister.chw.core.R.string.male); | ||
} else if (gender_key.equalsIgnoreCase("Female")) { | ||
gender = context.getString(org.smartregister.chw.core.R.string.female); | ||
} | ||
fillValue(viewHolder.textViewGender, gender); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
opensrp-chw-hf/src/test/java/org/smartregister/chw/hf/BaseActivityUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.smartregister.chw.hf; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
|
||
import org.junit.Assert; | ||
import org.robolectric.android.controller.ActivityController; | ||
import org.robolectric.shadows.ShadowApplication; | ||
|
||
import timber.log.Timber; | ||
|
||
public abstract class BaseActivityUnitTest extends BaseUnitTest { | ||
|
||
protected void destroyController() { | ||
try { | ||
getActivity().finish(); | ||
getActivityController().pause().stop().destroy(); //destroy controller if we can | ||
|
||
} catch (Exception e) { | ||
Timber.e(e); | ||
} | ||
System.gc(); | ||
} | ||
|
||
protected abstract Activity getActivity(); | ||
|
||
protected abstract ActivityController getActivityController(); | ||
|
||
protected void assertActivityStarted(Activity currActivity, Activity nextActivity) { | ||
Intent expectedIntent = new Intent(currActivity, nextActivity.getClass()); | ||
Intent actual = ShadowApplication.getInstance().getNextStartedActivity(); | ||
Assert.assertEquals(expectedIntent.getComponent(), actual.getComponent()); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
opensrp-chw-hf/src/test/java/org/smartregister/chw/hf/BaseUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.smartregister.chw.hf; | ||
|
||
import android.os.Build; | ||
|
||
import org.junit.runner.RunWith; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.annotation.Config; | ||
|
||
@RunWith (RobolectricTestRunner.class) | ||
@Config(application = HealthFacilityApplication.class, sdk = Build.VERSION_CODES.P) | ||
public abstract class BaseUnitTest { | ||
protected static final String DUMMY_USERNAME = "myusername"; | ||
protected static final String DUMMY_PASSWORD = "mypassword"; | ||
} |
Oops, something went wrong.