19_ B long exposure APP and 19_ B exposure app

Source: Internet
Author: User

19_ B long exposure APP and 19_ B exposure app

Basic knowledge ......

I bought a single SLR a few days ago. I especially want to take the effect of a long time exposure for B. Later, I thought it would be better to write an APP to achieve random color of the screen background and full screen text display.

First:

 

The left side of the two images is very bright, because the APP forgot to hide the "status bar. The shutter speed of the two photos is 30 s. The basic function of the APP is to set the text. When you click the screen, a word is displayed. Then, click the screen programming black. When you click the screen again, the next word appears. When the screen is black, I move my cell phone and click the screen at the right position to display the next word. At the same time, the screen can display random colors according to the set interval. In order to make the display more colorful, the random values of RGB are from 80 ~ 255.

At the same time, text is displayed at random from 45 ° to 135 °, which requires the mobile phone to be normally placed during the photo, and it is not too dull.

The following is the APP:

Running:

The program code is as follows:

Package com. example. raw; import java. util. timer; import java. util. timerTask; import android. app. activity; import android. OS. bundle; import android. OS. handler; import android. OS. message; import android. view. view; import android. view. window; import android. view. windowManager; import android. widget. button; import android. widget. linearLayout; import android. widget. seekBar; import android. widget. textView; public clas S MainActivity extends Activity {public int redColor = 0; public int blueColor = 0; public int greenColor = 0; public int tvRedColor = 0; public int tvBlueColor = 0; public int tvGreenColor = 0; public int tvRotation = 0; public int clickTimes = 0; public int I = 0; public char [] text = null; public boolean enableView = false; private LinearLayout ll; private TimerTask task; private Button btnTim EInterval, btnSetText; private TextView etTimeInterval, editSetText, tvFullScreen, tvScreenLight; private SeekBar seekBar; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); requestWindowFeature (Window. FEATURE_NO_TITLE); setContentView (R. layout. activity_main); seekBar = (SeekBar) findViewById (R. id. seekBar); seekBar. setMax (100); seekBar. setOnSeekBarCh AngeListener (new SeekBar. onSeekBarChangeListener () {public void onStopTrackingTouch (SeekBar seekBar) {// TODO Auto-generated method stub} public void onStartTrackingTouch (SeekBar seekBar) {// TODO Auto-generated method stub} public void onProgressChanged (SeekBar seekBar, int progress, boolean fromUser) {WindowManager. layoutParams lp = getWindow (). getAttributes (); lp. screenBrightness = (float) (Progress/100.0); getWindow (). setAttributes (lp) ;}}); ll = (LinearLayout) findViewById (R. id. root); ll. setBackgroundColor (0 XFFFFFFFF); btnTimeInterval = (Button) findViewById (R. id. btnTimeInterval); btnSetText = (Button) findViewById (R. id. btnSetText); etTimeInterval = (TextView) findViewById (R. id. etTimeInterval); editSetText = (TextView) findViewById (R. id. editSetText); tvFullScreen = (TextView) FindViewById (R. id. tvFullScreen); tvScreenLight = (TextView) findViewById (R. id. tvScreenLight); final Handler handler = new Handler () {@ Override public void handleMessage (Message msg) {switch (msg. what) {case 1: redColor = (int) (80 + Math. random () * 175); blueColor = (int) (80 + Math. random () * 175); greenColor = (int) (80 + Math. random () * 175); ll. setBackgroundColor (0xff000000 + redColor * 25 5*255 + blueColor * 255 + greenColor); break; default: break;} super. handleMessage (msg) ;}}; btnTimeInterval. setOnClickListener (new View. onClickListener () {public void onClick (View v) {try {if (etTimeInterval. getText ()! = Null) {setAllUiVisibilityGone (); tvFullScreen. setVisibility (8); Timer timer = new Timer (true); timer. schedule (task, 1000, Integer. parseInt (etTimeInterval. getText (). toString () ;}} catch (Exception e) {}}); btnSetText. setOnClickListener (new View. onClickListener () {public void onClick (View v) {try {if (editSetText. getText ()! = Null) {setAllUiVisibilityGone (); text = editSetText. getText (). toString (). toCharArray (); tvFullScreen. setBackgroundColor (0xff000000); ll. setBackgroundColor (0xff000000); enableView = true ;}} catch (Exception e) {// TODO: handle exception }}); ll. setOnClickListener (new View. onClickListener () {public void onClick (View v) {if (enableView = true) {clickTimes ++; if (clickTimes % 2 = 1) {tvFullScreen. setBackgroundColor (0xff000000); ll. setBackgroundColor (0xff000000); tvRotation = (int) (45 + Math. random () * 90); tvFullScreen. setRotation (tvRotation); tvRedColor = (int) (100 + Math. random () * 155); tvBlueColor = (int) (100 + Math. random () * 155); tvGreenColor = (int) (100 + Math. random () * 155); tvFullScreen. setTextColor (0xff000000 + tvRedColor x 255*255 + tvBlueColor * 255 + tvGreenColor); if (I <text. length) {tvFullScreen. setText (text, I ++, 1);} else {tvFullScreen. setTextColor (0xff000000) ;}} else {tvFullScreen. setBackgroundColor (0xff000000); tvFullScreen. setTextColor (0xff000000); ll. setBackgroundColor (0xff000000) ;}}}); task = new TimerTask () {@ Override public void run () {Message message Message = new message (); Message. what = 1; handler. sendMessage (message) ;}};} public void setAllUiVisibilityGone () {btnTimeInterval. setVisibility (8); etTimeInterval. setVisibility (8); btnSetText. setVisibility (8); editSetText. setVisibility (8); seekBar. setVisibility (8); tvScreenLight. setVisibility (8 );}}MainActivity <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" android: id = "@ + id/root" android: layout_width = "match_parent" android: layout_height = "match_parent" android: background = "# ffffff" android: orientation = "vertical" tools: context = "com. example. raw. mainActivity "> <LinearLayout android: layout_width =" fill_parent "android: layout_height =" wrap_content "android: orientation =" horizontal "> <EditText android: id = "@ + id/etTimeInterval" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_weight = "2" android: EMS = "10" android: hint = "input time interval" android: inputType = "numberDecimal"> <requestFocus/> </EditText> <Button android: id = "@ + id/btnTimeInterval" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_weight = "3" android: text = "set interval"/> </LinearLayout> <LinearLayout android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: orientation = "horizontal"> <EditText android: id = "@ + id/editSetText" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_weight = "2" android: EMS = "10" android: hint = "input text"/> <Button android: id = "@ + id/btnSetText" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_weight = "3" android: text = "set text"/> </LinearLayout> <LinearLayout android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: orientation = "horizontal"> <SeekBar android: id = "@ + id/seekBar" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: layout_weight = "2"/> <TextView android: id = "@ + id/tvScreenLight" android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: text = "screen brightness" android: layout_weight = "3" android: gravity = "center" android: textSize = "20sp"/> </LinearLayout> <TextView android: id = "@ + id/tvFullScreen" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: gravity = "center" android: text = "" android: textSize = "280sp"/> </LinearLayout>XML file

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.