Merge branch 'shared-settings-handle-background-task' of s416084/find-my-tutor-android into develop

This commit is contained in:
Mieszko Wrzeszczyński 2018-11-03 10:23:23 +00:00 committed by Gogs
commit d2b5fbf35d
15 changed files with 251 additions and 187 deletions

View File

@ -8,6 +8,14 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_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_COARSE_UPDATES" />
<application
android:allowBackup="true"

View File

@ -53,42 +53,45 @@ public abstract class BaseActivity
setContentView(getContentViewId());
drawerNavigationView = findViewById(R.id.nav_view);
sideDrawer = findViewById(R.id.activity_container);
drawerNavigationView.setNavigationItemSelectedListener(
new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
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);
item -> {
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) {

View File

@ -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());

View File

@ -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() {

View File

@ -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;
}
}

View File

@ -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<String> 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()

View File

@ -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<String> providers = new ArrayList<String>();
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<String> 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;

View File

@ -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);
}
}

View File

@ -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<String,?> keys = getSharedPreferences(context).getAll();
for(Map.Entry<String,?> 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) {

View File

@ -12,13 +12,12 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".activity.LoginActivity">
<!-- Login progress -->
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="180dp"
android:contentDescription="Logo find my tutor"
android:contentDescription="@string/logo_find_my_tutor"
app:srcCompat="@drawable/logo_design_black2" />
<ProgressBar
@ -48,7 +47,7 @@
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_email"
android:hint="@string/prompt_login"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
@ -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" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -1,24 +0,0 @@
<?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:orientation="horizontal"
android:padding="10dp">
<ImageView
android:id="@+id/image_view"
android:layout_width="0dp"
android:layout_height="75dp"
android:layout_weight="30"
android:contentDescription="@string/app_name" />
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="70"
android:gravity="center"
android:text=""
android:textStyle="bold" />
</LinearLayout>

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<PreferenceCategory android:title="@string/settings_category_general">

View File

@ -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">

View File

@ -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" />
<TextView
android:id="@+id/userDutyHoursTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/userDutyHoursHeader"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text"
tools:text="@string/dutyHours" />
@ -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" />
<TextView
android:id="@+id/userNote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="8sp"
android:paddingTop="5dp"
android:textColor="@color/note_list_text" />
</LinearLayout>

View File

@ -1,7 +1,7 @@
<resources>
<string name="app_name" translatable="false">FindMyTutor</string>
<string name="title_activity_login">Sign in</string>
<string name="title_activity_startup" translatable="false">StartUp Activity</string>
<string name="title_activity_startup" translatable="false">Find My Tutor</string>
<!-- Menu -->
<string name="nav_map">Map</string>
@ -26,7 +26,7 @@
<!-- Strings related to login -->
<string name="prompt_email" translatable="false">Email</string>
<string name="prompt_password">Password (optional)</string>
<string name="prompt_password">Password</string>
<string name="action_sign_in">Sign in or register</string>
<string name="action_sign_out">Sign out</string>
<string name="action_sign_in_short">Sign in</string>
@ -204,13 +204,16 @@ functionality.</string>
<string name="there_is_no_users_in_system">There is no users in system</string>
<string name="cancel">Close</string>
<string name="userRoom">Pokój</string>
<string name="userEmail">Email</string>
<string name="userNote">Notatka</string>
<string name="userDutyHoursHeader">Dyżury</string>
<string name="dutyHours">Dyżury</string>
<string name="userRoom"><b>Pokój</b></string>
<string name="userEmail"><b>Email</b></string>
<string name="userNote"><b>Notatka</b></string>
<string name="userDutyHoursHeader"><b>Dyżury</b></string>
<string name="dutyHours"> <b>Dyżury</b></string>
<string name="error_invalid_login_name">Invalid format login. Use s11111 format</string>
<string name="userDepartment">Zakład</string>
<string name="loading">Loading ...</string>
<string name="logo_find_my_tutor">Logo find my tutor</string>
<string name="prompt_login">Login (sXXXXXX)</string>
<string name="action_log_in">Log in </string>
</resources>