package de.codecrafters.tableviewexample;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import de.codecrafters.tableview.listeners.TableDataClickListener;
import de.codecrafters.tableviewexample.data.Car;
import de.codecrafters.tableviewexample.data.CarProducer;
import de.codecrafters.tableviewexample.data.DataFactory;


public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        if (toolbar != null) {
            setSupportActionBar(toolbar);
        }

        final SortableCarTableView carTableView = (SortableCarTableView) findViewById(R.id.tableView);
        if (carTableView != null) {
            carTableView.setDataAdapter(new CarTableDataAdapter(this, DataFactory.createCarList()));
            carTableView.addDataClickListener(new CarClickListener());
        }
    }

    private class CarClickListener implements TableDataClickListener<Car> {

        @Override
        public void onDataClicked(final int rowIndex, final Car clickedData) {
            final String carString = clickedData.getProducer().getName() + " " + clickedData.getName();
            Toast.makeText(MainActivity.this, carString, Toast.LENGTH_SHORT).show();
        }
    }
}

@@ -194,63 +194,8 @@
 %0D%0A%0D%0A
-import java.util.ArrayList;%0D%0Aimport java.util.List;%0D%0A%0D%0A
 impo
@@ -290,31 +290,52 @@
 ableview
-example.data.Ca
+.listeners.TableDataLongClickListene
 r;%0D%0Aimpo
@@ -378,24 +378,16 @@
 data.Car
-Producer
 ;%0D%0Aimpor
@@ -1146,24 +1146,104 @@
 stener());%0D%0A
+            carTableView.addDataLongClickListener(new CarLongClickListener());%0D%0A
         %7D%0D%0A 
@@ -1464,16 +1464,28 @@
 String =
+ %22Click: %22 +
  clicked
@@ -1648,12 +1648,455 @@
 %0D%0A    %7D%0D
+%0A%0D%0A    private class CarLongClickListener implements TableDataLongClickListener%3CCar%3E %7B%0D%0A%0D%0A        @Override%0D%0A        public boolean onDataClicked(final int rowIndex, final Car clickedData) %7B%0D%0A            final String carString = %22Long Click: %22 + clickedData.getProducer().getName() + %22 %22 + clickedData.getName();%0D%0A            Toast.makeText(MainActivity.this, carString, Toast.LENGTH_SHORT).show();%0D%0A            return true;%0D%0A        %7D%0D%0A    %7D%0D
 %0A%7D%0D%0A

Add long table click listener to table in example app