Commit 620ab984 authored by Yusuke Iwaki's avatar Yusuke Iwaki

multi-pane

parent d5acef38
...@@ -3,6 +3,7 @@ package chat.rocket.android.activity; ...@@ -3,6 +3,7 @@ package chat.rocket.android.activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.widget.SlidingPaneLayout; import android.support.v4.widget.SlidingPaneLayout;
import android.view.View;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
...@@ -51,6 +52,18 @@ public class MainActivity extends AbstractAuthedActivity { ...@@ -51,6 +52,18 @@ public class MainActivity extends AbstractAuthedActivity {
closeSidebarIfNeeded(); closeSidebarIfNeeded();
}); });
SlidingPaneLayout pane = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
if (pane != null) {
final SlidingPaneLayout subPane = (SlidingPaneLayout) findViewById(R.id.sub_sliding_pane);
pane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override public void onPanelClosed(View panel) {
super.onPanelClosed(panel);
if (subPane != null) {
subPane.closePane();
}
}
});
}
ImageView myAvatar = (ImageView) findViewById(R.id.img_my_avatar); ImageView myAvatar = (ImageView) findViewById(R.id.img_my_avatar);
new Avatar("demo.rocket.chat", "John Doe").into(myAvatar); new Avatar("demo.rocket.chat", "John Doe").into(myAvatar);
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v4.widget.SlidingPaneLayout
android:layout_width="288dp" android:id="@+id/sub_sliding_pane"
android:layout_height="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_gravity="start" android:layout_gravity="start"
android:layout_width="280dp"
android:layout_height="match_parent"
android:theme="@style/AppTheme.Dark" android:theme="@style/AppTheme.Dark"
> >
<android.support.v4.widget.NestedScrollView
<LinearLayout android:layout_width="96dp"
android:id="@+id/user_info_container" android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_gravity="start"
android:layout_height="wrap_content"
android:background="?attr/colorPrimaryDark" android:background="?attr/colorPrimaryDark"
android:foreground="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/margin_16"
android:layout_alignParentTop="true"
android:elevation="2dp"
> >
<LinearLayout
<ImageView android:layout_width="match_parent"
android:id="@+id/img_userstatus"
android:layout_width="8dp"
android:layout_height="8dp"
android:src="@drawable/userstatus_online"
/>
<Space
android:layout_width="@dimen/margin_8"
android:layout_height="wrap_content"
/>
<ImageView
android:id="@+id/img_my_avatar"
android:layout_width="48dp"
android:layout_height="48dp"
/>
<FrameLayout
android:layout_width="0px"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_8" android:orientation="vertical"
android:layout_marginRight="@dimen/margin_8"
android:layout_weight="1"
> >
<TextView <ImageButton
android:id="@+id/txt_account_info" android:layout_width="80dp"
android:layout_width="match_parent" android:layout_height="80dp"
android:layout_height="wrap_content" android:layout_margin="@dimen/margin_8"
android:layout_gravity="center_vertical" android:src="@mipmap/ic_launcher"
android:text="John Doe" style="@style/Base.Widget.AppCompat.Button.Borderless"
android:textSize="14sp"
/> />
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="@dimen/margin_8"
android:text="@string/fa_plus"
style="@style/Base.Widget.AppCompat.Button.Borderless"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</FrameLayout> <RelativeLayout
android:layout_width="288dp"
<chat.rocket.android.widget.DownUpToggleView android:layout_height="match_parent">
android:id="@+id/toggle_user_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/user_info_container"
android:background="?attr/colorPrimary"
android:layout_alignParentBottom="true"
>
<LinearLayout <LinearLayout
android:id="@+id/user_info_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="?attr/listPreferredItemPaddingLeft" android:background="?attr/colorPrimaryDark"
android:orientation="vertical" android:foreground="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/margin_16"
android:layout_alignParentTop="true"
android:elevation="2dp"
> >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_8"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CHANNELS"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textStyle="bold"
android:alpha="0.62"
android:layout_gravity="start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton <ImageView
android:layout_width="48dp" android:id="@+id/img_userstatus"
android:layout_height="48dp" android:layout_width="8dp"
android:text="@string/fa_plus" android:layout_height="8dp"
android:textSize="12dp" android:src="@drawable/userstatus_online"
android:layout_gravity="end|center_vertical" />
style="@style/Widget.AppCompat.Button.Borderless"
/>
</FrameLayout>
<LinearLayout <Space
android:id="@+id/channels_container" android:layout_width="@dimen/margin_8"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" />
android:layout_marginEnd="?attr/listPreferredItemPaddingRight"
<ImageView
android:id="@+id/img_my_avatar"
android:layout_width="48dp"
android:layout_height="48dp"
/> />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="0px"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_8" android:layout_marginLeft="@dimen/margin_8"
android:layout_marginRight="@dimen/margin_8"
android:layout_weight="1"
> >
<TextView <TextView
android:layout_width="wrap_content" android:id="@+id/txt_account_info"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="DIRECT MESSAGES" android:layout_gravity="center_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:text="John Doe"
android:textStyle="bold" android:textSize="14sp"
android:alpha="0.62"
android:layout_gravity="start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width="48dp"
android:layout_height="48dp"
android:text="@string/fa_plus"
android:textSize="12dp"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_gravity="end|center_vertical"
/> />
</FrameLayout> </FrameLayout>
<LinearLayout <chat.rocket.android.widget.DownUpToggleView
android:id="@+id/direct_messages_container" android:id="@+id/toggle_user_action"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="?attr/listPreferredItemPaddingRight"
/> />
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v4.widget.NestedScrollView <android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/user_info_container"
android:background="?attr/colorPrimaryDark"
android:elevation="2dp"
tools:visibility="gone"
>
<LinearLayout
android:id="@+id/user_action_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_below="@id/user_info_container"
android:background="?attr/colorPrimary"
android:layout_alignParentBottom="true"
> >
<TextView <LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Online"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Away"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Busy"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Invisible"
/>
<chat.rocket.android.widget.DividerView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall" android:layout_height="wrap_content"
android:paddingStart="?attr/listPreferredItemPaddingLeft" android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight" android:orientation="vertical"
android:gravity="center_vertical" >
android:text="Logout" <FrameLayout
/> android:layout_width="match_parent"
</LinearLayout> android:layout_height="wrap_content"
</android.support.v4.widget.NestedScrollView> android:layout_marginTop="@dimen/margin_8"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CHANNELS"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textStyle="bold"
android:alpha="0.62"
android:layout_gravity="start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width="48dp"
android:layout_height="48dp"
android:text="@string/fa_plus"
android:textSize="12dp"
android:layout_gravity="end|center_vertical"
style="@style/Widget.AppCompat.Button.Borderless"
/>
</FrameLayout>
<LinearLayout
android:id="@+id/channels_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="?attr/listPreferredItemPaddingRight"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_8"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DIRECT MESSAGES"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textStyle="bold"
android:alpha="0.62"
android:layout_gravity="start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width="48dp"
android:layout_height="48dp"
android:text="@string/fa_plus"
android:textSize="12dp"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_gravity="end|center_vertical"
/>
</FrameLayout>
<LinearLayout
android:id="@+id/direct_messages_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginEnd="?attr/listPreferredItemPaddingRight"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout> <android.support.v4.widget.NestedScrollView
\ No newline at end of file android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/user_info_container"
android:background="?attr/colorPrimaryDark"
android:elevation="2dp"
tools:visibility="gone"
>
<LinearLayout
android:id="@+id/user_action_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Online"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Away"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Busy"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Invisible"
/>
<chat.rocket.android.widget.DividerView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:gravity="center_vertical"
android:text="Logout"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
</android.support.v4.widget.SlidingPaneLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment