diff --git a/app/build.gradle b/app/build.gradle
index cac7cc0..37963d7 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -78,7 +78,6 @@ dependencies {
implementation 'com.irozon.alertview:alertview:1.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.irozon.sneaker:sneaker:2.0.0'
- implementation 'com.github.halilozercan:BetterVideoPlayer:kotlin-SNAPSHOT'
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.1'
implementation('com.paytm:pgplussdk:1.3.3') { transitive = true; }
diff --git a/app/debug/output.json b/app/debug/output.json
new file mode 100644
index 0000000..44182ea
--- /dev/null
+++ b/app/debug/output.json
@@ -0,0 +1 @@
+[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"AppBoat v1.0.1","enabled":true,"outputFile":"app-debug.apk","fullName":"debug","baseName":"debug"},"path":"app-debug.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
index f26a056..c09e6d6 100644
--- a/app/google-services.json
+++ b/app/google-services.json
@@ -15,16 +15,12 @@
},
"oauth_client": [
{
- "client_id": "534879477500-jn3fjsh786273ltt8f14qf55u2v1i8sl.apps.googleusercontent.com",
+ "client_id": "534879477500-0d8a3n7sc0gqhi8tsb2t93neqil3ude3.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.pravrajya.diamond",
- "certificate_hash": "cbbd5e12583101441e56dcecb8cbf2d30d8e8edc"
+ "certificate_hash": "129c9510d985b6c650a52c783317b50db4afae0a"
}
- },
- {
- "client_id": "534879477500-hce79pt2b4iqtsdtesdlj3qgt9g9ef9g.apps.googleusercontent.com",
- "client_type": 3
}
],
"api_key": [
@@ -33,20 +29,13 @@
}
],
"services": {
- "analytics_service": {
- "status": 1
- },
"appinvite_service": {
- "status": 2,
"other_platform_oauth_client": [
{
"client_id": "534879477500-hce79pt2b4iqtsdtesdlj3qgt9g9ef9g.apps.googleusercontent.com",
"client_type": 3
}
]
- },
- "ads_service": {
- "status": 2
}
}
}
diff --git a/app/release/app.aab b/app/release/app.aab
deleted file mode 100644
index 13bdaf2..0000000
Binary files a/app/release/app.aab and /dev/null differ
diff --git a/app/release/output.json b/app/release/output.json
new file mode 100644
index 0000000..ecdebbb
--- /dev/null
+++ b/app/release/output.json
@@ -0,0 +1 @@
+[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"AppBoat v1.0.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 04cc481..e2cc2e9 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -51,10 +51,10 @@
-
+
diff --git a/app/src/main/java/com/pravrajya/diamond/api/video_player/PDLPlayerActivity.java b/app/src/main/java/com/pravrajya/diamond/api/video_player/PDLPlayerActivity.java
deleted file mode 100644
index c1f391f..0000000
--- a/app/src/main/java/com/pravrajya/diamond/api/video_player/PDLPlayerActivity.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.pravrajya.diamond.api.video_player;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.databinding.DataBindingUtil;
-
-import android.net.Uri;
-import android.os.Bundle;
-
-import com.pravrajya.diamond.R;
-import com.pravrajya.diamond.databinding.ActivityPdlplayerBinding;
-
-import static com.pravrajya.diamond.utils.Constants.TEST_URL;
-
-public class PDLPlayerActivity extends AppCompatActivity {
-
- // https://github.com/halilozercan/BetterVideoPlayer
- ActivityPdlplayerBinding binding;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- getSupportActionBar().hide();
- binding = DataBindingUtil.setContentView(this, R.layout.activity_pdlplayer);
- binding.player.setSource(Uri.parse(TEST_URL));
- }
-
-
- @Override
- protected void onPause() {
- super.onPause();
- binding.player.pause();
- }
-
-}
diff --git a/app/src/main/java/com/pravrajya/diamond/api/video_player/WatchVideoActivity.java b/app/src/main/java/com/pravrajya/diamond/api/video_player/WatchVideoActivity.java
new file mode 100644
index 0000000..13b2e19
--- /dev/null
+++ b/app/src/main/java/com/pravrajya/diamond/api/video_player/WatchVideoActivity.java
@@ -0,0 +1,66 @@
+package com.pravrajya.diamond.api.video_player;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.databinding.DataBindingUtil;
+import android.app.ProgressDialog;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.Window;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ProgressBar;
+
+import com.pravrajya.diamond.R;
+import com.pravrajya.diamond.databinding.ActivityPdlplayerBinding;
+
+
+public class WatchVideoActivity extends AppCompatActivity {
+
+ private ActivityPdlplayerBinding binding;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getSupportActionBar().hide();
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_pdlplayer);
+ Intent intent = getIntent();
+ String vedio_link = intent.getStringExtra("vedio_link");
+
+ //pd = new ProgressDialog(WatchVideoActivity.this);
+ //pd.setMessage("Please wait Loading...");
+ binding.progressBar.setVisibility(View.VISIBLE);
+ binding.webview.setWebViewClient(new MyWebViewClient());
+ if (vedio_link!=null && !vedio_link.isEmpty()){
+ binding.webview.loadUrl(vedio_link);
+ }else {
+ binding.webview.loadUrl("https://cutwise.com/diamond/30672");
+ }
+
+ }
+
+
+ private class MyWebViewClient extends WebViewClient {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ view.loadUrl(url);
+
+ binding.progressBar.setVisibility(View.VISIBLE);
+
+ return true;
+ }
+
+ @Override
+ public void onPageFinished(WebView view, String url) {
+ System.out.println("on finish");
+ binding.progressBar.setVisibility(View.INVISIBLE);
+
+ }
+ }
+
+
+
+
+
+}
diff --git a/app/src/main/java/com/pravrajya/diamond/tables/RealmManager.java b/app/src/main/java/com/pravrajya/diamond/tables/RealmManager.java
index bebf558..985105b 100644
--- a/app/src/main/java/com/pravrajya/diamond/tables/RealmManager.java
+++ b/app/src/main/java/com/pravrajya/diamond/tables/RealmManager.java
@@ -1,11 +1,11 @@
package com.pravrajya.diamond.tables;
+import com.pravrajya.diamond.tables.diamondClarity.DiamondClarityDao;
import com.pravrajya.diamond.tables.diamondColor.DiamondColorDao;
import com.pravrajya.diamond.tables.diamondCut.DiamondCutDao;
import com.pravrajya.diamond.tables.diamondSize.DiamondSizeDao;
import com.pravrajya.diamond.tables.faq.FaqDao;
import com.pravrajya.diamond.tables.offers.OfferTableDao;
import com.pravrajya.diamond.tables.order.CartTableDao;
-import com.pravrajya.diamond.tables.product.ProductList;
import com.pravrajya.diamond.tables.product.ProductTableDao;
import io.realm.Realm;
@@ -51,6 +51,11 @@ public static DiamondColorDao diamondColorDao() {
return new DiamondColorDao(mRealm);
}
+ public static DiamondClarityDao diamondClarityDao() {
+ checkForOpenRealm();
+ return new DiamondClarityDao(mRealm);
+ }
+
public static DiamondSizeDao diamondSizeDao(){
checkForOpenRealm();
return new DiamondSizeDao(mRealm);
@@ -67,12 +72,6 @@ public static FaqDao faqDao(){
return new AdminPanelDao(mRealm);
}*/
- public static void clear() {
- checkForOpenRealm();
- mRealm.executeTransaction(realm -> {
- realm.delete(ProductList.class);
- });
- }
private static void checkForOpenRealm() {
if (mRealm == null || mRealm.isClosed()) {
diff --git a/app/src/main/java/com/pravrajya/diamond/tables/diamondClarity/DiamondClarity.java b/app/src/main/java/com/pravrajya/diamond/tables/diamondClarity/DiamondClarity.java
new file mode 100644
index 0000000..5afbbb1
--- /dev/null
+++ b/app/src/main/java/com/pravrajya/diamond/tables/diamondClarity/DiamondClarity.java
@@ -0,0 +1,36 @@
+package com.pravrajya.diamond.tables.diamondClarity;
+
+import io.realm.RealmObject;
+import io.realm.annotations.PrimaryKey;
+
+public class DiamondClarity extends RealmObject {
+
+ @PrimaryKey
+ private String clarity;
+ private String clarityCode;
+
+ public DiamondClarity() {
+ }
+
+
+ public DiamondClarity(String clarity, String clarityCode) {
+ this.clarity = clarity;
+ this.clarityCode = clarityCode;
+ }
+
+ public String getClarity() {
+ return clarity;
+ }
+
+ public void setClarity(String clarity) {
+ this.clarity = clarity;
+ }
+
+ public String getClarityCode() {
+ return clarityCode;
+ }
+
+ public void setClarityCode(String clarityCode) {
+ this.clarityCode = clarityCode;
+ }
+}
diff --git a/app/src/main/java/com/pravrajya/diamond/tables/diamondClarity/DiamondClarityDao.java b/app/src/main/java/com/pravrajya/diamond/tables/diamondClarity/DiamondClarityDao.java
new file mode 100644
index 0000000..c47c82b
--- /dev/null
+++ b/app/src/main/java/com/pravrajya/diamond/tables/diamondClarity/DiamondClarityDao.java
@@ -0,0 +1,52 @@
+package com.pravrajya.diamond.tables.diamondClarity;
+
+
+import com.pravrajya.diamond.tables.diamondColor.DiamondColor;
+
+import java.util.List;
+
+import androidx.annotation.NonNull;
+import io.realm.Realm;
+import io.realm.RealmObject;
+import io.realm.RealmResults;
+
+public class DiamondClarityDao {
+
+ private Realm mRealm;
+
+ public DiamondClarityDao(@NonNull Realm realm) {
+ mRealm = realm;
+ }
+
+ public void save(final DiamondClarity diamondClarity) {
+ mRealm.executeTransaction(realm -> realm.copyToRealmOrUpdate(diamondClarity));
+ }
+
+ public void save(final List list) {
+ mRealm.executeTransaction(realm -> realm.copyToRealmOrUpdate(list));
+ }
+
+ public RealmResults loadAll() {
+ return mRealm.where(DiamondClarity.class).findAll();
+ }
+
+ public RealmResults loadAllAsync() {
+ return mRealm.where(DiamondClarity.class).findAll();
+ }
+
+ public RealmObject loadBy(String uid) {
+ return mRealm.where(DiamondClarity.class).equalTo("uid", uid).findFirst();
+ }
+
+ public void remove(@NonNull final RealmObject object) {
+ mRealm.executeTransaction(realm -> object.deleteFromRealm());
+ }
+
+ public void removeAll() {
+ mRealm.executeTransaction(realm -> mRealm.delete(DiamondClarity.class));
+ }
+
+ public long count() {
+ return mRealm.where(DiamondClarity.class).count();
+ }
+}
diff --git a/app/src/main/java/com/pravrajya/diamond/tables/product/ProductList.java b/app/src/main/java/com/pravrajya/diamond/tables/product/ProductList.java
deleted file mode 100644
index b19cae0..0000000
--- a/app/src/main/java/com/pravrajya/diamond/tables/product/ProductList.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.pravrajya.diamond.tables.product;
-
-import io.realm.RealmObject;
-
-public class ProductList extends RealmObject {
-
- private String product;
- private String productWeight;
- private String high;
- private String low;
- private String price;
-
- public ProductList() { }
-
- public ProductList(String product, String productWeight, String high, String low, String price) {
- this.product = product;
- this.productWeight = productWeight;
- this.high = high;
- this.low = low;
- this.price = price;
- }
-
-
- public String getProduct() {
- return product;
- }
-
- public void setProduct(String product) {
- this.product = product;
- }
-
- public String getProductWeight() {
- return productWeight;
- }
-
- public void setProductWeight(String productWeight) {
- this.productWeight = productWeight;
- }
-
- public String getHigh() {
- return high;
- }
-
- public void setHigh(String high) {
- this.high = high;
- }
-
- public String getLow() {
- return low;
- }
-
- public void setLow(String low) {
- this.low = low;
- }
-
- public String getPrice() {
- return price;
- }
-
- public void setPrice(String price) {
- this.price = price;
- }
-
-
- @Override
- public String toString() {
- return "ProductList{" +
- "product='" + product + '\'' +
- ", productWeight='" + productWeight + '\'' +
- ", high='" + high + '\'' +
- ", low='" + low + '\'' +
- ", price='" + price + '\'' +
- '}';
- }
-}
diff --git a/app/src/main/java/com/pravrajya/diamond/tables/product/ProductTable.java b/app/src/main/java/com/pravrajya/diamond/tables/product/ProductTable.java
index dd16895..f57d2d3 100644
--- a/app/src/main/java/com/pravrajya/diamond/tables/product/ProductTable.java
+++ b/app/src/main/java/com/pravrajya/diamond/tables/product/ProductTable.java
@@ -7,63 +7,191 @@ public class ProductTable extends RealmObject {
@PrimaryKey
private String id;
- private Integer type;
- private String diamondColor;
- private ProductList productLists;
+ private String color;
+
+ private String stockId;
+ private String productWeight;
+ private String high;
+ private String low;
+ private String price;
+ private String shape;
+ private String shade;
+ private String size;
+ private String clarity;
+ private String cut;
+ private String polish;
+ private String symmetry;
+ private String culet;
+ private String fluorescence;
+ private String licence;
+ private String vedioLink;
+
public ProductTable() { }
- public ProductTable(String diamondColor, Integer type) {
- this.diamondColor = diamondColor;
- this.type = type;
+
+ public String getId() {
+ return id;
}
- public ProductTable(String id, Integer type, String diamondColor, ProductList productLists) {
+ public void setId(String id) {
this.id = id;
- this.type = type;
- this.diamondColor = diamondColor;
- this.productLists = productLists;
}
- @Override
- public String toString() {
- return "ProductTable{" +
- "id='" + id + '\'' +
- ", type=" + type +
- ", diamondColor='" + diamondColor + '\'' +
- ", productLists=" + productLists +
- '}';
+ public String getStockId() {
+ return stockId;
}
- public String getId() {
- return id;
+ public void setStockId(String stockId) {
+ this.stockId = stockId;
}
- public void setId(String id) {
- this.id = id;
+ public String getProductWeight() {
+ return productWeight;
+ }
+
+ public void setProductWeight(String productWeight) {
+ this.productWeight = productWeight;
+ }
+
+ public String getHigh() {
+ return high;
+ }
+
+ public void setHigh(String high) {
+ this.high = high;
+ }
+
+ public String getLow() {
+ return low;
+ }
+
+ public void setLow(String low) {
+ this.low = low;
+ }
+
+ public String getPrice() {
+ return price;
}
- public Integer getType() {
- return type;
+ public void setPrice(String price) {
+ this.price = price;
}
- public void setType(Integer type) {
- this.type = type;
+ public String getShape() {
+ return shape;
}
- public String getDiamondColor() {
- return diamondColor;
+ public void setShape(String shape) {
+ this.shape = shape;
}
- public void setDiamondColor(String diamondColor) {
- this.diamondColor = diamondColor;
+ public String getShade() {
+ return shade;
}
- public ProductList getProductLists() {
- return productLists;
+ public void setShade(String shade) {
+ this.shade = shade;
}
- public void setProductLists(ProductList productLists) {
- this.productLists = productLists;
+ public String getSize() {
+ return size;
+ }
+
+ public void setSize(String size) {
+ this.size = size;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+
+ public String getClarity() {
+ return clarity;
+ }
+
+ public void setClarity(String clarity) {
+ this.clarity = clarity;
+ }
+
+ public String getCut() {
+ return cut;
+ }
+
+ public void setCut(String cut) {
+ this.cut = cut;
+ }
+
+ public String getPolish() {
+ return polish;
+ }
+
+ public void setPolish(String polish) {
+ this.polish = polish;
+ }
+
+ public String getSymmetry() {
+ return symmetry;
+ }
+
+ public void setSymmetry(String symmetry) {
+ this.symmetry = symmetry;
+ }
+
+ public String getCulet() {
+ return culet;
+ }
+
+ public void setCulet(String culet) {
+ this.culet = culet;
+ }
+
+ public String getFluorescence() {
+ return fluorescence;
+ }
+
+ public void setFluorescence(String fluorescence) {
+ this.fluorescence = fluorescence;
+ }
+
+ public String getLicence() {
+ return licence;
+ }
+
+ public void setLicence(String licence) {
+ this.licence = licence;
+ }
+
+ public String getVedioLink() { return vedioLink; }
+
+ public void setVedioLink(String vedioLink) { this.vedioLink = vedioLink; }
+
+
+ @Override
+ public String toString() {
+ return "ProductTable{" +
+ "id='" + id + '\'' +
+ ", color='" + color + '\'' +
+ ", stockId='" + stockId + '\'' +
+ ", productWeight='" + productWeight + '\'' +
+ ", high='" + high + '\'' +
+ ", low='" + low + '\'' +
+ ", price='" + price + '\'' +
+ ", shape='" + shape + '\'' +
+ ", shade='" + shade + '\'' +
+ ", size='" + size + '\'' +
+ ", clarity='" + clarity + '\'' +
+ ", cut='" + cut + '\'' +
+ ", polish='" + polish + '\'' +
+ ", symmetry='" + symmetry + '\'' +
+ ", culet='" + culet + '\'' +
+ ", fluorescence='" + fluorescence + '\'' +
+ ", licence='" + licence + '\'' +
+ ", vedioLink='" + vedioLink + '\'' +
+ '}';
}
}
diff --git a/app/src/main/java/com/pravrajya/diamond/utils/ClickListener.java b/app/src/main/java/com/pravrajya/diamond/utils/ClickListener.java
index c2f5138..b337416 100644
--- a/app/src/main/java/com/pravrajya/diamond/utils/ClickListener.java
+++ b/app/src/main/java/com/pravrajya/diamond/utils/ClickListener.java
@@ -4,7 +4,6 @@
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
-
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
diff --git a/app/src/main/java/com/pravrajya/diamond/utils/Constants.java b/app/src/main/java/com/pravrajya/diamond/utils/Constants.java
index 97d60d4..7d87987 100644
--- a/app/src/main/java/com/pravrajya/diamond/utils/Constants.java
+++ b/app/src/main/java/com/pravrajya/diamond/utils/Constants.java
@@ -4,8 +4,13 @@
public class Constants {
- public static final String DIAMOND_COLOR = "diamondColor";
- public static final String DIAMOND_CUT = "cut_type";
+ public static final String DIAMOND_COLOR = "color";
+ public static final String DIAMOND_SIZE = "size";
+ public static final String DIAMOND_CUT = "cut";
+ public static final String SELECTED_SIZE = "selected_size";
+ public static final String DIAMOND_CLARITY = "diamond_clarity";
+ public static final String SELECTED_CUT = "cut_type";
+ public static final String DIAMOND_CUT_URL = "diamond_cut_url";
public static final String DRAWER_SELECTION = "selected_drawer_path";
public static final String SELECTED_COLOR = "selectedColor";
public static final String USER_PROFILE = "USER_PROFILE";
@@ -16,11 +21,16 @@ public class Constants {
public static final String UID = "uid";
public static final String ID = "id";
public static final String DEFAULT_COLOR = "white";
+ public static final String DEFAULT_CUT = "round";
+ public static final String DEFAULT_SIZE = "+0.90";
public static final String DEVELOPER_INFO = "@Copyright "+ BuildConfig.VERSION_NAME;
public static final String TEST_URL = "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4";
-
public static final String ADMIN_CUT = "admin_cut";
public static final String ADMIN_FLUORESCENCE = "admin_fluorescence";
public static final String ADMIN_POLISH = "admin_polish";
public static final String ADMIN_SYMMETRY = "admin_symmetry";
+ public static final String ADMIN_CULET = "admin_culet";
+ public static final String ADMIN_COLOR_SHADE = "admin_color_shade";
+ public static final String VIDS_LINK = "https://firebasestorage.googleapis.com/v0/b/pdlfirebaseproject.appspot.com/o/videos%2Fvideo1.mp4?alt=media&token=921ceb6b-c0be-4925-a09a-4eb3b89a8536";
+
}
diff --git a/app/src/main/java/com/pravrajya/diamond/utils/FirebaseUtil.java b/app/src/main/java/com/pravrajya/diamond/utils/FirebaseUtil.java
index 667a49c..c49d734 100644
--- a/app/src/main/java/com/pravrajya/diamond/utils/FirebaseUtil.java
+++ b/app/src/main/java/com/pravrajya/diamond/utils/FirebaseUtil.java
@@ -10,6 +10,7 @@
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import com.pravrajya.diamond.tables.RealmManager;
+import com.pravrajya.diamond.tables.diamondClarity.DiamondClarity;
import com.pravrajya.diamond.tables.diamondColor.DiamondColor;
import com.pravrajya.diamond.tables.diamondCut.DiamondCut;
import com.pravrajya.diamond.tables.diamondSize.DiamondSize;
@@ -20,11 +21,19 @@
import com.pravrajya.diamond.views.users.login.UserProfile;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
+
+import static com.pravrajya.diamond.utils.Constants.ADMIN_COLOR_SHADE;
+import static com.pravrajya.diamond.utils.Constants.ADMIN_CULET;
+import static com.pravrajya.diamond.utils.Constants.ADMIN_CUT;
+import static com.pravrajya.diamond.utils.Constants.ADMIN_FLUORESCENCE;
+import static com.pravrajya.diamond.utils.Constants.ADMIN_POLISH;
+import static com.pravrajya.diamond.utils.Constants.ADMIN_SYMMETRY;
import static com.pravrajya.diamond.utils.Constants.USERS;
import static com.pravrajya.diamond.utils.Constants.USER_PROFILE;
@@ -49,8 +58,11 @@ public FirebaseUtil() {
loadALLOffers();
loadALLDiamondCut();
loadALLDiamondColor();
+ loadALLDiamondClarity();
loadALLDiamondSize();
loadALLAdminPanelItems();
+
+ //uploadAdminModel();
}
@@ -246,6 +258,48 @@ private void updateDiamondColors(DiamondColor diamondColor) {
+ /****************************************************************************/
+ /****************[ Load all Diamond Clarity ]****************/
+ /****************************************************************************/
+
+ private void loadALLDiamondClarity(){
+ Query lastQuery = dbReference.child(Constants.DIAMOND_CLARITY);//.orderByChild("color");
+ lastQuery.addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
+ if (dataSnapshot.exists()){
+ AsyncTask.execute(() -> clearDiamondClarity());
+ for (DataSnapshot snapshot: dataSnapshot.getChildren())
+ {
+ DiamondClarity diamondClarity = snapshot.getValue(DiamondClarity.class);
+ AsyncTask.execute(() -> updateDiamondClarity(diamondClarity));
+ }
+ }
+ }
+ @Override
+ public void onCancelled(@NonNull DatabaseError error) {
+ Log.w(TAG, "Failed to read value.", error.toException());
+ }
+ });
+
+ }
+
+
+
+ private void clearDiamondClarity(){
+ RealmManager.open();
+ RealmManager.diamondClarityDao().removeAll();
+ RealmManager.close();
+ }
+
+
+ private void updateDiamondClarity(DiamondClarity diamondClarity) {
+ RealmManager.open();
+ RealmManager.diamondClarityDao().save(diamondClarity);
+ RealmManager.close();
+ }
+
+
@@ -424,11 +478,53 @@ private void uploadAdminModel(){
arrayListFluorescence.add("Very Strong");
+ ArrayList arrayListCulet = new ArrayList<>();
+ arrayListCulet.add("None");
+ arrayListCulet.add("Very Small");
+ arrayListCulet.add("Small");
+ arrayListCulet.add("Medium");
+ arrayListCulet.add("Large");
+ arrayListCulet.add("Very Large");
+ arrayListCulet.add("Broken");
+
+
+ ArrayList arrayColorShade = new ArrayList<>();
+ arrayColorShade.add("D");
+ arrayColorShade.add("E");
+ arrayColorShade.add("F");
+ arrayColorShade.add("G");
+ arrayColorShade.add("H");
+ arrayColorShade.add("I");
+ arrayColorShade.add("I");
+ arrayColorShade.add("J");
+ arrayColorShade.add("K");
+ arrayColorShade.add("L");
+ arrayColorShade.add("M");
+ arrayColorShade.add("N");
+ arrayColorShade.add("O");
+ arrayColorShade.add("P");
+ arrayColorShade.add("Q");
+ arrayColorShade.add("R");
+ arrayColorShade.add("S");
+ arrayColorShade.add("T");
+ arrayColorShade.add("U");
+ arrayColorShade.add("V");
+ arrayColorShade.add("W");
+ arrayColorShade.add("X");
+ arrayColorShade.add("Y");
+ arrayColorShade.add("Z");
+ arrayColorShade.add("Fancy");
+
+
+
+
Map> adminPanelItems = new HashMap<>();
- adminPanelItems.put("admin_cut",arrayListCut);
- adminPanelItems.put("admin_polish",arrayListPolish);
- adminPanelItems.put("admin_symmetry",arrayListSymmetry);
- adminPanelItems.put("admin_fluorescence",arrayListFluorescence);
+ adminPanelItems.put(ADMIN_CUT,arrayListCut);
+ adminPanelItems.put(ADMIN_POLISH,arrayListPolish);
+ adminPanelItems.put(ADMIN_SYMMETRY,arrayListSymmetry);
+ adminPanelItems.put(ADMIN_FLUORESCENCE,arrayListFluorescence);
+ adminPanelItems.put(ADMIN_CULET, arrayListCulet);
+ adminPanelItems.put(ADMIN_COLOR_SHADE, arrayColorShade);
dbReference.child("admin_panel").setValue(adminPanelItems).addOnSuccessListener(aVoid -> {
Log.e("admin_panel", "admin_panel updated");
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/AdminListAdapter.java b/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/AdminListAdapter.java
index ffdb7d4..127625a 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/AdminListAdapter.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/AdminListAdapter.java
@@ -1,20 +1,13 @@
package com.pravrajya.diamond.views.admin.adapters;
-import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.TextView;
-
import com.pravrajya.diamond.R;
-import com.pravrajya.diamond.tables.product.ProductList;
import com.pravrajya.diamond.tables.product.ProductTable;
-
-import java.util.List;
-import java.util.concurrent.ThreadLocalRandom;
-
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import io.realm.RealmResults;
@@ -36,16 +29,17 @@ public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType)
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
- ProductList item = itemList.get(position).getProductLists();
+ ProductTable item = itemList.get(position);
if (position % 2 == 1) {
holder.viewColor.setBackgroundColor(holder.viewColor.getContext().getResources().getColor(R.color.colorPrimary));
} else {
holder.viewColor.setBackgroundColor(holder.viewColor.getContext().getResources().getColor(R.color.colorAccent));
}
- holder.tvItem.setText(item.getProduct());
+ holder.tvItem.setText(item.getClarity());
if (item.getProductWeight()==null){
holder.tvWeight.setText("0.0");
}else { holder.tvWeight.setText(item.getProductWeight());}
+
holder.tvHigh.setText(item.getHigh());
holder.tvLow.setText(item.getLow());
holder.tvPrice.setText(item.getPrice());
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/ChipAdapter.java b/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/ChipAdapter.java
index a560f57..c8fb889 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/ChipAdapter.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/admin/adapters/ChipAdapter.java
@@ -5,13 +5,9 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
-
import com.pravrajya.diamond.R;
import com.pravrajya.diamond.tables.diamondColor.DiamondColor;
-import com.pravrajya.diamond.tables.diamondCut.DiamondCut;
-
import java.util.List;
-
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_crud/CRUDActivity.java b/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_crud/CRUDActivity.java
index 5a5c31d..c6f1a4f 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_crud/CRUDActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_crud/CRUDActivity.java
@@ -5,7 +5,6 @@
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
-import androidx.recyclerview.widget.LinearLayoutManager;
import de.mrapp.android.bottomsheet.BottomSheet;
import io.realm.Realm;
import io.realm.RealmResults;
@@ -13,34 +12,30 @@
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
+import android.widget.AdapterView;
import android.widget.EditText;
+import android.widget.TextView;
import android.widget.Toast;
import com.fxn.stash.Stash;
+import com.google.android.material.textfield.TextInputEditText;
+import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.database.DatabaseReference;
import com.pravrajya.diamond.R;
import com.pravrajya.diamond.databinding.ContentAdminBinding;
+import com.pravrajya.diamond.tables.diamondClarity.DiamondClarity;
import com.pravrajya.diamond.tables.diamondColor.DiamondColor;
import com.pravrajya.diamond.tables.diamondCut.DiamondCut;
import com.pravrajya.diamond.tables.diamondSize.DiamondSize;
import com.pravrajya.diamond.utils.Constants;
import com.pravrajya.diamond.views.BaseActivity;
-import com.pravrajya.diamond.views.admin.adapters.ChipAdapter;
-import com.pravrajya.diamond.tables.product.ProductList;
import com.pravrajya.diamond.tables.product.ProductTable;
import com.pravrajya.diamond.tables.RealmManager;
-import com.pravrajya.diamond.utils.ClickListener;
import com.pravrajya.diamond.views.admin.views.admin_products.ProductsListActivity;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import java.util.Objects;
import java.util.UUID;
-
import static com.pravrajya.diamond.utils.Constants.ID;
import static com.pravrajya.diamond.utils.FirebaseUtil.getDatabase;
@@ -52,86 +47,75 @@ public class CRUDActivity extends BaseActivity {
private String selectedColorChip = null;
private String selectedProductId = null;
private DatabaseReference dbReference;
- private List diamondCutList;
+
+ public String getSelected_licence() {
+ return this.selected_licence;
+ }
+
+ public void setSelected_licence(String selected_licence) {
+ this.selected_licence = selected_licence;
+ }
+
+ private String selected_licence;
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- Objects.requireNonNull(getSupportActionBar()).setElevation(0);
+ binding = DataBindingUtil.setContentView(this, R.layout.content_admin);
+ Objects.requireNonNull(getSupportActionBar()).setTitle("Add new product");
+ getSupportActionBar().setElevation(0);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
realm = Realm.getDefaultInstance();
dbReference = getDatabase().getReference();
- binding = DataBindingUtil.setContentView(this, R.layout.content_admin);
-
- Objects.requireNonNull(getSupportActionBar()).setTitle("Add new product");
+ loadSelectedOptions();
Intent intent = getIntent();
if (intent!=null)
{
selectedProductId = intent.getStringExtra("selectedProductId");
- if (selectedProductId!=null){
+ if (selectedProductId!=null)
+ {
getSupportActionBar().setTitle("Update Product");
binding.btnAddProduct.setText("Update Product");
+ updateProduct();
}
}
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
btnClickHandler();
}
-
-
-
-
- @SuppressLint("SetTextI18n")
- private void btnClickHandler() {
-
- binding.tvColor.setText("Select your diamond color");
- diamondCutList = realm.where(DiamondColor.class).sort("color").findAll();
- ChipAdapter adapter = new ChipAdapter(diamondCutList);
- LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
- binding.colorRecyclerView.setLayoutManager(layoutManager);
- binding.colorRecyclerView.setAdapter(adapter);
-
- adapter.notifyDataSetChanged();
- binding.colorRecyclerView.addOnItemTouchListener(new ClickListener(getApplicationContext(), binding.colorRecyclerView, (view, position) -> {
- DiamondColor diamondColor = diamondCutList.get(position);
- assert diamondColor != null;
- selectedColorChip = diamondColor.getColor();
- Toast.makeText(getApplicationContext(), selectedColorChip, Toast.LENGTH_SHORT).show();
-
- }));
-
-
- /*****************************************************************************/
+ private void updateProduct(){
if (selectedProductId !=null)
{
ProductTable product = realm.where(ProductTable.class).equalTo(ID, selectedProductId).findFirst();
assert product != null;
- binding.tvColor.setText("Please select ( "+product.getDiamondColor().toUpperCase()+" ) from below.");
- // Function to find the index of an element
- //boolean isAvailable = diamondCutList.contains(table.getDiamondColor());
- //binding.colorRecyclerView.findViewHolderForAdapterPosition(3).itemView.performClick();
- /*Autho select color item*/
- ProductList productList = product.getProductLists();
- binding.etProduct.setText(productList.getProduct());
- if (productList.getProductWeight()==null){
- binding.etProductWeight.setText(productList.getProductWeight());
- }
- binding.etHighPrice.setText(productList.getHigh());
- binding.etLowPrice.setText(productList.getLow());
- binding.etPrice.setText(productList.getPrice());
+ binding.etStockId.setText(product.getStockId());
+ binding.etHighPrice.setText(product.getHigh());
+ binding.etLowPrice.setText(product.getLow());
+ binding.etPrice.setText(product.getPrice());
+ binding.etProductWeight.setText(product.getProductWeight());
+ binding.etShape.setText(product.getShape());
+ binding.etSize.setText(product.getSize());
+ binding.etColor.setText(product.getColor());
+ binding.etClarity.setText(product.getClarity());
+ binding.etCut.setText(product.getCut());
+ //binding.etCulet.setText(product.getCulet());
+ binding.etVideoLink.setText(product.getVedioLink());
+ binding.etPolish.setText(product.getPolish());
+ binding.etSymmetry.setText(product.getSymmetry());
+ binding.etFluorescence.setText(product.getFluorescence());
}
- /*****************************************************************************/
- loadSelectedOptions();
+ }
+ @SuppressLint("SetTextI18n")
+ private void btnClickHandler() {
binding.btnAddProduct.setOnClickListener(view->{
- String product = Objects.requireNonNull(binding.etProduct.getText()).toString().trim();
+ String stockId = Objects.requireNonNull(binding.etStockId.getText()).toString().trim();
String Weight = Objects.requireNonNull(binding.etProductWeight.getText()).toString().trim();
String highPrice = Objects.requireNonNull(binding.etHighPrice.getText()).toString().trim();
String lowPrice = Objects.requireNonNull(binding.etLowPrice.getText()).toString().trim();
@@ -143,76 +127,86 @@ private void btnClickHandler() {
String cut = Objects.requireNonNull(binding.etCut.getText().toString().trim());
String polish = Objects.requireNonNull(binding.etPolish.getText().toString().trim());
String symmetry = Objects.requireNonNull(binding.etSymmetry.getText().toString().trim());
- String fluorescence = Objects.requireNonNull(binding.etFluorescence.getText().toString().trim());
-
- if (selectedColorChip ==null){
- Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
- binding.colorRecyclerView.startAnimation(shake);
- binding.tvColor.startAnimation(shake);
- } else if (product.isEmpty()){
- clearAllErrors(binding.etProduct);
- binding.textInputLayoutProduct.setError("Product can not be empty");
+ String culet = Objects.requireNonNull(binding.etCulet.getText().toString().trim());
+ String fluores = Objects.requireNonNull(binding.etFluorescence.getText().toString().trim());
+ String certNumber= Objects.requireNonNull(binding.etCertNo.getText()).toString().trim();
+ String shade = Objects.requireNonNull(binding.etShade.getText()).toString();
+ String videoLink = Objects.requireNonNull(binding.etVideoLink.getText()).toString();
+
+ if (stockId.isEmpty()){
+ clearAllErrors("Stock ID", binding.textInputLayoutProduct, binding.etStockId);
}else if (Weight.isEmpty()){
- clearAllErrors(binding.etProductWeight);
- binding.textInputLayoutProductWeight.setError("Product Weight can not be empty");
+ clearAllErrors("Weight", binding.textInputLayoutProductWeight, binding.etProductWeight);
}else if (highPrice.isEmpty()){
- clearAllErrors(binding.etHighPrice);
- binding.textInputHighPrice.setError("High price can not be empty");
+ clearAllErrors("High Price", binding.textInputHighPrice, binding.etHighPrice);
}else if (highPrice.length()<3){
- clearAllErrors(binding.etHighPrice);
binding.textInputHighPrice.setError("High price can not be less than 100");
}else if (lowPrice.isEmpty()){
- clearAllErrors(binding.etLowPrice);
- binding.textInputLayoutLowPrice.setError("Low price can not be empty");
+ clearAllErrors("Low Price",binding.textInputLayoutLowPrice, binding.etLowPrice);
}else if (lowPrice.length()<3){
- clearAllErrors(binding.etLowPrice);
binding.textInputLayoutLowPrice.setError("Low price can not be less than 100");
}else if (price.isEmpty()){
- clearAllErrors(binding.etPrice);
- binding.textInputLayoutPrice.setError("Low price can not be empty");
+ clearAllErrors("Price",binding.textInputLayoutPrice, binding.etPrice);
}else if (price.length()<3){
- clearAllErrors(binding.etPrice);
binding.textInputLayoutPrice.setError("Price can not be less than 100");
}else if (shape.isEmpty()){
- clearAllErrors(binding.etShape);
- binding.textInputLayoutShape.setError("Please select shape");
- }else if (size.isEmpty()){
- clearAllErrors(binding.etSize);
- binding.textInputLayoutSize.setError("Please select Size");
+ clearAllErrors("Shape",binding.textInputLayoutShape, binding.etShape);
+ }/*else if (shade.isEmpty()){
+ clearAllErrors("Shade",binding.textInputLayoutShade, binding.etShade);
+ }*/else if (size.isEmpty()){
+ clearAllErrors("Size",binding.textInputLayoutSize, binding.etSize);
}else if (color.isEmpty()){
- clearAllErrors(binding.etColor);
- binding.textInputLayoutColor.setError("Please select Color Type");
+ clearAllErrors("Color",binding.textInputLayoutColor, binding.etColor);
}else if (clarity.isEmpty()){
- clearAllErrors(binding.etClarity);
- binding.textInputLayoutClarity.setError("Please select Clarity Type");
+ clearAllErrors("Clarity",binding.textInputLayoutClarity, binding.etClarity);
}else if (cut.isEmpty()){
- clearAllErrors(binding.etCut);
- binding.textInputLayoutCut.setError("Please select Cut Type");
+ clearAllErrors("Cut",binding.textInputLayoutCut, binding.etCut);
}else if (polish.isEmpty()){
- clearAllErrors(binding.etPolish);
- binding.textInputLayoutPolish.setError("Please select Polish Type");
+ clearAllErrors("Polish",binding.textInputLayoutPolish, binding.etPolish);
}else if (symmetry.isEmpty()){
- clearAllErrors(binding.etSymmetry);
- binding.textInputLayoutSymmetry.setError("Please select Symmetry Type");
- }else if (fluorescence.isEmpty()){
- clearAllErrors(binding.etFluorescence);
- binding.textInputLayoutSymmetry.setError("Please select Symmetry Type");
+ clearAllErrors("Symmetry",binding.textInputLayoutSymmetry, binding.etSymmetry);
+ }else if (culet.isEmpty()){
+ clearAllErrors("Culet",binding.textInputLayoutCulet, binding.etCulet);
+ }else if (fluores.isEmpty()){
+ clearAllErrors("Fluorescence",binding.textInputLayoutFluorescence, binding.etFluorescence);
+ }else if (videoLink.isEmpty()){
+ clearAllErrors("Video Link",binding.textInputLayoutVideo, binding.etVideoLink);
}else {
String uniqueID = UUID.randomUUID().toString();
- if (selectedProductId!=null) {uniqueID = selectedProductId;}
- /******************************************************/
- ProductList productList = new ProductList();
- productList.setProduct(product);
- productList.setProductWeight(Weight);
- productList.setHigh(highPrice);
- productList.setLow(lowPrice);
- productList.setPrice(price);
+ if (selectedProductId!=null) {
+ uniqueID = selectedProductId;
+ }
+
+
/******************************************************/
+
ProductTable productTable = new ProductTable();
productTable.setId(uniqueID);
- productTable.setDiamondColor(selectedColorChip);
- productTable.setProductLists(productList);
+ productTable.setColor(selectedColorChip);
+ productTable.setStockId(stockId);
+ productTable.setProductWeight(Weight);
+ productTable.setHigh(highPrice);
+ productTable.setLow(lowPrice);
+ productTable.setPrice(price);
+ productTable.setShape(shape);
+ productTable.setShade(shade);
+ productTable.setSize(size);
+ productTable.setColor(color);
+ productTable.setClarity(clarity);
+ productTable.setCut(cut);
+ productTable.setPolish(polish);
+ productTable.setSymmetry(symmetry);
+ productTable.setCulet(culet);
+ productTable.setFluorescence(fluores);
+ productTable.setVedioLink(videoLink);
+
+ if (!getSelected_licence().equalsIgnoreCase("NONE") && !certNumber.isEmpty()){
+ productTable.setLicence(getSelected_licence()+":"+certNumber);
+ }
+
+
+
/******************************************************/
String information = "Make sure all information is correct";
@@ -223,29 +217,35 @@ private void btnClickHandler() {
}
}
});
-
}
-
-
private void loadSelectedOptions() {
-
binding.etShape.setOnClickListener(view->{
loadShapes(binding.etShape);
- });binding.etSize.setOnClickListener(view->{
- loadSizes(binding.etSize);
- });binding.etColor.setOnClickListener(view->{
- loadColors(binding.etColor);
- });binding.etClarity.setOnClickListener(view->{
- loadClarity(binding.etClarity);
- });binding.etCut.setOnClickListener(view->{
- loadAdminItem(binding.etCut, Constants.ADMIN_CUT);
- });binding.etPolish.setOnClickListener(view->{
- loadAdminItem(binding.etPolish, Constants.ADMIN_POLISH);
- });binding.etSymmetry.setOnClickListener(view->{
- loadAdminItem(binding.etSymmetry, Constants.ADMIN_SYMMETRY);
- });binding.etFluorescence.setOnClickListener(view->{
- loadAdminItem(binding.etFluorescence, Constants.ADMIN_FLUORESCENCE);
+ });binding.etSize.setOnClickListener(view->{ loadSizes(binding.etSize);
+ });binding.etColor.setOnClickListener(view->{ loadColors(binding.etColor);
+ });binding.etClarity.setOnClickListener(view->{ loadClarity(binding.etClarity);
+ });binding.etCut.setOnClickListener(view->{ loadAdminItem(binding.etCut, Constants.ADMIN_CUT);
+ });binding.etPolish.setOnClickListener(view->{ loadAdminItem(binding.etPolish, Constants.ADMIN_POLISH);
+ });binding.etSymmetry.setOnClickListener(view->{ loadAdminItem(binding.etSymmetry, Constants.ADMIN_SYMMETRY);
+ });binding.etCulet.setOnClickListener(view->{ loadAdminItem(binding.etCulet, Constants.ADMIN_CULET);
+ });binding.etFluorescence.setOnClickListener(view->{ loadAdminItem(binding.etFluorescence, Constants.ADMIN_FLUORESCENCE);
+ });binding.etShade.setOnClickListener(view->{ loadAdminItem(binding.etShade, Constants.ADMIN_COLOR_SHADE);
+ });
+
+ binding.licenceSpinn.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> parent, View view, int position, long id) {
+
+ if (parent.getItemAtPosition(position)!=null){
+ setSelected_licence(parent.getItemAtPosition(position).toString());
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent) {
+
+ }
});
}
@@ -255,10 +255,14 @@ private void loadShapes(EditText editText){
BottomSheet.Builder builder = new BottomSheet.Builder(this);
BottomSheet bottomSheet = builder.create();
for (int pos = 0; pos { editText.setText(diamondCuts.get(position).getCut_type()); });
+ builder.setOnItemClickListener((parent, view, position, id) -> {
+ editText.setText(diamondCuts.get(position).getCut_type());
+
+ });
}
@@ -282,6 +286,7 @@ private void loadColors(EditText editText){
BottomSheet.Builder builder = new BottomSheet.Builder(this);
BottomSheet bottomSheet = builder.create();
for (int pos = 0; pos productTables = realm.where(ProductTable.class).findAll();
+ final RealmResults diamondClarities = realm.where(DiamondClarity.class).findAll();
BottomSheet.Builder builder = new BottomSheet.Builder(this);
BottomSheet bottomSheet = builder.create();
- for (int pos = 0; pos0){
+ for (int pos = 0; pos { editText.setText(productTables.get(position).getProductLists().getProduct()); });
+ builder.setOnItemClickListener((parent, view, position, id) -> { editText.setText(diamondClarities.get(position).getClarity()); });
}
@@ -312,44 +320,50 @@ private void loadAdminItem(EditText editText, String key){
editText.setText(stringArrayList.get(position)); });
}
- private void clearAllErrors(View requestFocus)
- {
+ private void clearAllErrors(String errorMsg, TextInputLayout inputLayout, View requestFocus) {
+
if (requestFocus!=null){ requestFocus.requestFocus(); }
+
binding.textInputLayoutProduct.setError(null);
binding.textInputHighPrice.setError(null);
binding.textInputLayoutProductWeight.setError(null);
binding.textInputLayoutLowPrice.setError(null);
binding.textInputLayoutPrice.setError(null);
-
binding.textInputLayoutShape.setError(null);
+ binding.textInputLayoutShade.setError(null);
binding.textInputLayoutSize.setError(null);
binding.textInputLayoutColor.setError(null);
binding.textInputLayoutClarity.setError(null);
binding.textInputLayoutCut.setError(null);
binding.textInputLayoutPolish.setError(null);
binding.textInputLayoutSymmetry.setError(null);
+ binding.textInputLayoutCulet.setError(null);
binding.textInputLayoutFluorescence.setError(null);
+
+ if (inputLayout!=null){
+ inputLayout.setError(errorMsg+" can't be Empty");
+ }
+
}
- private void clearEditTexts()
- {
- binding.etProduct.setText("");
+ private void clearEditTexts() {
+ binding.etStockId.setText("");
binding.etProductWeight.setText("");
binding.etHighPrice.setText("");
binding.etLowPrice.setText("");
- binding.etProduct.setText("");
binding.etShape.setText("");
+ binding.etShade.setText("");
binding.etSize.setText("");
binding.etColor.setText("");
binding.etClarity.setText("");
binding.etCut.setText("");
binding.etPolish.setText("");
binding.etSymmetry.setText("");
+ binding.etCulet.setText("");
binding.etFluorescence.setText("");
}
private void showAlertDialog(String title, String subtitle, ProductTable productTable ){
-
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(title);
builder.setMessage(subtitle);
@@ -358,25 +372,25 @@ private void showAlertDialog(String title, String subtitle, ProductTable product
RealmManager.open();
RealmManager.createProductTableDao().save(productTable);
RealmManager.close();
- clearAllErrors(null);
+
dialog.dismiss();
- clearEditTexts();
syncProductToServer(productTable);
}).setNegativeButton("Cancel", (dialog, which) -> {
});
builder.show();
-
- //loadProductTable();
}
public void syncProductToServer(ProductTable productTable){
- showProgressDialog(productTable.getProductLists().getProduct()+" syncing to server...");
+ showProgressDialog(productTable.getClarity()+" syncing to server...");
dbReference.child("products").child(productTable.getId()).setValue(productTable)
.addOnSuccessListener(aVoid -> {
hideProgressDialog();
- successToast(productTable.getProductLists().getProduct()+" syncing completed");
+ clearAllErrors("",null, null);
+ clearEditTexts();
+
+ successToast(productTable.getClarity()+" syncing completed");
Intent intent = new Intent(getApplicationContext(), ProductsListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
@@ -387,8 +401,6 @@ public void syncProductToServer(ProductTable productTable){
});
}
-
-
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_products/AdminProductsListAdapter.java b/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_products/AdminProductsListAdapter.java
new file mode 100644
index 0000000..dcc52dd
--- /dev/null
+++ b/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_products/AdminProductsListAdapter.java
@@ -0,0 +1,96 @@
+package com.pravrajya.diamond.views.admin.views.admin_products;
+
+import android.graphics.Color;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.AlphaAnimation;
+import android.view.animation.Animation;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import com.pravrajya.diamond.R;
+import com.pravrajya.diamond.tables.product.ProductTable;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+import io.realm.RealmResults;
+
+public class AdminProductsListAdapter extends RecyclerView.Adapter {
+
+ private RealmResults itemList;
+ private boolean isSelected = false;
+
+ AdminProductsListAdapter(RealmResults itemList) {
+ this.itemList = itemList;
+ }
+
+ @NonNull
+ @Override
+ public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.admin_products_list_row, parent, false);
+ return new MyViewHolder(itemView);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
+
+ ProductTable item = itemList.get(position);
+ assert item != null;
+ holder.tvClarity.setText(item.getClarity());
+
+ if (item.getProductWeight()==null){
+ holder.tvWeight.setText("0.0");
+ }
+ else {
+ holder.tvWeight.setText(item.getProductWeight());
+ }
+ holder.tvColor.setText(item.getColor());
+ holder.tvHighPrice.setText(String.format("High $%s", item.getHigh()));
+ holder.tvLowPrice.setText(String.format("Low $%s", item.getLow()));
+ holder.tvPrice.setText(String.format("Price $%s", item.getPrice()));
+
+
+ /*int COLOR_RED = holder.itemView.getContext().getResources().getColor(R.color.colorAccent);
+ holder.itemView.setBackgroundColor(item.isSelected() ? COLOR_RED: Color.WHITE);
+ holder.itemView.setOnClickListener(view -> {
+ item.setSelected(!item.isSelected());
+ holder.itemView.setBackgroundColor(item.isSelected() ? COLOR_RED: Color.WHITE);
+ holder.tvDetails.setText(item.toString());
+ });*/
+
+
+ }
+
+ private void animateView(View view) {
+ Animation anim = new AlphaAnimation(0.0f, 1.0f);
+ anim.setDuration(250);
+ anim.setStartOffset(200);
+ anim.setRepeatMode(Animation.REVERSE);
+ anim.setRepeatCount(Animation.INFINITE);
+ view.startAnimation(anim);
+ }
+
+ @Override
+ public int getItemCount() {
+ return itemList.size();
+ }
+
+
+ class MyViewHolder extends RecyclerView.ViewHolder {
+
+ TextView tvColor, tvClarity, tvWeight, tvHighPrice, tvLowPrice, tvPrice, tvDetails;
+
+ MyViewHolder(View view) {
+ super(view);
+
+ tvClarity = view.findViewById(R.id.tvClarity);
+ tvColor = view.findViewById(R.id.tvColor);
+ tvWeight = view.findViewById(R.id.tvWeight);
+ tvHighPrice = view.findViewById(R.id.tvHighPrice);
+ tvLowPrice = view.findViewById(R.id.tvLowPrice);
+ tvPrice = view.findViewById(R.id.tvPrice);
+ tvDetails = view.findViewById(R.id.tvDetails);
+
+
+ }
+ }
+}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_products/ProductsListActivity.java b/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_products/ProductsListActivity.java
index 9a23d80..00ebc17 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_products/ProductsListActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/admin/views/admin_products/ProductsListActivity.java
@@ -1,6 +1,7 @@
package com.pravrajya.diamond.views.admin.views.admin_products;
import androidx.appcompat.app.AlertDialog;
+import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -11,75 +12,117 @@
import android.content.Intent;
import android.os.Bundle;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
+import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.pravrajya.diamond.R;
+import com.pravrajya.diamond.databinding.ActivityAdminProductsBinding;
import com.pravrajya.diamond.databinding.AdminProductsBinding;
+import com.pravrajya.diamond.tables.diamondColor.DiamondColor;
import com.pravrajya.diamond.utils.ClickListener;
+import com.pravrajya.diamond.utils.Constants;
import com.pravrajya.diamond.utils.ItemDecoration;
import com.pravrajya.diamond.views.BaseActivity;
import com.pravrajya.diamond.views.admin.adapters.AdminListAdapter;
import com.pravrajya.diamond.tables.product.ProductTable;
+import com.pravrajya.diamond.views.admin.adapters.ChipAdapter;
import com.pravrajya.diamond.views.admin.views.admin_crud.CRUDActivity;
import com.pravrajya.diamond.views.admin.views.offers.AddOfferActivity;
+import java.util.Objects;
+
+import static com.pravrajya.diamond.utils.Constants.DEFAULT_COLOR;
+import static com.pravrajya.diamond.utils.Constants.DIAMOND_COLOR;
import static com.pravrajya.diamond.utils.FirebaseUtil.getDatabase;
public class ProductsListActivity extends BaseActivity {
private Realm realmInstance;
- private AdminListAdapter adapter;
- private RealmResults loadProductTable;
- private AdminProductsBinding binding;
+ private ActivityAdminProductsBinding binding;
private DatabaseReference dbReference;
+ private RealmResults loadProductTable;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_admin_products);
this.dbReference = getDatabase().getReference();
- binding = DataBindingUtil.setContentView(this, R.layout.admin_products);
realmInstance = Realm.getDefaultInstance();
-
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setElevation(0);
getSupportActionBar().setTitle("All products");
- getSupportActionBar().setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_close_black));
+ getSupportActionBar().setHomeAsUpIndicator(ContextCompat.getDrawable(this, R.drawable.ic_close_black));
+ loadProductTable = realmInstance.where(ProductTable.class).equalTo(DIAMOND_COLOR, DEFAULT_COLOR).findAll();
+ loadColorChips();
+ }
- loadRecyclerView();
- binding.swipeRefresh.setOnRefreshListener(() -> {
- adapter.notifyDataSetChanged();
- binding.swipeRefresh.setRefreshing(false);
- });
+
+
+
+ private void loadColorChips(){
+
+ RealmResults diamondColors = realmInstance.where(DiamondColor.class).findAll();
+ ChipAdapter adapter = new ChipAdapter(diamondColors);
+ LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
+ binding.chipRecyclerView.setLayoutManager(layoutManager);
+ binding.chipRecyclerView.setAdapter(adapter);
+ adapter.notifyDataSetChanged();
+ binding.chipRecyclerView.addOnItemTouchListener(new ClickListener(getApplicationContext(), binding.chipRecyclerView, (view, position) -> {
+ String diamondColor = diamondColors.get(position).getColor();
+ Log.e("diamondColor", diamondColor);
+ realmInstance.executeTransaction(realm -> {
+ loadProductTable = realmInstance.where(ProductTable.class).equalTo(DIAMOND_COLOR, diamondColor.toLowerCase()).findAll();
+ });
+
+ loadRecyclerView(diamondColor);
+ }));
}
- private void loadRecyclerView(){
- loadProductTable = realmInstance.where(ProductTable.class).sort("diamondColor").findAll();
- adapter = new AdminListAdapter(loadProductTable);
+
+ private void loadRecyclerView(String color){
+
+ AdminProductsListAdapter adminProductsListAdapter = new AdminProductsListAdapter(loadProductTable);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
- binding.recyclerView.setLayoutManager(layoutManager);
- binding.recyclerView.setItemAnimator(new DefaultItemAnimator());
- binding.recyclerView.addItemDecoration(new ItemDecoration(this));
- binding.recyclerView.setAdapter(adapter);
- adapter.notifyDataSetChanged();
+ binding.adminListRecyclerView.setLayoutManager(layoutManager);
+ binding.adminListRecyclerView.setItemAnimator(new DefaultItemAnimator());
+ binding.adminListRecyclerView.addItemDecoration(new ItemDecoration(ProductsListActivity.this));
+ binding.adminListRecyclerView.setAdapter(adminProductsListAdapter);
+
+ if (loadProductTable.size()==0){
+
+ binding.tvError.setVisibility(View.VISIBLE);
+ binding.tvError.setText(String.format("%s Does Not Have Products", color.toUpperCase()));
+ }else {
+
+ binding.tvError.setVisibility(View.GONE);
+ binding.adminListRecyclerView.addOnItemTouchListener(new ClickListener(ProductsListActivity.this,
+ binding.adminListRecyclerView, (view, position)->{
+ assert loadProductTable.get(position) != null;
+ String selectedId = loadProductTable.get(position).getId();
+ if (selectedId!=null){
+ updateTheItem(selectedId);
+ }
+ }));
- binding.recyclerView.addOnItemTouchListener(new ClickListener(getApplicationContext(), binding.recyclerView, (view, position) -> {
- updateTheItem(loadProductTable.get(position));
- }));
+ }
}
- private void updateTheItem(ProductTable selectedProduct){
+ private void updateTheItem(String selectedProductId){
BottomSheet.Builder builder = new BottomSheet.Builder(this);
BottomSheet bottomSheet = builder.create();
+ builder.setTitle("Select your choice");
builder.addItem(0,"Add New Product");
builder.addItem(1,"Update");
builder.addItem(2,"Delete");
@@ -93,12 +136,12 @@ private void updateTheItem(ProductTable selectedProduct){
break;
case 1:
Intent intent = new Intent(this, CRUDActivity.class);
- intent.putExtra("selectedProductId", selectedProduct.getId());
+ intent.putExtra("selectedProductId", selectedProductId);
startActivity(intent);
overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
break;
case 2:
- removeProduct(selectedProduct);
+ removeProduct(selectedProductId);
break;
default:
break;
@@ -107,43 +150,55 @@ private void updateTheItem(ProductTable selectedProduct){
}
- private void removeProduct(ProductTable table) {
- dbReference.child("products").child(table.getId()).removeValue((databaseError, databaseReference) -> {
+
+ private void removeProduct(String selectedId) {
+ dbReference.child("products").child(selectedId).removeValue((databaseError, databaseReference) -> {
if (databaseError==null){
successToast("Deleted");
}else {
- errorToast("Failed to delete");
+ errorToast("Failed To Delete");
}
});
}
+
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.add_new, menu);
return true;
}
+
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
- if (id == android.R.id.home) {
+ if (id == android.R.id.home)
+ {
onBackPressed();
return true;
- } else if (id == R.id.action_add_new) {
+
+ } else if (id == R.id.action_add_new)
+ {
startActivity(new Intent(getApplicationContext(), CRUDActivity.class));
overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
return true;
- }else if (id == R.id.action_add_new_offer){
+
+ }else if (id == R.id.action_add_new_offer)
+ {
startActivity(new Intent(getApplicationContext(), AddOfferActivity.class));
overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
}
+
return super.onOptionsItemSelected(item);
}
- private void showAlert() {
+
+ private void showAlert() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Exit ");
builder.setMessage("Do you want to exit admin panel ?");
@@ -152,6 +207,7 @@ private void showAlert() {
builder.show();
}
+
@Override
public void onBackPressed() {
showAlert();
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/AdminProductsActivity.java b/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/AdminProductsActivity.java
deleted file mode 100644
index 6625d1e..0000000
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/AdminProductsActivity.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package com.pravrajya.diamond.views.admin.views.products;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import com.google.firebase.database.DatabaseReference;
-import com.pravrajya.diamond.R;
-import com.pravrajya.diamond.databinding.ActivityAdminProductBinding;
-import com.pravrajya.diamond.tables.product.ProductTable;
-import com.pravrajya.diamond.utils.ClickListener;
-import com.pravrajya.diamond.views.BaseActivity;
-import com.pravrajya.diamond.views.admin.views.admin_crud.CRUDActivity;
-import com.pravrajya.diamond.views.admin.views.offers.AddOfferActivity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.databinding.DataBindingUtil;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import de.mrapp.android.bottomsheet.BottomSheet;
-import io.realm.Realm;
-import io.realm.RealmResults;
-
-import static com.pravrajya.diamond.utils.FirebaseUtil.getDatabase;
-
-
-public class AdminProductsActivity extends BaseActivity {
-
- private Realm realm;
- private RecyclerViewAdapter adapter;
- private DatabaseReference dbReference;
- private ActivityAdminProductBinding binding;
- private RealmResults loadProductTable;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- realm = Realm.getDefaultInstance();
-
- dbReference = getDatabase().getReference();
- binding = DataBindingUtil.setContentView(this, R.layout.activity_admin_product);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- getSupportActionBar().setElevation(0);
- getSupportActionBar().setTitle("Admin products");
- getSupportActionBar().setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_close_black));
-
- initAdapter();
- initData();
- }
-
- private void initAdapter() {
- adapter = new RecyclerViewAdapter();
- binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
- binding.recyclerView.setAdapter(adapter);
- binding.recyclerView.addOnItemTouchListener(new ClickListener(getApplicationContext(), binding.recyclerView, (view, position) -> {
- updateTheItem(loadProductTable.get(position));
- }));
- }
-
-
-
-
- private void updateTheItem(ProductTable selectedProduct){
-
- BottomSheet.Builder builder = new BottomSheet.Builder(this);
- BottomSheet bottomSheet = builder.create();
- builder.addItem(0,"Add New Product");
- builder.addItem(1,"Update");
- builder.addItem(2,"Delete");
- bottomSheet.show();
-
- builder.setOnItemClickListener((parent, view, position, id) -> {
- switch (position) {
- case 0:
- startActivity(new Intent(this, CRUDActivity.class));
- overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
- break;
- case 1:
- Intent intent = new Intent(this, CRUDActivity.class);
- intent.putExtra("selectedProductId", selectedProduct.getId());
- startActivity(intent);
- overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
- break;
- case 2:
- removeProduct(selectedProduct);
- break;
- default:
- break;
- }
- });
- }
-
- private void initData() {
- List modelList = new ArrayList<>();
- loadProductTable = realm.where(ProductTable.class).sort("diamondColor").findAll();
- loadProductTable.forEach(table -> {
- Model headerModel = new Model(table.getDiamondColor(), ItemType.Header);
- if (!modelList.contains(headerModel)){
- modelList.add(headerModel);
- }
- Model productModel = new Model(table.getId(), ItemType.Post, table.getDiamondColor(), table.getProductLists());
- modelList.add(productModel);
- });
- adapter.submitList(modelList);
- }
-
-
- private void removeProduct(ProductTable table) {
-
- dbReference.child("products").child(table.getId()).removeValue((databaseError, databaseReference) -> {
- if (databaseError==null){
- successToast("Deleted");
- }else {
- errorToast("Failed to delete");
- }
- });
-
- }
-
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.add_new, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- if (id == android.R.id.home) {
- onBackPressed();
- return true;
- } else if (id == R.id.action_add_new) {
- startActivity(new Intent(getApplicationContext(), CRUDActivity.class));
- overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
- return true;
- }else if (id == R.id.action_add_new_offer){
- startActivity(new Intent(getApplicationContext(), AddOfferActivity.class));
- overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
- }
- return super.onOptionsItemSelected(item);
- }
-
- private void showAlert() {
-
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle("Exit ");
- builder.setMessage("Do you want to exit admin panel ?");
- builder.setPositiveButton("Go Back", (dialog, id) -> finish())
- .setNegativeButton("Cancel", (dialog, which) -> { });
- builder.show();
- }
-
- @Override
- public void onBackPressed() {
- showAlert();
- }
-}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/ItemType.java b/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/ItemType.java
deleted file mode 100644
index 712307e..0000000
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/ItemType.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.pravrajya.diamond.views.admin.views.products;
-
-public class ItemType {
- public static final Integer Post = 1;
- public static final Integer Header = 2;
-}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/Model.java b/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/Model.java
deleted file mode 100644
index 4f534f2..0000000
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/Model.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.pravrajya.diamond.views.admin.views.products;
-
-import com.pravrajya.diamond.tables.product.ProductList;
-
-import io.realm.annotations.PrimaryKey;
-
-public class Model {
-
- @PrimaryKey
- private String id;
- private Integer type;
- private String diamondColor;
- private ProductList productLists;
-
- public Model(String diamondColor, Integer type) {
- this.diamondColor = diamondColor;
- this.type = type;
- }
-
- public Model(String id, Integer type, String diamondColor, ProductList productLists) {
- this.id = id;
- this.type = type;
- this.diamondColor = diamondColor;
- this.productLists = productLists;
- }
-
- @Override
- public String toString() {
- return "Model{" +
- "id='" + id + '\'' +
- ", type=" + type +
- ", diamondColor='" + diamondColor + '\'' +
- ", productLists=" + productLists +
- '}';
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Integer getType() {
- return type;
- }
-
- public void setType(Integer type) {
- this.type = type;
- }
-
- public String getDiamondColor() {
- return diamondColor;
- }
-
- public void setDiamondColor(String diamondColor) {
- this.diamondColor = diamondColor;
- }
-
- public ProductList getProductLists() {
- return productLists;
- }
-
- public void setProductLists(ProductList productLists) {
- this.productLists = productLists;
- }
-}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/RecyclerViewAdapter.java b/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/RecyclerViewAdapter.java
deleted file mode 100644
index 91f2ebe..0000000
--- a/app/src/main/java/com/pravrajya/diamond/views/admin/views/products/RecyclerViewAdapter.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package com.pravrajya.diamond.views.admin.views.products;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-import com.kodmap.library.kmrecyclerviewstickyheader.KmStickyListener;
-import com.pravrajya.diamond.R;
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.DiffUtil;
-import androidx.recyclerview.widget.ListAdapter;
-import androidx.recyclerview.widget.RecyclerView;
-
-public class RecyclerViewAdapter extends ListAdapter
- implements KmStickyListener {
-
-
- public RecyclerViewAdapter() { super(ModelDiffUtilCallback); }
-
-
- @NonNull
- @Override
- public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
- View itemView;
- if (viewType == ItemType.Header) {
- itemView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_header, viewGroup, false);
- return new HeaderViewHolder(itemView);
- } else {
- itemView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.admin_list_row, viewGroup, false);
- return new ProductViewHolder(itemView);
- }
- }
-
- @Override
- public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
- if (getItemViewType(position) == ItemType.Header) {
- ((HeaderViewHolder) holder).bind(getItem(position), position);
- } else {
- ((ProductViewHolder) holder).bind(getItem(position));
- }
- }
-
-
-
- class HeaderViewHolder extends RecyclerView.ViewHolder {
- public TextView title;
-
- HeaderViewHolder(@NonNull View itemView) {
- super(itemView);
- title = itemView.findViewById(R.id.title_header);
- }
-
- public void bind(Model model, int position) {
- String header = model.getDiamondColor().toUpperCase();
- title.setVisibility(View.GONE);
- if (position > 0){
- Model previousItem = getItem(position - 1);
- if (!previousItem.getDiamondColor().equalsIgnoreCase(header)){
- title.setVisibility(View.VISIBLE);
- title.setText(header);
- }
-
- }
-
- }
- }
-
- class ProductViewHolder extends RecyclerView.ViewHolder {
- TextView tvItem, tvHigh, tvLow, tvPrice;
-
- ProductViewHolder(View itemView) {
- super(itemView);
- tvItem = itemView.findViewById(R.id.tvItem);
- tvHigh = itemView.findViewById(R.id.tvHigh);
- tvLow = itemView.findViewById(R.id.tvLow);
- tvPrice = itemView.findViewById(R.id.tvPrice);
- }
-
- public void bind(Model model) {
- tvItem.setText(model.getProductLists().getProduct());
- tvHigh.setText(model.getProductLists().getHigh());
- tvLow.setText(model.getProductLists().getLow());
- tvPrice.setText(model.getProductLists().getPrice());
- }
-
- }
-
-
-
- @Override
- public int getItemViewType(int position) {
- return getItem(position).getType();
- }
-
- @Override
- public Integer getHeaderPositionForItem(Integer itemPosition) {
- Integer headerPosition = 0;
- for (Integer pos = itemPosition; pos > 0 ;pos--){
- if (isHeader(pos)){
- headerPosition = pos;
- return headerPosition;
- }
- }
- return headerPosition;
- }
-
- @Override
- public Integer getHeaderLayout(Integer headerPosition) {
- return R.layout.item_header;
- }
-
- @Override
- public void bindHeaderData(View header, Integer headerPosition) {
- TextView tv = header.findViewById(R.id.title_header);
- tv.setText(getItem(headerPosition).getDiamondColor().toUpperCase());
- }
-
- @Override
- public Boolean isHeader(Integer itemPosition) { return getItem(itemPosition).getType().equals(ItemType.Header); }
-
-
- public static final DiffUtil.ItemCallback ModelDiffUtilCallback =
-
- new DiffUtil.ItemCallback() {
- @Override
- public boolean areItemsTheSame(@NonNull Model model, @NonNull Model t1) {
- return model.getDiamondColor().equals(t1.getDiamondColor());
- }
- @Override
- public boolean areContentsTheSame(@NonNull Model model, @NonNull Model t1) {
- return model.equals(t1);
- }
- };
-}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/fragments/cart/FragmentCart.java b/app/src/main/java/com/pravrajya/diamond/views/users/fragments/cart/FragmentCart.java
index 1c7bd62..49c46ae 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/fragments/cart/FragmentCart.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/fragments/cart/FragmentCart.java
@@ -103,15 +103,13 @@ private void refreshData() {
if (offerTable!=null){
Log.i("OfferTable", "offer found");
- cartModels.add(new CartModel(offerTable.getUid(),
- offerTable.getTitle(), offerTable.getPrice()));
+ cartModels.add(new CartModel(offerTable.getUid(), offerTable.getTitle(), offerTable.getPrice()));
}
if (productTable!=null){
Log.i("ProductTable", "product found");
- cartModels.add(new CartModel(productTable.getId(),
- item_id_array[1],
- productTable.getProductLists().getPrice()));
+ cartModels.add(new CartModel(productTable.getId(), item_id_array[1],
+ productTable.getPrice()));
}
});
@@ -130,8 +128,7 @@ private void loadCartData() {
binding.recyclerView.setAdapter(cartAdapter);
cartAdapter.notifyDataSetChanged();
- ItemTouchHelper.Callback callback = new DeletionSwipeHelper(0,
- ItemTouchHelper.START, getActivity(), this);
+ ItemTouchHelper.Callback callback = new DeletionSwipeHelper(0, ItemTouchHelper.START, getActivity(), this);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
itemTouchHelper.attachToRecyclerView(binding.recyclerView);
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/fragments/news/view/FragmentNews.java b/app/src/main/java/com/pravrajya/diamond/views/users/fragments/news/view/FragmentNews.java
index 8f6ba36..d9f0ad5 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/fragments/news/view/FragmentNews.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/fragments/news/view/FragmentNews.java
@@ -6,6 +6,9 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
import com.pravrajya.diamond.R;
import com.pravrajya.diamond.databinding.ContentNewsBinding;
import com.pravrajya.diamond.api.APIClient;
@@ -41,15 +44,27 @@ public FragmentNews() { }
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
binding = DataBindingUtil.inflate(inflater, R.layout.content_news, container, false);
-
binding.swipeRefresh.setRefreshing(true);
- loadRecyclerView();
- loadNewsArticles();
binding.swipeRefresh.setOnRefreshListener(this::loadNewsArticles);
+ //loadWebViewNews();
+ //loadNewsArticles();
return binding.getRoot();
}
+
+
+ private void loadWebViewNews(){
+ WebView webView = new WebView(getActivity());
+ webView.setWebViewClient(new WebViewClient());
+ webView.loadUrl("https://www.diamonds.net/News/Articles.aspx");
+ binding.rlWebview.addView(webView);
+
+ }
+
+
+
+
private void loadRecyclerView(){
adapter = new NewsAdapter(getActivity(), headlineList);
@@ -69,8 +84,6 @@ private void loadRecyclerView(){
}
-
-
private void loadNewsArticles(){
binding.swipeRefresh.setRefreshing(true);
@@ -92,6 +105,8 @@ public void onResponse(@NonNull Call call, @NonNull Response faqTable = realm.where(FAQTable.class).findAll();
binding.swipeRefresh.setOnRefreshListener(() -> {
binding.swipeRefresh.setRefreshing(false);
- faqAdapter.notifyDataSetChanged();
+ tutorialAdapter.notifyDataSetChanged();
});
loadRecyclerView(faqTable);
@@ -45,12 +45,12 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
private void loadRecyclerView(RealmResults faqTable){
- faqAdapter = new FaqAdapter(faqTable);
+ tutorialAdapter = new TutorialAdapter(faqTable);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
binding.recyclerView.setLayoutManager(layoutManager);
binding.recyclerView.addItemDecoration(new ItemDecoration(requireContext()));
- binding.recyclerView.setAdapter(faqAdapter);
- faqAdapter.notifyDataSetChanged();
+ binding.recyclerView.setAdapter(tutorialAdapter);
+ tutorialAdapter.notifyDataSetChanged();
}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/fragments/help/FaqAdapter.java b/app/src/main/java/com/pravrajya/diamond/views/users/fragments/tutorials/TutorialAdapter.java
similarity index 86%
rename from app/src/main/java/com/pravrajya/diamond/views/users/fragments/help/FaqAdapter.java
rename to app/src/main/java/com/pravrajya/diamond/views/users/fragments/tutorials/TutorialAdapter.java
index fc38c4b..8d5ae4f 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/fragments/help/FaqAdapter.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/fragments/tutorials/TutorialAdapter.java
@@ -1,4 +1,4 @@
-package com.pravrajya.diamond.views.users.fragments.help;
+package com.pravrajya.diamond.views.users.fragments.tutorials;
import android.view.LayoutInflater;
@@ -11,7 +11,7 @@
import androidx.recyclerview.widget.RecyclerView;
import io.realm.RealmResults;
-public class FaqAdapter extends RecyclerView.Adapter {
+public class TutorialAdapter extends RecyclerView.Adapter {
private RealmResults itemList;
@@ -26,7 +26,7 @@ class MyViewHolder extends RecyclerView.ViewHolder {
}
- public FaqAdapter(RealmResults itemList) {
+ public TutorialAdapter(RealmResults itemList) {
this.itemList = itemList;
}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/login/LoginViewActivity.java b/app/src/main/java/com/pravrajya/diamond/views/users/login/LoginViewActivity.java
index 08666b0..be003b1 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/login/LoginViewActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/login/LoginViewActivity.java
@@ -95,7 +95,7 @@ private void firebaseCreateAccount(String email, String password) {
if (task.isSuccessful()) {
FirebaseUser user = mAuth.getCurrentUser();
assert user != null;
- setUserProfile(user.getUid(), user.getEmail(), "", "");
+ setUserProfile(user);
} else {
errorToast(Objects.requireNonNull(task.getException()).getLocalizedMessage());
}
@@ -168,7 +168,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
} catch (ApiException e) {
View parentLayout = findViewById(android.R.id.content);
- Snackbar.make(parentLayout, "Google sign in failed.", Snackbar.LENGTH_SHORT).show();
+ Snackbar.make(parentLayout, "Google sign in failed."+e.getLocalizedMessage(), Snackbar.LENGTH_SHORT).show();
}
}else if (requestCode == FACEBOOK_SIGN_IN) {
callbackManager.onActivityResult(requestCode, resultCode, data);
@@ -184,7 +184,7 @@ private void googleLoginAuth(AuthCredential authCredential) {
if (task.isSuccessful()) {
FirebaseUser user = mAuth.getCurrentUser();
if (user!=null){
- setUserProfile(user.getUid(), user.getEmail(), user.getDisplayName(), user.getPhotoUrl().toString());
+ setUserProfile(user);
}
} else {
errorToast(task.getException().getLocalizedMessage());
@@ -200,7 +200,7 @@ private void handleFacebookAccessToken(AccessToken token) {
if (task.isSuccessful()) {
FirebaseUser user = mAuth.getCurrentUser();
if (user!=null){
- setUserProfile(user.getUid(), user.getEmail(), user.getDisplayName(), user.getPhotoUrl().toString());
+ setUserProfile(user);
}
} else {
errorToast(task.getException().getLocalizedMessage());
@@ -210,8 +210,17 @@ private void handleFacebookAccessToken(AccessToken token) {
- private void setUserProfile(String uid, String email, String name, String userProfile) {
- Stash.put(USER_PROFILE,new UserProfile(uid, email, name, userProfile));
+ private void setUserProfile(FirebaseUser user) {
+
+ String photo = "";
+ if (user.getPhotoUrl()!=null){
+ photo = user.getPhotoUrl().toString();
+ }
+
+
+ Stash.put(USER_PROFILE, new UserProfile(user.getUid(), user.getEmail(),
+ user.getDisplayName(), "", user.getPhoneNumber(), user.getProviders().toString(),
+ photo));
startActivity(new Intent(getApplicationContext(), MainActivity.class));
finish();
}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/login/UserProfile.java b/app/src/main/java/com/pravrajya/diamond/views/users/login/UserProfile.java
index b317613..319d5e4 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/login/UserProfile.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/login/UserProfile.java
@@ -6,13 +6,19 @@ public class UserProfile {
private String userId;
private String email;
private String name;
+ private String location;
+ private String mobile;
+ private String loogedInBy;
private String profileImage;
- public UserProfile(String userId, String email, String name, String profileImage) {
+ public UserProfile(String userId, String email, String name, String location, String mobile, String loogedInBy, String profileImage) {
this.userId = userId;
this.email = email;
this.name = name;
+ this.location = location;
+ this.mobile = mobile;
+ this.loogedInBy = loogedInBy;
this.profileImage = profileImage;
}
@@ -41,6 +47,30 @@ public void setName(String name) {
this.name = name;
}
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getMobile() {
+ return mobile;
+ }
+
+ public void setMobile(String mobile) {
+ this.mobile = mobile;
+ }
+
+ public String getLoogedInBy() {
+ return loogedInBy;
+ }
+
+ public void setLoogedInBy(String loogedInBy) {
+ this.loogedInBy = loogedInBy;
+ }
+
public String getProfileImage() {
return profileImage;
}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/main/adapter/ProductAdapter.java b/app/src/main/java/com/pravrajya/diamond/views/users/main/adapter/ProductAdapter.java
index 442958f..9da1f37 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/main/adapter/ProductAdapter.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/main/adapter/ProductAdapter.java
@@ -7,7 +7,6 @@
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
-import android.widget.Filter;
import android.widget.TextView;
import com.pravrajya.diamond.R;
import com.pravrajya.diamond.tables.product.ProductTable;
@@ -22,10 +21,11 @@ public class ProductAdapter extends RecyclerView.Adapter dataModel;
- private int DELAY_IN_MILLIS=5000;
+ private int DELAY_IN_MILLIS = 5000;
private Boolean isRefreshing = true;
private Realm realm;
private ProductAdapter adapter;
@@ -60,30 +62,34 @@ static FragmentHome newInstance() {
public FragmentHome() { }
+
@SuppressLint("SetTextI18n")
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-
binding = DataBindingUtil.inflate(inflater, R.layout.content_main, container, false);
activity = (MainActivity)getActivity();
realm = Realm.getDefaultInstance();
- if (!Stash.getString(Constants.SELECTED_COLOR).equalsIgnoreCase("")) {
- SELECTED_COLOR = Stash.getString(Constants.SELECTED_COLOR);
- } else {
- SELECTED_COLOR = DEFAULT_COLOR;
- }
+ COLOR = Stash.getString(Constants.SELECTED_COLOR);
+ CUT = Stash.getString(Constants.SELECTED_CUT);
+ SIZE = Stash.getString(Constants.SELECTED_SIZE);
+
+ if (!COLOR.equalsIgnoreCase("")) { COLOR = Stash.getString(Constants.SELECTED_COLOR);
+ } else { COLOR = DEFAULT_COLOR; }
+ if (!CUT.equalsIgnoreCase("")) { CUT = Stash.getString(Constants.SELECTED_CUT);
+ } else { CUT = DEFAULT_CUT; }
+ if (!SIZE.equalsIgnoreCase("")) { SIZE = Stash.getString(Constants.SELECTED_SIZE);
+ } else { SIZE = DEFAULT_SIZE; }
- dataModel = realm.where(ProductTable.class).equalTo(Constants.DIAMOND_COLOR, SELECTED_COLOR).findAll();
- if (dataModel.size()==0){
- binding.headingLayout.setVisibility(View.GONE);
- binding.recyclerView.setVisibility(View.GONE);
- binding.info.setVisibility(View.VISIBLE);
- binding.info.setText("No Items Available");
- binding.chart.setVisibility(View.INVISIBLE);
- }
+
+ dataModel = realm.where(ProductTable.class)
+ .contains("color",COLOR)
+ .contains("size", SIZE)
+ .contains("shape",CUT)
+ .findAll();
loadRecyclerView();
+ onRefresh();
startAnimGraph();
binding.swipeRefreshLayout.setOnRefreshListener(this::onRefresh);
return binding.getRoot();
@@ -97,11 +103,26 @@ public void onStart() {
private void onRefresh(){
- binding.swipeRefreshLayout.setRefreshing(true);
- dataModel = realm.where(ProductTable.class).equalTo(Constants.DIAMOND_COLOR, SELECTED_COLOR).findAll();
- adapter.notifyDataSetChanged();
- adapter.updateData( isRefreshing);
- binding.swipeRefreshLayout.setRefreshing(false);
+ dataModel = realm.where(ProductTable.class)
+ .contains("color",COLOR)
+ .contains("size",SIZE)
+ .contains("shape",CUT)
+ .findAll();
+
+ if (dataModel.isLoaded())
+ if (dataModel.size() == 0){
+ binding.headingLayout.setVisibility(View.GONE);
+ binding.recyclerView.setVisibility(View.GONE);
+ binding.info.setVisibility(View.VISIBLE);
+ binding.info.setText("No Products Found");
+ binding.chart.setVisibility(View.INVISIBLE);
+ }else {
+
+ binding.swipeRefreshLayout.setRefreshing(true);
+ adapter.notifyDataSetChanged();
+ adapter.updateData( isRefreshing);
+ binding.swipeRefreshLayout.setRefreshing(false);
+ }
}
private void startAnimGraph() {
@@ -116,14 +137,12 @@ public void run() {
if (isRefreshing){
activity.runOnUiThread(() -> {
isRefreshing = false;
- //binding.headingLayout.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
adapter.updateData(isRefreshing);
});
}else {
activity.runOnUiThread(() -> {
isRefreshing = true;
- //binding.headingLayout.setBackgroundColor(getResources().getColor(R.color.red_google));
adapter.updateData(isRefreshing);
});
}
@@ -134,17 +153,7 @@ public void run() {
}
- private ArrayList getClarityModels(){
- ArrayList modelArrayList = new ArrayList<>();
- if (dataModel.size()>0){
- dataModel.forEach(table -> {
- ProductList eachItem = table.getProductLists();
- modelArrayList.add(new ItemModel(eachItem.getProduct(),eachItem.getProductWeight(),eachItem.getHigh(),eachItem.getLow(),eachItem.getPrice()));
- });
- }
- return modelArrayList;
- }
private void loadRecyclerView() {
@@ -185,8 +194,8 @@ private void setupChart(LineChart chart, LineData data) {
chart.setPinchZoom(false);
chart.setViewPortOffsets(10, 0, 10, 0);
chart.setData(data);
- Legend l = chart.getLegend();
- l.setEnabled(false);
+ Legend legend = chart.getLegend();
+ legend.setEnabled(false);
chart.getAxisLeft().setEnabled(false);
chart.getAxisLeft().setSpaceTop(40);
chart.getAxisLeft().setSpaceBottom(40);
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/main/views/MainActivity.java b/app/src/main/java/com/pravrajya/diamond/views/users/main/views/MainActivity.java
index 590bdff..762e960 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/main/views/MainActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/main/views/MainActivity.java
@@ -4,6 +4,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
+import android.os.Build;
import android.os.Bundle;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
@@ -17,10 +18,11 @@
import com.google.firebase.database.FirebaseDatabase;
import com.pravrajya.diamond.R;
import com.pravrajya.diamond.databinding.ActivityMainLayoutBinding;
+import com.pravrajya.diamond.tables.diamondClarity.DiamondClarity;
import com.pravrajya.diamond.tables.diamondColor.DiamondColor;
import com.pravrajya.diamond.tables.diamondCut.DiamondCut;
import com.pravrajya.diamond.tables.diamondSize.DiamondSize;
-import com.pravrajya.diamond.tables.faq.FAQTable;
+import com.pravrajya.diamond.tables.product.ProductTable;
import com.pravrajya.diamond.utils.ClickListener;
import com.pravrajya.diamond.utils.Constants;
import com.pravrajya.diamond.utils.MessageEvent;
@@ -33,12 +35,12 @@
import com.pravrajya.diamond.views.users.fragments.offers.FragmentOffers;
import com.pravrajya.diamond.views.users.fragments.cart.FragmentCart;
import com.pravrajya.diamond.views.users.fragments.about.FragmentAboutUs;
-import com.pravrajya.diamond.views.users.fragments.help.FragmentFAQ;
+import com.pravrajya.diamond.views.users.fragments.tutorials.FragmentTutorials;
import com.pravrajya.diamond.views.users.fragments.news.view.FragmentNews;
import com.pravrajya.diamond.views.users.fragments.terms.FragmentTermsCondition;
import com.pravrajya.diamond.views.users.profile.ProfileActivity;
-import com.pravrajya.diamond.views.users.registration.SignUpActivity;
+import androidx.annotation.RequiresApi;
import androidx.appcompat.widget.AppCompatButton;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@@ -60,6 +62,7 @@
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.TextView;
+import android.widget.Toast;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -94,7 +97,6 @@ public class MainActivity extends BaseActivity {
Fragment selectedFragment = null;
String titleString= null;
-
switch (item.getItemId()) {
case R.id.navigation_home:
@@ -106,7 +108,7 @@ public class MainActivity extends BaseActivity {
selectedFragment = FragmentOffers.newInstance();
break;
case R.id.navigation_cart:
- titleString = getResources().getString(R.string.title_orders);
+ titleString = getResources().getString(R.string.title_cart);
selectedFragment = FragmentCart.newInstance();
break;
}
@@ -121,11 +123,12 @@ public class MainActivity extends BaseActivity {
};
+ @RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
- loadCartItems();
+ UserProfile userNew = (UserProfile)Stash.getObject(USER_PROFILE, UserProfile.class);
+ if (userNew!=null){ loadCartItems(); }
realm = Realm.getDefaultInstance();
dbReference = FirebaseDatabase.getInstance().getReference();
binding = DataBindingUtil.setContentView(this, R.layout.activity_main_layout);
@@ -147,12 +150,11 @@ protected void onCreate(Bundle savedInstanceState) {
loadDrawerHeader();
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_NETWORK_STATE) != PackageManager.PERMISSION_GRANTED) {
- ActivityCompat.requestPermissions(MainActivity.this,
- new String[]{Manifest.permission.READ_SMS, Manifest.permission.RECEIVE_SMS,
- Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.ANSWER_PHONE_CALLS,
- Manifest.permission.CALL_PHONE, Manifest.permission.CAMERA}, 101);
+ ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_SMS, Manifest.permission.RECEIVE_SMS, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.ANSWER_PHONE_CALLS,
+ Manifest.permission.CALL_PHONE, Manifest.permission.CAMERA}, 101);
}
+ pushClarity();
}
@Override
@@ -178,30 +180,31 @@ public void onStop() {
private void loadDrawerHeader() {
UserProfile userNew = (UserProfile)Stash.getObject(USER_PROFILE, UserProfile.class);
- View navHeaderView = binding.navView.getHeaderView(0);
- // Initialise the views
- ImageView profileImage = navHeaderView.findViewById(R.id.ivProfileIcon);
- TextView tvName = navHeaderView.findViewById(R.id.tvName);
- TextView tvEmail = navHeaderView.findViewById(R.id.tvEmail);
- AppCompatButton btnProfile = navHeaderView.findViewById(R.id.btnProfile);
- btnProfile.setOnClickListener(v -> {
- binding.drawerLayout.closeDrawer(GravityCompat.START);
- startActivity(new Intent(this, ProfileActivity.class));
- });
- // set all the views
- tvName.setText(userNew.getName());
- tvEmail.setText(userNew.getEmail());
- if (!userNew.getProfileImage().isEmpty()) { loadProfilePreview(userNew.getProfileImage(), profileImage); }
- RecyclerView productRecyclerView = navHeaderView.findViewById(R.id.recyclerView);
- loadProductType(productRecyclerView);
+ if (userNew!=null){
+ View navHeaderView = binding.navView.getHeaderView(0);
+ ImageView profileImage = navHeaderView.findViewById(R.id.ivProfileIcon);
+ TextView tvName = navHeaderView.findViewById(R.id.tvName);
+ TextView tvEmail = navHeaderView.findViewById(R.id.tvEmail);
+ AppCompatButton btnProfile = navHeaderView.findViewById(R.id.btnProfile);
+ btnProfile.setOnClickListener(v -> {
+ binding.drawerLayout.closeDrawer(GravityCompat.START);
+ startActivity(new Intent(this, ProfileActivity.class));
+ });
+
+ // set all the views
+ tvName.setText(userNew.getName());
+ tvEmail.setText(userNew.getEmail());
+ if (!userNew.getProfileImage().isEmpty()) { loadProfilePreview(userNew.getProfileImage(), profileImage); }
+ RecyclerView productRecyclerView = navHeaderView.findViewById(R.id.recyclerView);
+ loadProductType(productRecyclerView);
+ }
}
private void loadProfilePreview(String profileImage, ImageView view) {
Glide.with(getApplicationContext()).load(profileImage)
.apply(new RequestOptions().override(PROFILE_ICON, PROFILE_ICON))
- .apply(RequestOptions.circleCropTransform())
- .into(view);
+ .apply(RequestOptions.circleCropTransform()).into(view);
}
private void loadProductType(RecyclerView recyclerView){
@@ -214,7 +217,9 @@ private void loadProductType(RecyclerView recyclerView){
recyclerView.addOnItemTouchListener(new ClickListener(getApplicationContext(), recyclerView, (view, position) -> {
DiamondCut diamondCut = diamondCutList.get(position);
selectedChipItem = diamondCut.getCut_type();
- Stash.put(Constants.DIAMOND_CUT, selectedChipItem);
+ String cut_type_url = diamondCut.getCut_url();
+ Stash.put(Constants.SELECTED_CUT, selectedChipItem);
+ Stash.put(Constants.DIAMOND_CUT_URL, cut_type_url);
runOnUiThread(() -> loadDrawerExpandableList(selectedChipItem));
}));
}
@@ -227,34 +232,46 @@ private void loadDrawerExpandableList(String chipItem){
List diamondSize = new ArrayList<>();
RealmResults diamondSizeList = realm.where(DiamondSize.class).findAll();
- diamondSizeList.forEach(diamond->{
- //Log.e("diamondSizes", diamond.getSize());
- diamondSize.add(diamond.getSize());
+ diamondSizeList.forEach(diamond->{ diamondSize.add(diamond.getSize());
});
List diamondColors = new ArrayList<>();
RealmResults diamondColorList = realm.where(DiamondColor.class).findAll();
- diamondColorList.forEach(diamond->{
- //Log.e("diamondColor", diamond.getColor());
- diamondColors.add(diamond.getColor());
+ diamondColorList.forEach(diamond->{ diamondColors.add(diamond.getColor());
});
- List othersItems = Arrays.asList("News", "About Us", "Terms and Conditions","Help","Logout");
+ List othersItems = Arrays.asList("News", "About Us", "Terms and Conditions","Tutorials","Logout");
for (String diamond: diamondSize) { listDataChild.put(diamond, diamondColors); }
int length = diamondSize.size()-1;
listDataChild.put(diamondSize.get(length), othersItems);
ExpandableDrawerAdapter expandableDrawerAdapter = new ExpandableDrawerAdapter(this, diamondSize, listDataChild);
expandableListView.setAdapter(expandableDrawerAdapter);
expandableListView.setOnGroupExpandListener(groupPosition -> {
+
+ //****************************************************************************************/
+ /*on group size selection*/
+ String groupHeader = diamondSize.get(groupPosition); // +0.90
+ RealmResults productTables = realm.where(ProductTable.class)
+ .contains("size",groupHeader)
+ .contains("shape",selectedChipItem).findAll();
+
+ if (productTables.size()==0){
+ Toast.makeText(this, "No Products Found", Toast.LENGTH_SHORT).show();
+ }
+ //****************************************************************************************//
+
if (lastExpandedPosition != -1 && groupPosition != lastExpandedPosition) {
expandableListView.collapseGroup(lastExpandedPosition);
}
lastExpandedPosition = groupPosition;
+
});
expandableListView.expandGroup(length);
expandableListView.setOnChildClickListener((parent, view, groupPosition, childPosition, id) -> {
+ /*group Size selected*/
String groupHeader = diamondSize.get(groupPosition); // +0.90
+ /*group Color selected*/
String selectedItem = listDataChild.get(groupHeader).get(childPosition); // White
view.setSelected(true);
if (view_Group != null) { view_Group.setBackgroundColor(Color.WHITE); }
@@ -271,14 +288,15 @@ private void loadDrawerExpandableList(String chipItem){
}else if (selectedItem.equalsIgnoreCase("Terms and Conditions")){
setActionBarTitle(selectedItem);
fragment = new FragmentTermsCondition();
- }else if (selectedItem.equalsIgnoreCase("Help")){
+ }else if (selectedItem.equalsIgnoreCase("Tutorials")){
setActionBarTitle(selectedItem);
- fragment = new FragmentFAQ();
+ fragment = new FragmentTutorials();
}else if (selectedItem.equalsIgnoreCase("Logout")){
appLogout();
fragment = new FragmentHome();
}else {
+ Stash.put(Constants.SELECTED_SIZE, groupHeader);
Stash.put(SELECTED_COLOR, selectedItem);
fragment = new FragmentHome();
Objects.requireNonNull(getSupportActionBar()).setTitle(selectedItem.toUpperCase());
@@ -345,9 +363,28 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
- private void pushFaqs(){
- List tables = new ArrayList<>();
- dbReference.child("faq").setValue(tables).addOnSuccessListener(aVoid -> { }).addOnFailureListener(e -> { });
+ private void pushClarity(){
+ List tables = new ArrayList<>();
+ tables.add(new DiamondClarity("FL","1"));
+ tables.add(new DiamondClarity("IF","2"));
+ tables.add(new DiamondClarity("VVS-1","3"));
+ tables.add(new DiamondClarity("VVS-2","4"));
+ tables.add(new DiamondClarity("VVS","5"));
+ tables.add(new DiamondClarity("VS-1","6"));
+ tables.add(new DiamondClarity("VS-2","7"));
+ tables.add(new DiamondClarity("VS","8"));
+ tables.add(new DiamondClarity("SI-1","9"));
+ tables.add(new DiamondClarity("SI-2","10"));
+ tables.add(new DiamondClarity("SI-3","11"));
+ tables.add(new DiamondClarity("SI","12"));
+ tables.add(new DiamondClarity("I-1","13"));
+ tables.add(new DiamondClarity("I-2","14"));
+ tables.add(new DiamondClarity("I-3","15"));
+ tables.add(new DiamondClarity("I-4","16"));
+ tables.add(new DiamondClarity("I-5","17"));
+ tables.add(new DiamondClarity("I-6","18"));
+ tables.add(new DiamondClarity("I-7","19"));
+ dbReference.child(Constants.DIAMOND_CLARITY).setValue(tables).addOnSuccessListener(aVoid -> { }).addOnFailureListener(e -> { });
}
private void addBadgeView(int counter) {
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/main/views/ProductDetailsActivity.java b/app/src/main/java/com/pravrajya/diamond/views/users/main/views/ProductDetailsActivity.java
index 951d60d..1fc0b10 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/main/views/ProductDetailsActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/main/views/ProductDetailsActivity.java
@@ -1,7 +1,7 @@
package com.pravrajya.diamond.views.users.main.views;
import androidx.annotation.Nullable;
-import androidx.appcompat.widget.AppCompatButton;
+import androidx.core.content.ContextCompat;
import androidx.core.widget.TextViewCompat;
import androidx.databinding.DataBindingUtil;
import io.realm.Realm;
@@ -9,16 +9,19 @@
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
-import android.graphics.drawable.Drawable;
+import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.request.RequestOptions;
import com.fxn.stash.Stash;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
@@ -27,9 +30,10 @@
import com.irozon.alertview.AlertView;
import com.irozon.alertview.objects.AlertAction;
import com.pravrajya.diamond.R;
-import com.pravrajya.diamond.api.video_player.PDLPlayerActivity;
+import com.pravrajya.diamond.api.video_player.WatchVideoActivity;
import com.pravrajya.diamond.api.video_player.YouTubeActivity;
import com.pravrajya.diamond.databinding.ActivityProductDetailBinding;
+import com.pravrajya.diamond.tables.diamondCut.DiamondCut;
import com.pravrajya.diamond.tables.product.ProductTable;
import com.pravrajya.diamond.utils.Constants;
import com.pravrajya.diamond.views.BaseActivity;
@@ -39,8 +43,8 @@
import java.util.Objects;
import static com.pravrajya.diamond.utils.Constants.CART;
-import static com.pravrajya.diamond.utils.Constants.DIAMOND_CUT;
import static com.pravrajya.diamond.utils.Constants.DRAWER_SELECTION;
+import static com.pravrajya.diamond.utils.Constants.PROFILE_ICON;
import static com.pravrajya.diamond.utils.Constants.USERS;
import static com.pravrajya.diamond.utils.Constants.USER_PROFILE;
@@ -55,125 +59,81 @@ public class ProductDetailsActivity extends BaseActivity {
private DatabaseReference dbReference;
private UserProfile userNew;
+
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_product_detail);
+ getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#0000ffff")));
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- dbReference = FirebaseDatabase.getInstance().getReference();
- userNew = (UserProfile) Stash.getObject(USER_PROFILE, UserProfile.class);
- binding = DataBindingUtil.setContentView(this, R.layout.activity_product_detail);
- cartList = Stash.getArrayList(Constants.CART_ITEMS, String.class);
- realm = Realm.getDefaultInstance();
+ instantiateVariables();
+ }
- Objects.requireNonNull(getSupportActionBar()).setElevation(0);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+
+ private void instantiateVariables() {
+
+ dbReference = FirebaseDatabase.getInstance().getReference();
+ userNew = (UserProfile) Stash.getObject(USER_PROFILE, UserProfile.class);
+ cartList = Stash.getArrayList(Constants.CART_ITEMS, String.class);
+ realm = Realm.getDefaultInstance();
selectedUID = getIntent().getStringExtra("id");
- loadInformation();
+
+ ProductTable table = realm.where(ProductTable.class).equalTo(Constants.ID, selectedUID).findFirst();
+ getSupportActionBar().setTitle(table.getClarity());
+ loadInformation(table);
+
buyBtnClickHandler();
}
- /**
- * Formate mailed from Rushil
- * -Title. (As it is right now )
- * -Shape (round/pear/ whatever is selected)
- * -Size. (+0.90,+1.00, whatever size is selected)
- * -Color (white,nwlb,wlb, whatever colour is selected)
- * -Clarity (vsi,vs1, whatever clarity is selected)
- * -Cut. (Fair, good, very good or excellent)
- * -Polish. (Fair, good, very good or excellent)
- * -Fluorescence. (None,faint,strong,very strong)
- * -Symmetry. (Fair, good, very good or excellent)-
- * -High Price $342
- * -Price. $212
- * -low price $100
- */
- @SuppressLint("ResourceType")
- private void loadInformation() {
- ProductTable table = realm.where(ProductTable.class).equalTo(Constants.ID, selectedUID).findFirst();
- Objects.requireNonNull(getSupportActionBar()).setTitle(Objects.requireNonNull(table).getProductLists().getProduct());
-
-
- String CUT_TYPE = Stash.getString(DIAMOND_CUT);
- Log.e("CUT_TYPE", CUT_TYPE);
- if (CUT_TYPE.equalsIgnoreCase("round")){
- String uri = "@drawable/round_cut";
- setLogoImage(uri, getResources().getString(R.string.round_brilient_cut));
- }else if (CUT_TYPE.equalsIgnoreCase("princess")){
- String uri = "@drawable/princess_cut";
- setLogoImage(uri, getResources().getString(R.string.princess_cut));
- }else if (CUT_TYPE.equalsIgnoreCase("pear")){
- String uri = "@drawable/pear_cut";
- setLogoImage(uri, getResources().getString(R.string.pear_cut));
- }else if (CUT_TYPE.equalsIgnoreCase("oval")){
- String uri = "@drawable/oval_cut";
- setLogoImage(uri, getResources().getString(R.string.oval_cut));
- }else if (CUT_TYPE.equalsIgnoreCase("marquise")){
- String uri = "@drawable/marquise_cut";
- setLogoImage(uri, getResources().getString(R.string.marquise_cut));
- }else if (CUT_TYPE.equalsIgnoreCase("fancy cut")){
- String uri = "@drawable/marquise_cut";
- setLogoImage(uri, "Not available");
- }else if (CUT_TYPE.equalsIgnoreCase("emerald")){
- String uri = "@drawable/emerald_cut";
- setLogoImage(uri, getResources().getString(R.string.emerald_cut));
- }else if (CUT_TYPE.equalsIgnoreCase("Cushion")){
- String uri = "@drawable/cushion_cut";
- setLogoImage(uri, getResources().getString(R.string.cushin_cut));
- }
+ private void loadInformation(ProductTable table) {
- PATH = Stash.getString(DRAWER_SELECTION)+" --> "+table.getProductLists().getProduct();
- String[] root = PATH.split("-->");
- String shape =root[0];
- String size =root[1];
- int colorGRAY = getResources().getColor(R.color.lightGray);
- int colorWhite = getResources().getColor(R.color.white);
- String getWeight = table.getProductLists().getProductWeight();
- if (getWeight==null){ getWeight = "1.2"; }
- binding.linearLayout.addView(addCustomView("Title", getWeight+" CARAT "+root[0], colorWhite));
- binding.linearLayout.addView(addCustomView("Stock ID", "P105", colorGRAY));
- binding.linearLayout.addView(addCustomView("Shape", shape, colorWhite));
- binding.linearLayout.addView(addCustomView("Size", size, colorGRAY));
- binding.linearLayout.addView(addCustomView("Color", table.getDiamondColor().toUpperCase(), colorWhite));
- binding.linearLayout.addView(addCustomView("Clarity",table.getProductLists().getProduct(), colorGRAY));
- binding.linearLayout.addView(addCustomView("Cut", "Fair", colorWhite));
- binding.linearLayout.addView(addCustomView("Polish", "Good", colorGRAY));
- binding.linearLayout.addView(addCustomView("Fluorescence", "Faint", colorWhite));
- binding.linearLayout.addView(addCustomView("Symmetry", "Excellent", colorGRAY));
- binding.linearLayout.addView(addCustomView("Culet", "None", colorWhite));
- binding.linearLayout.addView(addCustomView("High Price/Carat",table.getProductLists().getHigh(), colorGRAY));
- binding.linearLayout.addView(addCustomView("Price/Carat",table.getProductLists().getPrice(), colorWhite));
- binding.linearLayout.addView(addCustomView("Low Price/Carat",table.getProductLists().getLow(), colorGRAY));
-
- watchVedio();
+ loadImagePreview(table);
- }
-
- private void setLogoImage(String uri, String cutText) {
+ PATH = table.getShape()+" --> "+table.getSize()+" --> "+table.getColor()+" --> "+table.getClarity();
+ int colorGRAY = ContextCompat.getColor(getApplicationContext(), R.color.lightGray);
+ int colorWhite = ContextCompat.getColor(getApplicationContext(), R.color.white);
- int imageResource = getResources().getIdentifier(uri, null, getPackageName());
- ImageView imageView = new ImageView(getApplicationContext());
- Drawable res = getResources().getDrawable(imageResource);
- imageView.setImageDrawable(res);
- applyMargin(imageView);
- binding.linearLayout.addView(imageView);
+ if (table.getStockId()!=null){ binding.linearLayout.addView(addCustomView("Stock Id", table.getStockId().toUpperCase(), colorGRAY)); }
+ if ( table.getShape()!=null){ binding.linearLayout.addView(addCustomView("Title", table.getProductWeight()+" CARAT "+table.getShape(), colorWhite)); }
+ if (table.getLicence()!=null){ binding.linearLayout.addView(addCustomView("Certificate", table.getLicence(), colorGRAY)); }
+ if (table.getSize()!=null){ binding.linearLayout.addView(addCustomView("Size", table.getSize().toUpperCase(), colorWhite)); }
+ if (table.getProductWeight()!=null){ binding.linearLayout.addView(addCustomView("Weight", table.getProductWeight()+" CARAT ", colorGRAY)); }
+ if (table.getShape()!=null){ binding.linearLayout.addView(addCustomView("Shape", table.getShape().toUpperCase(), colorWhite)); }
+ if (table.getColor()!=null && table.getShade()!= null) { binding.linearLayout.addView(addCustomView("Color", table.getColor().toUpperCase()+" "+table.getShade().toUpperCase(), colorGRAY));
+ }else { binding.linearLayout.addView(addCustomView("Color", table.getColor().toUpperCase(), colorGRAY)); }
+ if (table.getClarity()!=null){ binding.linearLayout.addView(addCustomView("Clarity",table.getClarity().toUpperCase(), colorWhite)); }
+ if (table.getCut()!=null){ binding.linearLayout.addView(addCustomView("Cut", table.getCut().toUpperCase(), colorGRAY)); }
+ if (table.getPolish()!=null){ binding.linearLayout.addView(addCustomView("Polish", table.getPolish().toUpperCase(), colorWhite)); }
+ if (table.getFluorescence()!=null){ binding.linearLayout.addView(addCustomView("Fluorescence", table.getFluorescence().toUpperCase(), colorGRAY)); }
+ if (table.getSymmetry()!=null){ binding.linearLayout.addView(addCustomView("Symmetry", table.getSymmetry().toUpperCase(), colorWhite)); }
+ if (table.getCulet()!=null){ binding.linearLayout.addView(addCustomView("Culet", table.getCulet().toUpperCase(), colorGRAY)); }
+ if (table.getHigh()!=null){ binding.linearLayout.addView(addCustomView("High Price",table.getHigh()+"/Carat", colorWhite)); }
+ if (table.getPrice()!=null){ binding.linearLayout.addView(addCustomView("Price",table.getPrice()+"/Carat", colorGRAY)); }
+ if (table.getPrice()!=null){ binding.linearLayout.addView(addCustomView("Low Price",table.getLow()+"/Carat", colorWhite)); }
- /*TextView textView = new TextView(getApplicationContext());
- TextViewCompat.setTextAppearance(textView, R.style.AppTextSmall);
- textView.setTextSize(14);
- textView.setText(cutText);
- applyMargin(textView);
- binding.linearLayout.addView(textView);*/
+ }
+ private void loadImagePreview(ProductTable table) {
+ DiamondCut diamondCut = realm.where(DiamondCut.class).equalTo("cut_type",table.getShape()).findFirst();
+ Glide.with(getApplicationContext()).load(diamondCut.getCut_url()).apply(new RequestOptions().override(300, 300))
+ .into(binding.viewImageLogo);
+ //binding.viewImageLogo.setOnClickListener(v -> startActivity(new Intent(getApplicationContext(), YouTubeActivity.class)));
+ binding.viewImageLogo.setOnClickListener(v -> {
+ Intent intent = new Intent(getApplicationContext(), WatchVideoActivity.class);
+ intent.putExtra("vedio_link",String.valueOf(table.getVedioLink()));
+ startActivity(intent);
+ });
}
private View addCustomView(String title, String titleInfo, int color) {
View customLinear = LayoutInflater.from(this).inflate(R.layout.custom_text_view, binding.linearLayout, false);
- TextView tvTitle = customLinear.findViewById(R.id.title);
- TextView tvInfo = customLinear.findViewById(R.id.content);
+ TextView tvTitle = customLinear.findViewById(R.id.title);
+ TextView tvInfo = customLinear.findViewById(R.id.content);
- // style of textview
TextViewCompat.setTextAppearance(tvTitle, R.style.AppTextSmall);
TextViewCompat.setTextAppearance(tvInfo, R.style.AppTextSmall);
@@ -183,12 +143,6 @@ private View addCustomView(String title, String titleInfo, int color) {
return customLinear;
}
- private void applyMargin(View view){
- LinearLayout.LayoutParams params = new LinearLayout
- .LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
- params.setMargins(10, 16, 10, 16);
- view.setLayoutParams(params);
- }
private void buyBtnClickHandler(){
@@ -222,9 +176,9 @@ private void syncCart(){
successToast("Added to cart");
onBackPressed();
}).addOnFailureListener(e -> {
- hideProgressDialog();
- errorToast("Failed to add in cart");
- });
+ hideProgressDialog();
+ errorToast("Failed to add in cart");
+ });
}
@Override
@@ -233,34 +187,43 @@ public boolean onOptionsItemSelected(MenuItem item) {
if (id == android.R.id.home) {
finish();
return true;
- }
-
+ }/*else if (id == R.id.action_play) {
+ startActivity(new Intent(getApplicationContext(), WatchVideoActivity.class));
+ overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
+ return true;
+ }*/
return super.onOptionsItemSelected(item);
}
-
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.detail_menu, menu);
+ return true;
+ }
private void watchVedio() {
- AppCompatButton compatButton = new AppCompatButton(this);
+ //startActivity(new Intent(getApplicationContext(), WatchVideoActivity.class));
+ //overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
+ /*AppCompatButton compatButton = new AppCompatButton(this);
compatButton.setText("Watch Video");
compatButton.setTextColor(Color.RED);
compatButton.setBackgroundResource(R.drawable.gray_round_btn);
applyMargin(compatButton);
+ binding.linearLayout.addView(compatButton);*/
- binding.linearLayout.addView(compatButton);
- compatButton.setOnClickListener(v -> {
+ /*binding.btnWatchVideo.setOnClickListener(v -> {
AlertView alert = new AlertView("Watch Video", "Select Your Preferences", AlertStyle.BOTTOM_SHEET);
alert.addAction(new AlertAction("Watch Online", AlertActionStyle.DEFAULT, action -> {
- startActivity(new Intent(getApplicationContext(), PDLPlayerActivity.class));
+ startActivity(new Intent(getApplicationContext(), WatchVideoActivity.class));
}));
alert.addAction(new AlertAction("Youtube", AlertActionStyle.NEGATIVE, action -> {
startActivity(new Intent(getApplicationContext(), YouTubeActivity.class));
}));
alert.show(this);
- });
+ });*/
}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/profile/ProfileActivity.java b/app/src/main/java/com/pravrajya/diamond/views/users/profile/ProfileActivity.java
index 3fb913a..1b5e3e3 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/profile/ProfileActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/profile/ProfileActivity.java
@@ -3,7 +3,10 @@
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
+import android.widget.ImageView;
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.request.RequestOptions;
import com.fxn.stash.Stash;
import com.irozon.alertview.AlertActionStyle;
import com.irozon.alertview.AlertStyle;
@@ -11,11 +14,16 @@
import com.irozon.alertview.objects.AlertAction;
import com.pravrajya.diamond.R;
import com.pravrajya.diamond.databinding.ProfileLayoutBinding;
+import com.pravrajya.diamond.utils.Constants;
import com.pravrajya.diamond.views.users.login.UserProfile;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.AppCompatImageView;
+import androidx.core.widget.ImageViewCompat;
import androidx.databinding.DataBindingUtil;
+import static com.pravrajya.diamond.utils.Constants.DIAMOND_CUT;
+import static com.pravrajya.diamond.utils.Constants.PROFILE_ICON;
import static com.pravrajya.diamond.utils.Constants.USER_PROFILE;
/**
@@ -28,21 +36,65 @@ public class ProfileActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getSupportActionBar().setTitle("Profile");
binding = DataBindingUtil.setContentView(this, R.layout.profile_layout);
+
+ loadProfile();
+ }
+
+ private void loadProfile() {
+
UserProfile userNew = (UserProfile) Stash.getObject(USER_PROFILE, UserProfile.class);
+ if (userNew!=null){
+
+ if (!userNew.getProfileImage().isEmpty()){
+ loadPreview(binding.ivBack, userNew.getProfileImage());
+ loadProfile(binding.ivProfileIcon, userNew.getProfileImage());
+ }
+ if (userNew.getName()!=null && !userNew.getName().isEmpty()){
+ binding.tvName.setText(userNew.getName());
+ getSupportActionBar().setTitle(userNew.getName());
+ }else {
+ binding.tvName.setVisibility(View.GONE);
+ }
+
+ if (!userNew.getEmail().isEmpty()){
+ binding.tvEmail.setText(userNew.getEmail());
+ }else {
+ binding.tvEmail.setVisibility(View.GONE);
+ }
+
+ if (!userNew.getLocation().isEmpty()){
+ binding.tvLocation.setText(userNew.getLocation());
+ }else {
+ binding.tvLocation.setVisibility(View.GONE);
+ }
- binding.showAlert.setOnClickListener(v -> {
+ if (!userNew.getLoogedInBy().isEmpty()){
+ binding.tvLoggedInBy.setText("Loggedin by: "+userNew.getLoogedInBy());
+ }else {
+ binding.tvLoggedInBy.setVisibility(View.GONE);
+ }
- AlertView alert = new AlertView("Title", "Message", AlertStyle.BOTTOM_SHEET);
- alert.addAction(new AlertAction("Action 1", AlertActionStyle.DEFAULT, action -> {
- // Action 1 callback
- }));
- alert.addAction(new AlertAction("Action 2", AlertActionStyle.NEGATIVE, action -> {
- // Action 2 callback
- }));
- alert.show(this);
- });
+ }else { binding.cardView.setVisibility(View.INVISIBLE); }
+
+ }
+
+
+
+ private void loadPreview(AppCompatImageView imageView, String profileIcon) {
+ Glide.with(getApplicationContext()).load(profileIcon)
+ //.apply(new RequestOptions().override(PROFILE_ICON, PROFILE_ICON))
+ //.apply(RequestOptions.circleCropTransform())
+ .into(imageView);
+ }
+
+ private void loadProfile(AppCompatImageView imageView, String profileIcon) {
+ Glide.with(getApplicationContext()).load(profileIcon)
+ .apply(new RequestOptions().override(PROFILE_ICON, PROFILE_ICON))
+ .apply(RequestOptions.circleCropTransform())
+ .into(imageView);
}
}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/registration/SignUpActivity.java b/app/src/main/java/com/pravrajya/diamond/views/users/registration/SignUpActivity.java
index cb0e280..a343f71 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/registration/SignUpActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/registration/SignUpActivity.java
@@ -3,7 +3,6 @@
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
-
import com.fxn.stash.Stash;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
@@ -12,13 +11,12 @@
import com.pravrajya.diamond.views.BaseActivity;
import com.pravrajya.diamond.views.users.login.UserProfile;
import com.pravrajya.diamond.views.users.main.views.MainActivity;
-
import java.util.Objects;
-
import androidx.databinding.DataBindingUtil;
-
import static com.pravrajya.diamond.utils.Constants.USER_PROFILE;
+
+
public class SignUpActivity extends BaseActivity {
private ActivityProfileBinding binding;
@@ -82,7 +80,7 @@ private void firebaseCreateAccount(String name, String email, String password) {
if (task.isSuccessful()) {
FirebaseUser user = mAuth.getCurrentUser();
assert user != null;
- setUserProfile(user.getUid(), user.getEmail(), name, "");
+ setUserProfile(user);
} else {
errorToast(Objects.requireNonNull(task.getException()).getLocalizedMessage());
}
@@ -90,8 +88,10 @@ private void firebaseCreateAccount(String name, String email, String password) {
}
- private void setUserProfile(String uid, String email, String name, String userProfile) {
- Stash.put(USER_PROFILE,new UserProfile(uid, email, name, userProfile));
+ private void setUserProfile(FirebaseUser user) {
+ Stash.put(USER_PROFILE,new UserProfile(user.getUid(), user.getEmail(),
+ user.getDisplayName(), user.getProviderData().toString(), user.getPhoneNumber(), user.getProviders().toString(),
+ user.getPhotoUrl().toString()));
startActivity(new Intent(getApplicationContext(), MainActivity.class));
finish();
}
diff --git a/app/src/main/java/com/pravrajya/diamond/views/users/splash/SplashActivity.java b/app/src/main/java/com/pravrajya/diamond/views/users/splash/SplashActivity.java
index de0cdfc..ac6f516 100644
--- a/app/src/main/java/com/pravrajya/diamond/views/users/splash/SplashActivity.java
+++ b/app/src/main/java/com/pravrajya/diamond/views/users/splash/SplashActivity.java
@@ -27,15 +27,13 @@
*/
public class SplashActivity extends BaseActivity {
- private String BACKGROUND = "https://firebasestorage.googleapis.com/v0/b/pdlfirebaseproject.appspot.com/o/splash_screen%2Fimage_background.jpg?alt=media&token=95552799-9f02-4a7c-ab46-a6143009799f";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setNavigationBarColor(getResources().getColor(android.R.color.transparent));
ActivitySplashBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_splash);
binding.tvDeveloper.setText(Constants.DEVELOPER_INFO);
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
deleted file mode 100644
index 1f6bb29..0000000
--- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/drawable/assher_cut.jpg b/app/src/main/res/drawable/assher_cut.jpg
deleted file mode 100644
index 54dafb1..0000000
Binary files a/app/src/main/res/drawable/assher_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/cushion_cut.jpg b/app/src/main/res/drawable/cushion_cut.jpg
deleted file mode 100644
index b8659fd..0000000
Binary files a/app/src/main/res/drawable/cushion_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/emerald_cut.jpg b/app/src/main/res/drawable/emerald_cut.jpg
deleted file mode 100644
index ff4892a..0000000
Binary files a/app/src/main/res/drawable/emerald_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_add_black.xml b/app/src/main/res/drawable/ic_add_black.xml
deleted file mode 100644
index e3979cd..0000000
--- a/app/src/main/res/drawable/ic_add_black.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_add_shopping_cart.xml b/app/src/main/res/drawable/ic_add_shopping_cart.xml
deleted file mode 100644
index dd83f6a..0000000
--- a/app/src/main/res/drawable/ic_add_shopping_cart.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_burst_mode_black_24dp.xml b/app/src/main/res/drawable/ic_burst_mode_black_24dp.xml
new file mode 100644
index 0000000..609cad9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_burst_mode_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_card.xml b/app/src/main/res/drawable/ic_card.xml
deleted file mode 100644
index cbb6995..0000000
--- a/app/src/main/res/drawable/ic_card.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_certificate.xml b/app/src/main/res/drawable/ic_certificate.xml
new file mode 100644
index 0000000..41fbc67
--- /dev/null
+++ b/app/src/main/res/drawable/ic_certificate.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_chevron_right.xml b/app/src/main/res/drawable/ic_chevron_right.xml
deleted file mode 100644
index 405eddb..0000000
--- a/app/src/main/res/drawable/ic_chevron_right.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_email.xml b/app/src/main/res/drawable/ic_email.xml
new file mode 100644
index 0000000..ce97ab8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_email.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_error_black.xml b/app/src/main/res/drawable/ic_error_black.xml
new file mode 100644
index 0000000..fcd800b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_error_black.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_https_black.xml b/app/src/main/res/drawable/ic_https_black.xml
new file mode 100644
index 0000000..67a7c73
--- /dev/null
+++ b/app/src/main/res/drawable/ic_https_black.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_no_items.xml b/app/src/main/res/drawable/ic_no_items.xml
deleted file mode 100644
index 9e1722c..0000000
--- a/app/src/main/res/drawable/ic_no_items.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_orders.xml b/app/src/main/res/drawable/ic_orders.xml
deleted file mode 100644
index a902d9a..0000000
--- a/app/src/main/res/drawable/ic_orders.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_search_black_24dp.xml b/app/src/main/res/drawable/ic_search_black_24dp.xml
deleted file mode 100644
index affc7ba..0000000
--- a/app/src/main/res/drawable/ic_search_black_24dp.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
diff --git a/app/src/main/res/drawable/ic_slow_motion_video.xml b/app/src/main/res/drawable/ic_slow_motion_video.xml
new file mode 100644
index 0000000..1ffac79
--- /dev/null
+++ b/app/src/main/res/drawable/ic_slow_motion_video.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_arrow_drop_up_black.xml b/app/src/main/res/drawable/ic_smartphone.xml
similarity index 63%
rename from app/src/main/res/drawable/ic_arrow_drop_up_black.xml
rename to app/src/main/res/drawable/ic_smartphone.xml
index b1442ce..0f291f1 100644
--- a/app/src/main/res/drawable/ic_arrow_drop_up_black.xml
+++ b/app/src/main/res/drawable/ic_smartphone.xml
@@ -5,5 +5,5 @@
android:viewportHeight="24.0">
+ android:pathData="M17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19H7V5h10v14z"/>
diff --git a/app/src/main/res/drawable/image_background.jpg b/app/src/main/res/drawable/image_background.jpg
deleted file mode 100644
index 2843c57..0000000
Binary files a/app/src/main/res/drawable/image_background.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/list_selector.xml b/app/src/main/res/drawable/list_selector.xml
deleted file mode 100755
index 7488a45..0000000
--- a/app/src/main/res/drawable/list_selector.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/drawable/logo.png b/app/src/main/res/drawable/logo.png
deleted file mode 100644
index 1f9756f..0000000
Binary files a/app/src/main/res/drawable/logo.png and /dev/null differ
diff --git a/app/src/main/res/drawable/marquise_cut.jpg b/app/src/main/res/drawable/marquise_cut.jpg
deleted file mode 100644
index 136e979..0000000
Binary files a/app/src/main/res/drawable/marquise_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/oval_cut.jpg b/app/src/main/res/drawable/oval_cut.jpg
deleted file mode 100644
index 8fe1d7e..0000000
Binary files a/app/src/main/res/drawable/oval_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/pear_cut.jpg b/app/src/main/res/drawable/pear_cut.jpg
deleted file mode 100644
index 6a3b2ba..0000000
Binary files a/app/src/main/res/drawable/pear_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/princess_cut.jpg b/app/src/main/res/drawable/princess_cut.jpg
deleted file mode 100644
index eff666c..0000000
Binary files a/app/src/main/res/drawable/princess_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/radiant_cut.jpg b/app/src/main/res/drawable/radiant_cut.jpg
deleted file mode 100644
index 62424e3..0000000
Binary files a/app/src/main/res/drawable/radiant_cut.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/textlines.xml b/app/src/main/res/drawable/textlines.xml
new file mode 100644
index 0000000..63a7766
--- /dev/null
+++ b/app/src/main/res/drawable/textlines.xml
@@ -0,0 +1,20 @@
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/user_icon.xml b/app/src/main/res/drawable/user_icon.xml
new file mode 100644
index 0000000..7678580
--- /dev/null
+++ b/app/src/main/res/drawable/user_icon.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/user_location.xml b/app/src/main/res/drawable/user_location.xml
new file mode 100644
index 0000000..e3291a9
--- /dev/null
+++ b/app/src/main/res/drawable/user_location.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_admin_products.xml b/app/src/main/res/layout/activity_admin_products.xml
new file mode 100644
index 0000000..7af4a22
--- /dev/null
+++ b/app/src/main/res/layout/activity_admin_products.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_pdlplayer.xml b/app/src/main/res/layout/activity_pdlplayer.xml
index ffde651..0b2f2de 100644
--- a/app/src/main/res/layout/activity_pdlplayer.xml
+++ b/app/src/main/res/layout/activity_pdlplayer.xml
@@ -1,16 +1,25 @@
+ xmlns:tools="http://schemas.android.com/tools">
+
+ android:layout_height="match_parent">
-
+ android:layout_height="match_parent"
+ tools:context=".api.video_player.WatchVideoActivity"/>
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_product_detail.xml b/app/src/main/res/layout/activity_product_detail.xml
index 377f74d..fde7841 100644
--- a/app/src/main/res/layout/activity_product_detail.xml
+++ b/app/src/main/res/layout/activity_product_detail.xml
@@ -1,37 +1,63 @@
-
+
-
+ android:layout_height="match_parent">
-
+ android:layout_height="match_parent">
+ android:orientation="vertical">
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml
index ff2ceb2..7981b52 100644
--- a/app/src/main/res/layout/activity_splash.xml
+++ b/app/src/main/res/layout/activity_splash.xml
@@ -6,6 +6,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:background="@color/colorWhite"
tools:context=".views.users.splash.SplashActivity">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml
index 38e53da..e04adc2 100644
--- a/app/src/main/res/layout/app_bar_main.xml
+++ b/app/src/main/res/layout/app_bar_main.xml
@@ -13,10 +13,10 @@
android:id="@+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:elevation="0sp"
android:theme="@style/AppTheme.AppBarOverlay">
-
+
@@ -26,7 +26,6 @@
android:layout_height="match_parent"
android:layout_weight="1"/>
-
diff --git a/app/src/main/res/layout/content_admin.xml b/app/src/main/res/layout/content_admin.xml
index 5f338a6..19c78f7 100644
--- a/app/src/main/res/layout/content_admin.xml
+++ b/app/src/main/res/layout/content_admin.xml
@@ -20,8 +20,9 @@
android:layout_marginTop="@dimen/bottom_sheet_drawable_padding"
android:paddingBottom="@dimen/fab_margin"
android:orientation="vertical">
+
-
+ android:padding="@dimen/fab_margin" />-->
+ android:hint="@string/stock_id" />
@@ -85,7 +86,6 @@
-
-
+
+
+
+
+
+
+
@@ -268,7 +285,6 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -319,10 +407,12 @@
diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml
index 665ff75..c5c61a2 100644
--- a/app/src/main/res/layout/content_main.xml
+++ b/app/src/main/res/layout/content_main.xml
@@ -91,6 +91,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
+ android:gravity="center"
+ android:drawablePadding="@dimen/spacing_4"
+ android:background="@drawable/gray_round_btn"
+ android:paddingLeft="@dimen/fab_margin"
+ android:paddingEnd="@dimen/fab_margin"
+ android:paddingTop="@dimen/bottom_sheet_grid_item_horizontal_spacing"
+ android:drawableLeft="@drawable/ic_burst_mode_black_24dp"
+ android:paddingBottom="@dimen/bottom_sheet_grid_item_horizontal_spacing"
+ style="@style/AppTextSmall"
android:visibility="gone"
android:layout_gravity="center"/>
diff --git a/app/src/main/res/layout/content_news.xml b/app/src/main/res/layout/content_news.xml
index efe1624..11490ae 100644
--- a/app/src/main/res/layout/content_news.xml
+++ b/app/src/main/res/layout/content_news.xml
@@ -10,6 +10,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/top_margin">
+
+
-
-
+ android:layout_height="wrap_content"
+ android:padding="@dimen/bottom_sheet_grid_item_horizontal_spacing">
+
+
diff --git a/app/src/main/res/layout/profile_layout.xml b/app/src/main/res/layout/profile_layout.xml
index 4a2ef98..a7c6a58 100644
--- a/app/src/main/res/layout/profile_layout.xml
+++ b/app/src/main/res/layout/profile_layout.xml
@@ -1,16 +1,95 @@
-
-
+
+
-
+
+
+ app:cardCornerRadius="@dimen/bottom_sheet_divider_indent"
+ app:cardUseCompatPadding="true"
+ android:layout_margin="@dimen/activity_horizontal_margin"
+ android:layout_alignParentBottom="true">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/toolbar_layout.xml b/app/src/main/res/layout/toolbar_layout.xml
index a28b748..6ccdd2f 100644
--- a/app/src/main/res/layout/toolbar_layout.xml
+++ b/app/src/main/res/layout/toolbar_layout.xml
@@ -6,12 +6,14 @@
android:id="@+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:elevation="0sp"
android:theme="@style/AppTheme">
diff --git a/app/src/main/res/menu/detail_menu.xml b/app/src/main/res/menu/detail_menu.xml
new file mode 100644
index 0000000..4f7a517
--- /dev/null
+++ b/app/src/main/res/menu/detail_menu.xml
@@ -0,0 +1,11 @@
+
+
diff --git a/app/src/main/res/menu/navigation.xml b/app/src/main/res/menu/navigation.xml
index fcacbb0..d3ab440 100644
--- a/app/src/main/res/menu/navigation.xml
+++ b/app/src/main/res/menu/navigation.xml
@@ -17,6 +17,6 @@
android:id="@+id/navigation_cart"
android:icon="@drawable/ic_shopping_cart"
android:backgroundTint="@color/colorDrawerItem"
- android:title="@string/title_orders" />
+ android:title="@string/title_cart" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 555e788..8bc226b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -13,7 +13,6 @@
Home
Cart
Offers
- Cart
Pravrajya Diamond Llp is a Limited Liability Partnership firm incorporated on 23 October 2017.
It is registered at Registrar of Companies, Mumbai. Its total obligation of contribution is Rs. 100,000.
\n\nDesignated Partners of Pravrajya Diamond Llp are Shah Vishal Vinod and Mehta Nishit Hasmukhbhai.
@@ -71,18 +70,12 @@
Up/Down
Add new offer
-
- - @color/colorPrimary
- - @color/lightGray
- - @color/colorAccent
- - @color/red_google
- - @color/blue_facebook
- - @color/semi_black
- - @color/lightGray
- - @color/lightGray
- - @color/lightGray
- - @color/lightGray
-
+
+ - NONE
+ - GIA
+ - IGI
+
+
AddOfferActivity
Something additional..
@@ -120,7 +113,6 @@
Profile
Video Player
Watch Video
- RONUD
Shape
Size
Color
@@ -129,5 +121,13 @@
Polish
Symmetry
Fluorescence
+ Not available
+ RONUD
+ Stock Id
+ Show details..
+ Culet
+ Cert Number
+ Shade
+ Provide video link