Implementation of the startup page of Netease news advertisement and Netease news advertisement
As a result of the project's needs, you need to implement a similar effect similar to that on the Netease news advertisement startup page and write one by yourself. The main functions are as follows:
First, the first image is displayed when the application is started;
Second: fade the second image (animated );
3. After the animation ends, you can click an image to go to the advertisement details page;
4. If you do not click an advertisement, the homepage is automatically displayed three seconds later;
The source code is as follows:
Public class MainActivity extends Activity implements OnClickListener {private ImageView firstImage = null; private ImageView secondImage = null; private int runCount = 0; // The number of times the thread executes private Animation inAnimation; // animation final Handler handler = new Handler (); private Boolean flag = false; // whether to click the advertisement private Timer mTimer = null; private TimerTask mTimerTask = null; private long delay= 4000; @ Overrideprotect Ed void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_main); firstImage = (ImageView) findViewById (R. id. first_img); // the first figure displayed: secondImage = (ImageView) findViewById (R. id. second_img); // The second image of the incremental step, firstImage. setOnClickListener (this); secondImage. setOnClickListener (this); inAnimation = AnimationUtils. loadAnimation (this, R. anim. fade); // defines an incremental animation adCa. NClick (); // you can click an advertisement image after the animation is played. Otherwise, the exception runCount = 0 may occur. // global variable, used to determine whether Runnable runnable = new Runnable () {@ Overridepublic void run () {// TODO Auto-generated method stubif (runCount = 1) is executed for the first time) {// when the first execution is performed, disable the scheduled execution. // Add the code secondImage to the execution. setVisibility (View. VISIBLE); secondImage. startAnimation (inAnimation); startTimer (); handler. removeCallbacks (this); // stop Timer: deletes the specified Runnable object and stops the thread object.} if (runCount = 0) {// only allow this thread to execute handler once. postDelayed (this, 100); // while the 150 ms in Runnable indicates that your function module is executed every 150 milliseconds;} runCount ++ ;}}; handler. postDelayed (runnable, 1000); // enable the timer and execute the operation: one second in postDelay indicates that the program is running until one second. Enable the handler} @ Overridepublic void onClick (View v) {// TODO Auto-generated method stubswitch (v. getId () {case R. id. first_img: flag = true; // indicates that the stopTimer () is clicked within three seconds of the AD display; // startTimer () is disabled first; // then break is enabled; case R. id. second_img: Flag = true; // indicates that the stopTimer (); startTimer (); break; default: break;} is clicked to view the ad within three seconds ;}} /*** open timer */private void startTimer () {if (mTimer = null) {mTimer = new Timer ();} if (mTimerTask = null) {mTimerTask = new TimerTask () {@ Overridepublic void run () {if (flag) {Intent intent = new Intent (MainActivity. this, AdActivity. class); startActivity (intent); stopTimer ();} else {Intent intent = new Intent (MainAct Ivity. this, MainPageActivity. class); startActivity (intent); stopTimer () ;}};}if (flag) {// if the button is clicked, reset the delay time, so that this operation is performed immediately delay = 100;} if (mTimer! = Null & mTimerTask! = Null) mTimer. schedule (mTimerTask, delay);}/*** disable timer */private void stopTimer () {if (mTimer! = Null) {mTimer. cancel (); mTimer = null;} if (mTimerTask! = Null) {mTimerTask. cancel (); mTimerTask = null ;}/ *** click */private void adCanClick () {firstImage. setClickable (false); secondImage. setClickable (false); new Timer (). schedule (new TimerTask () {@ Overridepublic void run () {// TODO Auto-generated method stubfirstImage. setClickable (true); secondImage. setClickable (true) ;}}, 2100); // this time is the time when the animation has been played }}
A woku advertisement pops up as soon as the Netease news page is opened recently. Is it a trojan?
Try this software.
Special Trojan ad effect software ewido 7.5
Www.crsky.com/soft/8937.html
The only available 70AM-TH1DZ1-PL-C05-S22AFR-94U-E7Z0 is used each time it is entered for upgrade. If it is no longer killed, the system will be reinstalled in Zone C.
If you do not want to delete a key value, right-click to delete it, or manually delete it (Run regedit) according to the path provided by it.
Does Netease news websites always play junk advertisement pages?
I have also seen it. It's annoying to intercept it.