Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
Adds an arrow in front of a expandable stream to expand and contract …
Browse files Browse the repository at this point in the history
…that stream.
  • Loading branch information
amcoding committed Mar 16, 2017
1 parent b596202 commit a97409e
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import android.view.View;
import android.view.ViewPropertyAnimator;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
Expand Down Expand Up @@ -211,6 +212,8 @@ public void onReceive(Context contenxt, Intent intent) {
private ImageView ivSearchStreamCancel;
private ListView peopleDrawer;
private Toast toast;
private boolean expanded_stream = false;

//
private String streamSearchFilterKeyword = "";
private SimpleCursorAdapter.ViewBinder peopleBinder = new SimpleCursorAdapter.ViewBinder() {
Expand Down Expand Up @@ -1235,10 +1238,22 @@ public boolean onGroupClick(ExpandableListView expandableListView, View view, in
String streamName = ((TextView) view.findViewById(R.id.name)).getText().toString();
doNarrowToLastRead(streamName);
drawerLayout.openDrawer(GravityCompat.START);
ImageView imageView = (ImageView) view.findViewById(R.id.stream_expand_arrow);
float deg = (imageView.getRotation() == 180F) ? 0F : 180F;
imageView.animate().rotation(deg).setInterpolator(new AccelerateDecelerateInterpolator());

if (previousClick != -1 && expandableListView.getCount() > previousClick) {
expandableListView.collapseGroup(previousClick);
}
expandableListView.expandGroup(position);

if ((previousClick == position) && expanded_stream) {
expandableListView.collapseGroup(position);
expanded_stream = false;
} else {
expandableListView.expandGroup(position);
expanded_stream = true;
}

previousClick = position;
onNarrowFillSendBoxStream(streamName, "", false);
return true;
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/zulip/android/util/StreamSpan.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public StreamSpan(String streamId, int color) {
@Override
public void onClick(View widget) {
Context context = widget.getContext().getApplicationContext();

// get stream name from streamId string
String streamName = null;
if (StringUtils.isNumeric(streamId)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#5b5656"
android:pathData="M7.41,7.84L12,12.42l4.59,-4.58L18,9.25l-6,6 -6,-6z"/>
</vector>
77 changes: 45 additions & 32 deletions app/src/main/res/layout/stream_tile_new.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="horizontal">

<View
android:id="@+id/stream_dot"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_centerVertical="true"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:background="@drawable/dot" />
android:layout_weight="1">

<TextView
android:id="@+id/unread_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/stream_dot"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:text="1"
android:visibility="gone" />
<View
android:id="@+id/stream_dot"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:background="@drawable/dot" />

<TextView
android:id="@+id/name"
<TextView
android:id="@+id/unread_group"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/stream_dot"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="30dp"
android:layout_marginRight="30dp"
android:layout_weight="1"
android:text="1"
android:visibility="gone" />

<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:gravity="center_vertical"
android:text="MyStream"
android:textColor="@color/colorTextPrimary"
android:textSize="18sp" />
</LinearLayout>

<ImageView
android:id="@+id/stream_expand_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_toEndOf="@+id/stream_dot"
android:layout_toRightOf="@+id/stream_dot"
android:layout_marginRight="5dp"
android:layout_marginTop="7dp"
android:padding="5dp"
android:text="MyStream"
android:textColor="@color/colorTextPrimary"
android:textSize="18sp" />
</RelativeLayout>
android:src="@drawable/ic_keyboard_arrow_down_black_24dp" />
</LinearLayout>

0 comments on commit a97409e

Please sign in to comment.