Android Open Source - photogallery Photo Gallery Activity






From Project

Back to project page photogallery.

License

The source code is released under:

Apache License

If you think the Android project photogallery 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.donnemartin.android.photogallery;
//  w  ww.j ava  2s.co  m
import android.app.SearchManager;
import android.content.Intent;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.util.Log;

public class PhotoGalleryActivity extends SingleFragmentActivity {

    private static final String TAG = "PhotoGalleryActivity";

    @Override
    public Fragment createFragment() {
        return new PhotoGalleryFragment();
    }

    @Override
    public void onNewIntent(Intent intent) {
        // Search is implemented using the singleTop launch mode.  Instead of
        // launching a new activity, the search intent will go to this
        // PhotoGalleryActivity on top of the back stack
        //
        // Note, if you need the new intent value, save it somewhere
        // getIntent() will have the old intent (return the intent that started
        // this activity)
        PhotoGalleryFragment fragment = (PhotoGalleryFragment)
            getSupportFragmentManager()
            .findFragmentById(R.id.fragmentContainer);

        if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
            String query = intent.getStringExtra(SearchManager.QUERY);
            Log.i(TAG, "Received a new search query: " + query);

            // Get the instance of SharedPreferences (with a default name and
            // private permissions) that is shared across the entire app
            // SharedPreferences.Editor stashes values into SharedPreferences
            // and allows us to group sets of changes together in transactions,
            // which is helpful if you have a lot of changes.
            PreferenceManager.getDefaultSharedPreferences(this)
                .edit()
                .putString(FlickrConn.PREF_SEARCH_QUERY, query)
                .commit();
        }

        // Whenever we receive a new intent, we want to refresh the items
        fragment.updateItems();
    }
}




Java Source Code List

com.donnemartin.android.photogallery.Creds.java
com.donnemartin.android.photogallery.FlickrConn.java
com.donnemartin.android.photogallery.GalleryItem.java
com.donnemartin.android.photogallery.NotificationReceiver.java
com.donnemartin.android.photogallery.PhotoGalleryActivity.java
com.donnemartin.android.photogallery.PhotoGalleryFragment.java
com.donnemartin.android.photogallery.PhotoPageActivity.java
com.donnemartin.android.photogallery.PhotoPageFragment.java
com.donnemartin.android.photogallery.PollService.java
com.donnemartin.android.photogallery.SingleFragmentActivity.java
com.donnemartin.android.photogallery.StartupReceiver.java
com.donnemartin.android.photogallery.ThumbnailDownloader.java
com.donnemartin.android.photogallery.VisibleFragment.java