mirror of
https://github.com/xoureldeen/Vectras-VM-Android.git
synced 2026-05-19 16:42:13 +00:00
3.9.2
- Added 3dfx wrappers disc and VirtIO for Windows disc for mounting to optical drives and use. - Added UEFI option for virtual machines. - Asset files are only checked and extracted when necessary.
This commit is contained in:
parent
f9ed010d7e
commit
652dfc663e
26 changed files with 642 additions and 69 deletions
76
app/src/main/java/com/vectras/vm/view/CheckBoxView.java
Normal file
76
app/src/main/java/com/vectras/vm/view/CheckBoxView.java
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
package com.vectras.vm.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.vectras.vm.R;
|
||||
|
||||
public class CheckBoxView extends LinearLayout {
|
||||
private TextView tvTitle;
|
||||
private CheckBox checkBox;
|
||||
|
||||
public interface OnCheckedChangeListener {
|
||||
void onCheckedChanged(CheckBoxView view, boolean isChecked);
|
||||
}
|
||||
|
||||
private OnCheckedChangeListener listener;
|
||||
|
||||
public void setOnCheckedChangeListener(OnCheckedChangeListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public CheckBoxView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
LayoutInflater.from(context).inflate(R.layout.checkbox_view, this, true);
|
||||
|
||||
tvTitle = findViewById(R.id.tv_title);
|
||||
checkBox = findViewById(R.id.checkbox);
|
||||
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CheckBoxView);
|
||||
|
||||
String title = typedArray.getString(R.styleable.CheckBoxView_setText);
|
||||
boolean isChecked = typedArray.getBoolean(R.styleable.CheckBoxView_setChecked, false);
|
||||
|
||||
if (title != null) tvTitle.setText(title);
|
||||
checkBox.setChecked(isChecked);
|
||||
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
findViewById(R.id.root).setOnClickListener(v -> checkBox.setChecked(!checkBox.isChecked()));
|
||||
|
||||
checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (listener != null) {
|
||||
listener.onCheckedChanged(this, isChecked);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setText(String title) {
|
||||
tvTitle.setText(title);
|
||||
}
|
||||
|
||||
public void setChecked(boolean isCheck) {
|
||||
checkBox.setChecked(isCheck);
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return checkBox.isChecked();
|
||||
}
|
||||
|
||||
public void setEnabled(boolean isEnabled) {
|
||||
findViewById(R.id.root).setEnabled(isEnabled);
|
||||
findViewById(R.id.root).setAlpha(0.5f);
|
||||
checkBox.setEnabled(isEnabled);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue