Magisk/app/src/main/java/com/topjohnwu/magisk/LogFragment.java

56 lines
1.5 KiB
Java
Raw Normal View History

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;
import butterknife.Unbinder;
2016-08-21 15:21:37 +00:00
public class LogFragment extends Fragment {
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
@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);
((MainActivity) getActivity()).toolbar.setElevation(0);
2017-01-27 17:10:50 +00:00
TabFragmentAdapter adapter = new TabFragmentAdapter(getChildFragmentManager());
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-04-25 16:27:55 +00:00
adapter.addTab(new MagiskLogFragment(), getString(R.string.magisk));
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;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
2016-08-21 13:29:42 +00:00
}