MaterialYouFileExplorer
A file explorer with the style of Material You.
Use this library to select files/directories quickly.
Implementation
- Enable
mavenCentral()
insettings.gradle
repositories {
......
mavenCentral()
}
- Implementation
implementation 'io.github.xayahsususu:materialyoufileexplorer:1.0.6'
Usage
- Initialize in
onCreate()
val materialYouFileExplorer = MaterialYouFileExplorer()
materialYouFileExplorer.initialize(this)
- Start the explorer activity and handle callback
materialYouFileExplorer.toExplorer(this, isFile) { path, isFile ->
// Code here
}
Custom title
materialYouFileExplorer.toExplorer(this, isFile, "Custom Title") { path, isFile ->
// Code here
}
Sample
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
val materialYouFileExplorer = MaterialYouFileExplorer()
materialYouFileExplorer.initialize(this)
binding.filledButton.setOnClickListener {
materialYouFileExplorer.toExplorer(
this, binding.radioButtonFile.isChecked, "Custom Title"
) { path, _ -> binding.textInputEditText.setText(path) }
}
}
}