Skip to content

Commit

Permalink
design changes in EditChatActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
DevEmperor committed Feb 6, 2024
1 parent 9982f98 commit 431b69d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

Expand All @@ -19,6 +20,7 @@

public class EditChatActivity extends Activity {

ScrollView editChatSv;
TextView titleTv;
TextView modifiedTv;
TextView chatCostTv;
Expand All @@ -33,6 +35,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_chat);

editChatSv = findViewById(R.id.edit_chat_sv);
titleTv = findViewById(R.id.edit_title_tv);
modifiedTv = findViewById(R.id.modified_tv);
chatCostTv = findViewById(R.id.chat_cost_tv);
Expand All @@ -45,13 +48,15 @@ protected void onCreate(Bundle savedInstanceState) {
titleTv.setText(chatHistoryDatabaseHelper.getTitle(id));

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd\nHH:mm:ss", Locale.getDefault());
modifiedTv.setText(getString(R.string.wristassist_formatted_date, formatter.format(chatHistoryDatabaseHelper.getModified(id))));
modifiedTv.setText(formatter.format(chatHistoryDatabaseHelper.getModified(id)));

try {
chatCostTv.setText(getString(R.string.wristassist_chat_cost, String.format(Locale.getDefault(), "%,d", chatHistoryDatabaseHelper.getChatCost(this, id))));
chatCostTv.setText(String.format(Locale.getDefault(), "%,d", chatHistoryDatabaseHelper.getChatCost(this, id)));
} catch (IOException | JSONException e) {
throw new RuntimeException(e);
}

editChatSv.requestFocus();
}

@Override
Expand Down
32 changes: 25 additions & 7 deletions app/src/main/res/layout/activity_edit_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="10dp"
android:fillViewport="false">
android:paddingHorizontal="24dp"
android:fillViewport="false"
android:id="@+id/edit_chat_sv">

<LinearLayout
android:layout_width="match_parent"
Expand All @@ -18,30 +19,47 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="32dp"
android:layout_marginHorizontal="32dp"
android:layout_marginBottom="16dp"
android:maxLines="3"
android:textAlignment="center"
android:textColor="#7B1FA2"
android:textSize="18sp"
android:textStyle="bold"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="18sp"
android:textAlignment="center"
android:textColor="@color/wristassist_purple"
android:textStyle="bold|italic"
android:text="@string/wristassist_last_modified"/>

<TextView
android:id="@+id/modified_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="32dp"
android:layout_marginBottom="16dp"
android:textSize="16sp"
android:textAlignment="center" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="18sp"
android:textAlignment="center"
android:textColor="@color/wristassist_purple"
android:textStyle="bold|italic"
android:text="@string/wristassist_chat_cost"/>

<TextView
android:id="@+id/chat_cost_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="32dp"
android:layout_marginBottom="16dp"
android:textSize="16sp"
android:textAlignment="center"/>
Expand All @@ -56,7 +74,7 @@
android:id="@+id/edit_btn"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="32dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:background="@null"
android:onClick="editTitle"
Expand All @@ -74,7 +92,7 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="32dp"
android:layout_marginEnd="8dp"
android:background="@null"
android:onClick="deleteChat"
android:src="@drawable/twotone_delete_24"
Expand Down

0 comments on commit 431b69d

Please sign in to comment.