java - Android Launcher3 - Google Now Page -
i downloaded launcher3 (google's kitkat launcher) 4.4 sources.
i imported eclipse . got rid of errors.and launcher works pretty good.
but missing. "google now" page when scroll left.
i can't activate google now.anyway don't need that. want put own fragment or layout first page , other pages work same normal launcher. google's experience launcher(kitkat launcher of google)'s google page ..
like :
i added layout :
here original codes workspace.java
public long insertnewworkspacescreen(long screenid, int insertindex) { if (mworkspacescreens.containskey(screenid)) { throw new runtimeexception("screen id " + screenid + " exists!"); } celllayout newscreen = (celllayout) mlauncher.getlayoutinflater().inflate(r.layout.workspace_screen, null); newscreen.setonlongclicklistener(mlongclicklistener); newscreen.setonclicklistener(mlauncher); newscreen.setsoundeffectsenabled(false); mworkspacescreens.put(screenid, newscreen); mscreenorder.add(insertindex, screenid); addview(newscreen, insertindex); return screenid; }
here edited codes me on workspace.java
public long insertnewworkspacescreen(long screenid, int insertindex) { if (mworkspacescreens.containskey(screenid)) { throw new runtimeexception("screen id " + screenid + " exists!"); } if (screenid == 2) //firstscreen/page { relativelayout newscreen = (relativelayout) mlauncher.getlayoutinflater().inflate(r.layout.blinkfeed, null); newscreen.setonclicklistener(mlongclicklistener); newscreen.setonclicklistener(mlauncher); newscreen.setsoundeffectsenabled(false); // mworkspacescreens.put(screenid, newscreen); mscreenorder.add(insertindex, screenid); addview(newscreen, insertindex); return screenid; } else { celllayout newscreen = (celllayout) mlauncher.getlayoutinflater().inflate(r.layout.workspace_screen, null); newscreen.setonlongclicklistener(mlongclicklistener); newscreen.setonclicklistener(mlauncher); newscreen.setsoundeffectsenabled(false); mworkspacescreens.put(screenid, newscreen); mscreenorder.add(insertindex, screenid); addview(newscreen, insertindex); return screenid; } }
as can see when first page changed layout i'm getting problems on childviews, animations etc, anyway cant access other pages after that. putted everywhere try catch when errors because of "celllayout cannot bind relative bla bla .."
my try catch
try { cell layout stuff trying make animations etc. } catch (exception e) { //empty }
i couldn't make work @ moment google pages :) know adding fragment/layout first page ?
thanks.
if want add fragment or view in same manner google now, launcher3 code supports that. have 2 ways of getting desired behavior:
subclass launcher class , overwrite
hascustomcontenttoleft()
return true ,addcustomcontenttoleft()
can create/inflate view added. make sure calladdtocustomcontentpage
, implementcustomcontentcallbacks
if want notified when screen open.implement same methods described above in launcher class directly.
hope helps, mihai
Comments
Post a Comment