diff --git a/.DS_Store b/.DS_Store index 59dfd6c4..de23f9c0 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/README.md b/README.md index 4f3f8aa0..ae4b3deb 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ | 둘째마당 02 | 레이아웃 | `진행 완료` | second/layout | | 둘째마당 03 | 기본위젯과 드로어블 | `진행 완료` | second/widget | | 둘째마당 04 | 화면 간 전환 | `진행 완료` | second/inflate | -| 둘째마당 05 | 프래그먼트 | `진행 전` | +| 둘째마당 05 | 프래그먼트 | `진행 전` | second/fragment | | 둘째마당 06 | 서비스와 수신자 | `진행 전` | | 둘째마당 07 | 선택위젯 만들기 | `진행 전` | | 둘째마당 08 | 애니메이션(참고) | `진행 전` | diff --git a/second/.DS_Store b/second/.DS_Store index 6ef06dd8..4a2e531e 100644 Binary files a/second/.DS_Store and b/second/.DS_Store differ diff --git a/second/05_fragment/.DS_Store b/second/05_fragment/.DS_Store new file mode 100644 index 00000000..cd0a37c6 Binary files /dev/null and b/second/05_fragment/.DS_Store differ diff --git a/second/05_fragment/SampleActionBar1/.gitignore b/second/05_fragment/SampleActionBar1/.gitignore new file mode 100644 index 00000000..aa724b77 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/second/05_fragment/SampleActionBar1/.idea/.gitignore b/second/05_fragment/SampleActionBar1/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/second/05_fragment/SampleActionBar1/.idea/compiler.xml b/second/05_fragment/SampleActionBar1/.idea/compiler.xml new file mode 100644 index 00000000..fb7f4a8a --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/.idea/gradle.xml b/second/05_fragment/SampleActionBar1/.idea/gradle.xml new file mode 100644 index 00000000..5cd135a0 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/.idea/jarRepositories.xml b/second/05_fragment/SampleActionBar1/.idea/jarRepositories.xml new file mode 100644 index 00000000..0380d8d3 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/.idea/misc.xml b/second/05_fragment/SampleActionBar1/.idea/misc.xml new file mode 100644 index 00000000..6199cc2a --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/.idea/runConfigurations.xml b/second/05_fragment/SampleActionBar1/.idea/runConfigurations.xml new file mode 100644 index 00000000..797acea5 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/.idea/vcs.xml b/second/05_fragment/SampleActionBar1/.idea/vcs.xml new file mode 100644 index 00000000..c2365ab1 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/.gitignore b/second/05_fragment/SampleActionBar1/app/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/build.gradle b/second/05_fragment/SampleActionBar1/app/build.gradle new file mode 100644 index 00000000..293bc7a1 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "com.example.actionbar1" + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.3.0' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/proguard-rules.pro b/second/05_fragment/SampleActionBar1/app/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/src/androidTest/java/com/example/actionbar1/ExampleInstrumentedTest.java b/second/05_fragment/SampleActionBar1/app/src/androidTest/java/com/example/actionbar1/ExampleInstrumentedTest.java new file mode 100644 index 00000000..5b7c3dee --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/src/androidTest/java/com/example/actionbar1/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.actionbar1; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.actionbar1", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/src/main/AndroidManifest.xml b/second/05_fragment/SampleActionBar1/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a65d1d72 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/src/main/java/com/example/actionbar1/MainActivity.java b/second/05_fragment/SampleActionBar1/app/src/main/java/com/example/actionbar1/MainActivity.java new file mode 100644 index 00000000..71c4a2bd --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/src/main/java/com/example/actionbar1/MainActivity.java @@ -0,0 +1,58 @@ +package com.example.actionbar1; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.Toast; + +public class MainActivity extends AppCompatActivity { + ActionBar abar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + abar = getSupportActionBar(); + + Button button = findViewById(R.id.button); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + abar.setLogo(R.drawable.home); + abar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_USE_LOGO); + } + }); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + int curId = item.getItemId(); + switch (curId) { + case R.id.menu_refresh: + Toast.makeText(this, "새로고침 메뉴가 선택되었습니다. ", Toast.LENGTH_SHORT).show(); + break; + case R.id.menu_search: + Toast.makeText(this, "검색 메뉴가 선택되었습니다. ", Toast.LENGTH_SHORT).show(); + break; + case R.id.menu_settings: + Toast.makeText(this, "설정 메뉴가 선택되었습니다. ", Toast.LENGTH_SHORT).show(); + break; + default: + break; + } + return super.onOptionsItemSelected(item); + } +} \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/src/main/res/drawable-v24/home.png b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable-v24/home.png new file mode 100644 index 00000000..7f4fe6fe Binary files /dev/null and b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable-v24/home.png differ diff --git a/second/05_fragment/SampleActionBar1/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 00000000..2b068d11 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/ic_launcher_background.xml b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..07d5da9c --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_refresh.png b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_refresh.png new file mode 100644 index 00000000..6a3c7c86 Binary files /dev/null and b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_refresh.png differ diff --git a/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_search.png b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_search.png new file mode 100644 index 00000000..3a7a7322 Binary files /dev/null and b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_search.png differ diff --git a/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_settings.png b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_settings.png new file mode 100644 index 00000000..7f265284 Binary files /dev/null and b/second/05_fragment/SampleActionBar1/app/src/main/res/drawable/menu_settings.png differ diff --git a/second/05_fragment/SampleActionBar1/app/src/main/res/layout/activity_main.xml b/second/05_fragment/SampleActionBar1/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..f2828d88 --- /dev/null +++ b/second/05_fragment/SampleActionBar1/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,30 @@ + + + + + +