import android.view.View;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
-import android.widget.Switch;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import com.google.android.material.switchmaterial.SwitchMaterial;
import com.google.android.material.textfield.TextInputLayout;
import net.ktnx.mobileledger.BuildConfig;
private boolean defaultCommoditySet;
private TextInputLayout urlLayout;
private LinearLayout authParams;
- private Switch useAuthentication;
+ private SwitchMaterial useAuthentication;
private TextView userName;
private TextInputLayout userNameLayout;
private TextView password;
cpf.show(activity.getSupportFragmentManager(), "currency-selector");
});
- Switch showCommodityByDefault = context.findViewById(R.id.profile_show_commodity);
+ SwitchMaterial showCommodityByDefault = context.findViewById(R.id.profile_show_commodity);
showCommodityByDefault.setOnCheckedChangeListener(
(buttonView, isChecked) -> model.setShowCommodityByDefault(isChecked));
model.observeShowCommodityByDefault(viewLifecycleOwner, showCommodityByDefault::setChecked);
View postingSubItems = context.findViewById(R.id.posting_sub_items);
- Switch postingPermitted = context.findViewById(R.id.profile_permit_posting);
+ SwitchMaterial postingPermitted = context.findViewById(R.id.profile_permit_posting);
model.observePostingPermitted(viewLifecycleOwner, isChecked -> {
postingPermitted.setChecked(isChecked);
postingSubItems.setVisibility(isChecked ? View.VISIBLE : View.GONE);
postingPermitted.setOnCheckedChangeListener(
((buttonView, isChecked) -> model.setPostingPermitted(isChecked)));
- Switch showCommentsByDefault = context.findViewById(R.id.profile_show_comments);
+ SwitchMaterial showCommentsByDefault = context.findViewById(R.id.profile_show_comments);
model.observeShowCommentsByDefault(viewLifecycleOwner, showCommentsByDefault::setChecked);
showCommentsByDefault.setOnCheckedChangeListener(
((buttonView, isChecked) -> model.setShowCommentsByDefault(isChecked)));
android:orientation="vertical"
>
- <Switch
+ <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/enable_http_auth"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
- <Switch
+ <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/profile_permit_posting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
- <Switch
+ <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/profile_show_commodity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceListItem"
/>
- <Switch
+ <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/profile_show_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<!--
- ~ Copyright © 2019 Damyan Ivanov.
+ ~ Copyright © 2020 Damyan Ivanov.
~ This file is part of MoLe.
~ MoLe is free software: you can distribute it and/or modify it
~ under the term of the GNU General Public License as published by
android:layout_width="match_parent"
android:layout_height="match_parent">
- <Switch
+ <com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
- android:layout_centerVertical="true" />
+ android:layout_centerVertical="true"
+ />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright © 2019 Damyan Ivanov.
+ ~ Copyright © 2020 Damyan Ivanov.
~ This file is part of MoLe.
~ MoLe is free software: you can distribute it and/or modify it
~ under the term of the GNU General Public License as published by
android:title="@string/show_currency_input"
android:checkable="true"
android:checked="false"
+ app:actionLayout="@layout/switch_item"
app:showAsAction="never" />
<item
android:id="@+id/toggle_comments"