Further Lokify UI

This commit is contained in:
Niels Andriesse 2019-07-18 15:59:41 +10:00
parent 8867f3d471
commit 3a8d509c1e
8 changed files with 114 additions and 9 deletions

View File

@ -447,6 +447,10 @@
android:windowSoftInputMode="stateUnchanged" android:windowSoftInputMode="stateUnchanged"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".loki.NewConversationActivity"
android:windowSoftInputMode="stateAlwaysVisible"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<service android:enabled="true" android:name="org.thoughtcrime.securesms.service.WebRtcCallService"/> <service android:enabled="true" android:name="org.thoughtcrime.securesms.service.WebRtcCallService"/>
<service android:enabled="true" android:name=".service.ApplicationMigrationService"/> <service android:enabled="true" android:name=".service.ApplicationMigrationService"/>
<service android:enabled="true" android:exported="false" android:name=".service.KeyCachingService"/> <service android:enabled="true" android:exported="false" android:name=".service.KeyCachingService"/>

View File

@ -171,7 +171,7 @@ dependencies {
testImplementation 'org.robolectric:shadows-multidex:4.2' testImplementation 'org.robolectric:shadows-multidex:4.2'
// Loki // Loki
implementation "com.github.loki-project:loki-messenger-android-core:master-SNAPSHOT" implementation "com.github.loki-project:loki-messenger-android-service:master-SNAPSHOT"
implementation "org.signal:signal-metadata-android:0.0.3" implementation "org.signal:signal-metadata-android:0.0.3"
implementation "com.google.protobuf:protobuf-java:2.5.0" implementation "com.google.protobuf:protobuf-java:2.5.0"
implementation "com.googlecode.libphonenumber:libphonenumber:8.10.7" implementation "com.googlecode.libphonenumber:libphonenumber:8.10.7"

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:background="@color/white"
android:orientation="vertical">
<org.thoughtcrime.securesms.components.LabeledEditText
android:id="@+id/publicKeyEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
app:labeledEditText_background="@color/white"
app:labeledEditText_label="@string/activity_new_conversation_public_key_edit_text_label"/>
<TextView
android:id="@+id/explanationTextView"
style="@style/Signal.Text.Body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/activity_new_conversation_public_key_explanation" />
<com.dd.CircularProgressButton
android:id="@+id/nextButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="24dp"
android:layout_gravity="center_horizontal"
android:background="@color/signal_primary"
android:textColor="@color/white"
app:cpb_colorIndicator="@color/white"
app:cpb_colorProgress="@color/textsecure_primary"
app:cpb_cornerRadius="4dp"
app:cpb_selectorIdle="@drawable/progress_button_state"
app:cpb_textIdle="@string/activity_new_conversation_button_title" />
</LinearLayout>

View File

@ -31,7 +31,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
tools:src="@drawable/conversation_list_empty_state" /> tools:src="@drawable/conversation_list_empty_state"
android:visibility="gone" />
<TextView android:layout_width="match_parent" <TextView android:layout_width="match_parent"
@ -41,7 +42,7 @@
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginBottom="20dp" android:layout_marginBottom="20dp"
style="@style/Signal.Text.Body" style="@style/Signal.Text.Body"
android:text="@string/conversation_list_fragment__give_your_inbox_something_to_write_home_about_get_started_by_messaging_a_friend" android:text="@string/activity_conversation_list_empty_state_message"
android:gravity="center" /> android:gravity="center" />
</LinearLayout> </LinearLayout>

View File

@ -1335,12 +1335,10 @@
<string name="conversation_list_item_inbox_zero__inbox_zeeerrro">Inbox zeeerrro</string> <string name="conversation_list_item_inbox_zero__inbox_zeeerrro">Inbox zeeerrro</string>
<string name="conversation_list_item_inbox_zero__zip_zilch_zero_nada_nyou_re_all_caught_up">Zip. Zilch. Zero. Nada.\nYou\'re all caught up!</string> <string name="conversation_list_item_inbox_zero__zip_zilch_zero_nada_nyou_re_all_caught_up">Zip. Zilch. Zero. Nada.\nYou\'re all caught up!</string>
<!-- conversation_list_fragment --> <!-- conversation_list_fragment -->
<string name="conversation_list_fragment__fab_content_description">New conversation</string> <string name="conversation_list_fragment__fab_content_description">New conversation</string>
<string name="conversation_list_fragment__give_your_inbox_something_to_write_home_about_get_started_by_messaging_a_friend">Give your inbox something to write home about. Get started by messaging a friend.</string> <string name="conversation_list_fragment__give_your_inbox_something_to_write_home_about_get_started_by_messaging_a_friend">Give your inbox something to write home about. Get started by messaging a friend.</string>
<!-- conversation_secure_verified --> <!-- conversation_secure_verified -->
<string name="conversation_secure_verified__menu_reset_secure_session">Reset secure session</string> <string name="conversation_secure_verified__menu_reset_secure_session">Reset secure session</string>
@ -1539,6 +1537,8 @@
<string name="activity_key_pair_mnemonic_copied_message">Copied to Clipboard</string> <string name="activity_key_pair_mnemonic_copied_message">Copied to Clipboard</string>
<string name="activity_key_pair_register_or_restore_button_title_1">Register</string> <string name="activity_key_pair_register_or_restore_button_title_1">Register</string>
<string name="activity_key_pair_register_or_restore_button_title_2">Restore</string> <string name="activity_key_pair_register_or_restore_button_title_2">Restore</string>
<!-- Conversation list activity -->
<string name="activity_conversation_list_empty_state_message">Looks like you don\'t have any conversations yet. Get started by messaging a friend.</string>
<!-- Settings activity --> <!-- Settings activity -->
<string name="activity_settings_share_public_key_button_title">Share Public Key</string> <string name="activity_settings_share_public_key_button_title">Share Public Key</string>
<string name="activity_settings_show_seed_button_title">Show Seed</string> <string name="activity_settings_show_seed_button_title">Show Seed</string>
@ -1556,6 +1556,10 @@
<!-- Contact selection activity --> <!-- Contact selection activity -->
<string name="activity_contact_selection_search_bar_placeholder">Search by name or public key</string> <string name="activity_contact_selection_search_bar_placeholder">Search by name or public key</string>
<!-- New conversation activity --> <!-- New conversation activity -->
<string name="activity_new_conversation_title">New Conversation</string>
<string name="activity_new_conversation_public_key_edit_text_label">Public Key</string>
<string name="activity_new_conversation_public_key_explanation">Enter the public key of the person you\'d like to securely message. They can share their public key with you by going into Loki Messenger\'s in-app settings and clicking "Share Public Key".</string>
<string name="activity_new_conversation_button_title">Next</string>
<string name="activity_new_conversation_invalid_public_key_message">Invalid Public Key</string> <string name="activity_new_conversation_invalid_public_key_message">Invalid Public Key</string>
<!-- Friend request view --> <!-- Friend request view -->
<string name="view_friend_request_accept_button_title">Accept</string> <string name="view_friend_request_accept_button_title">Accept</string>

View File

@ -74,6 +74,7 @@ import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
import org.thoughtcrime.securesms.database.loaders.ConversationListLoader; import org.thoughtcrime.securesms.database.loaders.ConversationListLoader;
import org.thoughtcrime.securesms.events.ReminderUpdateEvent; import org.thoughtcrime.securesms.events.ReminderUpdateEvent;
import org.thoughtcrime.securesms.jobs.ServiceOutageDetectionJob; import org.thoughtcrime.securesms.jobs.ServiceOutageDetectionJob;
import org.thoughtcrime.securesms.loki.NewConversationActivity;
import org.thoughtcrime.securesms.mms.GlideApp; import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.notifications.MarkReadReceiver; import org.thoughtcrime.securesms.notifications.MarkReadReceiver;
import org.thoughtcrime.securesms.notifications.MessageNotifier; import org.thoughtcrime.securesms.notifications.MessageNotifier;
@ -360,7 +361,7 @@ public class ConversationListFragment extends Fragment
public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) { public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) {
if ((cursor == null || cursor.getCount() <= 0) && TextUtils.isEmpty(queryFilter) && !archive) { if ((cursor == null || cursor.getCount() <= 0) && TextUtils.isEmpty(queryFilter) && !archive) {
list.setVisibility(View.INVISIBLE); list.setVisibility(View.INVISIBLE);
emptyState.setVisibility(View.GONE); emptyState.setVisibility(View.VISIBLE);
emptySearch.setVisibility(View.INVISIBLE); emptySearch.setVisibility(View.INVISIBLE);
emptyImage.setImageResource(EMPTY_IMAGES[(int) (Math.random() * EMPTY_IMAGES.length)]); emptyImage.setImageResource(EMPTY_IMAGES[(int) (Math.random() * EMPTY_IMAGES.length)]);
fab.startPulse(3 * 1000); fab.startPulse(3 * 1000);

View File

@ -7,13 +7,13 @@ import android.os.Bundle;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import org.thoughtcrime.securesms.conversation.ConversationActivity;
import org.thoughtcrime.securesms.logging.Log;
import android.widget.Toast; import android.widget.Toast;
import org.thoughtcrime.securesms.conversation.ConversationActivity;
import org.thoughtcrime.securesms.database.Address; import org.thoughtcrime.securesms.database.Address;
import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.loki.NewConversationActivity;
import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.Rfc5724Uri; import org.thoughtcrime.securesms.util.Rfc5724Uri;

View File

@ -0,0 +1,53 @@
package org.thoughtcrime.securesms.loki
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_new_conversation.*
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.conversation.ConversationActivity
import org.thoughtcrime.securesms.database.Address
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.database.ThreadDatabase
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.util.DynamicTheme
import org.whispersystems.signalservice.loki.utilities.PublicKeyValidation
class NewConversationActivity : PassphraseRequiredActionBarActivity() {
private val dynamicTheme = DynamicTheme()
override fun onPreCreate() {
dynamicTheme.onCreate(this)
}
override fun onCreate(bundle: Bundle?, isReady: Boolean) {
setContentView(R.layout.activity_new_conversation)
supportActionBar!!.setTitle(R.string.activity_new_conversation_title)
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
nextButton.setOnClickListener { startNewConversationIfPossible() }
}
public override fun onResume() {
super.onResume()
dynamicTheme.onResume(this)
}
private fun startNewConversationIfPossible() {
val hexEncodedPublicKey = publicKeyEditText.text.toString().trim()
if (PublicKeyValidation.isValid(hexEncodedPublicKey)) {
val contact = Recipient.from(this, Address.fromSerialized(hexEncodedPublicKey), true)
val intent = Intent(this, ConversationActivity::class.java)
intent.putExtra(ConversationActivity.ADDRESS_EXTRA, contact.address)
intent.putExtra(ConversationActivity.TEXT_EXTRA, getIntent().getStringExtra(ConversationActivity.TEXT_EXTRA))
intent.setDataAndType(getIntent().data, getIntent().type)
val existingThread = DatabaseFactory.getThreadDatabase(this).getThreadIdIfExistsFor(contact)
intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, existingThread)
intent.putExtra(ConversationActivity.DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT)
startActivity(intent)
finish()
} else {
Toast.makeText(this, R.string.activity_new_conversation_invalid_public_key_message, Toast.LENGTH_SHORT).show()
}
}
}