-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #443 from Mygod/master
Fix #441
- Loading branch information
Showing
7 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
<include layout="@layout/toolbar_light_dark" /> | ||
<android.support.v7.widget.RecyclerView android:id="@+id/profilesList" | ||
android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
android:layout_weight="1" /> | ||
<android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" | ||
android:layout_height="0dp" | ||
android:layout_weight="1"> | ||
<android.support.v7.widget.RecyclerView android:id="@+id/profilesList" | ||
app:layout_behavior="com.github.shadowsocks.widget.AutoPaddingBehavior" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
</android.support.design.widget.CoordinatorLayout> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/scala/com/github/shadowsocks/widget/AutoPaddingBehavior.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.github.shadowsocks.widget | ||
|
||
import android.content.Context | ||
import android.support.design.widget.CoordinatorLayout | ||
import android.support.design.widget.CoordinatorLayout.Behavior | ||
import android.support.design.widget.Snackbar.SnackbarLayout | ||
import android.util.AttributeSet | ||
import android.view.View | ||
|
||
/** | ||
* @author Mygod | ||
*/ | ||
class AutoPaddingBehavior(context: Context, attrs: AttributeSet) extends Behavior[View] { | ||
override def layoutDependsOn(parent: CoordinatorLayout, child: View, dependency: View) = | ||
dependency.isInstanceOf[SnackbarLayout] | ||
|
||
override def onDependentViewChanged(parent: CoordinatorLayout, child: View, dependency: View) = | ||
dependency match { | ||
case sl: SnackbarLayout => | ||
child.setPadding(0, 0, 0, dependency.getHeight) | ||
true | ||
case _ => super.onDependentViewChanged(parent, child, dependency) | ||
} | ||
|
||
override def onDependentViewRemoved(parent: CoordinatorLayout, child: View, dependency: View) = | ||
dependency match { | ||
case sl: SnackbarLayout => child.setPadding(0, 0, 0, 0) | ||
case _ => super.onDependentViewRemoved(parent, child, dependency) | ||
} | ||
} |