• 大小: 518KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-11
  • 语言: Java
  • 标签: android  自定义  

资源简介

android 自定义 模仿Launcher 是平板的,手机的,需要调整下分辨和图片大小,有的显示不出来,但代码是成熟的代码

资源截图

代码片段和文件信息

#!/usr/bin/env python2.5

import cgi
import os
import shutil
import sys
import sqlite3

SCREENS = 5
COLUMNS = 4
ROWS = 4
CELL_SIZE = 110

DIR = “db_files“
AUTO_FILE = “launcher.db“

APPLICATION_COMPONENTS = [
  “com.android.calculator2/com.android.calculator2.Calculator“
  “com.android.providers.downloads.ui/com.android.providers.downloads.ui.DownloadList“
  “com.android.settings/com.android.settings.Settings“
  “com.android.mms/com.android.mms.ui.ConversationList“
  “com.android.contacts/com.android.contacts.activities.PeopleActivity“
  “com.android.contacts/com.android.contacts.activities.DialtactsActivity“
]

def usage():
  print “usage: fill_screens.py -- fills up the launcher db“


def make_dir():
  shutil.rmtree(DIR True)
  os.makedirs(DIR)

def pull_file(fn):
  print “pull_file: “ + fn
  rv = os.system(“adb pull“
    + “ /data/data/com.android.launcher/databases/launcher.db“
    + “ “ + fn);
  if rv != 0:
    print “adb pull failed“
    sys.exit(1)

def push_file(fn):
  print “push_file: “ + fn
  rv = os.system(“adb push“
    + “ “ + fn
    + “ /data/data/com.android.launcher/databases/launcher.db“)
  if rv != 0:
    print “adb push failed“
    sys.exit(1)

def process_file(fn):
  print “process_file: “ + fn
  conn = sqlite3.connect(fn)
  c = conn.cursor()
  c.execute(“DELETE FROM favorites“)

  intentFormat = “#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=%s;end“

  id = 0;
  for s in range(SCREENS):
    for x in range(ROWS):
      for y in range(COLUMNS):
        id += 1
        insert = “INSERT into favorites (_id title intent container screen cellX cellY spanX spanY itemType appWidgetId iconType) VALUES (%d ‘%s‘ ‘%s‘ %d %d %d %d %d %d %d %d %d)“
        insert = insert % (id “title“ ““ -100 s x y 1 1 2 -1 0)
        c.execute(insert)
        folder_id = id

        for z in range(15):
          id += 1
          intent = intentFormat % (APPLICATION_COMPONENTS[id % len(APPLICATION_COMPONENTS)])
          insert = “INSERT into favorites (_id title intent container screen cellX cellY spanX spanY itemType appWidgetId iconType) VALUES (%d ‘%s‘ ‘%s‘ %d %d %d %d %d %d %d %d %d)“
          insert = insert % (id “title“ intent folder_id 0 0 0 1 1 0 -1 0)
          c.execute(insert)

  conn.commit()
  c.close()

def main(argv):
  if len(argv) == 1:
    make_dir()
    pull_file(AUTO_FILE)
    process_file(AUTO_FILE)
    push_file(AUTO_FILE)
  else:
    usage()

if __name__==“__main__“:
  main(sys.argv)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         475  2017-04-17 13:33  ScrollLayoutGrid_v3\.classpath
     文件         844  2015-09-02 09:44  ScrollLayoutGrid_v3\.project
     目录           0  2017-05-19 10:13  ScrollLayoutGrid_v3\.settings\
     文件         220  2015-09-02 09:48  ScrollLayoutGrid_v3\.settings\org.eclipse.core.resources.prefs
     文件         177  2015-09-02 09:44  ScrollLayoutGrid_v3\.settings\org.eclipse.jdt.core.prefs
     文件        1068  2015-01-27 09:45  ScrollLayoutGrid_v3\Android.mk
     文件        1576  2017-04-17 13:58  ScrollLayoutGrid_v3\AndroidManifest.xml
     目录           0  2011-11-25 16:15  ScrollLayoutGrid_v3\assets\
     目录           0  2017-05-19 10:13  ScrollLayoutGrid_v3\bin\
     文件        1576  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\AndroidManifest.xml
     文件       67576  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes.dex
     目录           0  2017-05-19 10:13  ScrollLayoutGrid_v3\bin\classes\
     目录           0  2017-05-19 10:13  ScrollLayoutGrid_v3\bin\classes\com\
     目录           0  2017-05-19 10:13  ScrollLayoutGrid_v3\bin\classes\com\android\
     目录           0  2017-05-19 10:13  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\
     文件        5785  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\AppDataAdapter.class
     文件        4641  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\AppsManager.class
     文件        1812  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\DateAdapter.class
     文件        1836  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\DemoGridAdapter.class
     文件        1802  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\DragGridView$1.class
     文件        1664  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\DragGridView$2.class
     文件         317  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\DragGridView$OnChanageListener.class
     文件       11307  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\DragGridView.class
     文件         889  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Info.class
     文件        1346  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Launcher$1.class
     文件        1472  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Launcher$2$1.class
     文件        4500  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Launcher$2.class
     文件         997  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Launcher$3$1.class
     文件        1627  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Launcher$3.class
     文件         780  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Launcher$4.class
     文件        2211  2017-04-17 14:26  ScrollLayoutGrid_v3\bin\classes\com\android\launcher2\Launcher$5.class
............此处省略169个文件信息

评论

共有 条评论