Merge branch 'sendFeedbackAndBugToDrawer' of s416084/find-my-tutor-android into develop

This commit is contained in:
Marcin Jedyński 2018-11-21 07:49:44 +00:00 committed by Gogs
commit be6a487a92
16 changed files with 482 additions and 74 deletions

View File

@ -31,6 +31,7 @@ repositories {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1' implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1' implementation 'com.android.support:support-v4:27.1.1'

View File

@ -10,7 +10,6 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" /> <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
@ -45,17 +44,15 @@
android:label="@string/title_activity_login" android:label="@string/title_activity_login"
android:launchMode="singleTask" android:launchMode="singleTask"
android:noHistory="true" /> android:noHistory="true" />
<activity <activity
android:name=".activity.SettingsActivity" android:name=".activity.SettingsActivity"
android:label="@string/title_activity_settings" /> android:label="@string/title_activity_settings" />
<service <service
android:name=".service.BackgroundLocalizationService" android:name=".service.BackgroundLocalizationService"
android:exported="false"
android:launchMode="singleTop"
android:enabled="true" android:enabled="true"
/> android:exported="false"
android:launchMode="singleTop" />
</application> </application>

View File

@ -2,6 +2,7 @@ package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -9,16 +10,26 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment; import android.preference.PreferenceFragment;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import com.uam.wmi.findmytutor.R; import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.model.Feedback;
import com.uam.wmi.findmytutor.network.ApiClient;
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService; import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
import com.uam.wmi.findmytutor.service.FeedbackService;
import com.uam.wmi.findmytutor.service.PredefinedStatusesService;
import com.uam.wmi.findmytutor.utils.PrefUtils; import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RestApiHelper;
import com.uam.wmi.findmytutor.utils.RightButtonPreference;
import com.uam.wmi.findmytutor.utils.SharingLevel; import com.uam.wmi.findmytutor.utils.SharingLevel;
import java.util.Arrays; import java.util.Arrays;
@ -29,58 +40,145 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.observers.DisposableSingleObserver;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;
import retrofit2.Response;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext; import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class SharingFragment extends PreferenceFragment { public class SharingFragment extends PreferenceFragment {
private HashMap<Integer, String> locationLevelMapping; private HashMap<Integer, String> locationLevelMapping;
// private HashMap<Integer, String> statusMapping; private HashMap<Integer, String> statusMapping;
private PredefinedStatusesService statusesService;
private CompositeDisposable disposable;
protected Preference locationSharing;
protected Preference locationMode;
protected Preference manualLocationList;
protected PreferenceCategory preferenceCategory;
protected RightButtonPreference manualLocationButton;
protected Preference manualStatus;
protected ListPreference statusList;
void getStatuses(CompositeDisposable disposable){
disposable.add(statusesService.getUserPredefinedStatuses(PrefUtils.getUserId(getApplicationContext()))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableSingleObserver<List<String>>() {
@Override
public void onSuccess(List<String> strings) {
setListPreferenceData(statusList.getKey(),strings.toArray(new String[strings.size()]));
}
@Override
public void onError(Throwable e) {
Toast.makeText(getApplicationContext(), "Error handling status fetch", Toast.LENGTH_SHORT).show();
}
}));
}
@SuppressLint("ResourceType") @SuppressLint("ResourceType")
@Override @Override
public void onCreate(final Bundle savedInstanceState) { public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
locationLevelMapping = new HashMap<Integer, String>(); addPreferencesFromResource(R.layout.pref_sharing);
locationSharing = findPreference("key_sharing_enabled");
locationMode = findPreference("key_location_level");
preferenceCategory = (PreferenceCategory) findPreference("category_sharing");
manualLocationList = findPreference("key_manual_location_value");
manualLocationButton = (RightButtonPreference) findPreference("manual_location_button");
manualStatus = findPreference("key_manual_status");
statusList =(ListPreference) findPreference("key_status_value");
statusesService = ApiClient.getClient(getApplicationContext()).create(PredefinedStatusesService.class);
disposable = new CompositeDisposable();
getStatuses(disposable);
locationLevelMapping = new HashMap<Integer, String>();
locationLevelMapping.put(0, SharingLevel.PRESENCE.toString()); locationLevelMapping.put(0, SharingLevel.PRESENCE.toString());
locationLevelMapping.put(1, SharingLevel.APPROXIMATED.toString()); locationLevelMapping.put(1, SharingLevel.APPROXIMATED.toString());
locationLevelMapping.put(2, SharingLevel.EXACT.toString()); locationLevelMapping.put(2, SharingLevel.EXACT.toString());
locationLevelMapping.put(3, SharingLevel.MANUAL.toString()); locationLevelMapping.put(3, SharingLevel.MANUAL.toString());
addPreferencesFromResource(R.layout.pref_sharing); statusMapping = new HashMap<Integer, String>();
Preference manualStatus = findPreference("key_manual_status"); statusMapping.put(0,"available");
Preference locationSharing = findPreference("key_sharing_enabled"); statusMapping.put(1,"consultation");
Preference locationMode = findPreference("key_location_level"); statusMapping.put(2,"busy");
Preference statusList = findPreference("key_status_value");
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
ListPreference lp = (ListPreference) findPreference("key_status_value");
updateListPreference(lp, newValue, "manual_statuses");
PrefUtils.storeStatus(getApplicationContext(),(String) newValue);
/** Main sharing switch**/
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
((MapActivity)getActivity()).handleBackgroundTaskLifeCycle();
return true; return true;
}); });
/** Sharing level list **/
locationMode.setOnPreferenceChangeListener((preference, newValue) -> { locationMode.setOnPreferenceChangeListener((preference, newValue) -> {
PrefUtils.storeLocationMode(getApplicationContext(),locationLevelMapping.get(Integer.parseInt((String) newValue))); PrefUtils.storeLocationMode(getApplicationContext(),locationLevelMapping.get(Integer.parseInt((String) newValue)));
if(PrefUtils.getLocationLevel(getApplicationContext()) == "manual"){
preferenceCategory.addPreference(manualLocationList);
preferenceCategory.addPreference(manualLocationButton);
}else{
preferenceCategory.removePreference(manualLocationList);
preferenceCategory.removePreference(manualLocationButton);
}
return true; return true;
}); });
/** Manual location category hiding when location level is != manual **/
if(!PrefUtils.getLocationLevel(getApplicationContext()).equals("manual")){
preferenceCategory.removePreference(manualLocationList);
preferenceCategory.removePreference(manualLocationButton);
}
/** Custom manual location list change listener **/
manualLocationList.setOnPreferenceChangeListener((preference, newValue) -> {
ListPreference lp = (ListPreference) preference;
//ToDo handle manual location change
return true;
});
/** Button 'choose from map' button listener **/
manualLocationButton.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
//ToDO wywołanie wybierania lokalizacji z mapy
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.hide(SharingFragment.this);
fragmentTransaction.commit();
return true;
}
});
/** Status list change listener **/
statusList.setOnPreferenceChangeListener((preference, newValue) -> { statusList.setOnPreferenceChangeListener((preference, newValue) -> {
ListPreference lp = (ListPreference) preference; ListPreference lp = (ListPreference) preference;
CharSequence [] entries = lp.getEntries(); CharSequence [] entries = lp.getEntries();
PrefUtils.storeStatus(getApplicationContext(),(String) entries[Integer.parseInt((String) newValue)]); PrefUtils.storeStatus(getApplicationContext(),(String) entries[Integer.parseInt((String) newValue)]);
// PrefUtils.storeStatus(getApplicationContext(),statusMapping.get(Integer.parseInt((String) newValue)));
return true;
});
/** Custom status list change listener **/
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
// ListPreference lp = (ListPreference) findPreference("key_status_value");
// updateListPreference(lp, newValue, "manual_statuses");
// PrefUtils.storeStatus(getApplicationContext(),(String) newValue);
// statusList.setValue((String) newValue);
disposable.add(statusesService.postUserPredefinedStatus(PrefUtils.getUserId(getApplicationContext()),(String) newValue)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponse, this::handleError));
return true; return true;
}); });
locationSharing.setOnPreferenceChangeListener((buttonView, newValue) -> {
PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) newValue);
((MapActivity)getActivity()).handleBackgroundTaskLifeCycle();
return true;
});
} }
public static SharingFragment newInstance() { public static SharingFragment newInstance() {
@ -109,8 +207,9 @@ public class SharingFragment extends PreferenceFragment {
Set <String> manualStatusSet = sharedPref.getStringSet(storageKey,defaultEntries); Set <String> manualStatusSet = sharedPref.getStringSet(storageKey,defaultEntries);
manualStatusSet.add((String) newValue); manualStatusSet.add((String) newValue);
String [] manualStatusArr = manualStatusSet.toArray(new String[0]); String [] manualStatusArr = manualStatusSet.toArray(new String[0]);
Arrays.sort(manualStatusArr); //Arrays.sort(manualStatusArr);
setListPreferenceData(lp.getKey(),manualStatusArr); setListPreferenceData(lp.getKey(),manualStatusArr);
// lp.setValue((String) newValue);
SharedPreferences.Editor editor = sharedPref.edit(); SharedPreferences.Editor editor = sharedPref.edit();
editor.putStringSet(storageKey,manualStatusSet); editor.putStringSet(storageKey,manualStatusSet);
@ -118,6 +217,7 @@ public class SharingFragment extends PreferenceFragment {
} }
protected void setListPreferenceData(String lp_name, String [] entries) { protected void setListPreferenceData(String lp_name, String [] entries) {
//todo bug z pustym statusem
ListPreference lp = (ListPreference) findPreference(lp_name); ListPreference lp = (ListPreference) findPreference(lp_name);
lp.setEntries(entries); lp.setEntries(entries);
CharSequence[] entryValues = new CharSequence [entries.length]; CharSequence[] entryValues = new CharSequence [entries.length];
@ -129,4 +229,27 @@ public class SharingFragment extends PreferenceFragment {
lp.setDefaultValue("1"); lp.setDefaultValue("1");
lp.setEntryValues(entryValues); lp.setEntryValues(entryValues);
} }
private void handleResponse(List<String> resp) {
getStatuses(disposable);
String newStatus = resp.toArray(new String[resp.size()])[resp.size()-1];
// Toast.makeText(getApplicationContext(), newStatus, Toast.LENGTH_SHORT).show();
statusList.setValue(Integer.toString(resp.size()-1));
statusList.setSummary(newStatus);
}
private void handleError(Throwable error) {
if (error instanceof HttpException) {
ResponseBody responseBody = ((HttpException) error).response().errorBody();
Toast.makeText(getApplicationContext(),
RestApiHelper.getErrorMessage(responseBody), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(),
"Network error " + error.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("FEEDBACK",error.getMessage());
}
}
} }

View File

@ -0,0 +1,187 @@
package com.uam.wmi.findmytutor.model;
import java.util.UUID;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class PredefinedCoordViewModel {
@SerializedName("predefinedCoordinateId")
@Expose
private UUID predefinedCoordinateId;
/**
*
* (Required)
*
*/
@SerializedName("latitude")
@Expose
private Double latitude;
/**
*
* (Required)
*
*/
@SerializedName("longitude")
@Expose
private Double longitude;
/**
*
* (Required)
*
*/
@SerializedName("altitude")
@Expose
private Double altitude;
/**
*
* (Required)
*
*/
@SerializedName("userId")
@Expose
private String userId;
@SerializedName("approximatedLocation")
@Expose
private String approximatedLocation;
@SerializedName("displayMode")
@Expose
private String displayMode = "predefined";
@SerializedName("label")
@Expose
private String label;
/**
* No args constructor for use in serialization
*
*/
public PredefinedCoordViewModel() {
}
/**
*
* @param altitude
* @param userId
* @param displayMode
* @param label
* @param longitude
* @param latitude
* @param approximatedLocation
* @param predefinedCoordinateId
*/
public PredefinedCoordViewModel(UUID predefinedCoordinateId, Double latitude, Double longitude, Double altitude, String userId, String approximatedLocation, String displayMode, String label) {
super();
this.predefinedCoordinateId = predefinedCoordinateId;
this.latitude = latitude;
this.longitude = longitude;
this.altitude = altitude;
this.userId = userId;
this.approximatedLocation = approximatedLocation;
this.displayMode = displayMode;
this.label = label;
}
public UUID getPredefinedCoordinateId() {
return predefinedCoordinateId;
}
public void setPredefinedCoordinateId(UUID predefinedCoordinateId) {
this.predefinedCoordinateId = predefinedCoordinateId;
}
/**
*
* (Required)
*
*/
public Double getLatitude() {
return latitude;
}
/**
*
* (Required)
*
*/
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
/**
*
* (Required)
*
*/
public Double getLongitude() {
return longitude;
}
/**
*
* (Required)
*
*/
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
/**
*
* (Required)
*
*/
public Double getAltitude() {
return altitude;
}
/**
*
* (Required)
*
*/
public void setAltitude(Double altitude) {
this.altitude = altitude;
}
/**
*
* (Required)
*
*/
public String getUserId() {
return userId;
}
/**
*
* (Required)
*
*/
public void setUserId(String userId) {
this.userId = userId;
}
public String getApproximatedLocation() {
return approximatedLocation;
}
public void setApproximatedLocation(String approximatedLocation) {
this.approximatedLocation = approximatedLocation;
}
public String getDisplayMode() {
return displayMode;
}
public void setDisplayMode(String displayMode) {
this.displayMode = displayMode;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

View File

@ -321,7 +321,7 @@ public class BackgroundLocalizationService extends Service {
longitude, longitude,
altitude, altitude,
approximatedBuildingPart, approximatedBuildingPart,
PrefUtils.getUserStatus(getApplicationContext()), (PrefUtils.isStatusEnabled(getApplicationContext())) ? PrefUtils.getUserStatus(getApplicationContext()) : "",
PrefUtils.getUserId(getApplicationContext()), PrefUtils.getUserId(getApplicationContext()),
PrefUtils.getLocationLevel(getApplicationContext()) PrefUtils.getLocationLevel(getApplicationContext())
); );

View File

@ -0,0 +1,29 @@
package com.uam.wmi.findmytutor.service;
import com.uam.wmi.findmytutor.model.PredefinedCoordViewModel;
import java.util.List;
import io.reactivex.Single;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
public interface PredefinedStatusesService {
@GET("api/users/predefined/status/{tutorId}")
Single<List<String>> getUserPredefinedStatuses(@Path("tutorId") String tutorId);
@POST("api/users/predefined/status/{tutorId}")
Single<List<String>> postUserPredefinedStatus(@Path("tutorId") String tutorId, @Body String status);
@DELETE("api/users/predefined/status/{tutorId}")
Single<List<String>> deleteUserPredefinedStatus(@Path("tutorId") String tutorId, @Body String status);
@GET("api/users/predefined/coordinate/{tutorId}")
Single<List<PredefinedCoordViewModel>> getUserPredefinedCoords(@Path("tutorId") String tutorId);
@POST("api/users/predefined/coordinate/{tutorId}")
Single<List<PredefinedCoordViewModel>> postUserPredefinedCoord(@Path("tutorId") String tutorId, @Body PredefinedCoordViewModel coord);
@DELETE("api/users/predefined/coordinate/{tutorId}")
Single<List<PredefinedCoordViewModel>> deleteUserPredefinedCoord(@Path("tutorId") String tutorId, @Body PredefinedCoordViewModel coord);
}

View File

@ -38,7 +38,7 @@ public class FeedbackUtils {
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activityContext); LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activityContext);
View view = layoutInflaterAndroid.inflate(R.layout.feedback_modal, null); View view = layoutInflaterAndroid.inflate(R.layout.feedback_modal, null);
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activityContext); AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activityContext);
alertDialogBuilderUserInput.setView(view).setPositiveButton("SEND",null); alertDialogBuilderUserInput.setView(view).setPositiveButton(activityContext.getString(R.string.modal_feedback_send),null);
final AlertDialog alertDialog = alertDialogBuilderUserInput.create(); final AlertDialog alertDialog = alertDialogBuilderUserInput.create();
EditText modalUserInput = view.findViewById(R.id.feedback_input); EditText modalUserInput = view.findViewById(R.id.feedback_input);
@ -46,11 +46,10 @@ public class FeedbackUtils {
TextView modalTitle = view.findViewById(R.id.feedback_modal_title); TextView modalTitle = view.findViewById(R.id.feedback_modal_title);
TextView modalSubtitle = view.findViewById(R.id.feedback_modal_subtitle); TextView modalSubtitle = view.findViewById(R.id.feedback_modal_subtitle);
modalTitle.setText(subject); modalTitle.setText(subject);
if( subject == "BUG REPORT"){ if( subject.equals(activityContext.getString(R.string.title_bug_report)) ){
modalSubtitle.setText("Tell us what you noticed!(max 1000 characters)"); modalSubtitle.setText(activityContext.getString(R.string.title_bug_report_notice));
} else if (subject == "FEEDBACK") } else {
{ modalSubtitle.setText(activityContext.getString(R.string.title_feedback_report_notice));
modalSubtitle.setText("Tell us what you think!(max 1000 characters)");
} }
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override @Override
@ -61,7 +60,7 @@ public class FeedbackUtils {
public void onClick(View view) { public void onClick(View view) {
String body = modalUserInput.getText().toString(); String body = modalUserInput.getText().toString();
if(TextUtils.isEmpty(body)){ if(TextUtils.isEmpty(body)){
Toast.makeText(activityContext, "Please describe your insights.", Toast.LENGTH_SHORT).show(); Toast.makeText(activityContext, activityContext.getString(R.string.modal_feedback_hint), Toast.LENGTH_SHORT).show();
modalUserInput.requestFocus(); modalUserInput.requestFocus();
}else{ }else{
boolean mode = modalIsAnonymous.isChecked(); boolean mode = modalIsAnonymous.isChecked();
@ -103,7 +102,7 @@ public class FeedbackUtils {
.subscribe(this::handleResponse, this::handleError)); .subscribe(this::handleResponse, this::handleError));
} }
private void handleResponse(Response<Void> resp) { private void handleResponse(Response<Void> resp) {
Toast.makeText(activityContext, "Thank you for subbmiting your feedback", Toast.LENGTH_SHORT).show(); Toast.makeText(activityContext, activityContext.getString(R.string.modal_feedback_thankyou), Toast.LENGTH_SHORT).show();
} }
private void handleError(Throwable error) { private void handleError(Throwable error) {

View File

@ -54,6 +54,10 @@ public class PrefUtils {
return getSharedPreferences(context).getString("USER_ID", null); return getSharedPreferences(context).getString("USER_ID", null);
} }
public static boolean isStatusEnabled(Context context){
return getSharedPreferences(context).getBoolean("key_status_enabled",false);
}
public static String getUserStatus(Context context) { public static String getUserStatus(Context context) {
return getSharedPreferences(context).getString("status_entry", "Available"); return getSharedPreferences(context).getString("status_entry", "Available");
} }

View File

@ -0,0 +1,40 @@
package com.uam.wmi.findmytutor.utils;
import android.content.Context;
import android.preference.Preference;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.uam.wmi.findmytutor.R;
public class RightButtonPreference extends Preference {
public RightButtonPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setWidgetLayoutResource(R.layout.preference_button_widget);
}
@Override
protected View onCreateView(ViewGroup parent) {
View view = super.onCreateView(parent);
// LayoutInflater li = (LayoutInflater)getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
// View temp =li.inflate( R.layout.preference_button_widget, parent, false);
return view;
}
@Override
protected void onBindView(View view)
{
super.onBindView(view);
Button button = (Button)view.findViewById(R.id.button_choose_from_map);
if(button != null)
{
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
callChangeListener(null);
notifyChanged();
}
});
}
}
}

