diff --git a/AndroidWorkshop/.gitignore b/AndroidWorkshop/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/AndroidWorkshop/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/AndroidWorkshop/.idea/.name b/AndroidWorkshop/.idea/.name new file mode 100644 index 0000000..fe220e8 --- /dev/null +++ b/AndroidWorkshop/.idea/.name @@ -0,0 +1 @@ +AndroidWorkshop \ No newline at end of file diff --git a/AndroidWorkshop/.idea/compiler.xml b/AndroidWorkshop/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/AndroidWorkshop/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AndroidWorkshop/.idea/copyright/profiles_settings.xml b/AndroidWorkshop/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/AndroidWorkshop/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/AndroidWorkshop/.idea/encodings.xml b/AndroidWorkshop/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/AndroidWorkshop/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/AndroidWorkshop/.idea/gradle.xml b/AndroidWorkshop/.idea/gradle.xml new file mode 100644 index 0000000..ee6ddd0 --- /dev/null +++ b/AndroidWorkshop/.idea/gradle.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/AndroidWorkshop/.idea/misc.xml b/AndroidWorkshop/.idea/misc.xml new file mode 100644 index 0000000..1a3eaff --- /dev/null +++ b/AndroidWorkshop/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AndroidWorkshop/.idea/modules.xml b/AndroidWorkshop/.idea/modules.xml new file mode 100644 index 0000000..010f9c4 --- /dev/null +++ b/AndroidWorkshop/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/AndroidWorkshop/.idea/runConfigurations.xml b/AndroidWorkshop/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/AndroidWorkshop/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/AndroidWorkshop/app/.gitignore b/AndroidWorkshop/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/AndroidWorkshop/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/AndroidWorkshop/app/build.gradle b/AndroidWorkshop/app/build.gradle new file mode 100644 index 0000000..ffe95f5 --- /dev/null +++ b/AndroidWorkshop/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.3" + + defaultConfig { + applicationId "piotrek.androidworkshop" + minSdkVersion 21 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:23.3.0' +} diff --git a/AndroidWorkshop/app/proguard-rules.pro b/AndroidWorkshop/app/proguard-rules.pro new file mode 100644 index 0000000..d167e8f --- /dev/null +++ b/AndroidWorkshop/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\Admin\AppData\Local\Android\sdk1/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 *; +#} diff --git a/AndroidWorkshop/app/src/androidTest/java/piotrek/androidworkshop/ApplicationTest.java b/AndroidWorkshop/app/src/androidTest/java/piotrek/androidworkshop/ApplicationTest.java new file mode 100644 index 0000000..2839468 --- /dev/null +++ b/AndroidWorkshop/app/src/androidTest/java/piotrek/androidworkshop/ApplicationTest.java @@ -0,0 +1,13 @@ +package piotrek.androidworkshop; + +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/AndroidWorkshop/app/src/main/AndroidManifest.xml b/AndroidWorkshop/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..4d9d2a0 --- /dev/null +++ b/AndroidWorkshop/app/src/main/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AndroidWorkshop/app/src/main/java/piotrek/androidworkshop/FirstFragment.java b/AndroidWorkshop/app/src/main/java/piotrek/androidworkshop/FirstFragment.java new file mode 100644 index 0000000..20d4f43 --- /dev/null +++ b/AndroidWorkshop/app/src/main/java/piotrek/androidworkshop/FirstFragment.java @@ -0,0 +1,66 @@ +package piotrek.androidworkshop; + +import android.content.Context; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; + +/** + * Created by Admin on 2016-04-25. + */ +public class FirstFragment extends Fragment { + + + + + /// PRZEKAZYWANIE ACTIVITY DO FRAGMENTU !!!! + private Callback callback; + + + @Override + public void onAttach(Context context) { + super.onAttach(context); + + callback = (Callback) context; + } + + @Override + public void onDetach() { + super.onDetach(); + + callback = null; + } + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setRetainInstance(false); + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.first_fragment ,container, false); + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + Button button = (Button) view.findViewById(R.id.button); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + callback.onClick(); + } + }); + } + + public interface Callback{ + void onClick(); + } +} diff --git a/AndroidWorkshop/app/src/main/java/piotrek/androidworkshop/MainActivity.java b/AndroidWorkshop/app/src/main/java/piotrek/androidworkshop/MainActivity.java new file mode 100644 index 0000000..1a03652 --- /dev/null +++ b/AndroidWorkshop/app/src/main/java/piotrek/androidworkshop/MainActivity.java @@ -0,0 +1,26 @@ +package piotrek.androidworkshop; + +import android.support.v4.app.Fragment; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +public class MainActivity extends AppCompatActivity implements FirstFragment.Callback{ + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Fragment fragment = new FirstFragment(); + + getSupportFragmentManager().beginTransaction().add(R.id.container, fragment).commit(); + + //getSupportFragmentManager().beginTransaction().remove(fragment).addToBackStack(null).commit(); + + + } + + @Override + public void onClick() { + finish(); + } +} diff --git a/AndroidWorkshop/app/src/main/res/layout/activity_main.xml b/AndroidWorkshop/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..da1a619 --- /dev/null +++ b/AndroidWorkshop/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/AndroidWorkshop/app/src/main/res/layout/first_fragment.xml b/AndroidWorkshop/app/src/main/res/layout/first_fragment.xml new file mode 100644 index 0000000..9bdf7df --- /dev/null +++ b/AndroidWorkshop/app/src/main/res/layout/first_fragment.xml @@ -0,0 +1,13 @@ + + +