Ejemplo n.º 1
0
  @SuppressLint("NewApi")
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(getApplicationContext());
    callbackManager = CallbackManager.Factory.create();

    // You need this method to be used only once to configure
    // your key hash in your App Console at
    // developers.facebook.com/apps

    getFbKeyHash("com.jaze.hello_world");

    setContentView(R.layout.activity_login);
    if (Build.VERSION.SDK_INT > 9) {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);
    }

    init();

    Button log = (Button) findViewById(R.id.btn_log);
    log.bringToFront();
    log.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            Boolean is_netConnetion = glbFunc.isInternetOn(LoginActivity.this, true);
            // .isConnectingToInternet(LoginActivity.this);
            if (glbFunc.isInternetOn(getApplicationContext(), false) == false) {
              new AlertDialog.Builder(LoginActivity.this)
                  .setTitle(R.string.app_name)
                  .setMessage(R.string.Server_not_reachable)
                  .setNeutralButton(R.string.OK_btn, null)
                  .setInverseBackgroundForced(true)
                  .show();

            } else {
              if (username.getText().toString().matches("")
                  && pass.getText().toString().matches("")) {
                new AlertDialog.Builder(LoginActivity.this)
                    .setTitle(R.string.app_name)
                    .setMessage(R.string.All_field_blank)
                    .setNeutralButton(R.string.OK_btn, null)
                    .setInverseBackgroundForced(true)
                    .show();

              } else {
                progressDialog =
                    new ProgressDialog(LoginActivity.this, R.style.AppTheme_Dark_Dialog);
                progressDialog.setIndeterminate(true);
                progressDialog.setMessage("Authenticating...");
                progressDialog.show();
                String Server_url = "http://www.thumpi.com/jazeit_api/api_user/login";
                new LongOperation().execute(Server_url);

                // http://www.thumpi.com/jazeit_api/api_user/[email protected]&password=q1w2e3r4
                /* if ( glbFunc.isInternetOn(getApplicationContext(), false) == true ) {
                    String names = username.getText().toString();
                    String appide = pass.getText().toString();
                    String _url = Server_url + "?email=" + names + "&password="******"Updating Server ..";
                    glbAsyn.PARAM_ShowDowloadDialog = false ;
                    glbAsyn.PARAM_PrefKey = "storedAddress";
                    glbAsyn.PARAM_PostHandler =	"SAVE_PREF";
                    glbAsyn.execute(_url);
                    glbAsyn = null;
                }*/
              }
            }
          }
        });
    fbLoginButton = (LoginButton) findViewById(R.id.fb_login_button);

    fbLoginButton.registerCallback(
        callbackManager,
        new FacebookCallback<LoginResult>() {
          @Override
          public void onSuccess(LoginResult loginResult) {
            Intent intent = new Intent(LoginActivity.this, Search_catagory.class);
            startActivity(intent);
            System.out.println("Facebook Login Successful!");
            System.out.println("Logged in user Details : ");
            System.out.println("--------------------------");
            System.out.println("User ID  : " + loginResult.getAccessToken().getUserId());
            Log.d("User Id ", "" + loginResult.getAccessToken().getUserId());
            Log.d("User name", "" + loginResult.getAccessToken().getApplicationId());
            prefs = getSharedPreferences(prefName, MODE_PRIVATE);
            SharedPreferences.Editor editor = prefs.edit();

            // ---save the values in the EditText view to preferences---
            editor.putString("FBUser_id", loginResult.getAccessToken().getUserId());
            editor.putString("FBAccessToken", loginResult.getAccessToken().getToken());

            editor.commit();
            System.out.println("Authentication Token : " + loginResult.getAccessToken().getToken());
            Log.d("Authentication : ", "" + loginResult.getAccessToken().getToken());
            Toast.makeText(LoginActivity.this, "Login Successful!", Toast.LENGTH_LONG).show();
          }

          @Override
          public void onCancel() {
            Toast.makeText(LoginActivity.this, "Login cancelled by user!", Toast.LENGTH_LONG)
                .show();
            System.out.println("Facebook Login failed!!");
          }

          @Override
          public void onError(FacebookException e) {
            Toast.makeText(LoginActivity.this, "Login unsuccessful!", Toast.LENGTH_LONG).show();
            System.out.println("Facebook Login failed!!");
          }
        });

    btnfb.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            final String urlFb = "fb://page/";
            Intent intent1 = new Intent(Intent.ACTION_VIEW);
            intent1.setData(Uri.parse(urlFb));

            final PackageManager packageManager = getPackageManager();
            List<ResolveInfo> list =
                packageManager.queryIntentActivities(intent1, PackageManager.MATCH_DEFAULT_ONLY);
            if (list.size() == 0) {
              final String urlBrowser = "https://www.facebook.com/pages/";
              intent1.setData(Uri.parse(urlBrowser));
            }
            overridePendingTransition(0, 0);
            startActivity(intent1);
          }
        });
    btntwit.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {

            String tweetUrl =
                String.format(
                    "https://twitter.com/intent/tweet?text=%s&url=%s",
                    urlEncode("Tweet text"), urlEncode("https://www.google.fi/"));
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(tweetUrl));

            // Narrow down to official Twitter app, if available:
            List<ResolveInfo> matches = getPackageManager().queryIntentActivities(intent, 0);
            for (ResolveInfo info : matches) {
              if (info.activityInfo.packageName.toLowerCase().startsWith("com.twitter")) {
                intent.setPackage(info.activityInfo.packageName);
              }
            }

            startActivity(intent);
          }
        });
    findViewById(R.id.btn_signup)
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                Intent intent = new Intent(LoginActivity.this, MainActivity.class);
                startActivity(intent);
              }
            });
    findViewById(R.id.btn_forgotpass)
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                Intent intent = new Intent(LoginActivity.this, Forgot_Password_Activity.class);
                startActivity(intent);
              }
            });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.free_flow_photo_grid_activity);

    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.frameLayout);

    final ImageAdapter adapter = new ImageAdapter();

    container = new FreeFlowContainer(this);

    DefaultLayoutAnimator anim = (DefaultLayoutAnimator) container.getLayoutAnimator();
    anim.animateAllSetsSequentially = false;
    anim.animateIndividualCellsSequentially = false;

    container.requestFocus();
    hLayout = new HLayout();
    hLayout.setLayoutParams(new HLayout.LayoutParams(100, 150, 600));

    vLayout = new VLayout();
    vLayout.setLayoutParams(new VLayout.LayoutParams(100, 600, 150));

    vGridLayout = new VGridLayout();
    vGridLayout.setLayoutParams(new VGridLayout.LayoutParams(200, 200, 600, 100));

    hGridLayout = new HGridLayout();
    hGridLayout.setLayoutParams(new HGridLayout.LayoutParams(200, 200, 100, 600));

    layouts = new FreeFlowLayout[] {vLayout, hLayout, vGridLayout, hGridLayout};

    container.setAdapter(adapter);
    container.setLayout(layouts[currentLayoutIndex]);

    frameLayout.addView(container);

    changeButton = ((Button) frameLayout.findViewById(R.id.transitionButton));
    changeButton.setText("Layout");

    changeButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            currentLayoutIndex++;
            if (currentLayoutIndex == layouts.length) {
              currentLayoutIndex = 0;
            }
            container.setLayout(layouts[currentLayoutIndex]);
          }
        });

    jumpButton = (Button) findViewById(R.id.jumpButton);
    jumpButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            int section = (int) (adapter.getNumberOfSections() * Math.random());
            int index = (int) (adapter.getSection(section).getDataCount() * Math.random());
            String s = "section = " + section + ", index = " + index;
            Toast.makeText(FreeFlowPhotoGridActivity.this, s, Toast.LENGTH_SHORT).show();
            container.scrollToItem(section, index, false);
          }
        });

    jumpButtonAnim = (Button) findViewById(R.id.jumpButtonAnim);
    jumpButtonAnim.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            int section = (int) (adapter.getNumberOfSections() * Math.random());
            int index = (int) (adapter.getSection(section).getDataCount() * Math.random());
            String s = "section = " + section + ", index = " + index;
            Toast.makeText(FreeFlowPhotoGridActivity.this, s, Toast.LENGTH_SHORT).show();
            container.scrollToItem(section, index, true);
          }
        });

    container.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AbsLayoutContainer parent, FreeFlowItem proxy) {
            Log.d("Test", "container item: " + proxy.itemSection + " /  " + proxy.itemIndex);
          }
        });

    changeButton.bringToFront();
    jumpButton.bringToFront();
    jumpButtonAnim.bringToFront();
  }
