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;
});
}
@Override
- public void onActivityCreated(@Nullable Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
+ public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
Activity context = getActivity();
if (context == null)
return;
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)));
detectedApiVersion.setText(ver.toString());
});
detectedApiVersion.setOnClickListener(v -> model.triggerVersionDetection());
- context.findViewById(R.id.api_version_detect_button)
- .setOnClickListener(v -> model.triggerVersionDetection());
+ final View detectButton = context.findViewById(R.id.api_version_detect_button);
+ detectButton.setOnClickListener(v -> model.triggerVersionDetection());
+ model.observeDetectingHledgerVersion(viewLifecycleOwner, running -> {
+ detectButton.setVisibility(running ? View.VISIBLE : View.INVISIBLE);
+ });
authParams = context.findViewById(R.id.auth_params);