Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Commit

Permalink
Adiciona botão na tela de chat para voltar para tela de detalhes da c…
Browse files Browse the repository at this point in the history
…arona
  • Loading branch information
BrenoFRocha committed Aug 3, 2018
1 parent 36fdd03 commit 6558892
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 30 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
43 changes: 38 additions & 5 deletions app/src/main/java/br/ufrj/caronae/acts/ChatAct.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@

public class ChatAct extends AppCompatActivity {

@BindView(R.id.back_bt)
RelativeLayout backBtn;
@BindView(R.id.chatMsgs_rv)
RecyclerView chatMsgs_rv;
@BindView(R.id.send_bt)
Expand All @@ -63,8 +65,6 @@ public class ChatAct extends AppCompatActivity {
EditText msg_et;
@BindView(R.id.chat_header_text)
TextView headerText;
@BindView(R.id.lay1)
RelativeLayout lay1;
@BindView(R.id.card_loading_menssages_sign)
CardView cardLoadingMessages;
@BindView(R.id.loading_message_text)
Expand All @@ -75,6 +75,10 @@ public class ChatAct extends AppCompatActivity {
static int color;
Context context;
static ChatMsgsAdapter chatMsgsAdapter;
private RideForJson rideOffer;
private String fromWhere = "", status;
private int idRide;


Animation translate;

Expand All @@ -89,6 +93,13 @@ protected void onCreate(Bundle savedInstanceState) {

App.getBus().register(this);

try {
fromWhere = getIntent().getStringExtra("fromWhere");
status = getIntent().getStringExtra("status");
}catch(Exception e){}
rideOffer = getIntent().getExtras().getParcelable("ride");
idRide = getIntent().getExtras().getInt("id");

SharedPref.setChatActIsForeground(true);

final ActionBar ab = getSupportActionBar();
Expand All @@ -113,7 +124,6 @@ private void configureActivityWithChatAssets(ChatAssets chatAssets) {
context = this;
color = chatAssets.getColor();
int colorPressed = color;
lay1.setBackgroundColor(color);
send_bt.setColorNormal(color);
send_bt.setColorPressed(colorPressed);
String neighborhood = chatAssets.getLocation();
Expand Down Expand Up @@ -380,9 +390,9 @@ public void onResponse(Call<MyRidesForJson> call, Response<MyRidesForJson> respo
if (ride[0] != null){
String location;
if (ride[0].isGoing())
location = ride[0].getNeighborhood() + " -> " + ride[0].getHub();
location = ride[0].getNeighborhood() + " " + ride[0].getHub();
else
location = ride[0].getHub() + " -> " + ride[0].getNeighborhood();
location = ride[0].getHub() + " " + ride[0].getNeighborhood();
ChatAssets chatAssets = new ChatAssets(rideId, location,
Util.getColors(ride[0].getZone()),
Util.formatBadDateWithoutYear(ride[0].getDate()),
Expand Down Expand Up @@ -414,4 +424,27 @@ public void onFailure(Call<MyRidesForJson> call, Throwable t) {
});
return ride[0];
}


@OnClick(R.id.back_bt)
public void backRide()
{
Intent intent = new Intent(this, RideDetailAct.class);
intent.putExtra("ride", rideOffer);
intent.putExtra("fromWhere", fromWhere);
intent.putExtra("status", status);
intent.putExtra("id", idRide);
startActivity(intent);
overridePendingTransition(R.anim.anim_left_slide_in, R.anim.anim_right_slide_out);
}
@Override
public void onBackPressed() {
Intent intent = new Intent(this, RideDetailAct.class);
intent.putExtra("ride", rideOffer);
intent.putExtra("fromWhere", fromWhere);
intent.putExtra("status", status);
intent.putExtra("id", idRide);
startActivity(intent);
overridePendingTransition(R.anim.anim_left_slide_in, R.anim.anim_right_slide_out);
}
}
4 changes: 4 additions & 0 deletions app/src/main/java/br/ufrj/caronae/acts/RideDetailAct.java
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,10 @@ private void openChat()

Intent intent = new Intent(RideDetailAct.this, ChatAct.class);
intent.putExtra("rideId", Integer.toString(idRide));
intent.putExtra("status", status);
intent.putExtra("ride", rideWithUsers);
intent.putExtra("fromWhere", fromWhere);
intent.putExtra("id", idRide);
startActivity(intent);
overridePendingTransition(R.anim.anim_right_slide_in, R.anim.anim_left_slide_out);
}
Expand Down
72 changes: 47 additions & 25 deletions app/src/main/res/layout/activity_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,68 @@
android:orientation="vertical"
tools:context="br.ufrj.caronae.acts.ChatAct">

<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
<android.support.v7.widget.CardView
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="4dp"
android:background="@color/white">

<RelativeLayout
android:id="@+id/toolbar"
app:cardElevation="4dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ToolbarColoredBackArrow">
android:layout_height="45dp"
android:background="@color/light_gray">

<RelativeLayout
android:id="@+id/lay1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/dark_gray">

android:layout_height="match_parent"
android:gravity="start">
<RelativeLayout
android:id="@+id/back_bt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="@+id/arrow"
android:layout_width="40dp"
android:layout_height="40dp"
android:tint="@color/dark_gray"
android:src="@drawable/ic_keyboard_arrow_left_24dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ride"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/arrow"
android:layout_toEndOf="@id/arrow"
android:textColor="@color/dark_gray"
android:layout_marginLeft="-10dp"
android:layout_marginStart="-10dp"
android:textSize="18sp"/>
</RelativeLayout>
<TextView
android:padding="10dp"
android:id="@+id/chat_header_text"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="18sp"
android:text="BARRA DA TIJUCA ➜ CSS - 25/12 - 12:00" />

android:layout_toRightOf="@id/back_bt"
android:layout_toEndOf="@id/back_bt"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:layout_centerVertical="true"
android:text="BARRA DA TIJUCA ➜ CSS - 25/12 - 12:00"
android:textColor="@color/black"
android:textSize="18sp"/>
</RelativeLayout>

</RelativeLayout>

</android.support.design.widget.AppBarLayout>
</FrameLayout>
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
android:id="@+id/card_loading_menssages_sign"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/app_bar_layout"
android:layout_below="@id/toolbar_layout"
android:minHeight="24dp"
app:cardCornerRadius="6dp"
app:cardElevation="2dp">
Expand Down

0 comments on commit 6558892

Please sign in to comment.