diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c5863db..3a4122d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -8,6 +8,14 @@
+
+
+
+
+
+
+
+
{
+ String itemName = (String) item.getTitle();
+ Intent launchIntent;
+ if (itemName.equals("Whitelist")) {
+ /* launchIntent = new Intent(getApplicationContext(), WhitelistActivity.class);
+ startActivity(launchIntent);*/
+ } else if (itemName.equals("Blacklist")) {
+ /* launchIntent = new Intent(getApplicationContext(), BlacklistActivity.class);
+ startActivity(launchIntent);*/
+ } else if (itemName.equals("Profile")) {
+ /* launchIntent = new Intent(getApplicationContext(), ProfileActivity.class);
+ startActivity(launchIntent);*/
+ } else if (itemName.equals("Settings")) {
+ launchIntent = new Intent(getApplicationContext(), SettingsActivity.class);
+ startActivity(launchIntent);
- } else if (itemName.equals("Log out")) {
- PrefUtils.cleanUserLocalStorage(getApplicationContext());
- Intent i = getBaseContext().getPackageManager()
- .getLaunchIntentForPackage(getBaseContext().getPackageName());
- if (i != null) {
- i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- }
- startActivity(i);
- finish();
+ } else if (itemName.equals("Log out")) {
+ stopBackgroundLocalizationTask();
+
+ PrefUtils.cleanUserLocalStorage(getApplicationContext());
+ Intent i = getBaseContext().getPackageManager()
+ .getLaunchIntentForPackage(getBaseContext().getPackageName());
+ if (i != null) {
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
+ startActivity(i);
+ finish();
- sideDrawer.closeDrawers();
-
- return true;
}
+
+ sideDrawer.closeDrawers();
+
+ return true;
}
);
+
navigationView = findViewById(R.id.navigation);
navigationView.setOnNavigationItemSelectedListener(this);
sharingFragment = new SharingFragment();
@@ -102,6 +105,43 @@ public abstract class BaseActivity
}
+ public void stopBackgroundLocalizationTask() {
+ Intent stopIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
+ stopIntent.putExtra("request_stop", true);
+ startService(stopIntent);
+ }
+
+ public void startBackgroundLocalizationTask() {
+ if ((ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
+
+ if ((ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.ACCESS_FINE_LOCATION))) {
+
+ } else {
+ ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION
+
+ },
+ REQUEST_PERMISSIONS);
+ }
+ } else {
+
+ Intent startIntent = new Intent(getApplicationContext(), BackgroundLocalizationService.class);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ startForegroundService(startIntent);
+ } else {
+ startService(startIntent);
+ }
+ }
+ }
+
+ public void handleBackgroundTaskLifeCycle() {
+ if (PrefUtils.isEnableSharingLocalization(getApplicationContext())) {
+ startBackgroundLocalizationTask();
+ } else {
+ stopBackgroundLocalizationTask();
+ }
+ }
+
@Override
public void setContentView(int layoutResID) {
DrawerLayout fullView = (DrawerLayout) getLayoutInflater().inflate(R.layout.base_activity, null);
@@ -140,12 +180,12 @@ public abstract class BaseActivity
actionBarDrawerToggle.syncState();
- if (isTutor) {
- fn_permission();
- }
+ /* if (isTutor) {
+ startLocalizationService();
+ }*/
}
- private void fn_permission() {
+ /* public void startLocalizationService() {
if ((ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
if ((ActivityCompat.shouldShowRequestPermissionRationale(BaseActivity.this, android.Manifest.permission.ACCESS_FINE_LOCATION))) {
@@ -171,7 +211,7 @@ public abstract class BaseActivity
Toast.makeText(getApplicationContext(), "Please enable the gps", Toast.LENGTH_SHORT).show();
}
}
- }
+ }*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java
index 748c8fb..6241f50 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/LoginActivity.java
@@ -167,9 +167,10 @@ public class LoginActivity extends AppCompatActivity {
private void loginProcess(String email, String password) {
+ Log.e("LOGIN", String.valueOf(PrefUtils.getIsTutor(getApplicationContext())));
//Fake validate
- LdapUser user = new LdapUser(email, password, "admin", (isTutor) ? "Tutor" : "Student", "string", "string", email);
+ LdapUser user = new LdapUser(email, password, "admin", (PrefUtils.getIsTutor(getApplicationContext())) ? "Tutor" : "Student", "string", "string", email);
// ValidateUser user = new ValidateUser(email, password);
@@ -202,7 +203,6 @@ public class LoginActivity extends AppCompatActivity {
JWT jwt = new JWT(token);
Claim role = jwt.getClaim("nameid");
-
PrefUtils.storeIsLoggedIn(getApplicationContext(), true);
PrefUtils.storeApiKey(getApplicationContext(), token);
PrefUtils.storeUserId(getApplicationContext(), role.asString());
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java
index 6483fba..99d1a75 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java
@@ -6,14 +6,11 @@ import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.content.ContextCompat;
-import android.widget.Toast;
import android.os.Handler;
import android.util.Log;
+
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
@@ -25,7 +22,6 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.uam.wmi.findmytutor.R;
import com.uam.wmi.findmytutor.model.Coordinate;
import com.uam.wmi.findmytutor.network.ApiClient;
-import com.uam.wmi.findmytutor.network.RetrofitClientInstance;
import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
import com.uam.wmi.findmytutor.service.CoordinateService;
import com.uam.wmi.findmytutor.utils.PrefUtils;
@@ -62,8 +58,6 @@ public class MapActivity extends BaseActivity
-
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -93,6 +87,9 @@ public class MapActivity extends BaseActivity
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
+
+ //start background task
+ startBackgroundLocalizationTask();
}
@Override
@@ -239,7 +236,10 @@ public class MapActivity extends BaseActivity
mapView.onSaveInstanceState(outState);
}
- private void fn_permission() {
+
+
+ /*@Override
+ public void startLocalizationService() {
if ((ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
if ((ActivityCompat.shouldShowRequestPermissionRationale(MapActivity.this, android.Manifest.permission.ACCESS_FINE_LOCATION))) {
@@ -265,7 +265,7 @@ public class MapActivity extends BaseActivity
Toast.makeText(getApplicationContext(), "Please enable the gps", Toast.LENGTH_SHORT).show();
}
}
- }
+ }*/
@Override
protected int getContentViewId() {
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java
index 03f6f2d..e671a31 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/SharingFragment.java
@@ -1,8 +1,11 @@
package com.uam.wmi.findmytutor.activity;
import android.annotation.SuppressLint;
+import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
+import android.os.Build;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -13,44 +16,42 @@ import android.view.View;
import android.view.ViewGroup;
import com.uam.wmi.findmytutor.R;
+import com.uam.wmi.findmytutor.service.BackgroundLocalizationService;
+import com.uam.wmi.findmytutor.utils.PrefUtils;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
-//public class SharingFragment {
-//}
+import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
+
public class SharingFragment extends PreferenceFragment {
+
@SuppressLint("ResourceType")
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.layout.pref_sharing);
Preference manualStatus = findPreference("key_manual_status");
+ Preference locationSharing = findPreference("key_sharing_enabled");
+
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
ListPreference lp = (ListPreference) findPreference("key_status_value");
updateListPreference(lp, newValue, "manual_statuses");
return true;
});
- /* Preference manualLocation = findPreference("key_sharing_enabled");
- manualLocation.setOnPreferenceChangeListener((preference, newValue) -> {
- ListPreference lp = (ListPreference) findPreference("key_sharing_enabled");
- updateListPreference(lp, newValue, "sharing_enabled");
- return true;
- });*/
+ locationSharing.setOnPreferenceChangeListener((buttonView, isChecked) -> {
+ PrefUtils.storeEnableSharingLocalization(getApplicationContext(), (Boolean) isChecked);
+ ((MapActivity)getActivity()).handleBackgroundTaskLifeCycle();
- Preference sharingLocation = findPreference("key_sharing_enabled");
- sharingLocation.setOnPreferenceChangeListener((preference, o) -> {
- Log.e("change", "1");
- return false;
+ return true;
});
}
-
public static SharingFragment newInstance() {
-
return new SharingFragment();
}
@@ -58,7 +59,7 @@ public class SharingFragment extends PreferenceFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
- view.setBackgroundColor(getResources().getColor(android.R.color.white));
+ Objects.requireNonNull(view).setBackgroundColor(getResources().getColor(android.R.color.white));
return view;
}
@@ -74,10 +75,10 @@ public class SharingFragment extends PreferenceFragment {
setListPreferenceData(lp.getKey(),manualStatusArr);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putStringSet(storageKey,manualStatusSet);
- editor.commit();
+ editor.apply();
}
- protected ListPreference setListPreferenceData(String lp_name, String [] entries) {
+ protected void setListPreferenceData(String lp_name, String [] entries) {
ListPreference lp = (ListPreference) findPreference(lp_name);
lp.setEntries(entries);
CharSequence[] entryValues = new CharSequence [entries.length];
@@ -88,7 +89,5 @@ public class SharingFragment extends PreferenceFragment {
lp.setDefaultValue("1");
lp.setEntryValues(entryValues);
-
- return lp;
}
}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
index 3af23d8..ecc460a 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/UsersListFragment.java
@@ -117,7 +117,7 @@ public class UsersListFragment extends Fragment {
private void showNoteDialog(final User user) {
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getActivity().getApplicationContext());
- View view = layoutInflaterAndroid.inflate(R.layout.note_dialog, null);
+ View view = layoutInflaterAndroid.inflate(R.layout.user_list_modal, null);
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(getActivity());
alertDialogBuilderUserInput.setView(view);
@@ -128,6 +128,7 @@ public class UsersListFragment extends Fragment {
TextView userName = view.findViewById(R.id.userName);
ListView userDutyHours = view.findViewById(R.id.userDutyHours);
+ TextView userDutyHoursTitle = view.findViewById(R.id.userDutyHoursTitle);
TextView userNote = view.findViewById(R.id.userNote);
TextView userRoom = view.findViewById(R.id.userRoom);
TextView userEmail = view.findViewById(R.id.userEmail);
@@ -150,9 +151,10 @@ public class UsersListFragment extends Fragment {
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
userNote.setText(String.format("%s: %s", getString(R.string.userNote), tutorTabViewModel.getNote()));
department.setText(String.format("%s: %s", getString(R.string.userDepartment), user.getDepartment()));
+ userDutyHoursTitle.setText(String.format("%s:", getString(R.string.userDutyHoursHeader)));
final ArrayAdapter arrayAdapter = new ArrayAdapter<>(getActivity(),
- android.R.layout.simple_list_item_activated_1, dutyHoursList);
+ android.R.layout.test_list_item, dutyHoursList);
userDutyHours.setAdapter(arrayAdapter);
alertDialog.show();
@@ -165,6 +167,7 @@ public class UsersListFragment extends Fragment {
}));
}
+
private void fetchAllTutors() {
disposable.add(
userService.apiUsersGet()
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java
index af7e14e..2412286 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/service/BackgroundLocalizationService.java
@@ -6,21 +6,23 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
+import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
+import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
+import android.os.HandlerThread;
import android.os.IBinder;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
-import android.content.Context;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import com.uam.wmi.findmytutor.model.Coordinate;
@@ -28,16 +30,8 @@ import com.uam.wmi.findmytutor.network.ApiClient;
import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RestApiHelper;
-import org.json.JSONObject;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.lang.reflect.Array;
-import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@@ -48,64 +42,22 @@ import timber.log.Timber;
public class BackgroundLocalizationService extends Service {
- public static String str_receiver = "background.location.broadcast";
private static final String TAG = "MyLocationService";
- private LocationManager mLocationManager = null;
private static final int LOCATION_INTERVAL = 1000;
- private static final float LOCATION_DISTANCE = 10f;
+ private static final float LOCATION_DISTANCE = 5f;
+ public static String str_receiver = "background.location.broadcast";
private static long notify_interval = 10000;
- private Handler mHandler = new Handler();
-
Location mLastLocation;
- Intent intent;
ArrayList providers = new ArrayList();
- LocationListener[] mLocationListeners ;
+ LocationListener[] mLocationListeners;
- private class LocationListener implements android.location.LocationListener {
+ private LocationManager mLocationManager = null;
+ private Handler mHandler = new Handler();
+ private HandlerThread mHandlerThread = null;
+ private Runnable mStatusChecker;
- public LocationListener(String provider) {
- Log.e(TAG, "LocationListener " + provider);
- mLastLocation = new Location(provider);
- }
-
- @Override
- public void onLocationChanged(Location location) {
- Log.e(TAG, "onLocationChanged: " + location);
- mLastLocation.set(location);
- fn_update(mLastLocation);
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- Log.e(TAG, "onProviderDisabled: " + provider);
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- Log.e(TAG, "onProviderEnabled: " + provider);
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- Log.e(TAG, "onStatusChanged: " + provider);
- }
- }
-
- @Override
- public IBinder onBind(Intent arg0) {
- return null;
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- Log.e(TAG, "onStartCommand");
- super.onStartCommand(intent, flags, startId);
-
- return START_STICKY;
- }
-
- public BackgroundLocalizationService(){
+ public BackgroundLocalizationService() {
providers.add(LocationManager.GPS_PROVIDER);
providers.add(LocationManager.NETWORK_PROVIDER);
providers.add(LocationManager.PASSIVE_PROVIDER);
@@ -117,10 +69,36 @@ public class BackgroundLocalizationService extends Service {
};
}
+ @Override
+ public IBinder onBind(Intent arg0) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ Log.e(TAG, "onStartCommand");
+ super.onStartCommand(intent, flags, startId);
+
+ //call startForeground first
+ boolean stopService = false;
+
+ if (intent != null) {
+ stopService = intent.getBooleanExtra("request_stop", false);
+ }
+ if (stopService) {
+ stopForeground(true);
+ stopSelf();
+ return START_STICKY;
+ }
+
+ return START_STICKY;
+ }
+
@Override
public void onCreate() {
Log.e(TAG, "onCreate");
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
startMyOwnForeground();
else {
@@ -141,6 +119,7 @@ public class BackgroundLocalizationService extends Service {
LOCATION_DISTANCE,
listener
);
+
} catch (java.lang.SecurityException ex) {
Log.i(TAG, "fail to request location update, ignore", ex);
} catch (IllegalArgumentException ex) {
@@ -150,11 +129,15 @@ public class BackgroundLocalizationService extends Service {
providerIndex++;
}
- Timer mTimer = new Timer();
- mTimer.schedule(new TimerTaskToGetLocation(), 5, notify_interval);
- intent = new Intent(str_receiver);
+ mStatusChecker = () -> {
+ try {
+ fn_getlocation();
+ } finally {
+ mHandler.postDelayed(mStatusChecker, notify_interval);
+ }
+ };
- fn_getlocation();
+ AsyncTask.execute(mStatusChecker);
}
@RequiresApi(api = Build.VERSION_CODES.O)
@@ -178,7 +161,6 @@ public class BackgroundLocalizationService extends Service {
startForeground(2, notification);
}
-
private void fn_getlocation() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
@@ -194,14 +176,17 @@ public class BackgroundLocalizationService extends Service {
List providers1 = mLocationManager.getProviders(true);
Location bestLocation = null;
+
for (String provider : providers1) {
Location location = mLocationManager.getLastKnownLocation(provider);
+
if (location == null) {
continue;
}
if (bestLocation == null || location.getAccuracy() < bestLocation.getAccuracy()) {
bestLocation = location;
}
+
}
Log.e("Best localization:", String.valueOf(bestLocation));
@@ -210,13 +195,6 @@ public class BackgroundLocalizationService extends Service {
fn_update(bestLocation);
}
- private class TimerTaskToGetLocation extends TimerTask {
- @Override
- public void run() {
- mHandler.post(BackgroundLocalizationService.this::fn_getlocation);
- }
- }
-
private void fn_update(Location location) {
new Task(location).execute();
}
@@ -226,6 +204,9 @@ public class BackgroundLocalizationService extends Service {
Log.e(TAG, "onDestroy");
super.onDestroy();
+ mHandler.removeCallbacks(mStatusChecker);
+
+
if (mLocationManager != null) {
for (LocationListener listener : mLocationListeners) {
try {
@@ -233,6 +214,8 @@ public class BackgroundLocalizationService extends Service {
return;
}
mLocationManager.removeUpdates(listener);
+ Log.i(TAG, "Removed");
+
} catch (Exception ex) {
Log.i(TAG, "fail to remove location listener, ignore", ex);
}
@@ -248,6 +231,35 @@ public class BackgroundLocalizationService extends Service {
}
}
+ private class LocationListener implements android.location.LocationListener {
+
+ public LocationListener(String provider) {
+ Log.e(TAG, "LocationListener " + provider);
+ mLastLocation = new Location(provider);
+ }
+
+ @Override
+ public void onLocationChanged(Location location) {
+ Log.e(TAG, "onLocationChanged: " + location);
+ mLastLocation.set(location);
+ }
+
+ @Override
+ public void onProviderDisabled(String provider) {
+ Log.e(TAG, "onProviderDisabled: " + provider);
+ }
+
+ @Override
+ public void onProviderEnabled(String provider) {
+ Log.e(TAG, "onProviderEnabled: " + provider);
+ }
+
+ @Override
+ public void onStatusChanged(String provider, int status, Bundle extras) {
+ Log.e(TAG, "onStatusChanged: " + provider);
+ }
+ }
+
private class Task extends AsyncTask {
private Double latitude;
private Double longitude;
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java
index 96a4d62..ad8c94d 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/MyDividerItemDecoration.java
@@ -61,7 +61,7 @@ public class MyDividerItemDecoration extends RecyclerView.ItemDecoration {
.getLayoutParams();
final int top = child.getBottom() + params.bottomMargin;
final int bottom = top + mDivider.getIntrinsicHeight();
- mDivider.setBounds(left + dpToPx(margin), top, right - dpToPx(margin), bottom);
+ mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
diff --git a/app/src/main/java/com/uam/wmi/findmytutor/utils/PrefUtils.java b/app/src/main/java/com/uam/wmi/findmytutor/utils/PrefUtils.java
index 93c9065..07eb7a8 100644
--- a/app/src/main/java/com/uam/wmi/findmytutor/utils/PrefUtils.java
+++ b/app/src/main/java/com/uam/wmi/findmytutor/utils/PrefUtils.java
@@ -7,15 +7,26 @@ import android.util.Log;
import com.auth0.android.jwt.Claim;
import com.auth0.android.jwt.JWT;
+import java.util.Map;
+
public class PrefUtils {
public PrefUtils() {
}
- private static SharedPreferences getSharedPreferences(Context context) {
+ public static SharedPreferences getSharedPreferences(Context context) {
return context.getSharedPreferences("APP_PREF", Context.MODE_PRIVATE);
}
+
+ public static void getAllKeys(Context context){
+ Map keys = getSharedPreferences(context).getAll();
+
+ for(Map.Entry entry : keys.entrySet()){
+ Log.d("map values",entry.getKey() + ": " + entry.getValue().toString());
+ }
+ }
+
public static void cleanUserLocalStorage(Context context) {
SharedPreferences preferences = getSharedPreferences(context);
SharedPreferences.Editor editor = preferences.edit();
@@ -67,14 +78,14 @@ public class PrefUtils {
return getSharedPreferences(context).getBoolean("IS_LOGGED_IN", false);
}
- public static void storeIsServiceRunning(Context context, Boolean flag) {
- SharedPreferences.Editor editor = getSharedPreferences(context).edit();
- editor.putBoolean("IS_SERVIS_RUNNING", flag);
- editor.apply();
+ public static boolean isEnableSharingLocalization(Context context) {
+ return getSharedPreferences(context).getBoolean("IS_ENABLE_SHARING_LOCALIZATION", false);
}
- public static boolean getIsServiceRunning(Context context) {
- return getSharedPreferences(context).getBoolean("IS_SERVIS_RUNNING", false);
+ public static void storeEnableSharingLocalization(Context context,Boolean isChecked) {
+ SharedPreferences.Editor editor = getSharedPreferences(context).edit();
+ editor.putBoolean("IS_ENABLE_SHARING_LOCALIZATION", isChecked);
+ editor.apply();
}
public static void storeUserFirstName(Context context, String userName) {
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index a3d5a78..0c0e1fe 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -12,13 +12,12 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".activity.LoginActivity">
-
@@ -85,11 +84,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
- android:text="@string/action_sign_in"
+ android:text="@string/action_log_in"
android:textStyle="bold" />
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_listview.xml b/app/src/main/res/layout/item_listview.xml
deleted file mode 100644
index 6a9a4d1..0000000
--- a/app/src/main/res/layout/item_listview.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/pref_main.xml b/app/src/main/res/layout/pref_main.xml
index 0c13e23..fdc9b61 100644
--- a/app/src/main/res/layout/pref_main.xml
+++ b/app/src/main/res/layout/pref_main.xml
@@ -1,5 +1,7 @@
-
+
diff --git a/app/src/main/res/layout/tutor_list_row.xml b/app/src/main/res/layout/tutor_list_row.xml
index d31fb60..fdfa124 100644
--- a/app/src/main/res/layout/tutor_list_row.xml
+++ b/app/src/main/res/layout/tutor_list_row.xml
@@ -4,9 +4,9 @@
android:layout_height="90dp"
android:clickable="true"
android:focusable="true"
- android:paddingLeft="@dimen/activity_margin"
+ android:paddingLeft="10dp"
android:paddingTop="@dimen/dimen_10"
- android:paddingRight="@dimen/activity_margin"
+ android:paddingRight="10dp"
android:paddingBottom="@dimen/dimen_10">
diff --git a/app/src/main/res/layout/note_dialog.xml b/app/src/main/res/layout/user_list_modal.xml
similarity index 77%
rename from app/src/main/res/layout/note_dialog.xml
rename to app/src/main/res/layout/user_list_modal.xml
index f46f130..8355b19 100644
--- a/app/src/main/res/layout/note_dialog.xml
+++ b/app/src/main/res/layout/user_list_modal.xml
@@ -15,7 +15,7 @@
android:fontFamily="sans-serif-medium"
android:lineSpacingExtra="8sp"
android:text="@string/lbl_new_note_title"
- android:textColor="@color/note_list_text"
+ android:textColor="@color/colorAccent"
android:textSize="@dimen/lbl_new_note_title"
android:textStyle="normal" />
@@ -23,6 +23,8 @@
android:id="@+id/userDepartment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:lineSpacingExtra="8sp"
+ android:paddingTop="5dp"
android:textColor="@color/note_list_text"
/>
@@ -30,6 +32,8 @@
android:id="@+id/userRoom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:lineSpacingExtra="8sp"
+ android:paddingTop="5dp"
android:textColor="@color/note_list_text"
/>
@@ -37,13 +41,16 @@
android:id="@+id/userEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:lineSpacingExtra="8sp"
+ android:paddingTop="5dp"
android:textColor="@color/note_list_text" />
@@ -51,12 +58,17 @@
android:id="@+id/userDutyHours"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textColor="@color/note_list_text" />
+ android:paddingTop="0dp"
+ android:paddingBottom="0dp"
+ android:paddingStart="@dimen/activity_margin"
+ android:textColor="@color/colorAccent" />
\ 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 9b4f74b..992d181 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,7 +1,7 @@
FindMyTutor
Sign in
- StartUp Activity
+ Find My Tutor
Map
@@ -26,7 +26,7 @@
Email
- Password (optional)
+ Password
Sign in or register
Sign out
Sign in
@@ -204,13 +204,16 @@ functionality.
There is no users in system
Close
- Pokój
- Email
- Notatka
- Dyżury
- Dyżury
+ Pokój
+ Email
+ Notatka
+ Dyżury
+ Dyżury
Invalid format login. Use s11111 format
Zakład
Loading ...
+ Logo find my tutor
+ Login (sXXXXXX)
+ Log in