Android Open Source - guerrillaprose Title Fragment






From Project

Back to project page guerrillaprose.

License

The source code is released under:

GNU General Public License

If you think the Android project guerrillaprose 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 de.handler.mobile.android.bachelorapp.app.ui.fragments;
// w  w  w . java2s.  co m
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.App;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;

import de.handler.mobile.android.bachelorapp.app.BachelorApp;
import de.handler.mobile.android.bachelorapp.app.R;
import de.handler.mobile.android.bachelorapp.app.controllers.MediaController;
import de.handler.mobile.android.bachelorapp.app.ui.BigPictureActivity_;
import de.handler.mobile.android.bachelorapp.app.ui.MainActivity;

/**
 * Shown in HomeFragment on top
 * Shows Image and lets the user record new media
 */
@EFragment(R.layout.fragment_title)
public class TitleFragment extends Fragment implements View.OnClickListener {

    @ViewById(R.id.fragmentTitle_image)
    ImageView mImageView;

    @ViewById(R.id.fragmentTitle_camera)
    ImageButton mCameraButton;

    @ViewById(R.id.fragmentTitle_gallery)
    ImageButton mGalleryButton;

    @ViewById(R.id.fragmentTitle_image_author)
    TextView mImageTextView;

    @ViewById(R.id.fragmentTitle_text)
    TextView mFragmentTitleText;

    @Bean
    MediaController mediaController;


    @App
    BachelorApp app;


    @AfterViews
    void init() {
        // Create custom typeface
        Typeface myTypeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Thin.ttf");

        mImageView.setImageBitmap(app.getTitleImage());

        mImageTextView.setText(app.getTitleImageAuthor());
        mImageTextView.setTypeface(myTypeface);
        mFragmentTitleText.setTypeface(myTypeface);

        mImageView.setOnClickListener(this);
        mCameraButton.setOnClickListener(this);
        mGalleryButton.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.fragmentTitle_camera:
                this.startCamera();
                break;
            case R.id.fragmentTitle_image:
                this.startBigPicture();
                break;
            case R.id.fragmentTitle_gallery:
                this.startGallery();
                break;
        }
    }

    private void startBigPicture() {
        getActivity().startActivity(new Intent(getActivity(), BigPictureActivity_.class));
    }

    private void startGallery() {
        getActivity().startActivityForResult(
                new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
                MainActivity.REQUEST_CODE_SELECT_IMAGE);
    }

    private void startCamera() {
        Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        Uri mediaFileUri = mediaController.getMediaFileUri();
        // due to workaround (activity state loss --> support library) set uri of new file in app object
        // only used here and if user cancels camera operation --> onActivityResult (MainActivity)
        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mediaFileUri);
        app.setTempImageUri(mediaFileUri);
        getActivity().startActivityForResult(takePictureIntent, MainActivity.REQUEST_CODE_IMAGE_CAPTURE);
    }
}




Java Source Code List

