// Path: Idovatar/src/main/java/com/uphyca/idobata/android/InjectionUtils.java
// public abstract class InjectionUtils {
// 
//     private InjectionUtils() {
//     }
// 
//     public static ObjectGraph getObjectGraph(Context context) {
//         return IdobataApplication.class.cast(context.getApplicationContext())
//                                        .getObjectGraph();
//     }
// }
// 
// Path: Idovatar/src/main/java/com/uphyca/idobata/android/service/PostImageService.java
// public class PostImageService extends IntentService {
// 
//     private static final String EXTRA_ROOM_URI = "room_uri";
// 
//     public static void postImage(Context context, Uri roomUri, Uri dataUri) {
//         Intent intent = new Intent(context, PostImageService.class).setData(dataUri)
//                                                                    .putExtra(EXTRA_ROOM_URI, roomUri);
//         context.startService(intent);
//     }
// 
//     @Inject
//     Idobata mIdobata;
// 
//     public PostImageService() {
//         super("PostImageService");
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         InjectionUtils.getObjectGraph(this)
//                       .inject(this);
//     }
// 
//     @Override
//     protected void onHandleIntent(Intent intent) {
//         Uri roomUri = intent.getParcelableExtra(EXTRA_ROOM_URI);
//         Uri dataUri = intent.getData();
//         String mimeType = null;
//         try {
//             String[] tuple = roomUri.getFragment()
//                                     .split("/");
//             String organizationSlug = tuple[2];
//             String roomName = tuple[4];
//             long roomId = mIdobata.getRoom(organizationSlug, roomName)
//                                   .getId();
//             Cursor meta = getContentResolver().query(dataUri, new String[] {
//                 "mime_type"
//             }, null, null, null);
//             try {
//                 if (meta.moveToNext()) {
//                     mimeType = meta.getString(0);
//                 }
//             } finally {
//                 meta.close();
//             }
//             String fileName = "image." + mimeType.split("/")[1];
//             mIdobata.postMessage(roomId, fileName, mimeType, getContentResolver().openInputStream(dataUri));
//         } catch (FileNotFoundException e) {
//             e.printStackTrace();
//         } catch (IdobataError idobataError) {
//             idobataError.printStackTrace();
//         }
//     }
// }
// 
// Path: Idovatar/src/main/java/com/uphyca/idobata/android/service/PostTextService.java
// public class PostTextService extends IntentService {
// 
//     private static final String EXTRA_ROOM_URI = "room_uri";
//     private static final String EXTRA_SOURCE = "source";
// 
//     public static void postText(Context context, Uri roomUri, String source) {
//         Intent intent = new Intent(context, PostTextService.class).putExtra(EXTRA_SOURCE, source)
//                                                                   .putExtra(EXTRA_ROOM_URI, roomUri);
//         context.startService(intent);
//     }
// 
//     @Inject
//     Idobata mIdobata;
// 
//     public PostTextService() {
//         super("PostTextService");
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         InjectionUtils.getObjectGraph(this)
//                       .inject(this);
//     }
// 
//     @Override
//     protected void onHandleIntent(Intent intent) {
//         Uri roomUri = intent.getParcelableExtra(EXTRA_ROOM_URI);
//         String source = intent.getStringExtra(EXTRA_SOURCE);
//         try {
//             String[] tuple = roomUri.getFragment()
//                                     .split("/");
//             String organizationSlug = tuple[2];
//             String roomName = tuple[4];
//             long roomId = mIdobata.getRoom(organizationSlug, roomName)
//                                   .getId();
//             mIdobata.postMessage(roomId, source);
//         } catch (IdobataError idobataError) {
//             idobataError.printStackTrace();
//         }
//     }
// }
// 
// Path: Idovatar/src/main/java/com/uphyca/idobata/android/data/IdobataUtils.java
// public static Organization findOrganizationById(long id, List<Organization> organizations) {
//     for (Organization org : organizations) {
//         if (org.getId() == id) {
//             return org;
//         }
//     }
//     return null;
// }


import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.uphyca.idobata.Idobata;
import com.uphyca.idobata.IdobataError;
import com.uphyca.idobata.android.InjectionUtils;
import com.uphyca.idobata.android.R;
import com.uphyca.idobata.android.data.api.Main;
import com.uphyca.idobata.android.data.api.Networking;
import com.uphyca.idobata.android.service.PostImageService;
import com.uphyca.idobata.android.service.PostTextService;
import com.uphyca.idobata.model.Organization;
import com.uphyca.idobata.model.Records;
import com.uphyca.idobata.model.Room;
import com.uphyca.idobata.model.Seed;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import javax.inject.Inject;
import static com.uphyca.idobata.android.data.IdobataUtils.findOrganizationById;

package com.uphyca.idobata.android.ui;






