made checkboxes and radiobuttons stylable

This commit is contained in:
Daniel Gultsch 2018-04-01 09:18:12 +02:00
parent f0cfbb4681
commit 962ecbedfa
9 changed files with 43 additions and 108 deletions

View File

@ -9,19 +9,15 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.CheckBox;
import android.widget.Checkable;
import android.widget.Spinner;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.JoinConferenceDialogBinding;
import eu.siacs.conversations.databinding.DialogJoinConferenceBinding;
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
import eu.siacs.conversations.ui.interfaces.OnBackendConnected;
import eu.siacs.conversations.ui.util.DelayedHintHelper;
@ -53,7 +49,7 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon
public Dialog onCreateDialog(Bundle savedInstanceState) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.dialog_title_join_conference);
JoinConferenceDialogBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.join_conference_dialog, null, false);
DialogJoinConferenceBinding binding = DataBindingUtil.inflate(getActivity().getLayoutInflater(), R.layout.dialog_join_conference, null, false);
DelayedHintHelper.setHint(R.string.conference_address_example, binding.jid);
this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item);
binding.jid.setAdapter(knownHostsAdapter);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
@ -8,8 +8,9 @@
android:background="?attr/color_background_secondary"
android:orientation="vertical">
<include android:id="@+id/toolbar"
layout="@layout/toolbar" />
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"/>
<ScrollView
android:layout_width="fill_parent"
@ -89,6 +90,7 @@
<CheckBox
android:id="@+id/details_send_presence"
style="@style/Widget.Conversations.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
@ -97,6 +99,7 @@
<CheckBox
android:id="@+id/details_receive_presence"
style="@style/Widget.Conversations.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/receive_presence_updates"
@ -149,9 +152,9 @@
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:minWidth="0dp"
android:text="@string/scan_qr_code"
android:textColor="?attr/colorAccent"/>
@ -160,9 +163,9 @@
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:minWidth="0dp"
android:text="@string/show_inactive_devices"
android:textColor="?attr/colorAccent"/>
</LinearLayout>

View File

@ -149,6 +149,7 @@
<CheckBox
android:id="@+id/account_register_new"
style="@style/Widget.Conversations.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"

View File

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="?attr/color_background_secondary">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/card_padding_regular">
<EditText
android:id="@+id/presence_status_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:hint="@string/status_message"
android:inputType="textMultiLine"/>
<Spinner
android:id="@+id/presence_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
<CheckBox
android:id="@+id/all_accounts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:text="@string/all_accounts_on_this_device"/>
<Button
android:id="@+id/change_presence"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginBottom="-8dp"
android:layout_marginRight="-8dp"
android:text="@string/change_presence"
android:textColor="@color/accent"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="@+id/templates_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin">
<LinearLayout
android:id="@+id/templates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/card_padding_list"/>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
</layout>

View File

@ -18,6 +18,7 @@
<CheckBox
android:id="@+id/report_spam"
style="@style/Widget.Conversations.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"

View File

@ -1,25 +1,26 @@
<?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"
android:paddingLeft="?attr/dialog_horizontal_padding"
android:paddingRight="?attr/dialog_horizontal_padding"
android:paddingBottom="?attr/dialog_vertical_padding"
android:paddingTop="?attr/dialog_vertical_padding">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="?attr/dialog_vertical_padding"
android:paddingLeft="?attr/dialog_horizontal_padding"
android:paddingRight="?attr/dialog_horizontal_padding"
android:paddingTop="?attr/dialog_vertical_padding">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:text="@string/clear_histor_msg"/>
android:text="@string/clear_histor_msg"
android:textAppearance="@style/TextAppearance.Conversations.Body1"/>
<CheckBox
android:id="@+id/end_conversation_checkbox"
style="@style/Widget.Conversations.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/also_end_conversation" />
android:text="@string/also_end_conversation"/>
</LinearLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -19,26 +20,27 @@
<Spinner
android:id="@+id/account"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/account_jid_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/conference_address"
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint"
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error">
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
<AutoCompleteTextView
android:id="@+id/jid"
style="@style/Widget.Conversations.EditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
style="@style/Widget.Conversations.EditText"/>
android:inputType="textEmailAddress"/>
</android.support.design.widget.TextInputLayout>
<CheckBox
android:id="@+id/bookmark"
style="@style/Widget.Conversations.CheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"

View File

@ -19,24 +19,28 @@
<RadioButton
android:id="@+id/online"
style="@style/Widget.Conversations.RadioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_online"/>
<RadioButton
android:id="@+id/away"
style="@style/Widget.Conversations.RadioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_away"/>
<RadioButton
android:id="@+id/xa"
style="@style/Widget.Conversations.RadioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_xa"/>
<RadioButton
android:id="@+id/dnd"
style="@style/Widget.Conversations.RadioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/presence_dnd"/>

View File

@ -25,6 +25,15 @@
<item name="android:textSize">?TextSizeInput</item>
</style>
<style name="Widget.Conversations.CheckBox" parent="Widget.AppCompat.CompoundButton.CheckBox">
<item name="android:textSize">?TextSizeBody1</item>
</style>
<style name="Widget.Conversations.RadioButton" parent="Widget.AppCompat.CompoundButton.RadioButton">
<item name="android:textSize">?TextSizeBody1</item>
</style>
<style name="TextAppearance.Conversations.Design.Hint" parent="TextAppearance.Design.Hint">
<item name="android:textSize">?TextSizeCaption</item>
</style>