-
Notifications
You must be signed in to change notification settings - Fork 10
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 #3 from Tenor-Inc/feature/dev_0.5.1
Feature/dev 0.5.1
- Loading branch information
Showing
67 changed files
with
1,301 additions
and
1,029 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
36 changes: 36 additions & 0 deletions
36
src/main/java/com/tenor/android/core/checker/ScriptDirectionChecker.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,36 @@ | ||
package com.tenor.android.core.checker; | ||
|
||
import android.content.Context; | ||
import android.support.annotation.IntDef; | ||
import android.support.annotation.Nullable; | ||
|
||
import com.tenor.android.core.R; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
|
||
public class ScriptDirectionChecker { | ||
|
||
@Retention(RetentionPolicy.CLASS) | ||
@IntDef({UNSPECIFIED, LEFT_TO_RIGHT, RIGHT_TO_LEFT}) | ||
public @interface Value { | ||
} | ||
|
||
public static final int UNSPECIFIED = -1; | ||
public static final int LEFT_TO_RIGHT = 0; | ||
public static final int RIGHT_TO_LEFT = 1; | ||
|
||
@ScriptDirectionChecker.Value | ||
public static int checkSelfScriptDirection(@Nullable Context context) { | ||
if (context == null || context.getResources() == null) { | ||
return UNSPECIFIED; | ||
} | ||
|
||
if (context.getResources().getBoolean(R.bool.right_to_left)) { | ||
return RIGHT_TO_LEFT; | ||
} else { | ||
return LEFT_TO_RIGHT; | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/tenor/android/core/constant/AspectRatioRange.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,8 @@ | ||
package com.tenor.android.core.constant; | ||
|
||
public class AspectRatioRange { | ||
|
||
public static final String ALL = "all"; | ||
public static final String STANDARD = "standard"; | ||
public static final String WIDE = "wide"; | ||
} |
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
26 changes: 0 additions & 26 deletions
26
src/main/java/com/tenor/android/core/constant/ContentFormats.java
This file was deleted.
Oops, something went wrong.
129 changes: 113 additions & 16 deletions
129
src/main/java/com/tenor/android/core/constant/ItemBadgePosition.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 |
---|---|---|
@@ -1,23 +1,120 @@ | ||
package com.tenor.android.core.constant; | ||
|
||
import android.support.annotation.IntDef; | ||
import android.support.annotation.NonNull; | ||
|
||
import com.tenor.android.core.model.impl.ItemBadge; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE; | ||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.PACKAGE; | ||
import static java.lang.annotation.ElementType.PARAMETER; | ||
|
||
@Retention(RetentionPolicy.CLASS) | ||
@IntDef({ItemBadgePositions.NONE, | ||
ItemBadgePositions.INTERIOR_TOP_LEFT, ItemBadgePositions.INTERIOR_TOP_RIGHT, | ||
ItemBadgePositions.INTERIOR_BOTTOM_RIGHT, ItemBadgePositions.INTERIOR_BOTTOM_LEFT, | ||
ItemBadgePositions.EXTERIOR_TOP_LEFT, ItemBadgePositions.EXTERIOR_TOP_RIGHT, | ||
ItemBadgePositions.EXTERIOR_BOTTOM_RIGHT, ItemBadgePositions.EXTERIOR_BOTTOM_LEFT}) | ||
@Target({METHOD, PARAMETER, FIELD, ANNOTATION_TYPE, PACKAGE}) | ||
public @interface ItemBadgePosition { | ||
|
||
public class ItemBadgePosition { | ||
|
||
@Retention(RetentionPolicy.CLASS) | ||
@IntDef({NONE, | ||
INTERIOR_TOP_LEFT, INTERIOR_TOP_RIGHT, | ||
INTERIOR_BOTTOM_RIGHT, INTERIOR_BOTTOM_LEFT, | ||
EXTERIOR_TOP_LEFT, EXTERIOR_TOP_RIGHT, | ||
EXTERIOR_BOTTOM_RIGHT, EXTERIOR_BOTTOM_LEFT}) | ||
public @interface Value { | ||
} | ||
|
||
public static final int NONE = 0; | ||
public static final int INTERIOR_TOP_LEFT = 1; | ||
public static final int INTERIOR_TOP_RIGHT = 2; | ||
public static final int INTERIOR_BOTTOM_RIGHT = 3; | ||
public static final int INTERIOR_BOTTOM_LEFT = 4; | ||
public static final int EXTERIOR_TOP_LEFT = 5; | ||
public static final int EXTERIOR_TOP_RIGHT = 6; | ||
public static final int EXTERIOR_BOTTOM_RIGHT = 7; | ||
public static final int EXTERIOR_BOTTOM_LEFT = 8; | ||
|
||
@Value | ||
public static int parse(int position) { | ||
switch (position) { | ||
case INTERIOR_TOP_LEFT: | ||
return INTERIOR_TOP_LEFT; | ||
case INTERIOR_TOP_RIGHT: | ||
return INTERIOR_TOP_RIGHT; | ||
case INTERIOR_BOTTOM_RIGHT: | ||
return INTERIOR_BOTTOM_RIGHT; | ||
case INTERIOR_BOTTOM_LEFT: | ||
return INTERIOR_BOTTOM_LEFT; | ||
case EXTERIOR_TOP_LEFT: | ||
return EXTERIOR_TOP_LEFT; | ||
case EXTERIOR_TOP_RIGHT: | ||
return EXTERIOR_TOP_RIGHT; | ||
case EXTERIOR_BOTTOM_RIGHT: | ||
return EXTERIOR_BOTTOM_RIGHT; | ||
case EXTERIOR_BOTTOM_LEFT: | ||
return EXTERIOR_BOTTOM_LEFT; | ||
case NONE: | ||
default: | ||
return NONE; | ||
} | ||
} | ||
|
||
public static boolean isExterior(@NonNull ItemBadge badge) { | ||
return isExterior(badge.getPosition()); | ||
} | ||
|
||
public static boolean isExterior(@Value int position) { | ||
switch (position) { | ||
case EXTERIOR_TOP_LEFT: | ||
case EXTERIOR_TOP_RIGHT: | ||
case EXTERIOR_BOTTOM_RIGHT: | ||
case EXTERIOR_BOTTOM_LEFT: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
public static boolean isInterior(@NonNull ItemBadge badge) { | ||
return isInterior(badge.getPosition()); | ||
} | ||
|
||
public static boolean isInterior(@Value int position) { | ||
switch (position) { | ||
case INTERIOR_TOP_LEFT: | ||
case INTERIOR_TOP_RIGHT: | ||
case INTERIOR_BOTTOM_RIGHT: | ||
case INTERIOR_BOTTOM_LEFT: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
public static boolean isLeft(@NonNull ItemBadge badge) { | ||
return isLeft(badge.getPosition()); | ||
} | ||
|
||
public static boolean isLeft(@Value int position) { | ||
switch (position) { | ||
case INTERIOR_TOP_LEFT: | ||
case INTERIOR_BOTTOM_LEFT: | ||
case EXTERIOR_TOP_LEFT: | ||
case EXTERIOR_BOTTOM_LEFT: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
public static boolean isRight(@NonNull ItemBadge badge) { | ||
return isRight(badge.getPosition()); | ||
} | ||
|
||
public static boolean isRight(@Value int position) { | ||
switch (position) { | ||
case INTERIOR_TOP_RIGHT: | ||
case INTERIOR_BOTTOM_RIGHT: | ||
case EXTERIOR_TOP_RIGHT: | ||
case EXTERIOR_BOTTOM_RIGHT: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
107 changes: 0 additions & 107 deletions
107
src/main/java/com/tenor/android/core/constant/ItemBadgePositions.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.