This file contains 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
package io.github.darvld.utils | |
import androidx.compose.animation.* | |
import androidx.compose.animation.core.ExperimentalTransitionApi | |
import androidx.compose.animation.core.MutableTransitionState | |
import androidx.compose.foundation.lazy.LazyListScope | |
import androidx.compose.foundation.lazy.items | |
import androidx.compose.runtime.* | |
import androidx.recyclerview.widget.AsyncListDiffer | |
import androidx.recyclerview.widget.DiffUtil |
This file contains 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
package cu.spin.catalog.ui.components | |
import android.annotation.SuppressLint | |
import androidx.compose.animation.core.animateFloat | |
import androidx.compose.animation.core.updateTransition | |
import androidx.compose.runtime.State | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.composed | |
import androidx.compose.ui.draw.drawWithCache | |
import androidx.compose.ui.geometry.Offset |
This file contains 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 2020 The Android Open Source Project | |
* | |
* 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 | |
* | |
* https://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains 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
package io.github.darvld.utils | |
/**Base class for components representing the result of the user's interaction with a dialog. | |
* | |
* To trigger the dialog and obtain the result, use [await]. | |
* | |
* Note that, since this class provides no UI implementation, [complete] must be manually called from UI code. This is | |
* typically achieved by showing a dialog when [isAwaiting] is `true`, and using a callback to invoke [complete].*/ | |
interface DialogResult<T> { | |
/**Whether the dialog is currently pending user interaction. |
This file contains 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
# Simple hill-climbing algorithm using the steepest-ascent variant | |
def perform_step(current: list, goal: list) -> (list, int): | |
# Keep track of the best candidate so far (steepest-ascent) | |
successor = current | |
successor_weight = -1 | |
for i in range(0, len(current) - 1): | |
# Generate a new state and calculate the weight | |
candidate = swapped(current, i, i + 1) | |
candidate_weight = calculate_weight(candidate, goal) |