Browse Source

some experiments

Alexander Brakowski 10 years ago
parent
commit
304e151d3f

+ 42 - 9
res/layout/fragment_profile_manager.xml

@@ -1,12 +1,45 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<ListView
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
+<RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/profile_manager_listview"
-    android:choiceMode="singleChoice"
-    android:background="#F2F2F2"
-    android:dividerHeight="10dp"
-    android:divider="@android:color/transparent"
-    android:padding="5dp" />
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:id="@+id/profile_manager_root_view">
+
+    <ListView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/profile_manager_listview"
+        android:choiceMode="singleChoice"
+        android:background="#F2F2F2"
+        android:dividerHeight="10dp"
+        android:divider="@android:color/transparent"
+        android:padding="5dp"
+        android:layout_alignParentLeft="true"
+        android:layout_marginLeft="0dp"
+        android:layout_alignParentTop="true"
+        android:layout_marginTop="0dp" />
+
+    <LinearLayout
+        android:orientation="horizontal"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentStart="true"
+        style="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"
+        android:alpha="0.8">
+
+        <Button
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="New Button"
+            android:id="@+id/button"
+            android:layout_gravity="center_vertical"
+            style="@android:style/Widget.DeviceDefault.ActionButton.Overflow"
+            android:textColor="@android:color/primary_text_dark" />
+    </LinearLayout>
+
+</RelativeLayout>

+ 16 - 7
res/layout/profile_manager_list_item.xml

@@ -19,25 +19,25 @@
         android:minHeight="?android:attr/listPreferredItemHeightSmall"
         android:text="Sample title"
         android:layout_alignParentTop="true"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentStart="true" />
+        android:layout_toRightOf="@+id/imageView" />
 
     <TextView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
         android:id="@+id/profile_manager_item_text"
-        android:layout_below="@+id/profile_manager_item_label"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentStart="true"
         android:paddingLeft="16dp"
         android:paddingRight="16dp"
         android:paddingBottom="16dp"
         android:textColor="#808080"
-        android:layout_marginRight="80dp"
         android:visibility="visible"
         android:singleLine="false"
-        android:phoneNumber="true" />
+        android:phoneNumber="true"
+        android:layout_toLeftOf="@+id/profile_manager_item_activated"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentStart="true"
+        android:layout_below="@+id/profile_manager_item_label"
+        android:paddingTop="10dp" />
 
     <ImageView
         android:layout_width="wrap_content"
@@ -50,4 +50,13 @@
         android:layout_marginRight="20dp"
         android:visibility="visible" />
 
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:id="@+id/imageView"
+        android:src="@drawable/ic_launcher"
+        android:layout_above="@+id/profile_manager_item_text"
+        android:layout_alignParentLeft="true"
+        android:layout_alignParentStart="true" />
+
 </RelativeLayout>

+ 6 - 2
src/de/tudarmstadt/informatik/hostage/ui2/activity/MainActivity.java

@@ -6,6 +6,7 @@ import android.app.ActionBar;
 import android.app.Activity;
 import android.app.Fragment;
 import android.app.FragmentManager;
+import android.app.FragmentTransaction;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.Configuration;
@@ -166,8 +167,11 @@ public class MainActivity extends Activity {
         if (fragment != null) {
         	this.displayedFragment = fragment;
             FragmentManager fragmentManager = getFragmentManager();
-            fragmentManager.beginTransaction()
-                    .replace(R.id.content_frame, fragment).commit();
+
+            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+            fragmentTransaction.replace(R.id.content_frame, fragment, fragment.getTag());
+            fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
+            fragmentTransaction.commit();
 
             // update selected item and title, then close the drawer
             mDrawerList.setItemChecked(position, true);