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

Issue22 malaria profile with more than one visit #862

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f01c957
implement call and refer to facility fab
whoisladleo Aug 30, 2019
23f277d
Merge remote-tracking branch 'origin/master' into implement-call-and-…
whoisladleo Aug 30, 2019
ed6deb1
loose setup super call.
whoisladleo Aug 30, 2019
2163690
setup floating action button
whoisladleo Sep 2, 2019
e74c4e1
implement call for fab
whoisladleo Sep 2, 2019
d432854
Merge remote-tracking branch 'origin/master' into implement-call-and-…
whoisladleo Sep 2, 2019
95e6d3e
Merge remote-tracking branch 'origin/master' into implement-call-and-…
whoisladleo Sep 5, 2019
95e3c74
Merge remote-tracking branch 'origin/master' into implement-call-and-…
whoisladleo Sep 10, 2019
a30f8a1
Merge branch 'implement-call-and-refer' into issue22-malaria-profile-…
whoisladleo Sep 16, 2019
7a48983
Merge branch 'master' into issue22-malaria-profile-with-one-visit
whoisladleo Sep 20, 2019
fd5b3a9
record anc visit
whoisladleo Sep 20, 2019
afe0727
record visit not done
whoisladleo Sep 20, 2019
d32e2f7
undo visit not done
whoisladleo Sep 20, 2019
d587f55
show profile image if exists
whoisladleo Sep 23, 2019
6e6e709
Merge branch 'master' into issue22-malaria-profile-with-one-visit
whoisladleo Sep 23, 2019
524e2a1
Merge branch 'master' into issue22-malaria-profile-with-one-visit
whoisladleo Oct 7, 2019
c73fed9
implement call and refer
whoisladleo Oct 8, 2019
7c1b360
malaria profile with more than one visit
whoisladleo Oct 8, 2019
c07149d
Merge branch 'master' into issue22-malaria-profile-with-one-visit
whoisladleo Oct 8, 2019
b9ef2f2
Merge branch 'master' into implement-call-and-refer-fab
whoisladleo Oct 11, 2019
5b60097
Merge branch 'master' into implement-call-and-refer-fab
whoisladleo Oct 15, 2019
694966c
Merge branch 'master' into implement-call-and-refer-fab
whoisladleo Oct 17, 2019
0dac5da
update malariafloatingmenu with member object
Oct 29, 2019
62dccaa
Merge branch 'master' into issue22-malaria-profile-with-one-visit
Oct 31, 2019
7da5967
Merge branch 'implement-call-and-refer-fab' into issue22-malaria-prof…
Oct 31, 2019
65cc029
anc condition
Nov 1, 2019
0c13890
anc condition
Nov 1, 2019
5b1120b
Merge remote-tracking branch 'origin/issue22-malaria-profile-with-one…
Nov 1, 2019
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
@@ -0,0 +1,121 @@
package org.smartregister.chw.core.custom_views;

import android.app.Activity;
import android.content.Context;
import android.support.design.widget.FloatingActionButton;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import org.smartregister.chw.core.R;
import org.smartregister.chw.core.listener.OnClickFloatingMenu;
import org.smartregister.chw.malaria.custom_views.BaseMalariaFloatingMenu;
import org.smartregister.chw.malaria.fragment.BaseMalariaCallDialogFragment;

import static org.smartregister.chw.core.utils.Utils.redrawWithOption;

