working on duty hours validation
This commit is contained in:
parent
f37fe44f2e
commit
80b0948033
@ -7,6 +7,7 @@ import android.preference.ListPreference;
|
|||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceCategory;
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
import android.preference.SwitchPreference;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -40,7 +41,7 @@ import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
|||||||
|
|
||||||
|
|
||||||
public class SharingFragment extends PreferenceFragment {
|
public class SharingFragment extends PreferenceFragment {
|
||||||
protected Preference locationSharing;
|
protected SwitchPreference locationSharing;
|
||||||
protected Preference locationMode;
|
protected Preference locationMode;
|
||||||
protected ListPreference manualLocationList;
|
protected ListPreference manualLocationList;
|
||||||
protected PreferenceCategory preferenceCategory;
|
protected PreferenceCategory preferenceCategory;
|
||||||
@ -113,7 +114,7 @@ public class SharingFragment extends PreferenceFragment {
|
|||||||
public void onCreate(final Bundle savedInstanceState) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
addPreferencesFromResource(R.layout.pref_sharing);
|
addPreferencesFromResource(R.layout.pref_sharing);
|
||||||
locationSharing = findPreference("key_sharing_enabled");
|
locationSharing = (SwitchPreference) findPreference("key_sharing_enabled");
|
||||||
locationMode = findPreference("key_location_level");
|
locationMode = findPreference("key_location_level");
|
||||||
preferenceCategory = (PreferenceCategory) findPreference("category_sharing");
|
preferenceCategory = (PreferenceCategory) findPreference("category_sharing");
|
||||||
manualLocationList = (ListPreference) findPreference("key_manual_location_value");
|
manualLocationList = (ListPreference) findPreference("key_manual_location_value");
|
||||||
|
@ -6,6 +6,7 @@ import android.support.v7.widget.LinearLayoutManager;
|
|||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Adapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@ -27,6 +28,7 @@ import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
|
|||||||
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.RestApiHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -47,10 +49,12 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
private TextView userRoom;
|
private TextView userRoom;
|
||||||
private TextView userEmail;
|
private TextView userEmail;
|
||||||
private TextView department;
|
private TextView department;
|
||||||
|
private Button addDutyButton;
|
||||||
private Button saveButon;
|
private Button saveButon;
|
||||||
|
private Boolean ifTutorTabExists = true;
|
||||||
private List<DutyHourViewModel> dutyHourList;
|
private List<DutyHourViewModel> dutyHourList;
|
||||||
private RecyclerView dutyHoursRecycller;
|
private RecyclerView dutyHoursRecycller;
|
||||||
private RecyclerView.Adapter dutyHoursAdapter;
|
private DutyHoursAdapter dutyHoursAdapter;
|
||||||
private RecyclerView.LayoutManager dutyHoursLayoutManager;
|
private RecyclerView.LayoutManager dutyHoursLayoutManager;
|
||||||
private TutorTabViewModel newTab;
|
private TutorTabViewModel newTab;
|
||||||
|
|
||||||
@ -60,19 +64,19 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.content_tutor_tab);
|
setContentView(R.layout.content_tutor_tab);
|
||||||
|
|
||||||
TextView userName = findViewById(R.id.userName);
|
userName = findViewById(R.id.userName);
|
||||||
// TextView userDutyHours = findViewById(R.id.userDutyHours);
|
// TextView userDutyHours = findViewById(R.id.userDutyHours);
|
||||||
EditText userNote = findViewById(R.id.userNote);
|
userNote = findViewById(R.id.userNote);
|
||||||
TextView userRoom = findViewById(R.id.userRoom);
|
userRoom = findViewById(R.id.userRoom);
|
||||||
TextView userEmail = findViewById(R.id.userEmail);
|
userEmail = findViewById(R.id.userEmail);
|
||||||
TextView department = findViewById(R.id.userDepartment);
|
department = findViewById(R.id.userDepartment);
|
||||||
Button saveButon = findViewById(R.id.saveButon);
|
saveButon = findViewById(R.id.saveButon);
|
||||||
|
addDutyButton = findViewById(R.id.addDuty);
|
||||||
dutyHoursRecycller = (RecyclerView) findViewById(R.id.dutyHourView);
|
dutyHoursRecycller = (RecyclerView) findViewById(R.id.dutyHourView);
|
||||||
dutyHoursLayoutManager = new LinearLayoutManager(this);
|
dutyHoursLayoutManager = new LinearLayoutManager(this);
|
||||||
dutyHoursRecycller.setLayoutManager(dutyHoursLayoutManager);
|
dutyHoursRecycller.setLayoutManager(dutyHoursLayoutManager);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tutorTabService = ApiClient.getClient(getApplicationContext())
|
tutorTabService = ApiClient.getClient(getApplicationContext())
|
||||||
.create(TutorTabApi.class);
|
.create(TutorTabApi.class);
|
||||||
userService = ApiClient.getClient(getApplicationContext())
|
userService = ApiClient.getClient(getApplicationContext())
|
||||||
@ -84,31 +88,40 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
|
.subscribeWith(new DisposableSingleObserver<TutorTabViewModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
||||||
Log.d("dupa tab", tutorTabViewModel.toString());
|
|
||||||
|
|
||||||
dutyHourList = tutorTabViewModel.getDutyHours();
|
dutyHourList = tutorTabViewModel.getDutyHours();
|
||||||
if(dutyHourList == null){
|
if(dutyHourList == null){
|
||||||
Log.d("dupa godziny","null godziny");
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
dutyHoursAdapter = new DutyHoursAdapter(getApplicationContext(),dutyHourList);
|
dutyHoursAdapter = new DutyHoursAdapter(getApplicationContext(),dutyHourList);
|
||||||
dutyHoursRecycller.setAdapter(dutyHoursAdapter);
|
dutyHoursRecycller.setAdapter(dutyHoursAdapter);
|
||||||
Log.d("dupa godziny",dutyHourList.toString());
|
addDutyButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
addEmptyDuty(dutyHoursAdapter);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
|
|
||||||
// .map(DutyHourViewModel::getSummary).toList();
|
|
||||||
|
|
||||||
userRoom.setText(String.format("%s", tutorTabViewModel.getRoom()));
|
userRoom.setText(String.format("%s", tutorTabViewModel.getRoom()));
|
||||||
userEmail.setText(String.format("%s", tutorTabViewModel.getEmailTutorTab()));
|
userEmail.setText(String.format("%s", tutorTabViewModel.getEmailTutorTab()));
|
||||||
if (!tutorTabViewModel.getNote().equals("")) {
|
if (!tutorTabViewModel.getNote().equals("")) {
|
||||||
userNote.setText(String.format("%s", tutorTabViewModel.getNote()));
|
userNote.setText(String.format("%s", tutorTabViewModel.getNote()));
|
||||||
}
|
}
|
||||||
// userDutyHours.setText(String.format("%s: %s", getString(R.string.userDutyHoursHeader), Arrays.toString(dutyHoursList.toArray())));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
|
int code = ((HttpException) e).response().code();
|
||||||
|
if( code == 404){
|
||||||
|
ifTutorTabExists = false;
|
||||||
|
dutyHoursAdapter = new DutyHoursAdapter(getApplicationContext(),new ArrayList<DutyHourViewModel>());
|
||||||
|
dutyHoursRecycller.setAdapter(dutyHoursAdapter);
|
||||||
|
addDutyButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
addEmptyDuty(dutyHoursAdapter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
showError(e);
|
showError(e);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -134,18 +147,32 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
showError(e);
|
showError(e);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
setUpSaveListener(saveButon, userNote);
|
setUpSaveListener(saveButon);
|
||||||
|
}
|
||||||
|
private void addEmptyDuty(DutyHoursAdapter adapter){
|
||||||
|
adapter.addDuty(new DutyHourViewModel());
|
||||||
|
adapter.notifyItemInserted(adapter.getItemCount());
|
||||||
|
dutyHoursRecycller.scrollToPosition(adapter.getItemCount()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpSaveListener(Button button, EditText note) {
|
private void setUpSaveListener(Button button) {
|
||||||
button.setOnClickListener(new View.OnClickListener() {
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),note.getText().toString());
|
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),
|
||||||
|
userRoom.getText().toString(),
|
||||||
|
userEmail.getText().toString(),
|
||||||
|
userNote.getText().toString(),
|
||||||
|
dutyHoursAdapter.getDutyList());
|
||||||
|
if(ifTutorTabExists){
|
||||||
putUserTab(newTab);
|
putUserTab(newTab);
|
||||||
|
}else{
|
||||||
|
postUserTab(newTab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -154,12 +181,21 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPut(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel)
|
disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPut(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(this::handleResponse, this::handleError));
|
.subscribe(this::handleResponsePut, this::handleError));
|
||||||
|
}
|
||||||
|
private void postUserTab(TutorTabViewModel tutorTabViewModel) {
|
||||||
|
disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPost(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(this::handleResponsePost, this::handleError));
|
||||||
}
|
}
|
||||||
// private void postUserTab()
|
|
||||||
|
|
||||||
private void handleResponse(TutorTabViewModel tutorTabViewModel) {
|
private void handleResponsePut(Response<Void> resp) {
|
||||||
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.modal_feedback_thankyou), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.updateToast), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void handleResponsePost(TutorTabViewModel tutorTabViewModel ) {
|
||||||
|
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.updateToast), Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,9 +222,6 @@ public class TutorTab extends AppCompatActivity {
|
|||||||
} else {
|
} else {
|
||||||
message = "Network Error!";
|
message = "Network Error!";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG)
|
|
||||||
// .show();
|
|
||||||
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,12 +3,18 @@ package com.uam.wmi.findmytutor.adapters;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
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.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.annimon.stream.Collectors;
|
||||||
|
import com.annimon.stream.Stream;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
import com.uam.wmi.findmytutor.model.DutyHour;
|
|
||||||
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -26,6 +32,21 @@ public DutyHoursAdapter(Context context, List<DutyHourViewModel> hours) {
|
|||||||
this.hours = new ArrayList<DutyHourViewModel>(hours);
|
this.hours = new ArrayList<DutyHourViewModel>(hours);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<DutyHourViewModel> getDutyList(){
|
||||||
|
ArrayList<DutyHourViewModel> notEmpty = Stream.of(hours).filter(DutyHourViewModel::isValid).collect(Collectors.toList());
|
||||||
|
return hours;
|
||||||
|
}
|
||||||
|
public void addDuty(DutyHourViewModel duty){
|
||||||
|
hours.add(duty);
|
||||||
|
}
|
||||||
|
private void removeDuty(int pos){
|
||||||
|
hours.remove(pos);
|
||||||
|
this.notifyItemRemoved(pos);
|
||||||
|
Log.d("DutyIndex af rm size",Integer.toString(getItemCount()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
@ -39,8 +60,76 @@ public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
|
|||||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||||
DutyHourViewModel duty = hours.get(position);
|
DutyHourViewModel duty = hours.get(position);
|
||||||
holder.dutyDay.setText(duty.getDay());
|
holder.dutyDay.setText(duty.getDay());
|
||||||
|
holder.dutyDay.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
duty.setDay(holder.dutyDay.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
holder.dutyStart.setText(duty.getStart());
|
holder.dutyStart.setText(duty.getStart());
|
||||||
|
holder.dutyStart.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
duty.setStart(holder.dutyStart.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
holder.dutyStop.setText(duty.getEnd());
|
holder.dutyStop.setText(duty.getEnd());
|
||||||
|
holder.dutyStop.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
duty.setEnd(holder.dutyStop.getText().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
holder.deleteRow.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
try{
|
||||||
|
Log.d("DutyIndex bf rm size",Integer.toString(getItemCount()));
|
||||||
|
Log.d("DutyIndex bf rm pos",Integer.toString(holder.getLayoutPosition()));
|
||||||
|
removeDuty(holder.getLayoutPosition());
|
||||||
|
Log.d("DutyIndex af rm pos",Integer.toString(holder.getLayoutPosition()));
|
||||||
|
|
||||||
|
|
||||||
|
}catch(Error e){
|
||||||
|
Log.e("DutyIndex error",e.getMessage());
|
||||||
|
Log.e("DutyIndex size",Integer.toString(getItemCount()));
|
||||||
|
Log.e("DutyIndex pos",Integer.toString(holder.getAdapterPosition()));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +149,9 @@ class MyViewHolder extends RecyclerView.ViewHolder {
|
|||||||
@BindView(R.id.duty_stop_value)
|
@BindView(R.id.duty_stop_value)
|
||||||
TextView dutyStop;
|
TextView dutyStop;
|
||||||
|
|
||||||
|
@BindView(R.id.deleteRow)
|
||||||
|
ImageButton deleteRow;
|
||||||
|
|
||||||
MyViewHolder(View view) {
|
MyViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
|
@ -24,6 +24,20 @@ public class DutyHourViewModel {
|
|||||||
this.day = day;
|
this.day = day;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
public Boolean isValid(){
|
||||||
|
if(this.day.isEmpty()){
|
||||||
|
return false;
|
||||||
|
}else if( !this.start.isEmpty() && this.end.isEmpty() ){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DutyHourViewModel(){
|
||||||
|
day="";
|
||||||
|
start="";
|
||||||
|
end="";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get day
|
* Get day
|
||||||
|
@ -33,11 +33,12 @@ public class TutorTabViewModel {
|
|||||||
@SerializedName("dutyHours")
|
@SerializedName("dutyHours")
|
||||||
private List<DutyHourViewModel> dutyHours = null;
|
private List<DutyHourViewModel> dutyHours = null;
|
||||||
|
|
||||||
public TutorTabViewModel(String userId, String note){
|
public TutorTabViewModel(String userId, String room, String email, String note, List<DutyHourViewModel> dutyHours){
|
||||||
this.userId=userId;
|
this.userId=userId;
|
||||||
// this.room=room;
|
this.room=room;
|
||||||
// this.emailTutorTab=emailTutorTab;
|
this.emailTutorTab=email;
|
||||||
this.note=note;
|
this.note=note;
|
||||||
|
this.dutyHours = new ArrayList<DutyHourViewModel>(dutyHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TutorTabViewModel tutorTabId(UUID tutorTabId) {
|
public TutorTabViewModel tutorTabId(UUID tutorTabId) {
|
||||||
|
@ -5,6 +5,7 @@ import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
|||||||
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
|
import retrofit2.Response;
|
||||||
import retrofit2.http.*;
|
import retrofit2.http.*;
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +41,10 @@ public interface TutorTabApi {
|
|||||||
@retrofit2.http.Path("tutorId") String tutorId
|
@retrofit2.http.Path("tutorId") String tutorId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@POST("api/users/tutorTab/{tutorId}")
|
||||||
|
Single<TutorTabViewModel> apiUsersTutorTabByTutorIdPost(
|
||||||
|
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -51,7 +56,7 @@ public interface TutorTabApi {
|
|||||||
"Content-Type:application/json"
|
"Content-Type:application/json"
|
||||||
})
|
})
|
||||||
@PUT("api/users/tutorTab/{tutorId}")
|
@PUT("api/users/tutorTab/{tutorId}")
|
||||||
Observable<TutorTabViewModel> apiUsersTutorTabByTutorIdPut(
|
Observable<Response<Void>> apiUsersTutorTabByTutorIdPut(
|
||||||
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
|
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
|
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -9,8 +16,6 @@
|
|||||||
android:paddingLeft="@dimen/activity_margin"
|
android:paddingLeft="@dimen/activity_margin"
|
||||||
android:paddingRight="@dimen/activity_margin"
|
android:paddingRight="@dimen/activity_margin"
|
||||||
android:paddingTop="@dimen/activity_margin">
|
android:paddingTop="@dimen/activity_margin">
|
||||||
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/contentTutorTabInfoImageButton"
|
android:id="@+id/contentTutorTabInfoImageButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -30,51 +35,65 @@
|
|||||||
android:textSize="@dimen/lbl_new_note_title"
|
android:textSize="@dimen/lbl_new_note_title"
|
||||||
android:textStyle="normal" />
|
android:textStyle="normal" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/personalInfoTitle"
|
android:id="@+id/personalInfoTitle"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="0dp"
|
android:paddingTop="0dp"
|
||||||
android:paddingBottom="0dp"
|
android:paddingBottom="0dp"
|
||||||
android:textColor="@color/note_list_text"
|
android:textColor="@color/mapboxRedDark"
|
||||||
android:text="@string/personalInfoTitle"/>
|
android:text="@string/personalInfoTitle"/>
|
||||||
<android.support.design.widget.TextInputLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
>
|
||||||
|
<android.support.design.widget.TextInputLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.7">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/userDepartment"
|
android:id="@+id/userDepartment"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/hint_department"
|
||||||
android:lineSpacingExtra="8sp"
|
android:lineSpacingExtra="8sp"
|
||||||
android:paddingTop="5dp"
|
android:paddingTop="5dp"
|
||||||
android:textColor="@color/note_list_text"
|
android:textColor="@color/note_list_text" />
|
||||||
android:hint="@string/hint_department"
|
|
||||||
/>
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0.3">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/userRoom"
|
android:id="@+id/userRoom"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/hint_room"
|
||||||
android:lineSpacingExtra="8sp"
|
android:lineSpacingExtra="8sp"
|
||||||
android:paddingTop="5dp"
|
android:paddingTop="5dp"
|
||||||
android:textColor="@color/note_list_text"
|
android:textColor="@color/note_list_text" />
|
||||||
android:hint="@string/hint_room"
|
|
||||||
/>
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/userEmail"
|
android:id="@+id/userEmail"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:lineSpacingExtra="8sp"
|
android:lineSpacingExtra="8sp"
|
||||||
@ -83,6 +102,8 @@
|
|||||||
android:hint="@string/hint_email"
|
android:hint="@string/hint_email"
|
||||||
/>
|
/>
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/dutyTitle"
|
android:id="@+id/dutyTitle"
|
||||||
@ -92,13 +113,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="0dp"
|
android:paddingTop="0dp"
|
||||||
android:paddingBottom="0dp"
|
android:paddingBottom="0dp"
|
||||||
android:textColor="@color/note_list_text"
|
android:textColor="@color/mapboxRedDark"
|
||||||
android:text="@string/dutyTitle"/>
|
android:text="@string/dutyTitle"/>
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/dutyHourView"
|
android:id="@+id/dutyHourView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="100dp"
|
||||||
android:scrollbars="vertical" />
|
android:scrollbars="vertical" />
|
||||||
|
|
||||||
|
|
||||||
@ -117,7 +138,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="0dp"
|
android:paddingTop="0dp"
|
||||||
android:paddingBottom="0dp"
|
android:paddingBottom="0dp"
|
||||||
android:textColor="@color/note_list_text"
|
android:textColor="@color/mapboxRedDark"
|
||||||
android:text="@string/userNoteTitle"/>
|
android:text="@string/userNoteTitle"/>
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -145,6 +166,7 @@
|
|||||||
android:text="@string/saveButton" />
|
android:text="@string/saveButton" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
@ -1,75 +1,61 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:orientation="vertical"
|
|
||||||
android:fontFamily="@font/lato_regular"
|
|
||||||
android:paddingBottom="12dp"
|
|
||||||
android:paddingLeft="8dp"
|
|
||||||
android:paddingRight="8dp"
|
|
||||||
android:paddingTop="12dp"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:id="@+id/duty_day"
|
android:id="@+id/duty_day"
|
||||||
android:layout_width="88dp"
|
android:layout_width="95dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:hint="@string/hint_duty_day">
|
android:hint="@string/hint_duty_day">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/duty_day_value"
|
android:id="@+id/duty_day_value"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignStart="@+id/duty_day"
|
android:inputType="text"
|
||||||
|
android:maxLines="1"
|
||||||
tools:text="@tools:sample/date/day_of_week" />
|
tools:text="@tools:sample/date/day_of_week" />
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:id="@+id/duty_start"
|
android:id="@+id/duty_start"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="65dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginStart="142dp"
|
|
||||||
android:hint="@string/hint_duty_start">
|
android:hint="@string/hint_duty_start">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/duty_start_value"
|
android:id="@+id/duty_start_value"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignTop="@+id/duty_start"
|
|
||||||
tools:text="@tools:sample/date/hhmm" />
|
tools:text="@tools:sample/date/hhmm" />
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<android.support.design.widget.TextInputLayout
|
||||||
android:id="@+id/duty_stop"
|
android:id="@+id/duty_stop"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="65dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginEnd="75dp"
|
|
||||||
android:hint="@string/hint_duty_end">
|
android:hint="@string/hint_duty_end">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
<android.support.design.widget.TextInputEditText
|
||||||
android:id="@+id/duty_stop_value"
|
android:id="@+id/duty_stop_value"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:inputType="text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignStart="@+id/duty_stop"
|
|
||||||
android:layout_alignTop="@+id/duty_stop"
|
|
||||||
tools:text="@tools:sample/date/hhmm" />
|
tools:text="@tools:sample/date/hhmm" />
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/deleteRow"
|
android:id="@+id/deleteRow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="41dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:scaleX="0.7"
|
android:scaleX="0.7"
|
||||||
android:scaleY="0.7"
|
android:scaleY="0.7"
|
||||||
app:srcCompat="@android:drawable/ic_delete" />
|
app:srcCompat="@android:drawable/ic_delete" />
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
@ -308,6 +308,8 @@
|
|||||||
<string name="dutyTitle">Duty hours</string>
|
<string name="dutyTitle">Duty hours</string>
|
||||||
<string name="personalInfoTitle">Personal info</string>
|
<string name="personalInfoTitle">Personal info</string>
|
||||||
<string name="userNoteTitle">Your note</string>
|
<string name="userNoteTitle">Your note</string>
|
||||||
|
<string name="updateToast">Thank you for updating your profile.</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user