mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 23:23:39 +00:00
parent
23a2a5e5f3
commit
2f568c6400
5
res/drawable/light_touch_highlight_background.xml
Normal file
5
res/drawable/light_touch_highlight_background.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:state_pressed="true" android:drawable="@color/light_button_highlight" />
|
||||||
|
<item android:drawable="@color/light_button" />
|
||||||
|
</selector>
|
@ -1,62 +1,78 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/container"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
android:orientation="vertical"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:background="?reminder_header_background">
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
<LinearLayout android:id="@+id/reminder"
|
<LinearLayout android:id="@+id/container"
|
||||||
android:layout_width="0dp"
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:gravity="center_vertical"
|
||||||
android:layout_margin="10dp"
|
android:background="?reminder_header_background">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView android:id="@+id/reminder_title"
|
<LinearLayout android:id="@+id/reminder"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/white"
|
android:layout_weight="1"
|
||||||
android:textSize="16sp"
|
android:layout_margin="10dp"
|
||||||
tools:text="@string/reminder_header_push_title" />
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView android:id="@+id/reminder_text"
|
<TextView android:id="@+id/reminder_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="sans-serif-light"
|
android:layout_marginBottom="5dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp"
|
android:textSize="18sp"/>
|
||||||
tools:text="@string/reminder_header_push_text" />
|
|
||||||
|
<TextView android:id="@+id/reminder_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="right"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="top">
|
||||||
|
|
||||||
|
<ImageButton android:id="@+id/cancel"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:background="@drawable/touch_highlight_background"
|
||||||
|
android:src="@drawable/ic_menu_remove_holo_light"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="bottom">
|
||||||
|
|
||||||
|
<Button android:id="@+id/ok"
|
||||||
|
android:layout_width="60sp"
|
||||||
|
android:layout_height="40sp"
|
||||||
|
android:gravity="center_vertical|center_horizontal"
|
||||||
|
android:background="@drawable/light_touch_highlight_background"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:clickable="false"
|
||||||
|
android:text="@string/yes"
|
||||||
|
android:padding="2dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView android:id="@+id/cancel"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:fontFamily="sans-serif-medium"
|
|
||||||
android:paddingLeft="6dp"
|
|
||||||
android:paddingRight="6dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:textColor="#99ffffff"
|
|
||||||
android:clickable="true"
|
|
||||||
android:text="@string/reminder_header_close_button" />
|
|
||||||
|
|
||||||
<TextView android:id="@+id/accept"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:fontFamily="sans-serif-medium"
|
|
||||||
android:paddingLeft="6dp"
|
|
||||||
android:paddingRight="6dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
tools:text="ENABLE" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -17,8 +17,7 @@ public class DefaultSmsReminder extends Reminder {
|
|||||||
@TargetApi(VERSION_CODES.KITKAT)
|
@TargetApi(VERSION_CODES.KITKAT)
|
||||||
public DefaultSmsReminder(final Context context) {
|
public DefaultSmsReminder(final Context context) {
|
||||||
super(context.getString(R.string.reminder_header_sms_default_title),
|
super(context.getString(R.string.reminder_header_sms_default_title),
|
||||||
context.getString(R.string.reminder_header_sms_default_text),
|
context.getString(R.string.reminder_header_sms_default_text));
|
||||||
context.getString(R.string.reminder_header_sms_default_button));
|
|
||||||
|
|
||||||
final OnClickListener okListener = new OnClickListener() {
|
final OnClickListener okListener = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,8 +14,7 @@ public class ExpiredBuildReminder extends Reminder {
|
|||||||
|
|
||||||
public ExpiredBuildReminder(final Context context) {
|
public ExpiredBuildReminder(final Context context) {
|
||||||
super(context.getString(R.string.reminder_header_expired_build),
|
super(context.getString(R.string.reminder_header_expired_build),
|
||||||
context.getString(R.string.reminder_header_expired_build_details),
|
context.getString(R.string.reminder_header_expired_build_details));
|
||||||
context.getString(R.string.reminder_header_expired_build_button));
|
|
||||||
setOkListener(new OnClickListener() {
|
setOkListener(new OnClickListener() {
|
||||||
@Override public void onClick(View v) {
|
@Override public void onClick(View v) {
|
||||||
try {
|
try {
|
||||||
|
@ -16,8 +16,7 @@ public class InviteReminder extends Reminder {
|
|||||||
final @NonNull Recipients recipients)
|
final @NonNull Recipients recipients)
|
||||||
{
|
{
|
||||||
super(context.getString(R.string.reminder_header_invite_title),
|
super(context.getString(R.string.reminder_header_invite_title),
|
||||||
context.getString(R.string.reminder_header_invite_text, recipients.toShortString()),
|
context.getString(R.string.reminder_header_invite_text, recipients.toShortString()));
|
||||||
context.getString(R.string.reminder_header_invite_button));
|
|
||||||
|
|
||||||
setDismissListener(new OnClickListener() {
|
setDismissListener(new OnClickListener() {
|
||||||
@Override public void onClick(View v) {
|
@Override public void onClick(View v) {
|
||||||
|
@ -14,8 +14,7 @@ public class PushRegistrationReminder extends Reminder {
|
|||||||
|
|
||||||
public PushRegistrationReminder(final Context context, final MasterSecret masterSecret) {
|
public PushRegistrationReminder(final Context context, final MasterSecret masterSecret) {
|
||||||
super(context.getString(R.string.reminder_header_push_title),
|
super(context.getString(R.string.reminder_header_push_title),
|
||||||
context.getString(R.string.reminder_header_push_text),
|
context.getString(R.string.reminder_header_push_text));
|
||||||
context.getString(R.string.reminder_header_push_button));
|
|
||||||
|
|
||||||
final OnClickListener okListener = new OnClickListener() {
|
final OnClickListener okListener = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package org.thoughtcrime.securesms.components.reminder;
|
package org.thoughtcrime.securesms.components.reminder;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.StringRes;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
|
||||||
public abstract class Reminder {
|
public abstract class Reminder {
|
||||||
private CharSequence buttonText;
|
|
||||||
private CharSequence title;
|
private CharSequence title;
|
||||||
private CharSequence text;
|
private CharSequence text;
|
||||||
|
|
||||||
@ -14,12 +11,10 @@ public abstract class Reminder {
|
|||||||
private OnClickListener dismissListener;
|
private OnClickListener dismissListener;
|
||||||
|
|
||||||
public Reminder(@NonNull CharSequence title,
|
public Reminder(@NonNull CharSequence title,
|
||||||
@NonNull CharSequence text,
|
@NonNull CharSequence text)
|
||||||
@NonNull CharSequence buttonText)
|
|
||||||
{
|
{
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.buttonText = buttonText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getTitle() {
|
public CharSequence getTitle() {
|
||||||
@ -30,10 +25,6 @@ public abstract class Reminder {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getButtonText() {
|
|
||||||
return buttonText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OnClickListener getOkListener() {
|
public OnClickListener getOkListener() {
|
||||||
return okListener;
|
return okListener;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import android.util.AttributeSet;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -18,8 +19,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
|||||||
*/
|
*/
|
||||||
public class ReminderView extends LinearLayout {
|
public class ReminderView extends LinearLayout {
|
||||||
private ViewGroup container;
|
private ViewGroup container;
|
||||||
private TextView acceptButton;
|
private ImageButton closeButton;
|
||||||
private TextView closeButton;
|
|
||||||
private TextView title;
|
private TextView title;
|
||||||
private TextView text;
|
private TextView text;
|
||||||
|
|
||||||
@ -41,19 +41,17 @@ public class ReminderView extends LinearLayout {
|
|||||||
|
|
||||||
private void initialize() {
|
private void initialize() {
|
||||||
LayoutInflater.from(getContext()).inflate(R.layout.reminder_header, this, true);
|
LayoutInflater.from(getContext()).inflate(R.layout.reminder_header, this, true);
|
||||||
container = ViewUtil.findById(this, R.id.container);
|
container = ViewUtil.findById(this, R.id.container);
|
||||||
acceptButton = ViewUtil.findById(this, R.id.accept);
|
closeButton = ViewUtil.findById(this, R.id.cancel);
|
||||||
closeButton = ViewUtil.findById(this, R.id.cancel);
|
title = ViewUtil.findById(this, R.id.reminder_title);
|
||||||
title = ViewUtil.findById(this, R.id.reminder_title);
|
text = ViewUtil.findById(this, R.id.reminder_text);
|
||||||
text = ViewUtil.findById(this, R.id.reminder_text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showReminder(final Reminder reminder) {
|
public void showReminder(final Reminder reminder) {
|
||||||
title.setText(reminder.getTitle());
|
title.setText(reminder.getTitle());
|
||||||
text.setText(reminder.getText());
|
text.setText(reminder.getText());
|
||||||
acceptButton.setText(reminder.getButtonText());
|
|
||||||
|
|
||||||
acceptButton.setOnClickListener(reminder.getOkListener());
|
setOnClickListener(reminder.getOkListener());
|
||||||
|
|
||||||
if (reminder.isDismissable()) {
|
if (reminder.isDismissable()) {
|
||||||
closeButton.setOnClickListener(new OnClickListener() {
|
closeButton.setOnClickListener(new OnClickListener() {
|
||||||
|
@ -15,8 +15,7 @@ public class SystemSmsImportReminder extends Reminder {
|
|||||||
|
|
||||||
public SystemSmsImportReminder(final Context context, final MasterSecret masterSecret) {
|
public SystemSmsImportReminder(final Context context, final MasterSecret masterSecret) {
|
||||||
super(context.getString(R.string.reminder_header_sms_import_title),
|
super(context.getString(R.string.reminder_header_sms_import_title),
|
||||||
context.getString(R.string.reminder_header_sms_import_text),
|
context.getString(R.string.reminder_header_sms_import_text));
|
||||||
context.getString(R.string.reminder_header_sms_import_button));
|
|
||||||
|
|
||||||
final OnClickListener okListener = new OnClickListener() {
|
final OnClickListener okListener = new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user