Welcome EntriesActivity
This commit is contained in:
parent
b9176a3881
commit
492b5668f7
8 changed files with 117 additions and 1 deletions
|
@ -24,6 +24,10 @@
|
|||
android:name=".TableActivity"
|
||||
android:label="@string/title_activity_table" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".EntriesActivity"
|
||||
android:label="@string/title_activity_entries" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package info.nerull7.mysqlbrowser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.os.Build;
|
||||
|
||||
import info.nerull7.mysqlbrowser.R;
|
||||
|
||||
public class EntriesActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_entries);
|
||||
String titleName = getIntent().getStringExtra("DatabaseName")+"->"+getIntent().getStringExtra("TableName");
|
||||
setTitle(titleName);
|
||||
|
||||
EntriesFragment entriesFragment = new EntriesFragment();
|
||||
entriesFragment.setArguments(getIntent().getExtras());
|
||||
if (savedInstanceState == null) {
|
||||
getFragmentManager().beginTransaction()
|
||||
.add(R.id.container, entriesFragment)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.entries, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_settings) {
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package info.nerull7.mysqlbrowser;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* Created by nerull7 on 15.07.14.
|
||||
*/
|
||||
public class EntriesFragment extends Fragment {
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_entries, container, false);
|
||||
return rootView;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package info.nerull7.mysqlbrowser;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -37,6 +38,11 @@ public class TableFragment extends Fragment implements AdapterView.OnItemClickLi
|
|||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
|
||||
String choosenTable = (String) listAdapter.getItem(position);
|
||||
listAdapter.getItem(position);
|
||||
Intent intent = new Intent(getActivity(), EntriesActivity.class);
|
||||
intent.putExtra("DatabaseName",databaseName);
|
||||
intent.putExtra("TableName",choosenTable);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
|
7
app/src/main/res/layout/activity_entries.xml
Normal file
7
app/src/main/res/layout/activity_entries.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nerull7.mysqlbrowser.EntriesActivity"
|
||||
tools:ignore="MergeRootFrame" />
|
16
app/src/main/res/layout/fragment_entries.xml
Normal file
16
app/src/main/res/layout/fragment_entries.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="info.nerull7.mysqlbrowser.EntriesFragment">
|
||||
|
||||
<TextView
|
||||
android:text="@string/hello_world"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</RelativeLayout>
|
8
app/src/main/res/menu/entries.xml
Normal file
8
app/src/main/res/menu/entries.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<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>
|
|
@ -14,5 +14,6 @@
|
|||
<string name="ok">OK</string>
|
||||
<string name="error">Error</string>
|
||||
<string name="title_activity_table">TableActivity</string>
|
||||
<string name="title_activity_entries">EntriesActivity</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue