diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java
index 7f28ea3..04988e6 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/BaseActivity.java
@@ -4,6 +4,7 @@ import android.Manifest;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
@@ -17,16 +18,26 @@ import android.support.v4.content.ContextCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.FrameLayout;
+import android.widget.ListView;
+import android.widget.TextView;
import android.widget.Toast;
+import com.annimon.stream.Stream;
import com.uam.wmi.findmytutor.R;
+import com.uam.wmi.findmytutor.model.DutyHourViewModel;
+import com.uam.wmi.findmytutor.model.TutorTabViewModel;
+import com.uam.wmi.findmytutor.model.User;
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
import com.uam.wmi.findmytutor.utils.ActiveFragment;
import com.uam.wmi.findmytutor.utils.PrefUtils;
@@ -35,6 +46,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.observers.DisposableSingleObserver;
+import io.reactivex.schedulers.Schedulers;
+
import static com.uam.wmi.findmytutor.utils.PrefUtils.storeBackgroundLocationStatus;
@@ -103,11 +118,9 @@ public abstract class BaseActivity
startActivity(i);
finish();
} else if (itemName.equals(getResources().getString(R.string.navigation_item_feedback))) {
- sendFeedback(getApplicationContext());
-
+ showNoteDialog(BaseActivity.this, R.string.email_subject_feedback);
} else if (itemName.equals(getResources().getString(R.string.navigation_item_bug))) {
-
-
+ showNoteDialog(BaseActivity.this, R.string.email_subject_bug);
}
sideDrawer.closeDrawers();
@@ -362,22 +375,68 @@ public abstract class BaseActivity
* Appends the necessary device information to email body
* useful when providing support
*/
- static public void sendFeedback(Context context) {
+ private void sendFeedback(Context context, int subject, String mode) {
+ String appVersion = null;
String body = null;
try {
- body = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
- body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
- Build.VERSION.RELEASE + "\n App Version: " + body + "\n Device Brand: " + Build.BRAND +
- "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
+ appVersion = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
+ if( mode == "full"){
+ body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
+ Build.VERSION.RELEASE + "\n App Version: " + appVersion + "\n Device Brand: " + Build.BRAND +
+ "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER + "\n Marian Kowalski!!!";
+ } else if ( mode == "anonymous"){
+ body = "\n\n-----------------------------\nPlease don't remove this information\n Device OS: Android \n Device OS version: " +
+ Build.VERSION.RELEASE + "\n App Version: " + appVersion + "\n Device Brand: " + Build.BRAND +
+ "\n Device Model: " + Build.MODEL + "\n Device Manufacturer: " + Build.MANUFACTURER;
+ }
} catch (PackageManager.NameNotFoundException e) {
}
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822");
- intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"team@findmytutor.com"});
- intent.putExtra(Intent.EXTRA_SUBJECT, "Query from android app");
+ intent.putExtra(Intent.EXTRA_EMAIL, new String[]{context.getString(R.string.fmt_email)});
+ intent.putExtra(Intent.EXTRA_SUBJECT, context.getString(subject));
intent.putExtra(Intent.EXTRA_TEXT, body);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(Intent.createChooser(intent, context.getString(R.string.choose_email_client)));
+ }
+
+ private void showNoteDialog(Context context, int subject) {
+ LayoutInflater layoutInflaterAndroid = LayoutInflater.from(BaseActivity.this);
+ //View view = layoutInflaterAndroid.inflate(R.layout.feedback_modal, null);
+ AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(BaseActivity.this);
+ //alertDialogBuilderUserInput.setView(view);
+ alertDialogBuilderUserInput.setNegativeButton(R.string.cancel, (dialog, id) -> {
+ // User cancelled the dialog
+ });
+ final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
+ alertDialog.setButton(AlertDialog.BUTTON_POSITIVE,"OK", new DialogInterface.OnClickListener() {
+
+ public void onClick(DialogInterface dialog, int which) {
+ // Write your code here to execute after dialog
+ // closed
+ Toast.makeText(getApplicationContext(),
+ "You clicked on OK", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+/* Button yes = (Button) alertDialog.findViewById(R.id.feedback_modal_yes);
+ Button no = (Button) alertDialog.findViewById(R.id.feedback_modal_no);*/
+/* yes.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View v){
+ sendFeedback(context,subject,"full");
+ }
+ });
+ no.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View v){
+ sendFeedback(context,subject,"anonymous");
+ }
+ });*/
+ alertDialog.show();
+
+
+
+
+
}
abstract int getNavigationMenuItemId();
diff --git a/app/src/main/res/layout/feedback_modal.xml b/app/src/main/res/layout/feedback_modal.xml
new file mode 100644
index 0000000..56ed62c
--- /dev/null
+++ b/app/src/main/res/layout/feedback_modal.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5bd1a8e..6de9856 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -17,6 +17,12 @@
Settings
Profile
Log out
+
+
+ Find My Tutor - feedback
+ Find My Tutor - bug report
+
+
Settings
Notes
@@ -36,6 +42,7 @@
White List
Settings
+ findmytutorwmi@gmail.com