diff --git a/.gitignore b/.gitignore index 144cfe7..b62d661 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .idea /library/build *.iml +**/*.iml diff --git a/app/app.iml b/app/app.iml deleted file mode 100644 index a6444d1..0000000 --- a/app/app.iml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 735cbe1..039c27a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { applicationId "io.techery.properratingbar.sample" @@ -22,8 +22,8 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' - compile 'com.android.support:appcompat-v7:23.0.1' - compile 'com.android.support:design:23.0.1' + compile 'com.android.support:appcompat-v7:23.1.1' + compile 'com.android.support:design:23.1.1' compile 'com.jakewharton:butterknife:7.0.1' compile project(':library') } diff --git a/app/src/main/java/io/techery/properratingbarsample/MainActivity.java b/app/src/main/java/io/techery/properratingbarsample/MainActivity.java index dd7df9e..48ee587 100644 --- a/app/src/main/java/io/techery/properratingbarsample/MainActivity.java +++ b/app/src/main/java/io/techery/properratingbarsample/MainActivity.java @@ -16,8 +16,12 @@ public class MainActivity extends AppCompatActivity { @Bind(R.id.rootView) ViewGroup rootView; - @Bind(R.id.ratingBar) - ProperRatingBar ratingBar; + @Bind(R.id.upperRatingBar) + ProperRatingBar upperRatingBar; + @Bind(R.id.lowerRatingBar) + ProperRatingBar lowerRatingBar; + + private String[] ticksArray = new String[] {"$", "★"}; @Override protected void onCreate(Bundle savedInstanceState) { @@ -27,17 +31,24 @@ protected void onCreate(Bundle savedInstanceState) { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // - ratingBar.setListener(ratingListener); + lowerRatingBar.setListener(ratingListener); + } + + @OnClick(R.id.toggleTick) void toggleTick() { // here goes shit-code. No time to do properly + String tick; + if (upperRatingBar.getSymbolicTick().equals(ticksArray[0])) tick = ticksArray[1]; + else tick = ticksArray[0]; + upperRatingBar.setSymbolicTick(tick); } @OnClick(R.id.getRatingButton) void getRatingClicked() { Snackbar.make(rootView, - String.format(getString(R.string.get_rating_snack_caption_format), ratingBar.getRating()), + String.format(getString(R.string.get_rating_snack_caption_format), lowerRatingBar.getRating()), Snackbar.LENGTH_SHORT).show(); } @OnClick(R.id.setRatingButton) void setRatingClicked() { - ratingBar.setRating(2); + lowerRatingBar.setRating(2); Snackbar.make(rootView, R.string.set_rating_snack_caption, Snackbar.LENGTH_SHORT).show(); } diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 7b6f83d..7ca04f6 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -23,6 +23,7 @@ /> +