mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-15 18:28:47 +00:00
commit
9a025c99ca
@ -87,10 +87,6 @@ public class List {
|
|||||||
this.uiPosition = uiPosition;
|
this.uiPosition = uiPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemEntry[] getEntries() {
|
|
||||||
return entries.toArray(new ItemEntry[entries.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addItemEntry(ItemEntry entry) {
|
public void addItemEntry(ItemEntry entry) {
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
|
|
||||||
import java.security.AccessControlException;
|
import java.security.AccessControlException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class TestListDelete {
|
public class TestListDelete {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|||||||
@ -19,10 +19,14 @@ public class PictureGetter implements CallHandler {
|
|||||||
@Override
|
@Override
|
||||||
public Object conductAction(Map<String, Object> bodyMap, HashMap<String, String> queryMap, String cognitoID) throws SQLException {
|
public Object conductAction(Map<String, Object> bodyMap, HashMap<String, String> queryMap, String cognitoID) throws SQLException {
|
||||||
PreparedStatement statement = connection.prepareStatement(GET_ITEM);
|
PreparedStatement statement = connection.prepareStatement(GET_ITEM);
|
||||||
if (!queryMap.containsKey("id") || !queryMap.get("id").toString().equals("profile")) {
|
if (!queryMap.containsKey("id")) {
|
||||||
throw new IllegalArgumentException("Only profile pictures are currently supported.");
|
throw new IllegalArgumentException("Must have id set.");
|
||||||
|
}
|
||||||
|
if (queryMap.get("id").equals("profile")) {
|
||||||
|
statement.setString(1, cognitoID);
|
||||||
|
} else {
|
||||||
|
statement.setString(1, queryMap.get("id"));
|
||||||
}
|
}
|
||||||
statement.setString(1, cognitoID);
|
|
||||||
System.out.println(statement);
|
System.out.println(statement);
|
||||||
ResultSet queryResults = statement.executeQuery();
|
ResultSet queryResults = statement.executeQuery();
|
||||||
queryResults.first();
|
queryResults.first();
|
||||||
|
|||||||
@ -28,6 +28,9 @@ public class UserGetter implements CallHandler {
|
|||||||
System.out.println(userPoolId);
|
System.out.println(userPoolId);
|
||||||
ListUsersRequest checkRequest = new ListUsersRequest().withUserPoolId(userPoolId);
|
ListUsersRequest checkRequest = new ListUsersRequest().withUserPoolId(userPoolId);
|
||||||
Object emailObject = bodyMap.get("emailToCheck");
|
Object emailObject = bodyMap.get("emailToCheck");
|
||||||
|
if (queryMap.get("id") != null && queryMap.get("id").contains("@")) {
|
||||||
|
emailObject = queryMap.get("id");
|
||||||
|
}
|
||||||
String attributeToGet = "sub";
|
String attributeToGet = "sub";
|
||||||
if (emailObject != null) {
|
if (emailObject != null) {
|
||||||
checkRequest.setFilter("email=\"" + emailObject.toString() +"\"");
|
checkRequest.setFilter("email=\"" + emailObject.toString() +"\"");
|
||||||
|
|||||||
@ -4,15 +4,12 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<compositeConfiguration>
|
|
||||||
<compositeBuild compositeDefinitionSource="SCRIPT" />
|
|
||||||
</compositeConfiguration>
|
|
||||||
<option name="delegatedBuild" value="false" />
|
<option name="delegatedBuild" value="false" />
|
||||||
<option name="testRunner" value="PLATFORM" />
|
<option name="testRunner" value="PLATFORM" />
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleHome" value="/usr/local/Cellar/gradle/6.6.1/libexec" />
|
<option name="gradleHome" value="/usr/local/Cellar/gradle/6.6.1/libexec" />
|
||||||
<option name="gradleJvm" value="9" />
|
<option name="gradleJvm" value="1.8" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
@ -20,7 +17,6 @@
|
|||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
<option name="useQualifiedModuleNames" value="true" />
|
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="9" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
package="com.example.listify">
|
package="com.example.listify">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
@ -56,6 +57,14 @@
|
|||||||
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
|
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
|
||||||
<activity android:name="com.example.listify.ListPage" />
|
<activity android:name="com.example.listify.ListPage" />
|
||||||
<activity android:name="com.example.listify.ListSharees" />
|
<activity android:name="com.example.listify.ListSharees" />
|
||||||
|
<activity android:name="com.example.listify.ConfirmShareView">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.CONFIRM_SHARE" />
|
||||||
|
|
||||||
|
<!-- <category android:name="android.intent.category.DEFAULT" />-->
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@ -9,7 +9,6 @@ import com.amplifyframework.auth.result.AuthResetPasswordResult;
|
|||||||
import com.amplifyframework.auth.result.AuthSignInResult;
|
import com.amplifyframework.auth.result.AuthSignInResult;
|
||||||
import com.amplifyframework.auth.result.AuthSignUpResult;
|
import com.amplifyframework.auth.result.AuthSignUpResult;
|
||||||
import com.amplifyframework.core.Amplify;
|
import com.amplifyframework.core.Amplify;
|
||||||
import com.example.listify.data.ListShare;
|
|
||||||
import com.example.listify.data.User;
|
import com.example.listify.data.User;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@ -63,11 +62,6 @@ public class AuthManager {
|
|||||||
|
|
||||||
public String getEmail(Requestor requestor) {
|
public String getEmail(Requestor requestor) {
|
||||||
if (email == null) {
|
if (email == null) {
|
||||||
try {
|
|
||||||
requestor.putObject(new ListShare(285, "nmerz@icloud.com", 210, -1, null));
|
|
||||||
} catch (JSONException jsonException) {
|
|
||||||
jsonException.printStackTrace();
|
|
||||||
}
|
|
||||||
SynchronousReceiver<User> userSynchronousReceiver = new SynchronousReceiver<>();
|
SynchronousReceiver<User> userSynchronousReceiver = new SynchronousReceiver<>();
|
||||||
requestor.getObject("", User.class, userSynchronousReceiver);
|
requestor.getObject("", User.class, userSynchronousReceiver);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -0,0 +1,114 @@
|
|||||||
|
package com.example.listify;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import com.example.listify.data.ListShare;
|
||||||
|
import com.example.listify.data.Picture;
|
||||||
|
import com.example.listify.data.User;
|
||||||
|
import org.json.JSONException;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import static com.example.listify.MainActivity.am;
|
||||||
|
|
||||||
|
public class ConfirmShareView extends AppCompatActivity {
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.share_confirmation);
|
||||||
|
System.out.println("Got to confirm view");
|
||||||
|
TextView shareeEmailView = findViewById(R.id.shareeEmailView);
|
||||||
|
final String shareeEmail = (String) getIntent().getSerializableExtra("shareeEmail");
|
||||||
|
final Integer listID = (Integer) getIntent().getSerializableExtra("listID");
|
||||||
|
|
||||||
|
shareeEmailView.setText(shareeEmail);
|
||||||
|
Properties configs = new Properties();
|
||||||
|
try {
|
||||||
|
configs = AuthManager.loadProperties(this, "android.resource://" + getPackageName() + "/raw/auths.json");
|
||||||
|
} catch (IOException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||||
|
SynchronousReceiver<Picture> profilePictureReceiver = new SynchronousReceiver<>();
|
||||||
|
SynchronousReceiver<User> userReceiver = new SynchronousReceiver<>();
|
||||||
|
ImageView profilePictureView = findViewById(R.id.otherProfilePicture);
|
||||||
|
try {
|
||||||
|
requestor.getObject(shareeEmail, User.class, userReceiver);
|
||||||
|
String shareeID = userReceiver.await().getCognitoID();
|
||||||
|
requestor.getObject(shareeID, Picture.class, profilePictureReceiver);
|
||||||
|
profilePictureView.setImageURI(Uri.fromFile(saveImage(profilePictureReceiver.await().getBase64EncodedImage(), "shareeProfilePicture")));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Button confirmShare = (Button) findViewById(R.id.confirmShare);
|
||||||
|
Button cancelShare = (Button) findViewById(R.id.cancelShare);
|
||||||
|
|
||||||
|
confirmShare.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
ListShare listShare = new ListShare(listID, shareeEmail, "Read, Write, Delete, Share", null);
|
||||||
|
try {
|
||||||
|
requestor.putObject(listShare);
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Intent data = new Intent();
|
||||||
|
data.putExtra("listID", listID);
|
||||||
|
data.putExtra("shareeEmail", shareeEmail);
|
||||||
|
setResult(RESULT_OK,data);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cancelShare.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//TODO: return to prior view
|
||||||
|
setResult(RESULT_CANCELED,null);
|
||||||
|
finish(); }
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//From: https://stackoverflow.com/questions/30005815/convert-encoded-base64-image-to-file-object-in-android
|
||||||
|
public File saveImage(final String imageData, String prefix) throws IOException {
|
||||||
|
final byte[] imgBytesData = android.util.Base64.decode(imageData,
|
||||||
|
android.util.Base64.DEFAULT);
|
||||||
|
|
||||||
|
final File file = File.createTempFile(prefix, null, this.getCacheDir());
|
||||||
|
final FileOutputStream fileOutputStream;
|
||||||
|
try {
|
||||||
|
fileOutputStream = new FileOutputStream(file);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(
|
||||||
|
fileOutputStream);
|
||||||
|
try {
|
||||||
|
bufferedOutputStream.write(imgBytesData);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
bufferedOutputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package com.example.listify;
|
package com.example.listify;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -29,6 +30,8 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
|
|||||||
ArrayList<ListShare> lShareeEntries = new ArrayList<>();
|
ArrayList<ListShare> lShareeEntries = new ArrayList<>();
|
||||||
ArrayList<String> lShareeEmails = new ArrayList<>();
|
ArrayList<String> lShareeEmails = new ArrayList<>();
|
||||||
|
|
||||||
|
private final int CONFIRM_REQUEST_CODE = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -55,20 +58,31 @@ public class ListSharees extends AppCompatActivity implements Requestor.Receiver
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
EditText sharedEmailText = (EditText) findViewById(R.id.editTextShareeEmail);
|
EditText sharedEmailText = (EditText) findViewById(R.id.editTextShareeEmail);
|
||||||
String sharedEmail = sharedEmailText.getText().toString();
|
String sharedEmail = sharedEmailText.getText().toString();
|
||||||
ListShare listShare = new ListShare(listID, sharedEmail, "Read, Write, Delete, Share", null);
|
Intent confirmIntent = new Intent(ListSharees.this, ConfirmShareView.class);
|
||||||
try {
|
confirmIntent.putExtra("listID", listID);
|
||||||
requestor.putObject(listShare);
|
confirmIntent.putExtra("shareeEmail", sharedEmail);
|
||||||
lShareeEntries.add(listShare);
|
startActivityForResult(confirmIntent, CONFIRM_REQUEST_CODE);
|
||||||
lShareeEmails.add(sharedEmail);
|
|
||||||
myAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == CONFIRM_REQUEST_CODE) {
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
Integer listID = data.getIntExtra("listID", -1);
|
||||||
|
String shareeEmail = data.getStringExtra("shareeEmail");
|
||||||
|
ListShare listShare = new ListShare(listID, shareeEmail, "Read, Write, Delete, Share", null);
|
||||||
|
lShareeEntries.add(listShare);
|
||||||
|
lShareeEmails.add(shareeEmail);
|
||||||
|
myAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
} else { //resultCode == RESULT_CANCELED
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void acceptDelivery(Object delivered) {
|
public void acceptDelivery(Object delivered) {
|
||||||
ListShare sharee = (ListShare) delivered;
|
ListShare sharee = (ListShare) delivered;
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
package com.example.listify;
|
package com.example.listify;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
import android.location.Location;
|
||||||
|
import android.location.LocationManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
@ -20,6 +24,7 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
@ -61,7 +66,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if(showSplash) {
|
if (showSplash) {
|
||||||
showSplash = false;
|
showSplash = false;
|
||||||
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@ -73,12 +78,39 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(am.getUserToken().equals("")) {
|
if (am.getUserToken().equals("")) {
|
||||||
am.nullify();
|
am.nullify();
|
||||||
Intent intent = new Intent(MainActivity.this, LoginPage.class);
|
Intent intent = new Intent(MainActivity.this, LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||||
|
if(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Log.d("CHECKING", "WORKS");
|
||||||
|
} else {
|
||||||
|
ActivityCompat.requestPermissions(
|
||||||
|
this,
|
||||||
|
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Location location;
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
try {
|
||||||
|
location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||||
|
break;
|
||||||
|
} catch(java.lang.SecurityException e) {
|
||||||
|
//User clicked delete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(location != null) {
|
||||||
|
double longitude = location.getLongitude();
|
||||||
|
double latitude = location.getLatitude();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------Auth Testing---------------------------------------------//
|
//------------------------------Auth Testing---------------------------------------------//
|
||||||
|
|
||||||
boolean testAuth = false;
|
boolean testAuth = false;
|
||||||
@ -184,7 +216,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
ImageView profilePictureView = navigationView.getHeaderView(0).findViewById(R.id.imageViewProfilePicture);
|
ImageView profilePictureView = navigationView.getHeaderView(0).findViewById(R.id.imageViewProfilePicture);
|
||||||
try {
|
try {
|
||||||
requestor.getObject("profile", Picture.class, profilePictureReceiver);
|
requestor.getObject("profile", Picture.class, profilePictureReceiver);
|
||||||
profilePictureView.setImageURI(Uri.fromFile(saveImage(profilePictureReceiver.await().getBase64EncodedImage())));
|
profilePictureView.setImageURI(Uri.fromFile(saveImage(profilePictureReceiver.await().getBase64EncodedImage(), "profilePicture")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -241,11 +273,11 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
}
|
}
|
||||||
|
|
||||||
//From: https://stackoverflow.com/questions/30005815/convert-encoded-base64-image-to-file-object-in-android
|
//From: https://stackoverflow.com/questions/30005815/convert-encoded-base64-image-to-file-object-in-android
|
||||||
private File saveImage(final String imageData) throws IOException {
|
public File saveImage(final String imageData, String prefix) throws IOException {
|
||||||
final byte[] imgBytesData = android.util.Base64.decode(imageData,
|
final byte[] imgBytesData = android.util.Base64.decode(imageData,
|
||||||
android.util.Base64.DEFAULT);
|
android.util.Base64.DEFAULT);
|
||||||
|
|
||||||
final File file = File.createTempFile("profilePicture", null, this.getCacheDir());
|
final File file = File.createTempFile(prefix, null, this.getCacheDir());
|
||||||
final FileOutputStream fileOutputStream;
|
final FileOutputStream fileOutputStream;
|
||||||
try {
|
try {
|
||||||
fileOutputStream = new FileOutputStream(file);
|
fileOutputStream = new FileOutputStream(file);
|
||||||
|
|||||||
@ -1,28 +1,19 @@
|
|||||||
package com.example.listify.adapter;
|
package com.example.listify.adapter;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
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.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.chauthai.swipereveallayout.SwipeRevealLayout;
|
import com.chauthai.swipereveallayout.SwipeRevealLayout;
|
||||||
import com.chauthai.swipereveallayout.ViewBinderHelper;
|
import com.chauthai.swipereveallayout.ViewBinderHelper;
|
||||||
import com.example.listify.AuthManager;
|
import com.example.listify.*;
|
||||||
import com.example.listify.ListPage;
|
|
||||||
import com.example.listify.ListSharees;
|
|
||||||
import com.example.listify.R;
|
|
||||||
import com.example.listify.Requestor;
|
|
||||||
import com.example.listify.data.List;
|
import com.example.listify.data.List;
|
||||||
import com.example.listify.data.ListShare;
|
import com.example.listify.data.ListShare;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
73
Listify/app/src/main/res/layout/share_confirmation.xml
Normal file
73
Listify/app/src/main/res/layout/share_confirmation.xml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="700dp"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="40dp"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||||
|
|
||||||
|
<TextView android:layout_width="match_parent"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:text="Please confirm sharing with the below user:"
|
||||||
|
android:textSize="30dp"
|
||||||
|
android:textColor="#FF000000"
|
||||||
|
/>
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="96dp"
|
||||||
|
android:layout_height="96dp"
|
||||||
|
android:elevation="400dp"
|
||||||
|
android:id="@+id/otherProfilePictureWrapper"
|
||||||
|
app:cardCornerRadius="48dp"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:background="#80000000">
|
||||||
|
<ImageView
|
||||||
|
android:layout_height="96dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/otherProfilePicture"
|
||||||
|
android:src="@raw/ic_launcher_round"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:background="#80000000"/>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
<TextView android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:id="@+id/shareeEmailView"
|
||||||
|
android:text="user@email.com"
|
||||||
|
android:textSize="25dp"
|
||||||
|
android:textColor="#FF000000"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
|
||||||
|
/>
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_height="250dp"
|
||||||
|
android:layout_width="match_parent" />
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_width="match_parent" >
|
||||||
|
<Button android:layout_width="150dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="left"
|
||||||
|
android:text="Cancel"
|
||||||
|
android:textSize="25dp"
|
||||||
|
android:background="#FF800000"
|
||||||
|
android:id="@+id/cancelShare"
|
||||||
|
|
||||||
|
/>
|
||||||
|
<Button android:layout_width="150dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:text="Confirm"
|
||||||
|
android:textSize="25dp"
|
||||||
|
android:background="#FF008000"
|
||||||
|
android:id="@+id/confirmShare"
|
||||||
|
/>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:layout_width="match_parent" />
|
||||||
|
</LinearLayout>
|
||||||
Loading…
Reference in New Issue
Block a user