diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..c8f6912 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/kevalpatel2106/sample/RulerDemoActivity2.java b/app/src/main/java/com/kevalpatel2106/sample/RulerDemoActivity2.java index c54b4d0..3973df0 100644 --- a/app/src/main/java/com/kevalpatel2106/sample/RulerDemoActivity2.java +++ b/app/src/main/java/com/kevalpatel2106/sample/RulerDemoActivity2.java @@ -18,6 +18,8 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; +import android.widget.CompoundButton; +import android.widget.RadioButton; import android.widget.TextView; import com.kevalpatel2106.rulerpicker.RulerValuePicker; @@ -29,7 +31,7 @@ public class RulerDemoActivity2 extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ruler_demo2); - + checkGender(); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -72,6 +74,30 @@ public void onIntermediateValueChange(final int selectedValue) { } }); + checkGender(); + } + + private void checkGender() { + final RadioButton male = findViewById(R.id.male); + final RadioButton female = findViewById(R.id.female); + male.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + female.setChecked(false); + } + } + }); + female.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + male.setChecked(false); + } + } + }); } @Override diff --git a/app/src/main/res/layout/activity_ruler_demo2.xml b/app/src/main/res/layout/activity_ruler_demo2.xml index 34015c6..2daad74 100644 --- a/app/src/main/res/layout/activity_ruler_demo2.xml +++ b/app/src/main/res/layout/activity_ruler_demo2.xml @@ -221,12 +221,14 @@ app:layout_constraintTop_toBottomOf="@+id/textView3">