forked from yslee94/movieApp
-
Notifications
You must be signed in to change notification settings - Fork 21
#기능추가 제작년도 기간 설정 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chad1994
wants to merge
1
commit into
boostcampth:master
Choose a base branch
from
chad1994:dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
#기능추가 제작년도 기간 설정 #13
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
app/src/main/java/com/example/yeseul/movieapp/view/main/NumberPickerFragment.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| package com.example.yeseul.movieapp.view.main; | ||
|
|
||
| import android.annotation.TargetApi; | ||
| import android.app.Dialog; | ||
| import android.os.Build; | ||
| import android.os.Bundle; | ||
| import android.support.annotation.NonNull; | ||
| import android.support.annotation.Nullable; | ||
| import android.support.v4.app.DialogFragment; | ||
| import android.support.v7.app.AlertDialog; | ||
| import android.widget.NumberPicker; | ||
| import android.widget.Toast; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| public class NumberPickerFragment extends DialogFragment { | ||
|
|
||
| private MainPresenter mPresenter; | ||
| private int type; | ||
|
|
||
| public static NumberPickerFragment newInstance(MainPresenter presenter,int type) { | ||
|
|
||
| Bundle args = new Bundle(); | ||
|
|
||
| NumberPickerFragment fragment = new NumberPickerFragment(); | ||
| args.putInt("type",type); | ||
| fragment.setPresenter(presenter); | ||
| fragment.setArguments(args); | ||
| return fragment; | ||
| } | ||
|
|
||
| @Override | ||
| public void onCreate(@Nullable Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| type = getArguments() != null ? getArguments().getInt("type") : 0; | ||
| } | ||
|
|
||
|
|
||
| @TargetApi(Build.VERSION_CODES.O) | ||
| @NonNull | ||
| @Override | ||
| public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { | ||
| final NumberPicker numberPicker = new NumberPicker(getActivity()); | ||
|
|
||
| if(type==1) { | ||
| numberPicker.setMinValue(1896); | ||
| }else if(type ==2){ | ||
| numberPicker.setMinValue(mPresenter.getYearFrom()); | ||
| } | ||
| numberPicker.setMaxValue(LocalDate.now().getYear()); | ||
|
|
||
|
|
||
| AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | ||
| builder.setTitle("년도를 선택하세요"); | ||
|
|
||
| builder.setPositiveButton("확인", (dialog, which) -> valueChangeListener.onValueChange(numberPicker, | ||
| numberPicker.getValue(), numberPicker.getValue())); | ||
|
|
||
| builder.setNegativeButton("취소",null); | ||
|
|
||
| builder.setView(numberPicker); | ||
| return builder.create(); | ||
| } | ||
|
|
||
| private NumberPicker.OnValueChangeListener valueChangeListener = (numberPicker, oldValue, newValue) -> { | ||
| if(type==1) { | ||
| mPresenter.onYearFromSelected(numberPicker.getValue()); | ||
| } else if(type==2){ | ||
| mPresenter.onYearToSelected(numberPicker.getValue()); | ||
| } | ||
| Toast.makeText(getContext(), "value: " + numberPicker.getValue(), Toast.LENGTH_SHORT).show(); | ||
|
|
||
| }; | ||
|
|
||
| public void setPresenter(MainPresenter presenter) { | ||
| this.mPresenter = presenter; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <translate | ||
| android:duration="500" | ||
| android:fromYDelta="-100%" | ||
| android:toYDelta="0%"/> | ||
| <alpha | ||
| android:duration="800" | ||
| android:fromAlpha="0" | ||
| android:toAlpha="1" | ||
| /> | ||
| </set> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <translate | ||
| android:duration="500" | ||
| android:fromYDelta="0%" | ||
| android:toYDelta="-100%"/> | ||
| <alpha | ||
| android:duration="200" | ||
| android:fromAlpha="1" | ||
| android:toAlpha="0" | ||
| /> | ||
| </set> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
시작년도를 1896으로 설정하신 이유가 궁금합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
조사한 결과에 따르면 최초의 상업영화가 1896년도의 ‘열차의 도착’ 이라고 합니다.