2016-09-20 22:01:20 +00:00
|
|
|
package com.topjohnwu.magisk;
|
2016-08-21 13:29:42 +00:00
|
|
|
|
2017-01-26 19:38:53 +00:00
|
|
|
|
2016-08-21 15:21:37 +00:00
|
|
|
import android.os.Bundle;
|
2017-01-26 19:38:53 +00:00
|
|
|
import android.support.design.widget.TabLayout;
|
|
|
|
import android.support.v4.view.ViewPager;
|
2016-08-21 15:21:37 +00:00
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
2017-01-27 17:10:50 +00:00
|
|
|
import com.topjohnwu.magisk.adapters.TabFragmentAdapter;
|
2017-02-06 18:01:32 +00:00
|
|
|
import com.topjohnwu.magisk.components.Fragment;
|
2016-08-21 15:21:37 +00:00
|
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
|
import butterknife.ButterKnife;
|
2017-01-12 00:46:07 +00:00
|
|
|
import butterknife.Unbinder;
|
2016-08-21 15:21:37 +00:00
|
|
|
|
|
|
|
public class LogFragment extends Fragment {
|
|
|
|
|
2017-01-12 00:46:07 +00:00
|
|
|
private Unbinder unbinder;
|
2016-08-21 15:21:37 +00:00
|
|
|
|
2017-01-26 19:38:53 +00:00
|
|
|
@BindView(R.id.container) ViewPager viewPager;
|
|
|
|
@BindView(R.id.tab) TabLayout tab;
|
2016-08-21 15:21:37 +00:00
|
|
|
|
2017-01-11 21:22:55 +00:00
|
|
|
@Override
|
2017-01-26 19:38:53 +00: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);
|
|
|
|
unbinder = ButterKnife.bind(this, v);
|
2017-01-11 21:22:55 +00:00
|
|
|
|
2017-01-27 17:10:50 +00:00
|
|
|
TabFragmentAdapter adapter = new TabFragmentAdapter(getChildFragmentManager());
|
2016-08-21 15:21:37 +00:00
|
|
|
|
2017-01-26 19:38:53 +00:00
|
|
|
adapter.addTab(new MagiskLogFragment(), getString(R.string.magisk));
|
2016-08-21 15:21:37 +00:00
|
|
|
|
2017-02-06 18:01:32 +00:00
|
|
|
if (getApplication().isSuClient) {
|
2017-01-26 19:38:53 +00:00
|
|
|
adapter.addTab(new SuLogFragment(), getString(R.string.superuser));
|
|
|
|
tab.setupWithViewPager(viewPager);
|
|
|
|
tab.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2016-08-21 15:21:37 +00:00
|
|
|
|
2017-01-26 19:38:53 +00:00
|
|
|
viewPager.setAdapter(adapter);
|
2016-08-21 15:21:37 +00:00
|
|
|
|
2017-01-26 19:38:53 +00:00
|
|
|
return v;
|
2016-09-29 20:18:41 +00:00
|
|
|
}
|
|
|
|
|
2017-01-12 00:46:07 +00:00
|
|
|
@Override
|
|
|
|
public void onDestroyView() {
|
|
|
|
super.onDestroyView();
|
|
|
|
unbinder.unbind();
|
|
|
|
}
|
|
|
|
|
2016-08-21 13:29:42 +00:00
|
|
|
}
|