2018-08-30 03:57:48 -04:00
|
|
|
package com.topjohnwu.magisk.fragments;
|
2016-08-21 15:29:42 +02:00
|
|
|
|
2017-01-27 03:38:53 +08:00
|
|
|
|
2016-08-21 17:21:37 +02:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
2018-09-10 02:27:45 -04:00
|
|
|
import com.google.android.material.tabs.TabLayout;
|
2018-08-30 03:57:48 -04:00
|
|
|
import com.topjohnwu.magisk.Const;
|
|
|
|
import com.topjohnwu.magisk.Data;
|
|
|
|
import com.topjohnwu.magisk.MainActivity;
|
|
|
|
import com.topjohnwu.magisk.R;
|
2018-09-14 23:00:39 -04:00
|
|
|
import com.topjohnwu.magisk.ViewBinder;
|
2017-01-28 01:10:50 +08:00
|
|
|
import com.topjohnwu.magisk.adapters.TabFragmentAdapter;
|
2018-08-01 17:57:11 +08:00
|
|
|
import com.topjohnwu.magisk.components.BaseFragment;
|
2016-08-21 17:21:37 +02:00
|
|
|
|
2018-09-10 02:27:45 -04:00
|
|
|
import androidx.viewpager.widget.ViewPager;
|
2016-08-21 17:21:37 +02:00
|
|
|
|
2018-08-01 17:57:11 +08:00
|
|
|
public class LogFragment extends BaseFragment {
|
2016-08-21 17:21:37 +02:00
|
|
|
|
2018-09-14 23:00:39 -04:00
|
|
|
public ViewPager viewPager;
|
|
|
|
public TabLayout tab;
|
2016-08-21 17:21:37 +02:00
|
|
|
|
2017-01-11 22:22:55 +01:00
|
|
|
@Override
|
2017-01-27 03:38:53 +08:00
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
|
Bundle savedInstanceState) {
|
|
|
|
// Inflate the layout for this fragment
|
|
|
|
View v = inflater.inflate(R.layout.fragment_log, container, false);
|
2018-09-14 23:00:39 -04:00
|
|
|
ViewBinder.bind(this, v);
|
2017-01-11 22:22:55 +01:00
|
|
|
|
2018-08-30 03:57:48 -04:00
|
|
|
((MainActivity) requireActivity()).toolbar.setElevation(0);
|
2017-07-23 00:47:54 +08:00
|
|
|
|
2017-01-28 01:10:50 +08:00
|
|
|
TabFragmentAdapter adapter = new TabFragmentAdapter(getChildFragmentManager());
|
2016-08-21 17:21:37 +02:00
|
|
|
|
2018-07-31 17:41:54 +08:00
|
|
|
if (!(Const.USER_ID > 0 && Data.multiuserMode == Const.Value.MULTIUSER_MODE_OWNER_MANAGED)) {
|
2017-12-12 02:35:00 +08:00
|
|
|
adapter.addTab(new SuLogFragment(), getString(R.string.superuser));
|
|
|
|
}
|
2017-04-26 00:27:55 +08:00
|
|
|
adapter.addTab(new MagiskLogFragment(), getString(R.string.magisk));
|
2017-11-09 01:11:50 +08:00
|
|
|
tab.setupWithViewPager(viewPager);
|
|
|
|
tab.setVisibility(View.VISIBLE);
|
2017-04-26 00:27:55 +08:00
|
|
|
|
2017-01-27 03:38:53 +08:00
|
|
|
viewPager.setAdapter(adapter);
|
2016-08-21 17:21:37 +02:00
|
|
|
|
2017-01-27 03:38:53 +08:00
|
|
|
return v;
|
2016-09-29 22:18:41 +02:00
|
|
|
}
|
|
|
|
|
2017-01-12 01:46:07 +01:00
|
|
|
@Override
|
|
|
|
public void onDestroyView() {
|
|
|
|
super.onDestroyView();
|
2018-09-14 23:00:39 -04:00
|
|
|
ViewBinder.unbind(this);
|
2017-01-12 01:46:07 +01:00
|
|
|
}
|
2016-08-21 15:29:42 +02:00
|
|
|
}
|