Search in sources :

Example 16 with MatrixCursor

use of android.database.MatrixCursor in project platform_frameworks_base by android.

the class SettingsProvider method getAllSystemSettings.

private Cursor getAllSystemSettings(int userId, String[] projection) {
    if (DEBUG) {
        Slog.v(LOG_TAG, "getAllSecureSystem(" + userId + ")");
    }
    // Resolve the userId on whose behalf the call is made.
    final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(userId);
    synchronized (mLock) {
        List<String> names = mSettingsRegistry.getSettingsNamesLocked(SETTINGS_TYPE_SYSTEM, callingUserId);
        final int nameCount = names.size();
        String[] normalizedProjection = normalizeProjection(projection);
        MatrixCursor result = new MatrixCursor(normalizedProjection, nameCount);
        for (int i = 0; i < nameCount; i++) {
            String name = names.get(i);
            // Determine the owning user as some profile settings are cloned from the parent.
            final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId, name);
            Setting setting = mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SYSTEM, owningUserId, name);
            appendSettingToCursor(result, setting);
        }
        return result;
    }
}
Also used : Setting(com.android.providers.settings.SettingsState.Setting) MatrixCursor(android.database.MatrixCursor)

Example 17 with MatrixCursor

use of android.database.MatrixCursor in project platform_frameworks_base by android.

the class SettingsProvider method packageSettingForQuery.

private static MatrixCursor packageSettingForQuery(Setting setting, String[] projection) {
    if (setting.isNull()) {
        return new MatrixCursor(projection, 0);
    }
    MatrixCursor cursor = new MatrixCursor(projection, 1);
    appendSettingToCursor(cursor, setting);
    return cursor;
}
Also used : MatrixCursor(android.database.MatrixCursor)

Example 18 with MatrixCursor

use of android.database.MatrixCursor in project iosched by google.

the class ExploreMockCursor method getCursorForTags.

/**
     * @return a list of tags, including {@link #THEME_GROW_EARN}. {@link #THEME_WHATSNEXT}, {@link
     * #TRACK_ANDROID}, {@link #TRACK_MOBILEWEB}, {@link #TRACK_CLOUD} and {@link #TYPE_SESSION}.
     */
public static MatrixCursor getCursorForTags() {
    String[] columns = { "_id", "tag_id", "tag_name", "tag_category", "tag_order_in_category", "tag_abstract", "tag_color", "tag_photo_url" };
    MatrixCursor matrixCursor = new MatrixCursor(columns);
    String[] data1 = { "TYPE_CODELABS", "TYPE_CODELABS", "Code labs", TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data1);
    String[] data2 = { "TRACK_AUDIENCEGROWTH", "TRACK_AUDIENCEGROWTH", "Audience Growth", TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data2);
    String[] data3 = { THEME_WHATSNEXT, THEME_WHATSNEXT, THEME_WHATSNEXT_NAME, TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data3);
    String[] data4 = { TYPE_SESSION, TYPE_SESSION, TYPE_SESSION_NAME, TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data4);
    String[] data5 = { "TYPE_SANDBOXTALKS", "TYPE_SANDBOXTALKS", "Sandbox talks", TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data5);
    String[] data6 = { TRACK_CLOUD, TRACK_CLOUD, TRACK_CLOUD_NAME, TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data6);
    String[] data7 = { "TRACK_AUTO", "TRACK_AUTO", "Auto", TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data7);
    String[] data8 = { TRACK_ANDROID, TRACK_ANDROID, TRACK_ANDROID_NAME, TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data8);
    String[] data9 = { TRACK_ANDROID, TRACK_ANDROID, TRACK_MOBILEWEB_NAME, TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data9);
    String[] data10 = { THEME_GROW_EARN, THEME_GROW_EARN, THEME_GROW_EARN_NAME, TAG_CATEGORY, "2", "", "-3355444", "" };
    matrixCursor.addRow(data10);
    return matrixCursor;
}
Also used : MatrixCursor(android.database.MatrixCursor)

Example 19 with MatrixCursor

use of android.database.MatrixCursor in project iosched by google.

the class ExploreMockCursor method getCursor.

/**
     * @param livestreamed Pass in an array of length 9  (the number of sessions), and true if the
     *                     given session should be livestreamed {@code now}. Pass in null if none of
     *                     the session should be livestreamed.
     * @param now          When the sessions should be made to be livestream
     * @return a cursor that contains 9 sessions, including a keynote session, 4 sessions with
     * {@link #THEME_WHATSNEXT}, 4 sessions with {@link #THEME_GROW_EARN}, 4 sessions with main
     * {@link #TRACK_CLOUD}, 2 sessions with main {@link #TRACK_ANDROID}, and 2 sessions with main
     * {@link #TRACK_MOBILEWEB}.
     */
