Address first round of review comments

This commit is contained in:
Torsten Grote
2018-05-28 16:11:30 -03:00
parent 3c6b43b2bd
commit dee0ca238b
21 changed files with 144 additions and 130 deletions

View File

@@ -86,9 +86,8 @@ public class ShowQrCodeFragment extends BaseEventFragment
private CameraView cameraView;
private View statusView;
private TextView status;
private View qrCodeContainer;
private ImageView qrCode;
private TextView mainProgressTitle;
private ViewGroup mainProgressContainer;
private boolean fullscreen = false;
private boolean gotRemotePayload;
@@ -131,12 +130,10 @@ public class ShowQrCodeFragment extends BaseEventFragment
cameraView = view.findViewById(R.id.camera_view);
statusView = view.findViewById(R.id.status_container);
status = view.findViewById(R.id.connect_status);
qrCodeContainer = view.findViewById(R.id.qr_code_container);
qrCode = view.findViewById(R.id.qr_code);
mainProgressTitle = view.findViewById(R.id.title_progress_bar);
mainProgressContainer = view.findViewById(R.id.container_progress);
ImageView fullscreenButton = view.findViewById(R.id.fullscreen_button);
fullscreenButton.setOnClickListener(v -> {
View qrCodeContainer = view.findViewById(R.id.qr_code_container);
LinearLayout cameraOverlay = view.findViewById(R.id.camera_overlay);
LayoutParams statusParams, qrCodeParams;
if (fullscreen) {
@@ -303,8 +300,8 @@ public class ShowQrCodeFragment extends BaseEventFragment
keyAgreementAborted(event.didRemoteAbort());
} else if (e instanceof KeyAgreementFinishedEvent) {
runOnUiThreadUnlessDestroyed(() -> {
mainProgressContainer.setVisibility(VISIBLE);
mainProgressTitle.setText(R.string.exchanging_contact_details);
statusView.setVisibility(VISIBLE);
status.setText(R.string.exchanging_contact_details);
});
}
}
@@ -363,16 +360,18 @@ public class ShowQrCodeFragment extends BaseEventFragment
private void keyAgreementStarted() {
runOnUiThreadUnlessDestroyed(() -> {
mainProgressContainer.setVisibility(VISIBLE);
mainProgressTitle.setText(R.string.authenticating_with_device);
qrCodeContainer.setVisibility(INVISIBLE);
statusView.setVisibility(VISIBLE);
status.setText(R.string.authenticating_with_device);
});
}
private void keyAgreementAborted(boolean remoteAborted) {
runOnUiThreadUnlessDestroyed(() -> {
reset();
mainProgressContainer.setVisibility(INVISIBLE);
mainProgressTitle.setText("");
qrCodeContainer.setVisibility(VISIBLE);
statusView.setVisibility(INVISIBLE);
status.setText(null);
// TODO show abort somewhere persistent?
Toast.makeText(getActivity(),
remoteAborted ? R.string.connection_aborted_remote :

View File

@@ -107,6 +107,7 @@ public class PasswordActivity extends BaseActivity {
private void deleteAccount() {
passwordController.deleteAccount(this);
Localizer.reinitialize();
UiUtils.setTheme(this, getString(R.string.pref_theme_light_value));
setResult(RESULT_CANCELED);
Intent i = new Intent(this, SetupActivity.class);
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);

View File

@@ -63,7 +63,7 @@ public abstract class BaseThreadItemViewHolder<I extends ThreadItem>
ValueAnimator anim = new ValueAnimator();
int viewColor = getColor(getContext(), R.color.thread_item_highlight);
anim.setIntValues(viewColor,
getColor(getContext(), R.color.window_background));
getColor(getContext(), R.color.thread_item_background));
anim.setEvaluator(new ArgbEvaluator());
anim.setInterpolator(new AccelerateInterpolator());
anim.addListener(new Animator.AnimatorListener() {

View File

@@ -7,6 +7,9 @@ import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.PowerManager;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
@@ -20,6 +23,7 @@ import android.text.format.DateUtils;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.URLSpan;
import android.util.TypedValue;
import android.view.View;
import android.widget.TextView;
@@ -212,4 +216,17 @@ public class UiUtils {
}
}
public static int resolveAttribute(Context ctx, @AttrRes int attr) {
TypedValue outValue = new TypedValue();
ctx.getTheme().resolveAttribute(attr, outValue, true);
return outValue.resourceId;
}
@ColorInt
public static int resolveColorAttribute(Context ctx, @AttrRes int res) {
@ColorRes
int color = resolveAttribute(ctx, res);
return ContextCompat.getColor(ctx, color);
}
}

View File

@@ -6,7 +6,6 @@ import android.graphics.Typeface;
import android.support.annotation.DimenRes;
import android.support.annotation.UiThread;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
@@ -28,6 +27,7 @@ import static android.graphics.Typeface.BOLD;
import static android.util.TypedValue.COMPLEX_UNIT_PX;
import static org.briarproject.bramble.api.identity.Author.Status.NONE;
import static org.briarproject.bramble.api.identity.Author.Status.OURSELVES;
import static org.briarproject.briar.android.util.UiUtils.resolveAttribute;
@UiThread
public class AuthorView extends RelativeLayout {
@@ -107,16 +107,15 @@ public class AuthorView extends RelativeLayout {
public void setAuthorClickable(OnClickListener listener) {
setClickable(true);
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(
android.R.attr.selectableItemBackground, outValue, true);
setBackgroundResource(outValue.resourceId);
int res =
resolveAttribute(getContext(), R.attr.selectableItemBackground);
setBackgroundResource(res);
setOnClickListener(listener);
}
public void setAuthorNotClickable() {
setClickable(false);
setBackgroundResource(android.R.color.transparent);
setBackgroundResource(0);
setOnClickListener(null);
}

View File

@@ -6,17 +6,15 @@ import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.UiThread;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import org.briarproject.briar.R;
import javax.annotation.Nullable;
import static android.graphics.Paint.ANTI_ALIAS_FLAG;
import static android.graphics.Paint.Align.CENTER;
import static android.graphics.Paint.FILTER_BITMAP_FLAG;
import static org.briarproject.briar.android.util.UiUtils.resolveColorAttribute;
@UiThread
public class EmojiView extends View implements Drawable.Callback {
@@ -63,8 +61,9 @@ public class EmojiView extends View implements Drawable.Callback {
float targetFontSize =
0.75f * getHeight() - getPaddingTop() - getPaddingBottom();
paint.setTextSize(targetFontSize);
paint.setColor(ContextCompat
.getColor(getContext(), R.color.emoji_text_color));
int color = resolveColorAttribute(getContext(),
android.R.attr.textColorPrimary);
paint.setColor(color);
paint.setTextAlign(CENTER);
int xPos = (canvas.getWidth() / 2);
int yPos = (int) ((canvas.getHeight() / 2) -

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="?attr/colorControlNormal"
android:state_enabled="false"/>
<item
android:color="#ffffffff"/>
</selector>

View File

@@ -6,7 +6,7 @@
android:viewportWidth="24">
<path
android:fillColor="#ffffff"
android:fillColor="#abffffff"
android:pathData="M12,2 C6.48,2,2,6.48,2,12 S6.48,22,12,22 S22,17.52,22,12 S17.52,2,12,2 Z M12,20
C7.58,20,4,16.42,4,12 S7.58,4,12,4 S20,7.58,20,12 S16.42,20,12,20 Z"/>

View File

@@ -4,6 +4,6 @@
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#ffffff"
android:fillColor="#abffffff"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm0,18c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
</vector>

View File

@@ -12,7 +12,7 @@
android:bottom="1px"/>
<solid
android:color="@color/briar_primary"/>
android:color="@color/briar_accent"/>
<stroke
android:color="@color/briar_text_primary_inverse"

View File

@@ -1,4 +1,9 @@
<vector android:height="48dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M7,14L5,14v5h5v-2L7,17v-3zM5,10h2L7,7h3L10,5L5,5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2L19,5h-5z"/>
</vector>

View File

@@ -2,6 +2,10 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/thread_item_background"
android:state_activated="false"/>
<item
android:drawable="@color/thread_item_highlight"
android:state_activated="true"/>

View File

@@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/errorIcon"
android:layout_width="128dp"
android:layout_height="128dp"
@@ -14,10 +14,10 @@
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:src="@drawable/alerts_and_states_error"
android:tint="?attr/colorControlNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/colorControlNormal"
tools:ignore="ContentDescription"/>
<TextView

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -14,19 +15,19 @@
android:id="@+id/camera_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:baselineAligned="false">
android:baselineAligned="false"
android:orientation="vertical">
<LinearLayout
android:id="@+id/status_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@android:color/background_light"
android:gravity="center"
android:orientation="vertical"
android:padding="@dimen/margin_medium"
android:visibility="invisible">
android:visibility="invisible"
tools:visibility="visible">
<ProgressBar
style="?android:attr/progressBarStyleLarge"
@@ -65,46 +66,22 @@
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:contentDescription="@string/qr_code"
android:scaleType="fitCenter"/>
android:scaleType="fitCenter"
tools:src="@drawable/startup_lock"/>
<ImageView
android:id="@+id/fullscreen_button"
android:background="?selectableItemBackground"
android:src="@drawable/ic_fullscreen_black_48dp"
android:alpha="0.54"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_small"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:contentDescription="@string/show_qr_code_fullscreen"/>
android:layout_alignParentRight="true"
android:layout_margin="@dimen/margin_small"
android:alpha="0.54"
android:background="?selectableItemBackground"
android:contentDescription="@string/show_qr_code_fullscreen"
android:src="@drawable/ic_fullscreen_black_48dp"/>
</RelativeLayout>
</FrameLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/container_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:visibility="invisible">
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/title_progress_bar"
android:layout_centerHorizontal="true"/>
<TextView
android:id="@+id/title_progress_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:paddingTop="@dimen/margin_large"
tools:text="@string/waiting_for_contact_to_scan"/>
</RelativeLayout>
</FrameLayout>

View File

@@ -1,6 +1,7 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -48,7 +49,7 @@
android:textSize="@dimen/text_size_tiny"
tools:text="Dec 24, 13:37"/>
<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -56,7 +57,7 @@
android:layout_marginLeft="@dimen/margin_medium"
android:layout_toEndOf="@+id/time"
android:layout_toRightOf="@+id/time"
android:tint="?attr/colorControlNormal"
app:tint="?attr/colorControlNormal"
tools:ignore="ContentDescription"
tools:src="@drawable/message_delivered"/>

View File

@@ -18,17 +18,17 @@
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/setup_huawei_text"/>
<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/checkImage"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="8dp"
android:src="@drawable/ic_check_white"
android:tint="?attr/colorControlNormal"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button"
app:tint="?attr/colorControlNormal"
tools:ignore="ContentDescription"/>
<Button

View File

@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="@color/briar_blue_light"/>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="@color/preference_category"
tools:text="This is a category"/>

View File

@@ -11,54 +11,46 @@
style="@style/Divider.Horizontal"
android:layout_alignParentTop="true"/>
<android.support.v7.widget.CardView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="0dp"
app:cardUseCompatPadding="false"
app:elevation="0dp">
android:background="@color/card_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
android:id="@+id/emoji_toggle"
android:layout_width="@dimen/text_input_height"
android:layout_height="@dimen/text_input_height"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/margin_small"
android:scaleType="center"
app:tint="?attr/colorControlNormal"/>
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
android:id="@+id/emoji_toggle"
android:layout_width="@dimen/text_input_height"
android:layout_height="@dimen/text_input_height"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/margin_small"
android:scaleType="center"
app:tint="?attr/colorControlNormal"/>
<org.thoughtcrime.securesms.components.emoji.EmojiEditText
android:id="@+id/input_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="3"
android:minHeight="@dimen/text_input_height"
android:textColor="?android:attr/textColorPrimary"
android:textColorHint="?android:attr/textColorTertiary"/>
<org.thoughtcrime.securesms.components.emoji.EmojiEditText
android:id="@+id/input_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="3"
android:minHeight="@dimen/text_input_height"
android:textColor="?android:attr/textColorPrimary"
android:textColorHint="?android:attr/textColorTertiary"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/btn_send"
android:layout_width="@dimen/text_input_height"
android:layout_height="@dimen/text_input_height"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:contentDescription="@string/send"
android:enabled="false"
android:focusable="true"
android:padding="@dimen/margin_small"
android:src="@drawable/social_send_now_white"
app:tint="@color/briar_accent"/>
<ImageButton
android:id="@+id/btn_send"
android:layout_width="@dimen/text_input_height"
android:layout_height="@dimen/text_input_height"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:contentDescription="@string/send"
android:enabled="false"
android:focusable="true"
android:padding="@dimen/margin_small"
android:src="@drawable/social_send_now_white"
android:tint="@color/briar_accent"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
android:id="@+id/emoji_drawer"

View File

@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="briar_accent">#476380</color>
<color name="briar_accent">@color/briar_blue_light2</color>
<color name="preference_category">@color/briar_blue_light2</color>
<color name="color_primary">#ffffff</color>
<color name="color_primary_inverse">#dd000000</color>
<color name="color_secondary">#b2ffffff</color>
<color name="window_background">#ff303030</color>
<color name="thread_item_highlight">#2D3E50</color>
<color name="card_background">@color/cardview_dark_background</color>
<color name="divider">#666666</color>
<color name="thread_item_background">@color/window_background</color>
<color name="thread_item_highlight">#000000</color>
</resources>

View File

@@ -3,11 +3,12 @@
<color name="briar_blue">#2D3E50</color>
<color name="briar_blue_dark">#0F1720</color>
<color name="briar_blue_light">#4F6C8C</color>
<color name="briar_gold">#FCCF1C</color>
<color name="briar_blue_light2">#5a7da3</color>
<color name="briar_green_light">#95D220</color>
<color name="briar_link">#06B9FF</color>
<color name="window_background">#fffafafa</color>
<color name="card_background">@color/cardview_light_background</color>
<color name="action_bar_text">#FFFFFF</color>
<color name="button_bar_background">#FFFFFF</color>
<color name="private_message_date">#AAAAAA</color>
@@ -32,17 +33,19 @@
<color name="briar_text_secondary_inverse">#b4ffffff</color>
<color name="briar_text_tertiary">#61000000</color>
<color name="briar_text_tertiary_inverse">#80ffffff</color>
<color name="preference_category">@color/briar_blue_light</color>
<color name="briar_button_positive">@color/briar_link</color>
<color name="briar_button_negative">#ff0000</color>
<color name="briar_warning_background">#ff0000</color>
<color name="emoji_text_color">#ff000000</color>
<color name="emoji_pager_background">@color/window_background</color>
<color name="thread_indicator">#9e9e9e</color>
<color name="thread_item_background">#eceff1</color>
<color name="thread_item_highlight">#ffffff</color>
<color name="divider">#c1c1c1</color>
<color name="menu_background">#FFFFFF</color>
<color name="spinner_border">#61000000</color> <!-- 38% Black -->
<color name="thread_item_highlight">#729ecc</color>
</resources>

View File

@@ -32,7 +32,7 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:padding">@dimen/margin_large</item>
<item name="android:textColor">@color/briar_text_primary_inverse</item>
<item name="android:textColor">@color/button_text</item>
</style>
<style name="BriarButtonFlat.Negative" parent="Widget.AppCompat.Button.Borderless">
@@ -73,7 +73,7 @@
<style name="BriarAvatar">
<item name="civ_border_width">@dimen/avatar_border_width</item>
<item name="civ_border_color">?android:attr/textColorPrimary</item>
<item name="civ_border_color">?android:attr/textColorSecondary</item>
</style>
<style name="NavMenuButton" parent="Widget.AppCompat.Button.Borderless.Colored">