Can now share list in Sharee page

This commit is contained in:
Aaron Sun 2020-11-29 16:46:25 -08:00
parent 78186ffbc4
commit 5cb920f494
2 changed files with 25 additions and 1 deletions

View File

@ -45,6 +45,7 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
MyAdapter myAdapter; MyAdapter myAdapter;
Requestor requestor; Requestor requestor;
Button shareList;
Button removeSharee; Button removeSharee;
ArrayList<String> lShareeEmails = new ArrayList<>(); ArrayList<String> lShareeEmails = new ArrayList<>();
@ -68,6 +69,23 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
listView = findViewById(R.id.listOfSharees); listView = findViewById(R.id.listOfSharees);
myAdapter = new MyAdapter(this, lShareeEmails); myAdapter = new MyAdapter(this, lShareeEmails);
listView.setAdapter(myAdapter); listView.setAdapter(myAdapter);
shareList = (Button) findViewById(R.id.buttonShare);
shareList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText sharedEmailText = (EditText) findViewById(R.id.editTextShareeEmail);
String sharedEmail = sharedEmailText.getText().toString();
ListShare listShare = new ListShare(listID, sharedEmail, "Read, Write, Delete, Share", null);
try {
requestor.putObject(listShare);
}
catch(Exception e) {
e.printStackTrace();
}
}
});
} }
@Override @Override
@ -122,6 +140,12 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
} }
}); });
//No need to show owner
if(position == 0) {
shareeEmail.setVisibility(View.GONE);
removeSharee.setVisibility(View.GONE);
}
return listproduct; return listproduct;
} }
} }

View File

@ -17,7 +17,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="17" android:ems="17"
android:inputType="textPersonName" android:inputType="textPersonName"
android:hint="Sharee's email" android:hint="Share with"
android:layout_marginTop="30dp" android:layout_marginTop="30dp"
android:layout_marginLeft="10dp"/> android:layout_marginLeft="10dp"/>