-
Notifications
You must be signed in to change notification settings - Fork 1
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 #50 from emreesen27/external-sup
[DEV][Dialog UI Imp]
- Loading branch information
Showing
17 changed files
with
167 additions
and
285 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/sn/snfilemanager/core/base/BaseDialog.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,59 @@ | ||
package com.sn.snfilemanager.core.base | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.constraintlayout.widget.ConstraintLayout | ||
import androidx.fragment.app.DialogFragment | ||
import androidx.fragment.app.FragmentManager | ||
import androidx.viewbinding.ViewBinding | ||
import com.sn.snfilemanager.R | ||
|
||
abstract class BaseDialog<VBinding : ViewBinding> : DialogFragment() { | ||
protected lateinit var binding: VBinding | ||
|
||
protected abstract fun getViewBinding(): VBinding | ||
|
||
open var setCancelable: Boolean = true | ||
|
||
protected abstract val dialogTag: String | ||
|
||
open fun setupViews() {} | ||
|
||
fun showDialog(fragmentManager: FragmentManager) { | ||
show(fragmentManager, dialogTag) | ||
} | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
dialog?.window?.setLayout( | ||
ConstraintLayout.LayoutParams.MATCH_PARENT, | ||
ConstraintLayout.LayoutParams.WRAP_CONTENT, | ||
) | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = getViewBinding() | ||
isCancelable = setCancelable | ||
setStyle(STYLE_NO_TITLE, R.style.DialogTheme_transparent) | ||
dialog?.window?.setBackgroundDrawableResource(R.drawable.dialog_rounded) | ||
} | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View? { | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated( | ||
view: View, | ||
savedInstanceState: Bundle?, | ||
) { | ||
super.onViewCreated(view, savedInstanceState) | ||
setupViews() | ||
} | ||
} |
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
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
Oops, something went wrong.