Skip to content

Commit

Permalink
WD| Setup on Kohort Child Detail activity #4
Browse files Browse the repository at this point in the history
  • Loading branch information
baksosapi committed Nov 16, 2017
1 parent 700f72f commit 6fa6553
Show file tree
Hide file tree
Showing 7 changed files with 803 additions and 295 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.HashMap;
import java.util.Map;

import util.Utils;

import static org.smartregister.util.StringUtil.humanize;
import static org.smartregister.util.StringUtil.humanizeAndDoUPPERCASE;

Expand Down Expand Up @@ -247,7 +249,7 @@ public void onClick(View v) {
//image already in local storage most likey ):
//set profile image by passing the client id.If the image doesn't exist in the image repository then download and save locally
// DrishtiApplication.getCachedImageLoaderInstance().getImageByClientId(ancclient.getCaseId(), OpenSRPImageLoader.getStaticImageListener(kiview, R.mipmap.woman_placeholder, R.mipmap.woman_placeholder));
KANCDetailActivity.setImagetoHolderFromUri(this,
Utils.setImagetoHolderFromUri(this,
DrishtiApplication.getAppDir() + File.separator + ancclient.getDetails().get("base_entity_id") + ".JPEG",
kiview, R.mipmap.woman_placeholder);
}
Expand Down Expand Up @@ -362,15 +364,4 @@ public void onBackPressed() {
overridePendingTransition(0, 0);
}

public static void setImagetoHolderFromUri(Activity activity, String file, ImageView view, int placeholder){
view.setImageDrawable(activity.getResources().getDrawable(placeholder));
File externalFile = new File(file);
if (externalFile.exists()) {
Uri external = Uri.fromFile(externalFile);
view.setImageURI(external);
}

}


}

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions bidan-cloudant/src/main/java/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@

package util;

import android.app.Activity;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.widget.ImageView;

import org.apache.commons.lang3.text.WordUtils;

import java.io.File;

import static org.apache.commons.lang3.StringUtils.capitalize;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.replace;
Expand Down Expand Up @@ -78,4 +83,15 @@ public static boolean hasJellyBean() {
// return isBlank(value)? "" : value;
// }


public static void setImagetoHolderFromUri(Activity activity, String file, ImageView view, int placeholder){
view.setImageDrawable(activity.getResources().getDrawable(placeholder));
File externalFile = new File(file);
if (externalFile.exists()) {
Uri external = Uri.fromFile(externalFile);
view.setImageURI(external);
}

}

}
103 changes: 103 additions & 0 deletions bidan-cloudant/src/main/res/layout/child_detail_activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/client_list_header_dark_grey">

<include layout="@layout/child_detail_nav_bar"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/smart_register_client_divider_height"
android:src="@color/smart_register_client_divider_color"
android:id="@+id/imageView5" />

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="4"
android:orientation="horizontal">

<org.ei.opensrp.view.customControls.CustomFontTextView
android:layout_weight="2"
android:layout_width="0dp"

android:layout_height="match_parent"
android:text="Basic Information"
android:id="@+id/child_detail_information"
style="@style/CustomFontTextViewStyle.ListView.Medium"
android:layout_gravity="right"
android:textColor="@color/alert_urgent_red"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textStyle="bold"
android:textSize="14sp" />


<!--
<org.ei.opensrp.view.customControls.CustomFontTextView
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="Today's Date:"
android:id="@+id/detail_today"
style="@style/CustomFontTextViewStyle.ListView.Medium"
android:layout_gravity="left"
android:textColor="@color/light_blue"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:textStyle="bold"
android:textSize="14sp" />
-->
</LinearLayout>

<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/smart_register_client_divider_height"
android:src="@color/smart_register_client_divider_color"
android:id="@+id/imageView4" />

<include
layout="@layout/child_detail_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/smart_register_client_divider_height"
android:src="@color/smart_register_client_divider_color"
android:id="@+id/imageView3" />

<LinearLayout
android:id="@+id/clients_header_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/list_header_height"
android:layout_marginLeft="@dimen/list_view_margin_left_and_right"
android:layout_marginRight="@dimen/list_view_margin_left_and_right"
android:orientation="horizontal">

<org.ei.opensrp.view.customControls.CustomFontTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/elco_details_summary"
android:id="@+id/mother_summary"
style="@style/CustomFontTextViewStyle.ListView.Medium"
android:layout_gravity="center_vertical"
android:textColor="@color/text_black"
android:textStyle="bold"
android:textSize="20sp" />

</LinearLayout>

<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/smart_register_client_divider_height"
android:src="@color/smart_register_client_divider_color"/>

<include layout="@layout/child_detail_data_layout"
/>
</LinearLayout>
Loading

0 comments on commit 6fa6553

Please sign in to comment.