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
FirebaseMessaging.getInstance().token.addOnCompleteListener(OnCompleteListener { task -> | |
if (!task.isSuccessful) { | |
Log.w("TAG", "Fetching FCM registration token failed", task.exception) | |
return@OnCompleteListener | |
} | |
val token = task.result | |
Log.i("token",token) | |
}) |
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
//BaseFragment | |
abstract class BaseFragment<T : ViewBinding> : Fragment() { | |
private var _binding: T? = null | |
private val binding get() = _binding!! | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, |
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
fun showHidePassword(editText: EditText, imageView: ImageView, context: Context) { | |
if (boolPassword) { | |
editText.transformationMethod = HideReturnsTransformationMethod.getInstance() | |
imageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_p_eye_off)) | |
} else { | |
editText.transformationMethod = PasswordTransformationMethod.getInstance() | |
imageView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_p_eye)) | |
} | |
boolPassword = !boolPassword | |
} |
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
//Java | |
Glide.with(getApplicationContext()) | |
.asBitmap() | |
.load(imgUrl) // url | |
.into(new CustomTarget<Bitmap>(150, 150) { | |
@Override | |
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { | |
image.setImageBitmap(resource); //imageview set bitmap | |
} |
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
//Util class | |
import android.annotation.TargetApi | |
import android.content.BroadcastReceiver | |
import android.content.Context | |
import android.content.Context.CONNECTIVITY_SERVICE | |
import android.content.Intent | |
import android.net.* | |
import android.os.Build | |
import androidx.lifecycle.LiveData |
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 com.astopia.app.utils | |
import android.content.Context | |
import android.util.Log | |
import com.google.android.gms.common.GoogleApiAvailability | |
object PlatformUtil { | |
fun getPlatformType(context: Context): PlatformType { | |
return when { |
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
100% — FF | |
95% — F2 | |
90% — E6 | |
85% — D9 | |
80% — CC | |
75% — BF | |
70% — B3 | |
65% — A6 | |
60% — 99 | |
55% — 8C |
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
* Let fonksiyonu genel amacı değişkenlerin null kontrolü yapmak için kullanılır. | |
Let fonksiyonunda bulanan it kelimesi kullanılan değişkeni kapsar | |
* run fonksiyonu içinde aynı değişken isimleri kullanılabilir, değişkenin özelliklerine doğrudan erişim yapabiliriz. | |
* also fonksiyonu çağırılan nesne üzerinde değişiklik yapar ama aynı nesneyi geri gönderir. | |
* apply fonksiyonu geriye kullandığı nesneyi döndürür. It kullanılmaz | |
* with fonksiyonu apply benzer, this gerek yoktur | |
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
pragma solidity >=0.4.22 <0.6.0; | |
interface tokenRecipient { | |
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; | |
} | |
contract TokenERC20 { | |
// Public variables of the token | |
string public name; | |
string public symbol; |