Commit ed08d6e6 by Krishna Vemulavada

userapi integraion

parents 89c051e8 5e6f6060
Showing with 780 additions and 77 deletions
...@@ -19,7 +19,7 @@ android { ...@@ -19,7 +19,7 @@ android {
minSdkVersion 9 minSdkVersion 9
targetSdkVersion 24 targetSdkVersion 24
versionCode 1 versionCode 1
versionName "0.0.2" versionName "0.0.3"
multiDexEnabled true multiDexEnabled true
} }
buildTypes { buildTypes {
......
...@@ -78,7 +78,9 @@ ...@@ -78,7 +78,9 @@
<activity <activity
android:name=".ui.MyRequestActivity" android:name=".ui.MyRequestActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize"/> />
<activity
android:name=".ui.MyIncidentScreen"
android:screenOrientation="portrait"/>
</application> </application>
</manifest> </manifest>
package com.vsoft.uofl_catalogue.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.vsoft.uofl_catalogue.R;
import com.vsoft.uofl_catalogue.db.models.Incident;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kunj on 11/8/16.
*/
public class MyIncidentsAdapter extends BaseAdapter {
private Context mContext;
private final List<Incident> mIncidentList = new ArrayList<>(0);
private LayoutInflater mInflater;
public MyIncidentsAdapter(Context context) {
mContext = context;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void setIncidentList(List<Incident> incidentList) {
mIncidentList.clear();
if(incidentList!=null)
mIncidentList.addAll(incidentList);
notifyDataSetChanged();
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return mIncidentList.size();
}
@Override
public Incident getItem(int position) {
// TODO Auto-generated method stub
return mIncidentList.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.my_incident_adapter, parent, false);
holder = new ViewHolder();
holder.numberTextView = (TextView) convertView.findViewById(R.id.my_incident_adapter_number_tv);
holder.shortDesTextView = (TextView) convertView.findViewById(R.id.my_incident_adapter_short_des_tv);
holder.dateTextView = (TextView) convertView.findViewById(R.id.my_incident_adapter_date_tv);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
Incident incident = mIncidentList.get(position);
holder.numberTextView.setText(incident.getNumber());
holder.dateTextView.setText(incident.getOpenedAt());
holder.shortDesTextView.setText(incident.getShortDescription());
return convertView;
}
static class ViewHolder {
private TextView numberTextView;
private TextView shortDesTextView;
private TextView dateTextView;
}
}
\ No newline at end of file
package com.vsoft.uofl_catalogue.api.interfaces;
import com.vsoft.uofl_catalogue.utils.Constants;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* @since 1.0
* @author Kunj on 11/8/16.
*
*/
public interface CatalogueCategoryApi {
// Get Catalogue API
@GET(Constants.URL_GET_CATALOGUE)
Call<ResponseBody> getCatalogue(@Query(Constants.URL_PARAM_SYSPRM_QUERY) String sysparmQuery,
@Query(Constants.URL_PARAM_SYSPRM_FIELDS) String sysParmFields);
}
package com.vsoft.uofl_catalogue.api.interfaces;
import com.vsoft.uofl_catalogue.utils.Constants;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* @since 1.0
* @author Kunj on 11/8/16.
*
*/
public interface CatalogueCategoryItemApi {
// Get Catalogue Item API
@GET(Constants.URL_GET_CATALOGUE_ITEM)
Call<ResponseBody> getCatalogueItem(@Query(Constants.URL_PARAM_SYSPRM_QUERY) String sysparmQuery,
@Query(Constants.URL_PARAM_SYSPRM_FIELDS) String sysParmFields);
}
...@@ -19,17 +19,7 @@ import retrofit2.http.Url; ...@@ -19,17 +19,7 @@ import retrofit2.http.Url;
* @author Kunj on 11/8/16. * @author Kunj on 11/8/16.
* *
*/ */
public interface CatalogueApi { public interface CatalogueVariableApi {
// Get Catalogue API
@GET(Constants.URL_GET_CATALOGUE)
Call<ResponseBody> getCatalogue(@Query(Constants.URL_PARAM_SYSPRM_QUERY) String sysparmQuery,
@Query(Constants.URL_PARAM_SYSPRM_FIELDS) String sysParmFields);
// Get Catalogue Item API
@GET(Constants.URL_GET_CATALOGUE_ITEM)
Call<ResponseBody> getCatalogueItem(@Query(Constants.URL_PARAM_SYSPRM_QUERY) String sysparmQuery,
@Query(Constants.URL_PARAM_SYSPRM_FIELDS) String sysParmFields);
// Get Variable API // Get Variable API
@GET(Constants.URL_GET_VARIABLE) @GET(Constants.URL_GET_VARIABLE)
Call<ResponseBody> getVariable(@Query(CatalogueVariable.Json.SYS_ID) String sysId); Call<ResponseBody> getVariable(@Query(CatalogueVariable.Json.SYS_ID) String sysId);
...@@ -47,7 +37,6 @@ public interface CatalogueApi { ...@@ -47,7 +37,6 @@ public interface CatalogueApi {
// Get Reference API // Get Reference API
@GET @GET
Call<ResponseBody> getReference(@Url String url, @Query(Reference.Json.FIRST_NAME) String firstName); Call<ResponseBody> getReference(@Url String url, @Query(Reference.Json.FIRST_NAME) String firstName);
} }
package com.vsoft.uofl_catalogue.api.interfaces;
import com.vsoft.uofl_catalogue.utils.Constants;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* @since 1.0
* @author Kunj on 31/8/16.
*
*/
public interface IncidentApi {
// Get Incident API
@GET(Constants.URL_GET_INCIDENTS)
Call<ResponseBody> getIncident(@Query(Constants.URL_PARAM_SYSPRM_QUERY) String sysParmQuery,
@Query(Constants.URL_PARAM_SYSPRM_LIMIT) String sysParmLimits);
}
package com.vsoft.uofl_catalogue.api.listeners.get;
import com.vsoft.uofl_catalogue.db.models.Incident;
import java.util.List;
/**
* @since 1.0
* @author Kunj on 11/8/16
*
*/
public interface GetIncidentApiListener {
void onDoneApiCall(List<Incident> incidentList);
}
...@@ -7,8 +7,8 @@ import com.google.gson.JsonDeserializer; ...@@ -7,8 +7,8 @@ import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.vsoft.uofl_catalogue.api.RestClient; import com.vsoft.uofl_catalogue.api.RestClient;
import com.vsoft.uofl_catalogue.api.interfaces.CatalogueCategoryApi;
import com.vsoft.uofl_catalogue.db.models.Catalogue; import com.vsoft.uofl_catalogue.db.models.Catalogue;
import com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi;
import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueApiListener;
import com.vsoft.uofl_catalogue.enums.SyncStatus; import com.vsoft.uofl_catalogue.enums.SyncStatus;
import com.vsoft.uofl_catalogue.utils.CatalogueLog; import com.vsoft.uofl_catalogue.utils.CatalogueLog;
...@@ -43,7 +43,7 @@ public class CatalogueApiManager { ...@@ -43,7 +43,7 @@ public class CatalogueApiManager {
CatalogueLog.d("CatalogueApiManager: getCatalogues: request parameter: "+stringBuilder.toString()); CatalogueLog.d("CatalogueApiManager: getCatalogues: request parameter: "+stringBuilder.toString());
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD); final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(CatalogueApi.class).getCatalogue(stringBuilder.toString(), "sys_id,title,description"); Call<ResponseBody> call = retrofit.create(CatalogueCategoryApi.class).getCatalogue(stringBuilder.toString(), "sys_id,title,description");
try { try {
//Retrofit synchronous call //Retrofit synchronous call
Response<ResponseBody> response = call.execute(); Response<ResponseBody> response = call.execute();
......
...@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer; ...@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.vsoft.uofl_catalogue.api.RestClient; import com.vsoft.uofl_catalogue.api.RestClient;
import com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi; import com.vsoft.uofl_catalogue.api.interfaces.CatalogueCategoryItemApi;
import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueItemApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueItemApiListener;
import com.vsoft.uofl_catalogue.db.models.CatalogueItem; import com.vsoft.uofl_catalogue.db.models.CatalogueItem;
import com.vsoft.uofl_catalogue.enums.SyncStatus; import com.vsoft.uofl_catalogue.enums.SyncStatus;
...@@ -43,7 +43,7 @@ public class CatalogueItemApiManager { ...@@ -43,7 +43,7 @@ public class CatalogueItemApiManager {
CatalogueLog.d("CatalogueItemApiManager: getCatalogueItems: request parameter: "+stringBuilder.toString()); CatalogueLog.d("CatalogueItemApiManager: getCatalogueItems: request parameter: "+stringBuilder.toString());
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD); final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(CatalogueApi.class).getCatalogueItem(stringBuilder.toString(), "sys_id,short_description,name,description"); Call<ResponseBody> call = retrofit.create(CatalogueCategoryItemApi.class).getCatalogueItem(stringBuilder.toString(), "sys_id,short_description,name,description");
try { try {
//Retrofit synchronous call //Retrofit synchronous call
Response<ResponseBody> response = call.execute(); Response<ResponseBody> response = call.execute();
...@@ -125,26 +125,4 @@ public class CatalogueItemApiManager { ...@@ -125,26 +125,4 @@ public class CatalogueItemApiManager {
return SyncStatus.FAIL; return SyncStatus.FAIL;
} }
} }
public static SyncStatus submitCatalogueItem(String catalogueItemSysId, JSONArray catalogueJsonArray) {
CatalogueLog.d("submitCatalogueItem: " + catalogueJsonArray);
String expenseJsonString = catalogueJsonArray.toString();
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(CatalogueApi.class).postCatalogueItem(catalogueItemSysId, expenseJsonString);
try {
//Retrofit synchronous call
Response<ResponseBody> response = call.execute();
if (response.isSuccessful()) {
return SyncStatus.SUCCESS;
} else {
return SyncStatus.FAIL;
}
} catch (IOException e) {
CatalogueLog.e("CatalogueItemApiManager: submitCatalogueItem: IOException: ", e);
return SyncStatus.FAIL;
} catch (NullPointerException e){
CatalogueLog.e("CatalogueItemApiManager: submitCatalogueItem: IOException: ", e);
return SyncStatus.FAIL;
}
}
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer; ...@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.vsoft.uofl_catalogue.api.RestClient; import com.vsoft.uofl_catalogue.api.RestClient;
import com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi; import com.vsoft.uofl_catalogue.api.interfaces.CatalogueVariableApi;
import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener;
import com.vsoft.uofl_catalogue.db.models.CatalogueVariable; import com.vsoft.uofl_catalogue.db.models.CatalogueVariable;
import com.vsoft.uofl_catalogue.enums.SyncStatus; import com.vsoft.uofl_catalogue.enums.SyncStatus;
...@@ -37,7 +37,7 @@ public class CatalogueVariableApiManager { ...@@ -37,7 +37,7 @@ public class CatalogueVariableApiManager {
public static SyncStatus getCatalogueVariable(String catalogueItemSysId, GetCatalogueVariableApiListener listener) { public static SyncStatus getCatalogueVariable(String catalogueItemSysId, GetCatalogueVariableApiListener listener) {
CatalogueLog.d("CatalogueVariableApiManager: getCatalogueVariable: "); CatalogueLog.d("CatalogueVariableApiManager: getCatalogueVariable: ");
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD); final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(CatalogueApi.class).getVariable(catalogueItemSysId); Call<ResponseBody> call = retrofit.create(CatalogueVariableApi.class).getVariable(catalogueItemSysId);
try { try {
//Retrofit synchronous call //Retrofit synchronous call
Response<ResponseBody> response = call.execute(); Response<ResponseBody> response = call.execute();
...@@ -121,4 +121,26 @@ public class CatalogueVariableApiManager { ...@@ -121,4 +121,26 @@ public class CatalogueVariableApiManager {
return SyncStatus.FAIL; return SyncStatus.FAIL;
} }
} }
public static SyncStatus submitVariableForm(String catalogueItemSysId, JSONArray catalogueJsonArray) {
CatalogueLog.d("submitVariableForm: " + catalogueJsonArray);
String expenseJsonString = catalogueJsonArray.toString();
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(CatalogueVariableApi.class).postCatalogueItem(catalogueItemSysId, expenseJsonString);
try {
//Retrofit synchronous call
Response<ResponseBody> response = call.execute();
if (response.isSuccessful()) {
return SyncStatus.SUCCESS;
} else {
return SyncStatus.FAIL;
}
} catch (IOException e) {
CatalogueLog.e("CatalogueVariableApiManager: submitVariableForm: IOException: ", e);
return SyncStatus.FAIL;
} catch (NullPointerException e){
CatalogueLog.e("CatalogueVariableApiManager: submitVariableForm: IOException: ", e);
return SyncStatus.FAIL;
}
}
} }
\ No newline at end of file
package com.vsoft.uofl_catalogue.api.managers;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.vsoft.uofl_catalogue.api.RestClient;
import com.vsoft.uofl_catalogue.api.interfaces.IncidentApi;
import com.vsoft.uofl_catalogue.api.listeners.get.GetIncidentApiListener;
import com.vsoft.uofl_catalogue.db.models.Incident;
import com.vsoft.uofl_catalogue.enums.SyncStatus;
import com.vsoft.uofl_catalogue.utils.CatalogueLog;
import com.vsoft.uofl_catalogue.utils.Constants;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.Retrofit;
/**
* @author Kunj on 31/8/16.
*
*/
public class IncidentApiManager {
public static SyncStatus getIncident(GetIncidentApiListener listener) {
CatalogueLog.d("IncidentApiManager: getIncident: ");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("caller_id=javascript:gs.getUserID()");
CatalogueLog.d("IncidentApiManager: getIncident: request parameter: "+stringBuilder.toString());
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(IncidentApi.class).getIncident(stringBuilder.toString(), "");
try {
//Retrofit synchronous call
Response<ResponseBody> response = call.execute();
if (response.isSuccessful()) {
try {
JSONObject jsonObject = new JSONObject(response.body().string());
JSONObject error = jsonObject.optJSONObject(Constants.RESPONSE_ERROR_OBJECT_NAME);
if (error == null) {
JSONArray incidentJsonArray = jsonObject.getJSONArray(Constants.RESPONSE_RESULT_OBJECT_NAME);
if(incidentJsonArray.length() > 0) {
Gson gson = new GsonBuilder()
.excludeFieldsWithoutExposeAnnotation()
.registerTypeAdapter(long.class, new JsonDeserializer<Long>() {
@Override
public Long deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
long value = 0;
try {
value = json.getAsLong();
} catch (NumberFormatException e) {
CatalogueLog.d("IncidentApiManager: getIncident: deserialize: long.class: NumberFormatException: ");
}
return value;
}
})
.registerTypeAdapter(int.class, new JsonDeserializer<Integer>() {
@Override
public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
int value = 0;
try {
value = json.getAsInt();
} catch (NumberFormatException e) {
CatalogueLog.d("IncidentApiManager: getIncident: deserialize: int.class: NumberFormatException: ");
}
return value;
}
})
.registerTypeAdapter(float.class, new JsonDeserializer<Float>() {
@Override
public Float deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
float value = 0;
try {
value = json.getAsFloat();
} catch (NumberFormatException e) {
CatalogueLog.e("IncidentApiManager: getIncident: deserialize: float.class: NumberFormatException: ", e);
}
return value;
}
})
.create();
List<Incident> incidentList = new ArrayList<>(incidentJsonArray.length());
for (int i = 0; i < incidentJsonArray.length(); i++) {
JSONObject expenseJsonObject = incidentJsonArray.getJSONObject(i);
Incident incident = gson.fromJson(expenseJsonObject.toString(), Incident.class);
incident.parseJson(expenseJsonObject);
incidentList.add(incident);
}
listener.onDoneApiCall(incidentList);
} else {
listener.onDoneApiCall(new ArrayList<Incident>(0));
}
return SyncStatus.SUCCESS;
} else
return SyncStatus.FAIL;
} catch (JSONException e) {
CatalogueLog.e("IncidentApiManager: getIncident: onResponse: ", e);
return SyncStatus.FAIL;
} catch (IOException e) {
CatalogueLog.e("IncidentApiManager: getIncident: onResponse: ", e);
return SyncStatus.FAIL;
}
} else {
return SyncStatus.FAIL;
}
} catch (IOException e) {
CatalogueLog.e("IncidentApiManager: getIncident: IOException: ", e);
return SyncStatus.FAIL;
} catch (NullPointerException e) {
CatalogueLog.e("IncidentApiManager: getIncident: NullPointerException: ", e);
return SyncStatus.FAIL;
}
}
}
\ No newline at end of file
...@@ -29,10 +29,10 @@ public class LoginApiManger { ...@@ -29,10 +29,10 @@ public class LoginApiManger {
return SyncStatus.FAIL; return SyncStatus.FAIL;
} }
} catch (IOException e) { } catch (IOException e) {
CatalogueLog.e("CatalogueItemApiManager: submitCatalogueItem: IOException: ", e); CatalogueLog.e("LoginApiManger: submitLoginValues: IOException: ", e);
return SyncStatus.FAIL; return SyncStatus.FAIL;
} catch (NullPointerException e) { } catch (NullPointerException e) {
CatalogueLog.e("CatalogueItemApiManager: submitCatalogueItem: IOException: ", e); CatalogueLog.e("LoginApiManger: submitLoginValues: IOException: ", e);
return SyncStatus.FAIL; return SyncStatus.FAIL;
} }
} }
......
...@@ -7,25 +7,19 @@ import com.google.gson.JsonDeserializer; ...@@ -7,25 +7,19 @@ import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.vsoft.uofl_catalogue.api.RestClient; import com.vsoft.uofl_catalogue.api.RestClient;
import com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi;
import com.vsoft.uofl_catalogue.api.interfaces.MyRequestApi; import com.vsoft.uofl_catalogue.api.interfaces.MyRequestApi;
import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueApiListener;
import com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener;
import com.vsoft.uofl_catalogue.db.models.Catalogue;
import com.vsoft.uofl_catalogue.db.models.MyRequest; import com.vsoft.uofl_catalogue.db.models.MyRequest;
import com.vsoft.uofl_catalogue.enums.SyncStatus; import com.vsoft.uofl_catalogue.enums.SyncStatus;
import com.vsoft.uofl_catalogue.utils.CatalogueLog; import com.vsoft.uofl_catalogue.utils.CatalogueLog;
import com.vsoft.uofl_catalogue.utils.Constants; import com.vsoft.uofl_catalogue.utils.Constants;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Response; import retrofit2.Response;
......
...@@ -58,7 +58,6 @@ public class UserApiManager { ...@@ -58,7 +58,6 @@ public class UserApiManager {
try { try {
value = json.getAsLong(); value = json.getAsLong();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
CatalogueLog.d("CatalogueApiManager: getCatalogues: deserialize: long.class: NumberFormatException: ");
} }
return value; return value;
} }
...@@ -70,7 +69,6 @@ public class UserApiManager { ...@@ -70,7 +69,6 @@ public class UserApiManager {
try { try {
value = json.getAsInt(); value = json.getAsInt();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
CatalogueLog.d("CatalogueApiManager: getCatalogues: deserialize: int.class: NumberFormatException: ");
} }
return value; return value;
} }
...@@ -82,20 +80,19 @@ public class UserApiManager { ...@@ -82,20 +80,19 @@ public class UserApiManager {
try { try {
value = json.getAsFloat(); value = json.getAsFloat();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
CatalogueLog.e("CatalogueApiManager: getCatalogues: deserialize: float.class: NumberFormatException: ", e);
} }
return value; return value;
} }
}) })
.create(); .create();
List<UserApiValues> catalogueList = new ArrayList<>(catalogueJsonArray.length()); List<UserApiValues> userList = new ArrayList<>(catalogueJsonArray.length());
for (int i = 0; i < catalogueJsonArray.length(); i++) { for (int i = 0; i < catalogueJsonArray.length(); i++) {
JSONObject expenseJsonObject = catalogueJsonArray.getJSONObject(i); JSONObject expenseJsonObject = catalogueJsonArray.getJSONObject(i);
UserApiValues catalogue = gson.fromJson(expenseJsonObject.toString(), UserApiValues.class); UserApiValues catalogue = gson.fromJson(expenseJsonObject.toString(), UserApiValues.class);
catalogueList.add(catalogue); userList.add(catalogue);
} }
listener.onDoneApiCall(catalogueList); listener.onDoneApiCall(userList);
} else { } else {
listener.onDoneApiCall(new ArrayList<UserApiValues>(0)); listener.onDoneApiCall(new ArrayList<UserApiValues>(0));
} }
...@@ -103,20 +100,16 @@ public class UserApiManager { ...@@ -103,20 +100,16 @@ public class UserApiManager {
} else } else
return SyncStatus.FAIL; return SyncStatus.FAIL;
} catch (JSONException e) { } catch (JSONException e) {
CatalogueLog.e("CatalogueApiManager: getCatalogues: onResponse: ", e);
return SyncStatus.FAIL; return SyncStatus.FAIL;
} catch (IOException e) { } catch (IOException e) {
CatalogueLog.e("CatalogueApiManager: getCatalogues: onResponse: ", e);
return SyncStatus.FAIL; return SyncStatus.FAIL;
} }
} else { } else {
return SyncStatus.FAIL; return SyncStatus.FAIL;
} }
} catch (IOException e) { } catch (IOException e) {
CatalogueLog.e("CatalogueApiManager: getCatalogues: IOException: ", e);
return SyncStatus.FAIL; return SyncStatus.FAIL;
} catch (NullPointerException e) { } catch (NullPointerException e) {
CatalogueLog.e("CatalogueApiManager: getCatalogues: NullPointerException: ", e);
return SyncStatus.FAIL; return SyncStatus.FAIL;
} }
} }
......
...@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer; ...@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.vsoft.uofl_catalogue.api.RestClient; import com.vsoft.uofl_catalogue.api.RestClient;
import com.vsoft.uofl_catalogue.api.interfaces.CatalogueApi; import com.vsoft.uofl_catalogue.api.interfaces.CatalogueVariableApi;
import com.vsoft.uofl_catalogue.api.listeners.get.GetReferenceApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetReferenceApiListener;
import com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener;
import com.vsoft.uofl_catalogue.db.models.Reference; import com.vsoft.uofl_catalogue.db.models.Reference;
...@@ -45,7 +45,7 @@ public class VariableChoiceApiManager { ...@@ -45,7 +45,7 @@ public class VariableChoiceApiManager {
CatalogueLog.d("VariableChoiceApiManager: getVariableChoice: request parameter: "+stringBuilder.toString()); CatalogueLog.d("VariableChoiceApiManager: getVariableChoice: request parameter: "+stringBuilder.toString());
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD); final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(CatalogueApi.class).getVariableChoice(stringBuilder.toString(), "text,value,order,misc"); Call<ResponseBody> call = retrofit.create(CatalogueVariableApi.class).getVariableChoice(stringBuilder.toString(), "text,value,order,misc");
try { try {
//Retrofit synchronous call //Retrofit synchronous call
Response<ResponseBody> response = call.execute(); Response<ResponseBody> response = call.execute();
...@@ -132,7 +132,7 @@ public class VariableChoiceApiManager { ...@@ -132,7 +132,7 @@ public class VariableChoiceApiManager {
CatalogueLog.d("VariableChoiceApiManager: getReference: tableName: "+tableName); CatalogueLog.d("VariableChoiceApiManager: getReference: tableName: "+tableName);
final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD); final Retrofit retrofit = RestClient.getInitializedRestAdapter(Constants.API_AUTH_PARAM_USER_NAME, Constants.API_AUTH_PARAM_PASSWORD);
Call<ResponseBody> call = retrofit.create(CatalogueApi.class).getReference(Constants.URL_GET_REFERENCE + tableName, firstName); Call<ResponseBody> call = retrofit.create(CatalogueVariableApi.class).getReference(Constants.URL_GET_REFERENCE + tableName, firstName);
try { try {
//Retrofit synchronous call //Retrofit synchronous call
Response<ResponseBody> response = call.execute(); Response<ResponseBody> response = call.execute();
......
package com.vsoft.uofl_catalogue.db.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.vsoft.uofl_catalogue.enums.Impact;
import com.vsoft.uofl_catalogue.utils.Util;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by Kunj on 11/8/16.
*/
public class Incident {
@SerializedName("number")
@Expose
private String number;
@SerializedName("short_description")
@Expose
private String shortDescription;
@SerializedName("opened_at")
// @Expose
private String openedAt;
@SerializedName("impact")
// @Expose
private Impact impact;
public Impact getImpact() {
return impact;
}
public void setImpact(Impact impact) {
this.impact = impact;
}
public String getOpenedAt() {
return openedAt;
}
public void setOpenedAt(String openedAt) {
this.openedAt = openedAt;
}
public String getShortDescription() {
return shortDescription;
}
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public void parseJson(JSONObject jsonObject) {
int impact = -1;
String openedAt = null;
try {
openedAt = jsonObject.getString(Json.OPENED_AT);
impact = jsonObject.getInt(Json.IMPACT);
} catch (JSONException e) {
e.printStackTrace();
}
this.setOpenedAt(Util.getDateTime(openedAt));
this.setImpact(Impact.from(impact));
}
public static final class IncidentBuilder {
private String number;
private String shortDescription;
private String openedAt;
private Impact impact;
private IncidentBuilder() {
}
public static IncidentBuilder anIncident() {
return new IncidentBuilder();
}
public IncidentBuilder setNumber(String number) {
this.number = number;
return this;
}
public IncidentBuilder setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
return this;
}
public IncidentBuilder setOpenedAt(String openedAt) {
this.openedAt = openedAt;
return this;
}
public IncidentBuilder setImpact(Impact impact) {
this.impact = impact;
return this;
}
public IncidentBuilder but() {
return anIncident().setNumber(number).setShortDescription(shortDescription).setOpenedAt(openedAt).setImpact(impact);
}
public Incident build() {
Incident incident = new Incident();
incident.setNumber(number);
incident.setShortDescription(shortDescription);
incident.setOpenedAt(openedAt);
incident.setImpact(impact);
return incident;
}
}
public static class Json {
public static final String IMPACT = "impact";
public static final String OPENED_AT = "opened_at";
}
@Override
public String toString() {
return "Incident{" +
"number='" + number + '\'' +
", shortDescription='" + shortDescription + '\'' +
", openedAt='" + openedAt + '\'' +
", impact=" + impact +
'}';
}
}
package com.vsoft.uofl_catalogue.enums;
/**
* @since 1.0
* @author Kunj on 30/8/16.
*
*/
public enum Impact {
UNKNOWN (-1),
HIGH (1),
MEDIUM (2),
LOW (3);
int id;
Impact(int id) {
this.id = id;
}
public static int getSyncStatus(Impact status) {
return status.id;
}
public int getId() {
return this.id;
}
public static Impact from(int id) {
for(int i = 0; i< Impact.values().length; i++) {
Impact impact = Impact.values()[i];
if(impact.id == id)
return Impact.values()[i];
}
return UNKNOWN;
}
}
...@@ -28,7 +28,6 @@ import com.vsoft.uofl_catalogue.CatalogueApplication; ...@@ -28,7 +28,6 @@ import com.vsoft.uofl_catalogue.CatalogueApplication;
import com.vsoft.uofl_catalogue.R; import com.vsoft.uofl_catalogue.R;
import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetCatalogueVariableApiListener;
import com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener; import com.vsoft.uofl_catalogue.api.listeners.get.GetVariableChoiceApiListener;
import com.vsoft.uofl_catalogue.api.managers.CatalogueItemApiManager;
import com.vsoft.uofl_catalogue.api.managers.CatalogueVariableApiManager; import com.vsoft.uofl_catalogue.api.managers.CatalogueVariableApiManager;
import com.vsoft.uofl_catalogue.api.managers.VariableChoiceApiManager; import com.vsoft.uofl_catalogue.api.managers.VariableChoiceApiManager;
import com.vsoft.uofl_catalogue.db.models.CatalogueVariable; import com.vsoft.uofl_catalogue.db.models.CatalogueVariable;
...@@ -463,7 +462,7 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -463,7 +462,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override @Override
protected SyncStatus doInBackground(String... params) { protected SyncStatus doInBackground(String... params) {
SyncStatus syncStatus = CatalogueItemApiManager.submitCatalogueItem(mCatalogueItemSysId, mJsonArray); SyncStatus syncStatus = CatalogueVariableApiManager.submitVariableForm(mCatalogueItemSysId, mJsonArray);
return syncStatus; return syncStatus;
} }
......
...@@ -42,7 +42,9 @@ public class HomeScreen extends Activity { ...@@ -42,7 +42,9 @@ public class HomeScreen extends Activity {
startActivity(new Intent(HomeScreen.this, ReportIncidentScreen.class)); startActivity(new Intent(HomeScreen.this, ReportIncidentScreen.class));
} else if(position == 1) { } else if(position == 1) {
startActivity(new Intent(HomeScreen.this, CatalogueScreen.class)); startActivity(new Intent(HomeScreen.this, CatalogueScreen.class));
} else if(position == 3) { } else if(position == 2) {
startActivity(new Intent(HomeScreen.this, MyIncidentScreen.class));
}else if(position == 3) {
startActivity(new Intent(HomeScreen.this, MyRequestActivity.class)); startActivity(new Intent(HomeScreen.this, MyRequestActivity.class));
} }
} }
......
package com.vsoft.uofl_catalogue.ui;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.widget.ListView;
import com.vsoft.uofl_catalogue.CatalogueApplication;
import com.vsoft.uofl_catalogue.R;
import com.vsoft.uofl_catalogue.adapters.MyIncidentsAdapter;
import com.vsoft.uofl_catalogue.api.listeners.get.GetIncidentApiListener;
import com.vsoft.uofl_catalogue.api.managers.IncidentApiManager;
import com.vsoft.uofl_catalogue.db.models.Incident;
import com.vsoft.uofl_catalogue.enums.SyncStatus;
import com.vsoft.uofl_catalogue.utils.CatalogueLog;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;
/**
* Created by kunj on 30/8/16.
*/
public class MyIncidentScreen extends AppCompatActivity {
@BindView(R.id.tool_bar_view) Toolbar mToolbar;
@BindView(R.id.my_incidents_screen_list_view) ListView mListView;
private CatalogueApplication mApplication;
private List<Incident> mIncidentList;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.my_incidents_screen);
ButterKnife.bind(this);
mApplication = (CatalogueApplication) getApplication();
setSupportActionBar(mToolbar);
ActionBar actionBar = getSupportActionBar();
if(actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setElevation(0);
actionBar.setTitle(R.string.my_incidents_text_string);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);
}
if(mApplication.isNetConnected()) {
new FetchIncident().execute();
} else {
showErrorDialog(R.string.internet_validation_string);
}
}
@OnItemClick(R.id.my_incidents_screen_list_view)
void listViewOnClicked(int position) {
Incident incident = mIncidentList.get(position);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Number: ");
stringBuilder.append(incident.getNumber());
stringBuilder.append("\n\n");
stringBuilder.append("Opened At: ");
stringBuilder.append(incident.getOpenedAt());
stringBuilder.append("\n\n");
stringBuilder.append("Short Description: ");
stringBuilder.append(incident.getShortDescription());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(stringBuilder.toString())
.setCancelable(false)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
class FetchIncident extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(MyIncidentScreen.this);
progressDialog.setMessage(getString(R.string.loading_string));
progressDialog.show();
progressDialog.setCancelable(false);
}
@Override
protected SyncStatus doInBackground(String... params) {
SyncStatus syncStatus = IncidentApiManager.getIncident(new GetIncidentApiListener() {
@Override
public void onDoneApiCall(List<Incident> incidentList) {
CatalogueLog.e("Data: incidentList: "+incidentList);
mIncidentList = incidentList;
}
});
return syncStatus;
}
@Override
protected void onPostExecute(SyncStatus syncStatus) {
super.onPostExecute(syncStatus);
if(progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
if(syncStatus == SyncStatus.SUCCESS) {
if(mIncidentList!=null)
setData(mIncidentList);
} else {
showErrorDialog(R.string.failed_to_fetch_incident_string);
}
}
}
private void setData(final List<Incident> catalogueList) {
MyIncidentsAdapter adapter = new MyIncidentsAdapter(MyIncidentScreen.this);
adapter.setIncidentList(catalogueList);
mListView.setAdapter(adapter);
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(menuItem);
}
private void showErrorDialog(int message) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(message)
.setCancelable(false)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
...@@ -26,6 +26,7 @@ public class Constants { ...@@ -26,6 +26,7 @@ public class Constants {
public static final String URL_PARAM_SYSPRM_QUERY = "sysparm_query"; public static final String URL_PARAM_SYSPRM_QUERY = "sysparm_query";
public static final String URL_PARAM_SYSPRM_FIELDS = "sysparm_fields"; public static final String URL_PARAM_SYSPRM_FIELDS = "sysparm_fields";
public static final String URL_PARAM_SYSPRM_USERNAME = "user_name"; public static final String URL_PARAM_SYSPRM_USERNAME = "user_name";
public static final String URL_PARAM_SYSPRM_LIMIT = "sysparm_limit";
/** /**
* Debug logs * Debug logs
...@@ -106,14 +107,23 @@ public class Constants { ...@@ -106,14 +107,23 @@ public class Constants {
/** /**
* Catalogue web services urls * Catalogue web services urls
*/ */
/*Login API */
public static final String URL_POST_LOGIN_ITEM = "/oauth_token.do";
/*Catalogue Category API */
public static final String URL_GET_CATALOGUE = API_PATH + "sc_category"; public static final String URL_GET_CATALOGUE = API_PATH + "sc_category";
/*Catalogue Category Items API */
public static final String URL_GET_CATALOGUE_ITEM = API_PATH + "sc_cat_item"; public static final String URL_GET_CATALOGUE_ITEM = API_PATH + "sc_cat_item";
/*Variable form API */
public static final String URL_GET_VARIABLE = "/api/uno33/uofl_mobile/variables"; public static final String URL_GET_VARIABLE = "/api/uno33/uofl_mobile/variables";
public static final String URL_GET_VARIABLE_CHOICE = API_PATH + "question_choice"; public static final String URL_GET_VARIABLE_CHOICE = API_PATH + "question_choice";
public static final String URL_POST_CATALOGUE_ITEM = "api/uno33/uofl_mobile"; public static final String URL_POST_CATALOGUE_ITEM = "api/uno33/uofl_mobile";
public static final String URL_GET_REFERENCE = API_PATH; public static final String URL_GET_REFERENCE = API_PATH;
public static final String URL_POST_LOGIN_ITEM = "/oauth_token.do";
public static final String URL_GET_MYREQUEST = API_PATH + "sc_req_item"; public static final String URL_GET_MYREQUEST = API_PATH + "sc_req_item";
public static final String URL_GET_USERDETAILS = API_PATH + "sys_user"; public static final String URL_GET_USERDETAILS = API_PATH + "sys_user";
/*Incident API */
public static final String URL_GET_INCIDENTS = API_PATH + "incident";
} }
...@@ -224,7 +224,7 @@ public class Util { ...@@ -224,7 +224,7 @@ public class Util {
public static String getDefaultDate() { public static String getDefaultDate() {
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy"); SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy", Locale.US);
String formattedDate = df.format(c.getTime()); String formattedDate = df.format(c.getTime());
return formattedDate; return formattedDate;
} }
...@@ -238,7 +238,7 @@ public class Util { ...@@ -238,7 +238,7 @@ public class Util {
} }
public static long getDateFromString(String strDate) { public static long getDateFromString(String strDate) {
SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy"); SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy", Locale.US);
Date date = null; Date date = null;
try { try {
date = df.parse(strDate); date = df.parse(strDate);
...@@ -250,12 +250,12 @@ public class Util { ...@@ -250,12 +250,12 @@ public class Util {
public static String getDateFromLong(long timeStamp) { public static String getDateFromLong(long timeStamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat SimpleDateFormat dateFormat = new SimpleDateFormat
("yyyy-MM-dd", Locale.getDefault()); ("yyyy-MM-dd", Locale.US);
return dateFormat.format(timeStamp); return dateFormat.format(timeStamp);
} }
public static long getDateTimeFromString(String strDate) { public static long getDateTimeFromString(String strDate) {
SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy HH:mm"); SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy HH:mm", Locale.US);
Date date = null; Date date = null;
try { try {
date = df.parse(strDate); date = df.parse(strDate);
...@@ -267,10 +267,24 @@ public class Util { ...@@ -267,10 +267,24 @@ public class Util {
public static String getDateTimeFromLong(long timeStamp) { public static String getDateTimeFromLong(long timeStamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat SimpleDateFormat dateFormat = new SimpleDateFormat
("dd MMM, yyyy HH:mm", Locale.getDefault()); ("dd MMM, yyyy HH:mm", Locale.US);
return dateFormat.format(timeStamp); return dateFormat.format(timeStamp);
} }
public static String getDateTime(String strDate) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
Date date = null;
try {
date = df.parse(strDate);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat dateFormat = new SimpleDateFormat
("dd MMM, yyyy HH:mm", Locale.US);
return dateFormat.format(date.getTime());
}
public static void hideSoftKeyboard(Context context, View view) { public static void hideSoftKeyboard(Context context, View view) {
InputMethodManager imm =(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm =(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
android:layout_margin="@dimen/normal_margin" android:layout_margin="@dimen/normal_margin"
android:background="@android:color/white" android:background="@android:color/white"
android:divider="@android:color/white" android:divider="@android:color/white"
android:dividerHeight="@dimen/list_view_divider_height" android:dividerHeight="@dimen/catalogue_category_and_item_list_view_divider_height"
android:padding="@dimen/normal_margin" android:padding="@dimen/normal_margin"
android:scrollbars="none" android:scrollbars="none"
android:visibility="gone" /> android:visibility="gone" />
......
...@@ -30,6 +30,6 @@ ...@@ -30,6 +30,6 @@
android:layout_margin="@dimen/normal_margin" android:layout_margin="@dimen/normal_margin"
android:padding="@dimen/normal_margin" android:padding="@dimen/normal_margin"
android:divider="@android:color/white" android:divider="@android:color/white"
android:dividerHeight="@dimen/list_view_divider_height" android:dividerHeight="@dimen/catalogue_category_and_item_list_view_divider_height"
android:scrollbars="none"/> android:scrollbars="none"/>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/small_margin">
<TextView
android:id="@+id/my_incident_adapter_number_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/extra_normal_text_size"
android:textStyle="bold" />
<TextView
android:id="@+id/my_incident_adapter_date_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="@dimen/normal_text_size" />
<TextView
android:id="@+id/my_incident_adapter_short_des_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/my_incident_adapter_number_tv"
android:layout_marginTop="@dimen/small_margin"
android:textSize="@dimen/normal_text_size"
android:lines="3"
android:ellipsize="end"/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/screen_bg_color">
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@android:color/white"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"/>
<ListView
android:id="@+id/my_incidents_screen_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:layout_margin="@dimen/normal_margin"
android:padding="@dimen/normal_margin"
android:divider="@color/divider_color"
android:dividerHeight="@dimen/list_view_divider_height"
android:scrollbars="none"/>
</LinearLayout>
\ No newline at end of file
...@@ -17,4 +17,5 @@ ...@@ -17,4 +17,5 @@
<color name="back_button_bg_color">#4f0307</color> <color name="back_button_bg_color">#4f0307</color>
<color name="submit_button_bg_color">#e31b22</color> <color name="submit_button_bg_color">#e31b22</color>
<color name="divider_color">#c9c8cc</color>
</resources> </resources>
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<dimen name="extra_normal_text_size">24sp</dimen> <dimen name="extra_normal_text_size">24sp</dimen>
<dimen name="large_text_size">20sp</dimen> <dimen name="large_text_size">20sp</dimen>
<dimen name="list_view_divider_height">5dp</dimen> <dimen name="catalogue_category_and_item_list_view_divider_height">5dp</dimen>
<dimen name="list_view_divider_height">1dp</dimen>
<!--Home Screen--> <!--Home Screen-->
<dimen name="home_screen_item_height">120dp</dimen> <dimen name="home_screen_item_height">120dp</dimen>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<string name="failed_to_fetch_variable_choice_string">Failed to fetch Choice Items.</string> <string name="failed_to_fetch_variable_choice_string">Failed to fetch Choice Items.</string>
<string name="failed_to_fetch_reference_string">Failed to fetch References.</string> <string name="failed_to_fetch_reference_string">Failed to fetch References.</string>
<string name="failed_to_submit_form_string">Failed to submit form.</string> <string name="failed_to_submit_form_string">Failed to submit form.</string>
<string name="failed_to_fetch_incident_string">Failed to fetch Incident.</string>
<!--Login Screen--> <!--Login Screen-->
<string name="login_screen_user_name_string">Username</string> <string name="login_screen_user_name_string">Username</string>
...@@ -48,4 +49,6 @@ ...@@ -48,4 +49,6 @@
<string name="incident_form_impact_text_string">Impact</string> <string name="incident_form_impact_text_string">Impact</string>
<string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below</string> <string name="incident_form_describe_your_issue_text_string">Please Describe Your Issue below</string>
<!--My Incidents-->
<string name="my_incidents_text_string">My Incidents</string>
</resources> </resources>
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 sign in to comment