-
-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
14d871b
commit 0f0b727
Showing
3 changed files
with
79 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.vanniktech.emoji; | ||
|
||
import android.annotation.TargetApi; | ||
import android.os.Build; | ||
import android.view.View; | ||
import android.view.ViewTreeObserver; | ||
|
||
final class Utils { | ||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) | ||
public static void removeOnGlobalLayoutListener(final View v, final ViewTreeObserver.OnGlobalLayoutListener listener){ | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { | ||
//noinspection deprecation | ||
v.getViewTreeObserver().removeGlobalOnLayoutListener(listener); | ||
} else { | ||
v.getViewTreeObserver().removeOnGlobalLayoutListener(listener); | ||
} | ||
} | ||
|
||
private Utils() { | ||
throw new AssertionError("No instances."); | ||
} | ||
} |
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,13 @@ | ||
package com.vanniktech.emoji; | ||
|
||
|
||
import com.pushtorefresh.private_constructor_checker.PrivateConstructorChecker; | ||
|
||
import org.junit.Test; | ||
|
||
public class UtilsTest { | ||
@Test | ||
public void constructorShouldBePrivate() { | ||
PrivateConstructorChecker.forClass(Utils.class).expectedTypeOfException(AssertionError.class).expectedExceptionMessage("No instances.").check(); | ||
} | ||
} |