Commit 4d6ac4dc by Kunj Gupta

Code review.

parent ef377686
Showing with 104 additions and 599 deletions
......@@ -5,7 +5,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.vsoft.uofl_catalogue.R;
......@@ -18,14 +17,11 @@ import java.util.List;
* Created by kunj on 11/8/16.
*/
public class CatalogueCategoryAdapter extends BaseAdapter {
private Context mContext;
private final List<Catalogue> mCatalogueList = new ArrayList<>(0);
private LayoutInflater mInflater;
public CatalogueCategoryAdapter(Context context) {
mContext = context;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void setCatalogueList(List<Catalogue> catalogueList) {
......@@ -86,6 +82,5 @@ public class CatalogueCategoryAdapter extends BaseAdapter {
static class ViewHolder {
private TextView titleTextView;
private TextView desTextView;
private ImageView imageView;
}
}
\ No newline at end of file
......@@ -5,7 +5,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.vsoft.uofl_catalogue.R;
......@@ -18,14 +17,11 @@ import java.util.List;
* Created by kunj on 11/8/16.
*/
public class CatalogueCategoryItemAdapter extends BaseAdapter {
private Context mContext;
private final List<CatalogueItem> mCatalogueItemList = new ArrayList<>(0);
private LayoutInflater mInflater;
public CatalogueCategoryItemAdapter(Context context) {
mContext = context;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void setCatalogueItemList(List<CatalogueItem> catalogueItemList) {
......@@ -85,6 +81,5 @@ public class CatalogueCategoryItemAdapter extends BaseAdapter {
static class ViewHolder {
private TextView nameTextView;
private TextView desTextView;
private ImageView imageView;
}
}
\ No newline at end of file
......@@ -17,14 +17,11 @@ 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);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void setIncidentList(List<Incident> incidentList) {
......
......@@ -3,7 +3,6 @@ package com.vsoft.uofl_catalogue.adapters;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -12,7 +11,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.vsoft.uofl_catalogue.R;
import com.vsoft.uofl_catalogue.db.models.Catalogue;
import com.vsoft.uofl_catalogue.db.models.MyRequest;
import java.util.ArrayList;
......@@ -22,14 +20,11 @@ import java.util.List;
* Created by kvemulavada on 8/30/2016.
*/
public class MyRequestAdapter extends BaseAdapter {
private Context mContext;
private final List<MyRequest> mReqList = new ArrayList<>(0);
private LayoutInflater mInflater;
public MyRequestAdapter(Context context) {
mContext = context;
mInflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void setRequestList(List<MyRequest> myreqList) {
......@@ -78,7 +73,7 @@ public class MyRequestAdapter extends BaseAdapter {
MyRequest req = mReqList.get(position);
holder.number.setText(req.getNumber());
String dueDate="Due : "+req.getDueDate();
String dueDate="Due : "+ req.getDueDate();
holder.dueDate.setText(dueDate);
holder.shotrDescription.setText(req.getShotrDescription());
holder.approval.setText(req.getApproval());
......@@ -88,7 +83,6 @@ public class MyRequestAdapter extends BaseAdapter {
((GradientDrawable)holder.statusIndicator.getBackground()).setColor(Color.parseColor("#FFB400"));
//holder.statusIndicator.setBackgroundColor(Color.parseColor("#FFB400"));
} else if (req.getApproval().equalsIgnoreCase("not requested")) {
((GradientDrawable)holder.statusIndicator.getBackground()).setColor(Color.parseColor("#5CE1ED"));
// holder.statusIndicator.setBackgroundColor(Color.parseColor("#5CE1ED"));
} else if (req.getApproval().equalsIgnoreCase("approved")) {
......
......@@ -8,8 +8,6 @@ import com.google.gson.annotations.SerializedName;
*/
public class Catalogue {
private long id = -1;
@SerializedName("title")
@Expose
private String title;
......@@ -20,16 +18,6 @@ public class Catalogue {
@Expose
private String sysId;
private int syncDirty;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
/**
*
* @return
......@@ -84,68 +72,6 @@ public class Catalogue {
this.sysId = sysId;
}
public int getSyncDirty() {
return syncDirty;
}
public void setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
}
public static final class CatalogueBuilder {
private long id = -1;
private String title;
private String description;
private String sysId;
private int syncDirty;
private CatalogueBuilder() {
}
public static CatalogueBuilder aCatalogue() {
return new CatalogueBuilder();
}
public CatalogueBuilder setId(long id) {
this.id = id;
return this;
}
public CatalogueBuilder setTitle(String title) {
this.title = title;
return this;
}
public CatalogueBuilder setDescription(String description) {
this.description = description;
return this;
}
public CatalogueBuilder setSysId(String sysId) {
this.sysId = sysId;
return this;
}
public CatalogueBuilder setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
return this;
}
public CatalogueBuilder but() {
return aCatalogue().setId(id).setTitle(title).setDescription(description).setSysId(sysId).setSyncDirty(syncDirty);
}
public Catalogue build() {
Catalogue catalogue = new Catalogue();
catalogue.setId(id);
catalogue.setTitle(title);
catalogue.setDescription(description);
catalogue.setSysId(sysId);
catalogue.setSyncDirty(syncDirty);
return catalogue;
}
}
public static class Json {
public static final String URL_PARAM_CATALOGUE_SYSPRM_QUERY_VALUE = "sc_catalog";
}
......@@ -153,11 +79,9 @@ public class Catalogue {
@Override
public String toString() {
return "Catalogue{" +
"id=" + id +
", title='" + title + '\'' +
", description='" + description + '\'' +
", sysId='" + sysId + '\'' +
", syncDirty=" + syncDirty +
'}';
}
}
......@@ -8,9 +8,6 @@ import com.google.gson.annotations.SerializedName;
*/
public class CatalogueItem {
private long id = -1;
private long catalogue_id = -1;
@SerializedName("short_description")
@Expose
private String shortDescription;
......@@ -23,23 +20,6 @@ public class CatalogueItem {
@SerializedName("sys_id")
@Expose
private String sysId;
private int syncDirty;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getCatalogueId() {
return catalogue_id;
}
public void setCatalogueId(long catalogueId) {
this.catalogue_id = catalogueId;
}
/**
*
......@@ -113,83 +93,6 @@ public class CatalogueItem {
this.sysId = sysId;
}
public int getSyncDirty() {
return syncDirty;
}
public void setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
}
public static final class CatalogueItemBuilder {
private long id = -1;
private long catalogue_id = -1;
private String shortDescription;
private String description;
private String name;
private String sysId;
private int syncDirty;
private CatalogueItemBuilder() {
}
public static CatalogueItemBuilder aCatalogueItem() {
return new CatalogueItemBuilder();
}
public CatalogueItemBuilder setId(long id) {
this.id = id;
return this;
}
public CatalogueItemBuilder setCatalogueId(long catalogueId) {
this.catalogue_id = catalogueId;
return this;
}
public CatalogueItemBuilder setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
return this;
}
public CatalogueItemBuilder setDescription(String description) {
this.description = description;
return this;
}
public CatalogueItemBuilder setName(String name) {
this.name = name;
return this;
}
public CatalogueItemBuilder setSysId(String sysId) {
this.sysId = sysId;
return this;
}
public CatalogueItemBuilder setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
return this;
}
public CatalogueItemBuilder but() {
return aCatalogueItem().setId(id).setCatalogueId(catalogue_id).setShortDescription(shortDescription).setDescription(description).setName(name).setSysId(sysId).setSyncDirty(syncDirty);
}
public CatalogueItem build() {
CatalogueItem catalogueItem = new CatalogueItem();
catalogueItem.setId(id);
catalogueItem.setCatalogueId(catalogue_id);
catalogueItem.setShortDescription(shortDescription);
catalogueItem.setDescription(description);
catalogueItem.setName(name);
catalogueItem.setSysId(sysId);
catalogueItem.setSyncDirty(syncDirty);
return catalogueItem;
}
}
public static class Json {
public static final String URL_PARAM_CATALOGUE_SYSPRM_QUERY_VALUE = "category";
public static final String SYS_ID = "sys_id";
......@@ -198,13 +101,10 @@ public class CatalogueItem {
@Override
public String toString() {
return "CatalogueItem{" +
"id=" + id +
", catalogue_id=" + catalogue_id +
", shortDescription='" + shortDescription + '\'' +
", description='" + description + '\'' +
", name='" + name + '\'' +
", sysId='" + sysId + '\'' +
", syncDirty=" + syncDirty +
'}';
}
}
......@@ -17,7 +17,6 @@ import java.util.List;
* Created by Kunj on 12/8/16.
*/
public class CatalogueVariable {
private long id = -1;
private long catalogue_item_id = -1;
@SerializedName("name")
......@@ -43,17 +42,8 @@ public class CatalogueVariable {
// @Expose
private ViewType type;
private int syncDirty;
private List<VariableChoice> mVariableChoiceList;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getCatalogueItemId() {
return catalogue_item_id;
}
......@@ -158,14 +148,6 @@ public class CatalogueVariable {
this.referenceTable = referenceTable;
}
public int getSyncDirty() {
return syncDirty;
}
public void setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
}
public List<VariableChoice> getVariableChoiceList() {
return mVariableChoiceList;
}
......@@ -217,95 +199,6 @@ public class CatalogueVariable {
this.setType(ViewType.from(viewType));
}
public static final class CatalogueVariableBuilder {
private long id = -1;
private long catalogue_item_id = -1;
private String name;
private String questionText;
private String sysId;
private boolean mandatory;
private boolean isNoneRequired;
private String referenceTable;
private ViewType type;
private int syncDirty;
private CatalogueVariableBuilder() {
}
public static CatalogueVariableBuilder aCatalogueVariable() {
return new CatalogueVariableBuilder();
}
public CatalogueVariableBuilder setId(long id) {
this.id = id;
return this;
}
public CatalogueVariableBuilder setCatalogueItemId(long catalogue_item_id) {
this.catalogue_item_id = catalogue_item_id;
return this;
}
public CatalogueVariableBuilder setName(String name) {
this.name = name;
return this;
}
public CatalogueVariableBuilder setQuestionText(String questionText) {
this.questionText = questionText;
return this;
}
public CatalogueVariableBuilder setSysId(String sysId) {
this.sysId = sysId;
return this;
}
public CatalogueVariableBuilder setMandatory(boolean mandatory) {
this.mandatory = mandatory;
return this;
}
public CatalogueVariableBuilder setNoneRequired(boolean isNoneRequired) {
this.isNoneRequired = isNoneRequired;
return this;
}
public CatalogueVariableBuilder setReferenceTable(String referenceTable) {
this.referenceTable = referenceTable;
return this;
}
public CatalogueVariableBuilder setType(ViewType type) {
this.type = type;
return this;
}
public CatalogueVariableBuilder setSyncDirty(int syncDirty) {
this.syncDirty = syncDirty;
return this;
}
public CatalogueVariableBuilder but() {
return aCatalogueVariable().setId(id).setCatalogueItemId(catalogue_item_id).setName(name).setQuestionText(questionText).setSysId(sysId).setMandatory(mandatory).setNoneRequired(isNoneRequired).setReferenceTable(referenceTable).setType(type).setSyncDirty(syncDirty);
}
public CatalogueVariable build() {
CatalogueVariable catalogueVariable = new CatalogueVariable();
catalogueVariable.setId(id);
catalogueVariable.setCatalogueItemId(catalogue_item_id);
catalogueVariable.setName(name);
catalogueVariable.setQuestionText(questionText);
catalogueVariable.setSysId(sysId);
catalogueVariable.setMandatory(mandatory);
catalogueVariable.setNoneRequired(isNoneRequired);
catalogueVariable.setReferenceTable(referenceTable);
catalogueVariable.setType(type);
catalogueVariable.setSyncDirty(syncDirty);
return catalogueVariable;
}
}
public static class Json {
public static final String SYS_ID = "sys_id";
public static final String TYPE = "type";
......@@ -314,7 +207,6 @@ public class CatalogueVariable {
@Override
public String toString() {
return "CatalogueVariable{" +
"id=" + id +
", catalogue_item_id=" + catalogue_item_id +
", name='" + name + '\'' +
", questionText='" + questionText + '\'' +
......@@ -323,7 +215,6 @@ public class CatalogueVariable {
", isNoneRequired=" + isNoneRequired +
", referenceTable='" + referenceTable + '\'' +
", type=" + type +
", syncDirty=" + syncDirty +
", mVariableChoiceList=" + mVariableChoiceList +
'}';
}
......
......@@ -72,53 +72,6 @@ public class Incident {
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";
......
......@@ -24,8 +24,6 @@ public class MyRequest {
@Expose
String approval;
public String getNumber() {
return number;
}
......
......@@ -6,7 +6,6 @@ import com.google.gson.annotations.SerializedName;
public class VariableChoice {
private long id;
private long variable_id;
@SerializedName("text")
......@@ -22,14 +21,6 @@ public class VariableChoice {
@Expose
private float misc;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getVariableId() {
return variable_id;
}
......@@ -104,72 +95,9 @@ public class VariableChoice {
public static final String URL_PARAM_VARIABLE_CHOICE_SYSPRM_QUERY_VALUE = "question";
}
public static final class VariableChoiceBuilder {
private long id;
private long variable_id;
private String text;
private String value;
private int order;
private float misc;
private VariableChoiceBuilder() {
}
public static VariableChoiceBuilder aVariableChoice() {
return new VariableChoiceBuilder();
}
public VariableChoiceBuilder setId(long id) {
this.id = id;
return this;
}
public VariableChoiceBuilder setVariableId(long variable_id) {
this.variable_id = variable_id;
return this;
}
public VariableChoiceBuilder setText(String text) {
this.text = text;
return this;
}
public VariableChoiceBuilder setValue(String value) {
this.value = value;
return this;
}
public VariableChoiceBuilder setOrder(int order) {
this.order = order;
return this;
}
public VariableChoiceBuilder setMisc(float misc) {
this.misc = misc;
return this;
}
public VariableChoiceBuilder but() {
return aVariableChoice().setId(id).setVariableId(variable_id).setText(text).setValue(value).setOrder(order).setMisc(misc);
}
public VariableChoice build() {
VariableChoice variableChoice = new VariableChoice();
variableChoice.setId(id);
variableChoice.setVariableId(variable_id);
variableChoice.setText(text);
variableChoice.setValue(value);
variableChoice.setOrder(order);
variableChoice.setMisc(misc);
return variableChoice;
}
}
@Override
public String toString() {
return "VariableChoice{" +
"id=" + id +
", variable_id=" + variable_id +
", text='" + text + '\'' +
", value='" + value + '\'' +
......
......@@ -50,7 +50,6 @@ public class SelectReferenceDialog extends DialogFragment {
@BindView(R.id.dialog_title) TextView mTitleTextView;
@BindView(R.id.dialog_edit_text) EditText mEditText;
private ArrayAdapter<String> mAdapter;
private ReferenceListener mListener;
private Unbinder mUnbinder;
private List<Reference> mReferenceList;
......@@ -178,11 +177,11 @@ public class SelectReferenceDialog extends DialogFragment {
progressDialog.dismiss();
}
if(syncStatus == SyncStatus.SUCCESS) {
mAdapter = new ArrayAdapter(getActivity(),
ArrayAdapter<String> adapter = new ArrayAdapter(getActivity(),
android.R.layout.simple_list_item_1,
android.R.id.text1,
getReferenceForDisplay());
mListView.setAdapter(mAdapter);
mListView.setAdapter(adapter);
} else {
showErrorDialog(R.string.failed_to_fetch_reference_string);
}
......
......@@ -39,9 +39,8 @@ public class CatalogueItemScreen extends AppCompatActivity {
@BindView(R.id.catalogue_item_screen_list_view) ListView mListView;
@BindView(R.id.catalogue_item_screen_empty_text_view) TextView mEmptyTextView;
private String mCatalogueSysId, mCatalogueTitle;
private String mCatalogueSysId;
private List<CatalogueItem> mCatalogueItemList;
private CatalogueApplication mApplication;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -51,9 +50,9 @@ public class CatalogueItemScreen extends AppCompatActivity {
setContentView(R.layout.catalogue_item_screen);
ButterKnife.bind(this);
mApplication = (CatalogueApplication) getApplication();
CatalogueApplication application = (CatalogueApplication) getApplication();
mCatalogueSysId = getIntent().getExtras().getString(Constants.DATA_KEY_SYS_ID);
mCatalogueTitle = getIntent().getExtras().getString(Constants.DATA_KEY_CATALOGUE_TITLE);
String catalogueTitle = getIntent().getExtras().getString(Constants.DATA_KEY_CATALOGUE_TITLE);
if (mCatalogueSysId == null) {
CatalogueLog.e("CatalogueItemScreen: mCatalogueSysId is null");
......@@ -64,12 +63,12 @@ public class CatalogueItemScreen extends AppCompatActivity {
if(actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setElevation(0);
actionBar.setTitle(mCatalogueTitle);
actionBar.setTitle(catalogueTitle);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);
}
if(mApplication.isNetConnected()) {
if(application.isNetConnected()) {
new FetchCatalogueItem().execute();
} else {
showErrorDialog(R.string.internet_validation_string);
......@@ -90,15 +89,13 @@ public class CatalogueItemScreen extends AppCompatActivity {
@Override
protected SyncStatus doInBackground(String... params) {
SyncStatus syncStatus = CatalogueItemApiManager.getCatalogueItems(mCatalogueSysId, new GetCatalogueItemApiListener() {
return CatalogueItemApiManager.getCatalogueItems(mCatalogueSysId, new GetCatalogueItemApiListener() {
@Override
public void onDoneApiCall(List<CatalogueItem> catalogueItemList) {
CatalogueLog.e("Data: catalogueItemList: "+catalogueItemList);
mCatalogueItemList = catalogueItemList;
}
});
return syncStatus;
}
@Override
......
......@@ -38,7 +38,6 @@ public class CatalogueScreen extends AppCompatActivity {
@BindView(R.id.catalogue_screen_list_view) ListView mListView;
private List<Catalogue> mCatalogueList;
private CatalogueApplication mApplication;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -48,7 +47,7 @@ public class CatalogueScreen extends AppCompatActivity {
setContentView(R.layout.catalogue_screen);
ButterKnife.bind(this);
mApplication = (CatalogueApplication) getApplication();
CatalogueApplication application = (CatalogueApplication) getApplication();
setSupportActionBar(mToolbar);
ActionBar actionBar = getSupportActionBar();
......@@ -60,7 +59,7 @@ public class CatalogueScreen extends AppCompatActivity {
actionBar.setDisplayShowTitleEnabled(true);
}
if(mApplication.isNetConnected()) {
if(application.isNetConnected()) {
new FetchCatalogue().execute();
} else {
showErrorDialog(R.string.internet_validation_string);
......@@ -81,15 +80,13 @@ public class CatalogueScreen extends AppCompatActivity {
@Override
protected SyncStatus doInBackground(String... params) {
SyncStatus syncStatus = CatalogueApiManager.getCatalogues(new GetCatalogueApiListener() {
return CatalogueApiManager.getCatalogues(new GetCatalogueApiListener() {
@Override
public void onDoneApiCall(List<Catalogue> catalogueList) {
CatalogueLog.e("Data: catalogueList: "+catalogueList);
mCatalogueList = catalogueList;
}
});
return syncStatus;
}
@Override
......
......@@ -462,8 +462,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override
protected SyncStatus doInBackground(String... params) {
SyncStatus syncStatus = CatalogueVariableApiManager.submitVariableForm(mCatalogueItemSysId, mJsonArray);
return syncStatus;
return CatalogueVariableApiManager.submitVariableForm(mCatalogueItemSysId, mJsonArray);
}
@Override
......
package com.vsoft.uofl_catalogue.ui;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.GridView;
import com.vsoft.uofl_catalogue.R;
import com.vsoft.uofl_catalogue.adapters.HomeScreenAdapter;
import com.vsoft.uofl_catalogue.utils.PrefManager;
import butterknife.BindView;
import butterknife.ButterKnife;
......@@ -19,18 +16,13 @@ import butterknife.OnItemClick;
* Created by Kunj on 11/8/16.
*/
public class HomeScreen extends Activity {
private String firstName,lastName,sysId;
@BindView(R.id.home_screen_grid_view) GridView mGridView;
@Override
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.home_screen);
SharedPreferences sharedPreferences = getSharedPreferences(PrefManager.PREFERENCES_USER_VALUES_KEY, Context.MODE_PRIVATE);
firstName = sharedPreferences.getString(PrefManager.PREFERENCES_FIRST_NAME, "");
lastName = sharedPreferences.getString(PrefManager.PREFERENCE_LAST_NAME, "");
sysId = sharedPreferences.getString(PrefManager.PREFERENCE_SYS_ID, "");
ButterKnife.bind(this);
mGridView.setAdapter(new HomeScreenAdapter(this, getResources().getStringArray(R.array.home_screen_array),getResources().obtainTypedArray(R.array.home_screen_icon_array)));
......
......@@ -9,12 +9,9 @@ import android.widget.EditText;
import android.widget.Toast;
import com.vsoft.uofl_catalogue.R;
import com.vsoft.uofl_catalogue.api.listeners.get.GetMyRequestApiListener;
import com.vsoft.uofl_catalogue.api.listeners.get.GetUserApiListener;
import com.vsoft.uofl_catalogue.api.managers.LoginApiManger;
import com.vsoft.uofl_catalogue.api.managers.MyRequestApiManager;
import com.vsoft.uofl_catalogue.api.managers.UserApiManager;
import com.vsoft.uofl_catalogue.db.models.MyRequest;
import com.vsoft.uofl_catalogue.db.models.UserApiValues;
import com.vsoft.uofl_catalogue.enums.SyncStatus;
import com.vsoft.uofl_catalogue.utils.PrefManager;
......@@ -36,15 +33,12 @@ public class LoginScreen extends Activity {
@BindView(R.id.login_screen_password_edit_text)
EditText password;
private List<UserApiValues> mUserDetails;
private PrefManager prefManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.login_screen);
prefManager = PrefManager.getInstance();
prefManager.init(LoginScreen.this);
ButterKnife.bind(this);
}
......@@ -74,9 +68,7 @@ public class LoginScreen extends Activity {
String clientSecret = "oklj6znxv3o9jmyn2mlp";
userName = params[0];//"a0kuma18";
String password = params[1];//"v$0ftA$win";
SyncStatus syncStatus = LoginApiManger.submitLoginValues(grantType, clientId, clientSecret, userName, password);
return syncStatus;
return LoginApiManger.submitLoginValues(grantType, clientId, clientSecret, userName, password);
}
@Override
......@@ -108,14 +100,12 @@ public class LoginScreen extends Activity {
@Override
protected SyncStatus doInBackground(String... params) {
String userName=params[0];
SyncStatus syncStatus = UserApiManager.getUserDetailResponse(userName,new GetUserApiListener() {
return UserApiManager.getUserDetailResponse(userName,new GetUserApiListener() {
@Override
public void onDoneApiCall(List<UserApiValues> userValues) {
mUserDetails = userValues;
}
});
return syncStatus;
}
@Override
......
......@@ -34,7 +34,6 @@ 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
......@@ -45,7 +44,7 @@ public class MyIncidentScreen extends AppCompatActivity {
setContentView(R.layout.my_incidents_screen);
ButterKnife.bind(this);
mApplication = (CatalogueApplication) getApplication();
CatalogueApplication application = (CatalogueApplication) getApplication();
setSupportActionBar(mToolbar);
ActionBar actionBar = getSupportActionBar();
......@@ -57,7 +56,7 @@ public class MyIncidentScreen extends AppCompatActivity {
actionBar.setDisplayShowTitleEnabled(true);
}
if(mApplication.isNetConnected()) {
if(application.isNetConnected()) {
new FetchIncident().execute();
} else {
showErrorDialog(R.string.internet_validation_string);
......@@ -103,15 +102,13 @@ public class MyIncidentScreen extends AppCompatActivity {
@Override
protected SyncStatus doInBackground(String... params) {
SyncStatus syncStatus = IncidentApiManager.getIncident(new GetIncidentApiListener() {
return IncidentApiManager.getIncident(new GetIncidentApiListener() {
@Override
public void onDoneApiCall(List<Incident> incidentList) {
CatalogueLog.e("Data: incidentList: "+incidentList);
mIncidentList = incidentList;
}
});
return syncStatus;
}
@Override
......
......@@ -31,8 +31,7 @@ public class MyRequestActivity extends AppCompatActivity {
@BindView(R.id.request_screen_list_view)
ListView mListView;
private List<MyRequest> mMyrequestList;
private CatalogueApplication mApplication;
private List<MyRequest> mMyRequestList;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -42,7 +41,7 @@ public class MyRequestActivity extends AppCompatActivity {
setContentView(R.layout.request_list_screen);
ButterKnife.bind(this);
mApplication = (CatalogueApplication) getApplication();
CatalogueApplication application = (CatalogueApplication) getApplication();
setSupportActionBar(mToolbar);
ActionBar actionBar = getSupportActionBar();
......@@ -55,7 +54,7 @@ public class MyRequestActivity extends AppCompatActivity {
actionBar.setDisplayShowTitleEnabled(true);
}
if(mApplication.isNetConnected()) {
if(application.isNetConnected()) {
new FetchMyRequestData().execute();
} else {
showErrorDialog(R.string.internet_validation_string);
......@@ -76,14 +75,12 @@ public class MyRequestActivity extends AppCompatActivity {
@Override
protected SyncStatus doInBackground(String... params) {
SyncStatus syncStatus = MyRequestApiManager.getMyrequests(new GetMyRequestApiListener() {
return MyRequestApiManager.getMyrequests(new GetMyRequestApiListener() {
@Override
public void onDoneApiCall(List<MyRequest> requestList) {
mMyrequestList = requestList;
mMyRequestList = requestList;
}
});
return syncStatus;
}
@Override
......@@ -93,8 +90,8 @@ public class MyRequestActivity extends AppCompatActivity {
progressDialog.dismiss();
}
if(syncStatus == SyncStatus.SUCCESS) {
if(mMyrequestList!=null)
setData(mMyrequestList);
if(mMyRequestList !=null)
setData(mMyRequestList);
} else {
showErrorDialog(R.string.failed_to_fetch_catalogue_category_string);
}
......
......@@ -121,8 +121,7 @@ public class ReportIncidentScreen extends AppCompatActivity {
} catch (JSONException e) {
e.printStackTrace();
}
SyncStatus syncStatus = IncidentApiManager.submitIncidentForm(incidentJsonObject.toString());
return syncStatus;
return IncidentApiManager.submitIncidentForm(incidentJsonObject.toString());
}
@Override
......
......@@ -53,7 +53,7 @@ public class PrefManager {
editor.putString(PREFERENCES_FIRST_NAME, firstname);
editor.putString(PREFERENCE_LAST_NAME, lastname);
editor.putString(PREFERENCE_SYS_ID, sysid);
editor.commit();
editor.apply();
}
......
......@@ -225,16 +225,14 @@ public class Util {
public static String getDefaultDate() {
Calendar c = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy", Locale.US);
String formattedDate = df.format(c.getTime());
return formattedDate;
return df.format(c.getTime());
}
public static String getDefaultTime() {
Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int min = c.get(Calendar.MINUTE);
String time = (hour < 10 ? ("0" + hour) : hour) + ":" + (min < 10 ? ("0" + min) : min);
return time;
return (hour < 10 ? ("0" + hour) : hour) + ":" + (min < 10 ? ("0" + min) : min);
}
public static long getDateFromString(String strDate) {
......
......@@ -11,9 +11,6 @@
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@android:color/white"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
app:contentInsetEnd="0dp"
......
......@@ -14,9 +14,6 @@
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"
......
......@@ -12,9 +12,6 @@
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@android:color/white"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
app:contentInsetEnd="0dp"
......
......@@ -31,6 +31,6 @@
android:layout_below="@+id/home_screen_adapter_image_view"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/large_text_size" />
android:textSize="@dimen/extra_normal_text_size" />
</RelativeLayout>
</android.support.v7.widget.CardView>
......@@ -12,9 +12,6 @@
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="@android:color/white"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
android:contentInsetStart="0dp"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
app:contentInsetEnd="0dp"
......@@ -35,7 +32,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_login_background"
>
android:background="@drawable/ic_login_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/login_screen_layout_margin_top"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/login_screen_layout_margin_bottom"
android:layout_marginLeft="@dimen/login_screen_layout_margin_left"
android:layout_marginRight="@dimen/login_screen_layout_margin_right"
android:layout_marginBottom="@dimen/login_screen_layout_margin_bottom"
android:layout_marginTop="@dimen/login_screen_layout_margin_top"
android:orientation="vertical">
<EditText
android:id="@+id/login_screen_username_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/username_under_bg_box"
android:layout_marginLeft="@dimen/login_screen_margin_left"
android:layout_marginRight="@dimen/login_screen_margin_right"
android:background="@drawable/username_under_bg_box"
android:drawableLeft="@mipmap/ic_user_icon"
android:text="a0kuma18"
android:hint="@string/login_screen_user_name_string"
android:lines="1"
android:singleLine="true"
android:text="a0kuma18"
android:textCursorDrawable="@null" />
<EditText
android:id="@+id/login_screen_password_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/login_screen_password_string"
android:inputType="textPassword"
android:lines="1"
android:text="v$0ftA$win"
android:background="@drawable/username_under_bg_box"
android:layout_marginLeft="@dimen/login_screen_margin_left"
android:layout_marginRight="@dimen/login_screen_margin_right"
android:background="@drawable/username_under_bg_box"
android:drawableLeft="@mipmap/ic_password_icon"
android:hint="@string/login_screen_password_string"
android:inputType="textPassword"
android:lines="1"
android:singleLine="true"
android:textCursorDrawable="@null"/>
android:text="v$0ftA$win"
android:textCursorDrawable="@null" />
<TextView
android:id="@+id/login_screen_login_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/login_screen_margin_left"
android:layout_marginRight="@dimen/login_screen_margin_right"
android:layout_marginTop="@dimen/login_screen_login_bottom"
android:background="@drawable/login_bg"
android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin"
android:text="@string/login_screen_login_string"
android:textAlignment="center"
android:layout_marginLeft="@dimen/login_screen_margin_left"
android:layout_marginRight="@dimen/login_screen_margin_right"
android:textColor="@android:color/white"
android:textSize="@dimen/extra_normal_text_size" />
</LinearLayout>
</LinearLayout>
......@@ -5,13 +5,6 @@
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"
......@@ -19,6 +12,17 @@
android:textSize="@dimen/normal_text_size" />
<TextView
android:id="@+id/my_incident_adapter_number_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1"
android:singleLine="true"
android:ellipsize="end"
android:layout_toLeftOf="@id/my_incident_adapter_date_tv"
android:textSize="@dimen/normal_text_size"
android:textStyle="bold" />
<TextView
android:id="@+id/my_incident_adapter_short_des_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -14,9 +14,6 @@
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"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
android:background="#ffffff"
android:orientation="vertical"
android:padding="@dimen/normal_margin">
<TextView
android:id="@+id/dueDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:id="@+id/number"
android:textSize="20dp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"/>
android:layout_alignParentRight="true"
android:textSize="@dimen/normal_text_size" />
<TextView
android:layout_width="wrap_content"
android:id="@+id/number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Large Text"
android:id="@+id/dueDate"
android:textColor="#8e8e8e"
android:textSize="15dp"
android:layout_marginTop="15dp"
android:layout_below="@+id/number"
android:layout_marginRight="15dp"
android:layout_alignParentRight="true"
android:layout_alignBaseline="@+id/number"
/>
android:layout_toLeftOf="@id/dueDate"
android:singleLine="true"
android:lines="1"
android:ellipsize="end"
android:textSize="@dimen/normal_text_size"
android:textStyle="bold" />
<TextView
android:id="@+id/shotrDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:id="@+id/shotrDescription"
android:textSize="20dp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginTop="15dp"
android:layout_below="@+id/number"
android:layout_alignLeft="@+id/number"
android:layout_alignStart="@+id/number" />
android:layout_below="@id/number"
android:layout_marginTop="@dimen/normal_margin"
android:layout_marginBottom="@dimen/normal_margin"
android:textColor="@android:color/black"
android:textSize="@dimen/normal_text_size"
android:textStyle="bold" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:id="@+id/approval_image"
android:background="@drawable/circle"
android:layout_alignTop="@+id/approval"
android:layout_alignLeft="@+id/shotrDescription"
android:layout_alignStart="@+id/shotrDescription"
android:layout_marginBottom="15dp"/>
android:layout_width="@dimen/my_request_approval_image_width"
android:layout_height="@dimen/my_request_approval_image_height"
android:layout_below="@id/shotrDescription"
android:background="@drawable/circle"/>
<TextView
android:id="@+id/approval"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:id="@+id/approval"
android:textSize="15dp"
android:textColor="#8e8e8e"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_toRightOf="@+id/approval_image"
android:layout_below="@+id/shotrDescription"/>
android:layout_below="@id/shotrDescription"
android:layout_marginLeft="@dimen/small_margin"
android:layout_toRightOf="@id/approval_image"
android:textSize="@dimen/normal_text_size" />
</RelativeLayout>
\ No newline at end of file
......@@ -14,9 +14,6 @@
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"
......
......@@ -9,7 +9,6 @@
<color name="name_null_view_color">#88FFA500</color>
<color name="view_not_implemented_color">#88ff0000</color>
<color name="login_screen_login_button_bg_color">@color/colorPrimary</color>
<color name="home_screen_bg_color">@color/colorPrimary</color>
<color name="screen_bg_color">#c0cfd1</color>
......
......@@ -2,35 +2,34 @@
<resources>
<!--Margins-->
<dimen name="small_margin">5dp</dimen>
<dimen name="normal_margin">5dp</dimen>
<dimen name="large_margin">10dp</dimen>
<dimen name="normal_margin">10dp</dimen>
<dimen name="large_margin">15dp</dimen>
<!--Text size-->
<dimen name="small_text_size">12sp</dimen>
<dimen name="normal_text_size">16sp</dimen>
<dimen name="extra_normal_text_size">24sp</dimen>
<dimen name="large_text_size">20sp</dimen>
<dimen name="extra_normal_text_size">20sp</dimen>
<dimen name="large_text_size">24sp</dimen>
<dimen name="catalogue_category_and_item_list_view_divider_height">5dp</dimen>
<dimen name="list_view_divider_height">1dp</dimen>
<!--Home Screen-->
<dimen name="home_screen_item_height">120dp</dimen>
<dimen name="home_screen_image_margin">10dp</dimen>
<dimen name="home_screen_image_height">70dp</dimen>
<dimen name="list_item_height">100dp</dimen>
<!--Login Screen-->
<!--Login Screen-->
<dimen name="login_screen_margin_left">20dp</dimen>
<dimen name="login_screen_margin_right">20dp</dimen>
<dimen name="login_screen_margin_top">2dp</dimen>
<dimen name="login_screen_login_bottom">15dp</dimen>
<dimen name="login_screen_layout_margin_left">20dp</dimen>
<dimen name="login_screen_layout_margin_right">20dp</dimen>
<dimen name="login_screen_layout_margin_bottom">35dp</dimen>
<dimen name="login_screen_layout_margin_top">10dp</dimen>
<!--Spinner Item height-->
<dimen name="spinner_item_height">40dp</dimen>
<!--My Request screen-->
<dimen name="my_request_approval_image_height">15dp</dimen>
<dimen name="my_request_approval_image_width">15dp</dimen>
</resources>
\ No newline at end of file
......@@ -24,7 +24,6 @@
<string name="failed_to_fetch_catalogue_category_string">Failed to fetch Catalogue Category.</string>
<string name="failed_to_fetch_catalogue_category_items_string">Failed to fetch Catalogue Category Items.</string>
<string name="failed_to_fetch_catalogue_form_string">Failed to fetch Form.</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_submit_form_string">Failed to submit form.</string>
<string name="failed_to_fetch_incident_string">Failed to fetch Incident.</string>
......
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