Ejemplo n.º 3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final MediaPlayer mp = MediaPlayer.create(this, R.raw.press);
    mp.setVolume(0.3f, 0.3f);

    //   uiHelper = new UiLifecycleHelper(this, callback);

    AppRater.app_launched(this);

    if (savedInstanceState != null) {
      mCameraFileName = savedInstanceState.getString("mCameraFileName");
    }
    // We create a new AuthSession so that we can use the Dropbox API.
    AndroidAuthSession session = buildSession();
    mApi = new DropboxAPI<AndroidAuthSession>(session);

    // Basic Android widgets
    setContentView(R.layout.main);

    RevMob revmob =
        RevMob.start(this); // RevMob Media ID configured in the AndroidManifest.xml file
    RevMobBanner banner = revmob.createBanner(this);
    ViewGroup view = (ViewGroup) findViewById(R.id.banner);

    // align bottom

    view.addView(banner);

    GridView gridview = (GridView) findViewById(R.id.gridview);
    myImageAdapter = new ImageAdapter(this);
    gridview.setAdapter(myImageAdapter);

    gridview.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            fullscreen.show();
          }
        });

    final String ExternalStorageDirectoryPath =
        Environment.getExternalStorageDirectory().getAbsolutePath();

    String targetPath = ExternalStorageDirectoryPath + PHOTO_DIR;

    Toast.makeText(getApplicationContext(), targetPath, Toast.LENGTH_LONG).show();

    File targetDirector = new File(targetPath);

    File dir = new File(ExternalStorageDirectoryPath + PHOTO_DIR);
    try {
      if (dir.mkdir()) {
        System.out.println("Directory created");
      } else {
        System.out.println("Directory is not created");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    File[] files = targetDirector.listFiles();

    for (File file : files) {

      myImageAdapter.add(file.getAbsolutePath());
      gridview.setFocusable(true);
    }

    fullscreen = revmob.createFullscreen(this, null); // pre-load it without showing it
    //    ViewGroup view = (ViewGroup) findViewById(R.id.banner);
    //    view.addView(banner);

    checkAppKeySetup();

    final AlphaAnimation alphaDown3, alphaUp3;

    mSubmit = (Button) findViewById(R.id.auth_button);
    // set animation
    alphaDown3 = new AlphaAnimation(1.0f, 0.5f);
    alphaUp3 = new AlphaAnimation(0.5f, 1.0f);
    alphaDown3.setDuration(100);
    alphaUp3.setDuration(100);
    alphaDown3.setFillAfter(true);
    alphaUp3.setFillAfter(true);

    // set OnTouchListener
    mSubmit.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            if (event.getAction() == MotionEvent.ACTION_DOWN) mSubmit.startAnimation(alphaDown3);
            alphaDown3.setFillAfter(false);

            if (event.getAction() == MotionEvent.ACTION_UP) mSubmit.startAnimation(alphaUp3);
            alphaUp3.setFillAfter(false);

            return false;
          }
        });

    mSubmit = (Button) findViewById(R.id.auth_button);

    mSubmit.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            mp.start();

            // This logs you out if you're logged in, or vice versa
            if (mLoggedIn) {

              logOut();
            }
          }
        });

    final AlphaAnimation alphaDown2, alphaUp2;

    Gallery = (Button) findViewById(R.id.gall);
    // set animation

    alphaDown2 = new AlphaAnimation(1.0f, 0.5f);
    alphaUp2 = new AlphaAnimation(0.5f, 1.0f);
    alphaDown2.setDuration(100);
    alphaUp2.setDuration(100);
    alphaDown2.setFillAfter(true);
    alphaUp2.setFillAfter(true);

    // set OnTouchListener
    Gallery.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            // TODO Auto-generated method stub
            if (event.getAction() == MotionEvent.ACTION_DOWN) Gallery.startAnimation(alphaDown2);

            alphaDown2.setFillAfter(false);

            if (event.getAction() == MotionEvent.ACTION_UP) Gallery.startAnimation(alphaUp2);

            alphaUp2.setFillAfter(false);

            //    Gallery.clearAnimation();

            return false;
          }
        });

    Gallery = (Button) findViewById(R.id.gall);

    Gallery.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {

            mp.start();

            fullscreen.show();

            Intent photoPickerIntent = new Intent(Intent.ACTION_VIEW);
            photoPickerIntent.setType("image/*");
            startActivity(photoPickerIntent);
          }
        });

    final AlphaAnimation alphaDown, alphaUp;

    box = (Button) findViewById(R.id.dropbox);
    // set animation
    alphaDown = new AlphaAnimation(1.0f, 0.5f);
    alphaUp = new AlphaAnimation(0.5f, 1.0f);
    alphaDown.setDuration(100);
    alphaUp.setDuration(100);
    alphaDown.setFillAfter(true);
    alphaUp.setFillAfter(true);

    // set OnTouchListener
    box.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            if (event.getAction() == MotionEvent.ACTION_DOWN) box.startAnimation(alphaDown);

            alphaDown.setFillAfter(false);

            if (event.getAction() == MotionEvent.ACTION_UP) box.startAnimation(alphaUp);

            alphaUp.setFillAfter(false);

            return false;
          }
        });

    box = (Button) findViewById(R.id.dropbox);

    box.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {

            mp.start();

            Intent intent = new Intent(Intent.CATEGORY_LAUNCHER);
            // intent.putExtra(Intent.EXTRA_SUBJECT, "Foo bar"); // NB: has no effect!

            // See if official Facebook app is found
            boolean facebookAppFound = false;
            List<ResolveInfo> matches = getPackageManager().queryIntentActivities(intent, 0);
            for (ResolveInfo info : matches) {
              if (info.activityInfo.packageName.toLowerCase().startsWith("com.dropbox.android")) {
                intent.setPackage(info.activityInfo.packageName);
                facebookAppFound = true;
                break;
              }
            }
            // As fallback, launch sharer.php in a browser
            if (!facebookAppFound) {
              String sharerUrl = "http://www.dropbox.com";
              intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sharerUrl));
            }

            startActivity(intent);

            try {

              PackageManager manager = getPackageManager();
              Intent i = manager.getLaunchIntentForPackage("com.dropbox.android");
              i.addCategory(Intent.CATEGORY_LAUNCHER);
              startActivity(i);
            } catch (ActivityNotFoundException e) {
              startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://dropbox.com/")));
            }
          }
        });

    loginbutton = (Button) findViewById(R.id.log_in);

    loginbutton.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            mp.start();

            // Start the remote authentication
            mApi.getSession().startAuthentication(CloudCam.this);
          }
        });

    final AlphaAnimation alphaDown1, alphaUp1;

    Kill = (Button) findViewById(R.id.Exit);
    // set animation
    alphaDown1 = new AlphaAnimation(1.0f, 0.5f);
    alphaUp1 = new AlphaAnimation(0.5f, 1.0f);
    alphaDown1.setDuration(100);
    alphaUp1.setDuration(100);
    alphaDown1.setFillAfter(true);
    alphaUp1.setFillAfter(true);

    // set OnTouchListener
    Kill.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            // TODO Auto-generated method stub
            if (event.getAction() == MotionEvent.ACTION_DOWN) Kill.startAnimation(alphaDown1);

            alphaDown1.setFillAfter(false);

            if (event.getAction() == MotionEvent.ACTION_UP) Kill.startAnimation(alphaUp1);

            alphaUp1.setFillAfter(false);

            return false;
          }
        });

    Kill = (Button) findViewById(R.id.Exit);

    Kill.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {

            mp.start();

            // Create custom dialog object
            final Dialog dialog = new Dialog(CloudCam.this);
            // Include dialog.xml file
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.dialog);
            // Set dialog title
            //        dialog.setTitle(" ✈ Cloud Cam ☁");
            TextView text = (TextView) dialog.findViewById(R.id.txt_dia);
            TextView text2 = (TextView) dialog.findViewById(R.id.lpt2);
            ImageView image2 = (ImageView) dialog.findViewById(R.id.vix);

            //     text.setText("\n Custom dialog Android example.");
            ImageView image = (ImageView) dialog.findViewById(R.id.imageDialog);
            image.setImageResource(R.drawable.cloud);

            Button buttonl = (Button) dialog.findViewById(R.id.Like);
            buttonl.setOnClickListener(
                new OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    // Perform action on click
                    mp.start();

                    try {
                      Intent intent =
                          new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/1638346363055062"));
                      startActivity(intent);
                    } catch (Exception e) {
                      startActivity(
                          new Intent(
                              Intent.ACTION_VIEW,
                              Uri.parse(
                                  "https://www.facebook.com/pages/Vixel-Interactive/1638346363055062")));
                    }

                    dialog.dismiss();
                  }
                });

            ImageView buttonv = (ImageView) dialog.findViewById(R.id.vix);
            buttonv.setOnClickListener(
                new OnClickListener() {
                  @Override
                  public void onClick(View v) {

                    mp.start();

                    // Perform action on click

                    try {
                      Intent intent =
                          new Intent(
                              Intent.ACTION_VIEW, Uri.parse("http://www.vixelinteractive.com"));
                      startActivity(intent);
                    } catch (Exception e) {
                    }

                    dialog.dismiss();
                  }
                });

            Button button69 = (Button) dialog.findViewById(R.id.insta);
            button69.setOnClickListener(
                new OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    // Perform action on click
                    mp.start();

                    Uri uri = Uri.parse("http://instagram.com/_u/vixel_interactive");
                    Intent likeIng = new Intent(Intent.ACTION_VIEW, uri);

                    likeIng.setPackage("com.instagram.android");

                    try {
                      startActivity(likeIng);
                    } catch (ActivityNotFoundException e) {
                      startActivity(
                          new Intent(
                              Intent.ACTION_VIEW,
                              Uri.parse("https://instagram.com/vixel_interactive")));
                    }

                    dialog.dismiss();
                  }
                });

            Button button = (Button) dialog.findViewById(R.id.Rate);
            button.setOnClickListener(
                new OnClickListener() {
                  @Override
                  public void onClick(View v) {

                    mp.start();

                    // Perform action on click

                    startActivity(
                        new Intent(
                            Intent.ACTION_VIEW,
                            Uri.parse("market://details?id=" + getPackageName())));

                    dialog.dismiss();
                  }
                });

            Button button3 = (Button) dialog.findViewById(R.id.Share);
            button3.setOnClickListener(
                new OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    // Perform action on click

                    mp.start();

                    String urlToShare =
                        "https://play.google.com/store/apps/details?id=" + getPackageName();
                    Intent intent = new Intent(Intent.ACTION_SEND);
                    intent.setType("text/plain");
                    // intent.putExtra(Intent.EXTRA_SUBJECT, "Foo bar"); // NB: has no effect!
                    intent.putExtra(Intent.EXTRA_TEXT, urlToShare);

                    // See if official Facebook app is found
                    boolean facebookAppFound = false;
                    List<ResolveInfo> matches =
                        getPackageManager().queryIntentActivities(intent, 0);
                    for (ResolveInfo info : matches) {
                      if (info.activityInfo
                          .packageName
                          .toLowerCase()
                          .startsWith("com.facebook.katana")) {
                        intent.setPackage(info.activityInfo.packageName);
                        facebookAppFound = true;
                        break;
                      }
                    }
                    // https://play.google.com/store/apps/details?id=" + getPackageName();
                    // As fallback, launch sharer.php in a browser
                    if (!facebookAppFound) {
                      String sharerUrl =
                          "https://www.facebook.com/sharer/sharer.php?u=" + urlToShare;
                      intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sharerUrl));
                    }

                    startActivity(intent);

                    dialog.dismiss();
                  }
                });

            // Typecasting the Animation Drawable

            dialog.show();
          }
        });

    mDisplay = (LinearLayout) findViewById(R.id.logged_in_display);

    Start1 = (TextView) findViewById(R.id.lpt2);

    asd = (GridView) findViewById(R.id.gridview);

    dropbox = (Button) findViewById(R.id.dropbox);

    gallbutton = (Button) findViewById(R.id.gall);

    vtext = (TextView) findViewById(R.id.tmt1);

    vmix = (ImageView) findViewById(R.id.tmt2);

    //   Start2 = (TextView)findViewById(R.id.lpt3);

    Start4 = (ImageView) findViewById(R.id.vix);

    Start5 = (ImageView) findViewById(R.id.cc);

    // Dropbox = (Button)findViewById(R.id.dropbox);

    final AlphaAnimation alphaDown4, alphaUp4;

    mPhoto = (Button) findViewById(R.id.photo_button);
    // set animation
    alphaDown4 = new AlphaAnimation(1.0f, 0.5f);
    alphaUp4 = new AlphaAnimation(0.5f, 1.0f);
    alphaDown4.setDuration(100);
    alphaUp4.setDuration(100);
    alphaDown4.setFillAfter(true);
    alphaUp4.setFillAfter(true);

    // set OnTouchListener
    mPhoto.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {

            // TODO Auto-generated method stub
            if (event.getAction() == MotionEvent.ACTION_DOWN) mPhoto.startAnimation(alphaDown4);

            alphaDown4.setFillAfter(false);

            if (event.getAction() == MotionEvent.ACTION_UP) mPhoto.startAnimation(alphaUp4);

            alphaUp4.setFillAfter(false);

            return false;
          }
        });

    // This is where a photo is displayed
    //    mImage = (ImageView)findViewById(R.id.image_view);

    // This is the button to take a photo
    mPhoto = (Button) findViewById(R.id.photo_button);
    mPhoto.bringToFront();
    mPhoto.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {

            mp.start();
            fullscreen.show();

            Intent intent = new Intent();

            // Picture from camera
            intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);

            // This is not the right way to do this, but for some reason, having
            // it store it in
            // MediaStore.Images.Media.EXTERNAL_CONTENT_URI isn't working right.

            Date date = new Date();
            DateFormat df = new SimpleDateFormat("yyyy-MM-dd-kk-mm-ss");

            String newPicFile = df.format(date) + ".jpg";
            String outPath =
                Environment.getExternalStorageDirectory()
                    + File.separator
                    + "CloudCameraBackup"
                    + File.separator
                    + newPicFile;
            File outFile = new File(outPath);

            mCameraFileName = outFile.toString();
            Uri outuri = Uri.fromFile(outFile);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, outuri);
            Log.i(TAG, "Importing New Picture: " + mCameraFileName);
            try {
              startActivityForResult(intent, NEW_PICTURE);
            } catch (ActivityNotFoundException e) {
              showToast("There doesn't seem to be a camera.");
            }
          }
        });

    // This is the button to take a photo

    // Display the proper UI state if logged in or not
    setLoggedIn(mApi.getSession().isLinked());
  }