made checkboxes and radiobuttons stylable
This commit is contained in:
		
							parent
							
								
									f0cfbb4681
								
							
						
					
					
						commit
						962ecbedfa
					
				| @ -9,19 +9,15 @@ import android.content.Context; | |||||||
| import android.content.DialogInterface; | import android.content.DialogInterface; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
| import android.support.v7.app.AlertDialog; | import android.support.v7.app.AlertDialog; | ||||||
| import android.view.View; |  | ||||||
| import android.widget.AutoCompleteTextView; | import android.widget.AutoCompleteTextView; | ||||||
| import android.widget.CheckBox; |  | ||||||
| import android.widget.Checkable; |  | ||||||
| import android.widget.Spinner; | import android.widget.Spinner; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.HashSet; |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| import eu.siacs.conversations.R; | 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.adapter.KnownHostsAdapter; | ||||||
| import eu.siacs.conversations.ui.interfaces.OnBackendConnected; | import eu.siacs.conversations.ui.interfaces.OnBackendConnected; | ||||||
| import eu.siacs.conversations.ui.util.DelayedHintHelper; | import eu.siacs.conversations.ui.util.DelayedHintHelper; | ||||||
| @ -53,7 +49,7 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon | |||||||
| 	public Dialog onCreateDialog(Bundle savedInstanceState) { | 	public Dialog onCreateDialog(Bundle savedInstanceState) { | ||||||
| 		final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | 		final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | ||||||
| 		builder.setTitle(R.string.dialog_title_join_conference); | 		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); | 		DelayedHintHelper.setHint(R.string.conference_address_example, binding.jid); | ||||||
| 		this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item); | 		this.knownHostsAdapter = new KnownHostsAdapter(getActivity(), R.layout.simple_list_item); | ||||||
| 		binding.jid.setAdapter(knownHostsAdapter); | 		binding.jid.setAdapter(knownHostsAdapter); | ||||||
|  | |||||||
| @ -8,7 +8,8 @@ | |||||||
|         android:background="?attr/color_background_secondary" |         android:background="?attr/color_background_secondary" | ||||||
|         android:orientation="vertical"> |         android:orientation="vertical"> | ||||||
| 
 | 
 | ||||||
|         <include android:id="@+id/toolbar" |         <include | ||||||
|  |             android:id="@+id/toolbar" | ||||||
|             layout="@layout/toolbar"/> |             layout="@layout/toolbar"/> | ||||||
| 
 | 
 | ||||||
|         <ScrollView |         <ScrollView | ||||||
| @ -89,6 +90,7 @@ | |||||||
| 
 | 
 | ||||||
|                             <CheckBox |                             <CheckBox | ||||||
|                                 android:id="@+id/details_send_presence" |                                 android:id="@+id/details_send_presence" | ||||||
|  |                                 style="@style/Widget.Conversations.CheckBox" | ||||||
|                                 android:layout_width="wrap_content" |                                 android:layout_width="wrap_content" | ||||||
|                                 android:layout_height="wrap_content" |                                 android:layout_height="wrap_content" | ||||||
|                                 android:layout_marginTop="8dp" |                                 android:layout_marginTop="8dp" | ||||||
| @ -97,6 +99,7 @@ | |||||||
| 
 | 
 | ||||||
|                             <CheckBox |                             <CheckBox | ||||||
|                                 android:id="@+id/details_receive_presence" |                                 android:id="@+id/details_receive_presence" | ||||||
|  |                                 style="@style/Widget.Conversations.CheckBox" | ||||||
|                                 android:layout_width="wrap_content" |                                 android:layout_width="wrap_content" | ||||||
|                                 android:layout_height="wrap_content" |                                 android:layout_height="wrap_content" | ||||||
|                                 android:text="@string/receive_presence_updates" |                                 android:text="@string/receive_presence_updates" | ||||||
| @ -149,9 +152,9 @@ | |||||||
|                                 style="?android:attr/borderlessButtonStyle" |                                 style="?android:attr/borderlessButtonStyle" | ||||||
|                                 android:layout_width="wrap_content" |                                 android:layout_width="wrap_content" | ||||||
|                                 android:layout_height="wrap_content" |                                 android:layout_height="wrap_content" | ||||||
|  |                                 android:minWidth="0dp" | ||||||
|                                 android:paddingLeft="16dp" |                                 android:paddingLeft="16dp" | ||||||
|                                 android:paddingRight="16dp" |                                 android:paddingRight="16dp" | ||||||
|                                 android:minWidth="0dp" |  | ||||||
|                                 android:text="@string/scan_qr_code" |                                 android:text="@string/scan_qr_code" | ||||||
|                                 android:textColor="?attr/colorAccent"/> |                                 android:textColor="?attr/colorAccent"/> | ||||||
| 
 | 
 | ||||||
