diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-12-11 10:18:06 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-12-11 10:18:06 +0100 |
commit | 49653f7c3811a29afc92b3def7430e962a39fe0b (patch) | |
tree | 74460916357ae9f0dd1849290d29881f3a4f423b /src/de/blinkt/openvpn/MainActivity.java | |
parent | ce1dba9a001049264449eadd138a9b1d93eccba3 (diff) |
Move activities and views into packages
--HG--
rename : src/de/blinkt/openvpn/ConfigConverter.java => src/de/blinkt/openvpn/activities/ConfigConverter.java
rename : src/de/blinkt/openvpn/app/CreateShortcuts.java => src/de/blinkt/openvpn/activities/CreateShortcuts.java
rename : src/de/blinkt/openvpn/DisconnectVPN.java => src/de/blinkt/openvpn/activities/DisconnectVPN.java
rename : src/de/blinkt/openvpn/FileSelect.java => src/de/blinkt/openvpn/activities/FileSelect.java
rename : src/de/blinkt/openvpn/LogWindow.java => src/de/blinkt/openvpn/activities/LogWindow.java
rename : src/de/blinkt/openvpn/MainActivity.java => src/de/blinkt/openvpn/activities/MainActivity.java
rename : src/de/blinkt/openvpn/FileSelectLayout.java => src/de/blinkt/openvpn/views/FileSelectLayout.java
rename : src/de/blinkt/openvpn/RemoteCNPreference.java => src/de/blinkt/openvpn/views/RemoteCNPreference.java
rename : src/de/blinkt/openvpn/fragments/SeekBarTicks.java => src/de/blinkt/openvpn/views/SeekBarTicks.java
extra : rebase_source : fccff1bc269dbc0ae33b96a4947b8a6e2924efeb
Diffstat (limited to 'src/de/blinkt/openvpn/MainActivity.java')
-rw-r--r-- | src/de/blinkt/openvpn/MainActivity.java | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/src/de/blinkt/openvpn/MainActivity.java b/src/de/blinkt/openvpn/MainActivity.java deleted file mode 100644 index e1d417ca..00000000 --- a/src/de/blinkt/openvpn/MainActivity.java +++ /dev/null @@ -1,101 +0,0 @@ -package de.blinkt.openvpn; - -import android.app.ActionBar; -import android.app.ActionBar.Tab; -import android.app.Activity; -import android.app.Fragment; -import android.app.FragmentTransaction; -import android.content.Intent; -import de.blinkt.openvpn.fragments.*; - - -public class MainActivity extends Activity { - - protected void onCreate(android.os.Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - ActionBar bar = getActionBar(); - bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - - Tab vpnListTab = bar.newTab().setText(R.string.vpn_list_title); - Tab generalTab = bar.newTab().setText(R.string.generalsettings); - Tab faqtab = bar.newTab().setText(R.string.faq); - Tab abouttab = bar.newTab().setText(R.string.about); - - vpnListTab.setTabListener(new TabListener<VPNProfileList>("profiles", VPNProfileList.class)); - generalTab.setTabListener(new TabListener<GeneralSettings>("settings", GeneralSettings.class)); - faqtab.setTabListener(new TabListener<FaqFragment>("faq", FaqFragment.class)); - abouttab.setTabListener(new TabListener<AboutFragment>("about", AboutFragment.class)); - - bar.addTab(vpnListTab); - bar.addTab(generalTab); - bar.addTab(faqtab); - bar.addTab(abouttab); - - if (false) { - Tab logtab = bar.newTab().setText("Log"); - logtab.setTabListener(new TabListener<LogFragment>("log", LogFragment.class)); - bar.addTab(logtab); - } - - if(SendDumpFragment.getLastestDump(this)!=null) { - Tab sendDump = bar.newTab().setText(R.string.crashdump); - sendDump.setTabListener(new TabListener<SendDumpFragment>("crashdump",SendDumpFragment.class)); - bar.addTab(sendDump); - } - - } - - protected class TabListener<T extends Fragment> implements ActionBar.TabListener - { - private Fragment mFragment; - private String mTag; - private Class<T> mClass; - - public TabListener(String tag, Class<T> clz) { - mTag = tag; - mClass = clz; - - // Check to see if we already have a fragment for this tab, probably - // from a previously saved state. If so, deactivate it, because our - // initial state is that a tab isn't shown. - mFragment = getFragmentManager().findFragmentByTag(mTag); - if (mFragment != null && !mFragment.isDetached()) { - FragmentTransaction ft = getFragmentManager().beginTransaction(); - ft.detach(mFragment); - ft.commit(); - } - } - - public void onTabSelected(Tab tab, FragmentTransaction ft) { - if (mFragment == null) { - mFragment = Fragment.instantiate(MainActivity.this, mClass.getName()); - ft.add(android.R.id.content, mFragment, mTag); - } else { - ft.attach(mFragment); - } - } - - public void onTabUnselected(Tab tab, FragmentTransaction ft) { - if (mFragment != null) { - ft.detach(mFragment); - } - } - - - @Override - public void onTabReselected(Tab tab, FragmentTransaction ft) { - - } - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - System.out.println(data); - - - } - - -} |