Add modal with more comprehensive information about specific user
This commit is contained in:
parent
1e281b3ea5
commit
b87646088c
@ -1,18 +1,24 @@
|
||||
package com.uam.wmi.findmytutor.activity;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.DefaultItemAnimator;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
|
||||
@ -82,16 +88,47 @@ public class UsersListActivity extends BaseActivity {
|
||||
recyclerView, new RecyclerTouchListener.ClickListener() {
|
||||
@Override
|
||||
public void onClick(View view, final int position) {
|
||||
showNoteDialog(true, tutorsList.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongClick(View view, int position) {
|
||||
//showActionsDialog(position);
|
||||
showActionsDialog(position);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
private void showActionsDialog(final int position) {
|
||||
CharSequence colors[] = new CharSequence[]{"Edit", "Delete"};
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("Choose option");
|
||||
builder.setItems(colors, (dialog, which) -> {
|
||||
if (which == 0) {
|
||||
showNoteDialog(true, tutorsList.get(position), position);
|
||||
} else {
|
||||
//deleteNote(tutorsList.get(position).getId(), position);
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private void showNoteDialog(final boolean shouldUpdate, final User note, final int position) {
|
||||
LayoutInflater layoutInflaterAndroid = LayoutInflater.from(getApplicationContext());
|
||||
View view = layoutInflaterAndroid.inflate(R.layout.note_dialog, null);
|
||||
|
||||
AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(this);
|
||||
alertDialogBuilderUserInput.setView(view);
|
||||
|
||||
final EditText inputNote = view.findViewById(R.id.note);
|
||||
TextView dialogTitle = view.findViewById(R.id.dialog_title);
|
||||
dialogTitle.setText(note.getTitle() + note.getFirstName() + note.getDepartment());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void fetchAllTutors() {
|
||||
disposable.add(
|
||||
|
33
app/src/main/res/layout/note_dialog.xml
Normal file
33
app/src/main/res/layout/note_dialog.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?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="vertical"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
<TextView android:id="@+id/dialog_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dimen_10"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:lineSpacingExtra="8sp"
|
||||
android:text="@string/lbl_new_note_title"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="@dimen/lbl_new_note_title"
|
||||
android:textStyle="normal" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/note"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="top"
|
||||
android:hint="@string/hint_enter_note"
|
||||
android:inputType="textCapSentences|textMultiLine"
|
||||
android:lines="4"
|
||||
android:textColorHint="@color/hint_enter_note"
|
||||
android:textSize="@dimen/input_new_note" />
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user