Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 1112034

Browse files
jainkuniyatimabbott
authored andcommitted
Fixes: #249 Added CustomTabs in register link
1 parent 4948409 commit 1112034

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ dependencies {
7575
compile 'commons-lang:commons-lang:2.6'
7676
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
7777
compile 'com.squareup.picasso:picasso:2.5.2'
78+
compile 'com.android.support:customtabs:23.3.0'
7879
compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') {
7980
transitive = true;
8081
}

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.zulip.android"
4-
>
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.zulip.android">
55

66
<uses-permission android:name="android.permission.INTERNET" />
77
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
@@ -17,6 +17,9 @@
1717
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
1818
<uses-permission android:name="android.permission.VIBRATE"/>
1919

20+
<uses-sdk android:targetSdkVersion="23" android:minSdkVersion="13"
21+
tools:overrideLibrary="com.android.support:customtabs:23.3.0,android.support.customtabs"/>
22+
2023
<application
2124
android:name="com.zulip.android.ZulipApp"
2225
android:allowBackup="false"

app/src/main/java/com/zulip/android/activities/LoginActivity.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
import android.content.Intent;
66
import android.content.IntentSender.SendIntentException;
77
import android.net.Uri;
8+
import android.os.Build;
89
import android.os.Bundle;
10+
import android.support.customtabs.CustomTabsIntent;
911
import android.support.v7.app.AlertDialog;
1012
import android.support.v7.widget.Toolbar;
1113
import android.util.Log;
@@ -446,14 +448,33 @@ public void onTaskFailure(String result) {
446448
asyncDevGetEmails.execute();
447449
break;
448450
case R.id.register:
449-
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(serverIn.getText().toString()+"register"));
450-
startActivity(intent);
451+
openRegister();
451452
break;
452453
default:
453454
break;
454455
}
455456
}
456457

458+
private void openRegister() {
459+
Uri uri;
460+
if (serverIn==null || serverIn.getText().toString().isEmpty() || serverIn.getText().toString().equals(""))
461+
{
462+
return;
463+
}else
464+
{
465+
uri = Uri.parse(serverIn.getText().toString()+"register");
466+
}
467+
if (Build.VERSION.SDK_INT < 15)
468+
{
469+
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
470+
startActivity(intent);
471+
return;
472+
}
473+
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
474+
CustomTabsIntent intent = builder.build();
475+
intent.launchUrl(LoginActivity.this,uri);
476+
}
477+
457478
private boolean isInputValidForDevAuth() {
458479
boolean isValid = true;
459480

0 commit comments

Comments
 (0)