Skip to content

Commit ab75843

Browse files
AltmerXAltmerX
authored andcommitted
Added image view, permission management, explicit search and upload.
1 parent 9cad149 commit ab75843

19 files changed

+443
-65
lines changed

mobile-photo-gallery/Cloudi/app/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ android {
2222
}
2323

2424
dependencies {
25-
25+
implementation 'com.google.firebase:firebase-database:11.4.2'
2626
compile 'com.firebaseui:firebase-ui-auth:3.1.0'
27+
compile 'com.firebaseui:firebase-ui-database:3.1.0'
28+
compile 'com.android.support:recyclerview-v7:26.1.0'
2729
implementation fileTree(include: ['*.jar'], dir: 'libs')
2830
implementation 'com.android.support:appcompat-v7:26.1.0'
2931
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

mobile-photo-gallery/Cloudi/app/google-services.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
{
22
"project_info": {
3-
"project_number": "353129209490",
4-
"firebase_url": "https://cloudi-8e6fe.firebaseio.com",
5-
"project_id": "cloudi-8e6fe",
6-
"storage_bucket": "cloudi-8e6fe.appspot.com"
3+
"project_number": "108914645069",
4+
"firebase_url": "https://cloudi-8cbf3.firebaseio.com",
5+
"project_id": "cloudi-8cbf3",
6+
"storage_bucket": "cloudi-8cbf3.appspot.com"
77
},
88
"client": [
99
{
1010
"client_info": {
11-
"mobilesdk_app_id": "1:353129209490:android:ac1a56ed8ce5b340",
11+
"mobilesdk_app_id": "1:108914645069:android:ac1a56ed8ce5b340",
1212
"android_client_info": {
1313
"package_name": "com.cornelltech.chumengxu.cloudi"
1414
}
1515
},
1616
"oauth_client": [
1717
{
18-
"client_id": "353129209490-i9m2jr5rno5du0fjba5537lki5qfdahp.apps.googleusercontent.com",
18+
"client_id": "108914645069-chqor0ukfisaba8gh0s35n42bvagsbnn.apps.googleusercontent.com",
1919
"client_type": 1,
2020
"android_info": {
2121
"package_name": "com.cornelltech.chumengxu.cloudi",
22-
"certificate_hash": "0fbc19f8faa3b7e6269c04661b7df81ac0345497"
22+
"certificate_hash": "c154d9dd36937bc47d28521086a1c148f751ec67"
2323
}
2424
},
2525
{
26-
"client_id": "353129209490-6vu92ki58a1tvb354l1a7b1stn32i2oc.apps.googleusercontent.com",
26+
"client_id": "108914645069-tmfm2vi1u092uhaih902sm5pcgv07kjb.apps.googleusercontent.com",
2727
"client_type": 3
2828
}
2929
],
3030
"api_key": [
3131
{
32-
"current_key": "AIzaSyB6pW0kjDD2oVDQtVGJBF31oK3Vpqnq970"
32+
"current_key": "AIzaSyCzGAb0rSkCHR2HtkTmgjuaIUCzQoeRyNI"
3333
}
3434
],
3535
"services": {
@@ -40,7 +40,7 @@
4040
"status": 2,
4141
"other_platform_oauth_client": [
4242
{
43-
"client_id": "353129209490-6vu92ki58a1tvb354l1a7b1stn32i2oc.apps.googleusercontent.com",
43+
"client_id": "108914645069-tmfm2vi1u092uhaih902sm5pcgv07kjb.apps.googleusercontent.com",
4444
"client_type": 3
4545
}
4646
]

mobile-photo-gallery/Cloudi/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
<uses-permission android:name="android.permission.READ_PROFILE" />
88
<uses-permission android:name="android.permission.READ_CONTACTS" />
99
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
10-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
10+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
11+
<uses-permission android:name="android.permission.INTERNET" />
12+
1113

1214
<application
1315
android:allowBackup="true"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.cornelltech.chumengxu.cloudi;
2+
3+
/**
4+
* Created by Sabri on 12/6/2017.
5+
*/
6+
7+
public class CloudImage {
8+
private String mValue;
9+
10+
public CloudImage(){}
11+
12+
public CloudImage(String value){
13+
mValue=value;
14+
}
15+
16+
public String getValue() {
17+
return mValue;
18+
}
19+
20+
public void setValue(String value){mValue=value;}
21+
22+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.cornelltech.chumengxu.cloudi;
2+
3+
import android.support.v7.widget.RecyclerView;
4+
import android.view.View;
5+
import android.widget.ImageView;
6+
import android.widget.LinearLayout;
7+
import android.widget.TextView;
8+
9+
public class CloudImageHolder extends RecyclerView.ViewHolder {
10+
private final LinearLayout mImageContainer;
11+
private final ImageView mImageField;
12+
private final TextView mTextField;
13+
14+
public CloudImageHolder(View itemView) {
15+
super(itemView);
16+
mImageContainer = itemView.findViewById(R.id.image_container);
17+
mImageField=itemView.findViewById(R.id.cloud_img);
18+
mTextField = itemView.findViewById(R.id.description_text);
19+
}
20+
21+
public void bind(String img) {
22+
setDescription(img);
23+
setImage(R.drawable.sample_0);
24+
}
25+
26+
private void setImage(int drawable) {
27+
mImageField.setImageResource(drawable);
28+
}
29+
30+
private void setDescription(String description) {
31+
mTextField.setText(description);
32+
}
33+
34+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.cornelltech.chumengxu.cloudi;
2+
3+
import android.content.Context;
4+
import android.view.View;
5+
import android.view.ViewGroup;
6+
import android.widget.BaseAdapter;
7+
import android.widget.ImageView;
8+
9+
/**
10+
* Created by Sabri on 12/6/2017.
11+
*/
12+
13+
public class ImageAdapter extends BaseAdapter {
14+
private Context mContext;
15+
16+
public ImageAdapter(Context c) {
17+
mContext = c;
18+
}
19+
20+
public int getCount() {
21+
return mThumbIds.length;
22+
}
23+
24+
public Object getItem(int position) {
25+
return null;
26+
}
27+
28+
public long getItemId(int position) {
29+
return 0;
30+
}
31+
32+
// create a new ImageView for each item referenced by the Adapter
33+
public View getView(int position, View convertView, ViewGroup parent) {
34+
ImageView imageView;
35+
if (convertView == null) {
36+
// if it's not recycled, initialize some attributes
37+
imageView = new ImageView(mContext);
38+
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
39+
imageView.setPadding(2, 2, 2, 2);
40+
} else {
41+
imageView = (ImageView) convertView;
42+
}
43+
44+
imageView.setImageResource(mThumbIds[position]);
45+
return imageView;
46+
}
47+
48+
// references to our images
49+
private Integer[] mThumbIds = {
50+
R.drawable.sample_2, R.drawable.sample_3,
51+
R.drawable.sample_4, R.drawable.sample_5,
52+
R.drawable.sample_6, R.drawable.sample_7,
53+
R.drawable.sample_0, R.drawable.sample_1,
54+
R.drawable.sample_2, R.drawable.sample_3,
55+
R.drawable.sample_4, R.drawable.sample_5,
56+
R.drawable.sample_6, R.drawable.sample_7,
57+
R.drawable.sample_0, R.drawable.sample_1,
58+
R.drawable.sample_2, R.drawable.sample_3,
59+
R.drawable.sample_4, R.drawable.sample_5,
60+
R.drawable.sample_6, R.drawable.sample_7
61+
};
62+
}

0 commit comments

Comments
 (0)