Search in sources :

Example 36 with Task

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);
}
Also used : AddReviewRequest(com.cmput301w18t05.taskzilla.request.command.AddReviewRequest)

Example 37 with 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;
}
Also used : GetUserRequest(com.cmput301w18t05.taskzilla.request.command.GetUserRequest) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 38 with Task

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);
}
Also used : AddNotificationRequest(com.cmput301w18t05.taskzilla.request.command.AddNotificationRequest)

Example 39 with 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);
}
Also used : AddBidRequest(com.cmput301w18t05.taskzilla.request.command.AddBidRequest)

Example 40 with Task

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);
    }
}
Also used : RemoveBidRequest(com.cmput301w18t05.taskzilla.request.command.RemoveBidRequest) GetBidsByTaskIdRequest(com.cmput301w18t05.taskzilla.request.command.GetBidsByTaskIdRequest)

Aggregations

View (android.view.View)18 Task (com.cmput301w18t05.taskzilla.Task)16 MainActivity (com.cmput301w18t05.taskzilla.activity.MainActivity)10 AddTaskRequest (com.cmput301w18t05.taskzilla.request.command.AddTaskRequest)9 AlertDialog (android.support.v7.app.AlertDialog)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)6 GetTaskRequest (com.cmput301w18t05.taskzilla.request.command.GetTaskRequest)6 Intent (android.content.Intent)5 RecyclerView (android.support.v7.widget.RecyclerView)5 EditText (android.widget.EditText)5 ImageButton (android.widget.ImageButton)5 DecimalFormat (java.text.DecimalFormat)5 DialogInterface (android.content.DialogInterface)4 Button (android.widget.Button)4 TextView (android.widget.TextView)4 AppCache (com.cmput301w18t05.taskzilla.AppCache)4 Bid (com.cmput301w18t05.taskzilla.Bid)4 ColorDrawable (android.graphics.drawable.ColorDrawable)3 ActionBar (android.support.v7.app.ActionBar)3