use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class Review method updateThis.
public void updateThis() {
AddReviewRequest task = new AddReviewRequest(this);
RequestManager.getInstance().invokeRequest(task);
}
use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class ExpandableBidListAdapter method getChildView.
/**
* @param groupPosition which group was clicked
* @param childPosition which child was clicked
* @param isLastChild if it the last element in the list
* @param view the listview parent in context
* @param parent the parent group this group belongs to
* @return the textview to be displayed
* @author myapplestory
*
* gets bids on this task as well as the bid amount and big owner name
* and displays it
*/
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View view, ViewGroup parent) {
Bid currentBid = this.bidList.get(childPosition);
GetUserRequest getUserRequest = new GetUserRequest(currentBid.getUserId());
RequestManager.getInstance().invokeRequest(getUserRequest);
User BidOwner = getUserRequest.getResult();
TextView textView = new TextView(context);
String output = "$" + String.format(Locale.CANADA, "%.2f", currentBid.getBidAmount()) + " By user: " + BidOwner.getName();
textView.setText(output);
textView.setTextColor(0xffff88ff);
textView.setTextSize(18);
textView.setPadding(144, 0, 0, 0);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(context, "Secret developer settings enabled", Toast.LENGTH_SHORT).show();
}
});
return textView;
}
use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class NotificationManager method sendNotification.
/**
* This method invokes a request to the requestmanager which inserts the notification to the
* elasticsearch server
*
* @param notification Notification to be inserted
* @see AddNotificationRequest
*/
public void sendNotification(Notification notification) {
AddNotificationRequest task = new AddNotificationRequest(notification);
RequestManager.getInstance().invokeRequest(task);
}
use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class Task method addBid.
/**
* addBid
*
* @author praharen
*/
public void addBid(Bid newbid) {
System.out.println("Adding bid: " + newbid);
AddBidRequest addBidRequest = new AddBidRequest(newbid);
RequestManager.getInstance().invokeRequest(addBidRequest);
String temp = "Your task '" + this.getName() + "' has been bidded on by " + currentUser.getInstance().getUsername() + " for $" + newbid.getBidAmount();
Notification notification = new Notification("New Bid", newbid.getUserId(), this.getRequesterId(), this.Id, this.name, temp, currentUser.getInstance());
NotificationManager.getInstance().sendNotification(notification);
}
use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class Task method removeAllBids.
/**
* removeAllBids
* remove all bids under this task
* @author myapplestory
*/
private void removeAllBids() {
GetBidsByTaskIdRequest getbidrequest = new GetBidsByTaskIdRequest(this.Id);
RequestManager.getInstance().invokeRequest(getbidrequest);
ArrayList<Bid> bidlist = getbidrequest.getResult();
for (Bid bid : bidlist) {
RemoveBidRequest removerequest = new RemoveBidRequest(bid);
RequestManager.getInstance().invokeRequest(removerequest);
String temp = "Your bid has been declined!";
Notification notification = new Notification("Bid Declined", this.requesterId, this.providerId, this.Id, this.getName(), temp, currentUser.getInstance());
NotificationManager.getInstance().sendNotification(notification);
}
}
Aggregations