Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:26.1.0"
implementation "com.android.support:design:27.1.0"
implementation "com.google.firebase:firebase-auth:$rootProject.firebaseVersion"
implementation "com.google.firebase:firebase-database:$rootProject.firebaseVersion"
implementation "com.google.firebase:firebase-messaging:$rootProject.firebaseVersion"
implementation "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation "junit:junit:$rootProject.junitVersion"

implementation 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'

androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'


implementation "com.android.support:appcompat-v7:$rootProject.supportLibVersion"
implementation "com.android.support:cardview-v7:$rootProject.supportLibVersion"
implementation "com.android.support:design:$rootProject.supportLibVersion"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.developervishalsehgal.udacityscholarsapp.ui.avatars;

import android.content.DialogInterface;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.developervishalsehgal.udacityscholarsapp.R;


public class avatar_selection extends AppCompatActivity implements View.OnClickListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_avatar_selection);

}

@Override
public void onClick(View view) {

final Intent intent = new Intent(this,com.developervishalsehgal.udacityscholarsapp.ui.profile.UserProfileActivity.class);

int id = view.getId();
if (id == R.id.pic1) {

new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("profile_path",R.drawable.avatar_1);
startActivity(intent);
}
})
.show();

} else if (id == R.id.pic2) {
new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("profile_path",R.drawable.avatar_2);
startActivity(intent);
}
})
.show();

} else if (id == R.id.pic3) {

new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("profile_path",R.drawable.avatar_3);
startActivity(intent);
}
})
.show();

} else if (id == R.id.pic4) {

new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("profile_path",R.drawable.avatar_4);
startActivity(intent);
}
})
.show();

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.developervishalsehgal.udacityscholarsapp.ui.coverimage;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.developervishalsehgal.udacityscholarsapp.R;

public class cover_picture_selection extends AppCompatActivity implements View.OnClickListener{

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cover_picture_selection);
}

@Override
public void onClick(View view) {

final Intent intent = new Intent(this,com.developervishalsehgal.udacityscholarsapp.ui.profile.UserProfileActivity.class);

int id = view.getId();
if (id == R.id.pic1) {

new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("cover_path",R.drawable.avatar_1);
startActivity(intent);
}
})
.show();

} else if (id == R.id.pic2) {
new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("cover_path",R.drawable.avatar_2);
startActivity(intent);
}
})
.show();

} else if (id == R.id.pic3) {

new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("cover_path",R.drawable.avatar_3);
startActivity(intent);
}
})
.show();

} else if (id == R.id.pic4) {

new MaterialDialog.Builder(this)
.title("Are you sure?")
.content("Selected image would be chosen as your new profile picture")
.positiveText("YES")
.negativeText("NO")
.onPositive(new MaterialDialog.SingleButtonCallback() {

@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
intent.putExtra("cover_path",R.drawable.avatar_4);
startActivity(intent);
}
})
.show();

}
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
package com.developervishalsehgal.udacityscholarsapp.ui.profile;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.Spinner;

import com.developervishalsehgal.udacityscholarsapp.R;


/**
* Profile activity for the app.
*/
public class UserProfileActivity extends AppCompatActivity implements ProfileContract.View {
public class UserProfileActivity extends AppCompatActivity implements ProfileContract.View, View.OnClickListener {

private ImageView profile_picture;
private ImageView cover_picture;
private Spinner track;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_profile);

profile_picture = findViewById(R.id.profile_picture);
cover_picture = findViewById(R.id.header_cover_image);
track = findViewById(R.id.spinner);

Intent sourceIntent = getIntent();

if (sourceIntent != null) {
Bundle params = sourceIntent.getExtras();

if (params != null ) {
if (params.containsKey("profile_path")) {
profile_picture.setImageResource(params.getInt("profile_path"));
}
if (params.containsKey("cover_path")) {
profile_picture.setImageResource(params.getInt("cover_path"));
}
}

}
track.setEnabled(false);
}

@Override
Expand Down Expand Up @@ -50,4 +80,23 @@ public void showLoading() {
public void hideLoading() {

}

@Override
public void onClick(View view) {

int id = view.getId();

if (id == R.id.profile_picture) {

Intent intent = new Intent(this,com.developervishalsehgal.udacityscholarsapp.ui.avatars.avatar_selection.class);
startActivity(intent);

} else if (id == R.id.header_cover_image) {

Intent intent = new Intent(this,com.developervishalsehgal.udacityscholarsapp.ui.coverimage.cover_picture_selection.class);
startActivity(intent);
} else if (id == R.id.submit_details) {
// TODO implement this function to save the changes made to the details
}
}
}
Binary file added app/src/main/res/drawable-hdpi/avatar_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/avatar_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/avatar_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/avatar_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/desert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/stars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/avatar_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/avatar_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/avatar_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/avatar_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/desert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/stars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/avatar_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/avatar_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/avatar_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/avatar_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/desert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/stars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions app/src/main/res/layout/activity_avatar_selection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="match_parent"
tools:context="com.developervishalsehgal.udacityscholarsapp.ui.avatars.avatar_selection">


<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:rowCount="3"
android:columnCount="2">

<ImageView
android:id="@+id/pic1"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:layout_gravity="fill_horizontal"
android:src="@drawable/avatar_1"
android:layout_margin="1dp"
android:onClick="onClick"/>

<ImageView
android:id="@+id/pic2"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:layout_gravity="fill_horizontal"
android:src="@drawable/avatar_2"
android:layout_margin="1dp"
android:onClick="onClick"/>

<ImageView
android:id="@+id/pic3"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:layout_gravity="fill_horizontal"
android:src="@drawable/avatar_3"
android:layout_margin="1dp"
android:onClick="onClick"/>

<ImageView
android:id="@+id/pic4"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:layout_gravity="fill_horizontal"
android:src="@drawable/avatar_4"
android:layout_margin="1dp"
android:onClick="onClick"/>

</GridLayout>

</android.support.constraint.ConstraintLayout>
Loading