Permalink
Browse files

redesigned dual pane layout - worked, but not yet finished.

  • Loading branch information...
1 parent 4ff3a62 commit e90f1299204689d1753cfa84fd56e787b12f5104 @mariotaku committed Nov 15, 2012
@@ -41,30 +41,9 @@
android:background="@drawable/two_panes_shadow_left"/>
</LinearLayout>
- <LinearLayout
+ <org.mariotaku.twidere.view.SlidePane
android:id="@+id/right_pane_layer"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:baselineAligned="false"
- android:orientation="horizontal">
-
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/pane_right_shadow_weight"
- android:background="@drawable/two_panes_shadow_right"/>
-
- <org.mariotaku.twidere.view.ExtendedFrameLayout
- android:id="@+id/right_pane_container"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/pane_right_content_weight">
-
- <FrameLayout
- android:id="@+id/right_pane"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
- </org.mariotaku.twidere.view.ExtendedFrameLayout>
- </LinearLayout>
+ android:layout_height="match_parent"/>
-</FrameLayout>
+</FrameLayout>
@@ -39,35 +39,13 @@
<View
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="@integer/pane_left_shadow_weight"
- android:background="@drawable/two_panes_shadow_left"/>
+ android:layout_weight="@integer/pane_left_shadow_weight"/>
</LinearLayout>
- <LinearLayout
+ <org.mariotaku.twidere.view.SlidePane
android:id="@+id/right_pane_layer"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:baselineAligned="false"
- android:orientation="horizontal">
-
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/pane_right_shadow_weight"
- android:background="@drawable/two_panes_shadow_right"/>
-
- <org.mariotaku.twidere.view.ExtendedFrameLayout
- android:id="@+id/right_pane_container"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/pane_right_content_weight">
-
- <FrameLayout
- android:id="@+id/right_pane"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
- </org.mariotaku.twidere.view.ExtendedFrameLayout>
- </LinearLayout>
+ android:layout_height="match_parent"/>
</FrameLayout>
<ImageButton
@@ -51,31 +51,10 @@
android:background="@drawable/two_panes_shadow_left"/>
</LinearLayout>
- <LinearLayout
+ <org.mariotaku.twidere.view.SlidePane
android:id="@+id/right_pane_layer"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:baselineAligned="false"
- android:orientation="horizontal">
-
- <View
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/pane_right_shadow_weight"
- android:background="@drawable/two_panes_shadow_right"/>
-
- <org.mariotaku.twidere.view.ExtendedFrameLayout
- android:id="@+id/right_pane_container"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="@integer/pane_right_content_weight">
-
- <FrameLayout
- android:id="@+id/right_pane"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
- </org.mariotaku.twidere.view.ExtendedFrameLayout>
- </LinearLayout>
+ android:layout_height="match_parent"/>
</FrameLayout>
</merge>
@@ -3,5 +3,6 @@
<item name="tab_display_label" type="bool">true</item>
<item name="home_display_icon" type="bool">true</item>
+ <item name="should_disable_scroll" type="bool">true</item>
-</resources>
+</resources>
View
@@ -5,5 +5,6 @@
<item name="home_display_icon" type="bool">false</item>
<item name="hw_accel_supported" type="bool">false</item>
<item name="hires_profile_image" type="bool">false</item>
+ <item name="should_disable_scroll" type="bool">false</item>
</resources>
View
@@ -50,5 +50,7 @@
<item name="clear_color" type="id"/>
<item name="copy" type="id"/>
<item name="load_from_position" type="id"/>
+ <item name="right_pane" type="id"/>
+ <item name="right_pane_container" type="id"/>
</resources>
@@ -41,52 +41,30 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
+import org.mariotaku.twidere.view.SlidePane;
@SuppressLint("Registered")
public class DualPaneActivity extends BaseActivity implements OnBackStackChangedListener {
private SharedPreferences mPreferences;
- private ExtendedFrameLayout mLeftPaneContainer, mRightPaneContainer;
+ private FrameLayout mLeftPaneContainer, mRightPaneContainer;
private ViewGroup mLeftPaneLayer, mRightPaneLayer;
private Fragment mDetailsFragment;
private boolean mDualPaneInPortrait, mDualPaneInLandscape;
- private final TouchInterceptor mLeftPaneTouchInterceptor = new TouchInterceptor() {
-
- @Override
- public void onInterceptTouchEvent(final MotionEvent event) {
- if (MotionEvent.ACTION_DOWN == event.getAction()) {
- bringLeftPaneToFront();
- }
- }
- };
- private final TouchInterceptor mRightPaneTouchInterceptor = new TouchInterceptor() {
-
- @Override
- public void onInterceptTouchEvent(final MotionEvent event) {
- if (MotionEvent.ACTION_DOWN == event.getAction()) {
- bringRightPaneToFront();
- }
- }
- };
-
public final void bringLeftPaneToFront() {
- if (mLeftPaneLayer == null || mRightPaneLayer == null || mLeftPaneContainer == null
- || mRightPaneContainer == null) return;
- mLeftPaneLayer.bringToFront();
- mLeftPaneContainer.setBackgroundResource(getPaneBackground());
- mRightPaneContainer.setBackgroundResource(0);
+ if (mRightPaneLayer instanceof SlidePane) {
+ ((SlidePane)mRightPaneLayer).close();
+ }
}
public final void bringRightPaneToFront() {
- if (mLeftPaneLayer == null || mRightPaneLayer == null || mLeftPaneContainer == null
- || mRightPaneContainer == null) return;
- mRightPaneLayer.bringToFront();
- mRightPaneContainer.setBackgroundResource(getPaneBackground());
- mLeftPaneContainer.setBackgroundResource(0);
+ if (mRightPaneLayer instanceof SlidePane) {
+ ((SlidePane)mRightPaneLayer).open();
+ }
}
public Fragment getDetailsFragment() {
@@ -126,7 +104,7 @@ public void onBackStackChanged() {
bringRightPaneToFront();
}
}
-
+ mRightPaneContainer.setBackgroundResource(getPaneBackground());
if (main_view != null) {
main_view.setVisibility(left_pane_used ? View.GONE : View.VISIBLE);
}
@@ -137,13 +115,13 @@ public void onBackStackChanged() {
public void onContentChanged() {
super.onContentChanged();
if (isDualPaneMode()) {
- mLeftPaneContainer = (ExtendedFrameLayout) findViewById(R.id.left_pane_container);
- mLeftPaneContainer.setTouchInterceptor(mLeftPaneTouchInterceptor);
+ mLeftPaneContainer = (FrameLayout) findViewById(R.id.left_pane_container);
mLeftPaneLayer = (ViewGroup) findViewById(R.id.left_pane_layer);
- mRightPaneContainer = (ExtendedFrameLayout) findViewById(R.id.right_pane_container);
- mRightPaneContainer.setTouchInterceptor(mRightPaneTouchInterceptor);
+ mRightPaneContainer = (FrameLayout) findViewById(R.id.right_pane_container);
mRightPaneLayer = (ViewGroup) findViewById(R.id.right_pane_layer);
- bringLeftPaneToFront();
+ if (mRightPaneLayer instanceof SlidePane) {
+ ((SlidePane)mRightPaneLayer).closeNoAnimation();
+ }
}
}
@@ -168,6 +146,7 @@ public void onCreate(final Bundle savedInstanceState) {
break;
}
setContentView(layout);
+ mRightPaneContainer.setBackgroundResource(getPaneBackground());
getSupportFragmentManager().addOnBackStackChangedListener(this);
}
Oops, something went wrong.

0 comments on commit e90f129

Please sign in to comment.