Skip to content

Commit

Permalink
updated app
Browse files Browse the repository at this point in the history
  • Loading branch information
tirtharajsinha committed Nov 23, 2021
1 parent 60ea15e commit bdb0fc8
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 28 deletions.
16 changes: 15 additions & 1 deletion app/src/main/java/com/example/todo_app/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
public class LoginActivity extends AppCompatActivity {
GoogleSignInClient mGoogleSignInClient;
Button signInButton;
private long pressedTime;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.loginactivity);

GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
Expand Down Expand Up @@ -63,6 +63,7 @@ public void updateUI(GoogleSignInAccount account){
String personId = account.getId();
Uri personPhoto = account.getPhotoUrl();
final Intent i=new Intent(LoginActivity.this,MainActivity.class);
finish();
startActivity(i);


Expand Down Expand Up @@ -99,4 +100,17 @@ private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
Log.d("GOOGLE ERROR",e.getMessage());
}
}

@Override
public void onBackPressed() {

if (pressedTime + 2000 > System.currentTimeMillis()) {
super.onBackPressed();
finish();
} else {
Toast.makeText(getBaseContext(), "Press back again to exit", Toast.LENGTH_SHORT).show();

}
pressedTime = System.currentTimeMillis();
}
}
9 changes: 8 additions & 1 deletion app/src/main/java/com/example/todo_app/fourthFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class fourthFragment extends Fragment {
Context thiscontext;
View view;
TextView textView3;
TextView textView4;
TextView textView5;
CircularImageView usrdp;

public fourthFragment(){
Expand Down Expand Up @@ -87,8 +89,12 @@ public void updateUI(GoogleSignInAccount account){
String personId = account.getId();
Uri personPhoto = account.getPhotoUrl();
textView3=view.findViewById(R.id.textView3);
textView4=view.findViewById(R.id.textView4);
textView5=view.findViewById(R.id.textView5);
usrdp =view.findViewById(R.id.UserImage);
textView3.setText("hi, "+personGivenName);
textView3.setText(personName);
textView4.setText("@"+personEmail);
textView5.setText("hi, "+personGivenName);
textView3.setTextSize(20);
Picasso.get().load(personPhoto).into(usrdp);
System.out.println(personPhoto);
Expand All @@ -106,6 +112,7 @@ public void updateUI(GoogleSignInAccount account){

public void redirectAuthPage(){
final Intent i=new Intent(thiscontext,LoginActivity.class);
getActivity().finish();
startActivity(i);
}

Expand Down
82 changes: 56 additions & 26 deletions app/src/main/res/layout/fragment_fourth.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,87 @@


<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:id="@+id/textView5"
android:layout_width="230dp"
android:layout_height="46dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="196dp"
android:text="Profile"
android:textSize="20dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="Profile"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/UserImage"
app:layout_constraintEnd_toStartOf="@+id/sign_out_button"
app:layout_constraintHorizontal_bias="0.333"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<Button
android:id="@+id/sign_out_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="28dp"
android:gravity="center"
android:text="Sign Out"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.937"
app:layout_constraintStart_toEndOf="@+id/UserImage"
app:layout_constraintTop_toTopOf="parent"

/>
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="380dp"
android:layout_height="150dp"
android:layout_marginTop="108dp"
android:layout_marginTop="92dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.516"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

</androidx.constraintlayout.widget.ConstraintLayout>
<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/UserImage"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:src="@drawable/ic_person"
app:civ_shadow="true"
app:civ_shadow_color="#3f51b5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="196dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="Profile"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/UserImage"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView4"
android:layout_width="271dp"
android:layout_height="63dp"
android:layout_marginTop="60dp"
android:paddingTop="5dp"
android:paddingLeft="10dp"
android:text="Profile"
android:textColor="@android:color/darker_gray"
android:textSize="17dp"
android:textStyle="normal"
app:layout_constraintStart_toEndOf="@+id/UserImage"
app:layout_constraintTop_toTopOf="parent" />



<com.mikhaellopez.circularimageview.CircularImageView
android:id="@+id/UserImage"
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/ic_person"
app:civ_shadow="true"
app:civ_shadow_color="#3f51b5"
android:layout_marginTop="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>


</androidx.constraintlayout.widget.ConstraintLayout>

Expand Down

0 comments on commit bdb0fc8

Please sign in to comment.