Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.50 KB | None | 0 0
  1. package com.wake_e;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.content.pm.ActivityInfo;
  6. import android.os.Bundle;
  7. import android.view.Menu;
  8. import android.view.MenuItem;
  9. import android.view.View;
  10. import android.view.View.OnClickListener;
  11. import android.view.animation.Animation;
  12. import android.view.animation.AnimationUtils;
  13. import android.widget.ImageView;
  14. import android.widget.TextView;
  15. import android.widget.Toast;
  16.  
  17. public class SnoozeActivity extends Activity {
  18.     ImageView iv ;
  19.     ImageView iv2 ;
  20.     TextView heure;
  21.     TextView tv;
  22.     SnoozeActivity that;
  23.  
  24.     @Override
  25.     protected void onCreate(Bundle savedInstanceState) {
  26.         super.onCreate(savedInstanceState);
  27.         setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  28.         setContentView(R.layout.activity_snooze);
  29.        
  30.         iv = (ImageView) this.findViewById(R.id.imageView1);
  31.         iv2 = (ImageView) this.findViewById(R.id.imageView2);
  32.         heure = (TextView)  this.findViewById(R.id.heure);
  33.         tv = (TextView) this.findViewById(R.id.snooze);
  34.        
  35.         Animation rightAnim = AnimationUtils.loadAnimation(this, R.anim.scale_stop);
  36.         iv.setAnimation(rightAnim);
  37.         rightAnim.startNow();
  38.        
  39.         iv.setOnClickListener(stopRing);
  40.         iv2.setOnClickListener(stopRing);
  41.         tv.setOnClickListener(snooze);
  42.        
  43.         heure.setTypeface(MainActivity.future);
  44.         tv.setTypeface(MainActivity.future);
  45.        
  46.         that = this;
  47.     }
  48.  
  49.     @Override
  50.     public boolean onCreateOptionsMenu(Menu menu) {
  51.         // Inflate the menu; this adds items to the action bar if it is present.
  52.         getMenuInflater().inflate(R.menu.snooze, menu);
  53.         return true;
  54.     }
  55.  
  56.     @Override
  57.     public boolean onOptionsItemSelected(MenuItem item) {
  58.         // Handle action bar item clicks here. The action bar will
  59.         // automatically handle clicks on the Home/Up button, so long
  60.         // as you specify a parent activity in AndroidManifest.xml.
  61.         int id = item.getItemId();
  62.         if (id == R.id.action_settings) {
  63.             return true;
  64.         }
  65.         return super.onOptionsItemSelected(item);
  66.     }
  67.    
  68.     private OnClickListener stopRing = new OnClickListener() {
  69.  
  70.         @Override
  71.         public void onClick(View v) {
  72.             //TODO on arrete la sonnerie et tout le bordel ICI, a toi de jouer Yoann ;)
  73.             Toast.makeText(that, "L'alarme a été arrété", Toast.LENGTH_LONG).show();
  74.         }
  75.     };
  76.    
  77.     private OnClickListener snooze = new OnClickListener() {
  78.  
  79.         @Override
  80.         public void onClick(View v) {
  81.             //TODO on snooze, a toi de jouer Yoann ;)
  82.             Toast.makeText(that, "L'alarme a été snoozer", Toast.LENGTH_LONG).show();
  83.         }
  84.     };
  85.    
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement