Merge branch 'extendTutorTab' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
264f752b20
@ -1,29 +1,29 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
@ -7,6 +7,7 @@ import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -40,7 +41,7 @@ import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
|
||||
|
||||
|
||||
public class SharingFragment extends PreferenceFragment {
|
||||
protected Preference locationSharing;
|
||||
protected SwitchPreference locationSharing;
|
||||
protected Preference locationMode;
|
||||
protected ListPreference manualLocationList;
|
||||
protected PreferenceCategory preferenceCategory;
|
||||
@ -113,7 +114,7 @@ public class SharingFragment extends PreferenceFragment {
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.layout.pref_sharing);
|
||||
locationSharing = findPreference("key_sharing_enabled");
|
||||
locationSharing = (SwitchPreference) findPreference("key_sharing_enabled");
|
||||
locationMode = findPreference("key_location_level");
|
||||
preferenceCategory = (PreferenceCategory) findPreference("category_sharing");
|
||||
manualLocationList = (ListPreference) findPreference("key_manual_location_value");
|
||||
|
@ -2,16 +2,22 @@ package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Adapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
import com.uam.wmi.findmytutor.R;
|
||||
import com.uam.wmi.findmytutor.adapters.DutyHoursAdapter;
|
||||
import com.uam.wmi.findmytutor.model.DutyHour;
|
||||
import com.uam.wmi.findmytutor.model.DutyHourViewModel;
|
||||
import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
||||
import com.uam.wmi.findmytutor.model.User;
|
||||
@ -22,6 +28,7 @@ import com.uam.wmi.findmytutor.utils.InfoHelperUtils;
|
||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||
import com.uam.wmi.findmytutor.utils.RestApiHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -42,28 +49,38 @@ public class TutorTab extends AppCompatActivity {
|
||||
private TextView userRoom;
|
||||
private TextView userEmail;
|
||||
private TextView department;
|
||||
private Button addDutyButton;
|
||||
private Button saveButon;
|
||||
private Boolean ifTutorTabExists = true;
|
||||
private List<DutyHourViewModel> dutyHourList;
|
||||
private RecyclerView dutyHoursRecycller;
|
||||
private DutyHoursAdapter dutyHoursAdapter;
|
||||
private RecyclerView.LayoutManager dutyHoursLayoutManager;
|
||||
private TutorTabViewModel newTab;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.content_tutor_tab);
|
||||
|
||||
userName = findViewById(R.id.userName);
|
||||
// TextView userDutyHours = findViewById(R.id.userDutyHours);
|
||||
userNote = findViewById(R.id.userNote);
|
||||
userRoom = findViewById(R.id.userRoom);
|
||||
userEmail = findViewById(R.id.userEmail);
|
||||
department = findViewById(R.id.userDepartment);
|
||||
saveButon = findViewById(R.id.saveButon);
|
||||
addDutyButton = findViewById(R.id.addDuty);
|
||||
dutyHoursRecycller = (RecyclerView) findViewById(R.id.dutyHourView);
|
||||
dutyHoursLayoutManager = new LinearLayoutManager(this);
|
||||
dutyHoursRecycller.setLayoutManager(dutyHoursLayoutManager);
|
||||
|
||||
|
||||
tutorTabService = ApiClient.getClient(getApplicationContext())
|
||||
.create(TutorTabApi.class);
|
||||
userService = ApiClient.getClient(getApplicationContext())
|
||||
.create(UserService.class);
|
||||
setContentView(R.layout.content_tutor_tab);
|
||||
TextView userName = findViewById(R.id.userName);
|
||||
TextView userDutyHours = findViewById(R.id.userDutyHours);
|
||||
EditText userNote = findViewById(R.id.userNote);
|
||||
TextView userRoom = findViewById(R.id.userRoom);
|
||||
TextView userEmail = findViewById(R.id.userEmail);
|
||||
TextView department = findViewById(R.id.userDepartment);
|
||||
Button saveButon = findViewById(R.id.saveButon);
|
||||
findViewById(R.id.contentTutorTabInfoImageButton).setOnClickListener(v-> InfoHelperUtils.infoPopUp(v,R.layout.info_popup_tutor_tab));
|
||||
|
||||
userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
|
||||
disposable.add(
|
||||
tutorTabService.apiUsersTutorTabByTutorIdGet(PrefUtils.getUserId(getApplicationContext()))
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -72,23 +89,49 @@ public class TutorTab extends AppCompatActivity {
|
||||
@Override
|
||||
public void onSuccess(TutorTabViewModel tutorTabViewModel) {
|
||||
|
||||
List<String> dutyHoursList = Stream.of(tutorTabViewModel.getDutyHours())
|
||||
.map(DutyHourViewModel::getSummary).toList();
|
||||
|
||||
userRoom.setText(String.format("%s: %s", getString(R.string.userRoom), tutorTabViewModel.getRoom()));
|
||||
userEmail.setText(String.format("%s: %s", getString(R.string.userEmail), tutorTabViewModel.getEmailTutorTab()));
|
||||
dutyHourList = tutorTabViewModel.getDutyHours();
|
||||
if(dutyHourList == null){
|
||||
}else{
|
||||
dutyHoursAdapter = new DutyHoursAdapter(getApplicationContext(),dutyHourList);
|
||||
dutyHoursRecycller.setAdapter(dutyHoursAdapter);
|
||||
addDutyButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
addEmptyDuty(dutyHoursAdapter);
|
||||
}
|
||||
});
|
||||
}
|
||||
userRoom.setText(String.format("%s", tutorTabViewModel.getRoom()));
|
||||
userEmail.setText(String.format("%s", tutorTabViewModel.getEmailTutorTab()));
|
||||
if (!tutorTabViewModel.getNote().equals("")) {
|
||||
userNote.setText(String.format("%s", tutorTabViewModel.getNote()));
|
||||
}
|
||||
userDutyHours.setText(String.format("%s: %s", getString(R.string.userDutyHoursHeader), Arrays.toString(dutyHoursList.toArray())));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
|
||||
findViewById(R.id.contentTutorTabInfoImageButton).setOnClickListener(v-> InfoHelperUtils.infoPopUp(v,R.layout.info_popup_tutor_tab));
|
||||
|
||||
userName.setText(String.format("%s %s", PrefUtils.getUserFirstName(getApplicationContext()), PrefUtils.getUserLastName(getApplicationContext())));
|
||||
|
||||
disposable.add(
|
||||
|
||||
userService.getUserById(PrefUtils.getUserId(getApplicationContext()))
|
||||
@ -104,18 +147,32 @@ public class TutorTab extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onError(Throwable 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() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),note.getText().toString());
|
||||
putUserTab(newTab);
|
||||
newTab = new TutorTabViewModel(PrefUtils.getUserId(getApplicationContext()),
|
||||
userRoom.getText().toString(),
|
||||
userEmail.getText().toString(),
|
||||
userNote.getText().toString(),
|
||||
dutyHoursAdapter.getDutyList());
|
||||
if(ifTutorTabExists){
|
||||
putUserTab(newTab);
|
||||
}else{
|
||||
postUserTab(newTab);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -124,11 +181,21 @@ public class TutorTab extends AppCompatActivity {
|
||||
disposable.add(tutorTabService.apiUsersTutorTabByTutorIdPut(PrefUtils.getUserId(getApplicationContext()), tutorTabViewModel)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.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 handleResponse(TutorTabViewModel tutorTabViewModel) {
|
||||
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.modal_feedback_thankyou), Toast.LENGTH_SHORT).show();
|
||||
private void handleResponsePut(Response<Void> resp) {
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@ -155,9 +222,6 @@ public class TutorTab extends AppCompatActivity {
|
||||
} else {
|
||||
message = "Network Error!";
|
||||
}
|
||||
|
||||
// Snackbar.make(coordinatorLayout, message, Snackbar.LENGTH_LONG)
|
||||
// .show();
|
||||
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,163 @@
|
||||
package com.uam.wmi.findmytutor.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
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.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
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.model.DutyHourViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
|
||||
public class DutyHoursAdapter extends RecyclerView.Adapter<DutyHoursAdapter.MyViewHolder> {
|
||||
private Context context;
|
||||
private List<DutyHourViewModel> hours;
|
||||
|
||||
public DutyHoursAdapter(Context context, List<DutyHourViewModel> hours) {
|
||||
this.context = context;
|
||||
this.hours = new ArrayList<DutyHourViewModel>(hours);
|
||||
}
|
||||
|
||||
|
||||
public List<DutyHourViewModel> getDutyList(){
|
||||
ArrayList<DutyHourViewModel> notEmpty = Stream.of(hours).filter(DutyHourViewModel::isValid).collect(Collectors.toCollection(ArrayList::new));
|
||||
return notEmpty;
|
||||
}
|
||||
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
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View itemView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.duty_hour_row, parent, false);
|
||||
|
||||
return new MyViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
DutyHourViewModel duty = hours.get(position);
|
||||
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.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.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()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return hours.size();
|
||||
}
|
||||
|
||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
@BindView(R.id.duty_day_value)
|
||||
TextView dutyDay;
|
||||
|
||||
@BindView(R.id.duty_start_value)
|
||||
TextView dutyStart;
|
||||
|
||||
@BindView(R.id.duty_stop_value)
|
||||
TextView dutyStop;
|
||||
|
||||
@BindView(R.id.deleteRow)
|
||||
ImageButton deleteRow;
|
||||
|
||||
MyViewHolder(View view) {
|
||||
super(view);
|
||||
ButterKnife.bind(this, view);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -33,6 +33,9 @@ public class DutyHour extends BaseResponse {
|
||||
public DutyHour dutyHourId(UUID dutyHourId) {
|
||||
this.dutyHourId = dutyHourId;
|
||||
return this;
|
||||
}
|
||||
public DutyHour(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,6 +24,20 @@ public class DutyHourViewModel {
|
||||
this.day = day;
|
||||
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
|
||||
|
@ -33,11 +33,12 @@ public class TutorTabViewModel {
|
||||
@SerializedName("dutyHours")
|
||||
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.room=room;
|
||||
// this.emailTutorTab=emailTutorTab;
|
||||
this.room=room;
|
||||
this.emailTutorTab=email;
|
||||
this.note=note;
|
||||
this.dutyHours = new ArrayList<DutyHourViewModel>(dutyHours);
|
||||
}
|
||||
|
||||
public TutorTabViewModel tutorTabId(UUID tutorTabId) {
|
||||
|
@ -5,6 +5,7 @@ import com.uam.wmi.findmytutor.model.TutorTabViewModel;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.http.*;
|
||||
|
||||
|
||||
@ -40,6 +41,10 @@ public interface TutorTabApi {
|
||||
@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"
|
||||
})
|
||||
@PUT("api/users/tutorTab/{tutorId}")
|
||||
Observable<TutorTabViewModel> apiUsersTutorTabByTutorIdPut(
|
||||
Observable<Response<Void>> apiUsersTutorTabByTutorIdPut(
|
||||
@retrofit2.http.Path("tutorId") String tutorId, @retrofit2.http.Body TutorTabViewModel tutorTab
|
||||
);
|
||||
|
||||
|
@ -1,15 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:fontFamily="@font/lato_regular"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:fontFamily="@font/lato_regular"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
<ImageButton
|
||||
android:id="@+id/contentTutorTabInfoImageButton"
|
||||
android:layout_width="wrap_content"
|
||||
@ -17,7 +23,9 @@
|
||||
android:layout_gravity="right"
|
||||
mapbox:srcCompat="@drawable/outline_info_24"/>
|
||||
|
||||
<TextView android:id="@+id/userName"
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dimen_10"
|
||||
@ -27,62 +35,129 @@
|
||||
android:textSize="@dimen/lbl_new_note_title"
|
||||
android:textStyle="normal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userDepartment"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
/>
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/personalInfoTitle"
|
||||
android:textSize="16sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:textColor="@color/mapboxRedDark"
|
||||
android:text="@string/personalInfoTitle"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
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:id="@+id/userDepartment"
|
||||
android:maxLines="1"
|
||||
android:inputType="text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/hint_department"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.3">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/userRoom"
|
||||
android:maxLines="1"
|
||||
android:inputType="text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/hint_room"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/userEmail"
|
||||
android:maxLines="1"
|
||||
android:inputType="text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
android:hint="@string/hint_email"
|
||||
/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userRoom"
|
||||
android:id="@+id/dutyTitle"
|
||||
android:textSize="16sp"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
/>
|
||||
android:paddingTop="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:textColor="@color/mapboxRedDark"
|
||||
android:text="@string/dutyTitle"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userEmail"
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/dutyHourView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:scrollbars="vertical" />
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/addDuty"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userDutyHours"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
tools:text="@string/dutyHours" />
|
||||
android:text="@string/addDuty"
|
||||
android:layout_gravity="end"/>
|
||||
|
||||
<TextView
|
||||
android:textSize="16sp"
|
||||
android:id="@+id/userNoteTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:textColor="@color/note_list_text" />
|
||||
<EditText
|
||||
android:id="@+id/userNote"
|
||||
android:textColor="@color/mapboxRedDark"
|
||||
android:text="@string/userNoteTitle"/>
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
android:hint="@string/tutorTabHint"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLength="1000"
|
||||
android:maxLines="7"
|
||||
android:requiresFadingEdge="vertical"
|
||||
android:scrollbars="vertical"/>
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/userNote"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:paddingTop="5dp"
|
||||
android:textColor="@color/note_list_text"
|
||||
android:hint="@string/tutorTabHint"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLength="1000"
|
||||
android:maxLines="7"
|
||||
android:requiresFadingEdge="vertical"
|
||||
android:scrollbars="vertical"/>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/saveButon"
|
||||
@ -90,4 +165,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/saveButton" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
61
app/src/main/res/layout/duty_hour_row.xml
Normal file
61
app/src/main/res/layout/duty_hour_row.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/duty_day"
|
||||
android:layout_width="95dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/hint_duty_day">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/duty_day_value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
tools:text="@tools:sample/date/day_of_week" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/duty_start"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/hint_duty_start">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/duty_start_value"
|
||||
android:maxLines="1"
|
||||
android:inputType="text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:text="@tools:sample/date/hhmm" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/duty_stop"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/hint_duty_end">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/duty_stop_value"
|
||||
android:maxLines="1"
|
||||
android:inputType="text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:text="@tools:sample/date/hhmm" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/deleteRow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.7"
|
||||
app:srcCompat="@android:drawable/ic_delete" />
|
||||
</LinearLayout>
|
@ -212,6 +212,16 @@
|
||||
<string name="info_icon_userlist_tab_level_status_offline">- użytkownik jest obecnie offline</string>
|
||||
<string name="info_icon_userlist_tab_level_status_inactive">- użytkownik jest nieaktywny</string>
|
||||
<string name="info_icon_userlist_tab_level_status_inactive_tip">(nie udostępnił żadnych danych o lokalizacji od conajmniej tygodnia)</string>
|
||||
<string name="hint_duty_day">Dzień</string>
|
||||
<string name="hint_duty_start">Start</string>
|
||||
<string name="hint_duty_end">Koniec</string>
|
||||
<string name="hint_department">Zakład</string>
|
||||
<string name="hint_room">Pokój</string>
|
||||
<string name="addDuty">DODAJ DYŻUR</string>
|
||||
<string name="dutyTitle">Godziny dyżurów</string>
|
||||
<string name="personalInfoTitle">Dane kontaktowe</string>
|
||||
<string name="userNoteTitle">Twoja notka</string>
|
||||
<string name="updateToast">Dziękujemy za aktualizację profilu</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
@ -294,4 +294,24 @@
|
||||
<string name="info_icon_userlist_tab_level_status_inactive">- user is inactive </string>
|
||||
<string name="info_icon_userlist_tab_level_status_inactive_tip">(didn’t share any localization data since 7 days)</string>
|
||||
|
||||
<!--(ENG) Profile Activity strings-->
|
||||
<string name="hint_duty_day">Day</string>
|
||||
<string name="hint_duty_start">Start</string>
|
||||
<string name="hint_duty_end">End</string>
|
||||
<string name="hint_department">Department</string>
|
||||
<string name="hint_room">Room</string>
|
||||
<string name="hint_email" translatable="false">Email</string>
|
||||
<string name="addDuty">ADD DUTY</string>
|
||||
<string name="dutyTitle">Duty hours</string>
|
||||
<string name="personalInfoTitle">Personal info</string>
|
||||
<string name="userNoteTitle">Your note</string>
|
||||
<string name="updateToast">Thank you for updating your profile.</string>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user