diff options
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/beam_messenger/beam_messenger/LoginActivity.kt | 13 | ||||
-rw-r--r-- | app/src/main/java/com/beam_messenger/beam_messenger/MainActivity.kt | 22 |
2 files changed, 29 insertions, 6 deletions
diff --git a/app/src/main/java/com/beam_messenger/beam_messenger/LoginActivity.kt b/app/src/main/java/com/beam_messenger/beam_messenger/LoginActivity.kt index 9662778..8c91771 100644 --- a/app/src/main/java/com/beam_messenger/beam_messenger/LoginActivity.kt +++ b/app/src/main/java/com/beam_messenger/beam_messenger/LoginActivity.kt @@ -23,6 +23,7 @@ import android.widget.TextView import java.util.ArrayList import android.Manifest.permission.READ_CONTACTS +import android.content.Intent import kotlinx.android.synthetic.main.activity_login.* @@ -142,13 +143,11 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> { } private fun isEmailValid(email: String): Boolean { - //TODO: Replace this with your own logic return email.contains("@") } private fun isPasswordValid(password: String): Boolean { - //TODO: Replace this with your own logic - return password.length > 4 + return password.length > 7 } /** @@ -246,7 +245,7 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> { try { // Simulate network access. - Thread.sleep(2000) + Thread.sleep(1000) } catch (e: InterruptedException) { return false } @@ -266,7 +265,9 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> { showProgress(false) if (success!!) { - finish() + val intent = Intent(this@LoginActivity, MainActivity::class.java) + //intent.putExtra("keyIdentifier", value) + startActivity(intent) } else { password.error = getString(R.string.error_incorrect_password) password.requestFocus() @@ -290,6 +291,6 @@ class LoginActivity : AppCompatActivity(), LoaderCallbacks<Cursor> { * A dummy authentication store containing known user names and passwords. * TODO: remove after connecting to a real authentication system. */ - private val DUMMY_CREDENTIALS = arrayOf("foo@example.com:hello", "bar@example.com:world") + private val DUMMY_CREDENTIALS = arrayOf("foo@example.com:password", "bar@example.com:helloworld") } } diff --git a/app/src/main/java/com/beam_messenger/beam_messenger/MainActivity.kt b/app/src/main/java/com/beam_messenger/beam_messenger/MainActivity.kt new file mode 100644 index 0000000..d708a98 --- /dev/null +++ b/app/src/main/java/com/beam_messenger/beam_messenger/MainActivity.kt @@ -0,0 +1,22 @@ +package com.beam_messenger.beam_messenger + +import android.os.Bundle +import android.support.design.widget.Snackbar +import android.support.v7.app.AppCompatActivity + +import kotlinx.android.synthetic.main.activity_main.* + +class MainActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + setSupportActionBar(toolbar) + + fab.setOnClickListener { view -> + Snackbar.make(view, "Sorry, this feature is currently unavailable.", Snackbar.LENGTH_LONG) + .setAction("Action", null).show() + } + } + +} |