diff --git a/HackMetro/.classpath b/HackMetro/.classpath new file mode 100644 index 0000000..7bc01d9 --- /dev/null +++ b/HackMetro/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/HackMetro/.gitignore b/HackMetro/.gitignore new file mode 100644 index 0000000..a02fbbe --- /dev/null +++ b/HackMetro/.gitignore @@ -0,0 +1,2 @@ +/gen +/bin diff --git a/HackMetro/.project b/HackMetro/.project new file mode 100644 index 0000000..eb72ad7 --- /dev/null +++ b/HackMetro/.project @@ -0,0 +1,33 @@ + + + HackMetro + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/HackMetro/AndroidManifest.xml b/HackMetro/AndroidManifest.xml new file mode 100644 index 0000000..5cda3c8 --- /dev/null +++ b/HackMetro/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + diff --git a/HackMetro/ic_launcher-web.png b/HackMetro/ic_launcher-web.png new file mode 100644 index 0000000..a18cbb4 Binary files /dev/null and b/HackMetro/ic_launcher-web.png differ diff --git a/HackMetro/proguard-project.txt b/HackMetro/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/HackMetro/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/HackMetro/project.properties b/HackMetro/project.properties new file mode 100644 index 0000000..ce39f2d --- /dev/null +++ b/HackMetro/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-18 diff --git a/HackMetro/res/drawable-hdpi/ic_launcher.png b/HackMetro/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..288b665 Binary files /dev/null and b/HackMetro/res/drawable-hdpi/ic_launcher.png differ diff --git a/HackMetro/res/drawable-mdpi/ic_launcher.png b/HackMetro/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..6ae570b Binary files /dev/null and b/HackMetro/res/drawable-mdpi/ic_launcher.png differ diff --git a/HackMetro/res/drawable-xhdpi/ic_launcher.png b/HackMetro/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..d4fb7cd Binary files /dev/null and b/HackMetro/res/drawable-xhdpi/ic_launcher.png differ diff --git a/HackMetro/res/drawable-xxhdpi/ic_launcher.png b/HackMetro/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..85a6081 Binary files /dev/null and b/HackMetro/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/HackMetro/res/layout/activity_main.xml b/HackMetro/res/layout/activity_main.xml new file mode 100644 index 0000000..d9b6371 --- /dev/null +++ b/HackMetro/res/layout/activity_main.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/HackMetro/res/layout/fragment_main_dummy.xml b/HackMetro/res/layout/fragment_main_dummy.xml new file mode 100644 index 0000000..e6854b5 --- /dev/null +++ b/HackMetro/res/layout/fragment_main_dummy.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/HackMetro/res/menu/main.xml b/HackMetro/res/menu/main.xml new file mode 100644 index 0000000..c002028 --- /dev/null +++ b/HackMetro/res/menu/main.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/HackMetro/res/values-sw600dp/dimens.xml b/HackMetro/res/values-sw600dp/dimens.xml new file mode 100644 index 0000000..44f01db --- /dev/null +++ b/HackMetro/res/values-sw600dp/dimens.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/HackMetro/res/values-sw720dp-land/dimens.xml b/HackMetro/res/values-sw720dp-land/dimens.xml new file mode 100644 index 0000000..61e3fa8 --- /dev/null +++ b/HackMetro/res/values-sw720dp-land/dimens.xml @@ -0,0 +1,9 @@ + + + + 128dp + + diff --git a/HackMetro/res/values-v11/styles.xml b/HackMetro/res/values-v11/styles.xml new file mode 100644 index 0000000..3c02242 --- /dev/null +++ b/HackMetro/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/HackMetro/res/values-v14/styles.xml b/HackMetro/res/values-v14/styles.xml new file mode 100644 index 0000000..a91fd03 --- /dev/null +++ b/HackMetro/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/HackMetro/res/values/dimens.xml b/HackMetro/res/values/dimens.xml new file mode 100644 index 0000000..55c1e59 --- /dev/null +++ b/HackMetro/res/values/dimens.xml @@ -0,0 +1,7 @@ + + + + 16dp + 16dp + + diff --git a/HackMetro/res/values/strings.xml b/HackMetro/res/values/strings.xml new file mode 100644 index 0000000..db73117 --- /dev/null +++ b/HackMetro/res/values/strings.xml @@ -0,0 +1,10 @@ + + + + HackMetro + Settings + Section 1 + Section 2 + Section 3 + + diff --git a/HackMetro/res/values/styles.xml b/HackMetro/res/values/styles.xml new file mode 100644 index 0000000..6ce89c7 --- /dev/null +++ b/HackMetro/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/HackMetro/src/com/github/ignazio1977/hackmetro/MainActivity.java b/HackMetro/src/com/github/ignazio1977/hackmetro/MainActivity.java new file mode 100644 index 0000000..43c5c75 --- /dev/null +++ b/HackMetro/src/com/github/ignazio1977/hackmetro/MainActivity.java @@ -0,0 +1,130 @@ +package com.github.ignazio1977.hackmetro; + +import java.util.Locale; + + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentActivity; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentPagerAdapter; +import android.support.v4.app.NavUtils; +import android.support.v4.view.ViewPager; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class MainActivity extends FragmentActivity { + + /** + * The {@link android.support.v4.view.PagerAdapter} that will provide + * fragments for each of the sections. We use a + * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which + * will keep every loaded fragment in memory. If this becomes too memory + * intensive, it may be best to switch to a + * {@link android.support.v4.app.FragmentStatePagerAdapter}. + */ + SectionsPagerAdapter mSectionsPagerAdapter; + + /** + * The {@link ViewPager} that will host the section contents. + */ + ViewPager mViewPager; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + + // Create the adapter that will return a fragment for each of the three + // primary sections of the app. + mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); + + // Set up the ViewPager with the sections adapter. + mViewPager = (ViewPager) findViewById(R.id.pager); + mViewPager.setAdapter(mSectionsPagerAdapter); + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + + + + /** + * A {@link FragmentPagerAdapter} that returns a fragment corresponding to + * one of the sections/tabs/pages. + */ + public class SectionsPagerAdapter extends FragmentPagerAdapter { + + public SectionsPagerAdapter(FragmentManager fm) { + super(fm); + } + + @Override + public Fragment getItem(int position) { + // getItem is called to instantiate the fragment for the given page. + // Return a DummySectionFragment (defined as a static inner class + // below) with the page number as its lone argument. + Fragment fragment = new DummySectionFragment(); + Bundle args = new Bundle(); + args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1); + fragment.setArguments(args); + return fragment; + } + + @Override + public int getCount() { + // Show 3 total pages. + return 3; + } + + @Override + public CharSequence getPageTitle(int position) { + Locale l = Locale.getDefault(); + switch (position) { + case 0: + return getString(R.string.title_section1).toUpperCase(l); + case 1: + return getString(R.string.title_section2).toUpperCase(l); + case 2: + return getString(R.string.title_section3).toUpperCase(l); + } + return null; + } + } + + /** + * A dummy fragment representing a section of the app, but that simply + * displays dummy text. + */ + public static class DummySectionFragment extends Fragment { + /** + * The fragment argument representing the section number for this + * fragment. + */ + public static final String ARG_SECTION_NUMBER = "section_number"; + + public DummySectionFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_main_dummy, container, false); + TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label); + dummyTextView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER))); + return rootView; + } + } + +}