Android Open Source - african-art-talent-discovery My Photos






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.afriphotos;
/*from  w  ww  .  j a v a 2 s  .  c om*/

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;

import com.appsng.adapters.PhotoGridAdapter;
import com.appsng.connectors.LocalDataBase;
import com.appsng.models.Photo;
import com.appsng.models.PhotoList;
import com.appsng.reusables.Utilities;

public class MyPhotos extends Activity {
  
  GridView grid_menu;
  ArrayList<Photo> photos = new ArrayList<Photo>();
  LocalDataBase localDataBase;
  static ArrayList<PhotoList> photolist = new ArrayList<PhotoList>();

  
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.myphotos);        
        grid_menu = (GridView)findViewById(R.id.gridView1);
        
        localDataBase = new LocalDataBase(this);
    setTitle("My Photos");

        loadDataFromDb();
    }

  private void loadDataFromDb() {
    photos = localDataBase.getMyPhotos();
        setUpGridView(photos);
  }

  private void setUpGridView(ArrayList<Photo> photos2) {
    PhotoGridAdapter madapter = new PhotoGridAdapter(this, photos2);
    grid_menu.setAdapter(madapter);
    
    
    setClickListener();
  }

  private void setClickListener() {
        // Listening to GridView item click
    for(int g = 0;g < photos.size();g++) {
      photolist.add(new PhotoList(
          photos.get(g).getId(), 
          photos.get(g).getCaption(), 
          photos.get(g).getUrl(), 
          photos.get(g).getPortfolio_id(), 
          photos.get(g).getUser_id(), 
          photos.get(g).getLikes(), 
          photos.get(g).getCreated(), 
          "121 Comments", 
          "portfolio_name", 
          "portfolio_num_of_photos", 
          photos.get(g).getUsername(), 
          "user_photo_url", 
          "user_lat", 
          "user_lng"
          ));
    }

    grid_menu.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
              // Launch ImageViewPager.java on selecting GridView Item
              Intent i = new Intent(getApplicationContext(), ImageViewActivity.class);
              // Show a simple toast message for the item position
              //Toast.makeText(MyPhotos.this, "" + position, Toast.LENGTH_SHORT).show();
              // Send the click position to ImageViewPager.java using intent
              i.putExtra("id", position);
              Utilities.photolist = new ArrayList<PhotoList>();
              Utilities.photolist.clear();
              Utilities.photolist = photolist;
              //i.putStringArrayListExtra("photos", photos);
                // Start ImageViewPager
                startActivity(i);
                overridePendingTransition(R.anim.slide_out_left_, R.anim.slide_in_left_);

            }
        });    
  }
   
}




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