Merge branch 'master' into honeycomb-release

This commit is contained in:
The Android Automerger
2010-12-02 07:55:19 -08:00
47 changed files with 696 additions and 266 deletions
+2 -2
View File
@@ -19,7 +19,7 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/pressed_application_background" />
<item android:state_window_focused="true" android:state_focused="true" android:drawable="@drawable/focused_application_background" />
<item android:state_window_focused="false" android:state_focused="true" android:drawable="@android:color/transparent" />
<item android:state_pressed="true" android:drawable="@drawable/pressed_application_background" />
<item android:drawable="@android:color/transparent" />
</selector>
+27 -3
View File
@@ -31,12 +31,36 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:tabStripEnabled="false" />
<ImageView
android:id="@+id/market_button"
<FrameLayout
android:id="@+id/market_info_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:onClick="onClickAppMarketButton" />
android:layout_centerVertical="true">
<com.android.launcher2.ApplicationInfoDropTarget
android:id="@+id/all_apps_info_target"
android:src="@drawable/info_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"/>
<ImageView
android:id="@+id/market_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="onClickAppMarketButton"/>
</FrameLayout>
<com.android.launcher2.DeleteZone
android:id="@+id/all_apps_delete_zone"
android:src="@drawable/delete_zone_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/market_info_frame"
android:layout_centerVertical="true"
android:visibility="invisible"
android:paddingRight="22dp"
launcher:direction="horizontal" />
</RelativeLayout>
<FrameLayout
android:id="@android:id/tabcontent"
+1 -1
View File
@@ -15,4 +15,4 @@
-->
<com.android.launcher2.BubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/WorkspaceIcon.Landscape" />
style="@style/WorkspaceIcon.Landscape" />
@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
launcher:wallpaperCellSpanX="4"
launcher:wallpaperCellSpanX="3"
launcher:widgetCellCountX="16"
launcher:cellCountX="8"
launcher:cellCountY="3"
+7 -1
View File
@@ -125,7 +125,13 @@
android:layout_toLeftOf="@id/configure_button"
android:layout_marginLeft="@dimen/toolbar_button_spacing"
android:layout_marginRight="@dimen/toolbar_button_spacing"
android:textSize="18dp"
android:textColor="#CCFFFFFF"
android:textSize="18sp"
android:shadowColor="#A0000000"
android:shadowDx="0.0"
android:shadowDy="0.0"
android:shadowRadius="2.0"
android:onClick="onClickAllAppsButton"
android:focusable="true"
+27 -3
View File
@@ -31,12 +31,36 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:tabStripEnabled="false" />
<ImageView
android:id="@+id/market_button"
<FrameLayout
android:id="@+id/market_info_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:onClick="onClickAppMarketButton" />
android:layout_centerVertical="true">
<com.android.launcher2.ApplicationInfoDropTarget
android:id="@+id/all_apps_info_target"
android:src="@drawable/info_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"/>
<ImageView
android:id="@+id/market_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="onClickAppMarketButton"/>
</FrameLayout>
<com.android.launcher2.DeleteZone
android:id="@+id/all_apps_delete_zone"
android:src="@drawable/delete_zone_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/market_info_frame"
android:layout_centerVertical="true"
android:visibility="invisible"
android:paddingRight="22dp"
launcher:direction="horizontal" />
</RelativeLayout>
<FrameLayout
android:id="@android:id/tabcontent"
+6
View File
@@ -125,8 +125,14 @@
android:layout_toLeftOf="@id/configure_button"
android:layout_marginLeft="@dimen/toolbar_button_spacing"
android:layout_marginRight="@dimen/toolbar_button_spacing"
android:textColor="#CCFFFFFF"
android:textSize="18dp"
android:shadowColor="#A0000000"
android:shadowDx="0.0"
android:shadowDy="0.0"
android:shadowRadius="2.0"
android:onClick="onClickAllAppsButton"
android:focusable="true"
android:clickable="true" />
@@ -13,8 +13,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
<com.android.launcher2.PagedViewWidget
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:layout_width="wrap_content"
android:layout_height="365dp"
@@ -22,7 +23,10 @@
android:paddingRight="12.5dp"
android:paddingBottom="50dp"
android:gravity="top"
android:orientation="vertical">
android:orientation="vertical"
launcher:blurColor="#FF6B8CF0"
launcher:outlineColor="#FF8CD2FF">
<!-- The preview image for the wallpaper. -->
<ImageView
@@ -57,4 +61,4 @@
android:maxLines="2"
android:fadingEdge="horizontal" />
</LinearLayout>
</com.android.launcher2.PagedViewWidget>
@@ -13,20 +13,21 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
<com.android.launcher2.PagedViewWidget
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
android:layout_width="wrap_content"
android:layout_height="365dp"
android:paddingLeft="12.5dp"
android:paddingTop="12.5dp"
android:paddingRight="12.5dp"
android:paddingBottom="50dp"
android:gravity="top"
android:orientation="vertical"
launcher:checkedBlurColor="#FFDAFF71"
launcher:checkedOutlineColor="#FFCFFF9C">
launcher:blurColor="#FF6B8CF0"
launcher:outlineColor="#FF8CD2FF">
<!-- The icon of the widget. -->
<ImageView
@@ -76,4 +77,4 @@
android:shadowDx="0.0"
android:shadowDy="1.0"
android:shadowRadius="1.0" />
</LinearLayout>
</com.android.launcher2.PagedViewWidget>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Stažené"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Nenalezeny žádné hry."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Žádné stažené aplikace."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Na tuto plochu nelze položku přetáhnout"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Název složky"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Downloadet"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Ingen spil."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Ingen hentede programmer."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Kunne ikke slippe elementet på denne startskærm"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mappenavn"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Heruntergeladen"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Keine Spiele gefunden."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Keine heruntergeladenen Apps"</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Element wurde nicht auf Startbildschirm abgelegt."</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Ordnername"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Η λήψη ολοκληρώθηκε"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Δεν βρέθηκαν παιχνίδια."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Δεν βρέθηκαν ληφθ. εφαρμ."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Δεν έγινε η απόθ. του στοιχείου στην αρχική οθόνη"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Όνομα φακέλου"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Descargado"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"No se encontraron juegos."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"No se encontraron apps."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"No se pudo colocar el elemento en esta pantalla principal"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nombre de carpeta"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Descargadas"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"No hay juegos."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Sin aplicaciones descarg."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"No se puede soltar el elemento en este escritorio."</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nombre de carpeta"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Téléchargées"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Aucun jeu n\'a été trouvé."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Pas d\'application téléchargée"</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Impossible de déposer l\'élément sur l\'écran d\'accueil."</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nom du dossier"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Scaricate"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Nessun gioco trovato."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Nessuna appl. scaricata"</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Impossibile rilasciare elemento in schermata Home"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nome cartella"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"ダウンロード済み"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"ゲームなし"</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"ダウンロードアプリなし"</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"このホーム画面にアイテムをドロップできませんでした"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"フォルダ名"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"다운로드앱"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"게임이 없습니다."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"다운로드한 애플리케이션이 없습니다."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"홈 화면에 항목을 드롭할 수 없습니다."</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"폴더 이름"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Nedlastet"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Finner ingen spill."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Finner ingen nedl.prog."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Kunne ikke slippe elementet på denne startskjermen"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mappenavn"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Gedownload"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Geen games gevonden."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Geen gedownl. apps gevond."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Kan item niet neerzetten op dit startscherm"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mapnaam"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Pobrane"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Nie znaleziono gier."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Brak pobranych aplikacji."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Nie można upuścić elementu na ekranie głównym"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nazwa folderu"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Transferidas"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Sem jogos."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Sem aplic. transferidas."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Não foi possível largar o item neste ecrã inicial"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nome da pasta"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Download concluído"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Nenhum jogo encontrado."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Nenhum aplic. encontrado."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Não foi possível soltar o item nesta tela inicial"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Nome da pasta"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Загруженные"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Игр не найдено."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Нет загруженных приложений."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Не удается скопировать элемент на главный экран"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Название папки"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"Hämtade"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Inga spel hittades."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"Inga hämtade appar."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Objektet kunde inte släppas på den här startsidan"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Mappnamn"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"İndirilenler"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"Oyun bulunamadı."</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"İndirilmş uyg bulunamadı."</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"Öğe bu ana ekrana bırakılamadı"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"Klasör adı"</string>
+2 -2
View File
@@ -26,8 +26,8 @@
<!-- Duration in milliseconds toolbar fade in and fade out animations.
NOTE: Fade in and fade out time should together be less the transition
animations between all apps, customize, & the workspace. -->
<integer name="config_toolbarButtonFadeInTime">350</integer>
<integer name="config_toolbarButtonFadeOutTime">350</integer>
<integer name="config_toolbarButtonFadeInTime">100</integer>
<integer name="config_toolbarButtonFadeOutTime">100</integer>
<!-- When dragging items on the workspace, how much bigger (in pixels) the dragged view
should be, as compared to the original view. If 0, it will not be scaled at all.
+1 -2
View File
@@ -48,8 +48,7 @@
<!-- height & width of the drop rectangle for the trash icon -->
<dimen name="delete_zone_size">50dip</dimen>
<dimen name="delete_zone_min_padding">10dip</dimen>
<dimen name="delete_zone_max_padding">20dip</dimen>
<dimen name="delete_zone_padding">20dip</dimen>
<!-- dimensions for the wallpaper picker wallpaper thumbnail width -->
<dimen name="wallpaper_small_width">170dp</dimen>
+3 -2
View File
@@ -31,12 +31,13 @@
</style>
<style name="WorkspaceIcon.Portrait">
<item name="android:drawablePadding">0dip</item>
<item name="android:drawablePadding">2dip</item>
<item name="android:paddingTop">0dip</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="WorkspaceIcon.Landscape">
<item name="android:drawablePadding">0dip</item>
<item name="android:drawablePadding">2dip</item>
<item name="android:paddingTop">0dip</item>
<item name="android:includeFontPadding">false</item>
</style>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"已下载"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"未找到游戏。"</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"未找到已下载的应用程序。"</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"无法将该项放到主屏幕上"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"文件夹名称"</string>
+1 -2
View File
@@ -39,8 +39,7 @@
<string name="all_apps_tab_downloaded" msgid="2300935549064726963">"下載內容"</string>
<string name="all_apps_no_games" msgid="5293893733372793696">"找不到遊戲。"</string>
<string name="all_apps_no_downloads" msgid="6145042636084482299">"找不到已下載的應用程式。"</string>
<!-- no translation found for external_drop_widget_error (4976816434597126575) -->
<skip />
<string name="external_drop_widget_error" msgid="4976816434597126575">"無法將項目拖放至主螢幕上"</string>
<!-- no translation found for external_drop_widget_pick_title (4481311720134376218) -->
<skip />
<string name="rename_folder_label" msgid="5646236631298452787">"資料夾名稱"</string>
+9
View File
@@ -74,6 +74,15 @@
<attr name="checkedOutlineColor" format="color" />
</declare-styleable>
<!-- PagedViewWidget specific attributes. These attributes are used to
customize a PagedViewWidget view in XML files. -->
<declare-styleable name="PagedViewWidget">
<!-- The blur color of the holographic outline -->
<attr name="blurColor" />
<!-- The outline color of the holographic outline -->
<attr name="outlineColor" />
</declare-styleable>
<!-- PagedView specific attributes. These attributes are used to customize
a PagedView view in XML files. -->
<declare-styleable name="PagedView">
+1 -1
View File
@@ -20,7 +20,7 @@
<resources>
<color name="window_background">#FF191919</color>
<color name="grid_dark_background">#EB191919</color>
<color name="bubble_dark_background">#B2191919</color>
<color name="bubble_dark_background">#20000000</color>
<color name="delete_color_filter">#A5FF0000</color>
<color name="appwidget_error_color">#FCCC</color>
+1 -1
View File
@@ -38,7 +38,7 @@
<item name="android:textSize">13dip</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">marquee</item>
<item name="android:shadowColor">#FF000000</item>
<item name="android:shadowColor">#B0000000</item>
<item name="android:shadowRadius">2.0</item>
<item name="android:textColor">#FFF</item>
<item name="android:gravity">center_horizontal</item>
+45 -91
View File
@@ -24,12 +24,8 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.Checkable;
import android.widget.TextView;
@@ -42,7 +38,7 @@ import com.android.launcher.R;
*/
public class AllAppsPagedView extends PagedView
implements AllAppsView, View.OnClickListener, View.OnLongClickListener, DragSource,
DropTarget, ActionMode.Callback {
DropTarget {
private static final String TAG = "AllAppsPagedView";
private static final boolean DEBUG = false;
@@ -69,11 +65,6 @@ public class AllAppsPagedView extends PagedView
private final LayoutInflater mInflater;
private ViewGroup mOrigInfoButtonParent;
private LayoutParams mOrigInfoButtonLayoutParams;
private ViewGroup mOrigDeleteZoneParent;
private LayoutParams mOrigDeleteZoneLayoutParams;
public AllAppsPagedView(Context context) {
this(context, null);
@@ -207,6 +198,47 @@ public class AllAppsPagedView extends PagedView
}
}
private void setupDragMode() {
mLauncher.getWorkspace().shrinkToBottomVisible();
ApplicationInfoDropTarget infoButton =
(ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
infoButton.setDragAndDropEnabled(false);
DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
deleteZone.setDragAndDropEnabled(false);
ApplicationInfoDropTarget allAppsInfoButton =
(ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
allAppsInfoButton.setDragAndDropEnabled(true);
DeleteZone allAppsDeleteZone = (DeleteZone)
mLauncher.findViewById(R.id.all_apps_delete_zone);
allAppsDeleteZone.setDragAndDropEnabled(true);
}
private void tearDownDragMode() {
post(new Runnable() {
// Once the drag operation has fully completed, hence the post, we want to disable the
// deleteZone and the appInfoButton in all apps, and re-enable the instance which
// live in the workspace
public void run() {
ApplicationInfoDropTarget infoButton =
(ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
infoButton.setDragAndDropEnabled(true);
DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
deleteZone.setDragAndDropEnabled(true);
ApplicationInfoDropTarget allAppsInfoButton =
(ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
allAppsInfoButton.setDragAndDropEnabled(false);
DeleteZone allAppsDeleteZone =
(DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone);
allAppsDeleteZone.setDragAndDropEnabled(false);
}
});
resetCheckedGrandchildren();
mDragController.removeDropTarget(this);
}
@Override
public boolean onLongClick(View v) {
if (!v.isInTouchMode()) {
@@ -223,10 +255,8 @@ public class AllAppsPagedView extends PagedView
c.toggle();
}
// Start choice mode AFTER the item is selected
if (isChoiceMode(CHOICE_MODE_NONE)) {
startChoiceMode(CHOICE_MODE_SINGLE, this);
}
// Start drag mode after the item is selected
setupDragMode();
ApplicationInfo app = (ApplicationInfo) v.getTag();
app = new ApplicationInfo(app);
@@ -246,6 +276,7 @@ public class AllAppsPagedView extends PagedView
if (target != this) {
endChoiceMode();
}
tearDownDragMode();
mLauncher.getWorkspace().onDragStopped();
}
@@ -467,83 +498,6 @@ public class AllAppsPagedView extends PagedView
new PagedViewCellLayout.LayoutParams(0, 0, 2, 1));
}
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
mode.setTitle(R.string.cab_app_selection_text);
// Until the workspace has a selection mode and the CAB supports drag-and-drop, we
// take a hybrid approach: grab the views from the workspace and stuff them into the CAB.
// When the action mode is done, restore the views to their original place in the toolbar.
ApplicationInfoDropTarget infoButton =
(ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
mOrigInfoButtonParent = (ViewGroup) infoButton.getParent();
mOrigInfoButtonLayoutParams = infoButton.getLayoutParams();
mOrigInfoButtonParent.removeView(infoButton);
infoButton.setManageVisibility(false);
infoButton.setVisibility(View.VISIBLE);
infoButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final ApplicationInfo appInfo = (ApplicationInfo) getChosenItem();
mLauncher.startApplicationDetailsActivity(appInfo.componentName);
}
});
DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
mOrigDeleteZoneParent = (ViewGroup) deleteZone.getParent();
mOrigDeleteZoneLayoutParams = deleteZone.getLayoutParams();
mOrigDeleteZoneParent.removeView(deleteZone);
deleteZone.setManageVisibility(false);
deleteZone.setVisibility(View.VISIBLE);
deleteZone.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final ApplicationInfo appInfo = (ApplicationInfo) getChosenItem();
mLauncher.startApplicationUninstallActivity(appInfo);
}
});
menu.add(0, MENU_DELETE_APP, 0, R.string.cab_menu_delete_app).setActionView(deleteZone);
menu.add(0, MENU_APP_INFO, 0, R.string.cab_menu_app_info).setActionView(infoButton);
mLauncher.getWorkspace().shrinkToBottomVisible();
return true;
}
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mDragController.addDropTarget(this);
return true;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
final Menu menu = mode.getMenu();
// Re-parent the drop targets into the toolbar, and restore their layout params
ApplicationInfoDropTarget infoButton =
(ApplicationInfoDropTarget) menu.findItem(MENU_APP_INFO).getActionView();
((ViewGroup) infoButton.getParent()).removeView(infoButton);
mOrigInfoButtonParent.addView(infoButton, mOrigInfoButtonLayoutParams);
infoButton.setVisibility(View.GONE);
infoButton.setManageVisibility(true);
DeleteZone deleteZone = (DeleteZone) menu.findItem(MENU_DELETE_APP).getActionView();
((ViewGroup) deleteZone.getParent()).removeView(deleteZone);
mOrigDeleteZoneParent.addView(deleteZone, mOrigDeleteZoneLayoutParams);
deleteZone.setVisibility(View.GONE);
deleteZone.setManageVisibility(true);
mDragController.removeDropTarget(this);
endChoiceMode();
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// This is never called. Because we use setActionView(), we handle our own click events.
return false;
}
/*
* We don't actually use AllAppsPagedView as a drop target... it's only used to intercept a drop
@@ -16,8 +16,6 @@
package com.android.launcher2;
import com.android.launcher.R;
import android.content.ComponentName;
import android.content.Context;
import android.graphics.Paint;
@@ -28,6 +26,8 @@ import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import com.android.launcher.R;
/**
* Implements a DropTarget which allows applications to be dropped on it,
* in order to launch the application info for that app.
@@ -41,7 +41,7 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
* This is generally the case, but it will be set to false when this is part of the
* Contextual Action Bar.
*/
private boolean mManageVisibility = true;
private boolean mDragAndDropEnabled = true;
/** The view that this view should appear in the place of. */
private View mHandle = null;
@@ -69,6 +69,7 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
// acceptDrop is called just before onDrop. We do the work here, rather than
// in onDrop, because it allows us to reject the drop (by returning false)
// so that the object being dragged isn't removed from the home screen.
if (getVisibility() != VISIBLE) return false;
ComponentName componentName = null;
if (dragInfo instanceof ApplicationInfo) {
@@ -87,6 +88,7 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
if (!mDragAndDropEnabled) return;
dragView.setPaint(mPaint);
}
@@ -96,18 +98,20 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
if (!mDragAndDropEnabled) return;
dragView.setPaint(null);
}
public void onDragStart(DragSource source, Object info, int dragAction) {
if (info != null) {
if (info != null && mDragAndDropEnabled) {
final int itemType = ((ItemInfo)info).itemType;
mActive = (itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION);
if (mManageVisibility) {
// Only show the info icon when an application is selected
if (mActive) {
setVisibility(VISIBLE);
}
// Only show the info icon when an application is selected
if (mActive) {
setVisibility(VISIBLE);
}
if (mHandle != null) {
mHandle.setVisibility(INVISIBLE);
}
}
@@ -118,11 +122,13 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
}
public void onDragEnd() {
if (!mDragAndDropEnabled) return;
if (mActive) {
mActive = false;
}
if (mManageVisibility) {
setVisibility(GONE);
setVisibility(GONE);
if (mHandle != null) {
mHandle.setVisibility(VISIBLE);
}
}
@@ -131,16 +137,10 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
public void getHitRect(Rect outRect) {
super.getHitRect(outRect);
if (LauncherApplication.isScreenXLarge()) {
// TODO: This is a temporary hack. mManageVisiblity = false when you're in CAB mode.
// In that case, this icon is more tightly spaced next to the delete icon so we want
// it to have a smaller drag region. When the new drag&drop system comes in, we'll
// dispatch the drag/drop by calculating what target you're overlapping
final int minPadding = R.dimen.delete_zone_min_padding;
final int maxPadding = R.dimen.delete_zone_max_padding;
final int padding = R.dimen.delete_zone_padding;
final int outerDragPadding =
getResources().getDimensionPixelSize(R.dimen.delete_zone_size);
final int innerDragPadding = getResources().getDimensionPixelSize(
mManageVisibility ? maxPadding : minPadding);
final int innerDragPadding = getResources().getDimensionPixelSize(padding);
outRect.top -= outerDragPadding;
outRect.left -= innerDragPadding;
outRect.bottom += outerDragPadding;
@@ -156,8 +156,8 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
mHandle = view;
}
void setManageVisibility(boolean value) {
mManageVisibility = value;
void setDragAndDropEnabled(boolean enabled) {
mDragAndDropEnabled = enabled;
}
@Override
+65 -20
View File
@@ -16,14 +16,17 @@
package com.android.launcher2;
import android.widget.TextView;
import android.content.Context;
import android.util.AttributeSet;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.util.AttributeSet;
import android.view.View.MeasureSpec;
import com.android.launcher.R;
@@ -32,13 +35,16 @@ import com.android.launcher.R;
* because we want to make the bubble taller than the text and TextView's clip is
* too aggressive.
*/
public class BubbleTextView extends TextView {
static final float CORNER_RADIUS = 8.0f;
static final float PADDING_H = 5.0f;
static final float PADDING_V = 1.0f;
public class BubbleTextView extends CacheableTextView {
static final float CORNER_RADIUS = 4.0f;
static final float PADDING_H = 8.0f;
static final float PADDING_V = 3.0f;
private int mAppCellWidth;
private final RectF mRect = new RectF();
private Paint mPaint;
private float mBubbleColorAlpha;
private int mPrevAlpha = -1;
private boolean mBackgroundSizeChanged;
@@ -63,20 +69,43 @@ public class BubbleTextView extends TextView {
}
private void init() {
setFocusable(true);
mBackground = getBackground();
setFocusable(true);
setBackgroundDrawable(null);
final Resources res = getContext().getResources();
int bubbleColor = res.getColor(R.color.bubble_dark_background);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(getContext().getResources().getColor(R.color.bubble_dark_background));
mPaint.setColor(bubbleColor);
mBubbleColorAlpha = Color.alpha(bubbleColor) / 255.0f;
mAppCellWidth = (int) res.getDimension(R.dimen.app_icon_size);
final float scale = getContext().getResources().getDisplayMetrics().density;
final float scale = res.getDisplayMetrics().density;
mCornerRadius = CORNER_RADIUS * scale;
mPaddingH = PADDING_H * scale;
//noinspection PointlessArithmeticExpression
mPaddingV = PADDING_V * scale;
}
protected int getVerticalPadding() {
return (int) PADDING_V;
}
protected int getHorizontalPadding() {
return (int) PADDING_H;
}
public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache) {
Bitmap b = info.getIcon(iconCache);
setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(b),
null, null);
setText(info.title);
buildAndEnableCache();
setTag(info);
}
@Override
protected boolean setFrame(int left, int top, int right, int bottom) {
if (mLeft != left || mRight != right || mTop != top || mBottom != bottom) {
@@ -120,37 +149,53 @@ public class BubbleTextView extends TextView {
}
}
// Draw the hotdog bubble
final Layout layout = getLayout();
final RectF rect = mRect;
final int left = getCompoundPaddingLeft();
final int top = getExtendedPaddingTop();
final int offset = getExtendedPaddingTop();
final int paddingLeft = getPaddingLeft();
final int paddingRight = getPaddingRight();
final float left = layout.getLineLeft(0) + paddingLeft;
final float right = Math.min(layout.getLineRight(0) + paddingRight,
left + getWidth() - paddingLeft - paddingRight);
mRect.set(left - mPaddingH, offset + (int) layout.getLineTop(0) - mPaddingV,
right + mPaddingH, offset + (int) layout.getLineBottom(0) + mPaddingV);
rect.set(left + layout.getLineLeft(0) - mPaddingH,
top + layout.getLineTop(0) - mPaddingV,
Math.min(left + layout.getLineRight(0) + mPaddingH, mScrollX + mRight - mLeft),
top + layout.getLineBottom(0) + mPaddingV);
canvas.drawRoundRect(rect, mCornerRadius, mCornerRadius, mPaint);
canvas.drawRoundRect(mRect, mCornerRadius, mCornerRadius, mPaint);
super.draw(canvas);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if (w > 0 && h > 0) {
// Temporary Workaround: We need to set padding to compress the text so that we can draw
// a hotdog around it. Currently, the background images prevent us from applying the
// padding in XML, so we are doing this programmatically
int d = w - mAppCellWidth;
int pL = d - (d / 2);
int pR = d - pL;
setPadding(pL, getPaddingTop(), pR, getPaddingBottom());
}
super.onSizeChanged(w, h, oldw, oldh);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mBackground.setCallback(this);
if (mBackground != null) mBackground.setCallback(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mBackground.setCallback(null);
if (mBackground != null) mBackground.setCallback(null);
}
@Override
protected boolean onSetAlpha(int alpha) {
if (mPrevAlpha != alpha) {
mPrevAlpha = alpha;
mPaint.setAlpha(alpha);
mPaint.setAlpha((int) (alpha * mBubbleColorAlpha));
super.onSetAlpha(alpha);
}
return true;
@@ -0,0 +1,132 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher2;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Bitmap.Config;
import android.text.Layout;
import android.util.AttributeSet;
import android.widget.TextView;
/*
* This class is a bit of a hack, designed to speed up long text labels in Launcher. It caches the
* text in a TextView to a bitmap and then just draws that Bitmap instead afterward, speeding up
* rendering. Marquee scrolling is not currently supported.
*
*/
public class CacheableTextView extends TextView {
private Bitmap mCache;
private final Paint mCachePaint = new Paint();
private final Canvas mCacheCanvas = new Canvas();
private int mPrevAlpha = -1;
private boolean mIsBuildingCache;
boolean mWaitingToGenerateCache;
float mTextCacheLeft;
float mTextCacheTop;
float mTextCacheScrollX;
float mRectLeft, mRectTop;
private float mPaddingH = 0;
private float mPaddingV = 0;
public CacheableTextView(Context context) {
super(context);
}
public CacheableTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CacheableTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
protected int getVerticalPadding() {
return 0;
}
protected int getHorizontalPadding() {
return 0;
}
public void buildAndEnableCache() {
if (getLayout() == null) {
mWaitingToGenerateCache = true;
return;
}
final Layout layout = getLayout();
final int left = getCompoundPaddingLeft();
final int top = getExtendedPaddingTop();
final float prevAlpha = getAlpha();
int vPadding = getVerticalPadding();
int hPadding = getHorizontalPadding();
mTextCacheLeft = layout.getLineLeft(0) - hPadding;
mTextCacheTop = top + layout.getLineTop(0) - mPaddingV - vPadding;
mRectLeft = mScrollX + getLeft();
mRectTop = 0;
mTextCacheScrollX = mScrollX;
final float textCacheRight =
Math.min(left + layout.getLineRight(0) + mPaddingH, mScrollX + mRight - mLeft) + hPadding;
final float textCacheBottom = top + layout.getLineBottom(0) + mPaddingV + vPadding;
mCache = Bitmap.createBitmap((int) (textCacheRight - mTextCacheLeft),
(int) (textCacheBottom - mTextCacheTop), Config.ARGB_8888);
mCacheCanvas.setBitmap(mCache);
mCacheCanvas.translate(-mTextCacheLeft, -mTextCacheTop);
mIsBuildingCache = true;
setAlpha(1.0f);
draw(mCacheCanvas);
setAlpha(prevAlpha);
mIsBuildingCache = false;
// A hack-- we set the text to be one space (we don't make it empty just to avoid any
// potential issues with text measurement, like line height, etc.) so that the text view
// doesn't draw it anymore, since it's been cached. We have to manually rebuild
// the cache whenever the text is changed (which is never in Launcher)
setText(" ");
}
public void draw(Canvas canvas) {
if (mWaitingToGenerateCache && !mIsBuildingCache) {
buildAndEnableCache();
mWaitingToGenerateCache = false;
}
if (mCache != null) {
canvas.drawBitmap(mCache, mTextCacheLeft - mTextCacheScrollX + mScrollX,
mTextCacheTop, mCachePaint);
}
super.draw(canvas);
}
@Override
protected boolean onSetAlpha(int alpha) {
if (mPrevAlpha != alpha) {
mPrevAlpha = alpha;
mCachePaint.setAlpha(alpha);
super.onSetAlpha(alpha);
}
return true;
}
}
@@ -569,7 +569,7 @@ public class CustomizePagedView extends PagedView
* This method will extract the preview image specified by the wallpaper source provider (if it
* exists) otherwise, it will try to generate a default image preview.
*/
private Drawable getWallpaperPreview(ResolveInfo info) {
private FastBitmapDrawable getWallpaperPreview(ResolveInfo info) {
// To be implemented later: resolving the up-to-date wallpaper thumbnail
final int minDim = mWorkspaceWidgetLayout.estimateCellWidth(1);
@@ -597,7 +597,7 @@ public class CustomizePagedView extends PagedView
// if we can't find the icon, then just don't draw it
}
Drawable drawable = new FastBitmapDrawable(bitmap);
FastBitmapDrawable drawable = new FastBitmapDrawable(bitmap);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
return drawable;
}
@@ -607,10 +607,11 @@ public class CustomizePagedView extends PagedView
* otherwise, it will try to generate a default image preview with the widget's package icon.
* @return the drawable that will be used and sized in the ImageView to represent the widget
*/
private Drawable getWidgetPreview(AppWidgetProviderInfo info) {
private FastBitmapDrawable getWidgetPreview(AppWidgetProviderInfo info) {
final PackageManager packageManager = mPackageManager;
String packageName = info.provider.getPackageName();
Drawable drawable = null;
FastBitmapDrawable newDrawable = null;
if (info.previewImage != 0) {
drawable = packageManager.getDrawable(packageName, info.previewImage, null);
if (drawable == null) {
@@ -649,7 +650,7 @@ public class CustomizePagedView extends PagedView
// if we can't find the icon, then just don't draw it
}
drawable = new FastBitmapDrawable(bitmap);
newDrawable = new FastBitmapDrawable(bitmap);
} else {
// Scale down the preview if necessary
final float imageWidth = drawable.getIntrinsicWidth();
@@ -672,10 +673,11 @@ public class CustomizePagedView extends PagedView
final Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
renderDrawableToBitmap(drawable, bitmap, 0, 0, width, height);
drawable = new FastBitmapDrawable(bitmap);
newDrawable = new FastBitmapDrawable(bitmap);
}
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
return drawable;
newDrawable.setBounds(0, 0, newDrawable.getIntrinsicWidth(),
newDrawable.getIntrinsicHeight());
return newDrawable;
}
private void setupPage(PagedViewCellLayout layout) {
@@ -720,28 +722,18 @@ public class CustomizePagedView extends PagedView
for (int i = 0; i < count; ++i) {
final AppWidgetProviderInfo info = (AppWidgetProviderInfo) list.get(i);
final PendingAddWidgetInfo createItemInfo = new PendingAddWidgetInfo(info, null, null);
final int[] cellSpans = CellLayout.rectToCell(getResources(), info.minWidth,
info.minHeight, null);
final FastBitmapDrawable icon = getWidgetPreview(info);
LinearLayout l = (LinearLayout) mInflater.inflate(
PagedViewWidget l = (PagedViewWidget) mInflater.inflate(
R.layout.customize_paged_view_widget, layout, false);
l.applyFromAppWidgetProviderInfo(info, icon, mMaxWidgetWidth, cellSpans);
l.setTag(createItemInfo);
l.setOnClickListener(this);
l.setOnTouchListener(this);
l.setOnLongClickListener(this);
final Drawable icon = getWidgetPreview(info);
int[] spans = CellLayout.rectToCell(getResources(), info.minWidth, info.minHeight, null);
final int hSpan = spans[0];
final int vSpan = spans[1];
ImageView image = (ImageView) l.findViewById(R.id.widget_preview);
image.setMaxWidth(mMaxWidgetWidth);
image.setImageDrawable(icon);
TextView name = (TextView) l.findViewById(R.id.widget_name);
name.setText(info.label);
TextView dims = (TextView) l.findViewById(R.id.widget_dims);
dims.setText(mContext.getString(R.string.widget_dims_format, hSpan, vSpan));
layout.addView(l);
}
}
@@ -775,20 +767,14 @@ public class CustomizePagedView extends PagedView
final int endIndex = Math.min(count, startIndex + numItemsPerPage);
for (int i = startIndex; i < endIndex; ++i) {
final ResolveInfo info = mWallpaperList.get(i);
final FastBitmapDrawable icon = getWallpaperPreview(info);
LinearLayout l = (LinearLayout) mInflater.inflate(
PagedViewWidget l = (PagedViewWidget) mInflater.inflate(
R.layout.customize_paged_view_wallpaper, layout, false);
l.applyFromWallpaperInfo(info, mPackageManager, icon, mMaxWidgetWidth);
l.setTag(info);
l.setOnClickListener(this);
final Drawable icon = getWallpaperPreview(info);
ImageView image = (ImageView) l.findViewById(R.id.wallpaper_preview);
image.setMaxWidth(mMaxWidgetWidth);
image.setImageDrawable(icon);
TextView name = (TextView) l.findViewById(R.id.wallpaper_name);
name.setText(info.loadLabel(mPackageManager));
layout.addView(l);
}
}
+20 -20
View File
@@ -16,8 +16,6 @@
package com.android.launcher2;
import com.android.launcher.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
@@ -35,6 +33,8 @@ import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import com.android.launcher.R;
public class DeleteZone extends ImageView implements DropTarget, DragController.DragListener {
private static final int ORIENTATION_HORIZONTAL = 1;
private static final int TRANSITION_DURATION = 250;
@@ -50,7 +50,7 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
* This is generally the case, but it will be set to false when this is part of the
* Contextual Action Bar.
*/
private boolean mManageVisibility = true;
private boolean mDragAndDropEnabled = true;
private AnimationSet mInAnimation;
private AnimationSet mOutAnimation;
@@ -81,7 +81,6 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DeleteZone, defStyle, 0);
mOrientation = a.getInt(R.styleable.DeleteZone_direction, ORIENTATION_HORIZONTAL);
a.recycle();
}
@Override
@@ -97,6 +96,8 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
if (!mDragAndDropEnabled) return;
final ItemInfo item = (ItemInfo) dragInfo;
// On x-large screens, you can uninstall an app by dragging from all apps
@@ -142,6 +143,7 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
if (!mDragAndDropEnabled) return;
mTransition.reverseTransition(TRANSITION_DURATION);
dragView.setPaint(mTrashPaint);
}
@@ -152,13 +154,14 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo) {
if (!mDragAndDropEnabled) return;
mTransition.reverseTransition(TRANSITION_DURATION);
dragView.setPaint(null);
}
public void onDragStart(DragSource source, Object info, int dragAction) {
final ItemInfo item = (ItemInfo) info;
if (item != null) {
if (item != null && mDragAndDropEnabled) {
mTrashMode = true;
getHitRect(mRegion);
mRegionF.set(mRegion);
@@ -175,26 +178,25 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
// Make sure the icon is set to the default drawable, not the hover drawable
mTransition.resetTransition();
if (mManageVisibility) {
createAnimations();
startAnimation(mInAnimation);
createAnimations();
startAnimation(mInAnimation);
if (mHandle != null) {
mHandle.startAnimation(mHandleOutAnimation);
setVisibility(VISIBLE);
}
setVisibility(VISIBLE);
}
}
public void onDragEnd() {
if (mTrashMode) {
if (mTrashMode && mDragAndDropEnabled) {
mTrashMode = false;
mDragController.setDeleteRegion(null);
if (mOutAnimation != null) startAnimation(mOutAnimation);
if (mHandleInAnimation != null) mHandle.startAnimation(mHandleInAnimation);
if (mManageVisibility) {
setVisibility(GONE);
if (mHandleInAnimation != null && mHandle != null) {
mHandle.startAnimation(mHandleInAnimation);
}
setVisibility(GONE);
}
}
@@ -210,12 +212,10 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
// In that case, this icon is more tightly spaced next to the delete icon so we want
// it to have a smaller drag region. When the new drag&drop system comes in, we'll
// dispatch the drag/drop by calculating what target you're overlapping
final int minPadding = R.dimen.delete_zone_min_padding;
final int maxPadding = R.dimen.delete_zone_max_padding;
final int padding = R.dimen.delete_zone_padding;
final int outerDragPadding =
getResources().getDimensionPixelSize(R.dimen.delete_zone_size);
final int innerDragPadding = getResources().getDimensionPixelSize(
mManageVisibility ? maxPadding : minPadding);
final int innerDragPadding = getResources().getDimensionPixelSize(padding);
outRect.top -= outerDragPadding;
outRect.left -= innerDragPadding;
outRect.bottom += outerDragPadding;
@@ -290,8 +290,8 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
mHandle = view;
}
void setManageVisibility(boolean value) {
mManageVisibility = value;
void setDragAndDropEnabled(boolean enabled) {
mDragAndDropEnabled = enabled;
}
private static class FastTranslateAnimation extends TranslateAnimation {
@@ -26,11 +26,13 @@ import android.graphics.drawable.Drawable;
class FastBitmapDrawable extends Drawable {
private Bitmap mBitmap;
private int mAlpha;
private int mWidth;
private int mHeight;
private final Paint mPaint = new Paint();
FastBitmapDrawable(Bitmap b) {
mAlpha = 255;
mBitmap = b;
if (b != null) {
mWidth = mBitmap.getWidth();
@@ -53,9 +55,14 @@ class FastBitmapDrawable extends Drawable {
@Override
public void setAlpha(int alpha) {
mAlpha = alpha;
mPaint.setAlpha(alpha);
}
public int getAlpha() {
return mAlpha;
}
@Override
public void setColorFilter(ColorFilter cf) {
}
+32 -12
View File
@@ -59,6 +59,7 @@ import android.content.res.TypedArray;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -90,8 +91,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.View.OnLongClickListener;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.Advanceable;
import android.widget.EditText;
@@ -960,6 +959,29 @@ public final class Launcher extends Activity
deleteZone.setHandle(findViewById(deleteZoneHandleId));
dragController.addDragListener(deleteZone);
DeleteZone allAppsDeleteZone = (DeleteZone) findViewById(R.id.all_apps_delete_zone);
if (allAppsDeleteZone != null) {
allAppsDeleteZone.setLauncher(this);
allAppsDeleteZone.setDragController(dragController);
allAppsDeleteZone.setDragAndDropEnabled(false);
dragController.addDragListener(allAppsDeleteZone);
dragController.addDropTarget(allAppsDeleteZone);
}
ApplicationInfoDropTarget allAppsInfoTarget = (ApplicationInfoDropTarget)
findViewById(R.id.all_apps_info_target);
if (allAppsInfoTarget != null) {
allAppsInfoTarget.setLauncher(this);
dragController.addDragListener(allAppsInfoTarget);
allAppsInfoTarget.setDragColor(getResources().getColor(R.color.app_info_filter));
allAppsInfoTarget.setDragAndDropEnabled(false);
View marketButton = findViewById(R.id.market_button);
if (marketButton != null) {
marketButton.setBackgroundColor(Color.RED);
allAppsInfoTarget.setHandle(marketButton);
}
}
ApplicationInfoDropTarget infoButton = (ApplicationInfoDropTarget)findViewById(R.id.info_button);
if (infoButton != null) {
infoButton.setLauncher(this);
@@ -978,6 +1000,12 @@ public final class Launcher extends Activity
if (infoButton != null) {
dragController.addDropTarget(infoButton);
}
if (allAppsInfoTarget != null) {
dragController.addDropTarget(allAppsInfoTarget);
}
if (allAppsDeleteZone != null) {
dragController.addDropTarget(allAppsDeleteZone);
}
}
@SuppressWarnings({"UnusedDeclaration"})
@@ -1038,17 +1066,9 @@ public final class Launcher extends Activity
* @return A View inflated from layoutResId.
*/
View createShortcut(int layoutResId, ViewGroup parent, ShortcutInfo info) {
TextView favorite = (TextView) mInflater.inflate(layoutResId, parent, false);
Bitmap b = info.getIcon(mIconCache);
favorite.setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(b),
null, null);
favorite.setText(info.title);
favorite.setTag(info);
BubbleTextView favorite = (BubbleTextView) mInflater.inflate(layoutResId, parent, false);
favorite.applyFromShortcutInfo(info, mIconCache);
favorite.setOnClickListener(this);
return favorite;
}
+6
View File
@@ -566,9 +566,15 @@ public abstract class PagedView extends ViewGroup {
rightScreen = Math.min(getChildCount() - 1, rightScreen);
final long drawingTime = getDrawingTime();
// Clip to the bounds
canvas.save();
canvas.clipRect(mScrollX, mScrollY, mScrollX + mRight - mLeft,
mScrollY + mBottom - mTop);
for (int i = leftScreen; i <= rightScreen; i++) {
drawChild(canvas, getChildAt(i), drawingTime);
}
canvas.restore();
}
}
+6 -3
View File
@@ -39,7 +39,7 @@ import com.android.launcher2.PagedView.PagedViewIconCache;
* An icon on a PagedView, specifically for items in the launcher's paged view (with compound
* drawables on the top).
*/
public class PagedViewIcon extends TextView implements Checkable {
public class PagedViewIcon extends CacheableTextView implements Checkable {
private static final String TAG = "PagedViewIcon";
// holographic outline
@@ -52,7 +52,7 @@ public class PagedViewIcon extends TextView implements Checkable {
private Object mIconCacheKey;
private PagedViewIconCache mIconCache;
private int mAlpha = -1;
private int mAlpha;
private int mHolographicAlpha;
private boolean mIsChecked;
@@ -104,12 +104,13 @@ public class PagedViewIcon extends TextView implements Checkable {
public PagedViewIcon(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedViewIcon, defStyle, 0);
mAlpha = 255;
mHoloBlurColor = a.getColor(R.styleable.PagedViewIcon_blurColor, 0);
mHoloOutlineColor = a.getColor(R.styleable.PagedViewIcon_outlineColor, 0);
mCheckedBlurColor = a.getColor(R.styleable.PagedViewIcon_checkedBlurColor, 0);
mCheckedOutlineColor = a.getColor(R.styleable.PagedViewIcon_checkedOutlineColor, 0);
a.recycle();
if (sHolographicOutlineHelper == null) {
@@ -138,6 +139,7 @@ public class PagedViewIcon extends TextView implements Checkable {
mIcon = info.iconBitmap;
setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null);
setText(info.title);
buildAndEnableCache();
setTag(info);
queueHolographicOutlineCreation();
@@ -153,6 +155,7 @@ public class PagedViewIcon extends TextView implements Checkable {
modelIconCache.getFullResIcon(info, packageManager), mContext);
setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(mIcon), null, null);
setText(info.loadLabel(packageManager));
buildAndEnableCache();
setTag(info);
queueHolographicOutlineCreation();
@@ -0,0 +1,218 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher2;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.launcher.R;
import com.android.launcher2.PagedView.PagedViewIconCache;
/**
* The linear layout used strictly for the widget/wallpaper tab of the customization tray
*/
public class PagedViewWidget extends LinearLayout {
static final String TAG = "PagedViewWidgetLayout";
private final Paint mPaint = new Paint();
private static HolographicOutlineHelper sHolographicOutlineHelper;
private Bitmap mHolographicOutline;
private final Canvas mHolographicOutlineCanvas = new Canvas();
private FastBitmapDrawable mPreview;
private int mAlpha = 255;
private int mHolographicAlpha;
// Highlight colors
private int mHoloBlurColor;
private int mHoloOutlineColor;
private static final HandlerThread sWorkerThread = new HandlerThread("pagedviewwidget-helper");
static {
sWorkerThread.start();
}
private static final int MESSAGE_CREATE_HOLOGRAPHIC_OUTLINE = 1;
private static final Handler sWorker = new Handler(sWorkerThread.getLooper()) {
private DeferredHandler mHandler = new DeferredHandler();
public void handleMessage(Message msg) {
final PagedViewWidget widget = (PagedViewWidget) msg.obj;
final int prevAlpha = widget.mPreview.getAlpha();
final Bitmap outline = Bitmap.createBitmap(widget.getWidth(), widget.getHeight(),
Bitmap.Config.ARGB_8888);
widget.mHolographicOutlineCanvas.setBitmap(outline);
widget.mHolographicOutlineCanvas.save();
widget.mHolographicOutlineCanvas.translate(widget.mPaddingLeft, widget.mPaddingTop);
widget.mPreview.setAlpha(255);
widget.mPreview.draw(widget.mHolographicOutlineCanvas);
widget.mPreview.setAlpha(prevAlpha);
widget.mHolographicOutlineCanvas.restore();
sHolographicOutlineHelper.applyExpensiveOutlineWithBlur(outline,
widget.mHolographicOutlineCanvas, widget.mHoloBlurColor,
widget.mHoloOutlineColor);
mHandler.post(new Runnable() {
public void run() {
widget.mHolographicOutline = outline;
widget.invalidate();
}
});
}
};
public PagedViewWidget(Context context) {
this(context, null);
}
public PagedViewWidget(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public PagedViewWidget(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedViewWidget,
defStyle, 0);
mHoloBlurColor = a.getColor(R.styleable.PagedViewWidget_blurColor, 0);
mHoloOutlineColor = a.getColor(R.styleable.PagedViewWidget_outlineColor, 0);
a.recycle();
if (sHolographicOutlineHelper == null) {
sHolographicOutlineHelper = new HolographicOutlineHelper();
}
setFocusable(true);
setWillNotDraw(false);
setClipToPadding(false);
}
private void queueHolographicOutlineCreation() {
// Generate the outline in the background
if (mHolographicOutline == null) {
Message m = sWorker.obtainMessage(MESSAGE_CREATE_HOLOGRAPHIC_OUTLINE);
m.obj = this;
sWorker.sendMessage(m);
}
}
public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info,
FastBitmapDrawable preview, int maxWidth, int[] cellSpan) {
final ImageView image = (ImageView) findViewById(R.id.widget_preview);
image.setMaxWidth(maxWidth);
image.setImageDrawable(preview);
final TextView name = (TextView) findViewById(R.id.widget_name);
name.setText(info.label);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
dims.setText(mContext.getString(R.string.widget_dims_format, cellSpan[0], cellSpan[1]));
mPreview = preview;
}
public void applyFromWallpaperInfo(ResolveInfo info, PackageManager packageManager,
FastBitmapDrawable preview, int maxWidth) {
ImageView image = (ImageView) findViewById(R.id.wallpaper_preview);
image.setMaxWidth(maxWidth);
image.setImageDrawable(preview);
TextView name = (TextView) findViewById(R.id.wallpaper_name);
name.setText(info.loadLabel(packageManager));
mPreview = preview;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// We eat up the touch events here, since the PagedView (which uses the same swiping
// touch code as Workspace previously) uses onInterceptTouchEvent() to determine when
// the user is scrolling between pages. This means that if the pages themselves don't
// handle touch events, it gets forwarded up to PagedView itself, and it's own
// onTouchEvent() handling will prevent further intercept touch events from being called
// (it's the same view in that case). This is not ideal, but to prevent more changes,
// we just always mark the touch event as handled.
return super.onTouchEvent(event) || true;
}
@Override
protected void onDraw(Canvas canvas) {
if (mAlpha > 0) {
super.onDraw(canvas);
}
// draw any blended overlays
if (mHolographicOutline != null && mHolographicAlpha > 0) {
mPaint.setAlpha(mHolographicAlpha);
canvas.drawBitmap(mHolographicOutline, 0, 0, mPaint);
}
}
@Override
protected boolean onSetAlpha(int alpha) {
return true;
}
@Override
public void setAlpha(float alpha) {
final float viewAlpha = sHolographicOutlineHelper.viewAlphaInterpolator(alpha);
final float holographicAlpha = sHolographicOutlineHelper.highlightAlphaInterpolator(alpha);
int newViewAlpha = (int) (viewAlpha * 255);
int newHolographicAlpha = (int) (holographicAlpha * 255);
if ((mAlpha != newViewAlpha) || (mHolographicAlpha != newHolographicAlpha)) {
mAlpha = newViewAlpha;
mHolographicAlpha = newHolographicAlpha;
setChildrenAlpha(viewAlpha);
super.setAlpha(viewAlpha);
}
}
private void setChildrenAlpha(float alpha) {
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
getChildAt(i).setAlpha(alpha);
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if (w > 0 && h > 0) {
queueHolographicOutlineCreation();
}
super.onSizeChanged(w, h, oldw, oldh);
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
sWorker.removeMessages(MESSAGE_CREATE_HOLOGRAPHIC_OUTLINE, this);
}
}
+7 -2
View File
@@ -1281,9 +1281,14 @@ public class Workspace extends SmoothPagedView
v.getDrawingRect(clipRect);
// For a TextView, adjust the clip rect so that we don't include the text label
if (v instanceof TextView) {
if (v instanceof BubbleTextView) {
final BubbleTextView tv = (BubbleTextView) v;
clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V +
tv.getLayout().getLineTop(0);
} else if (v instanceof TextView) {
final TextView tv = (TextView) v;
clipRect.bottom = clipRect.top + tv.getCompoundPaddingTop() - 1;
clipRect.bottom = tv.getExtendedPaddingTop() - tv.getCompoundDrawablePadding() +
tv.getLayout().getLineTop(0);
}
// Draw the View into the bitmap.