| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Whenever you search in PBworks, Dokkio Sidebar (from the makers of PBworks) will run the same search in your Drive, Dropbox, OneDrive, Gmail, and Slack. Now you can find what you're looking for wherever it lives. Try Dokkio Sidebar for free.

View
 

3rd Party Themes

Page history last edited by Daniel Benedykt 12 years, 7 months ago
 
 

This document defines the protocol so 3rd parties can publish themes on the android market to use inside Flyscreen!

 
 

 
 
We will use intents to call other apps to select themes.
 
 
 
  1. Flyscreen will call the intent:  com.flydroid.flyscreen.theme.THEME

     

  2. All the apps that handle the intent will be listed, and the user will choose one.

     

  3. After the user selects an option, the Intent selected will be called with 'startActivityForResult' and the 3rd party application will be executed.

     

  4. The 3rd party application will start and it will return a variable (extra) with the name 'uri', and the value will correspond to a content provider.  The application must also return RESULT_OK .

     

  5. Flyscreen will take that 'uri' and query the content provider

     

  6. The content provider must return a cursor with one row with the following columns:

    "name", "background", "statusbar", "menubg", "widgets", "updates", "settings", "searchButton", "searchButtonPr", "settingsButton", "settingsButtonPr"

    the row will contain the name of the theme, and 10 string corresponding to 10 images saved as resources.

    Example: 'android.resource://com.companyx.flyscreentheme/raw/custombg'

    In this case 'com.companyx.flyscreentheme' is the package of the application, 'raw' is the raw folder, and 'custombg' is the name of the png file (custombg.png) on the raw folder.

     

    Version 2:  for version to the fields are:  name, version, background1, background2, background3, leftIcon1, rightIcon1, leftIcon2, rightIcon2

     

  7. Flyscreen will take the images by calling 'openInputStream' on the content provider and save them to use on flyscreen.
 
 
 
-------------------------------------------------------------------------------------------
 

 

 

  Height Width
background 480 320
statusbar 103 320
menubg 64 253
widgets 32 28
updates 35 34
settings 35 38
searchButton 35 35
searchButtonPr 35 35
settingsButton 35 35
settingsButtonPr 35 35
Version 2: 

 

  Height Width comment
background1 480 320 HVGA
background2 800 480 WVGA
background3 854 480 FWVGA
lefticon1
64 64 HVGA
lefticon2
96 96 WVGA/FWVGA
righticon1
64 64 HVGA
righticon2
96 96 WVGA/FWVGA
header1
52 
270 
 HVGA
header2
72 406 WVGA/FWVGA
body1
 198
270 
HVGA
body2
404 406 WVGA/FWVGA
footer1
 25
 270
HVGA
footer2
49 406 WVGA/FWVGA
 
 
 
 
 
-------------------------------------------------------------------------------------------
 
 
 
 
public class FlyScreenTheme extends Activity{
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState); 
 
        Uri data = Uri.parse("content://cellogic/"); 
        Intent intentResult = new Intent(null, data);
 
        intentResult.putExtra("uri", "content://com.companyx.flyscreentheme/items");
        setResult(RESULT_OK, intentResult);
        finish();
    }
 
}
 
-------------------------------------------------------------------------------------------
 
 
 
 
public class ThemeProvider extends ContentProvider {
 
     

public static final String TAG = "FLYSCREENTHEME";

 

public static final Uri CONTENT_URI = Uri

.parse("content://com.companyx.flyscreentheme/items");

 

private static final UriMatcher uriMatcher;

private static final int SINGLE_ROW = 2;

 

static {

uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);

uriMatcher.addURI("com.companyx.flyscreentheme", "items", SINGLE_ROW);

uriMatcher.addURI("com.companyx.flyscreentheme", "raw", 3);

uriMatcher.addURI("*", "*", 4);

}

 

 

public static final String[] rows = { "name","version", "background1","background2","background3",

  "leftIcon1", "leftIcon2", "rightIcon1", "rightIcon2", "header1", "header2", "body1", "body2", "footer1", "footer2"  };

 

@Override

public int delete(Uri arg0, String arg1, String[] arg2) {

throw new SQLException("This operation is now allowed");

}

 

