Skip to content

Commit

Permalink
Merge pull request #25 from OpenSRP/266-app-crash-on-multiple-button-…
Browse files Browse the repository at this point in the history
…clicks

App crash on multiple button clicks bug fix
  • Loading branch information
vincent-karuri authored Apr 12, 2018
2 parents cd290b3 + 9884fc2 commit 1c16669
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.0.4
VERSION_NAME=1.0.7-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Growth Monitoring Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.DatePicker;
Expand Down Expand Up @@ -249,7 +250,16 @@ public void onStart() {
new Handler().post(new Runnable() {
@Override
public void run() {
getDialog().getWindow().setLayout(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
Window window = null;
if (getDialog() != null) {
window = getDialog().getWindow();
}

if (window == null) {
return;
}

window.setLayout(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);

}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ protected void onResume() {
recordWeight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
view.setEnabled(false);
SampleUtil.showWeightDialog(MainActivity.this, view, DIALOG_TAG);
view.setEnabled(true);
}
});

Expand All @@ -74,7 +76,9 @@ public void onClick(View view) {
growthChartButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
Utils.startAsyncTask(new ShowGrowthChartTask(), null);
v.setEnabled(true);
}
});

Expand Down Expand Up @@ -200,7 +204,9 @@ private void refreshEditWeightLayout() {

@Override
public void onClick(View v) {
v.setEnabled(false);
SampleUtil.showEditWeightDialog(MainActivity.this, finalI, DIALOG_TAG);
v.setEnabled(true);
}
};
listeners.add(onclicklistener);
Expand Down

0 comments on commit 1c16669

Please sign in to comment.