Added koin, databinding and navigation components

Converted App class and Main activity to Kotlin. With that refactored fields within App class to allow lazy initialization

BEWARE: at this point the navigation is very much broken, won't let you anywhere beyond home screen
This commit is contained in:
Viktor De Pasquale
2019-04-11 20:01:49 +02:00
parent e035523eb8
commit 2d58c725e0
32 changed files with 524 additions and 380 deletions
@@ -1,7 +1,6 @@
package com.topjohnwu.magisk.ui.log;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -10,7 +9,6 @@ import android.view.ViewGroup;
import com.google.android.material.tabs.TabLayout;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.model.adapters.TabFragmentAdapter;
import com.topjohnwu.magisk.ui.MainActivity;
import com.topjohnwu.magisk.ui.base.BaseFragment;
import androidx.viewpager.widget.ViewPager;
@@ -28,9 +26,9 @@ public class LogFragment extends BaseFragment {
View v = inflater.inflate(R.layout.fragment_log, container, false);
unbinder = new LogFragment_ViewBinding(this, v);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
/*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
((MainActivity) requireActivity()).toolbar.setElevation(0);
}
}*/
TabFragmentAdapter adapter = new TabFragmentAdapter(getChildFragmentManager());
@@ -42,7 +42,7 @@ public class SuLogFragment extends BaseFragment {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_su_log, container, false);
unbinder = new SuLogFragment_ViewBinding(this, v);
adapter = new SuLogAdapter(app.mDB);
adapter = new SuLogAdapter(app.getDB());
recyclerView.setAdapter(adapter);
updateList();
@@ -69,7 +69,7 @@ public class SuLogFragment extends BaseFragment {
updateList();
return true;
case R.id.menu_clear:
app.mDB.clearLogs();
app.getDB().clearLogs();
updateList();
return true;
default: