/*
 * Copyright 2016 Michael Bel
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.app.application;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import org.app.material.AndroidUtilities;
import org.app.material.MaterialActivity;

public class ViewController extends MaterialActivity {

    Button button1;
    Button button2;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        toolbar.setTitle("View Controller");
        toolbar.setBackButtonIcon(AndroidUtilities.getIcon(this, R.drawable.ic_menu, 0xFFFFFFFF));
        toolbar.addIcon(AndroidUtilities.getIcon(this, R.drawable.ic_dots_menu, 0xFFFFFFFF));
        toolbar.addIcon(AndroidUtilities.getIcon(this, R.drawable.ic_github, 0xFFFFFFFF));

        button1 = new Button(this);
        button1.setText("Primary");
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        addView(button1);

        button2 = new Button(this);
        button2.setText("Accent");
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        addView(button2);
    }

    private void makeToast(String resId) {
        Toast.makeText(this, "" + resId, Toast.LENGTH_SHORT).show();
    }
}
@@ -707,47 +707,95 @@
 oid.
-view.View;%0Aimport android.widget.Button
+support.design.widget.CoordinatorLayout;%0Aimport android.support.v4.app.FragmentActivity
 ;%0Aim
@@ -814,20 +814,27 @@
 .widget.
-Toas
+LinearLayou
 t;%0A%0Aimpo
@@ -895,32 +895,75 @@
 aterial.
-MaterialActivity
+widget.LayoutHelper;%0Aimport org.app.material.widget.Toolbar
 ;%0A%0Apubli
@@ -997,16 +997,16 @@
 nds 
-Material
+Fragment
 Acti
@@ -1021,42 +1021,66 @@
     
-Button button1;%0A    Button button2
+public Toolbar toolbar;%0A    public LinearLayout viewLayout
 ;%0A%0A 
@@ -1216,144 +1216,205 @@
     
-toolbar.setTitle(%22View Controller%22);%0A        toolbar.setBackButtonIcon(AndroidUtilities.getIcon(this, R.drawable.ic_menu, 0xFFFFFFFF
+CoordinatorLayout containerLayout = new CoordinatorLayout(this);%0A        containerLayout.setLayoutParams(LayoutHelper.makeCoordinator(this, LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT
 ));%0A
+%0A
     
@@ -1428,187 +1428,135 @@
 lbar
-.addIcon(AndroidUtilities.getIcon(this, R.drawable.ic_dots_menu, 0xFFFFFFFF));%0A        toolbar.addIcon(AndroidUtilities.getIcon(this, R.drawable.ic_github, 0xFFFFFFFF)
+ = new Toolbar(this);%0A        toolbar.setTitle(R.string.MaterialDemo);%0A        toolbar.setNavIcon(R.drawable.ic_menu
 );%0A
-%0A
         
 butt
@@ -1555,92 +1555,27 @@
     
-button1 = new Button(this);%0A        button1.setText(%22Primary%22);%0A        button1.setO
+//toolbar.setNavIco
 nCli
@@ -1614,32 +1614,34 @@
 ner() %7B%0A        
+//
     @Override%0A  
@@ -1638,32 +1638,34 @@
 verride%0A        
+//
     public void 
@@ -1678,33 +1678,32 @@
 k(View v) %7B%0A
-%0A
         
     %7D%0A      
@@ -1694,97 +1694,130 @@
     
+//
     
-%7D%0A
     
-    %7D);%0A        addView(button1);%0A%0A
+Toast.makeText(ViewController.this, %22Menus%22, Toast.LENGTH_SHORT).show();%0A        //
     
+%7D%0A
     
-button2 = new Button(this
+    //%7D
 );%0A
+%0A
         
 butt
@@ -1816,332 +1816,520 @@
     
-button2.setText(%22Accent%22);%0A        button2.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A%0A            %7D%0A        %7D);%0A        addView(button2
+toolbar.addIcon(R.drawable.ic_dots_menu);%0A        toolbar.addIcon(R.drawable.ic_github);%0A%0A        containerLayout.addView(toolbar);%0A%0A        viewLayout = new LinearLayout(this);%0A        viewLayout.setOrientation(LinearLayout.VERTICAL
 );%0A    
-%7D%0A%0A
     
-private void makeToast(String resId) %7B%0A        Toast.makeText(this, %22%22 + resId, Toast.LENGTH_SHORT).show(
+viewLayout.setPadding(0, AndroidUtilities.dp(this, 56), 0, 0);%0A        viewLayout.setLayoutParams(LayoutHelper.makeLinear(this, LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));%0A        containerLayout.addView(viewLayout);%0A%0A        setContentView(containerLayout
 );%0A 

Update activity