/** * 获取兴趣爱好 * * @return */ public static ArrayList<Hobby> getHobbyData() { ArrayList<Hobby> allHobbys = null; allHobbys = (ArrayList<Hobby>) DataSupport.findAll(Hobby.class); if (allHobbys == null || allHobbys.isEmpty()) { Hobby hobby1 = new Hobby(1, "上网"); allHobbys.add(hobby1); Hobby hobby2 = new Hobby(2, "研究汽车"); allHobbys.add(hobby2); Hobby hobby3 = new Hobby(3, "养小动物"); allHobbys.add(hobby3); Hobby hobby4 = new Hobby(4, "摄影"); allHobbys.add(hobby4); Hobby hobby5 = new Hobby(5, "看电影"); allHobbys.add(hobby5); Hobby hobby6 = new Hobby(6, "听音乐"); allHobbys.add(hobby6); Hobby hobby7 = new Hobby(7, "写作"); allHobbys.add(hobby7); Hobby hobby8 = new Hobby(8, "购物"); allHobbys.add(hobby8); Hobby hobby9 = new Hobby(9, "做手工艺"); allHobbys.add(hobby9); Hobby hobby10 = new Hobby(10, "做手工"); allHobbys.add(hobby10); Hobby hobby11 = new Hobby(11, "跳舞"); allHobbys.add(hobby11); Hobby hobby12 = new Hobby(12, "看展览"); allHobbys.add(hobby12); Hobby hobby13 = new Hobby(13, "烹饪"); allHobbys.add(hobby13); Hobby hobby14 = new Hobby(14, "读书"); allHobbys.add(hobby14); Hobby hobby15 = new Hobby(15, "会话"); allHobbys.add(hobby15); Hobby hobby16 = new Hobby(16, "研究计算机"); allHobbys.add(hobby16); Hobby hobby17 = new Hobby(17, "做运动"); allHobbys.add(hobby17); Hobby hobby18 = new Hobby(18, "旅游"); allHobbys.add(hobby18); Hobby hobby19 = new Hobby(19, "玩电玩"); allHobbys.add(hobby19); Hobby hobby20 = new Hobby(20, "其它"); allHobbys.add(hobby20); DataSupport.saveAll(allHobbys); } return allHobbys; }
/** * 获取个性特征 * * @return */ public static ArrayList<Disposition> getDispositionData() { ArrayList<Disposition> allDisposition = null; allDisposition = (ArrayList<Disposition>) DataSupport.findAll(Disposition.class); if (allDisposition == null || allDisposition.isEmpty()) { Disposition disposition1 = new Disposition(1, "宅"); allDisposition.add(disposition1); Disposition disposition2 = new Disposition(2, "感性"); allDisposition.add(disposition2); Disposition disposition3 = new Disposition(3, "体贴"); allDisposition.add(disposition3); Disposition disposition4 = new Disposition(4, "憨厚"); allDisposition.add(disposition4); Disposition disposition5 = new Disposition(5, "稳重"); allDisposition.add(disposition5); Disposition disposition6 = new Disposition(6, "好强"); allDisposition.add(disposition6); Disposition disposition7 = new Disposition(7, "冷静"); allDisposition.add(disposition7); Disposition disposition8 = new Disposition(8, "温柔"); allDisposition.add(disposition8); Disposition disposition9 = new Disposition(9, "闷骚"); allDisposition.add(disposition9); Disposition disposition10 = new Disposition(10, "自我"); allDisposition.add(disposition10); Disposition disposition11 = new Disposition(11, "幽默"); allDisposition.add(disposition11); Disposition disposition12 = new Disposition(12, "正直"); allDisposition.add(disposition12); Disposition disposition13 = new Disposition(13, "讲义气"); allDisposition.add(disposition13); Disposition disposition14 = new Disposition(14, "孝顺"); allDisposition.add(disposition14); Disposition disposition15 = new Disposition(15, "勇敢"); allDisposition.add(disposition15); Disposition disposition16 = new Disposition(16, "有责任心"); allDisposition.add(disposition16); Disposition disposition17 = new Disposition(17, "好动"); allDisposition.add(disposition17); Disposition disposition18 = new Disposition(18, "随和"); allDisposition.add(disposition18); DataSupport.saveAll(allDisposition); } return allDisposition; }
/** * 这个函数有毒 * * @param params * @return */ @Override protected List<AppInfo> doInBackground(Void... params) { appInfos.clear(); appInfos.addAll(adapter.getAppInfos()); List<MonitorApp> all = DataSupport.findAll(MonitorApp.class); // 去除掉所有已经加载过的app Iterator<MonitorApp> iterator = all.iterator(); while (iterator.hasNext()) { MonitorApp app = iterator.next(); for (AppInfo info : appInfos) { if (info.getPackName().equals(app.getPackName())) { iterator.remove(); } } } List<AppInfo> temp = new ArrayList<>(); for (MonitorApp app : all) { AppInfo appInfo = new AppInfo(); appInfo.setPackName(app.getPackName()); appInfo.setAppName(app.getAppName()); // 暂时不获取app的icon Drawable icon = getIcon(app.getPackName()); if (icon != null) { if (wantWhite() == app.isWhite()) { appInfo.setAppIcon(icon); appInfos.add(appInfo); temp.add(appInfo); } } } return temp; }