sudo yum update && sudo yum upgrade
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 getDefaultUserAgentString(Context context) { | |
if (Build.VERSION.SDK_INT >= 17) { | |
return NewApiWrapper.getDefaultUserAgent(context); | |
} | |
try { | |
Constructor<WebSettings> constructor = WebSettings.class.getDeclaredConstructor(Context.class, WebView.class); | |
constructor.setAccessible(true); | |
try { | |
WebSettings settings = constructor.newInstance(context, null); |
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
-keep public class * extends android.app.Activity | |
-keep public class * extends android.app.Application | |
-keep public class * extends android.app.Service | |
-keep public class * extends android.content.BroadcastReceiver | |
-keep public class * extends android.content.ContentProvider | |
-keep public class * extends android.app.backup.BackupAgentHelper | |
-keep public class * extends android.preference.Preference | |
-keep public class com.android.vending.licensing.ILicensingService | |
-keep public class io.mobitech.** |
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
#Based on: https://www.linuxsecrets.com/1631-complete-guide-installing-openresty-a-nginx-full-fledged-web-server-on-redhat-scientific-linux-debian | |
#Get openSSL version that you want to compile with | |
cd /usr/local/src | |
wget https://www.openssl.org/source/openssl-1.1.1f.tar.gz | |
tar zxvf openssl-1.1.1f.tar.gz | |
#Get Open resty version | |
cd /tmp | |
wget https://openresty.org/download/openresty-1.17.8.2.tar.gz |
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
GlideApp.with(context.getApplicationContext()).load(url).fallback(R.drawable.loading) | |
.into((BaseTarget) new BaseTarget<BitmapDrawable>() { | |
@Override | |
public void onResourceReady(@NonNull BitmapDrawable resource, @Nullable Transition<? super BitmapDrawable> transition) { | |
showNotification(context, newsArticle, ((BitmapDrawable) resource).getBitmap()); | |
} | |
@Override | |
public void getSize(@NonNull SizeReadyCallback cb) { |
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
sudo su | |
yum --enablerepo=extras install epel-release | |
yum -y install patch dkms kernel-devel perl | |
yum update | |
#Required for kernel num 5: | |
yum --enablerepo=elrepo-kernel -y install kernel-ml-devel | |
reboot |
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 void httpGetWithRedirectSupport(final Context context, String url){ | |
Volley.newRequestQueue(context).add(new StringRequest(url, new Response.Listener<String>() { | |
@Override | |
public void onResponse(String s) { | |
// Do nothing | |
} | |
}, new Response.ErrorListener() { | |
@Override | |
public void onErrorResponse(VolleyError volleyError) { | |
if (volleyError.networkResponse != null && (volleyError.networkResponse.statusCode == 302 || volleyError.networkResponse.statusCode == 301)) { |
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){ |
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; | |
} |
NewerOlder