package github.nisrulz.sample.chromecustomtabs;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

public class MainActivity extends AppCompatActivity {

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

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
        Snackbar.make(view, "Launch Custom Chrome Tab ?", Snackbar.LENGTH_LONG)
            .setAction("Yes", new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                // TODO: 11/8/16 Open Custom Chrome Tabs
              }
            })
            .show();
      }
    });
  }
}

@@ -61,17 +61,125 @@
 oid.
-os.Bundle
+content.Context;%0Aimport android.net.Uri;%0Aimport android.os.Bundle;%0Aimport android.support.customtabs.CustomTabsIntent
 ;%0Aim
@@ -278,24 +278,73 @@
 t.Snackbar;%0A
+import android.support.v4.content.ContextCompat;%0A
 import andro
@@ -1169,114 +1169,1644 @@
     
-// TODO: 11/8/16 Open Custom Chrome Tabs%0A              %7D%0A            %7D)%0A            .show
+loadChromeCustomTab(MainActivity.this, %22http://crushingcode.co/%22);%0A              %7D%0A            %7D)%0A            .show();%0A      %7D%0A    %7D);%0A  %7D%0A%0A  private void loadChromeCustomTab(Context context, String url) %7B%0A    Uri uri = Uri.parse(url);%0A%0A    // Use a CustomTabsIntent.Builder to configure CustomTabsIntent.%0A    CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();%0A%0A    // set toolbar color%0A    intentBuilder.setToolbarColor(ContextCompat.getColor(context, R.color.colorPrimary));%0A    intentBuilder.setSecondaryToolbarColor(%0A        ContextCompat.getColor(context, R.color.colorPrimaryDark));%0A%0A    // set start and exit animations%0A    intentBuilder.setStartAnimations(context, android.R.anim.fade_out, android.R.anim.fade_in);%0A    intentBuilder.setExitAnimations(context, android.R.anim.fade_in, android.R.anim.fade_out);%0A%0A    // Once ready, call CustomTabsIntent.Builder.build() to create a CustomTabsIntent%0A    // NOTE : If you do not have Chrome installed, the intent will launch the default%0A    // browser installed on the device. The CustomTabsIntent simply launches an%0A    // implicit intent (android.intent.action.VIEW) and passes an extra data in the%0A    // intent (i.e. android.support.customtabs.extra.SESSION and%0A    // android.support.customtabs.extra.TOOLBAR_COLOR) that gets ignored if the%0A    // default browser cannot process this information.%0A    CustomTabsIntent customTabsIntent = intentBuilder.build();%0A%0A    // add share action to menu list%0A    intentBuilder.addDefaultShareMenuItem
 ();%0A
+%0A
     
-  %7D%0A    %7D
+// and launch the desired Url with CustomTabsIntent.launchUrl()%0A    customTabsIntent.launchUrl(context, uri
 );%0A 

implement loading Chrome Custom Tabs