-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from rommansabbir/dev
Fixed issue (feature update request) (#13)
- Loading branch information
Showing
10 changed files
with
98 additions
and
48 deletions.
There are no files selected for viewing
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
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
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
43 changes: 43 additions & 0 deletions
43
NetworkX/src/main/java/com/rommansabbir/networkx/dialog/NoInternetDialogV2.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.rommansabbir.networkx.dialog | ||
|
||
import android.app.Activity | ||
import android.app.Dialog | ||
import com.rommansabbir.networkx.R | ||
import com.rommansabbir.networkx.databinding.ContentDialogNoInternetBinding | ||
import com.rommansabbir.networkx.extension.getDialogInstance | ||
import java.lang.ref.WeakReference | ||
|
||
class NoInternetDialogV2 constructor( | ||
private val activity: WeakReference<Activity>, | ||
private val title: String, | ||
private val message: String, | ||
private val buttonTitle: String, | ||
private val isCancelable: Boolean, | ||
private val callback: () -> Unit | ||
) { | ||
init { | ||
activity.get()?.let { | ||
getDialogInstance<ContentDialogNoInternetBinding>( | ||
it, | ||
R.layout.content_dialog_no_internet, | ||
R.style.my_dialog, | ||
isCancelable | ||
) { dialog, binding -> | ||
NoInternetDialogV2.dialog = dialog | ||
binding.cdniBtnRetry.text = buttonTitle | ||
binding.cdniTvTitle.text = title | ||
binding.cdniTvMessage.text = message | ||
NoInternetDialogV2.dialog?.setOnDismissListener { | ||
NoInternetDialogV2.dialog = null | ||
} | ||
binding.cdniBtnRetry.setOnClickListener { callback.invoke();NoInternetDialogV2.dialog?.cancel() } | ||
NoInternetDialogV2.dialog?.show() | ||
} | ||
} ?: kotlin.run { dialog = null } | ||
} | ||
|
||
companion object { | ||
private var dialog: Dialog? = null | ||
val isVisible: Boolean = dialog != null && dialog!!.isShowing | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
NetworkX/src/main/java/com/rommansabbir/networkx/exceptions/NoInternetDialogException.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package com.rommansabbir.networkx.exceptions | ||
|
||
@Deprecated("Deprecated. Use NetworkXProvider instead") | ||
class NoInternetDialogException : | ||
Exception("Activity reference is required to build an instance of NoInternetDialog") { | ||
} |
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
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
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
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
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