diff --git a/app/src/main/java/info/nerull7/mysqlbrowser/TableFragment.java b/app/src/main/java/info/nerull7/mysqlbrowser/TableFragment.java index 21fa092..21f4a9e 100644 --- a/app/src/main/java/info/nerull7/mysqlbrowser/TableFragment.java +++ b/app/src/main/java/info/nerull7/mysqlbrowser/TableFragment.java @@ -5,19 +5,38 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListAdapter; +import android.widget.ListView; import android.widget.TextView; /** * Created by nerull7 on 14.07.14. */ -public class TableFragment extends Fragment{ +public class TableFragment extends Fragment implements AdapterView.OnItemClickListener { + String databaseName; + ListView tablesList; + ListAdapter listAdapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_table, container, false); - TextView text = (TextView) rootView.findViewById(R.id.dumbText); - text.setText(getArguments().getString("DatabaseName")); + databaseName = getArguments().getString("DatabaseName"); + tablesList = (ListView) rootView.findViewById(R.id.tableList); + setupList(); return rootView; } + + private void setupList(){ + listAdapter = new ArrayAdapter(getActivity(),android.R.layout.simple_list_item_1, Static.databaseConnector.getTables()); + tablesList.setAdapter(listAdapter); + tablesList.setOnItemClickListener(this); + } + + @Override + public void onItemClick(AdapterView adapterView, View view, int position, long id) { + + } } diff --git a/app/src/main/res/layout/fragment_table.xml b/app/src/main/res/layout/fragment_table.xml index f3aa113..6df02e6 100644 --- a/app/src/main/res/layout/fragment_table.xml +++ b/app/src/main/res/layout/fragment_table.xml @@ -8,10 +8,9 @@ android:paddingBottom="@dimen/activity_vertical_margin" tools:context="info.nerull7.mysqlbrowser.TableFragment"> - + android:id="@+id/tableList" />