Skip to content

Commit

Permalink
add disable control
Browse files Browse the repository at this point in the history
  • Loading branch information
SPSpisoft committed Nov 5, 2019
1 parent 35bfc3c commit 978e5ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ protected void onCreate(Bundle savedInstanceState) {
}

final SpGenderSwitch Met = findViewById(R.id.met);
Met.SetConfirm(MainActivity.this,"TT","QQ","OK","Cancel");
// Met.SetConfirm(MainActivity.this,false,"TT","QQ","OK","Cancel");
Met.SetDisable(true);
Met.SetValue(gn);
Met.setChangeValueListener(new SpGenderSwitch.OnChangeValueListener() {
public void onEvent() {
Expand Down
15 changes: 11 additions & 4 deletions spgender/src/main/java/com/spisoft/spsswitch/SpGenderSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class SpGenderSwitch extends RelativeLayout {
private boolean ConfirmQS;
private Context context;
private String ConfirmTitle, ConfirmContent, ConfirmOK, ConfirmCancel;
private boolean Disable = false;

public interface OnChangeValueListener {
void onEvent();
Expand Down Expand Up @@ -126,10 +127,12 @@ public boolean onLongClick(View v) {
iGenre.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!ConfirmQS)
Switch(view, SetAnimate);
else
Confirmation(view);
if(!Disable) {
if (!ConfirmQS)
Switch(view, SetAnimate);
else
Confirmation(view);
}
}
});
}
Expand Down Expand Up @@ -272,6 +275,10 @@ public void SetValue(int val){
SwitchView(val);
}

public void SetDisable(boolean disable){
this.Disable = disable;
}

public String GetText(){
return iText.getText().toString();
}
Expand Down

0 comments on commit 978e5ab

Please sign in to comment.