diff --git a/app/src/androidTest/java/nl/smart/connect/dummyand/ApplicationTest.java b/app/src/androidTest/java/nl/smart/connect/dummyand/ApplicationTest.java new file mode 100644 index 0000000..a5ab9a1 --- /dev/null +++ b/app/src/androidTest/java/nl/smart/connect/dummyand/ApplicationTest.java @@ -0,0 +1,13 @@ +package nl.smart.connect.dummyand; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..17b938c --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/nl/smart/connect/dummyand/BrowseCard.java b/app/src/main/java/nl/smart/connect/dummyand/BrowseCard.java new file mode 100644 index 0000000..904a9d8 --- /dev/null +++ b/app/src/main/java/nl/smart/connect/dummyand/BrowseCard.java @@ -0,0 +1,184 @@ +package nl.smart.connect.dummyand; + +import android.content.Intent; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; + +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentPagerAdapter; +import android.support.v4.view.ViewPager; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; + +import android.widget.EditText; +import android.widget.TextView; + +import java.util.logging.Logger; + +public class BrowseCard extends AppCompatActivity { + + /** + * The {@link android.support.v4.view.PagerAdapter} that will provide + * fragments for each of the sections. We use a + * {@link 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}. + */ + private SectionsPagerAdapter mSectionsPagerAdapter; + + /** + * The {@link ViewPager} that will host the section contents. + */ + private ViewPager mViewPager; + + public final static String EXTRA_MESSAGE = "nl.smart.connect.dummyand.MESSAGE"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_browse_card); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + // 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.setAdapter(mSectionsPagerAdapter); + +// FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); +// fab.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View view) { +// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) +// .setAction("Action", null).show(); +// } +// }); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_browse_card, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } + + + /** + * 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 PlaceholderFragment (defined as a static inner class below). + return PlaceholderFragment.newInstance(position + 1); + } + + @Override + public int getCount() { + // Show 3 total pages. + return 3; + } + + @Override + public CharSequence getPageTitle(int position) { + switch (position) { + case 0: + return "SECTION 1"; + case 1: + return "SECTION 2"; + case 2: + return "SECTION 3"; + } + return null; + } + } + + /** + * A placeholder fragment containing a simple view. + */ + public static class PlaceholderFragment extends Fragment { + /** + * The fragment argument representing the section number for this + * fragment. + */ + private static final String ARG_SECTION_NUMBER = "section_number"; + + /** + * Returns a new instance of this fragment for the given section + * number. + */ + public static PlaceholderFragment newInstance(int sectionNumber) { + PlaceholderFragment fragment = new PlaceholderFragment(); + Bundle args = new Bundle(); + args.putInt(ARG_SECTION_NUMBER, sectionNumber); + fragment.setArguments(args); + return fragment; + } + + public PlaceholderFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_browse_card, container, false); + TextView textView = (TextView) rootView.findViewById(R.id.section_label); + textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER))); + + EditText editText = (EditText) rootView.findViewById(R.id.edit_message); + String message = editText.getText().toString(); + message = message + "blabla"; + + editText.setText(message); + + return rootView; + } + } + + /** + * Called when the user clicks the Send/eMail button + */ + public void sendMessage(View view) { + // Do something in response to button + Intent intent = new Intent(this, DisplayMessageActivity.class); + //EditText editText = (EditText) view.findViewById(R.id.edit_message); + //EditText editText = (EditText) mViewPager.getCurrentItem() ).findViewById(R.id.edit_message); + //String message = editText.getText().toString(); + String message = "Item number = "; + intent.putExtra(EXTRA_MESSAGE, message); + startActivity(intent); + } +} diff --git a/app/src/main/java/nl/smart/connect/dummyand/DisplayMessageActivity.java b/app/src/main/java/nl/smart/connect/dummyand/DisplayMessageActivity.java new file mode 100644 index 0000000..51aa4cc --- /dev/null +++ b/app/src/main/java/nl/smart/connect/dummyand/DisplayMessageActivity.java @@ -0,0 +1,30 @@ +package nl.smart.connect.dummyand; + +import android.content.Intent; +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.View; +import android.widget.TextView; + +public class DisplayMessageActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Get the message from the intent + Intent intent = getIntent(); + String message = intent.getStringExtra(BrowseCard.EXTRA_MESSAGE); + + // Create the text view + TextView textView = new TextView(this); + textView.setTextSize(40); + textView.setText(message); + + // Set the text view as the activity layout + setContentView(textView); + } +} diff --git a/app/src/main/res/layout/activity_browse_card.xml b/app/src/main/res/layout/activity_browse_card.xml new file mode 100644 index 0000000..d2e4292 --- /dev/null +++ b/app/src/main/res/layout/activity_browse_card.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_display_message.xml b/app/src/main/res/layout/activity_display_message.xml new file mode 100644 index 0000000..4aa1439 --- /dev/null +++ b/app/src/main/res/layout/activity_display_message.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/content_display_message.xml b/app/src/main/res/layout/content_display_message.xml new file mode 100644 index 0000000..8df96e8 --- /dev/null +++ b/app/src/main/res/layout/content_display_message.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/layout/fragment_browse_card.xml b/app/src/main/res/layout/fragment_browse_card.xml new file mode 100644 index 0000000..ba2e905 --- /dev/null +++ b/app/src/main/res/layout/fragment_browse_card.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/menu_browse_card.xml b/app/src/main/res/menu/menu_browse_card.xml new file mode 100644 index 0000000..312e0c6 --- /dev/null +++ b/app/src/main/res/menu/menu_browse_card.xml @@ -0,0 +1,6 @@ + + + diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc --- /dev/null +++ b/app/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c --- /dev/null +++ b/app/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 --- /dev/null +++ b/app/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c --- /dev/null +++ b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..aee44e1 --- /dev/null +++ b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differ diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..65d0c39 --- /dev/null +++ b/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,8 @@ +> + + diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..cef3abc --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,7 @@ + + + 16dp + 16dp + 16dp + 8dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..ad4735d --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + DummyAnd + Settings + Hello World from section: %1$d + Type your text here + My Message + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..44f664f --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,17 @@ + + + + + +