public abstract class CoreMalariaFloatingMenu extends BaseMalariaFloatingMenu {
public FloatingActionButton fab;
private Animation fabOpen;
private Animation fabClose;
private Animation rotateForward;
private Animation rotateBack;
private View callLayout;
private View referLayout;
private RelativeLayout activityMain;
private boolean isFabMenuOpen = false;
private LinearLayout menuBar;
private OnClickFloatingMenu onClickFloatingMenu;

public CoreMalariaFloatingMenu(Context context, String clientName, String clientPhone,
String clientFamilyHeadName, String clientFamilyHeadPhone) {
super(context, clientName, clientPhone, clientFamilyHeadName, clientFamilyHeadPhone);
}

public CoreMalariaFloatingMenu(Context context, AttributeSet attrs) {
super(context, attrs);
}

public void setFloatMenuClickListener(OnClickFloatingMenu onClickFloatingMenu) {
this.onClickFloatingMenu = onClickFloatingMenu;
}

@Override
protected void initUi() {
inflate(getContext(), R.layout.view_malaria_floating_menu, this);

fabOpen = AnimationUtils.loadAnimation(getContext(), R.anim.fab_open);
fabClose = AnimationUtils.loadAnimation(getContext(), R.anim.fab_close);
rotateForward = AnimationUtils.loadAnimation(getContext(), R.anim.rotate_forward);
rotateBack = AnimationUtils.loadAnimation(getContext(), R.anim.rotate_back);

activityMain = findViewById(R.id.activity_main);
menuBar = findViewById(R.id.menu_bar);

fab = findViewById(R.id.malaria_fab);
fab.setOnClickListener(this);

callLayout = findViewById(R.id.call_layout);
callLayout.setOnClickListener(this);
callLayout.setClickable(false);

referLayout = findViewById(R.id.refer_to_facility_layout);
referLayout.setOnClickListener(this);
referLayout.setClickable(false);

menuBar.setVisibility(GONE);

}

@Override
public void onClick(View view) {
onClickFloatingMenu.onClickMenu(view.getId());
}

public void animateFAB() {
if (menuBar.getVisibility() == GONE) {
menuBar.setVisibility(VISIBLE);
}

if (isFabMenuOpen) {
activityMain.setBackgroundResource(R.color.transparent);
fab.startAnimation(rotateBack);
fab.setImageResource(R.drawable.ic_edit_white);

callLayout.startAnimation(fabClose);
callLayout.setClickable(false);

referLayout.startAnimation(fabClose);
referLayout.setClickable(false);
isFabMenuOpen = false;
} else {
activityMain.setBackgroundResource(R.color.grey_tranparent_50);
fab.startAnimation(rotateForward);
fab.setImageResource(R.drawable.ic_input_add);

callLayout.startAnimation(fabOpen);
callLayout.setClickable(true);

referLayout.startAnimation(fabOpen);
referLayout.setClickable(true);
isFabMenuOpen = true;
}
}


public void launchCallWidget() {
BaseMalariaCallDialogFragment.launchDialog((Activity) this.getContext(), getClientName(),
getPhoneNumber(), getFamilyHeadName(), getFamilyHeadPhone());
}

public void redraw(boolean hasPhoneNumber) {
redrawWithOption(this, hasPhoneNumber);
}

public View getCallLayout() {
return callLayout;
}
}
125 changes: 125 additions & 0 deletions opensrp-chw-core/src/main/res/layout/view_malaria_floating_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:id="@+id/menu_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/malaria_fab"
android:layout_alignParentEnd="true"
android:layout_marginEnd="24dp"
android:orientation="vertical"
android:visibility="invisible">

<RelativeLayout
android:id="@+id/call_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="visible">

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@+id/callFab"
android:background="@color/white"
android:elevation="2dp"
android:gravity="center"
android:minWidth="50dp"
android:padding="10dp">

<TextView
android:id="@+id/CallTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:text="@string/call"
android:textColor="@android:color/black" />

<TextView
android:id="@+id/CallTextViewHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_toEndOf="@+id/CallTextView"
android:layout_toRightOf="@+id/CallTextView"
android:text="@string/call_no_number_provided"
android:textColor="@color/grey"
android:textStyle="italic"
android:visibility="gone" />

</RelativeLayout>


<android.support.design.widget.FloatingActionButton
android:id="@+id/callFab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:backgroundTint="@color/white"
app:fabSize="mini"
app:srcCompat="@drawable/floating_call" />

</RelativeLayout>

<RelativeLayout
android:id="@+id/refer_to_facility_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="visible">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="@+id/refer_to_facility_fab"
android:background="@color/white"
android:elevation="2dp"
android:gravity="center"
android:minWidth="50dp"
android:padding="10dp"
android:text="@string/refer_to_facility"
android:textColor="@android:color/black" />


<android.support.design.widget.FloatingActionButton
android:id="@+id/refer_to_facility_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:backgroundTint="@color/white"
app:fabSize="mini"
app:srcCompat="@mipmap/ic_refer" />

</RelativeLayout>

</LinearLayout>

<android.support.design.widget.FloatingActionButton
android:id="@+id/malaria_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:clickable="true"
android:tint="@android:color/white"
app:backgroundTint="@color/text_black"
app:fabSize="normal"
app:srcCompat="@drawable/ic_edit_white" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public void startFormActivity(JSONObject formJson) {
JsonFormUtils.REQUEST_CODE_GET_JSON);
}


@Override
public void initializeFloatingMenu() {
baseAncFloatingMenu = new AncFloatingMenu(this, getAncWomanName(),
Expand Down
Loading