This file contains 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
<uses-permission android:name="android.permission.INTERNET"/> |
This file contains 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.app.Dialog; | |
import android.app.ProgressDialog; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.graphics.Color; | |
import android.graphics.drawable.ColorDrawable; | |
import android.os.Bundle; | |
import android.os.Handler; |
This file contains 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
/** | |
* the method used to get all reviews in firebase firestore | |
* @param idProduct | |
*/ | |
private void getAllReview(String idProduct) { | |
progressBar.setVisibility(View.VISIBLE); | |
rvReview.setVisibility(View.GONE); | |
CollectionReference collectionReference = firebaseFirestore.collection("product"); | |
DocumentReference documentReference = collectionReference.document(idProduct); | |
documentReference.collection("review") |
This file contains 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 display rating by colors | |
* | |
* @param productModel | |
*/ | |
private void setRatingByColor(ProductModel productModel) { | |
int widthView = constrainLayout1.getWidth(); | |
int totalAllVoters = productModel.getTotalVoters(); | |
int totalRateStar1 = productModel.getStar1(); | |
int totalRateStar2 = productModel.getStar2(); |
This file contains 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 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 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 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 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 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; |