package edu.deanza.calendar.activities;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;

import edu.deanza.calendar.OrganizationSubscribeOnClickListener;
import edu.deanza.calendar.R;
import edu.deanza.calendar.dal.FirebaseSubscriptionDao;
import edu.deanza.calendar.dal.SubscriptionDao;
import edu.deanza.calendar.domain.models.Organization;

public class OrganizationInfo extends AppCompatActivity {

    Organization organization;
    SubscriptionDao subscriptionDao;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_organization_info);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        Intent intent = getIntent();
        organization = (Organization) intent.getSerializableExtra("edu.deanza.calendar.models.Organization");
        subscriptionDao = new FirebaseSubscriptionDao(intent.getStringExtra("UID"));

        setTitle(organization.getName());
        // TODO: set image button icon depending on org.getsub
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new OrganizationSubscribeOnClickListener(this, organization, subscriptionDao));

    }
}

@@ -91,16 +91,58 @@
 Bundle;%0A
+import android.provider.ContactsContract;%0A
 import a
@@ -283,16 +283,51 @@
 oolbar;%0A
+import android.widget.ImageButton;%0A
 import a
@@ -1300,62 +1300,155 @@
     
-// TODO: set image button icon depending on org.getsub
+TextView descriptionView = (TextView) findViewById(R.id.organization_description);%0A        descriptionView.setText(organization.getDescription());%0A
 %0A   
@@ -1473,19 +1473,31 @@
 nButton 
-fab
+subscribeButton
  = (Floa
@@ -1546,19 +1546,267 @@
         
-fab
+if (organization.getSubscription() == null) %7B%0A            subscribeButton.setImageResource(R.drawable.ic_favorite_border);%0A        %7D%0A        else %7B%0A            subscribeButton.setImageResource(R.drawable.ic_favorite);%0A        %7D%0A        subscribeButton
 .setOnCl

Set subscribe button image based on Subscription in OrgInfo