Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F rating #1

Merged
merged 38 commits into from
Apr 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0300f6d
Added three assts required for star
saran2020 Apr 6, 2019
3645c7b
Added a basic SlideRating View and files related to it
saran2020 Apr 8, 2019
7ffff68
Removed dependency of constrain layout
saran2020 Apr 8, 2019
2ea7b1c
Setup the main activity to show the rating view
saran2020 Apr 8, 2019
80fbea1
Added some more safety check as required
saran2020 Apr 9, 2019
375f67d
Fixed the logic of setting the rating view's asset
saran2020 Apr 9, 2019
c28591f
Made the space between rating to be shown when set or passed in xml
saran2020 Apr 9, 2019
62b6e3e
Added a on click listener to the rating view
saran2020 Apr 9, 2019
3218b00
Base impl of the the drag of view
saran2020 Apr 11, 2019
e135b6a
Upde the gradle wrapper to new supported version by android plugin
saran2020 Apr 20, 2019
ed48ec9
Update the android plugin to version 3.4.0
saran2020 Apr 20, 2019
0554f66
Add logic to track touch and calculate current rating
saran2020 Apr 20, 2019
2d32b40
Add logic to round of rating to the closet allowed rating based on tr…
saran2020 Apr 20, 2019
99b7c22
Remove setting of tag to the view, no longer required
saran2020 Apr 20, 2019
350085a
Made add view function 0 based instead of 1 based
saran2020 Apr 20, 2019
cef2fd6
Fix the logic of set rating asset, setting incorrect asset
saran2020 Apr 20, 2019
72efc9c
Add a todo to make the assetmap drawable based instead of drawable res
saran2020 Apr 20, 2019
d5b1dcc
Add new interface to pass on the callback when rating is changed
saran2020 Apr 20, 2019
cb13a07
Change the logic of set currentRating method to use the callback and …
saran2020 Apr 20, 2019
c8ab12f
Moved some constants to String.xml
saran2020 Apr 20, 2019
cc52e83
Made the Main activity to use callback to set the values
saran2020 Apr 20, 2019
88eba39
Changed the access modifier to match the requirement
saran2020 Apr 23, 2019
7e35175
Add a new module sliderating
saran2020 Apr 23, 2019
e69bb35
Remove all the testing related code auto added
saran2020 Apr 23, 2019
0aebbee
Refactor the file string.xml to values.xml, because there isn't much …
saran2020 Apr 23, 2019
529927a
Remove the "libs" directory dependency from the app module
saran2020 Apr 23, 2019
f4c927b
Add sliderating (new module) dependency to the the app module
saran2020 Apr 23, 2019
ef0540f
Move the attr from app module to the library module
saran2020 Apr 23, 2019
0c1c6f7
Add kotlin dependency to the library module
saran2020 Apr 23, 2019
42017bf
Update the kotlin dependency version to 1.3.30 from 1.3.21
saran2020 Apr 23, 2019
59f3b00
Delete the unwanted attr file from the app module
saran2020 Apr 23, 2019
fdd0c61
Move the resource from the app module to the library module, because …
saran2020 Apr 23, 2019
1155a7b
Move the Slide rating code to the library module from the app module
saran2020 Apr 23, 2019
e613c03
Move the app module to package com.github.saran2020.app
saran2020 Apr 23, 2019
54f2886
Apply the missing kotlin plugin causing the build to fail
saran2020 Apr 23, 2019
821ad27
Updated the SlideRatingView to now import from the correct library pa…
saran2020 Apr 23, 2019
9ffefc6
Some minor cleanup of code
saran2020 Apr 23, 2019
0a40b0a
My bad. Correct the previous package name in the app modules xml was …
saran2020 Apr 23, 2019
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
7 changes: 2 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.github.saran2020.sliderating"
applicationId "com.github.saran2020.app"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
Expand All @@ -22,8 +20,7 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':sliderating')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.github.saran2020.sliderating">
xmlns:tools="http://schemas.android.com/tools" package="com.github.saran2020.app">

<application
android:allowBackup="true"
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/com/github/saran2020/app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.saran2020.app

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.TextView
import com.github.saran2020.sliderating.SlideRatingView

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val ratingView = findViewById<SlideRatingView>(R.id.slide_rating)
val ratingTextView = findViewById<TextView>(R.id.rating_text)

ratingView.callback = object : SlideRatingView.RatingChangeCallback {
override fun onRatingChanged(previous: Float, new: Float) {
ratingTextView.text = "$new"
}
}
}
}
12 changes: 0 additions & 12 deletions app/src/main/java/com/github/saran2020/sliderating/MainActivity.kt

This file was deleted.

23 changes: 15 additions & 8 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">

<com.github.saran2020.sliderating.SlideRatingView
android:id="@+id/slide_rating"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:initial_rating="@integer/initial_rating"
app:max_rating="@integer/max_rating"/>

<TextView
android:layout_width="wrap_content"
android:id="@+id/rating_text"
android:textSize="20sp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
android:text="@integer/initial_rating"/>

</android.support.constraint.ConstraintLayout>
</LinearLayout>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">SlideRating</string>
<item name="initial_rating" format="float" type="integer">2.5</item>
<item name="max_rating" format="integer" type="integer">5</item>
</resources>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_version = '1.3.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Apr 07 02:07:40 IST 2019
#Sun Apr 21 03:00:25 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app'
include ':app', ':sliderating'
1 change: 1 addition & 0 deletions sliderating/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
28 changes: 28 additions & 0 deletions sliderating/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28


defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
21 changes: 21 additions & 0 deletions sliderating/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions sliderating/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.saran2020.sliderating"/>
Loading