2018-01-18 04:15:50 +00:00
|
|
|
package cy.agorise.crystalwallet.fragments;
|
|
|
|
|
|
|
|
import android.os.Bundle;
|
2018-01-18 19:39:05 +00:00
|
|
|
import android.support.design.widget.TabLayout;
|
2018-01-18 04:15:50 +00:00
|
|
|
import android.support.v4.app.Fragment;
|
2018-01-18 19:39:05 +00:00
|
|
|
import android.support.v4.app.FragmentManager;
|
|
|
|
import android.support.v4.app.FragmentPagerAdapter;
|
|
|
|
import android.support.v4.view.ViewPager;
|
2018-01-18 04:15:50 +00:00
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
2018-01-18 19:39:05 +00:00
|
|
|
import butterknife.BindView;
|
2018-01-18 04:15:50 +00:00
|
|
|
import butterknife.ButterKnife;
|
|
|
|
import cy.agorise.crystalwallet.R;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by xd on 1/17/18.
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class SecuritySettingsFragment extends Fragment {
|
|
|
|
|
|
|
|
public SecuritySettingsFragment() {
|
|
|
|
// Required empty public constructor
|
|
|
|
}
|
|
|
|
|
|
|
|
public static SecuritySettingsFragment newInstance() {
|
|
|
|
SecuritySettingsFragment fragment = new SecuritySettingsFragment();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
fragment.setArguments(args);
|
|
|
|
return fragment;
|
|
|
|
}
|
|
|
|
|
2018-01-18 19:39:05 +00:00
|
|
|
@BindView(R.id.pager)
|
|
|
|
public ViewPager mPager;
|
|
|
|
|
|
|
|
public SecurityPagerAdapter securityPagerAdapter;
|
|
|
|
|
2018-01-18 04:15:50 +00:00
|
|
|
@Override
|
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
|
Bundle savedInstanceState) {
|
|
|
|
// Inflate the layout for this fragment
|
|
|
|
View v = inflater.inflate(R.layout.fragment_security_settings, container, false);
|
|
|
|
ButterKnife.bind(this, v);
|
|
|
|
|
2018-01-18 19:39:05 +00:00
|
|
|
securityPagerAdapter = new SecurityPagerAdapter(getChildFragmentManager());
|
|
|
|
mPager.setAdapter(securityPagerAdapter);
|
|
|
|
|
|
|
|
TabLayout tabLayout = v.findViewById(R.id.tabs);
|
|
|
|
|
|
|
|
mPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
|
|
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager));
|
|
|
|
|
2018-01-18 04:15:50 +00:00
|
|
|
return v;
|
|
|
|
}
|
2018-01-18 19:39:05 +00:00
|
|
|
|
|
|
|
private class SecurityPagerAdapter extends FragmentPagerAdapter {
|
|
|
|
SecurityPagerAdapter(FragmentManager fm) {
|
|
|
|
super(fm);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Fragment getItem(int position) {
|
|
|
|
switch (position){
|
|
|
|
case 0:
|
|
|
|
//return new GeneralSettingsFragment();
|
|
|
|
case 1:
|
2018-01-18 22:11:54 +00:00
|
|
|
return new PinSecurityFragment();
|
2018-01-18 19:39:05 +00:00
|
|
|
case 2:
|
|
|
|
return new BackupsSettingsFragment();
|
|
|
|
}
|
|
|
|
|
|
|
|
return null; //new OnConstructionFragment();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getCount() {
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
}
|
2018-01-18 04:15:50 +00:00
|
|
|
}
|