diff --git a/app/src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.java b/app/src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.java deleted file mode 100644 index f99f65e5fd..0000000000 --- a/app/src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.owncloud.android.authentication; - -import android.net.Uri; -import android.os.Bundle; -import android.widget.TextView; -import android.widget.Toast; - -import com.nextcloud.client.di.Injectable; -import com.owncloud.android.R; - -public class DeepLinkLoginActivity extends AuthenticatorActivity implements Injectable { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - if (!getResources().getBoolean(R.bool.multiaccount_support) && - accountManager.getAccounts().length == 1) { - Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show(); - return; - } - - setContentView(R.layout.deep_link_login); - - Uri data = getIntent().getData(); - - if (data != null) { - try { - String prefix = getString(R.string.login_data_own_scheme) + PROTOCOL_SUFFIX + "login/"; - LoginUrlInfo loginUrlInfo = parseLoginDataUrl(prefix, data.toString()); - - TextView loginText = findViewById(R.id.loginInfo); - loginText.setText(String.format(getString(R.string.direct_login_text), loginUrlInfo.username, - loginUrlInfo.serverAddress)); - } catch (IllegalArgumentException e) { - Toast.makeText(this, R.string.direct_login_failed, Toast.LENGTH_LONG).show(); - } - } - } -} diff --git a/app/src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.kt b/app/src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.kt new file mode 100644 index 0000000000..9032371a72 --- /dev/null +++ b/app/src/main/java/com/owncloud/android/authentication/DeepLinkLoginActivity.kt @@ -0,0 +1,37 @@ +package com.owncloud.android.authentication + +import android.os.Bundle +import android.widget.TextView +import android.widget.Toast +import com.nextcloud.client.di.Injectable +import com.owncloud.android.R + +class DeepLinkLoginActivity : AuthenticatorActivity(), Injectable { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + if (!resources.getBoolean(R.bool.multiaccount_support) && + accountManager.accounts.size == 1 + ) { + Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show() + return + } + + setContentView(R.layout.deep_link_login) + + intent.data?.let { + try { + val prefix = getString(R.string.login_data_own_scheme) + PROTOCOL_SUFFIX + "login/" + val loginUrlInfo = parseLoginDataUrl(prefix, it.toString()) + val loginText = findViewById(R.id.loginInfo) + loginText.text = String.format( + getString(R.string.direct_login_text), loginUrlInfo.username, + loginUrlInfo.serverAddress + ) + } catch (e: IllegalArgumentException) { + Toast.makeText(this, R.string.direct_login_failed, Toast.LENGTH_LONG).show() + } + } + } +}