package com.raychenon.licensedroid.sample;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;

import com.raychenon.licensedroid.OpenSourceAdapter;
import com.raychenon.licensedroid.SimpleDividerItemDecoration;

/**
 * @author Raymond Chenon
 */
public class StartActivity extends Activity {

    Button activityBtn;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.start_activity);

        activityBtn = (Button) findViewById(R.id.activity_button);

        activityBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                redirect();
            }
        });
    }

    private void redirect(){
        startActivity(new Intent(this,OpenSourceActivity.class));
    }


}

@@ -41,37 +41,8 @@
 e;%0A%0A
-import android.app.Activity;%0A
 impo
@@ -122,83 +122,30 @@
 rt.v
-7.widget.LinearLayoutManager;%0Aimport android.support.v7.widget.RecyclerView
+4.app.FragmentActivity
 ;%0Aim
@@ -247,78 +247,51 @@
 urce
-Adapter;%0Aimport com.raychenon.licensedroid.SimpleDividerItemDecoration
+DialogFragment;%0A%0Aimport java.util.ArrayList
 ;%0A%0A/
@@ -358,16 +358,24 @@
 extends 
+Fragment
 Activity
@@ -401,16 +401,38 @@
 vityBtn;
+%0A    Button dialogBtn;
 %0A%0A    @O
@@ -653,16 +653,79 @@
 button);
+%0A        dialogBtn = (Button) findViewById(R.id.dialog_button);
 %0A%0A      
@@ -908,107 +908,523 @@
 %7D);%0A
-    %7D%0A%0A    private void redirect()%7B%0A        startActivity(new Intent(this,OpenSourceActivity.class)
+%0A        dialogBtn.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                showDialog();%0A            %7D%0A        %7D);%0A    %7D%0A%0A    private void redirect()%7B%0A        startActivity(new Intent(this,OpenSourceActivity.class));%0A    %7D%0A%0A    private void showDialog() %7B%0A        OpenSourceDialogFragment dialog = OpenSourceDialogFragment.newInstance(new ArrayList%3C%3E(OpenSourceData.getLicenseData()));%0A        dialog.show(getSupportFragmentManager(), %22dialog%22
 );%0A 

implement the inital DialogFragment