Skip to content

Commit

Permalink
feat: carry back the clicked view to the SwitchClickListener
Browse files Browse the repository at this point in the history
closes #87
  • Loading branch information
Jacksgong committed May 12, 2018
1 parent a7cd0cc commit b43093f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void onKeyboardShowing(boolean isShowing) {
KPSwitchConflictUtil.attach(mPanelRoot, mSendEdt,
new KPSwitchConflictUtil.SwitchClickListener() {
@Override
public void onClickSwitch(boolean switchToPanel) {
public void onClickSwitch(View v, boolean switchToPanel) {
if (switchToPanel) {
mSendEdt.clearFocus();
} else {
Expand All @@ -153,7 +153,7 @@ public void onClickSwitch(boolean switchToPanel) {
KPSwitchConflictUtil.attach(mPanelRoot, mPlusIv, mSendEdt,
new KPSwitchConflictUtil.SwitchClickListener() {
@Override
public void onClickSwitch(boolean switchToPanel) {
public void onClickSwitch(View v, boolean switchToPanel) {
if (switchToPanel) {
mSendEdt.clearFocus();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void onKeyboardShowing(boolean isShowing) {
KPSwitchConflictUtil.attach(mPanelRoot, mPlusIv, mSendEdt,
new KPSwitchConflictUtil.SwitchClickListener() {
@Override
public void onClickSwitch(boolean switchToPanel) {
public void onClickSwitch(View v, boolean switchToPanel) {
if (switchToPanel) {
mSendEdt.clearFocus();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void onCreate(Bundle savedInstanceState) {
KPSwitchConflictUtil.attach(panelRoot, plusIv, sendEdt,
new KPSwitchConflictUtil.SwitchClickListener() {
@Override
public void onClickSwitch(boolean switchToPanel) {
public void onClickSwitch(View v, boolean switchToPanel) {
if (switchToPanel) {
sendEdt.clearFocus();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static void attach(final View panelLayout,
public void onClick(View v) {
final boolean switchToPanel = switchPanelAndKeyboard(panelLayout, focusView);
if (switchClickListener != null) {
switchClickListener.onClickSwitch(switchToPanel);
switchClickListener.onClickSwitch(v, switchToPanel);
}
}
});
Expand Down Expand Up @@ -255,10 +255,11 @@ public static void hidePanelAndKeyboard(final View panelLayout) {
*/
public interface SwitchClickListener {
/**
* @param v The view that was clicked.
* @param switchToPanel If true, switch to showing Panel; If false, switch to showing
* Keyboard.
*/
void onClickSwitch(boolean switchToPanel);
void onClickSwitch(View v, boolean switchToPanel);
}

/**
Expand Down Expand Up @@ -317,7 +318,7 @@ public void onClick(View v) {
}

if (switchClickListener != null && switchToPanel != null) {
switchClickListener.onClickSwitch(switchToPanel);
switchClickListener.onClickSwitch(v, switchToPanel);
}
}
});
Expand Down

1 comment on commit b43093f

@xiaobaDev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradle的1.6.1没有包含这些啊

Please sign in to comment.