diff options
author | Parménides GV <parmegv@sdf.org> | 2013-02-11 17:32:19 +0100 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2013-02-11 17:32:19 +0100 |
commit | 8db161017f55a710bd91aa14fe9c1b24d4efdeab (patch) | |
tree | 037a3440d96315535e69958d45f3cd3d2ee20b76 | |
parent | e3acc71aaedfcf97b2adee907b6587e3c1eadf48 (diff) |
The newProviderButton gets user to the DialogFragment correctly.
The problem in the previous commit was that I had to modify the fragment
layout, instead of that of the Activity. I learnt how to obtain and
modify it from here:
https://developer.android.com/reference/android/app/ListFragment.html
-rw-r--r-- | res/layout/activity_configuration_wizard.xml | 11 | ||||
-rw-r--r-- | res/layout/activity_provider_list.xml | 10 | ||||
-rw-r--r-- | res/layout/provider_list_fragment.xml | 21 | ||||
-rw-r--r-- | src/se/leap/leapclient/ProviderListFragment.java | 13 |
4 files changed, 33 insertions, 22 deletions
diff --git a/res/layout/activity_configuration_wizard.xml b/res/layout/activity_configuration_wizard.xml index 7a0823d9..264ccf98 100644 --- a/res/layout/activity_configuration_wizard.xml +++ b/res/layout/activity_configuration_wizard.xml @@ -5,15 +5,4 @@ android:layout_height="match_parent" tools:context=".ConfigurationWizard" > - <Button - android:id="@+id/buttonNewProvider" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentLeft="true" - android:layout_marginBottom="24dp" - android:layout_marginLeft="24dp" - android:onClick="addNewProvider" - android:text="@string/new_provider_button" /> - </RelativeLayout>
\ No newline at end of file diff --git a/res/layout/activity_provider_list.xml b/res/layout/activity_provider_list.xml deleted file mode 100644 index 6a6dafec..00000000 --- a/res/layout/activity_provider_list.xml +++ /dev/null @@ -1,10 +0,0 @@ -<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/provider_list"
- android:name="se.leap.leapclient.ProviderListFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- tools:context=".ProviderListActivity"
- tools:layout="@android:layout/list_content" />
diff --git a/res/layout/provider_list_fragment.xml b/res/layout/provider_list_fragment.xml new file mode 100644 index 00000000..9bb775d7 --- /dev/null +++ b/res/layout/provider_list_fragment.xml @@ -0,0 +1,21 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp">
+
+ <ListView
+ android:id="@id/android:list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:drawSelectorOnTop="false" />
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="addNewProvider"
+ android:text="@string/new_provider_button" />
+
+</LinearLayout>
\ No newline at end of file diff --git a/src/se/leap/leapclient/ProviderListFragment.java b/src/se/leap/leapclient/ProviderListFragment.java index d83a7bc1..bde3baac 100644 --- a/src/se/leap/leapclient/ProviderListFragment.java +++ b/src/se/leap/leapclient/ProviderListFragment.java @@ -1,9 +1,14 @@ package se.leap.leapclient;
import android.app.Activity;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.os.Bundle;
+import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
@@ -63,7 +68,7 @@ public class ProviderListFragment extends ListFragment { */
public ProviderListFragment() {
}
-
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -73,9 +78,15 @@ public class ProviderListFragment extends ListFragment { android.R.layout.simple_list_item_activated_1,
android.R.id.text1,
ProviderListContent.ITEMS));
+
}
@Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
+ return inflater.inflate(R.layout.provider_list_fragment, container, false);
+ }
+
+ @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
|