| @ -160,9 +163,9 @@ | |||||||
|                                 style="?android:attr/borderlessButtonStyle" |                                 style="?android:attr/borderlessButtonStyle" | ||||||
|                                 android:layout_width="wrap_content" |                                 android:layout_width="wrap_content" | ||||||
|                                 android:layout_height="wrap_content" |                                 android:layout_height="wrap_content" | ||||||
|  |                                 android:minWidth="0dp" | ||||||
|                                 android:paddingLeft="16dp" |                                 android:paddingLeft="16dp" | ||||||
|                                 android:paddingRight="16dp" |                                 android:paddingRight="16dp" | ||||||
|                                 android:minWidth="0dp" |  | ||||||
|                                 android:text="@string/show_inactive_devices" |                                 android:text="@string/show_inactive_devices" | ||||||
|                                 android:textColor="?attr/colorAccent"/> |                                 android:textColor="?attr/colorAccent"/> | ||||||
|                         </LinearLayout> |                         </LinearLayout> | ||||||
|  | |||||||
| @ -149,6 +149,7 @@ | |||||||
| 
 | 
 | ||||||
|                             <CheckBox |                             <CheckBox | ||||||
|                                 android:id="@+id/account_register_new" |                                 android:id="@+id/account_register_new" | ||||||
|  |                                 style="@style/Widget.Conversations.CheckBox" | ||||||
|                                 android:layout_width="wrap_content" |                                 android:layout_width="wrap_content" | ||||||
|                                 android:layout_height="wrap_content" |                                 android:layout_height="wrap_content" | ||||||
|                                 android:layout_marginTop="8dp" |                                 android:layout_marginTop="8dp" | ||||||
|  | |||||||
| @ -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> |  | ||||||
| @ -18,6 +18,7 @@ | |||||||
| 
 | 
 | ||||||
|         <CheckBox |         <CheckBox | ||||||
|             android:id="@+id/report_spam" |             android:id="@+id/report_spam" | ||||||
|  |             style="@style/Widget.Conversations.CheckBox" | ||||||
|             android:layout_width="wrap_content" |             android:layout_width="wrap_content" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|             android:layout_marginTop="8dp" |             android:layout_marginTop="8dp" | ||||||
|  | |||||||
| @ -3,20 +3,21 @@ | |||||||
|               android:layout_width="match_parent" |               android:layout_width="match_parent" | ||||||
|               android:layout_height="match_parent" |               android:layout_height="match_parent" | ||||||
|               android:orientation="vertical" |               android:orientation="vertical" | ||||||
|  |               android:paddingBottom="?attr/dialog_vertical_padding" | ||||||
|               android:paddingLeft="?attr/dialog_horizontal_padding" |               android:paddingLeft="?attr/dialog_horizontal_padding" | ||||||
|               android:paddingRight="?attr/dialog_horizontal_padding" |               android:paddingRight="?attr/dialog_horizontal_padding" | ||||||
|     android:paddingBottom="?attr/dialog_vertical_padding" |  | ||||||
|               android:paddingTop="?attr/dialog_vertical_padding"> |               android:paddingTop="?attr/dialog_vertical_padding"> | ||||||
| 
 | 
 | ||||||
|     <TextView |     <TextView | ||||||
|         android:layout_width="wrap_content" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:layout_marginBottom="8dp" |         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 |     <CheckBox | ||||||
|         android:id="@+id/end_conversation_checkbox" |         android:id="@+id/end_conversation_checkbox" | ||||||
|  |         style="@style/Widget.Conversations.CheckBox" | ||||||
|         android:layout_width="wrap_content" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:checked="true" |         android:checked="true" | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | <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 |     <LinearLayout | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="match_parent" |         android:layout_height="match_parent" | ||||||
| @ -26,19 +27,20 @@ | |||||||
|             android:layout_width="match_parent" |             android:layout_width="match_parent" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|             android:hint="@string/conference_address" |             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 |             <AutoCompleteTextView | ||||||
|                 android:id="@+id/jid" |                 android:id="@+id/jid" | ||||||
|  |                 style="@style/Widget.Conversations.EditText" | ||||||
|                 android:layout_width="fill_parent" |                 android:layout_width="fill_parent" | ||||||
|                 android:layout_height="wrap_content" |                 android:layout_height="wrap_content" | ||||||
|                 android:inputType="textEmailAddress" |                 android:inputType="textEmailAddress"/> | ||||||
|                 style="@style/Widget.Conversations.EditText"/> |  | ||||||
|         </android.support.design.widget.TextInputLayout> |         </android.support.design.widget.TextInputLayout> | ||||||
| 
 | 
 | ||||||
|         <CheckBox |         <CheckBox | ||||||
|             android:id="@+id/bookmark" |             android:id="@+id/bookmark" | ||||||
|  |             style="@style/Widget.Conversations.CheckBox" | ||||||
|             android:layout_width="wrap_content" |             android:layout_width="wrap_content" | ||||||
|             android:layout_height="wrap_content" |             android:layout_height="wrap_content" | ||||||
|             android:layout_marginTop="8dp" |             android:layout_marginTop="8dp" | ||||||
| @ -19,24 +19,28 @@ | |||||||
| 
 | 
 | ||||||
|             <RadioButton |             <RadioButton | ||||||
|                 android:id="@+id/online" |                 android:id="@+id/online" | ||||||
|  |                 style="@style/Widget.Conversations.RadioButton" | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="match_parent" | ||||||
|                 android:layout_height="wrap_content" |                 android:layout_height="wrap_content" | ||||||
|                 android:text="@string/presence_online"/> |                 android:text="@string/presence_online"/> | ||||||
| 
 | 
 | ||||||
|             <RadioButton |             <RadioButton | ||||||
|                 android:id="@+id/away" |                 android:id="@+id/away" | ||||||
|  |                 style="@style/Widget.Conversations.RadioButton" | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="match_parent" | ||||||
|                 android:layout_height="wrap_content" |                 android:layout_height="wrap_content" | ||||||
|                 android:text="@string/presence_away"/> |                 android:text="@string/presence_away"/> | ||||||
| 
 | 
 | ||||||
|             <RadioButton |             <RadioButton | ||||||
|                 android:id="@+id/xa" |                 android:id="@+id/xa" | ||||||
|  |                 style="@style/Widget.Conversations.RadioButton" | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="match_parent" | ||||||
|                 android:layout_height="wrap_content" |                 android:layout_height="wrap_content" | ||||||
|                 android:text="@string/presence_xa"/> |                 android:text="@string/presence_xa"/> | ||||||
| 
 | 
 | ||||||
|             <RadioButton |             <RadioButton | ||||||
|                 android:id="@+id/dnd" |                 android:id="@+id/dnd" | ||||||
|  |                 style="@style/Widget.Conversations.RadioButton" | ||||||
|                 android:layout_width="match_parent" |                 android:layout_width="match_parent" | ||||||
|                 android:layout_height="wrap_content" |                 android:layout_height="wrap_content" | ||||||
|                 android:text="@string/presence_dnd"/> |                 android:text="@string/presence_dnd"/> | ||||||
|  | |||||||
| @ -25,6 +25,15 @@ | |||||||
|         <item name="android:textSize">?TextSizeInput</item> |         <item name="android:textSize">?TextSizeInput</item> | ||||||
|     </style> |     </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"> |     <style name="TextAppearance.Conversations.Design.Hint" parent="TextAppearance.Design.Hint"> | ||||||
|         <item name="android:textSize">?TextSizeCaption</item> |         <item name="android:textSize">?TextSizeCaption</item> | ||||||
|     </style> |     </style> | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Gultsch
						Daniel Gultsch