View File

@ -4,7 +4,7 @@ public enum SharingLevel {
PRESENCE("presence"), PRESENCE("presence"),
APPROXIMATED("approximated"), APPROXIMATED("approximated"),
EXACT("exact"), EXACT("exact"),
MANUAL("manuak"); MANUAL("manual");
private final String text; private final String text;

View File

@ -63,6 +63,5 @@
android:layout_alignEnd="@+id/feedback_input" android:layout_alignEnd="@+id/feedback_input"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginBottom="-50dp" android:layout_marginBottom="-50dp"
android:text="Tell us what you think (max 1000 characters)"
android:textSize="14sp" /> android:textSize="14sp" />
</RelativeLayout> </RelativeLayout>

View File

@ -6,7 +6,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<PreferenceCategory android:title="@string/settings_category_location"> <PreferenceCategory
android:title="@string/settings_category_location"
android:key="category_sharing">
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:disableDependentsState="false" android:disableDependentsState="false"
@ -17,10 +19,20 @@
android:defaultValue="1" android:defaultValue="1"
android:dialogTitle="@string/settings_location_level" android:dialogTitle="@string/settings_location_level"
android:entries="@array/location_level_entries" android:entries="@array/location_level_entries"
android:entryValues="@array/location_levels_values" android:entryValues="@array/location_level_values"
android:key="@string/key_location_level" android:key="@string/key_location_level"
android:summary="%s" android:summary="%s"
android:title="@string/title_location_level" /> android:title="@string/title_location_level" />
<ListPreference
android:defaultValue="1"
android:key="key_manual_location_value"
android:entries="@array/manual_location_entries"
android:entryValues="@array/manual_location_values"
android:summary="%s"
android:title="@string/title_list_manual_location" />
<com.uam.wmi.findmytutor.utils.RightButtonPreference
android:key="manual_location_button"
/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_status"> <PreferenceCategory android:title="@string/settings_category_status">
@ -32,7 +44,7 @@
android:title="@string/status_switch_title"/> android:title="@string/status_switch_title"/>
<ListPreference <ListPreference
android:defaultValue="1" android:defaultValue="1"
android:key="key_status_value" android:key="@string/key_status_value"
android:entries="@array/status_entries" android:entries="@array/status_entries"
android:entryValues="@array/status_values" android:entryValues="@array/status_values"
android:summary="%s" android:summary="%s"
@ -45,26 +57,6 @@
/> />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/settings_category_manuallocation">
<SwitchPreference
android:defaultValue="false"
android:disableDependentsState="false"
android:key="key_manual_location_enabled"
android:persistent="true"
android:title="@string/manual_location"/>
<ListPreference
android:defaultValue="1"
android:key="key_manual_location_value"
android:entries="@array/manual_location_entries"
android:entryValues="@array/manual_location_values"
android:summary="%s"
android:title="@string/title_list_manual_location" />
<EditTextPreference
android:key="key_manual_location_custom"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/title_manual_location"
/>
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@ -0,0 +1,13 @@
<?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:gravity="right"
>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/button_choose_from_map"
android:text="@string/preference_manual_location_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>

View File

@ -14,7 +14,7 @@
<string name="location_level_presence">Obecność</string> <string name="location_level_presence">Obecność</string>
<string name="location_level_approximated">Przybliżona</string> <string name="location_level_approximated">Przybliżona</string>
<string name="location_level_precise">Dokładna</string> <string name="location_level_precise">Dokładna</string>
<string name="settings_location_level">Sczegółowość udostępniania</string> <string name="settings_location_level">Poziom udostępniania</string>
<string name="key_location_level">key_location_level</string> <string name="key_location_level">key_location_level</string>
<string name="settings_description">Opis</string> <string name="settings_description">Opis</string>
<string name="key_description">key_description</string> <string name="key_description">key_description</string>
@ -116,7 +116,7 @@
<string name="userDutyHoursHeader"><b>Dyżury</b></string> <string name="userDutyHoursHeader"><b>Dyżury</b></string>
<string name="dutyHours"> <b>Dyżury</b></string> <string name="dutyHours"> <b>Dyżury</b></string>
<string name="userDepartment">Zakład</string> <string name="userDepartment">Zakład</string>
<string name="loading">Loading</string> <string name="loading">Ładowanie</string>
<string name="logo_find_my_tutor">Logo find my tutor</string> <string name="logo_find_my_tutor">Logo find my tutor</string>
<string name="prompt_login">Login (Ldap)</string> <string name="prompt_login">Login (Ldap)</string>
<string name="action_log_in">Zaloguj!</string> <string name="action_log_in">Zaloguj!</string>
@ -130,6 +130,20 @@
<string name="navigation_item_feedback">Wyślij nam feedback</string> <string name="navigation_item_feedback">Wyślij nam feedback</string>
<string name="navigation_item_bug">Zgłoś błąd</string> <string name="navigation_item_bug">Zgłoś błąd</string>
<string name="fab_title_bound_area">Bounds OFF</string> <string name="fab_title_bound_area">Bounds OFF</string>
<string name="email_subject_feedback">Find My Tutor - feedback</string>
<string name="email_subject_bug">Find My Tutor - zgłoszenie błędu</string>
<string name="modal_feedback_hint">Proszę opisz swoje spostrzeżnia.</string>
<string name="modal_feedback_question">Wyślij anonimowo</string>
<string name="location_level_manual">Manualna</string>
<string name="preference_manual_location_button">Wybierz z mapy</string>
<string name="permission_denied_explanation">Odmowa dostępu</string>
<string name="permission_rationale">Uprawnienia powinny zostać przyznane.</string>
<string name="title_feedback_report_notice">Powiedz nam co myślisz!(max 1000 znaków)</string>
<string name="title_bug_report_notice">Powiedz nam co zauważyłeś!(max 1000 znaków)</string>
<string name="title_bug_report">ZGŁOŚ BUG</string>
<string name="title_feedback_report">FEEDBACK</string>
<string name="modal_feedback_send">WYŚLIJ</string>
<string name="modal_feedback_thankyou">Dziękujemy za przesłanie feedbacku.</string>
</resources> </resources>

View File

@ -44,11 +44,14 @@
<item>@string/location_level_presence</item> <item>@string/location_level_presence</item>
<item>@string/location_level_approximated</item> <item>@string/location_level_approximated</item>
<item>@string/location_level_precise</item> <item>@string/location_level_precise</item>
<item>@string/location_level_manual</item>
</string-array> </string-array>
<string-array name="location_levels_values"> <string-array name="location_level_values">
<item>0</item> <item>0</item>
<item>1</item> <item>1</item>
<item>2</item> <item>2</item>
<item>3</item>
</string-array> </string-array>
<string-array name="status_entries"> <string-array name="status_entries">
<item>@string/description_available</item> <item>@string/description_available</item>

View File

@ -23,7 +23,12 @@
<string name="email_subject_bug">Find My Tutor - bug report</string> <string name="email_subject_bug">Find My Tutor - bug report</string>
<string name="modal_feedback_hint">Please input your feedback.</string> <string name="modal_feedback_hint">Please input your feedback.</string>
<string name="modal_feedback_question">Send anonymously</string> <string name="modal_feedback_question">Send anonymously</string>
<string name="title_feedback_report_notice">Tell us what you think!(max 1000 characters)</string>
<string name="title_bug_report_notice">Tell us what you noticed!(max 1000 characters)</string>
<string name="title_bug_report">BUG REPORT</string>
<string name="title_feedback_report">FEEDBACK</string>
<string name="modal_feedback_send">SEND</string>
<string name="modal_feedback_thankyou">Thank you for subbmiting your feedback</string>
<!-- Tutors list --> <!-- Tutors list -->
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
@ -44,8 +49,7 @@
<string name="action_white_list">White List</string> <string name="action_white_list">White List</string>
<string name="title_activity_settings">Settings</string> <string name="title_activity_settings">Settings</string>
<string name="fmt_email">findmytutorwmi@gmail.com</string> <string name="fmt_email" translatable="false">findmytutorwmi@gmail.com</string>
<!-- Strings related to SharingActivity --> <!-- Strings related to SharingActivity -->
@ -56,7 +60,6 @@
<!-- Strings related to settings --> <!-- Strings related to settings -->
<string name="title_sharing">Sharing</string> <string name="title_sharing">Sharing</string>
<string name="settings_category_location">Location sharing</string> <string name="settings_category_location">Location sharing</string>
<string name="settings_category_status">Status settings</string> <string name="settings_category_status">Status settings</string>
<string name="settings_category_manuallocation">Manual location override</string> <string name="settings_category_manuallocation">Manual location override</string>
@ -64,10 +67,13 @@
<string name="location_level_presence">Only presence</string> <string name="location_level_presence">Only presence</string>
<string name="location_level_approximated">Approximated</string> <string name="location_level_approximated">Approximated</string>
<string name="location_level_precise">Exact</string> <string name="location_level_precise">Exact</string>
<string name="location_level_manual">Manual</string>
<string name="preference_manual_location_button">Choose from map</string>
<string name="settings_location_level">Location level</string> <string name="settings_location_level">Location level</string>
<string name="key_location_level">key_location_level</string> <string name="key_location_level">key_location_level</string>
<string name="status_list_title">Choose status</string> <string name="status_list_title">Choose status</string>
<string name="key_status_value">key_status_value</string>
<string name="status_switch_title">Status</string> <string name="status_switch_title">Status</string>
<string name="description_busy">Busy</string> <string name="description_busy">Busy</string>
<string name="description_available">Available</string> <string name="description_available">Available</string>
@ -75,7 +81,6 @@
<string name="title_manual_status">Add custom status</string> <string name="title_manual_status">Add custom status</string>
<string name="settings_description">Descrition</string> <string name="settings_description">Descrition</string>
<string name="key_description">key_description</string> <string name="key_description">key_description</string>
@ -176,7 +181,7 @@
<item quantity="other">%d locations reported</item> <item quantity="other">%d locations reported</item>
</plurals> </plurals>
<string name="title_activity_main2">Main2Activity</string> <string name="title_activity_main2" translatable="false">Main2Activity</string>
<!--PulsingLayerOpacityColorActivity activity--> <!--PulsingLayerOpacityColorActivity activity-->
<string name="fab_title_hotels">TODO</string> <string name="fab_title_hotels">TODO</string>
@ -200,12 +205,14 @@
<string name="action_log_in">Log in </string> <string name="action_log_in">Log in </string>
<string name="user_list_nav">Users list</string> <string name="user_list_nav">Users list</string>
<string name="error_invalid_login_name">Invalid login format.</string> <string name="error_invalid_login_name">Invalid login format.</string>
<string name="title_locale_utils">Locale utils</string> <string name="title_locale_utils" translatable="false">Locale utils</string>
<string name="permission_denied_explanation">Permission denied</string> <string name="permission_denied_explanation">Permission denied</string>
<string name="permission_rationale">permission should be granted</string> <string name="permission_rationale" translatable="false">permission should be granted</string>
<string name="launch_activity" /> <string name="launch_activity" translatable="false" />
<string name="remove_location_updates" /> <string name="remove_location_updates" translatable="false" />
<string name="map_activity_label">MapActivity</string> <string name="map_activity_label" translatable="false">MapActivity</string>
<string name="nav_profile">User profile</string>
<string name="remove_manual_location">Remove Manual location</string> <string name="remove_manual_location">Remove Manual location</string>
</resources> </resources>