private static MatrixCursor getCursor(boolean[] livestreamed, long now) {
    String[] columns = { "session_id", "session_title", "session_abstract", "session_tags", "session_main_tag", "session_photo_url", "session_start", "session_end", "session_livestream_url", "session_youtube_url", "session_in_my_schedule" };
    MatrixCursor matrixCursor = new MatrixCursor(columns);
    String[] subData = constructStartEndAndLivestream(livestreamed, now, 0);
    String[] data1 = { KEYNOTE_ID, TITLE_KEYNOTE, "Join us to learn about product and platform innovations at Google, starting with" + " a live kickoff from our Senior Vice-President of Products, Sundar " + "Pichai.", "FLAG_KEYNOTE", "FLAG_KEYNOTE", "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/14f5088b-d0e2-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data1);
    subData = constructStartEndAndLivestream(livestreamed, now, 1);
    String[] data2 = { "74718f8b-b6d4-e411-b87f-00155d5066d7", TRACK_TOOLS_TITLE1, "The next big things from Google Cloud Messaging (GCM), simplifying your mobile " + "messaging and notifications solution.", TYPE_SESSION + SEP + THEME_WHATSNEXT + SEP + TRACK_CLOUD, TRACK_CLOUD, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/74718f8b-b6d4-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data2);
    subData = constructStartEndAndLivestream(livestreamed, now, 2);
    String[] data3 = { "ea96312e-e3d3-e411-b87f-00155d5066d7", TRACK_ANDROID_TITLE1, "This session will highlight the most exciting new developer features of the " + "Android platform.", TYPE_SESSION + SEP + THEME_WHATSNEXT + SEP + TRACK_ANDROID + SEP + TRACK_CLOUD, TRACK_ANDROID, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/ea96312e-e3d3-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data3);
    subData = constructStartEndAndLivestream(livestreamed, now, 3);
    String[] data4 = { "881a8930-f0e2-e411-b87f-00155d5066d7", TRACK_TOOLS_TITLE2, "Mobile development is growing more and more complex. To make things easier for " + "publishers, we have created a smart mobile ads platform that goes beyond" + " the traditional ad server. Come listen to Jonathan Alferness talk about" + " how AdMob brings the power, scale and innovation to app developers who " + "want to monetize effectively through tools like ad mediation for higher " + "fill rates, new formats like native ads, and Audience builder with " + "Google Analytics for list building and targeting. In this talk, we will " + "also be unveiling some new features that will help make things simpler " + "for developers.", TYPE_SESSION + SEP + THEME_GROW_EARN + SEP + TRACK_SEARCH + SEP + TRACK_CLOUD, TRACK_CLOUD, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/881a8930-f0e2-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data4);
    subData = constructStartEndAndLivestream(livestreamed, now, 4);
    String[] data5 = { "0c718f8b-b6d4-e411-b87f-00155d5066d7", TRACK_ANDROID_TITLE2, "In this session we will provide an in depth tour of the Android " + "development tools and take a closer look at everything new - " + "along with tips and tricks for getting the most out of them!", TYPE_SESSION + SEP + THEME_WHATSNEXT + SEP + TRACK_ANDROID + SEP + TRACK_CLOUD, TRACK_ANDROID, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/0c718f8b-b6d4" + "-e411-b87f-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data5);
    subData = constructStartEndAndLivestream(livestreamed, now, 5);
    String[] data6 = { "3a718f8b-b6d4-e411-b87f-00155d5066d7", TRACK_MOBILEWEB_TITLE1, "The games industry has never been more promising and full of opportunities. In " + "addition to consoles, PC, and browser gaming, as well as phone and " + "tablet games, there are emerging fields including virtual reality and " + "mobile games in the living room. This talk covers how Google is helping " + "developers across this broad range of platforms.", TYPE_SESSION + SEP + THEME_WHATSNEXT + SEP + TRACK_MOBILEWEB + SEP + TRACK_CLOUD, TRACK_MOBILEWEB, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/3a718f8b-b6d4-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data6);
    subData = constructStartEndAndLivestream(livestreamed, now, 6);
    String[] data7 = { "e096312e-e3d3-e411-b87f-00155d5066d7", TRACK_MOBILEWEB_TITLE2, "Are we as developers taking full advantage of the new sensing capabilities (like" + " GPS, Bluetooth Low Energy, accelerometers, barometers) of mobile " + "devices to make user experiences delightful? These new sensors introduce" + " the capability to know where a person is and what they’re doing as well" + " as many other clues. Join us as we explore the opportunities, show some" + " old and new tools Google has created to help, share our lessons " + "building experiences like the Now “Where did I park my car?” card, and " + "predict what the future may hold for context-aware computing.", TYPE_SESSION + SEP + THEME_GROW_EARN + SEP + TRACK_MOBILEWEB + SEP + TRACK_CLOUD, TRACK_MOBILEWEB, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/e096312e-e3d3-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data7);
    subData = constructStartEndAndLivestream(livestreamed, now, 7);
    String[] data8 = { "21718f8b-b6d4-e411-b87f-00155d5066d7", TRACK_TOOLS_TITLE3, "The latest version of Polymer is fast and lean. With new elements and tools, " + "Polymer 1.0 is ready for production. Learn how teams at Google have " + "successfully launched on google.com using Polymer and the latest " + "platform APIs: Web Animations, Service Workers for offline and push " + "notifications, and material design. Last but not least, we’ll show you " + "how to leverage the same tools as Google to be successful using Polymer " + "Starter Kit - a new toolkit for building mobile-first apps.", TYPE_SESSION + SEP + THEME_GROW_EARN + SEP + TRACK_MOBILEWEB + SEP + TRACK_CLOUD, TRACK_CLOUD, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/21718f8b-b6d4-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data8);
    subData = constructStartEndAndLivestream(livestreamed, now, 8);
    String[] data9 = { "60718f8b-b6d4-e411-b87f-00155d5066d7", TRACK_TOOLS_TITLE4, "How does an engineer, developer or computer scientist harness his or her skills " + "to address humanity’s biggest challenges? Listen to technologists -- " + "from Charity:water, Code for America, NexLeaf and HandUp -- who are " + "leading innovative projects at forward-thinking nonprofit organizations " + "supported by Google.org. They’ll share the challenges, successes, and " + "rewards of applying technology to causes like clean water, global " + "health, education, or increasing access for the more than three billions" + " of people around the world facing some form of disability. You might be" + " inspired to harness your own skills and talents toward creating a " + "better world faster.", TYPE_SESSION + SEP + THEME_GROW_EARN + SEP + TRACK_CLOUD, TRACK_CLOUD, "https://storage.googleapis.com/io2015-data.appspot" + ".com/images/sessions/__w-200-400-600-800-1000__/60718f8b-b6d4-e411-b87f" + "-00155d5066d7.jpg", subData[0], subData[1], subData[2], "null", "0" };
    matrixCursor.addRow(data9);
    return matrixCursor;
}
Also used : MatrixCursor(android.database.MatrixCursor)

Example 20 with MatrixCursor

use of android.database.MatrixCursor in project iosched by google.

the class SpeakersMockCursor method getCursorForSingleSpeaker.

public static MatrixCursor getCursorForSingleSpeaker() {
    String[] data = { FAKE_SPEAKER, "https://storage.googleapis.com/io2015-data.appspot.com/images/speakers/__w-200-" + "400-600-800-1000__/45cc3a01-d2d4-e411-b87f-00155d5066d7.jpg", "Google", "Satyajeet is a Product Manager on the Search team. He works on trying to " + "understand" + " all of the worlds media through the Knowledge Graph, and building " + "interesting features based on this knowledge in Search, Now and across " + "Google. He's previously held product management and partnerships roles " + "on " + "YouTube, Games, Ads and Payments. ", FAKE_SPEAKER_URL, "https://plus.google.com/+SatyajeetSalgar", "http://www.twitter.com/salgar" };
    String[] columns = { "speaker_name", "speaker_image_url", "speaker_company", "speaker_abstract", "speaker_url", "plusone_url", "twitter_url" };
    MatrixCursor matrixCursor = new MatrixCursor(columns);
    matrixCursor.addRow(data);
    return matrixCursor;
}
Also used : MatrixCursor(android.database.MatrixCursor)

Aggregations

MatrixCursor (android.database.MatrixCursor)259 Cursor (android.database.Cursor)37 DirectoryResult (com.android.documentsui.DirectoryResult)35 RowBuilder (android.database.MatrixCursor.RowBuilder)30 File (java.io.File)30 MergeCursor (android.database.MergeCursor)18 Uri (android.net.Uri)18 Test (org.junit.Test)17 Setting (com.android.providers.settings.SettingsState.Setting)15 FileNotFoundException (java.io.FileNotFoundException)15 ArrayList (java.util.ArrayList)13 Bundle (android.os.Bundle)10 BitSet (java.util.BitSet)10 Random (java.util.Random)10 IOException (java.io.IOException)7 LinkedList (java.util.LinkedList)7 ContentValues (android.content.ContentValues)6 HashSet (java.util.HashSet)6 Map (java.util.Map)6 SQLiteQueryBuilder (android.database.sqlite.SQLiteQueryBuilder)5