This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* this method used to update rating of product | |
* | |
* @param reviewModel | |
* @param productModel | |
*/ | |
private void updateRating(ReviewModel reviewModel, ProductModel productModel) { | |
ProductModel rate = new ProductModel(); | |
rate.setIdProduct(productModel.getIdProduct()); | |
rate.setProductName(productModel.getProductName()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Insert data review to collection of product | |
* @param review | |
*/ | |
private void insertDataReview(ReviewModel review) { | |
ReviewModel reviewModel = new ReviewModel(review.getName(), review.getReview(), review.getTimeStamp(), review.getTotalStarGiven()); | |
CollectionReference collectionReference = firebaseFirestore.collection("product"); | |
DocumentReference documentReference = collectionReference.document(productModelGlobal.getIdProduct()); | |
documentReference.collection("review") | |
.add(reviewModel) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_margin="@dimen/margin_value_10dp" | |
android:orientation="vertical"> | |
<LinearLayout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.putuguna.ratinggoogleplaystore.reviews; | |
import android.support.annotation.NonNull; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.TextView; | |
import com.putuguna.ratinggoogleplaystore.R; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.putuguna.ratinggoogleplaystore.reviews; | |
import java.util.Date; | |
public class ReviewModel { | |
private String name; | |
private String review; | |
private Date timeStamp; | |
private double totalStarGiven; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.putuguna.ratinggoogleplaystore.product; | |
import android.app.ProgressDialog; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.v7.app.AppCompatActivity; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.widget.Toast; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.putuguna.ratinggoogleplaystore.product; | |
import android.support.annotation.NonNull; | |
import android.support.v7.widget.CardView; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.TextView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:orientation="vertical"> | |
<android.support.v7.widget.CardView | |
android:id="@+id/cv_item" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.putuguna.ratinggoogleplaystore.reviews; | |
public class ProductModel { | |
private String idProduct; | |
private int totalVoters; | |
private double totalRating; | |
private int star1; | |
private int star2; | |
private int star3; | |
private int star4; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 27 | |
defaultConfig { | |
applicationId "com.putuguna.ratinggoogleplaystore" | |
minSdkVersion 15 | |
targetSdkVersion 27 | |
versionCode 1 | |
versionName "1.0" |