Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/activity_ruler_demo2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,14 @@
app:layout_constraintTop_toBottomOf="@+id/textView3">

<RadioButton
android:id="@+id/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:textColor="@android:color/white" />

<RadioButton
android:id="@+id/female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
Expand Down