Skip to content

Commit

Permalink
Merge pull request #35 from uo277516/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
franciscocoya authored Jan 12, 2023
2 parents fffdb66 + 804c902 commit 6f25ef8
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 14 deletions.
14 changes: 13 additions & 1 deletion app/src/main/java/com/example/helpme/ChatActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ private void addListeners() {
@Override
protected void onResume() {
super.onResume();
paintChatMessages();
if(FirebaseAuth.getInstance().getCurrentUser() == null){
redirectToLogin();
}else{
paintChatMessages();
}
}

@Override
Expand Down Expand Up @@ -477,4 +481,12 @@ private void initFields() {
txNombreUsuarioReceiver.setText(alumnoB.nombre);
Picasso.get().load(alumnoB.urlFoto).into(imgPerfilUsuarioReceiver);
}

private void redirectToLogin() {
Intent intent = new Intent(ChatActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
}
}
14 changes: 13 additions & 1 deletion app/src/main/java/com/example/helpme/ListarChatsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ private void addListeners() {
@Override
protected void onResume() {
super.onResume();
cargarChats();

if(FirebaseAuth.getInstance().getCurrentUser() == null){
redirectToLogin();
}else {
cargarChats();
}
}

private void cargarChats() {
Expand Down Expand Up @@ -219,6 +224,13 @@ private void toogleMessage(final boolean show) {
mensajeNoHayConversaciones.setVisibility(View.GONE);
recyclerListadoChats.setVisibility(View.VISIBLE);
}
}

private void redirectToLogin() {
Intent intent = new Intent(ListarChatsActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
}
}
37 changes: 26 additions & 11 deletions app/src/main/java/com/example/helpme/ListarDudasActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.example.helpme.extras.IntentExtras;
import com.example.helpme.model.Duda;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.firebase.auth.FirebaseAuth;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -73,18 +74,24 @@ private Duda crearDuda(DudaDto duda) {
@Override
protected void onResume() {
super.onResume();
cargarDudas();
dudaAdapter = new DudaAdapter(dudas,
new DudaAdapter.OnItemClickListener() {
@Override
public void onItemClick(DudaDto duda) {
clikonIntem(duda);
}
});
;
listaDudaView.setAdapter(dudaAdapter);

dudaAdapter.notifyDataSetChanged();
if(FirebaseAuth.getInstance().getCurrentUser() == null){
redirectToLogin();

}else{
cargarDudas();
dudaAdapter = new DudaAdapter(dudas,
new DudaAdapter.OnItemClickListener() {
@Override
public void onItemClick(DudaDto duda) {
clikonIntem(duda);
}
});
;
listaDudaView.setAdapter(dudaAdapter);

dudaAdapter.notifyDataSetChanged();
}
}


Expand Down Expand Up @@ -122,4 +129,12 @@ public void onItemClick(DudaDto duda) {
dudaAdapter.notifyDataSetChanged();
});
}

private void redirectToLogin() {
Intent intent = new Intent(ListarDudasActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
}
}
18 changes: 17 additions & 1 deletion app/src/main/java/com/example/helpme/ProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@

public class ProfileActivity extends AppCompatActivity {


private FirebaseFirestore db = FirebaseFirestore.getInstance();

private static final String TAG = "profile_activity";
Expand Down Expand Up @@ -155,6 +154,15 @@ public void onClick(View v) {

}

@Override
protected void onResume() {
super.onResume();

if(FirebaseAuth.getInstance().getCurrentUser() == null){
redirectToLogin();
}
}

private void editarImagenPerfil(View v) {
findViewById(R.id.containerView).setBackgroundColor(Color.GRAY);
findViewById(R.id.constraintLayout).setVisibility(View.INVISIBLE);
Expand Down Expand Up @@ -352,4 +360,12 @@ public void callback(Alumno alumno) {
});
}

private void redirectToLogin() {
Intent intent = new Intent(ProfileActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
}

}
14 changes: 14 additions & 0 deletions app/src/main/java/com/example/helpme/PublicarDudaActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,14 @@ public void onClick(View view) {

//Navegacion:
IntentExtras.getInstance().handleNavigationView(navegacion, getBaseContext());
}

@Override
protected void onResume() {
super.onResume();
if(FirebaseAuth.getInstance().getCurrentUser() == null){
redirectToLogin();
}
}

private void uploadImage(ImageView imageView) {
Expand Down Expand Up @@ -423,5 +430,12 @@ private void crearAsignaturaDuda(String nombreA) {
});
}

private void redirectToLogin() {
Intent intent = new Intent(PublicarDudaActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
finish();
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6f25ef8

Please sign in to comment.