Skip to content

Commit

Permalink
Merge pull request #42 from enriquebarba97/CHEAT_006_debug
Browse files Browse the repository at this point in the history
Cheat 006 debug
  • Loading branch information
DaVinciJunior authored Apr 29, 2020
2 parents f9bba68 + bc9847d commit ad50653
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
android:theme="@style/AppTheme">
<activity android:name=".StartActivity"
android:windowSoftInputMode="stateHidden|adjustResize">
</activity>
<activity android:name=".ChatActivity"
android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/example/cheat/ChatActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.cheat

import android.content.Intent
import android.graphics.Color
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -15,9 +16,11 @@ import android.widget.*

import androidx.activity.viewModels
import androidx.annotation.RequiresApi
import kotlinx.android.synthetic.main.activity_start.*


class ChatActivity : AppCompatActivity() {

private val viewModel: MessageViewModel by viewModels()

var debug = true; // just for debugging
Expand Down Expand Up @@ -101,6 +104,10 @@ class ChatActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_chat)

btnDebug.setOnClickListener {
startActivity(Intent(this,StartActivity::class.java))
}

if(debug) println("onCreate");

history = findViewById<ScrollView>(R.id.scrollView);
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/example/cheat/StartActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class StartActivity : AppCompatActivity() {

acceptThread = conn.startAcceptThread(this)

btnDebug.setOnClickListener {
startActivity(Intent(this,ChatActivity::class.java))
}

btnRefresh.setOnClickListener {
refresh()
}
Expand Down
17 changes: 14 additions & 3 deletions app/src/main/res/layout/activity_chat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_above="@+id/linearLayout2"
android:layout_marginLeft="3dp"
android:layout_marginTop="10dp"
android:layout_marginRight="3dp"
android:layout_above="@+id/linearLayout2"
android:layout_marginBottom="50dp"
android:scrollbarStyle="insideOverlay"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
Expand Down Expand Up @@ -87,4 +87,15 @@
app:srcCompat="@drawable/ic_send" />
</LinearLayout>

<Button
android:id="@+id/btnDebug"
android:layout_width="111dp"
android:layout_height="47dp"
android:layout_marginStart="72dp"
android:layout_marginLeft="72dp"
android:layout_marginBottom="2dp"
android:text="Connect"
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_start.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,13 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent" />

<Button
android:id="@+id/btnDebug"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:text="Chat View"
app:layout_constraintBottom_toTopOf="@+id/txtConnected"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit ad50653

Please sign in to comment.