Search in sources :

Example 1 with ViewTaskController

use of com.cmput301w18t05.taskzilla.controller.ViewTaskController in project Taskzilla by CMPUT301W18T05.

the class ViewTaskActivity method onCreate.

/**
 *onCreate
 * Retrieve the task using the task id that was sent using
 * intent into the activity updating the information on the
 * activity_ViewTaskActivity while checking if the task has
 * a provider, what the status is and if the user viewing
 * is the owner of the task
 *
 * @param savedInstanceState
 * @author Micheal-Nguyen, myapplestory
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_task);
    appColors = AppColors.getInstance();
    ActionBar actionBar = getSupportActionBar();
    actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(appColors.getActionBarColor())));
    actionBar.setTitle(Html.fromHtml("<font color='" + appColors.getActionBarTextColor() + "'>Taskzilla</font>"));
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.dragdropMap);
    mapFragment.getMapAsync(this);
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    findViews();
    // starts the activity at the very top
    scrollView.setFocusableInTouchMode(true);
    scrollView.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
    // gets the task id
    this.viewTaskController = new ViewTaskController(this.findViewById(android.R.id.content), this);
    taskID = getIntent().getStringExtra("TaskId");
    setValues();
    setRequesterField();
    setProviderField();
    photos = task.getPhotos();
    NoLocation = findViewById(R.id.NoLocationText);
    NoLocation.setVisibility(View.INVISIBLE);
    if (task.getLocation() == null) {
        NoLocation.setVisibility(View.VISIBLE);
    // mapFragment.s
    }
    linearLayout = findViewById(R.id.Photos);
    recyclerPhotosView = findViewById(R.id.listOfPhotos);
    layoutManager = new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.HORIZONTAL, false);
    recyclerPhotosView.setLayoutManager(layoutManager);
    recyclerPhotosViewAdapter = new RecyclerViewAdapter(getApplicationContext(), photos, new CustomOnItemClick() {

        @Override
        public void onColumnClicked(int position) {
            Intent intent = new Intent(getApplicationContext(), ZoomImageActivity.class);
            intent.putExtra("Photo", photos.get(position).toString());
            startActivity(intent);
        }
    });
    recyclerPhotosView.setAdapter(recyclerPhotosViewAdapter);
    setVisibility();
    setUpBidsList();
}
Also used : SupportMapFragment(com.google.android.gms.maps.SupportMapFragment) ColorDrawable(android.graphics.drawable.ColorDrawable) Intent(android.content.Intent) RecyclerViewAdapter(com.cmput301w18t05.taskzilla.RecyclerViewAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) CustomOnItemClick(com.cmput301w18t05.taskzilla.CustomOnItemClick) ActionBar(android.support.v7.app.ActionBar) ViewTaskController(com.cmput301w18t05.taskzilla.controller.ViewTaskController)

Aggregations

Intent (android.content.Intent)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 ActionBar (android.support.v7.app.ActionBar)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 CustomOnItemClick (com.cmput301w18t05.taskzilla.CustomOnItemClick)1 RecyclerViewAdapter (com.cmput301w18t05.taskzilla.RecyclerViewAdapter)1 ViewTaskController (com.cmput301w18t05.taskzilla.controller.ViewTaskController)1 SupportMapFragment (com.google.android.gms.maps.SupportMapFragment)1