-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RTL support. Upgrade dependencies version.
- Loading branch information
1 parent
54bba69
commit 5f22020
Showing
10 changed files
with
169 additions
and
44 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
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
39 changes: 39 additions & 0 deletions
39
holdingbutton/src/main/java/com/dewarder/holdinglibrary/DirectionHelper.java
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,39 @@ | ||
package com.dewarder.holdinglibrary; | ||
|
||
import android.os.Build; | ||
import android.view.View; | ||
|
||
import com.dewarder.holdinglibrary.HoldingButtonLayout.Direction; | ||
import com.dewarder.holdinglibrary.HoldingButtonLayout.LayoutDirection; | ||
|
||
final class DirectionHelper { | ||
|
||
static LayoutDirection resolveLayoutDirection(HoldingButtonLayout view) { | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { | ||
return LayoutDirection.LTR; | ||
} | ||
|
||
int rawDirection = view.getResources().getConfiguration().getLayoutDirection(); | ||
if (rawDirection == View.LAYOUT_DIRECTION_LTR) { | ||
return LayoutDirection.LTR; | ||
} else { | ||
return LayoutDirection.RTL; | ||
} | ||
} | ||
|
||
static Direction resolveDefaultSlidingDirection(HoldingButtonLayout view) { | ||
if (resolveLayoutDirection(view) == LayoutDirection.LTR) { | ||
return Direction.START; | ||
} else { | ||
return Direction.END; | ||
} | ||
} | ||
|
||
static Direction adaptSlidingDirection(HoldingButtonLayout view, Direction direction) { | ||
if (resolveLayoutDirection(view) == LayoutDirection.LTR) { | ||
return direction; | ||
} else { | ||
return direction.toRtl(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.