added interface to edit nick
This commit is contained in:
parent
aca4ba981f
commit
5012ff3545
|
@ -2,6 +2,7 @@ package eu.siacs.conversations.entities;
|
||||||
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -380,7 +381,12 @@ public class MucOptions {
|
||||||
} else if (!conversation.getJid().isBareJid()) {
|
} else if (!conversation.getJid().isBareJid()) {
|
||||||
return conversation.getJid().getResource();
|
return conversation.getJid().getResource();
|
||||||
} else {
|
} else {
|
||||||
return JidHelper.localPartOrFallback(account.getJid());
|
final String displayName = account.getDisplayName();
|
||||||
|
if (TextUtils.isEmpty(displayName)) {
|
||||||
|
return JidHelper.localPartOrFallback(account.getJid());
|
||||||
|
} else {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public abstract class AbstractGenerator {
|
||||||
"http://jabber.org/protocol/caps",
|
"http://jabber.org/protocol/caps",
|
||||||
"http://jabber.org/protocol/disco#info",
|
"http://jabber.org/protocol/disco#info",
|
||||||
"urn:xmpp:avatar:metadata+notify",
|
"urn:xmpp:avatar:metadata+notify",
|
||||||
"http://jabber.org/protocol/nick+notify",
|
Namespace.NICK+"+notify",
|
||||||
Namespace.BOOKMARKS+"+notify",
|
Namespace.BOOKMARKS+"+notify",
|
||||||
"urn:xmpp:ping",
|
"urn:xmpp:ping",
|
||||||
"jabber:iq:version",
|
"jabber:iq:version",
|
||||||
|
|
|
@ -127,8 +127,15 @@ public class IqGenerator extends AbstractGenerator {
|
||||||
|
|
||||||
public IqPacket publishNick(String nick) {
|
public IqPacket publishNick(String nick) {
|
||||||
final Element item = new Element("item");
|
final Element item = new Element("item");
|
||||||
item.addChild("nick", "http://jabber.org/protocol/nick").setContent(nick);
|
item.addChild("nick", Namespace.NICK).setContent(nick);
|
||||||
return publish("http://jabber.org/protocol/nick", item);
|
return publish(Namespace.NICK, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IqPacket deleteNode(String node) {
|
||||||
|
IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
|
||||||
|
final Element pubsub = packet.addChild("pubsub", Namespace.PUBSUB_OWNER);
|
||||||
|
pubsub.addChild("delete").setAttribute("node",node);
|
||||||
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IqPacket publishAvatar(Avatar avatar) {
|
public IqPacket publishAvatar(Avatar avatar) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -285,11 +285,19 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean needsUpdating = account.setOption(Account.OPTION_LOGGED_IN_SUCCESSFULLY, true);
|
boolean loggedInSuccessfully = account.setOption(Account.OPTION_LOGGED_IN_SUCCESSFULLY, true);
|
||||||
needsUpdating |= account.setOption(Account.OPTION_HTTP_UPLOAD_AVAILABLE, account.getXmppConnection().getFeatures().httpUpload(0));
|
boolean gainedFeature = account.setOption(Account.OPTION_HTTP_UPLOAD_AVAILABLE, account.getXmppConnection().getFeatures().httpUpload(0));
|
||||||
if (needsUpdating) {
|
if (loggedInSuccessfully || gainedFeature) {
|
||||||
databaseBackend.updateAccount(account);
|
databaseBackend.updateAccount(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loggedInSuccessfully) {
|
||||||
|
if (!TextUtils.isEmpty(account.getDisplayName())) {
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": display name wasn't empty on first log in. publishing");
|
||||||
|
publishDisplayName(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
account.getRoster().clearPresences();
|
account.getRoster().clearPresences();
|
||||||
mJingleConnectionManager.cancelInTransmission();
|
mJingleConnectionManager.cancelInTransmission();
|
||||||
mQuickConversationsService.considerSyncBackground(false);
|
mQuickConversationsService.considerSyncBackground(false);
|
||||||
|
@ -3828,14 +3836,17 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
public void publishDisplayName(Account account) {
|
public void publishDisplayName(Account account) {
|
||||||
String displayName = account.getDisplayName();
|
String displayName = account.getDisplayName();
|
||||||
if (displayName != null && !displayName.isEmpty()) {
|
final IqPacket request;
|
||||||
IqPacket publish = mIqGenerator.publishNick(displayName);
|
if (TextUtils.isEmpty(displayName)) {
|
||||||
sendIqPacket(account, publish, (account1, packet) -> {
|
request = mIqGenerator.deleteNode(Namespace.NICK);
|
||||||
if (packet.getType() == IqPacket.TYPE.ERROR) {
|
} else {
|
||||||
Log.d(Config.LOGTAG, account1.getJid().asBareJid() + ": could not publish nick");
|
request = mIqGenerator.publishNick(displayName);
|
||||||
}
|
}
|
||||||
});
|
sendIqPacket(account, request, (account1, packet) -> {
|
||||||
}
|
if (packet.getType() == IqPacket.TYPE.ERROR) {
|
||||||
|
Log.d(Config.LOGTAG, account1.getJid().asBareJid() + ": unable to modify nick name "+packet.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceDiscoveryResult getCachedServiceDiscoveryResult(Pair<String, String> key) {
|
public ServiceDiscoveryResult getCachedServiceDiscoveryResult(Pair<String, String> key) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,6 +16,7 @@ public final class Namespace {
|
||||||
public static final String PUBSUB = "http://jabber.org/protocol/pubsub";
|
public static final String PUBSUB = "http://jabber.org/protocol/pubsub";
|
||||||
public static final String PUBSUB_PUBLISH_OPTIONS = PUBSUB+"#publish-options";
|
public static final String PUBSUB_PUBLISH_OPTIONS = PUBSUB+"#publish-options";
|
||||||
public static final String PUBSUB_ERROR = PUBSUB+"#errors";
|
public static final String PUBSUB_ERROR = PUBSUB+"#errors";
|
||||||
|
public static final String PUBSUB_OWNER = PUBSUB+"#owner";
|
||||||
public static final String NICK = "http://jabber.org/protocol/nick";
|
public static final String NICK = "http://jabber.org/protocol/nick";
|
||||||
public static final String FLEXIBLE_OFFLINE_MESSAGE_RETRIEVAL = "http://jabber.org/protocol/offline";
|
public static final String FLEXIBLE_OFFLINE_MESSAGE_RETRIEVAL = "http://jabber.org/protocol/offline";
|
||||||
public static final String BIND = "urn:ietf:params:xml:ns:xmpp-bind";
|
public static final String BIND = "urn:ietf:params:xml:ns:xmpp-bind";
|
||||||
|
|
|
@ -470,11 +470,53 @@
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/pgp_fingerprint_box"
|
android:id="@+id/your_name_box"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="32dp">
|
android:layout_marginTop="32dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toLeftOf="@+id/action_edit_your_name"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/your_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/no_name_set_instructions"
|
||||||
|
android:textAppearance="@style/TextAppearance.Conversations.Body1.Tertiary"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/your_name_desc"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/your_name"
|
||||||
|
android:textAppearance="@style/TextAppearance.Conversations.Caption"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/action_edit_your_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:alpha="?attr/icon_alpha"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:padding="@dimen/image_button_padding"
|
||||||
|
android:src="?attr/icon_edit_body"
|
||||||
|
android:visibility="visible"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/pgp_fingerprint_box"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="16dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -514,7 +556,7 @@
|
||||||
android:id="@+id/axolotl_fingerprint_box"
|
android:id="@+id/axolotl_fingerprint_box"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="24dp">
|
android:layout_marginTop="16dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -515,6 +515,9 @@
|
||||||
<string name="share_uri_with">Share URI with…</string>
|
<string name="share_uri_with">Share URI with…</string>
|
||||||
<string name="welcome_header" translatable="false">Join the Conversation</string>
|
<string name="welcome_header" translatable="false">Join the Conversation</string>
|
||||||
<string name="welcome_text">Jabber is a provider independent instant messaging network. You can use this client with what ever Jabber server you choose.\nHowever for your convenience we made it easy to create an account on conversations.im¹; a provider specially suited for the use with Conversations.</string>
|
<string name="welcome_text">Jabber is a provider independent instant messaging network. You can use this client with what ever Jabber server you choose.\nHowever for your convenience we made it easy to create an account on conversations.im¹; a provider specially suited for the use with Conversations.</string>
|
||||||
|
<string name="welcome_header_quicksy" translatable="false">Have some Quick Conversations</string>
|
||||||
|
<string name="welcome_text_quicksy"><![CDATA[Quicksy is a spin off of the popular Jabber/XMPP client Conversations with automatic contact discovery.<br><br>You sign up with your phone number and Quicksy will automatically—based on the phone numbers in your address book—suggest possible contacts to you.<br><br>By signing up you agree to our <a href="https://quicksy.im/#privacy">privacy policy</a>.]]></string>
|
||||||
|
<string name="agree_and_continue">Agree & continue</string>
|
||||||
<string name="magic_create_text">We will guide you through the process of creating an account on conversations.im.¹\nWhen picking conversations.im as a provider you will be able to communicate with users of other providers by giving them your full Jabber ID.</string>
|
<string name="magic_create_text">We will guide you through the process of creating an account on conversations.im.¹\nWhen picking conversations.im as a provider you will be able to communicate with users of other providers by giving them your full Jabber ID.</string>
|
||||||
<string name="your_full_jid_will_be">Your full Jabber ID will be: %s</string>
|
<string name="your_full_jid_will_be">Your full Jabber ID will be: %s</string>
|
||||||
<string name="create_account">Create Account</string>
|
<string name="create_account">Create Account</string>
|
||||||
|
@ -789,4 +792,9 @@
|
||||||
<string name="too_many_attempts">Too many attempts</string>
|
<string name="too_many_attempts">Too many attempts</string>
|
||||||
<string name="the_app_is_out_of_date">You are using an out of date version of this app.</string>
|
<string name="the_app_is_out_of_date">You are using an out of date version of this app.</string>
|
||||||
<string name="update">Update</string>
|
<string name="update">Update</string>
|
||||||
|
<string name="logged_in_with_another_device">This phone number is currently logged in with another device.</string>
|
||||||
|
<string name="enter_your_name_instructions">Please enter your name to let people, who don’t have you in their address books, know who you are.</string>
|
||||||
|
<string name="your_name">Your name</string>
|
||||||
|
<string name="enter_your_name">Enter your name</string>
|
||||||
|
<string name="no_name_set_instructions">Use the edit button to set your name.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -80,6 +80,10 @@
|
||||||
<item name="android:textColor">?android:textColorSecondary</item>
|
<item name="android:textColor">?android:textColorSecondary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.Conversations.Body1.Tertiary" parent="TextAppearance.Conversations.Body1">
|
||||||
|
<item name="android:textColor">?android:textColorTertiary</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.Conversations.Fingerprint" parent="TextAppearance.Conversations.Body1">
|
<style name="TextAppearance.Conversations.Fingerprint" parent="TextAppearance.Conversations.Body1">
|
||||||
<item name="android:fontFamily" tools:targetApi="jelly_bean">monospace</item>
|
<item name="android:fontFamily" tools:targetApi="jelly_bean">monospace</item>
|
||||||
<item name="android:typeface">monospace</item>
|
<item name="android:typeface">monospace</item>
|
||||||
|
|
|
@ -19,5 +19,15 @@
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:label="@string/verify_your_phone_number"/>
|
android:label="@string/verify_your_phone_number"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.TosActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:label="@string/app_name"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.EnterNameActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:label="@string/enter_your_name"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.databinding.DataBindingUtil;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.databinding.ActivityEnterNameBinding;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.utils.AccountUtils;
|
||||||
|
|
||||||
|
public class EnterNameActivity extends XmppActivity {
|
||||||
|
|
||||||
|
private ActivityEnterNameBinding binding;
|
||||||
|
|
||||||
|
private Account account;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_enter_name);
|
||||||
|
setSupportActionBar((Toolbar) this.binding.toolbar);
|
||||||
|
this.binding.next.setOnClickListener(this::next);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void next(View view) {
|
||||||
|
if (account != null) {
|
||||||
|
|
||||||
|
String name = this.binding.name.getText().toString().trim();
|
||||||
|
|
||||||
|
account.setDisplayName(name);
|
||||||
|
|
||||||
|
xmppConnectionService.publishDisplayName(account);
|
||||||
|
|
||||||
|
Intent intent = new Intent(this, PublishProfilePictureActivity.class);
|
||||||
|
intent.putExtra(PublishProfilePictureActivity.EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
|
||||||
|
intent.putExtra("setup", true);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshUiReal() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void onBackendConnected() {
|
||||||
|
this.account = AccountUtils.getFirst(xmppConnectionService);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.text.Html;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.utils.XmppUri;
|
||||||
|
|
||||||
|
public class TosActivity extends XmppActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void refreshUiReal() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void onBackendConnected() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
final int theme = findTheme();
|
||||||
|
if (this.mTheme != theme) {
|
||||||
|
recreate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNewIntent(Intent intent) {
|
||||||
|
if (intent != null) {
|
||||||
|
setIntent(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
|
if (getResources().getBoolean(R.bool.portrait_only)) {
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_tos);
|
||||||
|
setSupportActionBar(findViewById(R.id.toolbar));
|
||||||
|
final ActionBar ab = getSupportActionBar();
|
||||||
|
if (ab != null) {
|
||||||
|
ab.setDisplayShowHomeEnabled(false);
|
||||||
|
ab.setDisplayHomeAsUpEnabled(false);
|
||||||
|
}
|
||||||
|
final Button agreeButton = findViewById(R.id.agree);
|
||||||
|
final TextView welcomeText = findViewById(R.id.welcome_text);
|
||||||
|
agreeButton.setOnClickListener(v -> {
|
||||||
|
final Intent intent = new Intent(this, EnterPhoneNumberActivity.class);
|
||||||
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
preferences.edit().putBoolean("tos", true).apply();
|
||||||
|
addInviteUri(intent);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
});
|
||||||
|
welcomeText.setText(Html.fromHtml(getString(R.string.welcome_text_quicksy)));
|
||||||
|
welcomeText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addInviteUri(Intent intent) {
|
||||||
|
StartConversationActivity.addInviteUri(intent, getIntent());
|
||||||
|
}
|
||||||
|
}
|
|
@ -269,9 +269,7 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP
|
||||||
|
|
||||||
private void performPostVerificationRedirect() {
|
private void performPostVerificationRedirect() {
|
||||||
if (redirectInProgress.compareAndSet(false, true)) {
|
if (redirectInProgress.compareAndSet(false, true)) {
|
||||||
Intent intent = new Intent(this, PublishProfilePictureActivity.class);
|
Intent intent = new Intent(this, EnterNameActivity.class);
|
||||||
intent.putExtra(PublishProfilePictureActivity.EXTRA_ACCOUNT, account.getJid().asBareJid().toEscapedString());
|
|
||||||
intent.putExtra("setup", true);
|
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,9 @@ public class ApiDialogHelper {
|
||||||
case 403:
|
case 403:
|
||||||
res = R.string.the_app_is_out_of_date;
|
res = R.string.the_app_is_out_of_date;
|
||||||
break;
|
break;
|
||||||
|
case 409:
|
||||||
|
res = R.string.logged_in_with_another_device;
|
||||||
|
break;
|
||||||
case 500:
|
case 500:
|
||||||
res = R.string.something_went_wrong_processing_your_request;
|
res = R.string.something_went_wrong_processing_your_request;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,6 +2,8 @@ package eu.siacs.conversations.utils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
|
@ -9,6 +11,7 @@ import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.ui.ConversationsActivity;
|
import eu.siacs.conversations.ui.ConversationsActivity;
|
||||||
import eu.siacs.conversations.ui.EnterPhoneNumberActivity;
|
import eu.siacs.conversations.ui.EnterPhoneNumberActivity;
|
||||||
import eu.siacs.conversations.ui.StartConversationActivity;
|
import eu.siacs.conversations.ui.StartConversationActivity;
|
||||||
|
import eu.siacs.conversations.ui.TosActivity;
|
||||||
import eu.siacs.conversations.ui.VerifyActivity;
|
import eu.siacs.conversations.ui.VerifyActivity;
|
||||||
|
|
||||||
public class SignupUtils {
|
public class SignupUtils {
|
||||||
|
@ -28,7 +31,12 @@ public class SignupUtils {
|
||||||
intent = new Intent(activity, StartConversationActivity.class);
|
intent = new Intent(activity, StartConversationActivity.class);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
intent = getSignUpIntent(activity);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||||
|
if (preferences.getBoolean("tos",false)) {
|
||||||
|
intent = getSignUpIntent(activity);
|
||||||
|
} else {
|
||||||
|
intent = new Intent(activity, TosActivity.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include android:id="@+id/toolbar" layout="@layout/toolbar" />
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/instructions"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:textAppearance="@style/TextAppearance.Conversations.Body1"
|
||||||
|
android:text="@string/enter_your_name_instructions"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/name_box"
|
||||||
|
android:layout_width="256dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@+id/next"
|
||||||
|
android:layout_below="@+id/instructions"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:imeOptions="flagNoExtractUi"
|
||||||
|
android:id="@+id/name"
|
||||||
|
style="@style/Widget.Conversations.EditText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="@string/your_name"
|
||||||
|
android:longClickable="false" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/next"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
style="@style/Widget.Conversations.Button.Borderless"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/next"
|
||||||
|
android:textColor="?colorAccent"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include layout="@layout/toolbar" />
|
||||||
|
|
||||||
|
<ScrollView android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true">
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/color_background_primary">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:minHeight="256dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
|
android:paddingBottom="16dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/welcome_header_quicksy"
|
||||||
|
android:textAppearance="@style/TextAppearance.Conversations.Title"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/welcome_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="@string/welcome_text_quicksy"
|
||||||
|
android:textAppearance="@style/TextAppearance.Conversations.Body1"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/agree"
|
||||||
|
style="@style/Widget.Conversations.Button.Borderless"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:text="@string/agree_and_continue"
|
||||||
|
android:textColor="?colorAccent"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_above="@+id/linearLayout"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:src="@drawable/main_logo"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</LinearLayout>
|
Loading…
Reference in New Issue