Commit 3d54444d by Kunj Gupta

UOFLMA-106 - Shown a dialog with item description.

parent 0fbca9d9
...@@ -74,7 +74,7 @@ public class MyRequestAdapter extends BaseAdapter { ...@@ -74,7 +74,7 @@ public class MyRequestAdapter extends BaseAdapter {
MyRequest req = mReqList.get(position); MyRequest req = mReqList.get(position);
holder.number.setText(req.getNumber()); holder.number.setText(req.getNumber());
holder.shortDescription.setText(req.getCatItem().getDisplayValue()); holder.shortDescription.setText(req.getShortDescription().getDisplayValue());
if(!req.getApproval().isEmpty()) { if(!req.getApproval().isEmpty()) {
if (req.getApproval().equalsIgnoreCase("requested")) { if (req.getApproval().equalsIgnoreCase("requested")) {
......
...@@ -15,17 +15,24 @@ public class MyRequest { ...@@ -15,17 +15,24 @@ public class MyRequest {
@SerializedName("number") @SerializedName("number")
@Expose @Expose
private String number; private String number;
@SerializedName("sys_updated_on") @SerializedName("sys_updated_on")
// @Expose // @Expose
private long updateOn; private long updateOn;
@SerializedName("approval") @SerializedName("approval")
@Expose @Expose
String approval; String approval;
@SerializedName("cat_item") @SerializedName("cat_item")
@Expose @Expose
MyRequestCatItem catItem; MyRequestShortDes shortDescription;
@SerializedName("request")
@Expose
MyRequestRequest request;
@SerializedName("opened_by")
@Expose
MyRequestRequest openedBy;
@SerializedName("stage")
@Expose
String stage;
public String getNumber() { public String getNumber() {
return number; return number;
...@@ -43,12 +50,12 @@ public class MyRequest { ...@@ -43,12 +50,12 @@ public class MyRequest {
this.updateOn = updateOn; this.updateOn = updateOn;
} }
public MyRequestCatItem getCatItem() { public MyRequestShortDes getShortDescription() {
return catItem; return shortDescription;
} }
public void setCatItem(MyRequestCatItem catItem) { public void setShortDescription(MyRequestShortDes shortDescription) {
this.catItem = catItem; this.shortDescription = shortDescription;
} }
public String getApproval() { public String getApproval() {
...@@ -59,6 +66,30 @@ public class MyRequest { ...@@ -59,6 +66,30 @@ public class MyRequest {
this.approval = approval; this.approval = approval;
} }
public MyRequestRequest getRequest() {
return request;
}
public void setRequest(MyRequestRequest request) {
this.request = request;
}
public MyRequestRequest getOpenedBy() {
return openedBy;
}
public void setOpenedBy(MyRequestRequest openedBy) {
this.openedBy = openedBy;
}
public String getStage() {
return stage;
}
public void setStage(String stage) {
this.stage = stage;
}
public void parseJson(JSONObject jsonObject) { public void parseJson(JSONObject jsonObject) {
String dueDate = null; String dueDate = null;
try { try {
......
...@@ -6,7 +6,7 @@ import com.google.gson.annotations.SerializedName; ...@@ -6,7 +6,7 @@ import com.google.gson.annotations.SerializedName;
/** /**
* Created by kvemulavada on 8/30/2016. * Created by kvemulavada on 8/30/2016.
*/ */
public class MyRequestCatItem { public class MyRequestOpenedBy {
@SerializedName("display_value") @SerializedName("display_value")
@Expose @Expose
......
package com.vsoft.uoflservicenow.db.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by kvemulavada on 8/30/2016.
*/
public class MyRequestRequest {
@SerializedName("display_value")
@Expose
private String displayValue;
@SerializedName("link")
@Expose
private String link;
public String getDisplayValue() {
return displayValue;
}
public void setDisplayValue(String displayValue) {
this.displayValue = displayValue;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}
package com.vsoft.uoflservicenow.db.models;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by kvemulavada on 8/30/2016.
*/
public class MyRequestShortDes {
@SerializedName("display_value")
@Expose
private String displayValue;
@SerializedName("link")
@Expose
private String link;
public String getDisplayValue() {
return displayValue;
}
public void setDisplayValue(String displayValue) {
this.displayValue = displayValue;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}
...@@ -8,6 +8,7 @@ import android.support.v7.app.ActionBar; ...@@ -8,6 +8,7 @@ import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.ListView; import android.widget.ListView;
...@@ -28,6 +29,7 @@ import java.util.List; ...@@ -28,6 +29,7 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnItemClick;
/** /**
* Created by kvemulavada on 8/30/2016. * Created by kvemulavada on 8/30/2016.
...@@ -67,6 +69,7 @@ public class MyRequestActivity extends AppCompatActivity { ...@@ -67,6 +69,7 @@ public class MyRequestActivity extends AppCompatActivity {
DialogUtils.showNoConnectionDialogWithCloseActivity(MyRequestActivity.this); DialogUtils.showNoConnectionDialogWithCloseActivity(MyRequestActivity.this);
} }
} }
class FetchMyRequestData extends AsyncTask<String, Void, SyncStatus> { class FetchMyRequestData extends AsyncTask<String, Void, SyncStatus> {
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
...@@ -104,6 +107,30 @@ public class MyRequestActivity extends AppCompatActivity { ...@@ -104,6 +107,30 @@ public class MyRequestActivity extends AppCompatActivity {
} }
} }
@OnItemClick(R.id.request_screen_list_view)
void listViewOnClicked(int position) {
MyRequest myRequest = mMyRequestList.get(position);
String messageString = String.format(getResources().getString(R.string.my_incidents_item_text_string),
myRequest.getNumber(),
myRequest.getShortDescription().getDisplayValue(),
Util.getDateTimeFromLong(myRequest.getUpdateOn()),
myRequest.getRequest().getDisplayValue(),
myRequest.getOpenedBy().getDisplayValue(),
myRequest.getStage());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(Html.fromHtml(messageString))
.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();
}
private void setData(final List<MyRequest> reqList) { private void setData(final List<MyRequest> reqList) {
MyRequestAdapter adapter = new MyRequestAdapter(MyRequestActivity.this); MyRequestAdapter adapter = new MyRequestAdapter(MyRequestActivity.this);
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<!--My Incidents--> <!--My Incidents-->
<string name="my_incidents_text_string">My Incidents</string> <string name="my_incidents_text_string">My Incidents</string>
<string name="my_incidents_item_text_string"><![CDATA[<b>Number: </b>%1$s<br><br><b>Short Description: </b>%2$s<br><br><b>Opened: </b>%3$s<br><br><b>Request: </b>%4$s<br><br><b>Opened by: </b>%5$s<br><br><b>Stage: </b>%6$s]]></string>
<string name="connection_alert_dialog_title">No Connection Available</string> <string name="connection_alert_dialog_title">No Connection Available</string>
<string name="connection_alert_dialog_message">Please check your device settings to ensure you have a working internet connection.</string> <string name="connection_alert_dialog_message">Please check your device settings to ensure you have a working internet connection.</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