Search in sources :

Example 1 with SettingsFragment

use of co.krypt.krypton.settings.SettingsFragment in project krypton-android by kryptco.

the class KnownHostsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_known_hosts, container, false);
    adapter = new KnownHostsRecyclerViewAdapter(getActivity(), new ArrayList<KnownHost>());
    RecyclerView recyclerView = (RecyclerView) root.findViewById(R.id.knownHostsList);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(adapter);
    Button doneButton = (Button) root.findViewById(R.id.doneButton);
    doneButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
            SettingsFragment settingsFragment = new SettingsFragment();
            transaction.setCustomAnimations(R.anim.instant, R.anim.exit_to_bottom).replace(R.id.fragmentOverlay, settingsFragment).commit();
            new Analytics(getContext()).postPageView("About");
        }
    });
    populateHosts();
    root.setTranslationZ(1);
    return root;
}
Also used : SettingsFragment(co.krypt.krypton.settings.SettingsFragment) FragmentTransaction(android.support.v4.app.FragmentTransaction) Button(android.widget.Button) ArrayList(java.util.ArrayList) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Analytics(co.krypt.krypton.analytics.Analytics)

Example 2 with SettingsFragment

use of co.krypt.krypton.settings.SettingsFragment in project krypton-android by kryptco.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    CrashReporting.startANRReporting();
    Notifications.setupNotificationChannels(getApplicationContext());
    silo = Silo.shared(getApplicationContext());
    startService(new Intent(this, BluetoothService.class));
    OnboardingProgress progress = new OnboardingProgress(getApplicationContext());
    if (new MeStorage(getApplicationContext()).load() == null || progress.inProgress()) {
        startActivity(new Intent(this, OnboardingActivity.class));
        finish();
        return;
    }
    if (ConnectionResult.SUCCESS != GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext())) {
    // TODO: warn about no push notifications, prompt to install google play services
    }
    setContentView(R.layout.activity_main);
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setOffscreenPageLimit(4);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);
    ImageButton settingsButton = (ImageButton) findViewById(R.id.settingsButton);
    settingsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            SettingsFragment settingsFragment = new SettingsFragment();
            transaction.setCustomAnimations(R.anim.enter_from_bottom, R.anim.exit_to_bottom, R.anim.enter_from_bottom, R.anim.exit_to_bottom).addToBackStack(null).replace(R.id.fragmentOverlay, settingsFragment).commit();
            new Analytics(getApplicationContext()).postPageView("About");
        }
    });
    ImageButton infoButton = (ImageButton) findViewById(R.id.infoButton);
    infoButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            HelpFragment helpFragment = new HelpFragment();
            transaction.setCustomAnimations(R.anim.enter_from_bottom, R.anim.exit_to_bottom, R.anim.enter_from_bottom, R.anim.exit_to_bottom).addToBackStack(null).replace(R.id.fragmentOverlay, helpFragment).commit();
            new Analytics(getApplicationContext()).postPageView("Help");
        }
    });
    if (getIntent() != null) {
        onNewIntent(getIntent());
    }
}
Also used : OnboardingActivity(co.krypt.krypton.onboarding.OnboardingActivity) TeamOnboardingActivity(co.krypt.krypton.team.onboarding.TeamOnboardingActivity) Intent(android.content.Intent) HelpFragment(co.krypt.krypton.help.HelpFragment) View(android.view.View) Analytics(co.krypt.krypton.analytics.Analytics) SettingsFragment(co.krypt.krypton.settings.SettingsFragment) ImageButton(android.widget.ImageButton) BluetoothService(co.krypt.krypton.transport.BluetoothService) FragmentTransaction(android.support.v4.app.FragmentTransaction) TabLayout(android.support.design.widget.TabLayout) MeStorage(co.krypt.krypton.me.MeStorage) OnboardingProgress(co.krypt.krypton.onboarding.OnboardingProgress)

Aggregations

FragmentTransaction (android.support.v4.app.FragmentTransaction)2 View (android.view.View)2 Analytics (co.krypt.krypton.analytics.Analytics)2 SettingsFragment (co.krypt.krypton.settings.SettingsFragment)2 Intent (android.content.Intent)1 TabLayout (android.support.design.widget.TabLayout)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Button (android.widget.Button)1 ImageButton (android.widget.ImageButton)1 HelpFragment (co.krypt.krypton.help.HelpFragment)1 MeStorage (co.krypt.krypton.me.MeStorage)1 OnboardingActivity (co.krypt.krypton.onboarding.OnboardingActivity)1 OnboardingProgress (co.krypt.krypton.onboarding.OnboardingProgress)1 TeamOnboardingActivity (co.krypt.krypton.team.onboarding.TeamOnboardingActivity)1 BluetoothService (co.krypt.krypton.transport.BluetoothService)1 ArrayList (java.util.ArrayList)1