Commit f3f19141 authored by Alexander Ivanov's avatar Alexander Ivanov

Update min SDK version, target SDK version and build target. Close #147.

parent 8c937d5f
......@@ -235,7 +235,7 @@
<receiver android:name="com.xabber.android.receiver.GoXaReceiver" />
<receiver android:name="com.xabber.android.receiver.ComposingPausedReceiver" />
</application>
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="9" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
......
......@@ -10,4 +10,4 @@
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-9
target=android-14
......@@ -15,15 +15,15 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:padding="4dip"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center">
<ImageView
......
......@@ -15,17 +15,17 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="@string/account_type" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:text="@string/account_type" android:layout_width="match_parent" android:layout_height="wrap_content" />
<Spinner
android:id="@+id/account_type"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dip"
android:paddingBottom="8dip"
......@@ -34,15 +34,15 @@
<LinearLayout
android:id="@+id/auth_panel"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView android:text="@string/account_user_name" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:text="@string/account_user_name" android:layout_width="match_parent" android:layout_height="wrap_content" />
<EditText
android:id="@+id/account_user_name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:singleLine="true"
......@@ -50,10 +50,10 @@
android:hint=""
/>
<TextView android:text="@string/account_password" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<TextView android:text="@string/account_password" android:layout_width="match_parent" android:layout_height="wrap_content" />
<EditText
android:id="@+id/account_password"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:password="true"
android:singleLine="true"
......@@ -62,7 +62,7 @@
<CheckBox
android:id="@+id/store_password"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/account_store_password" />
......@@ -71,27 +71,27 @@
<CheckBox
android:id="@+id/syncable"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/account_syncable" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:text="@string/account_add"
android:id="@+id/ok"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<TextView
android:id="@+id/account_help"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoLink="all"
/>
</LinearLayout>
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip">
......@@ -27,8 +27,8 @@
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="6dip"
android:singleLine="true"
android:ellipsize="marquee"
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip">
......@@ -27,8 +27,8 @@
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="6dip"
android:singleLine="true"
android:ellipsize="marquee"
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_list_item_height"
android:paddingTop="@dimen/contact_list_item_padding_top"
android:paddingBottom="@dimen/contact_list_item_padding_bottom"
......@@ -34,14 +34,14 @@
<LinearLayout
android:orientation="vertical"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="4dip"
android:paddingRight="4dip"
>
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
......@@ -54,7 +54,7 @@
<TextView
android:id="@+id/status"
android:text="@android:string/cancel"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip">
......@@ -27,8 +27,8 @@
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="6dip"
android:singleLine="true"
android:ellipsize="marquee"
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="2dip">
......@@ -27,8 +27,8 @@
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="6dip"
android:singleLine="true"
android:ellipsize="marquee"
......
......@@ -14,13 +14,13 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip">
<TextView
android:id="@android:id/message"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="48dp"
android:singleLine="true"
android:ellipsize="marquee"
......
......@@ -14,7 +14,7 @@
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_list_item_height"
android:paddingTop="@dimen/contact_list_item_padding_top"
android:paddingBottom="@dimen/contact_list_item_padding_bottom"
......@@ -28,8 +28,8 @@
<include layout="@layout/base_contact_avatar" />
<RelativeLayout
android:id="@+id/panel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/active_chat_padding_left"
android:paddingTop="@dimen/active_chat_padding_top"
android:paddingRight="@dimen/active_chat_padding_right"
......@@ -47,7 +47,7 @@
/>
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_name_height_show_status"
android:layout_marginRight="@dimen/status_icon_width"
android:gravity="bottom"
......@@ -59,7 +59,7 @@
/>
<TextView
android:id="@+id/status"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_name_height_show_status"
android:layout_marginRight="@dimen/status_icon_width"
android:gravity="top"
......@@ -81,7 +81,7 @@
</RelativeLayout>
<ImageView
android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_list_item_height"
android:background="@drawable/shadow"
/>
......
......@@ -14,7 +14,7 @@
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/expander_height"
android:gravity="center_vertical|left"
android:background="@drawable/expander_background_dark"
......@@ -29,7 +29,7 @@
/>
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/expander_height"
android:gravity="center_vertical"
android:layout_marginRight="@dimen/expander_text_margin_right"
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="6dip"
android:paddingTop="4dip"
......@@ -34,7 +34,7 @@
<include layout="@layout/base_contact_avatar" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
android:orientation="vertical"
......
......@@ -14,7 +14,7 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="3dp">
<ImageView
......
......@@ -14,7 +14,7 @@
-->
<com.xabber.android.ui.widget.PageSwitcher
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/switcher"
/>
\ No newline at end of file
......@@ -15,6 +15,6 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="1px"
/>
\ No newline at end of file
......@@ -15,11 +15,11 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/info"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip"
android:textAppearance="@style/ChatInfo.Warning"
......
......@@ -15,19 +15,19 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/contact_title" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="4dip"
android:stackFromBottom="true"
......@@ -36,7 +36,7 @@
/>
<TextView
android:id="@+id/chat_page"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip"
android:textSize="12sp"
......@@ -48,7 +48,7 @@
</RelativeLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="4dip">
<EditText
......@@ -59,7 +59,7 @@
android:cursorVisible="true"
android:hint="@string/chat_input_hint"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:maxLines="5"
android:scrollbars="vertical"
android:fadingEdge="vertical"
......@@ -68,7 +68,7 @@
android:text="@string/chat_send"
android:id="@+id/chat_send"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</LinearLayout>
......@@ -15,7 +15,7 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/background"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="4dip"
android:paddingBottom="4dip"
......
......@@ -15,6 +15,6 @@
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dip" />
......@@ -15,8 +15,8 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="4dip"
>
......@@ -27,7 +27,7 @@
/>
<com.xabber.android.ui.widget.NoDefaultSpinner
android:id="@+id/contact_account"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:prompt="@string/choose_account"
/>
......@@ -40,7 +40,7 @@
<EditText
android:text=""
android:id="@+id/contact_user"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="user@domain.name"
android:singleLine="true"
......@@ -55,7 +55,7 @@
<EditText
android:text=""
android:id="@+id/contact_name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
/>
......@@ -63,13 +63,13 @@
<LinearLayout
android:orientation="horizontal"
android:gravity="center_horizontal|bottom"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:text="@string/contact_add"
android:id="@+id/ok"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
......
......@@ -15,8 +15,8 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/contact_title" />
......@@ -33,7 +33,7 @@
<EditText
android:id="@+id/contact_name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
......@@ -49,7 +49,7 @@
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="6dip"
......
......@@ -15,13 +15,13 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="@android:id/title"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/title_height"
android:background="@drawable/title_main_background_dark"
>
......@@ -29,13 +29,13 @@
android:id="@+id/back_button"
android:background="@drawable/title_logo"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/contact_list_status_mode_width"
android:layout_toRightOf="@id/back_button"
android:layout_alignParentRight="true"
......@@ -102,8 +102,8 @@
</HorizontalScrollView>
<TextView
android:id="@+id/common_status_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="-72dip"
android:textColor="?android:attr/textColorPrimary"
android:text="online"
......@@ -120,20 +120,20 @@
android:paddingRight="@dimen/active_chat_padding_right"
android:background="@drawable/btn_status_mode"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textFilterEnabled="true"
/>
<RelativeLayout
android:id="@+id/info"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
>
......
......@@ -15,14 +15,14 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/title_height"
android:background="@drawable/title_account_background_light"
>
<LinearLayout
android:id="@+id/title_color"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
>
<ImageButton
......@@ -30,7 +30,7 @@
android:src="@drawable/btn_title_back"
android:background="@drawable/title_logo"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
/>
<LinearLayout
android:layout_width="wrap_content"
......@@ -45,13 +45,13 @@
android:src="@drawable/ic_security"
android:paddingLeft="6dip"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:visibility="gone"
/>
<LinearLayout
android:id="@+id/name_holder"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:layout_gravity="center_vertical"
......@@ -59,7 +59,7 @@
>
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="bottom"
......@@ -71,7 +71,7 @@
/>
<TextView
android:id="@+id/status_text"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="top"
......@@ -88,13 +88,13 @@
android:paddingRight="@dimen/active_chat_padding_right"
android:background="@drawable/btn_status_mode"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
<ImageView
android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shadow"
/>
</RelativeLayout>
......@@ -13,8 +13,8 @@
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="9dip"
android:paddingBottom="3dip"
......@@ -23,14 +23,14 @@
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="54dip"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
......@@ -55,14 +55,14 @@
style="?android:attr/textAppearanceLarge"
android:singleLine="true"
android:ellipsize="end"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="1dip"
android:visibility="gone"
android:scaleType="fitXY"
......@@ -73,7 +73,7 @@
<ScrollView
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="2dip"
......@@ -84,14 +84,14 @@
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@android:id/message"
style="?android:attr/textAppearanceMedium"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dip"
/>
......@@ -101,14 +101,14 @@
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<FrameLayout
android:id="@android:id/custom"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
......@@ -116,7 +116,7 @@
<LinearLayout
style="@android:style/ButtonBar"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="4dip"
......
......@@ -16,17 +16,17 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="4dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<EditText
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<CheckBox
android:id="@+id/send"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorPrimaryInverse"
android:text="@string/export_chat_send"
......
......@@ -15,21 +15,21 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/contact_title" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dip"
android:paddingBottom="4dip"
android:paddingLeft="2dip"
......@@ -38,20 +38,20 @@
<TextView
android:text="@string/otr_fingerprint_description"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dip"
/>
<TextView
android:text="@string/otr_remote_fingerprint"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/otr_remote_fingerprint"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@android:style/TextAppearance.Large"
android:text="12:34:56"
......@@ -59,33 +59,33 @@
<CheckBox
android:id="@+id/verified"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/otr_is_verified"
/>
<Button
android:id="@+id/scan"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/otr_scan_fingerprint"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/divider_horizontal_dark"
/>
<TextView
android:text="@string/otr_local_fingerprint"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/otr_local_fingerprint"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@android:style/TextAppearance.Large"
android:text="12:34:56"
......@@ -93,14 +93,14 @@
<Button
android:id="@+id/show"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/otr_show_fingerprint"
/>
<Button
android:id="@+id/copy"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/otr_copy_fingerprint"
/>
......
......@@ -16,7 +16,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="4dp"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
......@@ -27,7 +27,7 @@
<EditText
android:id="@+id/group_name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
......
......@@ -18,7 +18,7 @@
Preference is able to place a specific widget for its particular
type in the "widget_frame" layout. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
......@@ -52,7 +52,7 @@
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical" />
......
......@@ -15,6 +15,6 @@
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
......@@ -14,8 +14,8 @@
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
>
......
......@@ -15,14 +15,14 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
......@@ -32,7 +32,7 @@
/>
<com.xabber.android.ui.widget.NoDefaultSpinner
android:id="@+id/contact_account"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:prompt="@string/choose_account"
/>
......@@ -44,7 +44,7 @@
/>
<EditText
android:id="@+id/muc_server"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/muc_server_hint"
android:singleLine="true"
......@@ -58,7 +58,7 @@
/>
<EditText
android:id="@+id/muc_room"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
/>
......@@ -70,7 +70,7 @@
/>
<EditText
android:id="@+id/muc_nick"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/muc_nick_hint"
......@@ -78,12 +78,12 @@
<TextView
android:text="@string/muc_password"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/muc_password"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:password="true"
android:singleLine="true"
......@@ -94,21 +94,21 @@
android:id="@+id/muc_join"
android:checked="true"
android:text="@string/muc_join"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:orientation="horizontal"
android:gravity="center_horizontal|bottom"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:text="@string/muc_save"
android:id="@+id/ok"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
......
......@@ -25,7 +25,7 @@
/>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</FrameLayout>
\ No newline at end of file
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_list_item_height"
android:paddingLeft="6dip"
android:paddingRight="6dip"
......@@ -42,13 +42,13 @@
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
>
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_name_height_show_status"
android:layout_marginRight="@dimen/status_icon_width"
android:gravity="bottom"
......@@ -60,7 +60,7 @@
/>
<TextView
android:id="@+id/status"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/contact_name_height_show_status"
android:layout_marginRight="@dimen/status_icon_width"
android:gravity="top"
......
......@@ -14,18 +14,18 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="@string/account_password"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/account_password"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:password="true"
android:singleLine="true"
......@@ -33,7 +33,7 @@
<CheckBox
android:id="@+id/store_password"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="@string/account_store_password"
......
......@@ -18,7 +18,7 @@
Preference is able to place a specific widget for its particular
type in the "widget_frame" layout. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
......@@ -54,7 +54,7 @@
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical" />
......
......@@ -18,7 +18,7 @@
Preference is able to place a specific widget for its particular
type in the "widget_frame" layout. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
......@@ -44,7 +44,7 @@
style="?android:attr/progressBarStyleHorizontal"
android:minHeight="10dip"
android:maxHeight="10dip"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignLeft="@android:id/title"
......@@ -68,7 +68,7 @@
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@+android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical" />
......
......@@ -15,16 +15,16 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/contact_title" />
<ScrollView
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dip"
android:paddingBottom="4dip"
android:paddingLeft="2dip"
......@@ -33,50 +33,50 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:text="@string/otr_question_description"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dip"
/>
<TextView
android:text="@string/otr_question"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/question"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:text="@string/otr_answer"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/answer"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:id="@+id/send"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/chat_send"
......@@ -84,7 +84,7 @@
<Button
android:id="@+id/cancel"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/cancel"
......
......@@ -15,16 +15,16 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include layout="@layout/contact_title" />
<ScrollView
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dip"
android:paddingBottom="4dip"
android:paddingLeft="2dip"
......@@ -33,38 +33,38 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:text="@string/otr_secret_description"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dip"
/>
<TextView
android:text="@string/otr_secret"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/answer"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:id="@+id/send"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/chat_send"
......@@ -72,7 +72,7 @@
<Button
android:id="@+id/cancel"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/cancel"
......
......@@ -15,6 +15,6 @@
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dip" />
......@@ -15,23 +15,23 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/status_mode"
android:prompt="@string/status_editor"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/status_text"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/status_text_hint"
/>
<Button
android:id="@+id/ok"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/status_editor"
/>
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="4dip">
......@@ -25,7 +25,7 @@
android:src="@drawable/ic_status" />
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="42dip"
android:layout_marginLeft="6dip"
android:singleLine="true"
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="4dip">
......@@ -29,7 +29,7 @@
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="42dip"
android:layout_marginLeft="6dip"
android:singleLine="true"
......
......@@ -14,7 +14,7 @@
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="4dip">
......@@ -28,7 +28,7 @@
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dip"
android:singleLine="true"
......
......@@ -29,7 +29,6 @@ import java.util.concurrent.ThreadFactory;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Handler;
import com.xabber.android.service.XabberService;
......@@ -42,8 +41,6 @@ import com.xabber.androiddev.R;
*/
public class Application extends android.app.Application {
public static final int SDK_INT = Integer.valueOf(Build.VERSION.SDK);
private static Application instance;
public static Application getInstance() {
......@@ -254,8 +251,7 @@ public class Application extends android.app.Application {
* @return
*/
public boolean isContactsSupported() {
return SDK_INT >= 5
&& checkCallingOrSelfPermission("android.permission.READ_CONTACTS") == PackageManager.PERMISSION_GRANTED;
return checkCallingOrSelfPermission("android.permission.READ_CONTACTS") == PackageManager.PERMISSION_GRANTED;
}
@Override
......
......@@ -16,15 +16,11 @@ package com.xabber.android.data;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.jivesoftware.smack.Connection;
import org.xbill.DNS.Options;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.util.Log;
/**
......@@ -37,54 +33,12 @@ public class LogManager implements OnLoadListener {
private static final boolean log;
private static final boolean debugable;
private static Method _getApplicationInfo;
static {
initCompatibility();
debugable = (getApplicationInfo(Application.getInstance()).flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
debugable = (Application.getInstance().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
log = debugable && SettingsManager.debugLog();
};
private static void initCompatibility() {
try {
_getApplicationInfo = Context.class.getMethod("getApplicationInfo",
new Class[] {});
} catch (NoSuchMethodException nsme) {
}
}
public static ApplicationInfo getApplicationInfo(Context context) {
ApplicationInfo applicationInfo;
if (_getApplicationInfo != null) {
try {
applicationInfo = (ApplicationInfo) _getApplicationInfo
.invoke(context);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
throw (Error) cause;
} else {
throw new RuntimeException(e);
}
} catch (IllegalAccessException ie) {
throw new RuntimeException(ie);
}
} else {
try {
applicationInfo = context.getPackageManager()
.getApplicationInfo(context.getPackageName(), 0);
} catch (NameNotFoundException e) {
Log.e("LogManager",
"I can`t find my package in the system. Debug will be disabled.");
applicationInfo = new ApplicationInfo();
applicationInfo.flags = 0;
}
}
return applicationInfo;
}
private final static LogManager instance;
static {
......
......@@ -28,6 +28,7 @@ import org.jivesoftware.smack.util.StringUtils;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.os.Build;
import com.xabber.android.data.Application;
import com.xabber.android.data.NetworkException;
......@@ -133,7 +134,7 @@ public class AccountManager implements OnLoadListener, OnWipeListener {
TypedArray values = application.getResources().obtainTypedArray(id);
AccountProtocol protocol = AccountProtocol.valueOf(values
.getString(0));
if (Application.SDK_INT < 8 && protocol == AccountProtocol.wlm) {
if (Build.VERSION.SDK_INT < 8 && protocol == AccountProtocol.wlm) {
values.recycle();
continue;
}
......
......@@ -32,6 +32,8 @@ import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.StreamError;
import org.xbill.DNS.Record;
import android.os.Build;
import com.xabber.android.data.Application;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.NetworkException;
......@@ -264,7 +266,7 @@ public class ConnectionThread implements
LogManager.i(this, "Use " + address);
ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(
address.getHostAddress(), port, serverName);
if (Application.SDK_INT >= 14) {
if (Build.VERSION.SDK_INT >= 14) {
connectionConfiguration.setTruststoreType("AndroidCAStore");
connectionConfiguration.setTruststorePassword(null);
connectionConfiguration.setTruststorePath(null);
......
......@@ -27,6 +27,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import com.xabber.android.data.Application;
import com.xabber.android.data.OnLoadListener;
......@@ -479,9 +480,9 @@ public class AvatarManager implements OnLoadListener, OnLowMemoryListener,
}
private int getLauncherLargeIconSize() {
if (Application.SDK_INT < 9)
if (Build.VERSION.SDK_INT < 9)
return BaseShortcutHelper.getLauncherLargeIconSize();
else if (Application.SDK_INT < 11)
else if (Build.VERSION.SDK_INT < 11)
return GingerbreadShortcutHelper.getLauncherLargeIconSize();
else
return HoneycombShortcutHelper.getLauncherLargeIconSize();
......
......@@ -27,6 +27,7 @@ import android.content.Intent;
import android.database.Cursor;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Vibrator;
import android.widget.RemoteViews;
......@@ -391,7 +392,8 @@ public class NotificationManager implements OnInitializedListener,
chatViews.setTextViewText(R.id.text, status);
Notification notification = new Notification();
if (Application.SDK_INT >= 14 && SettingsManager.eventsPersistent()) {
if (Build.VERSION.SDK_INT >= 14
&& SettingsManager.eventsPersistent()) {
// Ongoing icons are in the left side, so hide this one.
notification.icon = R.drawable.ic_placeholder;
notification.when = 0;
......@@ -429,7 +431,7 @@ public class NotificationManager implements OnInitializedListener,
persistentNotification.defaults = 0;
persistentNotification.sound = null;
persistentNotification.tickerText = null;
if (Application.SDK_INT >= 14 && SettingsManager.eventsPersistent()) {
if (Build.VERSION.SDK_INT >= 14 && SettingsManager.eventsPersistent()) {
// Ongoing icons are in the left side, so always use it.
persistentNotification.when = startTime;
if (messageNotifications.isEmpty()) {
......
......@@ -14,10 +14,6 @@
*/
package com.xabber.android.service;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
......@@ -36,9 +32,6 @@ import com.xabber.android.data.notification.NotificationManager;
*/
public class XabberService extends Service {
private Method startForeground;
private Method stopForeground;
private static XabberService instance;
public static XabberService getInstance() {
......@@ -50,27 +43,17 @@ public class XabberService extends Service {
super.onCreate();
instance = this;
LogManager.i(this, "onCreate");
// Try to get methods supported in API Level 5+
try {
startForeground = getClass().getMethod("startForeground",
new Class[] { int.class, Notification.class });
stopForeground = getClass().getMethod("stopForeground",
new Class[] { boolean.class });
} catch (NoSuchMethodException e) {
startForeground = stopForeground = null;
}
changeForeground();
}
public void changeForeground() {
if (SettingsManager.eventsPersistent()
&& Application.getInstance().isInitialized())
startForegroundWrapper(NotificationManager.getInstance()
startForeground(NotificationManager.PERSISTENT_NOTIFICATION_ID,
NotificationManager.getInstance()
.getPersistentNotification());
else
stopForegroundWrapper();
stopForeground(true);
}
@Override
......@@ -83,7 +66,7 @@ public class XabberService extends Service {
public void onDestroy() {
super.onDestroy();
LogManager.i(this, "onDestroy");
stopForegroundWrapper();
stopForeground(true);
Application.getInstance().onServiceDestroy();
}
......@@ -92,56 +75,6 @@ public class XabberService extends Service {
return null;
}
/**
* This is a wrapper around the new startForeground method, using the older
* APIs if it is not available.
*/
void startForegroundWrapper(Notification notification) {
if (startForeground != null) {
Object[] startForegroundArgs = new Object[] {
Integer.valueOf(NotificationManager.PERSISTENT_NOTIFICATION_ID),
notification };
try {
startForeground.invoke(this, startForegroundArgs);
} catch (InvocationTargetException e) {
// Should not happen.
LogManager.w(this, "Unable to invoke startForeground" + e);
} catch (IllegalAccessException e) {
// Should not happen.
LogManager.w(this, "Unable to invoke startForeground" + e);
}
} else {
setForeground(true);
try {
((android.app.NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE))
.notify(NotificationManager.PERSISTENT_NOTIFICATION_ID,
notification);
} catch (SecurityException e) {
}
}
}
/**
* This is a wrapper around the new stopForeground method, using the older
* APIs if it is not available.
*/
void stopForegroundWrapper() {
if (stopForeground != null) {
try {
stopForeground.invoke(this, new Object[] { Boolean.TRUE });
// We don't want to clear notification bar.
} catch (InvocationTargetException e) {
// Should not happen.
LogManager.w(this, "Unable to invoke stopForeground" + e);
} catch (IllegalAccessException e) {
// Should not happen.
LogManager.w(this, "Unable to invoke stopForeground" + e);
}
} else {
setForeground(false);
}
}
public static Intent createIntent(Context context) {
return new Intent(context, XabberService.class);
}
......
......@@ -209,4 +209,9 @@ public class DummyCursor implements Cursor {
return null;
}
@Override
public int getType(int arg0) {
return 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment