Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
arman-riseuplabs committed Jul 2, 2020
1 parent 64fcb2e commit 025c7c9
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 2 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# ureport-app
UReport application based on RapidPro and offline surveyor
UReport application based on RapidPro and offline surveyor.

![Thumbnail](thumbnail.png)

![Screenshot](screenshot.png)

The whole system is based on 3 major components.
* RapidPro server
* U-Report Offline server
* The U-Report Application.

RapidPro server(s) are used to add Surveyor flows, which in turn will run on U-Report Application. U-Report Offline server process and converts flow run data from RapidPro into U-Report format. U-Report Application syncs data both U-Report Offline and RapidPro server. The application also runs the survey from RapidPro.
38 changes: 37 additions & 1 deletion app/src/main/java/io/rapidpro/surveyor/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected void onCreate(Bundle savedInstanceState) {
database = databaseConnection.getDatabase(this);
context = this;

MDetect.INSTANCE.init(getApplicationContext());
MDetect.INSTANCE.init(this);

// Animate Objects
animateObjects();
Expand Down Expand Up @@ -1038,6 +1038,42 @@ public void gotoNext() {
finish();
}

boolean lockBack = false;
@Override
public void onBackPressed() {

if(lockBack){return;}

final Dialog exitDialog = new Dialog(context);
exitDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
exitDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
exitDialog.setContentView(R.layout.v1_dialog_ui);
exitDialog.findViewById(R.id.textSubText).setVisibility(View.GONE);
((TextView) exitDialog.findViewById(R.id.textMainText)).setText("Would you like to exit the application?");
((TextView) exitDialog.findViewById(R.id.button_yes_text)).setText("Yes");
((TextView) exitDialog.findViewById(R.id.button_no_text)).setText("No");

exitDialog.findViewById(R.id.button_yes).setOnClickListener(view1 -> {
finish();
exitDialog.dismiss();
lockBack = false;
});

exitDialog.findViewById(R.id.button_no).setOnClickListener(view2 -> {
exitDialog.dismiss();
lockBack = false;
});

exitDialog.setOnDismissListener(dialogInterface -> {
lockBack = false;
});

exitDialog.show();
lockBack = true;

//super.onBackPressed();
}

/**
* This activity does not require login.
* It is required and checked by BaseActivity
Expand Down
39 changes: 39 additions & 0 deletions app/src/main/java/io/rapidpro/surveyor/activity/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AutoCompleteTextView;
Expand Down Expand Up @@ -303,4 +306,40 @@ public void onCreateAccount(View view) {
startActivity(new Intent(this, CreateAccountActivity.class));
finish();
}

boolean lockBack = false;
@Override
public void onBackPressed() {

if(lockBack){return;}

final Dialog exitDialog = new Dialog(this);
exitDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
exitDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
exitDialog.setContentView(R.layout.v1_dialog_ui);
exitDialog.findViewById(R.id.textSubText).setVisibility(View.GONE);
((TextView) exitDialog.findViewById(R.id.textMainText)).setText("Would you like to exit the application?");
((TextView) exitDialog.findViewById(R.id.button_yes_text)).setText("Yes");
((TextView) exitDialog.findViewById(R.id.button_no_text)).setText("No");

exitDialog.findViewById(R.id.button_yes).setOnClickListener(view1 -> {
finish();
exitDialog.dismiss();
lockBack = false;
});

exitDialog.findViewById(R.id.button_no).setOnClickListener(view2 -> {
exitDialog.dismiss();
lockBack = false;
});

exitDialog.setOnDismissListener(dialogInterface -> {
lockBack = false;
});

exitDialog.show();
lockBack = true;

//super.onBackPressed();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import io.rapidpro.surveyor.BuildConfig;
import io.rapidpro.surveyor.R;
import io.rapidpro.surveyor.SurveyorApplication;
import io.rapidpro.surveyor.SurveyorIntent;
import io.rapidpro.surveyor.SurveyorPreferences;
import io.rapidpro.surveyor.activity.BaseActivity;
Expand Down Expand Up @@ -553,6 +554,47 @@ public void colorChangeAnimator(int from, int to){
colorAnim.start();
}

boolean lockBack = false;
@Override
public void onBackPressed() {

if(!isLoggedIn()){
super.onBackPressed();
return;
}

if(lockBack){return;}

final Dialog exitDialog = new Dialog(context);
exitDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
exitDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
exitDialog.setContentView(R.layout.v1_dialog_ui);
exitDialog.findViewById(R.id.textSubText).setVisibility(View.GONE);
((TextView) exitDialog.findViewById(R.id.textMainText)).setText("Would you like to exit the application?");
((TextView) exitDialog.findViewById(R.id.button_yes_text)).setText("Yes");
((TextView) exitDialog.findViewById(R.id.button_no_text)).setText("No");

exitDialog.findViewById(R.id.button_yes).setOnClickListener(view1 -> {
finish();
exitDialog.dismiss();
lockBack = false;
});

exitDialog.findViewById(R.id.button_no).setOnClickListener(view2 -> {
exitDialog.dismiss();
lockBack = false;
});

exitDialog.setOnDismissListener(dialogInterface -> {
lockBack = false;
});

exitDialog.show();
lockBack = true;

//super.onBackPressed();
}

@Override
public boolean requireLogin() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.v1_activity_ureport_offline);
getWindow().setEnterTransition(null);

MDetect.INSTANCE.init(this);

isOpen = true;

ObjectAnimator.ofFloat(findViewById(R.id.headerLayout), "alpha", 0, 1f).setDuration(1000).start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.v1_activity_story);
getWindow().setEnterTransition(null);

MDetect.INSTANCE.init(this);

isOpen = true;

// Get StoryID from Previous Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public CustomAdapterPollList(Context context, List<String> data, List<String> da
this.isCategory = isCategory;
this.ColorPosition = ColorPos;
this.context = context;
MDetect.INSTANCE.init(context);
}

public CustomAdapterPollList(SurveyorApplication surveyor, Context context, List<String> data, List<String> data2, List<String> data3, boolean isCategory, int ColorPos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public CustomAdapterStories(Context context, List<StoriesLocal> stories, String
this.mInflater = LayoutInflater.from(context);
this.stories = stories;
this.lang_code = lang_code;
MDetect.INSTANCE.init(context);
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
lang_code = getSurveyor().getPreferences().getString(SurveyorPreferences.LANG_CODE, "en");
//setLang_code(lang_code);
MDetect.INSTANCE.init(getContext());


webView = getView().findViewById(R.id.webView);
Expand Down
Binary file added screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 025c7c9

Please sign in to comment.