Android Open Source - Android-Media-Helper Activity Manager






From Project

Back to project page Android-Media-Helper.

License

The source code is released under:

Apache License

If you think the Android project Android-Media-Helper 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 mobi.sherif.imageuploader;
//w  w  w .j a v a2  s .  c o m
import mobi.sherif.imageuploader.MediaEngine.MediaChooseCallback;
import android.content.Context;
import android.content.Intent;

interface ActivityManager {
  void startActivityForResult(Intent intent, int requestCode);

  void show(FragmentYesNoDialogBuilder builder, String tag);

  MediaChooseCallback getCallback( );

  Context getContext( );

  public static class StaticBuilder {
    private StaticBuilder( ) {
    }

    public static ActivityManager build(final android.app.Activity activity) {
      return new ActivityManager() {
        @Override
        public void startActivityForResult(Intent intent, int requestCode) {
          activity.startActivityForResult(intent, requestCode);
        }

        @Override
        public void show(FragmentYesNoDialogBuilder builder, String tag) {
          builder.build().show(activity.getFragmentManager(), tag);
        }

        @Override
        public Context getContext( ) {
          return activity;
        }

        @Override
        public MediaChooseCallback getCallback( ) {
          return (MediaChooseCallback) activity;
        }
      };
    }

    public static ActivityManager build(final android.support.v4.app.FragmentActivity activity) {
      return new ActivityManager() {
        @Override
        public void startActivityForResult(Intent intent, int requestCode) {
          activity.startActivityForResult(intent, requestCode);
        }

        @Override
        public void show(FragmentYesNoDialogBuilder builder, String tag) {
          builder.buildSupport().show(activity.getSupportFragmentManager(), tag);
        }

        @Override
        public Context getContext( ) {
          return activity;
        }

        @Override
        public MediaChooseCallback getCallback( ) {
          return (MediaChooseCallback) activity;
        }
      };
    }

    public static ActivityManager build(final android.app.Fragment fragment) {
      return new ActivityManager() {
        @Override
        public void startActivityForResult(Intent intent, int requestCode) {
          fragment.startActivityForResult(intent, requestCode);
        }

        @Override
        public void show(FragmentYesNoDialogBuilder builder, String tag) {
          builder.build().show(fragment.getChildFragmentManager(), tag);
        }

        @Override
        public Context getContext( ) {
          return fragment.getActivity();
        }

        @Override
        public MediaChooseCallback getCallback( ) {
          return (MediaChooseCallback) fragment;
        }
      };
    }

    public static ActivityManager build(final android.support.v4.app.Fragment fragment) {
      return new ActivityManager() {
        @Override
        public void startActivityForResult(Intent intent, int requestCode) {
          fragment.startActivityForResult(intent, requestCode);
        }

        @Override
        public void show(FragmentYesNoDialogBuilder builder, String tag) {
          builder.buildSupport().show(fragment.getChildFragmentManager(), tag);
        }

        @Override
        public Context getContext( ) {
          return fragment.getActivity();
        }

        @Override
        public MediaChooseCallback getCallback( ) {
          return (MediaChooseCallback) fragment;
        }
      };
    }
  }
}




Java Source Code List

mobi.sherif.example.imageuploader.ActivityForFragmentSupportVideo.java
mobi.sherif.example.imageuploader.ActivityForFragmentSupport.java
mobi.sherif.example.imageuploader.ActivityForFragmentVideo.java
mobi.sherif.example.imageuploader.ActivityForFragment.java
mobi.sherif.example.imageuploader.ImageUploaderActivitySupportVideo.java
mobi.sherif.example.imageuploader.ImageUploaderActivitySupport.java
mobi.sherif.example.imageuploader.ImageUploaderActivityVideo.java
mobi.sherif.example.imageuploader.ImageUploaderActivity.java
mobi.sherif.example.imageuploader.ImageUploaderFragmentSupportVideo.java
mobi.sherif.example.imageuploader.ImageUploaderFragmentSupport.java
mobi.sherif.example.imageuploader.ImageUploaderFragmentVideo.java
mobi.sherif.example.imageuploader.ImageUploaderFragment.java
mobi.sherif.example.imageuploader.MainActivity.java
mobi.sherif.imageuploader.ActivityManager.java
mobi.sherif.imageuploader.DefaultFileCreator.java
mobi.sherif.imageuploader.DefaultImageFileCreator.java
mobi.sherif.imageuploader.DefaultVideoFileCreator.java
mobi.sherif.imageuploader.FileLoadTask.java
mobi.sherif.imageuploader.FragmentSupportYesNoDialog.java
mobi.sherif.imageuploader.FragmentYesNoDialogBuilder.java
mobi.sherif.imageuploader.FragmentYesNoDialog.java
mobi.sherif.imageuploader.MediaEngine.java