mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Address first round of review comments
This commit is contained in:
@@ -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 :
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) -
|
||||
|
||||
Reference in New Issue
Block a user