@Override

public String getType(Uri _uri) {

Log.d(TAG, "cursor4");

switch (uriMatcher.match(_uri)) {

 

case SINGLE_ROW:

Log.d(TAG, "cursor6");

return "vnd.companyx.cursor.item/vnd.companyx.item";

default:

throw new IllegalArgumentException("Unsupported URI: " + _uri);

}

}

 

@Override

public Uri insert(Uri arg0, ContentValues arg1) {

throw new SQLException("This operation is now allowed");

 

}

 

@Override

public boolean onCreate() {

 

return true;

}

 

@Override

public Cursor query(Uri uri, String[] arg1, String arg2, String[] arg3,

String arg4) {

 

switch (uriMatcher.match(uri)) {

case SINGLE_ROW:

 

MatrixCursor c = new MatrixCursor(rows);

 

Object[] columnValues = new Object[rows.length];

 

// "name",

columnValues[0] = "Classic";

//version

columnValues[1] = "2";

// "background",

columnValues[2] = "android.resource://com.companyx.flyscreentheme/raw/background1";

columnValues[3] = "android.resource://com.companyx.flyscreentheme/raw/background2";

columnValues[4] = "android.resource://com.companyx.flyscreentheme/raw/background3";

 

columnValues[5] = "android.resource://com.companyx.flyscreentheme/raw/lefticon1";

columnValues[6] = "android.resource://com.companyx.flyscreentheme/raw/lefticon2";

 

columnValues[7] = "android.resource://com.companyx.flyscreentheme/raw/righticon1";

columnValues[8] = "android.resource://com.companyx.flyscreentheme/raw/righticon2";

 

columnValues[9] = "android.resource://com.companyx.flyscreentheme/raw/header1";

columnValues[10] = "android.resource://com.companyx.flyscreentheme/raw/header2";

 

columnValues[11] = "android.resource://com.companyx.flyscreentheme/raw/body1";

columnValues[12] = "android.resource://com.companyx.flyscreentheme/raw/body2";

 

columnValues[13] = "android.resource://com.companyx.flyscreentheme/raw/footer1";

columnValues[14] = "android.resource://com.companyx.flyscreentheme/raw/footer2";

 

 

 

c.addRow(columnValues);

 

return c;

}

return null;

}

 

@Override

public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {

throw new SQLException("This operation is now allowed");

}

 

@Override

public AssetFileDescriptor openAssetFile(Uri uri, String mode)

throws FileNotFoundException {

return super.openAssetFile(uri, mode);

}

 
}

 

------------------------------------------------------------------------------------

 

How to create the project in Eclipse using adt 0.9.4

 

  • Create new Android project targeted at Google APIs 1.5
  • Create it with an Activity called FlyScreenTheme and copy the code above into the java file (adjusting for your company's name)
  • Add a class for ThemeProvider and copy in the code above (again, adjusting the names for your company)
  • Fix up compile errors (Eclipse helps adding in the missing includes)
  • The pngs should be added in to the folder res/raw which is parallel to src/com
  • Adjust the AndroidManifest.xml:
    • Remove Intent Filters for MAIN and LAUNCHER
    • Add intent filters for:
      • com.flydroid.flyscreen.theme.THEME (action)
      • android.intent.category.DEFAULT (category)
      • android.intent.category.ALTERNATIVE (category)
      • android.intent.category.SELECTED_ALTERNATIVE (category)
    • Add a provider for ThemeProvider with "Authorities" being set to your company's details "com.companyx.coolskin"
  • Build and sign with your certificate
  • Install to you phone and test against the latest version of Flyscreen

 

 

------------------------------------------------------------------------------------

 

 

Template project for Themes

 

  • Download the project file from here
  • Inside eclipse select File --> import --> General --> Existing project into workspace 
  • Select archive file, and Browse to the file.
  • Click Finish to import the project
  • Once imported, modify the application name, the packages name, all images including the app icon, and the ThemeProvider.
  • Build and sign with your certificate
  • Install to you phone and test against the latest version of Flyscreen!

 

Comments (0)

You don't have permission to comment on this page.