리덕스를 코드로 이해해보자
리엑트를 공부하다 보면 자연스럽게 리덕스를 접하게 됩니다.
리덕스를 이해하기 위해 많은 문서를 접하지만, 저 같은 경우에는 코드랑 연결이 되어 있을 때 가장 잘 이해하는 것 같습니다. 그래서 코드로 리덕스를 접근해보려고 합니다.
1 | //1,get a WindowManager by using |
1 | //1,prepare the TrackSelector ..(BandwidthMeter,) about the newwork |
A app need to save some data After it achieve information and need to save something when user changed some settings.
1 | // app should ask for the permission |
To get external storage: Environment.getExternalStorageDirectory();
To create a file :
1 | new File(String parent,String name), |
1 | //To write file,use |
I looked and finally find some way to implement it.
1 | //use getOffsetForPosition(x,y) |
shortcut
| Quick documentation | Ctrl+Q |
| shift file | Ctrl+Tab|
| Parameter info | ctrl+p |
| format code | ctrl+shift+L |
Live Template
refer to this blog
| make a toast | Toast |
| quick make a TAG |logt |
| make a const int | const |
| make a const String |key |
| println |soutp |
| log a infomation | logd,loge,logi |
| judge if it is null | ifn,inn |
| make intent to startActicity|IntentView |
we can find the key word in Android Studio
Settings > Editor > Live Templates
Yesterday I finally finished a good function in my application.The function is to replace the wallpaper of the desktop of any video.The origin idea is from an application named Wallpaper Engine on the stream.The application sold on the stream is very pupolar around me. Sounds an amazing function but in fact it is very easy.And although maybe the code is simple and not like some big project,I think it is a goog beginning of my work.
As the preparation for the program,I kept looking up relevant information on the Interne.I searched on the stackflow for the answer but everything seems not esay.There is no distinct answer about how to actualize the function.It spent a lot of time searching for the answer.People on the stackflow only give the way to change the wallpaper which cannot actualize the function in my mind.So sadly.
I also searched the msdn for the answer.Unfortunately the approach is what I found on the satckflow.I had no idea where I can find the answer.What I could do is to try my fortune to search the code on the GitHub.I thought the chance is small because how could it be if I cannot find an answer on the stackflow.However it really surprises me that someone build it and show the code on the GitHub.Thanks to GitHUb for its help.And also thanks to the author for his code.
After I got the code,I start reading the project and tried to understand how the author did it.
The project is very simple and I quickly finished reading it.However it seems to make a window and set its size to suit the screen and then set the window’s parent to one window.The process is simple but I don’t know what the theory it is.So I keep search the reason why we code it like that.I try to find the answer on the ZhiHu ——Chinese bigest Ask-Answer community.As expected,the programmers give some answers.And finally I found the right anwer and the answer also provide a link to the CodeProject website where someone gave a prefect answer.The windows show on the Mircosoft Windows are piled up.And The “progam” is the lowest window.Above are other windows including the desktop’ icons.So we only need to set a window’s parent as the layer below the desktop’s icons and cover the wallpaper with my window and play the video on my window.So it works.
It is easy,isn’t it?However it occurs some other problems when I try to actualize it.But I really made it.So I think it is a great progress for me.