Android Open Source - african-art-talent-discovery Index






From Project

Back to project page african-art-talent-discovery.

License

The source code is released under:

GNU General Public License

If you think the Android project african-art-talent-discovery listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ekoconnect.afriphoto.fragments;
/*from   w ww .ja  v  a  2  s  .  c  o m*/
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.appsng.connectors.AppUtility;
import com.appsng.reusables.ImageHelper;
import com.appsng.reusables.TransparentDialog;
import com.appsng.reusables.Utilities;
import com.ekoconnect.afriphotos.ActivityFragment;
import com.ekoconnect.afriphotos.AwesomeActivity;
import com.ekoconnect.afriphotos.R;

public class Index extends BaseFragment{
  Button login,register,proceed;
  ImageView placeholder,close;
  LinearLayout loginlayout;
  EditText email,password;

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
    View viewer = (View) inflater.inflate(R.layout.fragment_index, container, false);
    login = (Button)viewer.findViewById(R.id.login);
    proceed = (Button)viewer.findViewById(R.id.proceed);
    register = (Button)viewer.findViewById(R.id.register);
    email = (EditText)viewer.findViewById(R.id.email);
    password = (EditText)viewer.findViewById(R.id.password);
    loginlayout = (LinearLayout)viewer.findViewById(R.id.login_layout);
    acBar.hide();
    
    placeholder = (ImageView)viewer.findViewById(R.id.placeholder);
    close = (ImageView)viewer.findViewById(R.id.close);
    Bitmap  mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
    placeholder.setImageBitmap(ImageHelper.getRoundedCornerBitmap(mBitmap, 500));
    setClickEvents();
    return viewer;
  }

  
  
  private void setClickEvents() {
    login.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        toggleLogin(true);
      }
    });
    
    close.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        toggleLogin(false);
      }
    });
    register.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        Utilities.newFragment = new Register();
        startActivity(new Intent(getActivity(), ActivityFragment.class));
                getActivity().overridePendingTransition(R.anim.slide_in_left_, R.anim.slide_out_left_);
      }
    });
    
    proceed.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        if(validate()) {
          if(Utilities.isOnline(getActivity())) {
            TransparentDialog dialog = new TransparentDialog(getActivity(), R.drawable.ajax_loader);
            dialog.show();
            AppUtility appUtility = new AppUtility(getActivity());
            appUtility.LoginUser(
                dialog, 
                email.getText().toString(), 
                password.getText().toString()
                );
            
          }else {
            Utilities.Toaster(getActivity(), Utilities.NO_INTERNET_TOAST);
          }
        }
      }
    });
    
    placeholder.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
                Intent intent = new Intent(context, AwesomeActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
        context.startActivity(intent);
      }
    });
  }
  
  
  protected boolean validate() {
    if(email.getText().toString().isEmpty()) {
      Utilities.Toaster(getActivity(), "Enter your email");
      return false;
    }else if(password.getText().toString().isEmpty()) {
      Utilities.Toaster(getActivity(), "Enter your password");
      return false;
    }else {
      return true;
    }
  }

  


  private void toggleLogin(boolean showlogin) {
    Animation bottom = AnimationUtils.loadAnimation(getSherlockActivity(),R.anim.bottom_down);
    Animation bottomUp = AnimationUtils.loadAnimation(getSherlockActivity(),R.anim.bottom_up);
    if(showlogin) {
      loginlayout.setVisibility(View.VISIBLE);
      loginlayout.startAnimation(bottomUp);
      placeholder.setVisibility(View.GONE);
      placeholder.startAnimation(bottom);
      
    }else {
      placeholder.startAnimation(bottomUp);
      loginlayout.setVisibility(View.GONE);
      loginlayout.startAnimation(bottom);
      placeholder.setVisibility(View.VISIBLE);
    }
  }
  
  
  private void AttachDialog() {
      final Dialog dialog = new Dialog(getActivity());
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.single_image_view);
        final Window window = dialog.getWindow();
        window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dialog.show();    
  }

  
  
}




Java Source Code List

com.appsng.adapters.CommentAdapter.java
com.appsng.adapters.ImagePagerAdapter.java
com.appsng.adapters.NotificationAdapter.java
com.appsng.adapters.PhotoGridAdapter.java
com.appsng.adapters.PhotoItemAdapter.java
com.appsng.adapters.PortfolioAdapter.java
com.appsng.connectors.AppUtility.java
com.appsng.connectors.CustomHttpClient2.java
com.appsng.connectors.CustomHttpClient.java
com.appsng.connectors.HttpFileUpload.java
com.appsng.connectors.LocalDataBase.java
com.appsng.models.Comment.java
com.appsng.models.Notification.java
com.appsng.models.PhotoList.java
com.appsng.models.Photo.java
com.appsng.models.Portfolio.java
com.appsng.reusables.Base64.java
com.appsng.reusables.CropOptionAdapter.java
com.appsng.reusables.CropOption.java
com.appsng.reusables.ImageHelper.java
com.appsng.reusables.TransparentDialog.java
com.appsng.reusables.Utilities.java
com.appsng.reusables.WakeLocker.java
com.appsng.reusables.ZoomImage.java
com.ekoconnect.afriphoto.fragments.BaseFragment.java
com.ekoconnect.afriphoto.fragments.Comments.java
com.ekoconnect.afriphoto.fragments.FragmentImageView.java
com.ekoconnect.afriphoto.fragments.Home.java
com.ekoconnect.afriphoto.fragments.Index.java
com.ekoconnect.afriphoto.fragments.Notifications.java
com.ekoconnect.afriphoto.fragments.Register.java
com.ekoconnect.afriphotos.ActivityFragment.java
com.ekoconnect.afriphotos.AwesomeActivity.java
com.ekoconnect.afriphotos.CameraActivity.java
com.ekoconnect.afriphotos.CopyOfMainActivity.java
com.ekoconnect.afriphotos.GCMIntentService.java
com.ekoconnect.afriphotos.GCM.java
com.ekoconnect.afriphotos.HomeActivity.java
com.ekoconnect.afriphotos.ImageViewActivity.java
com.ekoconnect.afriphotos.ImageViewPager.java
com.ekoconnect.afriphotos.MainActivity.java
com.ekoconnect.afriphotos.MyPhotos.java
com.ekoconnect.afriphotos.NotificationActivity.java
com.ekoconnect.afriphotos.Portfolio.java
com.ekoconnect.afriphotos.RefreshListView.java
com.ekoconnect.afriphotos.SplashScreen.java
com.ekokonnect.aada.MainActivity.java