コード例 #1
0
ファイル: Assets.java プロジェクト: norain2050/daima111
 public static String getWallpaper(Context context, String name) {
   ContentResolver resolver = context.getContentResolver();
   Uri uri;
   if (com.coco.theme.themebox.util.FunctionConfig.isNetVersion())
     uri = Uri.parse("content://" + TURBO_LAUNCHER_PROVIDER_AUTHOR + "/" + "wallpaper");
   else uri = Uri.parse("content://" + "com.iLoong.launcher.pub.provider" + "/" + "wallpaper");
   String[] projection = null;
   String selection = null;
   String[] selectionArgs = null;
   String sortOrder = null;
   String theme = "default";
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {name};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         theme = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       theme = null;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   if (theme == null || theme.trim().length() == 0) {
     theme = null;
   }
   return theme;
 }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: norain2050/daima111
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		switch (keyCode) {
		case KeyEvent.KEYCODE_MENU:
			if (com.coco.theme.themebox.util.FunctionConfig.isLockVisible()
					&& com.coco.lock2.lockbox.StaticClass
							.isLockBoxInstalled(this)) {
				// 在lock界面按设置才有用
				int tabIndex = tabHost.getCurrentTab();
				if (tabIndex == 1) {
					Intent intentSetting = new Intent();
					intentSetting.setClassName(
							StaticClass.LOCKBOX_PACKAGE_NAME,
							StaticClass.LOCKBOX_SETTING_ACTIVITY);
					startActivity(intentSetting);
				}
			}
			break;
		}
		return super.onKeyDown(keyCode, event);
	}
コード例 #3
0
ファイル: MainActivity.java プロジェクト: norain2050/daima111
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		ActivityManager.pushActivity(this);
		super.onCreate(savedInstanceState);
		mContext = this;

		// added by zhenNan.ye begin
		String sdpath = getSDPath();
		if (sdpath != null) {
			PATH_ENABLE_LOG = sdpath + File.separator + "enablelog.log";
			File dir = new File(PATH_ENABLE_LOG);
			if (dir.exists()) {
				Log.setEnableLog(true);
			}
		}
		// added by zhenNan.ye end

	

		if (!com.coco.theme.themebox.StaticClass.isAllowDownload(mContext)
				&& com.coco.theme.themebox.util.FunctionConfig
						.isDownToInternal()) {
			com.coco.theme.themebox.StaticClass.canDownToInternal = true;
		}
		PathTool.makeDirApp();
		// teapotXu_20130304: add start
		// set a flag that indicates whether the ThemeSelectIcon launched the
		// ThemeBox or Launcher app.
		String pkgNameFromThemeBox = getIntent().getStringExtra("FROM_PACKAGE");

		if (pkgNameFromThemeBox != null
				&& pkgNameFromThemeBox.length() > 16
				&& pkgNameFromThemeBox.substring(0, 16).equals(
						"com.coco.themes.")) {
			b_theme_icon_start_launcher = true;
			return;
		}

		// teapotXu_20130304: add end
		downModule = new DownModule(this);
		themedownModule = new ThemeDownModule(this);
		if (!com.coco.theme.themebox.util.FunctionConfig.isLockVisible()
				&& !com.coco.lock2.lockbox.StaticClass.isLockBoxInstalled(this)) {
			setContentView(R.layout.man_tab_nolock);
		} else {
			setContentView(R.layout.main_tab_lock);
		}
		tabHost = (TabHost) findViewById(R.id.tabhost);
		tabHost.setup();
		// 添加主题页面

		tabTheme = new TabThemeFactory(MainActivity.this, themedownModule);
		final View indicatorTheme = View.inflate(MainActivity.this,
				R.layout.indicator_theme, null);
		tabHost.addTab(tabHost.newTabSpec(TAG_THEME)
				.setIndicator(indicatorTheme).setContent(tabTheme));

		if (com.coco.theme.themebox.util.FunctionConfig.isLockVisible()
				|| com.coco.lock2.lockbox.StaticClass.isLockBoxInstalled(this)) {
			int Screen_W = getWindowManager().getDefaultDisplay().getWidth();
			int Screen_H = getWindowManager().getDefaultDisplay().getHeight();
			// 添加锁屏页面
			tabLock = new TabLockFactory(MainActivity.this, downModule,
					Screen_W, Screen_H);
			View indicatorLock = View.inflate(MainActivity.this,
					R.layout.indicator_lock, null);
			tabHost.addTab(tabHost.newTabSpec(TAG_LOCK)
					.setIndicator(indicatorLock).setContent(tabLock));

			int tabIndex = getIntent().getIntExtra(
					StaticClass.EXTRA_MAIN_TAB_INDEX, 0);
			switch (tabIndex) {
			default:
			case 0:
				tabHost.setCurrentTabByTag(TAG_THEME);
				break;
			case 1:
				tabHost.setCurrentTabByTag(TAG_LOCK);
				break;
			}
		}

		// 友盟 进入主题盒子统计
		MobclickAgent.onEvent(mContext, "StartBox");
		// 友盟 新用户统计
		NewUser(mContext);
		// 友盟 活跃用户统计
		ActiveUser(mContext);
	}
コード例 #4
0
ファイル: Assets.java プロジェクト: norain2050/daima111
 private static void initAssets(Context context) {
   mContext = context;
   String serialno = "";
   String domain = "";
   String app_id = "";
   String template_id = "";
   String channel_id = "";
   ContentResolver resolver = context.getContentResolver();
   Uri uri;
   if (com.coco.theme.themebox.util.FunctionConfig.isNetVersion())
     uri = Uri.parse("content://" + TURBO_LAUNCHER_PROVIDER_AUTHOR + "/" + "config");
   else uri = Uri.parse("content://" + "com.iLoong.launcher.pub.provider" + "/" + "config");
   String[] projection = null;
   String selection = null;
   String[] selectionArgs = null;
   String sortOrder = null;
   config = new JSONObject();
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_DOMAIN};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         domain = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       domain = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_DOMAIN, domain);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_SERIALNO};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         serialno = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       serialno = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_SERIALNO, serialno);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_APPID};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         app_id = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       app_id = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_APPID, app_id);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_TEMPLATEID};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         template_id = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       template_id = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_TEMPLATEID, template_id);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     selection = " propertyName=? ";
     selectionArgs = new String[] {PREFERENCE_KEY_CONFIG_CHANNELID};
     Cursor cursor = resolver.query(uri, projection, selection, selectionArgs, sortOrder);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         channel_id = cursor.getString(cursor.getColumnIndex("propertyValue"));
       }
       cursor.close();
     } else {
       channel_id = "";
     }
     config.put(PREFERENCE_KEY_CONFIG_CHANNELID, channel_id);
   } catch (Exception e) {
     e.printStackTrace();
   }
   try {
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_DOMAIN
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_DOMAIN));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_SERIALNO
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_SERIALNO));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_APPID
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_APPID));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_TEMPLATEID
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_TEMPLATEID));
     Log.v(
         "theme",
         "assets "
             + PREFERENCE_KEY_CONFIG_CHANNELID
             + ":"
             + config.getString(PREFERENCE_KEY_CONFIG_CHANNELID));
   } catch (Exception ex) {
   }
 }