srctree

Robin Lindén parent 30ce15dd 78b81794
Create a nicer starting activity

app/src/main/AndroidManifest.xml added: 89, removed: 10, total 79
@@ -9,6 +9,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ChatActivity">
</activity>
<activity android:name=".ContactListActivity">
</activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
 
filename was Deleted added: 89, removed: 10, total 79
@@ -0,0 +1,10 @@
package ltd.evilcorp.atox
 
import android.app.Application
 
class App:Application() {
companion object {
lateinit var profile:String
lateinit var password:String
}
}
 
filename was Deleted added: 89, removed: 10, total 79
@@ -0,0 +1,12 @@
package ltd.evilcorp.atox
 
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
 
class ContactListActivity : AppCompatActivity() {
 
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_contact_list)
}
}
 
app/src/main/java/ltd/evilcorp/atox/MainActivity.kt added: 89, removed: 10, total 79
@@ -1,12 +1,21 @@
package ltd.evilcorp.atox
 
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
 
class MainActivity : AppCompatActivity() {
 
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
 
btnCreate.setOnClickListener {
App.profile = if (username.text.isNotEmpty()) username.text.toString() else "aTox user"
App.password = if (password.text.isNotEmpty()) password.text.toString() else ""
startActivity(Intent(this@MainActivity, ContactListActivity::class.java))
}
}
 
}
 
filename was Deleted added: 89, removed: 10, total 79
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ContactListActivity">
 
</android.support.constraint.ConstraintLayout>
 
app/src/main/res/layout/activity_main.xml added: 89, removed: 10, total 79
@@ -8,12 +8,46 @@
tools:context=".MainActivity">
 
<TextView
android:id="@+id/profileCreationLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
android:text="Create a Tox profile"
android:textSize="25sp"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/username"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"/>
 
</android.support.constraint.ConstraintLayout>
No newline at end of file
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="username"
android:hint="Name"
android:inputType="text"
android:maxLines="1"
app:layout_constraintTop_toBottomOf="@id/profileCreationLabel"
app:layout_constraintBottom_toTopOf="@id/password"/>
 
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="password"
android:hint="Password (optional)"
android:inputType="textPassword"
android:maxLines="1"
app:layout_constraintTop_toBottomOf="@id/username"
app:layout_constraintBottom_toTopOf="@id/btnCreate"/>
 
<Button
android:id="@+id/btnCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Create"
app:layout_constraintTop_toBottomOf="@+id/password"
app:layout_constraintBottom_toBottomOf="parent"/>
 
</android.support.constraint.ConstraintLayout>