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
protected String replaceImageResolution(String images) { | |
int sqIndex = images.indexOf("sq"); | |
String f; | |
if (sqIndex != -1){ | |
String prefix = images.substring(0,sqIndex + 3); | |
String suffix = images.substring(sqIndex + 3); | |
char c; | |
int startTrim = 0; | |
for(int i=0; i< suffix.length();i++){ | |
c = suffix.charAt(i); |
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
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://someurl.com")); | |
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
//Give chrome browser a priority , if exist, otherwise, returns other browser package | |
final String browserPackage = ActivityUtils.getBrowserPackage(intent, this); | |
if (!browserPackage.isEmpty()) { | |
intent.setPackage(browserPackage); | |
} | |
try { | |
startActivity(intent); | |
} catch (ActivityNotFoundException ex) { |
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
{ | |
"IAB1": "Arts & Entertainment", | |
"IAB1-1": "Books & Literature", | |
"IAB1-2": "Celebrity Fan/Gossip", | |
"IAB1-3": "Fine Art", | |
"IAB1-4": "Humor", | |
"IAB1-5": "Movies", | |
"IAB1-6": "Music", | |
"IAB1-7": "Television", | |
"IAB2": "Automotive", |
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
public static String getBrowserPackage(Intent intent, Context context){ | |
PackageManager pm = context.getPackageManager(); | |
List<ResolveInfo> appsList = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); | |
String tmpPkg = "", pkg=""; | |
for (ResolveInfo app : appsList){ | |
tmpPkg = app.activityInfo.packageName.toLowerCase(); | |
if ("com.android.chrome".equals(tmpPkg)){ | |
return tmpPkg; | |
} | |
if (tmpPkg.contains("browse") || tmpPkg.contains("chrome") || tmpPkg.contains("com.UCMobile.intl") || tmpPkg.contains("org.mozilla.firefox") || tmpPkg.contains("com.opera.mini.native")){ |
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
private void animateClosing() { | |
AnimatorSet animator = new AnimatorSet(); | |
ObjectAnimator translation = ObjectAnimator.ofFloat(mSideTabs, "translationX", 0, sideTabsWidth); | |
ObjectAnimator fadeOut = ObjectAnimator.ofFloat(mSideTabs, "alpha", 1f, 0f); | |
animator.playTogether(translation, fadeOut); | |
animator.setDuration(300); | |
animator.addListener(new Animator.AnimatorListener() { | |
@Override | |
public void onAnimationStart(Animator animation) { | |
isAnimated = true; |
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
IAB25("Non-Standard Content",CategoryTier.T1), | |
IAB25_3("Pornography", CategoryTier.T2), | |
IAB25_2("Extreme Graphic and Explicit Violence",CategoryTier.T2), | |
IAB25_1("Unmoderated UGC",CategoryTier.T2), | |
IAB25_7("Incentivized",CategoryTier.T2), | |
IAB25_6("Under Construction",CategoryTier.T2), | |
IAB25_5("Hate Content",CategoryTier.T2), | |
IAB25_4("Profane Content",CategoryTier.T2), | |
IAB13("Personal Finance",CategoryTier.T1), | |
IAB13_9("Options",CategoryTier.T2), |
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
public static String getVideoUrl(View view, String clickUrl) { | |
int height = 300, width = 600; | |
String appName =""; | |
String gpUrl=""; | |
try { | |
appName = URLEncoder.encode(view.getContext().getString(R.string.app_name), "UTF-8"); | |
gpUrl = URLEncoder.encode( "http://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID, "UTF-8"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); |
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
private boolean getIsLowDevice(Context context) { | |
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); | |
ActivityManager activityManager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); | |
activityManager.getMemoryInfo(mi); | |
double availableMegs = (double)mi.availMem / 1048576d; | |
String networkType = getNetworkClass(context); | |
return "2G".equalsIgnoreCase(networkType) && availableMegs > 400; | |
} |
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
@Override | |
public void onBindViewHolder(final ViewHolder viewHolder, final int i) { | |
NewsArticle newsArticle = newsArticles.get(i); | |
final String articleVisibleUrl = newsArticle.visibleUrl; | |
if (!TextUtils.isEmpty(articleVisibleUrl) && newsArticle.isPromoted) { | |
Volley.newRequestQueue(context).add(new StringRequest(articleVisibleUrl, new Response.Listener<String>() { | |
@Override | |
public void onResponse(String s) { | |
// Do nothing |
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
//initialize variables | |
var visible_urls = new Map(); | |
var fired_urls = []; | |
//When news item is created, add it's id and the it's visibilityUrl to map | |
visible_urls.set(news_item.id, news_item.visibleUrl); | |
//call the url in background | |
function open_visible_url(url) { | |
if (url){ |
OlderNewer