de.handler.mobile.android.bachelorapp.app.BachelorApp.java
de.handler.mobile.android.bachelorapp.app.api.GuerrillaService.java
de.handler.mobile.android.bachelorapp.app.api.RestServiceErrorHandler.java
de.handler.mobile.android.bachelorapp.app.api.flickr.FlickrDataRestService.java
de.handler.mobile.android.bachelorapp.app.api.flickr.FlickrJson.java
de.handler.mobile.android.bachelorapp.app.api.flickr.FlickrManager.java
de.handler.mobile.android.bachelorapp.app.api.flickr.FlickrPhotoRestService.java
de.handler.mobile.android.bachelorapp.app.api.flickr.flickrAuthor.FlickrAuthor.java
de.handler.mobile.android.bachelorapp.app.api.flickr.flickrJson.FlickrPhotos.java
de.handler.mobile.android.bachelorapp.app.api.flickr.flickrJson.flickrPhotos.FlickrPhoto.java
de.handler.mobile.android.bachelorapp.app.controllers.MediaController.java
de.handler.mobile.android.bachelorapp.app.controllers.MediaTypeController.java
de.handler.mobile.android.bachelorapp.app.controllers.NetworkController.java
de.handler.mobile.android.bachelorapp.app.controllers.ProseController.java
de.handler.mobile.android.bachelorapp.app.controllers.Tag.java
de.handler.mobile.android.bachelorapp.app.controllers.UserController.java
de.handler.mobile.android.bachelorapp.app.database.DaoMaster.java
de.handler.mobile.android.bachelorapp.app.database.DaoSession.java
de.handler.mobile.android.bachelorapp.app.database.GuerrillaDao.java
de.handler.mobile.android.bachelorapp.app.database.GuerrillaProseDao.java
de.handler.mobile.android.bachelorapp.app.database.GuerrillaProse.java
de.handler.mobile.android.bachelorapp.app.database.Guerrilla.java
de.handler.mobile.android.bachelorapp.app.database.MediaDao.java
de.handler.mobile.android.bachelorapp.app.database.MediaTypeDao.java
de.handler.mobile.android.bachelorapp.app.database.MediaType.java
de.handler.mobile.android.bachelorapp.app.database.Media.java
de.handler.mobile.android.bachelorapp.app.helper.BitmapCache.java
de.handler.mobile.android.bachelorapp.app.helper.CustomNetworkImageView.java
de.handler.mobile.android.bachelorapp.app.interfaces.AppPreferences.java
de.handler.mobile.android.bachelorapp.app.interfaces.OnBackPressedListener.java
de.handler.mobile.android.bachelorapp.app.interfaces.OnFlickrListener.java
de.handler.mobile.android.bachelorapp.app.interfaces.OnLocationListener.java
de.handler.mobile.android.bachelorapp.app.interfaces.OnMediaListener.java
de.handler.mobile.android.bachelorapp.app.interfaces.OnMediaTypeListener.java
de.handler.mobile.android.bachelorapp.app.interfaces.OnProseListener.java
de.handler.mobile.android.bachelorapp.app.interfaces.OnUserListener.java
de.handler.mobile.android.bachelorapp.app.location.LocationHandler.java
de.handler.mobile.android.bachelorapp.app.security.Encryption.java
de.handler.mobile.android.bachelorapp.app.ui.AuthenticatorActivity.java
de.handler.mobile.android.bachelorapp.app.ui.BaseActivity.java
de.handler.mobile.android.bachelorapp.app.ui.BigPictureActivity.java
de.handler.mobile.android.bachelorapp.app.ui.MainActivity.java
de.handler.mobile.android.bachelorapp.app.ui.ProseGalleryActivity.java
de.handler.mobile.android.bachelorapp.app.ui.SplashActivity.java
de.handler.mobile.android.bachelorapp.app.ui.WebActivity.java
de.handler.mobile.android.bachelorapp.app.ui.adapters.ImageTagAdapter.java
de.handler.mobile.android.bachelorapp.app.ui.adapters.NavigationDrawerAdapter.java
de.handler.mobile.android.bachelorapp.app.ui.adapters.ProseListAdapter.java
de.handler.mobile.android.bachelorapp.app.ui.adapters.SectionsPagerAdapter.java
de.handler.mobile.android.bachelorapp.app.ui.dialogs.DeleteDialogFragment.java
de.handler.mobile.android.bachelorapp.app.ui.dialogs.ProseDialogFragment.java
de.handler.mobile.android.bachelorapp.app.ui.dialogs.VerifyUserDialogFrament.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.BaseGridFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.ContentFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.ContentListFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.ContentTagFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.GalleryContainerFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.GalleryContentFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.GalleryTitleFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.HomeFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.ProseFragment.java
de.handler.mobile.android.bachelorapp.app.ui.fragments.TitleFragment.java