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
object ImageDownloadHelper { | |
fun downloadAndSaveImageToCache(imageUrl: String): File? { | |
val cacheDir = applicationContext.cacheDir | |
val imageFile = File(cacheDir, generateUniqueFileName()) | |
val inputStream = | |
openInputStreamFromUrl(imageUrl) // Implement openInputStreamFromUrl function | |
if (inputStream != null) { |
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
class InAppReviewHelper(val context: Activity, val dialogContext: DialogFragment) { | |
val reviewManager = ReviewManagerFactory.create(AlignableApplication.instance) | |
val request: Task<ReviewInfo> = reviewManager.requestReviewFlow() | |
var reviewlnfo: ReviewInfo? = null | |
fun getReviewInfo(supportFragmentManager: FragmentManager) { | |
request.addOnCompleteListener { task -> | |
if (task.isSuccessful) { |
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
class MainActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityMainBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
binding = ActivityMainBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
val list = ArrayList<String>() | |
list.add("https://www.gstatic.com/webp/gallery/1.jpg") |
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
public class TinderPageTransformer implements ViewPager.PageTransformer { | |
private int mScaleOffset = 40; | |
public void setScaleOffset(int mScaleOffset) { | |
this.mScaleOffset = mScaleOffset; | |
} | |
public void transformPage(View page, float position) { | |
if (position <= 0.0f) { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:clipChildren="false" | |
android:orientation="vertical"> | |
<androidx.viewpager.widget.ViewPager |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/cardView" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
app:cardCornerRadius="20dp" | |
app:cardElevation="15dp" | |
app:cardUseCompatPadding="true"> |
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
public class AlphaAndScalePageTransformer implements ViewPager.PageTransformer { | |
final float SCALE_MAX = 0.8f; | |
final float ALPHA_MAX = 0.5f; | |
@Override | |
public void transformPage(@NonNull View page, float position) { | |
float scale = (position < 0) | |
? ((1 - SCALE_MAX) * position + 1) | |
: ((SCALE_MAX - 1) * position + 1); |
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
class MainActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityMainBinding | |
companion object { | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
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
class MyPagerAdapter(private val items: List<String>, private val context: Context) : | |
PagerAdapter() { | |
override fun instantiateItem(container: ViewGroup, position: Int): Any { | |
val inflater = LayoutInflater.from(container.context) | |
val view = inflater.inflate(R.layout.recycler_item, container, false) | |
val item = items[position] | |
// Set up views |
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
private fun handleResult(intent: Intent?) { | |
when (intent.containsFileResult()) { | |
true -> browseFilesDelegate.handleResult(intent) { sendResult(it) } | |
else -> cameraCaptureDelegate.handleResult { sendResult(it) } | |
} | |
} | |
private fun sendResult(results: Array<Uri>?) { | |
uploadCallback?.onReceiveValue(results) | |
uploadCallback = null |
NewerOlder