Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
designatednerd committed Jul 13, 2015
0 parents commit 79bace3
Show file tree
Hide file tree
Showing 26 changed files with 917 additions and 0 deletions.
73 changes: 73 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.designatednerd.wino"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
//Required by butterknife
disable 'InvalidPackage'
}

packagingOptions {
//Prevent a warning when trying to do UI tests.
exclude 'LICENSE.txt'
}
}



dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

//Android compat things
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:recyclerview-v7:21.0.0'


//Design support library
compile 'com.android.support:design:22.2.0'

//Square/Jake Wharton Thingies
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup:otto:1.3.5'

//Testing
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.1') {
exclude group: 'com.android.support', module: 'support-annotations'
}

androidTestCompile ('com.android.support.test:runner:0.2') {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile ('com.android.support.test:rules:0.2') {
exclude group: 'com.android.support', module: 'support-annotations'

}
androidTestCompile ('com.android.support.test.espresso:espresso-intents:2.1') {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.1') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
}


}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/Shared/android-osx-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# 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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.designatednerd.wino;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
29 changes: 29 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.designatednerd.wino" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".activity.WineTastingListActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.WineTastingDetailActivity"
android:label="@string/title_winetasting_detail"
android:parentActivityName=".activity.WineTastingListActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.WineTastingListActivity" />
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.designatednerd.wino.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;

import com.designatednerd.wino.R;
import com.designatednerd.wino.fragment.WineTastingDetailFragment;


/**
* An activity representing a single WineTasting detail screen. This
* activity is only used on handset devices. On tablet-size devices,
* item details are presented side-by-side with a list of items
* in a {@link WineTastingListActivity}.
* <p/>
* This activity is mostly just a 'shell' activity containing nothing
* more than a {@link WineTastingDetailFragment}.
*/
public class WineTastingDetailActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_winetasting_detail);

// Show the Up button in the action bar.
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

// savedInstanceState is non-null when there is fragment state
// saved from previous configurations of this activity
// (e.g. when rotating the screen from portrait to landscape).
// In this case, the fragment will automatically be re-added
// to its container so we don't need to manually add it.
// For more information, see the Fragments API guide at:
//
// http://developer.android.com/guide/components/fragments.html
//
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Bundle arguments = new Bundle();
arguments.putString(WineTastingDetailFragment.ARG_ITEM_ID,
getIntent().getStringExtra(WineTastingDetailFragment.ARG_ITEM_ID));
WineTastingDetailFragment fragment = new WineTastingDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.winetasting_detail_container, fragment)
.commit();
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpTo(this, new Intent(this, WineTastingListActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.designatednerd.wino.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.designatednerd.wino.R;
import com.designatednerd.wino.fragment.WineTastingDetailFragment;
import com.designatednerd.wino.fragment.WineTastingListFragment;


/**
* An activity representing a list of WineTastings. This activity
* has different presentations for handset and tablet-size devices. On
* handsets, the activity presents a list of items, which when touched,
* lead to a {@link WineTastingDetailActivity} representing
* item details. On tablets, the activity presents the list of items and
* item details side-by-side using two vertical panes.
* <p/>
* The activity makes heavy use of fragments. The list of items is a
* {@link WineTastingListFragment} and the item details
* (if present) is a {@link WineTastingDetailFragment}.
* <p/>
* This activity also implements the required
* {@link WineTastingListFragment.Callbacks} interface
* to listen for item selections.
*/
public class WineTastingListActivity extends FragmentActivity
implements WineTastingListFragment.Callbacks {

/**
* Whether or not the activity is in two-pane mode, i.e. running on a tablet
* device.
*/
private boolean mTwoPane;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_winetasting_list);

if (findViewById(R.id.winetasting_detail_container) != null) {
// The detail container view will be present only in the
// large-screen layouts (res/values-large and
// res/values-sw600dp). If this view is present, then the
// activity should be in two-pane mode.
mTwoPane = true;

// In two-pane mode, list items should be given the
// 'activated' state when touched.
((WineTastingListFragment) getSupportFragmentManager()
.findFragmentById(R.id.winetasting_list))
.setActivateOnItemClick(true);
}

// TODO: If exposing deep links into your app, handle intents here.
}

/**
* Callback method from {@link WineTastingListFragment.Callbacks}
* indicating that the item with the given ID was selected.
*/
@Override
public void onItemSelected(String id) {
if (mTwoPane) {
// In two-pane mode, show the detail view in this activity by
// adding or replacing the detail fragment using a
// fragment transaction.
Bundle arguments = new Bundle();
arguments.putString(WineTastingDetailFragment.ARG_ITEM_ID, id);
WineTastingDetailFragment fragment = new WineTastingDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.replace(R.id.winetasting_detail_container, fragment)
.commit();

} else {
// In single-pane mode, simply start the detail activity
// for the selected item ID.
Intent detailIntent = new Intent(this, WineTastingDetailActivity.class);
detailIntent.putExtra(WineTastingDetailFragment.ARG_ITEM_ID, id);
startActivity(detailIntent);
}
}
}
55 changes: 55 additions & 0 deletions app/src/main/java/com/designatednerd/wino/dummy/DummyContent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.designatednerd.wino.dummy;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Helper class for providing sample content for user interfaces created by
* Android template wizards.
* <p/>
* TODO: Replace all uses of this class before publishing your app.
*/
public class DummyContent {

/**
* An array of sample (dummy) items.
*/
public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();

/**
* A map of sample (dummy) items, by ID.
*/
public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();

static {
// Add 3 sample items.
addItem(new DummyItem("1", "Item 1"));
addItem(new DummyItem("2", "Item 2"));
addItem(new DummyItem("3", "Item 3"));
}

private static void addItem(DummyItem item) {
ITEMS.add(item);
ITEM_MAP.put(item.id, item);
}

/**
* A dummy item representing a piece of content.
*/
public static class DummyItem {
public String id;
public String content;

public DummyItem(String id, String content) {
this.id = id;
this.content = content;
}

@Override
public String toString() {
return content;
}
}
}
Loading

0 comments on commit 79bace3

Please sign in to comment.