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
| import UserNotifications | |
| class NotificationService: UNNotificationServiceExtension { | |
| var contentHandler: ((UNNotificationContent) -> Void)? | |
| var bestAttemptContent: UNMutableNotificationContent? | |
| override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { | |
| self.contentHandler = contentHandler | |
| bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) |
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
| val clickListener = View.OnClickListener {view -> | |
| when (view.getId()) { | |
| R.id.textview -> firstFun() | |
| R.id.button -> secondFun() | |
| } | |
| } |
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
| 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 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
| //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 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
| 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 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
| //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 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
| //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 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
| 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 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
| 100% — FF | |
| 95% — F2 | |
| 90% — E6 | |
| 85% — D9 | |
| 80% — CC | |
| 75% — BF | |
| 70% — B3 | |
| 65% — A6 | |
| 60% — 99 | |
| 55% — 8C |