Kamil Kalisz
02/02/2021, 3:25 PMSimone Summo
02/02/2021, 4:13 PMMark
02/03/2021, 10:57 AMFlow
. However, I prefer to work directly with the support library APIs. How to convert a generic query to a Flow
(either using a 3rd party library or building from scratch)?Rodri Represa
02/03/2021, 1:48 PMrecyclerview
with some cards (height = match_parent
) but i would like to add a marginBottom
only in case the android device screen is big (example 20:9). How can i do that?Slackbot
02/03/2021, 1:55 PMGiovani Guerra
02/03/2021, 5:39 PMstatic {
AppCompatDelegate.setDefaultNightMode(
AppCompatDelegate.MODE_NIGHT_NO);
}
public class MyApplication extends Application {
}
myanmarking
02/04/2021, 1:20 PMAndré Thiele
02/04/2021, 9:57 PMCarlos Bedoy
02/05/2021, 1:34 AMkotlinx.synthetic
, (yeah! but is deprecated now), hence we start to migrate to viewBinding (honestly much better), but I’m facing next issue.
I have a fragment such contains a MapFragment itself like this..
<androidx.cardview.widget.CardView
android:visibility="visible"
.....
app:layout_constraintTop_toTopOf="parent">
<fragment
android:id="@+id/onTheWayMap"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.cardview.widget.CardView>
Before with kotlinx.syntheti
we only invoke following lines:
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? = inflater.inflate(R.layout.a_fragment, container, false)
val mapFragment = childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
mapFragment?.getMapAsync { //mapFragments never null
googleMap = it
...
Since we’re migrating to viewBinding
, keeping same code above, mapFragment always is null, anyone here had faced same issue?, do you guys know how to fixed?, what can be wrong?
private val binding by lazy {
FragmentOnTheWayBinding.inflate(LayoutInflater.from(context))
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? = binding.root
val mapFragment = childFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
mapFragment?.getMapAsync { //always null
googleMap = it
tank777
02/05/2021, 4:08 AMMethod m = device.getClass().getMethod("removeBond", (Class[]) null);
m.invoke(device, (Object[]) null);
Tiago Nunes
02/05/2021, 11:34 AMFlorian
02/05/2021, 3:19 PMval bookmarks = repository.getAllBookmarkedArticles()
.stateIn(viewModelScope, SharingStarted.Lazily, emptyList())
Is it bad to initialize with emptyList()
? This is data from Room, hence it has no loading stateTravis Griggs
02/05/2021, 8:57 PMWukongRework.exe
02/06/2021, 12:26 AMoverride val keys: Keys get() = GamePadKeysOld(gamepad = gamepad)
and it gives me a Sealed types cannot be instantiated
error when building the android app
I tried a small test case in a kotlin playground ( https://pl.kotl.in/8VWvKtOqm ) and set both versions to 1.4.30 and in the playground the error does not pop up and successfully runs
Is there a reason for this and a way to fix? (I would like to keep it as an invoke call though just changing the function name is the solution I am currently using)
Thanks in advance!Jason
02/06/2021, 1:46 AMDuration.toMinutespart
is very useful in Java . Why Kotlin does not have such of this useful function ???Jason
02/06/2021, 1:47 AMmm:ss
such as : 300 seconds -> 05:00
Law Gimenez
02/06/2021, 1:06 PMİsmail KOYUNCU
02/06/2021, 3:22 PMJoshua
02/06/2021, 4:15 PMTiago Nunes
02/06/2021, 8:36 PMval args: SomeFragmentArgs by navArgs()
Does the args
field keep its values after the activity gets killed by the system and recreated?
In other words: does the Bundle sent to the Fragment survive?
CheersFlorian
02/06/2021, 10:25 PMstateIn
operator so that a Flow that starts fetching new data doesn't cancel when we switch screens. But after that remote fetch is done, the Flow will keep emitting cached data from the DB (which could get updated indirectly from another screen) even if the fragment is not active.Mostafa Hadian
02/07/2021, 12:53 AMTiago Nunes
02/07/2021, 4:36 PM@Singleton
class UserApplicationPreferencesRepository @Inject constructor(
private val dao: UserApplicationPreferencesDao,
){
var loggedInUserPreferences: UserApplicationPreferences? = null
private set
init {
CoroutineScope(SupervisorJob() + <http://Dispatchers.IO|Dispatchers.IO>).launch {
dao.getLoggedInFlow().collect {
loggedInUserPreferences = it
}
}
}
}
loloof64
02/08/2021, 9:59 AMSlackbot
02/08/2021, 1:04 PMJoshua
02/08/2021, 1:07 PM<style name="OrangeButtonPrimary">
<item name="android:textColor">@color/white</item>
<item name="cornerRadius">8dp</item>
<item name="backgroundColor">#FC7E2F</item>
<item name="android:textAllCaps">true</item>
</style>
However, when I add the style to my button nothing happens. I am therefor wondering whether I did something wrong or not?Abhinav Bhadauria
02/08/2021, 2:23 PMTiago Nunes
02/08/2021, 6:33 PMplugins {
id "org.jetbrains.kotlin.android" version "$kotlin_version"
}
I love the fact that it doesn't require me to change the classpath in project-level build.gradle
...But, does it work for every plugin? If it does, how would I do this?
id "androidx.navigation.safeargs.kotlin" version "2.3.3"
(Plugin [id: 'androidx.navigation.safeargs.kotlin', version: '2.3.3'] was not found in any of the following sources:)Vivek Sharma
02/09/2021, 1:58 PM2 flows
and I want to observe their changes with flatMapLatest
, if either of them emit new value, I want to trigger some action, but how can I observe on 2 flows
, should I combine them ? how can I do itLucien Guimaraes
02/09/2021, 5:14 PMLucien Guimaraes
02/09/2021, 5:14 PMLarry Schiefer
02/09/2021, 5:19 PMPERMISSION_DENIED
then calling .shouldShowRequestPermissionRationale()
which will tell you if it is acceptable for you to tell the user why the permission is needed. Note that method will return false
if you have never requested the permission - you have to have requested it and it been denied before it will return true
.Lucien Guimaraes
02/09/2021, 5:27 PMshouldShowRequestPermissionRationale
on the official documentation but it wasn't clear that it will return true
if the permission was already asked.