Skip to content

Instantly share code, notes, and snippets.

:octocat:

Paul Trinko PollyGlot

:octocat:
View GitHub Profile
@PollyGlot
PollyGlot / BottomNavigation.kt
Created Jan 3, 2020
A method to control navigation graphs in bottomNavigationBar
View BottomNavigation.kt
/**
* Called on first creation and when restoring state.
*/
private fun setupBottomNavigationBar(recreated: Boolean) {
val bottomNavigationView = findViewById<BottomNavigationView>(R.id.bottomNavigation)
val navGraphIds = listOf(TABS.BROWSE.navId, TABS.SEARCH.navId, TABS.FEED.navId, TABS.PROFILE.navId, TABS.PLUS.navId)
// Setup the bottom navigation view with a list of navigation graphs
val controller = bottomNavigationView.setupWithNavController(
@PollyGlot
PollyGlot / NavigateToCommentsFragment.kt
Created Jan 3, 2020
A method to navigate to comments fragment from different types of posts in the feed adapter
View NavigateToCommentsFragment.kt
private fun navigateToCommentsFragment(holder: ViewHolder) {
val timeLineObject = timelineList[holder.adapterPosition]
holder.itemView.findNavController().navigate(R.id.action_home_dest_to_comments_fragment, Bundle().apply {
putInt(CommentsFragment.EXTRA_COMMENTS, timeLineObject.comments)
putInt(CommentsFragment.EXTRA_LIKES_COUNT, timeLineObject.likes)
putBoolean(CommentsFragment.EXTRA_LIKED, timeLineObject.hasLiked)
putInt(CommentsFragment.EXTRA_POSITION, holder.adapterPosition)
putString(CommentsFragment.EXTRA_PROFILE_IMAGE, timeLineObject.user.avatarUrl)
@PollyGlot
PollyGlot / FilterActivity.kt
Created Jan 3, 2020
A filter functionality I was responsible for to filter videos / playlists in search results of a Kinomap application
View FilterActivity.kt
package com.kinomap.trainingapps.helper
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.preference.PreferenceManager
import android.util.Log
import android.view.Menu
@PollyGlot
PollyGlot / Extensions.kt
Created Jan 3, 2020
A list of extension functions I created for a Kinomap project
View Extensions.kt
package com.kinomap.kinomapcommon.util
import android.content.SharedPreferences
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.os.Build
import android.view.View
import androidx.annotation.DrawableRes
import androidx.annotation.PluralsRes
import androidx.fragment.app.FragmentManager
@PollyGlot
PollyGlot / VideosListAdapter.kt
Created Jan 3, 2020
RecyclerView adapter to show several recyclerviews with different orientations and types of headers
View VideosListAdapter.kt
package com.kinomap.trainingapps.helper
import android.content.Intent
import android.os.Bundle
import android.preference.PreferenceManager
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
View build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.compileSdkVersion
def versionPropsFile = file('version.properties')
def value = 0
Properties versionProps = new Properties()
View userVerification.java
private void userLogin(String email, String password) {
showProgressDialog();
mFirebaseAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d(TAG, "signInWithEmail:onComplete:" + task.isSuccessful());
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithEmail", task.getException());
You can’t perform that action at this time.