Commit 2c28cff2 authored by iman Fauzi's avatar iman Fauzi

Merge branch 'dev' into cart

parents 3d82e9cd a847797c
...@@ -47,6 +47,8 @@ dependencies { ...@@ -47,6 +47,8 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.3.1' implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1' implementation 'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation 'com.ethanhua:skeleton:1.1.2' implementation 'com.ethanhua:skeleton:1.1.2'
implementation 'com.github.florent37:expansionpanel:1.2.4'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'io.supercharge:shimmerlayout:2.1.0' implementation 'io.supercharge:shimmerlayout:2.1.0'
implementation project(':library') implementation project(':library')
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--NFC PERMISSION AND FEATURE-->
<uses-permission android:name="android.permission.NFC"/>
<uses-feature android:name="android.hardware.nfc" />
<uses-feature <uses-feature
android:name="android.hardware.camera" android:name="android.hardware.camera"
......
...@@ -66,6 +66,7 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -66,6 +66,7 @@ public class FormProductActivity extends AppCompatActivity {
String locationPath = null; String locationPath = null;
int idCategorySelected = 0; int idCategorySelected = 0;
public int id = 0; public int id = 0;
public String categoryName = "";
private String[] permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, private String[] permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE}; Manifest.permission.WRITE_EXTERNAL_STORAGE};
...@@ -76,6 +77,7 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -76,6 +77,7 @@ public class FormProductActivity extends AppCompatActivity {
List<String> categorySelect = new ArrayList<>(); List<String> categorySelect = new ArrayList<>();
FormCategory formCategory; FormCategory formCategory;
@RequiresApi(api = Build.VERSION_CODES.N)
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -139,6 +141,7 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -139,6 +141,7 @@ public class FormProductActivity extends AppCompatActivity {
progressDialog.show(); progressDialog.show();
CategoryServise categoryServise = client.Client(CategoryServise.class); CategoryServise categoryServise = client.Client(CategoryServise.class);
categoryServise.addCategory(categoryModels).enqueue(new Callback<DataResponse<CategoryModels>>() { categoryServise.addCategory(categoryModels).enqueue(new Callback<DataResponse<CategoryModels>>() {
@RequiresApi(api = Build.VERSION_CODES.N)
@Override @Override
public void onResponse(Call<DataResponse<CategoryModels>> call, Response<DataResponse<CategoryModels>> response) { public void onResponse(Call<DataResponse<CategoryModels>> call, Response<DataResponse<CategoryModels>> response) {
if (response.body().getStatusData()){ if (response.body().getStatusData()){
...@@ -185,7 +188,11 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -185,7 +188,11 @@ public class FormProductActivity extends AppCompatActivity {
HashSet<String> set = new HashSet<>(); HashSet<String> set = new HashSet<>();
List<String> str = new ArrayList<>(); List<String> str = new ArrayList<>();
categoryModels = new ArrayList<>(); categoryModels = new ArrayList<>();
if (productModelsIntent == null){
str.add("SELECT CATEGORY"); str.add("SELECT CATEGORY");
}else{
str.add(getCategoryById(productModelsIntent.getIdProduct()));
}
mainViewModels.getCategory().observe(this, listDataResponse -> { mainViewModels.getCategory().observe(this, listDataResponse -> {
progressDialog.dismiss(); progressDialog.dismiss();
for (CategoryModels cd: listDataResponse.getData()){ for (CategoryModels cd: listDataResponse.getData()){
...@@ -329,6 +336,23 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -329,6 +336,23 @@ public class FormProductActivity extends AppCompatActivity {
return id; return id;
} }
private String getCategoryById(int s) {
CategoryServise categoryServise = client.Client(CategoryServise.class);
categoryServise.getCategoryId(s).enqueue(new Callback<DataResponse<CategoryModels>>() {
@Override
public void onResponse(Call<DataResponse<CategoryModels>> call, Response<DataResponse<CategoryModels>> response) {
categoryName = response.body().getData().getNameCategory();
}
@Override
public void onFailure(Call<DataResponse<CategoryModels>> call, Throwable t) {
}
});
return categoryName;
}
private void openFile(){ private void openFile(){
requestPermissions(permissions, REQUEST_PERMISSIONS); requestPermissions(permissions, REQUEST_PERMISSIONS);
Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
......
...@@ -163,6 +163,7 @@ public class PaymentActivity extends AppCompatActivity { ...@@ -163,6 +163,7 @@ public class PaymentActivity extends AppCompatActivity {
paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/n1V3ZCf/Whats-App-Image-2020-09-01-at-14-50-13.jpg", "nfc"));
PaymentAdapter adapter = new PaymentAdapter(paymentResponses, this); PaymentAdapter adapter = new PaymentAdapter(paymentResponses, this);
rvPayment.setAdapter(adapter); rvPayment.setAdapter(adapter);
......
...@@ -26,6 +26,9 @@ public interface CategoryServise { ...@@ -26,6 +26,9 @@ public interface CategoryServise {
@GET(ApiHelper.VERSI_API_1+"category-name/{id}") @GET(ApiHelper.VERSI_API_1+"category-name/{id}")
Call<DataResponse<List<CategoryModels>>> getCategoryByName(@Path("id") String name); Call<DataResponse<List<CategoryModels>>> getCategoryByName(@Path("id") String name);
@GET(ApiHelper.VERSI_API_1+"category/{id}")
Call<DataResponse<CategoryModels>> getCategoryId(@Path("id") int id);
@POST(ApiHelper.VERSI_API_1+"category") @POST(ApiHelper.VERSI_API_1+"category")
Call<DataResponse<CategoryModels>> addCategory(@Body CategoryModels categoryModels); Call<DataResponse<CategoryModels>> addCategory(@Body CategoryModels categoryModels);
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
tools:layout_editor_absoluteX="10dp" tools:layout_editor_absoluteX="10dp"
tools:listitem="@layout/item_checkout"
/> />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
...@@ -59,6 +58,11 @@ ...@@ -59,6 +58,11 @@
/> />
<ExpandableListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tvLabel">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvPayment" android:id="@+id/rvPayment"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -66,8 +70,9 @@ ...@@ -66,8 +70,9 @@
android:layout_margin="10dp" android:layout_margin="10dp"
android:nestedScrollingEnabled="false" android:nestedScrollingEnabled="false"
tools:layout_editor_absoluteX="10dp" tools:layout_editor_absoluteX="10dp"
tools:listitem="@layout/payment_list" tools:listitem="@layout/payment_list"/>
android:layout_below="@id/tvLabel"/>
</ExpandableListView>
</RelativeLayout> </RelativeLayout>
</ScrollView> </ScrollView>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment