Skip to content

Commit 83deec7

Browse files
committed
Clean code
1 parent 078f429 commit 83deec7

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

app/src/main/java/com/infomaniak/drive/ui/fileList/preview/PreviewPDFActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class PreviewPDFActivity : AppCompatActivity() {
3131
override fun onCreate(savedInstanceState: Bundle?) {
3232
super.onCreate(savedInstanceState)
3333
setContentView(binding.root)
34-
val navController = setupNavController()
35-
navController.navigate(R.id.previewPDFFragment)
34+
setupNavController().navigate(R.id.previewPDFFragment)
3635
}
3736

3837
private fun getNavHostFragment() = supportFragmentManager.findFragmentById(R.id.hostFragment) as NavHostFragment

app/src/main/java/com/infomaniak/drive/ui/fileList/preview/PreviewPDFFragment.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ class PreviewPDFFragment : PreviewFragment() {
180180
}
181181

182182
private fun getConfigurator(uriString: String?, pdfFile: IOFile?): PDFView.Configurator {
183-
return uriString?.let {
184-
binding.pdfView.fromUri(Uri.parse(uriString))
185-
} ?: binding.pdfView.fromFile(pdfFile)
183+
return uriString?.let { binding.pdfView.fromUri(Uri.parse(uriString)) } ?: binding.pdfView.fromFile(pdfFile)
186184
}
187185

188186
private fun onPdfPasswordError() {

app/src/main/res/layout/activity_preview_pdf.xml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,10 @@
1515
~ You should have received a copy of the GNU General Public License
1616
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
-->
18-
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
18+
<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
1919
xmlns:app="http://schemas.android.com/apk/res-auto"
20+
android:id="@+id/hostFragment"
21+
android:name="androidx.navigation.fragment.NavHostFragment"
2022
android:layout_width="match_parent"
21-
android:layout_height="match_parent">
22-
23-
<androidx.fragment.app.FragmentContainerView
24-
android:id="@+id/hostFragment"
25-
android:name="androidx.navigation.fragment.NavHostFragment"
26-
android:layout_width="match_parent"
27-
android:layout_height="0dp"
28-
app:defaultNavHost="true"
29-
app:layout_constraintBottom_toBottomOf="parent"
30-
app:layout_constraintEnd_toEndOf="parent"
31-
app:layout_constraintStart_toStartOf="parent"
32-
app:layout_constraintTop_toTopOf="parent" />
33-
34-
</androidx.constraintlayout.widget.ConstraintLayout>
23+
android:layout_height="match_parent"
24+
app:defaultNavHost="true" />

0 commit comments

Comments
 (0)