Skip to content

Instantly share code, notes, and snippets.

View dmitriy-chernysh's full-sized avatar
🚀
Building NeonFrame.app

Dmitri Chernysh dmitriy-chernysh

🚀
Building NeonFrame.app
View GitHub Profile
VideoUploader.uploadAsyncWithProgressCallback(
videoContentBuilder.build(),
pageId,
object : GraphRequest.OnProgressCallback {
override fun onCompleted(response: GraphResponse) {
// {Response: responseCode: 200, graphObject: {"success":true,"video_id":"380208427529152"}
try {
val videoId = parseResponseVideoId(response.jsonObject)
val accessToken : AccessToken =
AccessToken(
// String token you saved from Pages list
token,
// replace it by your applicationId
"com.app.packagename",
// ID you saved from Pages list
pageId,
// The same permissions list we used for Login flow at point 4
listOf("public_profile", "pages_manage_posts"),
<resources>
<string name="facebook_app_id">{app_id_here}</string>
<string name="fb_login_protocol_scheme">fb{app_id_here}</string>
<string name="facebook_client_token">{client_token}</string>
</resources>
<application>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@style/AppTheme.Facebook.NoActionBar"
tools:replace="android:theme" />
<activity
android:name="com.facebook.CustomTabActivity"
object FacebookGraphUtil {
@Throws(RuntimeException::class)
fun getFacebookPageList(accessToken: AccessToken, doOnSuccess: (List<FacebookPage>) -> Unit) {
GraphRequest.newGraphPathRequest(
accessToken,
"/me/accounts"
) { response: GraphResponse ->
parsePageListJson(response.jsonObject)
@dmitriy-chernysh
dmitriy-chernysh / #01 themes.xml
Last active May 22, 2023 03:03
Material 3 Styles (quick start)
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme.Material.NoActionBar" parent="Theme.Material3.Dark.NoActionBar">
<item name="android:windowBackground">@color/colorWindowGreyBackground</item>
<!-- Primary brand color. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorOnPrimary">@color/colorWindowBackground</item>
<item name="colorPrimaryContainer">@color/colorAccent</item>
<item name="colorOnPrimaryContainer">@color/colorPrimaryDark</item>
@dmitriy-chernysh
dmitriy-chernysh / build.sh
Last active January 26, 2022 18:59
Script to build AAB release on local machine.
#! /bin/sh
#
# Script to build AAB release on local machine.
#
# Before continue please make sure
# you have the following variables in the file keystore.properties:
#
# KEYPWD - it's keyPassword
# KSTOREPWD - it's storePassword
# KEYSTORE_ALIAS - alias
@dmitriy-chernysh
dmitriy-chernysh / 01.RuntimePermissionObserver.kt
Last active April 14, 2021 03:03
Lifecycle observer to request runtime permission using Result API
//How to use this observer - see 02.Fragment.kt below
class RuntimePermissionObserver(
private val activity: FragmentActivity
) : LifecycleObserver {
private var onGranted: () -> Unit = {}
private var onDenied: () -> Unit = {}
private var onShouldShowRationale: () -> Unit = {}
@dmitriy-chernysh
dmitriy-chernysh / install-bundle-on-device.sh
Last active January 26, 2022 19:01
🌟 Script | Install App Bundles on connected device
#! /bin/sh
#
# Before continue please make sure
# you have the following variables in the file keystore.properties:
#
# KEYPWD - it's keyPassword
# KSTOREPWD - it's storePassword
# KEYSTORE_ALIAS - alias
# KEYSTORE_SECRET - it's a result of command 'gpg -c --armor release.keystore'
@dmitriy-chernysh
dmitriy-chernysh / HeightWrappingViewPager.java
Last active June 25, 2020 15:09
[Android, Java] HeightWrappingViewPager - a custom ViewPager that can be used as a child view in ScrollView. With custom swipe listener
/**
* A custom scrollable ViewPager
* NOTE: it uses in a production app.
* <p>
* Created by Dmitriy V. Chernysh on 2/7/19.
* <p>
* https://instagr.am/mobiledevpro
* #MobileDevPro
*/