Commit db00e096 authored by Muhammad Suryono's avatar Muhammad Suryono

Update

parent aee372a2
......@@ -63,6 +63,7 @@ public class FormProductActivity extends AppCompatActivity {
private boolean isUpdate = false;
String locationPath = null;
int idCategorySelected = 0;
public int id = 0;
private String[] permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
......@@ -297,7 +298,22 @@ public class FormProductActivity extends AppCompatActivity {
}
private int getCategory(String s) {
return 1;
Log.i("CATEGORY", "getCategory: "+s);
CategoryServise categoryServise = client.Client(CategoryServise.class);
categoryServise.getCategoryByName(s).enqueue(new Callback<DataResponse<List<CategoryModels>>>() {
@Override
public void onResponse(Call<DataResponse<List<CategoryModels>>> call, Response<DataResponse<List<CategoryModels>>> response) {
Log.i("CHDJHD", "getCategory: "+utils.convertGson(response.body()));
id = response.body().getData().get(0).getIdCategory();
}
@Override
public void onFailure(Call<DataResponse<List<CategoryModels>>> call, Throwable t) {
}
});
return id;
}
private void openFile(){
......
......@@ -23,6 +23,9 @@ public interface CategoryServise {
@GET(ApiHelper.VERSI_API_1+"product-category-id/{id}")
Call<DataResponse<List<ProductModels>>> getCategoryById(@Path("id") int id);
@GET(ApiHelper.VERSI_API_1+"category-name/{id}")
Call<DataResponse<List<CategoryModels>>> getCategoryByName(@Path("id") String name);
@POST(ApiHelper.VERSI_API_1+"category")
Call<DataResponse<CategoryModels>> addCategory(@Body CategoryModels categoryModels);
......
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