Commit 2907f3b4 authored by divyanshu's avatar divyanshu

new screens

parent a5963579
......@@ -22,7 +22,7 @@
android:name=".authentication.ui.AuthenticationActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="@style/AuthenticationTheme"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
......@@ -49,7 +49,7 @@
<activity
android:name=".server.ui.ChangeServerActivity"
android:theme="@style/AuthenticationTheme" />
android:theme="@style/AppTheme" />
<activity
android:name=".main.ui.MainActivity"
......
......@@ -2,17 +2,17 @@ package chat.rocket.android.authentication.loginoptions.ui
import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.*
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import chat.rocket.android.R
import chat.rocket.android.authentication.login.ui.REQUEST_CODE_FOR_OAUTH
import chat.rocket.android.authentication.loginoptions.presentation.LoginOptionsPresenter
import chat.rocket.android.authentication.loginoptions.presentation.LoginOptionsView
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.extensions.rotateBy
import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.ui
import chat.rocket.android.webview.oauth.ui.INTENT_OAUTH_CREDENTIAL_SECRET
......@@ -24,18 +24,32 @@ import kotlinx.android.synthetic.main.fragment_authentication_login_options.*
import javax.inject.Inject
private const val BUNDLE_SERVER_NAME = "BUNDLE_SERVER_NAME"
class LoginOptionsFragment : Fragment(), LoginOptionsView {
@Inject
lateinit var presenter: LoginOptionsPresenter
private var server: String? = null
companion object {
fun newInstance() = LoginOptionsFragment()
fun newInstance(server: String) : LoginOptionsFragment {
return LoginOptionsFragment().apply {
arguments = Bundle(1).apply {
putString(BUNDLE_SERVER_NAME, server)
}
}
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
AndroidSupportInjection.inject(this)
setHasOptionsMenu(true)
val bundle = arguments
if (bundle != null) {
server = bundle.getString(BUNDLE_SERVER_NAME)
}
}
override fun onCreateView(inflater: LayoutInflater,
......@@ -57,17 +71,24 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
button_login.setOnClickListener {
presenter.toLogin()
}
image_more_login_option.setOnClickListener{
if (it.rotation == 0f){
image_more_login_option.rotateBy(180f)
button_linkedin.isVisible = true
button_gitlab.isVisible = true
}else {
image_more_login_option.rotateBy(-180f)
button_linkedin.isVisible = false
button_gitlab.isVisible = false
}
}
}
private fun setupToolbar() {
val toolbar = (activity as AuthenticationActivity).toolbar
val textServerName = (activity as AuthenticationActivity).text_room_name
textServerName.text = "open.rocket.chat"
toolbar.isVisible = true
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp)
toolbar.setNavigationOnClickListener {
(activity as AuthenticationActivity).onBackPressed()
}
val textServerName = (activity as AuthenticationActivity).text_room_name
textServerName.text = server?.replace("https://","")
}
override fun enableLoginByFacebook() {
......
......@@ -25,7 +25,7 @@ class OnBoardingPresenter @Inject constructor(
fun connect(server: String) {
//code that leads to login screen (smart lock will be implemented after this)
connectToServer(server) {
navigator.toLoginOptions()
navigator.toLoginOptions(server)
}
}
......
package chat.rocket.android.authentication.presentation
import android.content.Intent
import androidx.appcompat.widget.DialogTitle
import chat.rocket.android.R
import chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import chat.rocket.android.authentication.login.ui.LoginFragment
......@@ -19,9 +20,9 @@ import chat.rocket.android.webview.ui.webViewIntent
class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
fun toLoginOptions() {
fun toLoginOptions(server: String) {
activity.addFragmentBackStack("LoginOptionFragment", R.id.fragment_container) {
LoginOptionsFragment.newInstance()
LoginOptionsFragment.newInstance(server)
}
}
......@@ -59,8 +60,8 @@ class AuthenticationNavigator(internal val activity: AuthenticationActivity) {
}
}
fun toWebPage(url: String) {
activity.startActivity(activity.webViewIntent(url))
fun toWebPage(url: String, toolbarTitle: String? = null) {
activity.startActivity(activity.webViewIntent(url, toolbarTitle))
activity.overridePendingTransition(R.anim.slide_up, R.anim.hold)
}
......
package chat.rocket.android.authentication.presentation
import chat.rocket.android.infrastructure.LocalRepository
import chat.rocket.android.server.domain.GetAccountInteractor
import chat.rocket.android.server.domain.GetCurrentServerInteractor
import chat.rocket.android.server.domain.SettingsRepository
import chat.rocket.android.server.domain.TokenRepository
import chat.rocket.android.server.domain.*
import chat.rocket.android.util.extensions.privacyPolicyUrl
import chat.rocket.android.util.extensions.termsOfServiceUrl
import javax.inject.Inject
class AuthenticationPresenter @Inject constructor(
......@@ -13,7 +12,8 @@ class AuthenticationPresenter @Inject constructor(
private val getAccountInteractor: GetAccountInteractor,
private val settingsRepository: SettingsRepository,
private val localRepository: LocalRepository,
private val tokenRepository: TokenRepository
private val tokenRepository: TokenRepository,
private val serverInteractor: GetConnectingServerInteractor
) {
suspend fun loadCredentials(newServer: Boolean, callback: (authenticated: Boolean) -> Unit) {
val currentServer = getCurrentServerInteractor.get()
......@@ -32,4 +32,16 @@ class AuthenticationPresenter @Inject constructor(
navigator.toChatList()
}
}
fun termsOfService(toolbarTitle: String) {
serverInteractor.get()?.let {
navigator.toWebPage(it.termsOfServiceUrl(), toolbarTitle)
}
}
fun privacyPolicy(toolbarTitle: String) {
serverInteractor.get()?.let {
navigator.toWebPage(it.privacyPolicyUrl(), toolbarTitle)
}
}
}
\ No newline at end of file
......@@ -35,7 +35,7 @@ class ServerPresenter @Inject constructor(
fun connect(server: String) {
//code that leads to login screen (smart lock will be implemented after this)
connectToServer(server) {
navigator.toLoginOptions()
navigator.toLoginOptions(server)
}
}
......
......@@ -14,7 +14,6 @@ import androidx.core.view.isVisible
import chat.rocket.android.BuildConfig
import chat.rocket.android.R
import chat.rocket.android.authentication.domain.model.LoginDeepLinkInfo
import chat.rocket.android.authentication.loginoptions.ui.LoginOptionsFragment
import chat.rocket.android.authentication.server.presentation.ServerPresenter
import chat.rocket.android.authentication.server.presentation.ServerView
import chat.rocket.android.authentication.ui.AuthenticationActivity
......@@ -225,9 +224,4 @@ class ServerFragment : Fragment(), ServerView {
}
}
}
private fun joinCommunity(){
val url = "https://open.rocket.chat"
presenter.checkServer("$protocol${url.sanitize()}")
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package chat.rocket.android.authentication.ui
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.fragment.app.Fragment
import androidx.appcompat.app.AppCompatActivity
import chat.rocket.android.R
......@@ -13,6 +15,7 @@ import dagger.android.AndroidInjection
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector
import kotlinx.android.synthetic.main.app_bar_chat_room.*
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.android.UI
import kotlinx.coroutines.experimental.launch
......@@ -28,8 +31,17 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
setContentView(R.layout.activity_authentication)
setTheme(R.style.AuthenticationTheme)
super.onCreate(savedInstanceState)
setupToolbar()
}
private fun setupToolbar() {
setSupportActionBar(toolbar)
supportActionBar?.setDisplayShowTitleEnabled(false)
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp)
toolbar.setNavigationOnClickListener {
onBackPressed()
}
}
override fun onStart() {
......@@ -45,6 +57,26 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.legal, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
return when(item?.itemId){
R.id.action_terms_of_Service -> {
presenter.termsOfService(getString(R.string.title_legal_terms))
true
}
R.id.action_privacy_policy -> {
presenter.privacyPolicy(getString(R.string.title_legal_terms))
true
}
else -> super.onOptionsItemSelected(item)
}
}
override fun onStop() {
job.cancel()
super.onStop()
......
......@@ -11,23 +11,27 @@ import chat.rocket.android.R
import kotlinx.android.synthetic.main.activity_web_view.*
import kotlinx.android.synthetic.main.app_bar.*
fun Context.webViewIntent(webPageUrl: String): Intent {
fun Context.webViewIntent(webPageUrl: String, toolbarTitle: String? = null): Intent {
return Intent(this, WebViewActivity::class.java).apply {
putExtra(INTENT_WEB_PAGE_URL, webPageUrl)
putExtra(TOOLBAR_TITLE, toolbarTitle)
}
}
private const val INTENT_WEB_PAGE_URL = "web_page_url"
private const val TOOLBAR_TITLE = "toolbar_title"
// Simple WebView to load URL.
class WebViewActivity : AppCompatActivity() {
private lateinit var webPageUrl: String
private var toolbarTitle: String? = ""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_web_view)
webPageUrl = intent.getStringExtra(INTENT_WEB_PAGE_URL)
toolbarTitle = intent.getStringExtra(TOOLBAR_TITLE)
requireNotNull(webPageUrl) { "no web_page_url provided in Intent extras" }
setupToolbar()
......@@ -47,7 +51,7 @@ class WebViewActivity : AppCompatActivity() {
}
private fun setupToolbar() {
toolbar.title = getString(R.string.title_legal_terms)
toolbar.title = if(toolbarTitle != null) toolbarTitle else webPageUrl.replace("https://","")
toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp)
toolbar.setNavigationOnClickListener {
finishActivity()
......
......@@ -6,12 +6,16 @@
android:viewportHeight="20">
<path
android:fillColor="#00000000"
android:fillType="evenOdd"
android:strokeColor="#2F343D"
android:pathData="M10.0002,5.5001C10.0002,6.3261 9.869,6.9474 9.6082,7.3639L14.4347,12.0381L15,13.8704L13.8695,15L12.0425,14.4382L11.6838,14.0804L11.6838,12.7898L10.3931,12.7898L9.8419,12.2385L9.8419,10.947L8.5504,10.947L7.1801,9.5715C6.6709,9.8576 6.11,10.0002 5.5001,10.0002C4.2845,10.0003 3.1205,9.5084 2.2732,8.6367C1.4258,7.765 0.9672,6.5876 1.0017,5.3724C1.0674,3.0239 3.0247,1.0674 5.3724,1.0017C6.5873,0.9675 7.7643,1.4261 8.6358,2.2732C9.5073,3.1203 9.9991,4.2839 9.9994,5.4992L10.0002,5.5001Z"
android:strokeWidth="1.5"
android:pathData="M5.714 5.143c0 0.944 0.15 1.654 0.448 2.13L0.646 12.615 0 14.709 1.292 16l2.088-0.642 0.41 -0.409v-1.475h1.475l0.63-0.63v-1.476h1.476l1.566-1.572c0.582 0.327 1.223 0.49 1.92 0.49 a5.143 5.143 0 0 0 5.141-5.289c-0.075-2.684-2.312-4.92-4.995-4.995a5.143 5.143 0 0 0-5.288 5.14z" />
android:strokeColor="#FF2F343D" />
<path
android:fillColor="#2F343D"
android:fillType="evenOdd"
android:pathData="M 11.5 3 C 12.3284271247 3 13 3.67157287525 13 4.5 C 13 5.32842712475 12.3284271247 6 11.5 6 C 10.6715728753 6 10 5.32842712475 10 4.5 C 10 3.67157287525 10.6715728753 3 11.5 3 Z" />
</vector>
\ No newline at end of file
android:fillColor="#FF2F343D"
android:fillType="nonZero"
android:pathData="M4.9375,4.9375m1.3125,0a1.3125,1.3125 0,1 0,-2.625 0a1.3125,1.3125 0,1 0,2.625 0"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>
......@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AuthenticationTheme"
android:theme="@style/AppTheme"
android:orientation="vertical"
tools:context=".authentication.ui.AuthenticationActivity">
......
......@@ -84,7 +84,8 @@
android:textColor="#2f343d"
android:textSize="16sp"
android:textAllCaps="false"
style="?borderlessButtonStyle" />
style="?borderlessButtonStyle"
android:visibility="gone"/>
<Button
android:id="@+id/button_gitlab"
......@@ -104,7 +105,8 @@
android:textColor="#2f343d"
android:textSize="16sp"
android:textAllCaps="false"
style="?borderlessButtonStyle" />
style="?borderlessButtonStyle"
android:visibility="gone" />
<ImageView
android:id="@+id/image_more_login_option"
......
......@@ -34,7 +34,7 @@
android:drawableStart="@drawable/ic_vpn_key_black_24dp"
android:hint="@string/msg_2fa_code"
android:imeOptions="actionDone"
android:inputType="text" />
android:inputType="number" />
<Button
android:id="@+id/button_log_in"
......
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_terms_of_Service"
android:title="Terms of Service"
app:showAsAction="never" />
<item
android:id="@+id/action_privacy_policy"
android:title="Privacy Policy"
app:showAsAction="never" />
</menu>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
......@@ -6,18 +6,10 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="windowActionModeOverlay">true</item>
<item name="searchViewStyle">@style/ChatRoom.SearchView</item>
</style>
<style name="AuthenticationTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
<item name="android:windowBackground">@color/colorWhite</item>
</style>
<!-- Widget styles. -->
<style name="Authentication.TextView" parent="TextAppearance.AppCompat.Medium">
<item name="android:layout_width">wrap_content</item>
......
......@@ -10,8 +10,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta04'
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'
classpath 'com.android.tools.build:gradle:3.3.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}"
classpath 'com.google.gms:google-services:3.2.0'
......
#Wed Jul 25 20:36:29 IST 2018
#Sat Aug 04 13:02:54 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-rc-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
distributionSha256Sum=9af7345c199f1731c187c96d3fe3d31f5405192a42046bafa71d846c3d9adacb
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment