浏览代码

fixed headline for edit share fragment

Andy Scherzinger 9 年之前
父节点
当前提交
c96be51151
共有 2 个文件被更改,包括 46 次插入22 次删除
  1. 31 11
      res/layout/edit_share_layout.xml
  2. 15 11
      src/com/owncloud/android/ui/fragment/EditShareFragment.java

+ 31 - 11
res/layout/edit_share_layout.xml

@@ -27,18 +27,40 @@
     <LinearLayout android:orientation="vertical"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content">
+        <TextView
+            android:id="@+id/editShareTitle"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/share_with_edit_title"
+            android:textAppearance="@style/TextAppearance.AppCompat.Title"
+            android:padding="@dimen/standard_padding"
+            android:singleLine="true"
+            android:ellipsize="middle"
+            />
 
-        <Switch
+        <View
+            android:id="@+id/share_header_divider"
+            android:layout_width="match_parent"
+            android:layout_height="2dp"
+            android:background="@color/owncloud_blue"
+            />
+    <LinearLayout
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="@dimen/standard_margin"
+        android:layout_marginRight="@dimen/standard_margin"
+        android:layout_marginBottom="@dimen/standard_margin">
+
+        <android.support.v7.widget.SwitchCompat
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:textSize="@dimen/two_line_primary_text_size"
             android:text="@string/share_privilege_can_edit"
             android:id="@+id/canEditSwitch"
             android:layout_gravity="start"
-            android:padding="@dimen/standard_half_padding"
             android:layout_marginTop="@dimen/standard_half_margin"
-            android:background="@color/actionbar_start_color"
-            android:textColor="@color/white"
+            android:textColor="@color/color_accent"
+            style="?android:attr/listSeparatorTextViewStyle"
             />
 
         <CheckBox
@@ -65,19 +87,17 @@
             android:visibility="gone"
             />
 
-        <Switch
+        <android.support.v7.widget.SwitchCompat
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:textSize="@dimen/two_line_primary_text_size"
             android:text="@string/share_privilege_can_share"
             android:id="@+id/canShareSwitch"
             android:layout_gravity="start"
-            android:padding="@dimen/standard_half_padding"
             android:layout_marginTop="@dimen/standard_half_margin"
-            android:background="@color/actionbar_start_color"
-            android:textColor="@color/white"
+            android:textColor="@color/color_accent"
+            style="?android:attr/listSeparatorTextViewStyle"
             />
-
+    </LinearLayout>
     </LinearLayout>
 
 </ScrollView>

+ 15 - 11
src/com/owncloud/android/ui/fragment/EditShareFragment.java

@@ -24,12 +24,13 @@ package com.owncloud.android.ui.fragment;
 import android.accounts.Account;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
+import android.support.v7.widget.SwitchCompat;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
-import android.widget.Switch;
+import android.widget.TextView;
 
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -130,6 +131,9 @@ public class EditShareFragment extends Fragment {
         // Inflate the layout for this fragment
         View view = inflater.inflate(R.layout.edit_share_layout, container, false);
 
+        ((TextView)view.findViewById(R.id.editShareTitle)).setText(
+                getResources().getString(R.string.share_with_edit_title, mShare.getSharedWithDisplayName()));
+
         // Setup layout
         refreshUiFromState(view);
 
@@ -224,7 +228,7 @@ public class EditShareFragment extends Fragment {
             implements CompoundButton.OnCheckedChangeListener {
 
         /**
-         * Called by every {@link Switch} and {@link CheckBox} in the fragment to update
+         * Called by every {@link SwitchCompat} and {@link CheckBox} in the fragment to update
          * the state of its associated permission.
          *
          * @param compound  {@link CompoundButton} toggled by the user
@@ -309,7 +313,7 @@ public class EditShareFragment extends Fragment {
         }
 
         /**
-         * Sync value of "can edit" {@link Switch} according to a change in one of its subordinate checkboxes.
+         * Sync value of "can edit" {@link SwitchCompat} according to a change in one of its subordinate checkboxes.
          *
          * If all the subordinates are disabled, "can edit" has to be disabled.
          *
@@ -427,23 +431,23 @@ public class EditShareFragment extends Fragment {
     }
 
     /**
-     * Shortcut to access {@link Switch} R.id.canShareSwitch
+     * Shortcut to access {@link SwitchCompat} R.id.canShareSwitch
      *
-     * @return  {@link Switch} R.id.canShareCheckBox or null if called before
+     * @return  {@link SwitchCompat} R.id.canShareCheckBox or null if called before
      *          {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} finished.
      */
-    private Switch getCanShareSwitch() {
-        return (Switch) getView().findViewById(R.id.canShareSwitch);
+    private SwitchCompat getCanShareSwitch() {
+        return (SwitchCompat) getView().findViewById(R.id.canShareSwitch);
     }
 
     /**
-     * Shortcut to access {@link Switch} R.id.canEditSwitch
+     * Shortcut to access {@link SwitchCompat} R.id.canEditSwitch
      *
-     * @return  {@link Switch} R.id.canEditSwitch or null if called before
+     * @return  {@link SwitchCompat} R.id.canEditSwitch or null if called before
      *          {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)} finished.
      */
-    private Switch getCanEditSwitch() {
-        return (Switch) getView().findViewById(R.id.canEditSwitch);
+    private SwitchCompat getCanEditSwitch() {
+        return (SwitchCompat) getView().findViewById(R.id.canEditSwitch);
     }
 
     /**