public class SendTo extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_send_to);
    }

    public static class Rooms extends ListFragment {

        @Inject
        Idobata mIdobata;

        @Inject
        @Networking
        Executor mExecutor;

        @Inject
        @Main
        Executor mDispatcher;

        private Seed mSeed;

        @Override
        public void onActivityCreated(Bundle savedInstanceState) {
            super.onActivityCreated(savedInstanceState);
// Path: Idovatar/src/main/java/com/uphyca/idobata/android/InjectionUtils.java
// public abstract class InjectionUtils {
// 
//     private InjectionUtils() {
//     }
// 
//     public static ObjectGraph getObjectGraph(Context context) {
//         return IdobataApplication.class.cast(context.getApplicationContext())
//                                        .getObjectGraph();
//     }
// }
// 
// Path: Idovatar/src/main/java/com/uphyca/idobata/android/service/PostImageService.java
// public class PostImageService extends IntentService {
// 
//     private static final String EXTRA_ROOM_URI = "room_uri";
// 
//     public static void postImage(Context context, Uri roomUri, Uri dataUri) {
//         Intent intent = new Intent(context, PostImageService.class).setData(dataUri)
//                                                                    .putExtra(EXTRA_ROOM_URI, roomUri);
//         context.startService(intent);
//     }
// 
//     @Inject
//     Idobata mIdobata;
// 
//     public PostImageService() {
//         super("PostImageService");
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         InjectionUtils.getObjectGraph(this)
//                       .inject(this);
//     }
// 
//     @Override
//     protected void onHandleIntent(Intent intent) {
//         Uri roomUri = intent.getParcelableExtra(EXTRA_ROOM_URI);
//         Uri dataUri = intent.getData();
//         String mimeType = null;
//         try {
//             String[] tuple = roomUri.getFragment()
//                                     .split("/");
//             String organizationSlug = tuple[2];
//             String roomName = tuple[4];
//             long roomId = mIdobata.getRoom(organizationSlug, roomName)
//                                   .getId();
//             Cursor meta = getContentResolver().query(dataUri, new String[] {
//                 "mime_type"
//             }, null, null, null);
//             try {
//                 if (meta.moveToNext()) {
//                     mimeType = meta.getString(0);
//                 }
//             } finally {
//                 meta.close();
//             }
//             String fileName = "image." + mimeType.split("/")[1];
//             mIdobata.postMessage(roomId, fileName, mimeType, getContentResolver().openInputStream(dataUri));
//         } catch (FileNotFoundException e) {
//             e.printStackTrace();
//         } catch (IdobataError idobataError) {
//             idobataError.printStackTrace();
//         }
//     }
// }
// 
// Path: Idovatar/src/main/java/com/uphyca/idobata/android/service/PostTextService.java
// public class PostTextService extends IntentService {
// 
//     private static final String EXTRA_ROOM_URI = "room_uri";
//     private static final String EXTRA_SOURCE = "source";
// 
//     public static void postText(Context context, Uri roomUri, String source) {
//         Intent intent = new Intent(context, PostTextService.class).putExtra(EXTRA_SOURCE, source)
//                                                                   .putExtra(EXTRA_ROOM_URI, roomUri);
//         context.startService(intent);
//     }
// 
//     @Inject
//     Idobata mIdobata;
// 
//     public PostTextService() {
//         super("PostTextService");
//     }
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         InjectionUtils.getObjectGraph(this)
//                       .inject(this);
//     }
// 
//     @Override
//     protected void onHandleIntent(Intent intent) {
//         Uri roomUri = intent.getParcelableExtra(EXTRA_ROOM_URI);
//         String source = intent.getStringExtra(EXTRA_SOURCE);
//         try {
//             String[] tuple = roomUri.getFragment()
//                                     .split("/");
//             String organizationSlug = tuple[2];
//             String roomName = tuple[4];
//             long roomId = mIdobata.getRoom(organizationSlug, roomName)
//                                   .getId();
//             mIdobata.postMessage(roomId, source);
//         } catch (IdobataError idobataError) {
//             idobataError.printStackTrace();
//         }
//     }
// }
// 
// Path: Idovatar/src/main/java/com/uphyca/idobata/android/data/IdobataUtils.java
// public static Organization findOrganizationById(long id, List<Organization> organizations) {
//     for (Organization org : organizations) {
//         if (org.getId() == id) {
//             return org;
//         }
//     }
//     return null;
// }


// Path: Idovatar/src/main/java/com/uphyca/idobata/android/ui/SendTo.java
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.uphyca.idobata.Idobata;
import com.uphyca.idobata.IdobataError;
import com.uphyca.idobata.android.InjectionUtils;
import com.uphyca.idobata.android.R;
import com.uphyca.idobata.android.data.api.Main;
import com.uphyca.idobata.android.data.api.Networking;
import com.uphyca.idobata.android.service.PostImageService;
import com.uphyca.idobata.android.service.PostTextService;
import com.uphyca.idobata.model.Organization;
import com.uphyca.idobata.model.Records;
import com.uphyca.idobata.model.Room;
import com.uphyca.idobata.model.Seed;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import javax.inject.Inject;
import static com.uphyca.idobata.android.data.IdobataUtils.findOrganizationById;


package com.uphyca.idobata.android.ui;






public class SendTo extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_send_to);
    }

    public static class Rooms extends ListFragment {

        @Inject
        Idobata mIdobata;

        @Inject
        @Networking
        Executor mExecutor;

        @Inject
        @Main
        Executor mDispatcher;

        private Seed mSeed;

        @Override
        public void onActivityCreated(Bundle savedInstanceState) {
            super.onActivityCreated(savedInstanceState);
            InjectionUtils.getObjectGraph(getActivity())