/*
 * 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.widget.Button;

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

public class ViewController extends MaterialActivity {

    Button button;

    @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));
    }
}
@@ -707,21 +707,76 @@
 oid.
-widget.Button
+view.View;%0Aimport android.widget.Button;%0Aimport android.widget.Toast
 ;%0A%0Ai
@@ -932,16 +932,37 @@
 n button
+1;%0A    Button button2
 ;%0A%0A    @
@@ -1312,32 +1312,32 @@
 , 0xFFFFFFFF));%0A
-
         toolbar.
@@ -1406,20 +1406,646 @@
 xFFFFFFFF));
+%0A%0A        button1 = new Button(this);%0A        button1.setText(%22Primary%22);%0A        button1.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A%0A            %7D%0A        %7D);%0A        addView(button1);%0A%0A        button2 = new Button(this);%0A        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);%0A    %7D%0A%0A    private void makeToast(String resId) %7B%0A        Toast.makeText(this, %22%22 + resId, Toast.LENGTH_SHORT).show();
 %0A    %7D%0A%7D

Update demo app