Skip to content

Commit

Permalink
Merge pull request #3 from Tenor-Inc/feature/dev_0.5.1
Browse files Browse the repository at this point in the history
Feature/dev 0.5.1
  • Loading branch information
ctrl-alt-del authored Feb 20, 2018
2 parents 01cedd4 + f4e316d commit 4b79019
Show file tree
Hide file tree
Showing 67 changed files with 1,301 additions and 1,029 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ allprojects {
apply plugin: 'com.android.library'

ext {
mSptLibVer = "26.0.1"
mSptLibVer = "26.1.0"
}

android {
def vMajor = 0 // range between [0,+INF)
def vMinor = 5 // range between [0,9]
def vPatch = 0 // range between [0,99]
def vPatch = 1 // range between [0,99]
compileSdkVersion 26
buildToolsVersion "26.0.1"
buildToolsVersion "26.0.3"

defaultConfig {
minSdkVersion 14
Expand Down
7 changes: 6 additions & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

<application>
<service
android:name="com.tenor.android.core.service.AaidService"
android:name="com.tenor.android.core.service.AaidServiceApi26"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service
android:name="com.tenor.android.core.service.AaidServiceCompat"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
Expand Down
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;
}
}
}
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";
}
43 changes: 30 additions & 13 deletions src/main/java/com/tenor/android/core/constant/ContentFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,34 @@

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)
@StringDef({ContentFormats.IMAGE_GIF, ContentFormats.IMAGE_MP4,
ContentFormats.IMAGE_JPEG, ContentFormats.IMAGE_PNG})
@Target({METHOD, PARAMETER, FIELD, ANNOTATION_TYPE, PACKAGE})
public @interface ContentFormat {

/**
* The supported content formats
*/
public class ContentFormat {

@Retention(RetentionPolicy.CLASS)
@StringDef({IMAGE_GIF, IMAGE_MP4, IMAGE_JPEG, IMAGE_PNG})
public @interface Value {
}

/**
* "image/gif"
*/
public static final String IMAGE_GIF = "image/" + MediaFormat.GIF;

/**
* "image/jpeg"
*/
public static final String IMAGE_JPEG = "image/" + MediaFormat.JPEG;

/**
* "image/png"
*/
public static final String IMAGE_PNG = "image/" + MediaFormat.PNG;

/**
* "image/mp4"
*/
public static final String IMAGE_MP4 = "video/" + MediaFormat.MP4;
}
26 changes: 0 additions & 26 deletions src/main/java/com/tenor/android/core/constant/ContentFormats.java

This file was deleted.

129 changes: 113 additions & 16 deletions src/main/java/com/tenor/android/core/constant/ItemBadgePosition.java
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 src/main/java/com/tenor/android/core/constant/ItemBadgePositions.java

This file was deleted.

Loading

0 comments on commit 4b79019

Please sign in to comment.