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
android { | |
signingConfigs { | |
getByName("debug") { | |
keyAlias = "debug" | |
keyPassword = "my debug key password" | |
storeFile = file("/home/miles/keystore.jks") | |
storePassword = "my keystore password" | |
} | |
create("release") { | |
keyAlias = "release" |
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
class MainActivity : AppCompatActivity() { | |
companion object { | |
private const val PERMISSION_REQUEST_CODE = 20 | |
} | |
private lateinit var binding: ActivityMainBinding | |
private lateinit var layout: View | |
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) { |
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
android.enableJetifier=true | |
android.useAndroidX=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
/* | |
* Copyright (C) 2020 Presidenza del Consiglio dei Ministri. | |
* Please refer to the AUTHORS file for more information. | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU Affero General Public License as | |
* published by the Free Software Foundation, either version 3 of the | |
* License, or (at your option) any later version. | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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
inline fun getValueAnimator(forward: Boolean = true, duration: Long, interpolator: TimeInterpolator, | |
crossinline updateListener: (progress: Float) -> Unit | |
): ValueAnimator { | |
val a = | |
if (forward) ValueAnimator.ofFloat(0f, 1f) | |
else ValueAnimator.ofFloat(1f, 0f) | |
a.addUpdateListener { updateListener(it.animatedValue as Float) } | |
a.duration = duration | |
a.interpolator = interpolator | |
return a |
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
class ToolbarBehavior : CoordinatorLayout.Behavior<AppBarLayout>() { | |
/** Consume if vertical scroll because we don't care about other scrolls */ | |
override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout, child: AppBarLayout, | |
directTargetChild: View, target: View, axes: Int, type: Int): Boolean { | |
getViews(child) | |
return axes == ViewCompat.SCROLL_AXIS_VERTICAL || | |
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, axes, type) | |
} |
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
tabsRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { | |
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { | |
totalTabsScroll += dx | |
} | |
}) | |
viewPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() { | |
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { | |
// Scroll tabs as viewpager is scrolled | |
val dx = (position + positionOffset) * tabItemWidth - totalTabsScroll |
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 void addADTStoPacket(byte[] packet, int packetLen) { | |
int profile = 2; //AAC LC //39=MediaCodecInfo.CodecProfileLevel.AACObjectELD; | |
int freqIdx = 4; //44.1KHz | |
int chanCfg = 2; //CPE | |
// fill in ADTS data | |
packet[0] = (byte)0xFF; // conversion hexadecimal a decimal - il y a seize unités de 0 à F, on parle donc d'hexadécimal. | |
packet[1] = (byte)0xF1; // installe l'entete ADTS dans MPEG-2 (0xF1) au lieu de MPEG-4 (0xF9) | |
packet[2] = (byte)(((profile-1)<<6) + (freqIdx<<2) +(chanCfg>>2)); | |
packet[3] = (byte)(((chanCfg&3)<<6) + (packetLen>>11)); |
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
/* | |
* Copyright 2018 Google Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file | |
* except in compliance with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the | |
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
NewerOlder