Permalink
Browse files

Initial commit

  • Loading branch information...
thalespf committed Sep 7, 2014
0 parents commit 928e022cdf1a015fb39ea834fe427efa43422ec1
Showing with 1,080 additions and 0 deletions.
  1. +6 −0 .gitignore
  2. +4 −0 README.md
  3. +5 −0 navigation-drawer/.gitignore
  4. +1 −0 navigation-drawer/app/.gitignore
  5. +86 −0 navigation-drawer/app/app.iml
  6. +25 −0 navigation-drawer/app/build.gradle
  7. +17 −0 navigation-drawer/app/proguard-rules.pro
  8. +13 −0 ...ation-drawer/app/src/androidTest/java/com/thalespf/articles/navigationdrawer/ApplicationTest.java
  9. +21 −0 navigation-drawer/app/src/main/AndroidManifest.xml
  10. +20 −0 navigation-drawer/app/src/main/java/com/thalespf/articles/navigationdrawer/FindPeopleFragment.java
  11. +20 −0 navigation-drawer/app/src/main/java/com/thalespf/articles/navigationdrawer/HomeFragment.java
  12. +103 −0 navigation-drawer/app/src/main/java/com/thalespf/articles/navigationdrawer/MenuActivity.java
  13. +264 −0 ...ion-drawer/app/src/main/java/com/thalespf/articles/navigationdrawer/NavigationDrawerFragment.java
  14. +20 −0 navigation-drawer/app/src/main/java/com/thalespf/articles/navigationdrawer/PhotosFragment.java
  15. BIN navigation-drawer/app/src/main/res/drawable-hdpi/drawer_shadow.9.png
  16. BIN navigation-drawer/app/src/main/res/drawable-hdpi/ic_drawer.png
  17. BIN navigation-drawer/app/src/main/res/drawable-hdpi/ic_launcher.png
  18. BIN navigation-drawer/app/src/main/res/drawable-mdpi/drawer_shadow.9.png
  19. BIN navigation-drawer/app/src/main/res/drawable-mdpi/ic_drawer.png
  20. BIN navigation-drawer/app/src/main/res/drawable-mdpi/ic_launcher.png
  21. BIN navigation-drawer/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png
  22. BIN navigation-drawer/app/src/main/res/drawable-xhdpi/ic_drawer.png
  23. BIN navigation-drawer/app/src/main/res/drawable-xhdpi/ic_launcher.png
  24. BIN navigation-drawer/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png
  25. BIN navigation-drawer/app/src/main/res/drawable-xxhdpi/ic_drawer.png
  26. BIN navigation-drawer/app/src/main/res/drawable-xxhdpi/ic_launcher.png
  27. +31 −0 navigation-drawer/app/src/main/res/layout/activity_menu.xml
  28. +15 −0 navigation-drawer/app/src/main/res/layout/fragment_find_people.xml
  29. +16 −0 navigation-drawer/app/src/main/res/layout/fragment_home.xml
  30. +16 −0 navigation-drawer/app/src/main/res/layout/fragment_menu.xml
  31. +9 −0 navigation-drawer/app/src/main/res/layout/fragment_navigation_drawer.xml
  32. +16 −0 navigation-drawer/app/src/main/res/layout/fragment_photos.xml
  33. +7 −0 navigation-drawer/app/src/main/res/menu/global.xml
  34. +12 −0 navigation-drawer/app/src/main/res/menu/menu.xml
  35. +6 −0 navigation-drawer/app/src/main/res/values-w820dp/dimens.xml
  36. +9 −0 navigation-drawer/app/src/main/res/values/dimens.xml
  37. +13 −0 navigation-drawer/app/src/main/res/values/strings.xml
  38. +8 −0 navigation-drawer/app/src/main/res/values/styles.xml
  39. +19 −0 navigation-drawer/build.gradle
  40. +18 −0 navigation-drawer/gradle.properties
  41. BIN navigation-drawer/gradle/wrapper/gradle-wrapper.jar
  42. +6 −0 navigation-drawer/gradle/wrapper/gradle-wrapper.properties
  43. +164 −0 navigation-drawer/gradlew
  44. +90 −0 navigation-drawer/gradlew.bat
  45. +19 −0 navigation-drawer/navigation-drawer.iml
  46. +1 −0 navigation-drawer/settings.gradle
@@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
.DS_Store
/build
**/.idea
@@ -0,0 +1,4 @@
Códigos do thalesondev
====
Códigos dos artigos da minha página pessoal http://thalesondev.wordpress.com
@@ -0,0 +1,5 @@
.gradle
/local.properties
/.idea/workspace.xml
.DS_Store
/build
@@ -0,0 +1 @@
/build
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="navigation-drawer" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
</content>
<orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="appcompat-v7-19.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
</component>
</module>
@@ -0,0 +1,25 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.thalespf.articles.navigationdrawer"
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/thales/ides/android-studio/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 *;
#}
@@ -0,0 +1,13 @@
package com.thalespf.articles.navigationdrawer;
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);
}
}
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thalespf.articles.navigationdrawer" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MenuActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -0,0 +1,20 @@
package com.thalespf.articles.navigationdrawer;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by thales on 9/7/14.
*/
public class FindPeopleFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_find_people, container, false);
return view;
}
}
@@ -0,0 +1,20 @@
package com.thalespf.articles.navigationdrawer;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by thales on 9/7/14.
*/
public class HomeFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
return view;
}
}
@@ -0,0 +1,103 @@
package com.thalespf.articles.navigationdrawer;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
public class MenuActivity extends ActionBarActivity
implements NavigationDrawerFragment.NavigationDrawerCallbacks {
/**
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
*/
private NavigationDrawerFragment mNavigationDrawerFragment;
/**
* Used to store the last screen title. For use in {@link #restoreActionBar()}.
*/
private CharSequence mTitle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();
// Set up the drawer.
mNavigationDrawerFragment.setUp((DrawerLayout) findViewById(R.id.drawer_layout));
}
@Override
public void onNavigationDrawerItemSelected(int position) {
Log.d("tag", "Mudando fragmento position" + position);
// update the main content by replacing fragments
Fragment fragment = null;
switch (position) {
case 0:
fragment = new HomeFragment();
mTitle = getString(R.string.title_section1);
break;
case 1:
fragment = new FindPeopleFragment();
mTitle = getString(R.string.title_section2);
break;
case 2:
fragment = new PhotosFragment();
mTitle = getString(R.string.title_section3);
break;
}
if (fragment != null) {
// update selected item and title, then close the drawer
ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(mTitle);
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.container, fragment)
.commit();
}
}
public void restoreActionBar() {
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle(mTitle);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (!mNavigationDrawerFragment.isDrawerOpen()) {
// Only show items in the action bar relevant to this screen
// if the drawer is not showing. Otherwise, let the drawer
// decide what to show in the action bar.
getMenuInflater().inflate(R.menu.menu, menu);
restoreActionBar();
return true;
}
return super.onCreateOptionsMenu(menu);
}
@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();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Oops, something went wrong.

0 comments on commit 928e022

Please sign in to comment.