Cleaning and added todo's
This commit is contained in:
parent
cee9520595
commit
4b61eb675a
16 changed files with 16 additions and 70 deletions
app
app.iml
src/main
java/info/nerull7/mysqlbrowser
DatabaseActivity.javaDatabaseFragment.javaDatabaseItem.javaEntriesActivity.javaEntriesFragment.javaMainActivity.javaTableActivity.javaTableFragment.java
db
res/menu
|
@ -61,6 +61,7 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,7 @@ public class DatabaseActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
getMenuInflater().inflate(R.menu.main, menu);
|
||||||
getMenuInflater().inflate(R.menu.database, menu);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +30,8 @@ public class DatabaseActivity extends Activity {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
|
||||||
|
//TODO Handling menu
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_settings) {
|
if (id == R.id.action_settings) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class DatabaseFragment extends Fragment implements AdapterView.OnItemClic
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupListViewDatabase(){
|
private void setupListViewDatabase(){ // TODO: Handle no databases available problem
|
||||||
listAdapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, Static.databaseConnector.getDatabases());
|
listAdapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, Static.databaseConnector.getDatabases());
|
||||||
databasesListView.setAdapter(listAdapter);
|
databasesListView.setAdapter(listAdapter);
|
||||||
databasesListView.setOnItemClickListener(this);
|
databasesListView.setOnItemClickListener(this);
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package info.nerull7.mysqlbrowser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by nerull7 on 07.07.14.
|
|
||||||
*/
|
|
||||||
public class DatabaseItem {
|
|
||||||
}
|
|
|
@ -26,8 +26,7 @@ public class EntriesActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
getMenuInflater().inflate(R.menu.main, menu);
|
||||||
getMenuInflater().inflate(R.menu.entries, menu);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +35,8 @@ public class EntriesActivity extends Activity {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
|
||||||
|
//TODO Handling menu
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_settings) {
|
if (id == R.id.action_settings) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class EntriesFragment extends Fragment {
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupTable(){
|
private void setupTable(){ // TODO Empty table handling
|
||||||
List<String> fieldList = Static.databaseConnector.getFields(tableName);
|
List<String> fieldList = Static.databaseConnector.getFields(tableName);
|
||||||
|
|
||||||
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||||
|
|
|
@ -31,6 +31,8 @@ public class MainActivity extends Activity {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
|
||||||
|
//TODO Handling menu
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_settings) {
|
if (id == R.id.action_settings) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -25,8 +25,7 @@ public class TableActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
getMenuInflater().inflate(R.menu.main, menu);
|
||||||
getMenuInflater().inflate(R.menu.table, menu);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +34,8 @@ public class TableActivity extends Activity {
|
||||||
// Handle action bar item clicks here. The action bar will
|
// Handle action bar item clicks here. The action bar will
|
||||||
// automatically handle clicks on the Home/Up button, so long
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
// as you specify a parent activity in AndroidManifest.xml.
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
|
||||||
|
//TODO Handling menu
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
if (id == R.id.action_settings) {
|
if (id == R.id.action_settings) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class TableFragment extends Fragment implements AdapterView.OnItemClickLi
|
||||||
|
|
||||||
private void setupList(){
|
private void setupList(){
|
||||||
listAdapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, Static.databaseConnector.getTables());
|
listAdapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, Static.databaseConnector.getTables());
|
||||||
|
// TODO No tables handling
|
||||||
tablesList.setAdapter(listAdapter);
|
tablesList.setAdapter(listAdapter);
|
||||||
tablesList.setOnItemClickListener(this);
|
tablesList.setOnItemClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,11 @@ import java.util.List;
|
||||||
public interface DatabaseConnector {
|
public interface DatabaseConnector {
|
||||||
void setDatabaseInUse(String database);
|
void setDatabaseInUse(String database);
|
||||||
|
|
||||||
// TODO Real connection
|
|
||||||
List<String> getDatabases();
|
List<String> getDatabases();
|
||||||
|
|
||||||
// TODO Real getTables
|
|
||||||
List<String> getTables();
|
List<String> getTables();
|
||||||
|
|
||||||
// TODO Real getFields
|
|
||||||
List<String> getFields(String table);
|
List<String> getFields(String table);
|
||||||
|
|
||||||
// TODO Real getRows
|
|
||||||
List<List<String>> getRows(String table, int count);
|
List<List<String>> getRows(String table, int count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,8 @@ public class FakeDatabaseConnector implements DatabaseConnector {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real checking
|
|
||||||
public static boolean checkLogin(String login, String password, String url){
|
public static boolean checkLogin(String login, String password, String url){
|
||||||
// if (login.compareTo("nerull7")==0)
|
|
||||||
return true;
|
return true;
|
||||||
// if(password.compareTo("")==0)
|
|
||||||
// errorMsg = "No Password";
|
|
||||||
// else
|
|
||||||
// errorMsg = "I don't know";
|
|
||||||
// return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,7 +32,6 @@ public class FakeDatabaseConnector implements DatabaseConnector {
|
||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real connection
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getDatabases(){
|
public List<String> getDatabases(){
|
||||||
List<String> stringList = new ArrayList<String>();
|
List<String> stringList = new ArrayList<String>();
|
||||||
|
@ -50,7 +42,6 @@ public class FakeDatabaseConnector implements DatabaseConnector {
|
||||||
return stringList;
|
return stringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real getTables
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTables(){
|
public List<String> getTables(){
|
||||||
if(database==null) return null; // if database is not chosen return null
|
if(database==null) return null; // if database is not chosen return null
|
||||||
|
@ -62,7 +53,6 @@ public class FakeDatabaseConnector implements DatabaseConnector {
|
||||||
return stringList;
|
return stringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real getFields
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getFields(String table){
|
public List<String> getFields(String table){
|
||||||
if(database==null) return null; // if database is not chosen return null
|
if(database==null) return null; // if database is not chosen return null
|
||||||
|
@ -76,7 +66,6 @@ public class FakeDatabaseConnector implements DatabaseConnector {
|
||||||
return stringList;
|
return stringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real getRows
|
|
||||||
@Override
|
@Override
|
||||||
public List<List<String>> getRows(String table, int count){
|
public List<List<String>> getRows(String table, int count){
|
||||||
if(database==null) return null; // if database is not chosen return null
|
if(database==null) return null; // if database is not chosen return null
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RealDatabaseConnector implements DatabaseConnector {
|
||||||
private static String httpRequest(String urlRequest) throws IOException {
|
private static String httpRequest(String urlRequest) throws IOException {
|
||||||
disableStrictMode(); // FIXME
|
disableStrictMode(); // FIXME
|
||||||
URL url = new URL(urlRequest);
|
URL url = new URL(urlRequest);
|
||||||
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
|
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); // TODO Handling no connection
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
String response;
|
String response;
|
||||||
if(urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
if(urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||||
|
@ -58,13 +58,6 @@ public class RealDatabaseConnector implements DatabaseConnector {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// try {
|
|
||||||
// inputStream = new BufferedInputStream(urlConnection.getErrorStream());
|
|
||||||
// errorMsg = readStream(inputStream);
|
|
||||||
// } finally {
|
|
||||||
// urlConnection.disconnect();
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
errorMsg = "ERROR: "+urlConnection.getResponseCode();
|
errorMsg = "ERROR: "+urlConnection.getResponseCode();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context="info.nerull7.mysqlbrowser.DatabaseActivity" >
|
|
||||||
<item android:id="@+id/action_settings"
|
|
||||||
android:title="@string/action_settings"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:showAsAction="never" />
|
|
||||||
</menu>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context="info.nerull7.mysqlbrowser.EntriesActivity" >
|
|
||||||
<item android:id="@+id/action_settings"
|
|
||||||
android:title="@string/action_settings"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:showAsAction="never" />
|
|
||||||
</menu>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context=".LoginActivity" >
|
|
||||||
<item android:id="@+id/action_settings"
|
|
||||||
android:title="@string/action_settings"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:showAsAction="never" />
|
|
||||||
</menu>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context="info.nerull7.mysqlbrowser.TableActivity" >
|
|
||||||
<item android:id="@+id/action_settings"
|
|
||||||
android:title="@string/action_settings"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:showAsAction="never" />
|
|
||||||
</menu>
|
|
Loading…
Add table
Reference in a new issue