This file contains hidden or 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 @DrawableRes int getPlaceHolder(Context context, @DrawableRes int actualPlaceholder) { | |
if(isLowRamDevice(context)) | |
return R.drawable.low_ram_placeholder; | |
else | |
return actualPlaceholder; | |
} | |
public static boolean isLowRamDevice(Context context) { | |
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | |
return activityManager != null && ActivityManagerCompat.isLowRamDevice(activityManager); |
This file contains hidden or 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 Description getDescriptionsFromJson(JsonElement jsonElement){ | |
Description description = new Description(); | |
for (Map.Entry<String, JsonElement> entry :jsonElement.getAsJsonObject().entrySet()){ | |
if(entry.getKey().equalsIgnoreCase("en") || entry.getKey().equalsIgnoreCase(getDefaultLangCode())) | |
description.descriptionMap.put(entry.getKey(), entry.getValue().getAsString()); | |
} | |
return description; | |
} | |
public static String getDefaultCode(Context context){ |
This file contains hidden or 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
<!-- A theme. --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/randomRed</item> | |
<item name="alertDialogTheme">@style/MyDialog</item> | |
</style> | |
<style name="MyDialog" parent="ThemeOverlay.AppCompat.Dialog.Alert"> | |
<item name="colorAccent">@color/secondary</item> |
This file contains hidden or 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
<activity | |
android:name=".MainActivity" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme"> | |
</activity> |
This file contains hidden or 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 | |
protected void onDestroy() { | |
super.onDestroy(); | |
customTabActivityHelper.setConnectionCallback(null); | |
} | |
@Override | |
protected void onStart() { | |
super.onStart(); | |
customTabActivityHelper.bindCustomTabsService(this); |
This file contains hidden or 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 val customTabActivityHelper: CustomTabActivityHelper = | |
CustomTabActivityHelper(this, lifecycle, this) | |
override fun onClick(view: View) { | |
val viewId = view.id | |
val uri = Uri.parse(urlEditText.text.toString()) | |
when (viewId) { | |
R.id.button_may_launch_url -> customTabActivityHelper.mayLaunchUrl(uri) | |
R.id.start_custom_tab -> { | |
val customTabsIntent = CustomTabsIntent.Builder(customTabActivityHelper.session) |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
app:layoutDescription="@xml/scene_05" | |
android:layout_height="match_parent"> | |
<ImageView | |
android:id="@+id/ivDusk" | |
android:layout_width="0dp" |
This file contains hidden or 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
val fullScreenIntent = Intent(this, CallActivity::class.java) | |
val fullScreenPendingIntent = PendingIntent.getActivity(this, 0, | |
fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT) | |
val notificationBuilder = NotificationCompat.Builder(this, CHANNEL_ID) | |
.... | |
.setPriority(NotificationCompat.PRIORITY_HIGH) | |
.setCategory(NotificationCompat.CATEGORY_CALL) | |
.setFullScreenIntent(fullScreenPendingIntent, true) |
This file contains hidden or 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
<manifest> | |
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | |
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> | |
</manifest> | |
//Request for the permission like any other permission request: | |
ActivityCompat.requestPermissions(this, | |
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION, | |
Manifest.permission.ACCESS_BACKGROUND_LOCATION), | |
your-permission-request-code) |
This file contains hidden or 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
root.setOnApplyWindowInsetsListener { _, insets -> | |
val fabLp = fab.layoutParams as CoordinatorLayout.LayoutParams | |
fabLp.bottomMargin = fabOriginalBottomMargin + insets.systemWindowInsetBottom | |
fab.layoutParams = fabLp | |
insets.consumeSystemWindowInsets() | |
} | |
OlderNewer