2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-09-02 23:25:10 +00:00

Apply coding style to whole project

Summary: Sorry for the huge diff, but all I did was applying Android Studio's 'Reformat Code' to all files. If everyone does that before submitting a patch we can keep it clean easily.

Test Plan: Compiles

Reviewers: #kde_connect, mtijink

Reviewed By: #kde_connect, mtijink

Subscribers: mtijink, sredman, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D10905
This commit is contained in:
Nicolas Fella
2018-03-03 16:06:52 +01:00
parent 0a08cd43cb
commit fa5a37c472
89 changed files with 1505 additions and 1345 deletions

View File

@@ -1,26 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:paddingLeft="25dp"
android:paddingTop="25dp"
android:paddingRight="25dp"
android:paddingBottom="25dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingBottom="25dp"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:paddingTop="25dp">
<ImageView <ImageView
android:id="@+id/album_art" android:id="@+id/album_art"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="25dp" android:layout_marginRight="25dp"
android:layout_weight="1"
android:scaleType="fitCenter" /> android:scaleType="fitCenter" />
<include <include
layout="@layout/mpris_control"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1" />
layout="@layout/mpris_control" />
</LinearLayout> </LinearLayout>

View File

@@ -2,105 +2,99 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/activity_vertical_margin" android:padding="@dimen/activity_vertical_margin"
tools:context="org.kde.kdeconnect.UserInterface.DeviceFragment" tools:context="org.kde.kdeconnect.UserInterface.DeviceFragment">
android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/pairing_buttons"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_gravity="center"
android:id="@+id/pairing_buttons" android:orientation="vertical">
android:layout_gravity="center">
<ProgressBar <ProgressBar
android:visibility="gone" android:id="@+id/pair_progress"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/pair_progress" /> android:visibility="gone" />
<TextView <TextView
android:id="@+id/pair_message"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dip" android:layout_marginBottom="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/device_not_paired" android:text="@string/device_not_paired"
android:id="@+id/pair_message" android:textAppearance="?android:attr/textAppearanceMedium" />
/>
<Button <Button
android:id="@+id/pair_button" android:id="@+id/pair_button"
android:background="@drawable/button_round"
android:textColor="@android:color/white"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/button_round"
android:text="@string/request_pairing" android:text="@string/request_pairing"
/> android:textColor="@android:color/white" />
<LinearLayout <LinearLayout
android:id="@+id/pair_request"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:layout_gravity="center"
android:id="@+id/pair_request" android:visibility="gone">
android:layout_gravity="center">
<Button <Button
android:background="@drawable/button_round"
android:textColor="@android:color/white"
android:layout_margin="4dip"
android:id="@+id/accept_button" android:id="@+id/accept_button"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/pairing_accept" android:layout_margin="4dip"
android:layout_weight="1" android:layout_weight="1"
/> android:background="@drawable/button_round"
android:text="@string/pairing_accept"
android:textColor="@android:color/white" />
<Button <Button
android:background="@drawable/button_round"
android:textColor="@android:color/white"
android:layout_margin="4dip"
android:id="@+id/reject_button" android:id="@+id/reject_button"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="4dip"
android:layout_weight="1"
android:background="@drawable/button_round"
android:text="@string/pairing_reject" android:text="@string/pairing_reject"
android:layout_weight="1" /> android:textColor="@android:color/white" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/not_reachable_message" android:id="@+id/not_reachable_message"
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:drawableStart="@drawable/ic_error_outline_black_48dp" android:layout_height="match_parent"
android:drawableLeft="@drawable/ic_error_outline_black_48dp" android:drawableLeft="@drawable/ic_error_outline_black_48dp"
android:drawablePadding="8dip" android:drawablePadding="8dip"
android:layout_height="match_parent" android:drawableStart="@drawable/ic_error_outline_black_48dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/unreachable_description" android:text="@string/unreachable_description"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/on_data_message" android:id="@+id/on_data_message"
android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:drawableStart="@drawable/ic_error_outline_black_48dp" android:layout_height="match_parent"
android:drawableLeft="@drawable/ic_error_outline_black_48dp" android:drawableLeft="@drawable/ic_error_outline_black_48dp"
android:drawablePadding="8dip" android:drawablePadding="8dip"
android:layout_height="match_parent" android:drawableStart="@drawable/ic_error_outline_black_48dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/on_data_message" android:text="@string/on_data_message"
android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceMedium"
/> android:visibility="gone" />
<ListView <ListView
android:id="@+id/buttons_list" android:id="@+id/buttons_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fillViewport="true" android:fillViewport="true"
tools:context=".DeviceActivity" tools:context=".DeviceActivity" />
/>
</LinearLayout> </LinearLayout>

View File

@@ -2,25 +2,22 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="org.kde.kdeconnect.Plugins.FindMyPhonePlugin.FindMyPhoneActivity"> tools:context="org.kde.kdeconnect.Plugins.FindMyPhonePlugin.FindMyPhoneActivity">
<Button <Button
android:id="@+id/bFindMyPhone"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:text="@string/findmyphone_found"
android:textSize="50dp"
android:id="@+id/bFindMyPhone"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> android:layout_alignParentStart="true"
android:text="@string/findmyphone_found"
android:textSize="50dp" />
</RelativeLayout> </RelativeLayout>

View File

@@ -1,11 +1,10 @@
<ListView xmlns:android="http://schemas.android.com/apk/res/android" <ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/listView1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:addStatesFromChildren="true"
android:orientation="vertical"
android:paddingLeft="16dip" android:paddingLeft="16dip"
android:paddingRight="16dip" android:paddingRight="16dip"
tools:context="org.kde.kdeconnect.UserInterface.MaterialActivity" tools:context="org.kde.kdeconnect.UserInterface.MaterialActivity"></ListView>
android:id="@+id/listView1"
android:addStatesFromChildren="true"
android:orientation="vertical">
</ListView>

View File

@@ -1,7 +1,6 @@
<android.support.v4.widget.DrawerLayout <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@@ -9,37 +8,35 @@
tools:context="org.kde.kdeconnect.UserInterface.MaterialActivity"> <!-- fitSystemWindows to make the drawer slide below the Lollipop transparent status bar --> tools:context="org.kde.kdeconnect.UserInterface.MaterialActivity"> <!-- fitSystemWindows to make the drawer slide below the Lollipop transparent status bar -->
<LinearLayout <LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:elevation="8dp" android:elevation="8dp"
android:background="?attr/colorPrimary" /> app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<FrameLayout <FrameLayout
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"></FrameLayout>
</FrameLayout>
</LinearLayout> </LinearLayout>
<android.support.design.widget.NavigationView <android.support.design.widget.NavigationView
android:id="@+id/navigation_drawer" android:id="@+id/navigation_drawer"
android:background="@drawable/state_list_drawer_background"
app:itemBackground="@drawable/state_list_drawer_background"
app:itemTextColor="@color/state_list_drawer_text"
app:itemIconTint="@color/state_list_drawer_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="start" android:layout_gravity="start"
android:background="@drawable/state_list_drawer_background"
app:headerLayout="@layout/nav_header" app:headerLayout="@layout/nav_header"
/> app:itemBackground="@drawable/state_list_drawer_background"
app:itemIconTint="@color/state_list_drawer_text"
app:itemTextColor="@color/state_list_drawer_text" />
</android.support.v4.widget.DrawerLayout> </android.support.v4.widget.DrawerLayout>

View File

@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:keepScreenOn="true" android:id="@+id/mousepad_view"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/mousepad_view"> android:keepScreenOn="true"
android:orientation="vertical">
<TextView <TextView
style="@android:style/TextAppearance.Medium"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/mousepad_info"
android:gravity="center"
style="@android:style/TextAppearance.Medium"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:padding="12dip" /> android:gravity="center"
android:padding="12dip"
android:text="@string/mousepad_info" />
<view <view
android:layout_width="wrap_content" android:id="@+id/keyListener"
android:layout_height="wrap_content"
class="org.kde.kdeconnect.Plugins.MousePadPlugin.KeyListenerView" class="org.kde.kdeconnect.Plugins.MousePadPlugin.KeyListenerView"
android:id="@+id/keyListener" /> android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout> </RelativeLayout>

View File

@@ -1,25 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:paddingLeft="25dp"
android:paddingTop="25dp"
android:paddingRight="25dp"
android:paddingBottom="25dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="25dp"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:paddingTop="25dp">
<ImageView <ImageView
android:id="@+id/album_art" android:id="@+id/album_art"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="4"
android:layout_marginBottom="25dp" android:layout_marginBottom="25dp"
android:layout_weight="4"
android:scaleType="fitCenter" /> android:scaleType="fitCenter" />
<include <include
layout="@layout/mpris_control"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content" />
layout="@layout/mpris_control" />
</LinearLayout> </LinearLayout>

View File

@@ -6,27 +6,26 @@
tools:context="org.kde.kdeconnect.Plugins.NotificationsPlugin.NotificationFilterActivity"> tools:context="org.kde.kdeconnect.Plugins.NotificationsPlugin.NotificationFilterActivity">
<TextView <TextView
android:text="@string/filter_apps_info" android:id="@+id/tFilter"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="5dp" android:paddingBottom="5dp"
android:id="@+id/tFilter"/> android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:text="@string/filter_apps_info" />
<ProgressBar <ProgressBar
android:layout_marginTop="64dip" android:id="@+id/spinner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:id="@+id/spinner" /> android:layout_marginTop="64dip" />
<ListView <ListView
android:id="@+id/lvFilterApps"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:id="@+id/lvFilterApps" android:visibility="gone" />
android:visibility="gone"
/>
</LinearLayout> </LinearLayout>

View File

@@ -5,13 +5,14 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ListView android:layout_width="match_parent" <ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:addStatesFromChildren="true"
android:orientation="vertical"
android:paddingLeft="16dip" android:paddingLeft="16dip"
android:paddingRight="16dip" android:paddingRight="16dip"
tools:context=".MainActivity" tools:context=".MainActivity" />
android:id="@+id/listView1"
android:addStatesFromChildren="true"
android:orientation="vertical"/>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>

View File

@@ -1,18 +1,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin">
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical">
<ListView <ListView
android:id="@android:id/list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:id="@android:id/list" android:layout_weight="1" />
android:layout_weight="1"
/>
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="fill_parent"
@@ -20,17 +19,17 @@
android:text="@string/custom_dev_list_help" /> android:text="@string/custom_dev_list_help" />
<EditText <EditText
android:id="@+id/ip_edittext"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:imeOptions="actionSend"
android:hint="@string/add_host_hint" android:hint="@string/add_host_hint"
android:id="@+id/ip_edittext"/> android:imeOptions="actionSend" />
<Button <Button
android:id="@android:id/button1"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/add_host" android:text="@string/add_host" />
android:id="@android:id/button1"/>
</LinearLayout> </LinearLayout>

View File

@@ -1,34 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:drawableBottom="@drawable/text_section_header" android:id="@+id/list_item_category_text"
android:textStyle="bold" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:textColor="?android:textColorSecondary" android:drawableBottom="@drawable/text_section_header"
android:drawablePadding="4dp" android:drawablePadding="4dp"
android:textSize="14sp"
android:textAllCaps="true"
android:paddingLeft="8dip" android:paddingLeft="8dip"
android:paddingRight="8dip" android:paddingRight="8dip"
android:layout_height="wrap_content" android:textAllCaps="true"
android:layout_width="match_parent" android:textColor="?android:textColorSecondary"
android:id="@+id/list_item_category_text" android:textSize="14sp"
/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/list_item_category_empty_placeholder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dip" android:layout_margin="10dip"
android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/device_list_empty" android:text="@string/device_list_empty"
android:id="@+id/list_item_category_empty_placeholder" android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_gravity="center" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>

View File

@@ -2,36 +2,37 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:baselineAligned="false"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="12dip"
android:paddingStart="12dip"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize"
android:paddingEnd="?android:attr/scrollbarSize"
android:background="@drawable/abc_list_selector_holo_dark" android:background="@drawable/abc_list_selector_holo_dark"
android:orientation="vertical"> android:baselineAligned="false"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="vertical"
android:paddingEnd="?android:attr/scrollbarSize"
android:paddingLeft="12dip"
android:paddingRight="?android:attr/scrollbarSize"
android:paddingStart="12dip">
<!-- We should use android:background="@android:/listChoiceBackgroundIndicator" <!-- We should use android:background="@android:/listChoiceBackgroundIndicator"
instead of abc_list_selector_holo_dark but that's only supported from API11 --> instead of abc_list_selector_holo_dark but that's only supported from API11 -->
<TextView android:id="@+id/list_item_entry_title" <TextView
android:id="@+id/list_item_entry_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:ellipsize="marquee" android:ellipsize="marquee"
android:fadingEdge="horizontal" android:fadingEdge="horizontal"
android:text="" /> android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView android:id="@+id/list_item_entry_summary" <TextView
android:id="@+id/list_item_entry_summary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true" android:singleLine="true"
android:visibility="gone" android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/darker_gray" android:textColor="@android:color/darker_gray"
android:text="" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>

View File

@@ -1,72 +1,75 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:baselineAligned="false"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="12dip" android:baselineAligned="false"
android:paddingStart="12dip"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize" android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:paddingEnd="?android:attr/scrollbarSize" android:paddingEnd="?android:attr/scrollbarSize"
android:orientation="horizontal"> android:paddingLeft="12dip"
android:paddingRight="?android:attr/scrollbarSize"
android:paddingStart="12dip">
<ImageView android:id="@+id/list_item_entry_icon" <ImageView
android:id="@+id/list_item_entry_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_device_laptop" android:layout_weight="0"
android:layout_weight="0" /> android:src="@drawable/ic_device_laptop" />
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content"> android:orientation="vertical">
<TextView android:id="@+id/list_item_entry_title" <TextView
android:id="@+id/list_item_entry_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="8dip" android:layout_marginLeft="8dip"
android:layout_marginStart="8dip" android:layout_marginStart="8dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee" android:ellipsize="marquee"
android:fadingEdge="horizontal" android:fadingEdge="horizontal"
android:text=""/> android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView android:id="@+id/list_item_entry_summary" <TextView
android:id="@+id/list_item_entry_summary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true" android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#CC2222" android:textColor="#CC2222"
android:visibility="gone" android:visibility="gone" />
android:text="" />
</LinearLayout> </LinearLayout>
<ProgressBar <ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_weight="0" android:layout_weight="0"
android:indeterminate="true" /> android:indeterminate="true" />
<Button <Button
android:layout_width="wrap_content"
android:minWidth="128dip"
android:layout_height="wrap_content"
android:text="@string/request_pairing"
android:padding="8dip"
android:background="@drawable/button_round"
android:textColor="#FFFFFF"
android:id="@+id/entry_pair_button" android:id="@+id/entry_pair_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" android:layout_weight="0"
android:nestedScrollingEnabled="false" /> android:background="@drawable/button_round"
android:minWidth="128dip"
android:nestedScrollingEnabled="false"
android:padding="8dip"
android:text="@string/request_pairing"
android:textColor="#FFFFFF" />
</LinearLayout> </LinearLayout>

View File

@@ -1,52 +1,54 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:baselineAligned="false"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="12dip"
android:paddingStart="12dip"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:paddingRight="?android:attr/scrollbarSize"
android:paddingEnd="?android:attr/scrollbarSize"
android:clickable="true"
android:background="@drawable/abc_list_selector_holo_dark" android:background="@drawable/abc_list_selector_holo_dark"
android:orientation="horizontal"> android:baselineAligned="false"
android:clickable="true"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:paddingEnd="?android:attr/scrollbarSize"
android:paddingLeft="12dip"
android:paddingRight="?android:attr/scrollbarSize"
android:paddingStart="12dip">
<ImageView android:id="@+id/list_item_entry_icon" <ImageView
android:id="@+id/list_item_entry_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_device_laptop" android:src="@drawable/ic_device_laptop" />
/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical" android:layout_height="wrap_content"
android:layout_height="wrap_content"> android:orientation="vertical">
<TextView android:id="@+id/list_item_entry_title" <TextView
android:id="@+id/list_item_entry_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="8dip" android:layout_marginLeft="8dip"
android:layout_marginStart="8dip" android:layout_marginStart="8dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee" android:ellipsize="marquee"
android:fadingEdge="horizontal" android:fadingEdge="horizontal"
android:text="" /> android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView android:id="@+id/list_item_entry_summary" <TextView
android:id="@+id/list_item_entry_summary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="8dip" android:layout_marginLeft="8dip"
android:layout_marginStart="8dip" android:layout_marginStart="8dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true" android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#CC2222" android:textColor="#CC2222"
android:visibility="gone" android:visibility="gone" />
android:text="" />
</LinearLayout> </LinearLayout>

View File

@@ -2,164 +2,155 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:id="@+id/mpris_control_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/mpris_control_view" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:layout_gravity="center"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/no_players"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" android:layout_gravity="center_horizontal"
android:text="@string/no_players_connected" android:text="@string/no_players_connected"
android:id="@+id/no_players" android:textAppearance="?android:attr/textAppearanceMedium" />
android:layout_gravity="center_horizontal" />
<Spinner <Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/player_spinner" android:id="@+id/player_spinner"
android:layout_gravity="center"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/now_playing_textview"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:gravity="center"
android:padding="8dip"
android:layout_gravity="center"
/>
<ImageButton
android:layout_width="fill_parent"
android:layout_height="75dp"
android:id="@+id/play_button"
android:src="@drawable/ic_play_black"
android:contentDescription="@string/mpris_play"
android:layout_gravity="center"
android:layout_weight="0"
android:clickable="false"
android:adjustViewBounds="false"
android:baselineAlignBottom="true" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="60dip"
android:layout_gravity="center"
>
<ImageButton
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/prev_button"
android:src="@drawable/ic_previous_black"
android:contentDescription="@string/mpris_previous"
android:layout_weight="0.25"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/rew_button"
android:src="@drawable/ic_rewind_black"
android:contentDescription="@string/mpris_rew"
android:layout_weight="0.25"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/ff_button"
android:src="@drawable/ic_fast_forward_black"
android:contentDescription="@string/mpris_ff"
android:layout_weight="0.25"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/next_button"
android:src="@drawable/ic_next_black"
android:contentDescription="@string/mpris_next"
android:layout_weight="0.25"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/progress_slider">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/progress_textview"
android:singleLine="true"
android:gravity="center"
android:padding="8dip"
android:layout_gravity="center"
android:text="00:00" />
<SeekBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/positionSeek"
android:layout_weight="1"
android:layout_gravity="center" /> android:layout_gravity="center" />
<TextView <TextView
android:id="@+id/now_playing_textview"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/time_textview"
android:singleLine="true"
android:gravity="center"
android:padding="8dip"
android:layout_gravity="center" android:layout_gravity="center"
android:text="00:00" /> android:ellipsize="marquee"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:padding="8dip"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageButton
android:id="@+id/play_button"
android:layout_width="fill_parent"
android:layout_height="75dp"
android:layout_gravity="center"
android:layout_weight="0"
android:adjustViewBounds="false"
android:baselineAlignBottom="true"
android:clickable="false"
android:contentDescription="@string/mpris_play"
android:src="@drawable/ic_play_black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dip"
android:layout_gravity="center"
android:orientation="horizontal">
<ImageButton
android:id="@+id/prev_button"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="0.25"
android:contentDescription="@string/mpris_previous"
android:src="@drawable/ic_previous_black" />
<ImageButton
android:id="@+id/rew_button"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="0.25"
android:contentDescription="@string/mpris_rew"
android:src="@drawable/ic_rewind_black" />
<ImageButton
android:id="@+id/ff_button"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="0.25"
android:contentDescription="@string/mpris_ff"
android:src="@drawable/ic_fast_forward_black" />
<ImageButton
android:id="@+id/next_button"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="0.25"
android:contentDescription="@string/mpris_next"
android:src="@drawable/ic_next_black" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:id="@+id/progress_slider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/volume_layout" android:orientation="horizontal">
<TextView
android:id="@+id/progress_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="8dip"> android:gravity="center"
android:padding="8dip"
android:singleLine="true"
android:text="00:00"
android:textAppearance="?android:attr/textAppearanceMedium" />
<SeekBar
android:id="@+id/positionSeek"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1" />
<TextView
android:id="@+id/time_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="8dip"
android:singleLine="true"
android:text="00:00"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:id="@+id/volume_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dip"
android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/imageView"
android:layout_width="30dip" android:layout_width="30dip"
android:layout_height="30dip" android:layout_height="30dip"
android:maxWidth="30dip"
android:layout_marginRight="10dip"
android:layout_marginEnd="10dip" android:layout_marginEnd="10dip"
android:id="@+id/imageView" android:layout_marginRight="10dip"
android:layout_weight="0" android:layout_weight="0"
android:contentDescription="@string/mpris_volume" android:contentDescription="@string/mpris_volume"
android:src="@drawable/ic_volume_black" android:maxWidth="30dip"
/> android:src="@drawable/ic_volume_black" />
<SeekBar <SeekBar
android:id="@+id/volume_seek"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/volume_seek"
android:layout_weight="1"
android:max="100"
android:layout_gravity="center" android:layout_gravity="center"
/> android:layout_weight="1"
android:max="100" />
</LinearLayout> </LinearLayout>

View File

@@ -3,36 +3,35 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="160dp" android:layout_height="160dp"
android:background="@drawable/drawer_header" android:background="@drawable/drawer_header"
android:orientation="vertical" android:gravity="bottom"
android:gravity="bottom"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/kdeconnect_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="KDE Connect" android:paddingEnd="48dp"
android:textColor="#FFF"
android:textStyle="bold"
android:id="@+id/kdeconnect_label"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="48dp"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingRight="48dp" android:text="KDE Connect"
android:paddingEnd="48dp" android:textColor="#FFF"
/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/device_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="My device"
android:id="@+id/device_name"
android:layout_marginBottom="0dp" android:layout_marginBottom="0dp"
android:textColor="#fff"
android:paddingBottom="16dp" android:paddingBottom="16dp"
android:paddingTop="4dp"
android:paddingRight="48dp"
android:paddingEnd="48dp" android:paddingEnd="48dp"
android:paddingLeft="16dp"
android:paddingRight="48dp"
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingLeft="16dp" /> android:paddingTop="4dp"
android:text="My device"
android:textColor="#fff" />
<!-- <!--
<ImageView <ImageView

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2006 The Android Open Source Project
<!-- Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@@ -20,16 +19,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight" android:background="?attr/selectableItemBackground"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingEnd="?android:attr/scrollbarSize" android:paddingEnd="?android:attr/scrollbarSize"
android:paddingRight="?android:attr/scrollbarSize"
android:paddingStart="12dip"
android:paddingLeft="12dip" android:paddingLeft="12dip"
android:background="?attr/selectableItemBackground"> android:paddingRight="?android:attr/scrollbarSize"
android:paddingStart="12dip">
<!-- Preference will place its actual preference widget here. --> <!-- Preference will place its actual preference widget here. -->
<LinearLayout android:id="@android:id/widget_frame" <LinearLayout
android:id="@android:id/widget_frame"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
@@ -38,40 +38,42 @@
<RelativeLayout <RelativeLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="12dip"
android:layout_marginLeft="12dip"
android:layout_marginEnd="4dip"
android:layout_marginRight="4dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip" android:layout_marginBottom="6dip"
android:layout_marginEnd="4dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="4dip"
android:layout_marginStart="12dip"
android:layout_marginTop="6dip"
android:layout_weight="1"> android:layout_weight="1">
<TextView android:id="@+android:id/title" <TextView
android:id="@+android:id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:ellipsize="marquee" android:ellipsize="marquee"
android:fadingEdge="horizontal" /> android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView android:id="@android:id/summary" <TextView
android:id="@android:id/summary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignStart="@android:id/title"
android:layout_alignLeft="@android:id/title" android:layout_alignLeft="@android:id/title"
android:layout_alignStart="@android:id/title"
android:layout_below="@android:id/title"
android:maxLines="3"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary" />
android:maxLines="3" />
</RelativeLayout> </RelativeLayout>
<ImageButton <ImageButton
android:id="@+id/settingsButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/settingsButton"
android:padding="8dip"
android:background="@drawable/abc_btn_borderless_material" android:background="@drawable/abc_btn_borderless_material"
android:padding="8dip"
android:src="@drawable/ic_action_settings_inverted" /> android:src="@drawable/ic_action_settings_inverted" />
</LinearLayout> </LinearLayout>

View File

@@ -2,16 +2,19 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:kdeconnect="http://schemas.android.com/apk/res-auto"> xmlns:kdeconnect="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_show_keyboard" <item
android:title="@string/show_keyboard" android:id="@+id/menu_show_keyboard"
android:icon="@drawable/ic_action_keyboard" android:icon="@drawable/ic_action_keyboard"
android:title="@string/show_keyboard"
kdeconnect:showAsAction="ifRoom" /> kdeconnect:showAsAction="ifRoom" />
<item android:id="@+id/menu_right_click" <item
android:id="@+id/menu_right_click"
android:title="@string/right_click" android:title="@string/right_click"
kdeconnect:showAsAction="never" /> kdeconnect:showAsAction="never" />
<item android:id="@+id/menu_middle_click" <item
android:id="@+id/menu_middle_click"
android:title="@string/middle_click" android:title="@string/middle_click"
kdeconnect:showAsAction="never" /> kdeconnect:showAsAction="never" />

View File

@@ -5,22 +5,19 @@
android:id="@+id/menu_refresh" android:id="@+id/menu_refresh"
android:icon="@drawable/ic_action_refresh" android:icon="@drawable/ic_action_refresh"
android:orderInCategory="200" android:orderInCategory="200"
kdeconnect:showAsAction="never"
android:title="@string/refresh" android:title="@string/refresh"
/> kdeconnect:showAsAction="never" />
<item <item
android:id="@+id/menu_rename" android:id="@+id/menu_rename"
android:orderInCategory="300" android:orderInCategory="300"
android:title="@string/device_rename_title" android:title="@string/device_rename_title"
kdeconnect:showAsAction="never" kdeconnect:showAsAction="never" />
/>
<item <item
android:id="@+id/menu_custom_device_list" android:id="@+id/menu_custom_device_list"
android:orderInCategory="900" android:orderInCategory="900"
android:title="@string/custom_device_list" android:title="@string/custom_device_list"
kdeconnect:showAsAction="never" kdeconnect:showAsAction="never" />
/>
</menu> </menu>

View File

@@ -5,8 +5,7 @@
android:id="@+id/menu_refresh" android:id="@+id/menu_refresh"
android:icon="@drawable/ic_action_refresh" android:icon="@drawable/ic_action_refresh"
android:orderInCategory="200" android:orderInCategory="200"
kdeconnect:showAsAction="never"
android:title="@string/refresh" android:title="@string/refresh"
/> kdeconnect:showAsAction="never" />
</menu> </menu>

View File

@@ -18,10 +18,8 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
</style> </style>
<style name="KdeConnectTheme" parent="KdeConnectThemeBase"> <style name="KdeConnectTheme" parent="KdeConnectThemeBase"></style>
</style>
<style name="KdeConnectTheme.NoActionBar" parent="KdeConnectThemeBase.NoActionBar"> <style name="KdeConnectTheme.NoActionBar" parent="KdeConnectThemeBase.NoActionBar"></style>
</style>
</resources> </resources>

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android"> <paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="." /> <external-path
name="external_files"
path="." />
</paths> </paths>

View File

@@ -32,7 +32,7 @@
<CheckBoxPreference <CheckBoxPreference
android:id="@+id/mousepad_scroll_preference" android:id="@+id/mousepad_scroll_preference"
android:defaultValue="false"
android:key="@string/mousepad_scroll_direction" android:key="@string/mousepad_scroll_direction"
android:title="@string/mousepad_scroll_direction_title" android:title="@string/mousepad_scroll_direction_title" />
android:defaultValue="false" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -5,18 +5,18 @@
<ListPreference <ListPreference
android:id="@+id/mpris_time_preference" android:id="@+id/mpris_time_preference"
android:key="@string/mpris_time_key" android:defaultValue="@string/mpris_time_default"
android:title="@string/mpris_time_settings_title"
android:summary="@string/mpris_time_settings_summary"
android:entries="@array/mpris_time_entries" android:entries="@array/mpris_time_entries"
android:entryValues="@array/mpris_time_entries_values" android:entryValues="@array/mpris_time_entries_values"
android:defaultValue="@string/mpris_time_default" /> android:key="@string/mpris_time_key"
android:summary="@string/mpris_time_settings_summary"
android:title="@string/mpris_time_settings_title" />
<CheckBoxPreference <CheckBoxPreference
android:id="@+id/mpris_notification_preference" android:id="@+id/mpris_notification_preference"
android:defaultValue="true"
android:key="@string/mpris_notification_key" android:key="@string/mpris_notification_key"
android:title="@string/mpris_notification_settings_title"
android:summary="@string/mpris_notification_settings_summary" android:summary="@string/mpris_notification_settings_summary"
android:defaultValue="true" /> android:title="@string/mpris_notification_settings_title" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -1,14 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Keyboard <Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:keyHeight="@dimen/key_height"
android:horizontalGap="0px" android:horizontalGap="0px"
android:keyHeight="@dimen/key_height"
android:verticalGap="0px"> android:verticalGap="0px">
<Row android:rowEdgeFlags="bottom"> <Row android:rowEdgeFlags="bottom">
<Key android:keyIcon="@drawable/ic_keyboard_hide_white_36dp" android:codes="0" android:keyWidth="20%" /> <Key
<Key android:keyIcon="@drawable/ic_action_settings" android:codes="1" android:keyWidth="40%"/> android:codes="0"
<Key android:keyIcon="@drawable/ic_action_keyboard" android:codes="2" android:keyWidth="40%"/> android:keyIcon="@drawable/ic_keyboard_hide_white_36dp"
<Key android:keyIcon="@drawable/ic_phonelink_white_36dp" android:codes="3" android:keyWidth="20%" />--> android:keyWidth="20%" />
<Key
android:codes="1"
android:keyIcon="@drawable/ic_action_settings"
android:keyWidth="40%" />
<Key
android:codes="2"
android:keyIcon="@drawable/ic_action_keyboard"
android:keyWidth="40%" />
<Key
android:codes="3"
android:keyIcon="@drawable/ic_phonelink_white_36dp"
android:keyWidth="20%" />-->
</Row> </Row>
</Keyboard> </Keyboard>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android" <input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:supportsSwitchingToNextInputMethod="true"> android:supportsSwitchingToNextInputMethod="true"></input-method>
</input-method>

View File

@@ -5,7 +5,7 @@
<CheckBoxPreference <CheckBoxPreference
android:id="@+id/remotekeyboard_editing_only" android:id="@+id/remotekeyboard_editing_only"
android:defaultValue="true"
android:key="@string/remotekeyboard_editing_only" android:key="@string/remotekeyboard_editing_only"
android:title="@string/remotekeyboard_editing_only_title" android:title="@string/remotekeyboard_editing_only_title" />
android:defaultValue="true" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -5,11 +5,11 @@
<CheckBoxPreference <CheckBoxPreference
android:id="@+id/share_destination_customize" android:id="@+id/share_destination_customize"
android:defaultValue="false"
android:key="share_destination_custom" android:key="share_destination_custom"
android:title="@string/share_destination_customize"
android:summaryOff="@string/share_destination_customize_summary_disabled" android:summaryOff="@string/share_destination_customize_summary_disabled"
android:summaryOn="@string/share_destination_customize_summary_enabled" android:summaryOn="@string/share_destination_customize_summary_enabled"
android:defaultValue="false" /> android:title="@string/share_destination_customize" />
<Preference <Preference
android:id="@+id/share_destination_folder_preference" android:id="@+id/share_destination_folder_preference"
@@ -18,9 +18,9 @@
<CheckBoxPreference <CheckBoxPreference
android:id="@+id/share_notification_preference" android:id="@+id/share_notification_preference"
android:defaultValue="true"
android:key="share_notification_preference" android:key="share_notification_preference"
android:title="@string/share_notification_preference"
android:summary="@string/share_notification_preference_summary" android:summary="@string/share_notification_preference_summary"
android:defaultValue="true" /> android:title="@string/share_notification_preference" />
</PreferenceScreen> </PreferenceScreen>

View File

@@ -2,9 +2,8 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference <EditTextPreference
android:dialogMessage="@string/telephony_pref_blocked_dialog_desc"
android:key="telephony_blocked_numbers" android:key="telephony_blocked_numbers"
android:title="@string/telephony_pref_blocked_title" android:title="@string/telephony_pref_blocked_title"></EditTextPreference>
android:dialogMessage="@string/telephony_pref_blocked_dialog_desc">
</EditTextPreference>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -36,7 +36,11 @@ import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.Helpers.SecurityHelpers.RsaHelper; import org.kde.kdeconnect.Helpers.SecurityHelpers.RsaHelper;
import org.kde.kdeconnect.NetworkPackage; import org.kde.kdeconnect.NetworkPackage;
import java.io.*; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.security.PublicKey; import java.security.PublicKey;
import java.util.UUID; import java.util.UUID;
@@ -102,7 +106,10 @@ public class BluetoothLink extends BaseLink {
np.setPayload(transferSocket.getInputStream(), np.getPayloadSize()); np.setPayload(transferSocket.getInputStream(), np.getPayloadSize());
} catch (Exception e) { } catch (Exception e) {
if (transferSocket != null) { if (transferSocket != null) {
try { transferSocket.close(); } catch(IOException ignored) { } try {
transferSocket.close();
} catch (IOException ignored) {
}
} }
Log.e("BluetoothLink/receiving", "Unable to get payload", e); Log.e("BluetoothLink/receiving", "Unable to get payload", e);
} }
@@ -219,7 +226,10 @@ public class BluetoothLink extends BaseLink {
callback.onFailure(e); callback.onFailure(e);
return false; return false;
} finally { } finally {
try { transferSocket.close(); } catch (IOException ignored) { } try {
transferSocket.close();
} catch (IOException ignored) {
}
} }
} }

View File

@@ -23,8 +23,8 @@ package org.kde.kdeconnect.Backends.BluetoothBackend;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.bluetooth.BluetoothServerSocket; import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -37,11 +37,14 @@ import org.kde.kdeconnect.Backends.BaseLinkProvider;
import org.kde.kdeconnect.Device; import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.NetworkPackage; import org.kde.kdeconnect.NetworkPackage;
import java.io.*; import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import java.util.Set; import java.util.Set;
import java.util.UUID;
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class BluetoothLinkProvider extends BaseLinkProvider { public class BluetoothLinkProvider extends BaseLinkProvider {

View File

@@ -21,6 +21,7 @@
package org.kde.kdeconnect.Backends.BluetoothBackend; package org.kde.kdeconnect.Backends.BluetoothBackend;
import android.util.Log; import android.util.Log;
import org.kde.kdeconnect.Backends.BasePairingHandler; import org.kde.kdeconnect.Backends.BasePairingHandler;
import org.kde.kdeconnect.Device; import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.NetworkPackage; import org.kde.kdeconnect.NetworkPackage;
@@ -32,6 +33,7 @@ import java.util.TimerTask;
public class BluetoothPairingHandler extends BasePairingHandler { public class BluetoothPairingHandler extends BasePairingHandler {
Timer mPairingTimer; Timer mPairingTimer;
public BluetoothPairingHandler(Device device, final PairingHandlerCallback callback) { public BluetoothPairingHandler(Device device, final PairingHandlerCallback callback) {
super(device, callback); super(device, callback);

View File

@@ -113,14 +113,17 @@ public class BackgroundService extends Service {
public void incomingRequest() { public void incomingRequest() {
onDeviceListChanged(); onDeviceListChanged();
} }
@Override @Override
public void pairingSuccessful() { public void pairingSuccessful() {
onDeviceListChanged(); onDeviceListChanged();
} }
@Override @Override
public void pairingFailed(String error) { public void pairingFailed(String error) {
onDeviceListChanged(); onDeviceListChanged();
} }
@Override @Override
public void unpaired() { public void unpaired() {
onDeviceListChanged(); onDeviceListChanged();
@@ -192,8 +195,7 @@ public class BackgroundService extends Service {
device = new Device(BackgroundService.this, identityPackage, link); device = new Device(BackgroundService.this, identityPackage, link);
if (device.isPaired() || device.isPairRequested() || device.isPairRequestedByPeer() if (device.isPaired() || device.isPairRequested() || device.isPairRequestedByPeer()
|| link.linkShouldBeKeptAlive() || link.linkShouldBeKeptAlive()
||!discoveryModeAcquisitions.isEmpty() ) || !discoveryModeAcquisitions.isEmpty()) {
{
devices.put(deviceId, device); devices.put(deviceId, device);
device.addPairingCallback(devicePairingCallback); device.addPairingCallback(devicePairingCallback);
} else { } else {
@@ -247,6 +249,7 @@ public class BackgroundService extends Service {
public void addDeviceListChangedCallback(String key, DeviceListChangedCallback callback) { public void addDeviceListChangedCallback(String key, DeviceListChangedCallback callback) {
deviceListChangedCallbacks.put(key, callback); deviceListChangedCallbacks.put(key, callback);
} }
public void removeDeviceListChangedCallback(String key) { public void removeDeviceListChangedCallback(String key) {
deviceListChangedCallbacks.remove(key); deviceListChangedCallbacks.remove(key);
} }

View File

@@ -110,19 +110,26 @@ public class Device implements BaseLink.PackageReceiver {
if ("phone".equals(s)) return Phone; if ("phone".equals(s)) return Phone;
return Computer; //Default return Computer; //Default
} }
public String toString() { public String toString() {
switch (this) { switch (this) {
case Tablet: return "tablet"; case Tablet:
case Phone: return "phone"; return "tablet";
default: return "desktop"; case Phone:
return "phone";
default:
return "desktop";
} }
} }
} }
public interface PairingCallback { public interface PairingCallback {
void incomingRequest(); void incomingRequest();
void pairingSuccessful(); void pairingSuccessful();
void pairingFailed(String error); void pairingFailed(String error);
void unpaired(); void unpaired();
} }
@@ -179,13 +186,17 @@ public class Device implements BaseLink.PackageReceiver {
return name != null ? name : context.getString(R.string.unknown_device); return name != null ? name : context.getString(R.string.unknown_device);
} }
public Drawable getIcon() public Drawable getIcon() {
{
int drawableId; int drawableId;
switch (deviceType) { switch (deviceType) {
case Phone: drawableId = R.drawable.ic_device_phone; break; case Phone:
case Tablet: drawableId = R.drawable.ic_device_tablet; break; drawableId = R.drawable.ic_device_phone;
default: drawableId = R.drawable.ic_device_laptop; break;
case Tablet:
drawableId = R.drawable.ic_device_tablet;
break;
default:
drawableId = R.drawable.ic_device_laptop;
} }
return ContextCompat.getDrawable(context, drawableId); return ContextCompat.getDrawable(context, drawableId);
} }
@@ -208,8 +219,6 @@ public class Device implements BaseLink.PackageReceiver {
} }
// //
// Pairing-related functions // Pairing-related functions
// //
@@ -600,13 +609,18 @@ public class Device implements BaseLink.PackageReceiver {
public static abstract class SendPackageStatusCallback { public static abstract class SendPackageStatusCallback {
public abstract void onSuccess(); public abstract void onSuccess();
public abstract void onFailure(Throwable e); public abstract void onFailure(Throwable e);
public void onProgressChanged(int percent) { }
public void onProgressChanged(int percent) {
}
} }
private SendPackageStatusCallback defaultCallback = new SendPackageStatusCallback() { private SendPackageStatusCallback defaultCallback = new SendPackageStatusCallback() {
@Override @Override
public void onSuccess() { } public void onSuccess() {
}
@Override @Override
public void onFailure(Throwable e) { public void onFailure(Throwable e) {
if (e != null) { if (e != null) {
@@ -651,7 +665,8 @@ public class Device implements BaseLink.PackageReceiver {
boolean success = false; boolean success = false;
//Make a copy to avoid concurrent modification exception if the original list changes //Make a copy to avoid concurrent modification exception if the original list changes
for (final BaseLink link : links) { for (final BaseLink link : links) {
if (link == null) continue; //Since we made a copy, maybe somebody destroyed the link in the meanwhile if (link == null)
continue; //Since we made a copy, maybe somebody destroyed the link in the meanwhile
if (useEncryption) { if (useEncryption) {
success = link.sendPackageEncrypted(np, callback, publicKey); success = link.sendPackageEncrypted(np, callback, publicKey);
} else { } else {
@@ -896,6 +911,7 @@ public class Device implements BaseLink.PackageReceiver {
if (protocolVersion >= 6) return; if (protocolVersion >= 6) return;
np.mType = np.getType().replace(".request", ""); np.mType = np.getType().replace(".request", "");
} }
public String hackToMakeRetrocompatiblePacketTypes(String type) { public String hackToMakeRetrocompatiblePacketTypes(String type) {
if (protocolVersion >= 6) return type; if (protocolVersion >= 6) return type;
return type.replace(".request", ""); return type.replace(".request", "");

View File

@@ -68,5 +68,4 @@ public class AppsHelper {
} }
} }

View File

@@ -75,7 +75,10 @@ public class ContactsHelper {
contactInfo.put("photoID", cursor.getString(nameIndex)); contactInfo.put("photoID", cursor.getString(nameIndex));
} }
try { cursor.close(); } catch (Exception e) {} try {
cursor.close();
} catch (Exception e) {
}
if (!contactInfo.isEmpty()) { if (!contactInfo.isEmpty()) {
return contactInfo; return contactInfo;
@@ -107,8 +110,16 @@ public class ContactsHelper {
Log.e("ContactsHelper", ex.toString()); Log.e("ContactsHelper", ex.toString());
return ""; return "";
} finally { } finally {
try { input.close(); } catch(Exception ignored) { }; try {
try { output.close(); } catch(Exception ignored) { }; input.close();
} catch (Exception ignored) {
}
;
try {
output.close();
} catch (Exception ignored) {
}
;
} }
} }
} }

View File

@@ -39,6 +39,7 @@ public class DeviceHelper {
//Converted to java using: //Converted to java using:
//cat android_models.properties | awk -F'=' '{sub(/ *$/, "", $1)} sub(/^ */, "", $2) { if ($2 != "") print "humanReadableNames.put(\""$1"\",\"" $2 "\");"}' | sed -e 's/\\ /_/g' //cat android_models.properties | awk -F'=' '{sub(/ *$/, "", $1)} sub(/^ */, "", $2) { if ($2 != "") print "humanReadableNames.put(\""$1"\",\"" $2 "\");"}' | sed -e 's/\\ /_/g'
private final static HashMap<String, String> humanReadableNames = new HashMap<>(); private final static HashMap<String, String> humanReadableNames = new HashMap<>();
static { static {
humanReadableNames.put("5860E", "Coolpad Quattro 4G"); humanReadableNames.put("5860E", "Coolpad Quattro 4G");
humanReadableNames.put("831C", "HTC One M8"); humanReadableNames.put("831C", "HTC One M8");

View File

@@ -36,6 +36,7 @@ public class FilesHelper {
int dot = filename.lastIndexOf("."); int dot = filename.lastIndexOf(".");
return (dot < 0) ? filename : filename.substring(0, dot); return (dot < 0) ? filename : filename.substring(0, dot);
} }
public static String getMimeTypeFromFile(String file) { public static String getMimeTypeFromFile(String file) {
String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(getFileExt(file)); String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(getFileExt(file));
if (mime == null) mime = "*/*"; if (mime == null) mime = "*/*";
@@ -57,6 +58,7 @@ public class FilesHelper {
} }
//Following code from http://activemq.apache.org/maven/5.7.0/kahadb/apidocs/src-html/org/apache/kahadb/util/IOHelper.html //Following code from http://activemq.apache.org/maven/5.7.0/kahadb/apidocs/src-html/org/apache/kahadb/util/IOHelper.html
/** /**
* Converts any string into a string that is safe to use as a file name. * Converts any string into a string that is safe to use as a file name.
* The result will only include ascii characters and numbers, and the "-","_", and "." characters. * The result will only include ascii characters and numbers, and the "-","_", and "." characters.
@@ -82,9 +84,11 @@ public class FilesHelper {
} }
return result; return result;
} }
public static String toFileSystemSafeName(String name, boolean dirSeparators) { public static String toFileSystemSafeName(String name, boolean dirSeparators) {
return toFileSystemSafeName(name, dirSeparators, 255); return toFileSystemSafeName(name, dirSeparators, 255);
} }
public static String toFileSystemSafeName(String name) { public static String toFileSystemSafeName(String name) {
return toFileSystemSafeName(name, true, 255); return toFileSystemSafeName(name, true, 255);
} }

View File

@@ -32,7 +32,8 @@ public class NetworkHelper {
continue; continue;
} }
//Log.e(info.getTypeName(),""+info.isAvailable()); //Log.e(info.getTypeName(),""+info.isAvailable());
if (info.isAvailable()) return false; //We are connected to at least one non-mobile network if (info.isAvailable())
return false; //We are connected to at least one non-mobile network
} }
if (mobile) { //We suspect we are on a mobile net if (mobile) { //We suspect we are on a mobile net
try { try {

View File

@@ -76,8 +76,8 @@ public class RsaHelper {
try { try {
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
byte[] publicKeyBytes = Base64.decode(settings.getString("publicKey", ""), 0); byte[] publicKeyBytes = Base64.decode(settings.getString("publicKey", ""), 0);
return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes)); return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(publicKeyBytes));
} catch (Exception e) { } catch (Exception e) {
throw e; throw e;
} }

View File

@@ -27,8 +27,7 @@ import android.net.ConnectivityManager;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.util.Log; import android.util.Log;
public class KdeConnectBroadcastReceiver extends BroadcastReceiver public class KdeConnectBroadcastReceiver extends BroadcastReceiver {
{
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
@@ -88,5 +87,4 @@ public class KdeConnectBroadcastReceiver extends BroadcastReceiver
} }
} }

View File

@@ -79,22 +79,85 @@ public class NetworkPackage {
} }
//Most commons getters and setters defined for convenience //Most commons getters and setters defined for convenience
public String getString(String key) { return mBody.optString(key,""); } public String getString(String key) {
public String getString(String key, String defaultValue) { return mBody.optString(key,defaultValue); } return mBody.optString(key, "");
public void set(String key, String value) { if (value == null) return; try { mBody.put(key,value); } catch(Exception e) { } } }
public int getInt(String key) { return mBody.optInt(key,-1); }
public int getInt(String key, int defaultValue) { return mBody.optInt(key,defaultValue); } public String getString(String key, String defaultValue) {
public long getLong(String key) { return mBody.optLong(key,-1); } return mBody.optString(key, defaultValue);
public long getLong(String key,long defaultValue) { return mBody.optLong(key,defaultValue); } }
public void set(String key, int value) { try { mBody.put(key,value); } catch(Exception e) { } }
public boolean getBoolean(String key) { return mBody.optBoolean(key,false); } public void set(String key, String value) {
public boolean getBoolean(String key, boolean defaultValue) { return mBody.optBoolean(key,defaultValue); } if (value == null) return;
public void set(String key, boolean value) { try { mBody.put(key,value); } catch(Exception e) { } } try {
public double getDouble(String key) { return mBody.optDouble(key,Double.NaN); } mBody.put(key, value);
public double getDouble(String key, double defaultValue) { return mBody.optDouble(key,defaultValue); } } catch (Exception e) {
public void set(String key, double value) { try { mBody.put(key,value); } catch(Exception e) { } } }
public JSONArray getJSONArray(String key) { return mBody.optJSONArray(key); } }
public void set(String key, JSONArray value) { try { mBody.put(key,value); } catch(Exception e) { } }
public int getInt(String key) {
return mBody.optInt(key, -1);
}
public int getInt(String key, int defaultValue) {
return mBody.optInt(key, defaultValue);
}
public long getLong(String key) {
return mBody.optLong(key, -1);
}
public long getLong(String key, long defaultValue) {
return mBody.optLong(key, defaultValue);
}
public void set(String key, int value) {
try {
mBody.put(key, value);
} catch (Exception e) {
}
}
public boolean getBoolean(String key) {
return mBody.optBoolean(key, false);
}
public boolean getBoolean(String key, boolean defaultValue) {
return mBody.optBoolean(key, defaultValue);
}
public void set(String key, boolean value) {
try {
mBody.put(key, value);
} catch (Exception e) {
}
}
public double getDouble(String key) {
return mBody.optDouble(key, Double.NaN);
}
public double getDouble(String key, double defaultValue) {
return mBody.optDouble(key, defaultValue);
}
public void set(String key, double value) {
try {
mBody.put(key, value);
} catch (Exception e) {
}
}
public JSONArray getJSONArray(String key) {
return mBody.optJSONArray(key);
}
public void set(String key, JSONArray value) {
try {
mBody.put(key, value);
} catch (Exception e) {
}
}
public Set<String> getStringSet(String key) { public Set<String> getStringSet(String key) {
JSONArray jsonArray = mBody.optJSONArray(key); JSONArray jsonArray = mBody.optJSONArray(key);
@@ -105,14 +168,17 @@ public class NetworkPackage {
try { try {
String str = jsonArray.getString(i); String str = jsonArray.getString(i);
list.add(str); list.add(str);
} catch(Exception e) { } } catch (Exception e) {
}
} }
return list; return list;
} }
public Set<String> getStringSet(String key, Set<String> defaultValue) { public Set<String> getStringSet(String key, Set<String> defaultValue) {
if (mBody.has(key)) return getStringSet(key); if (mBody.has(key)) return getStringSet(key);
else return defaultValue; else return defaultValue;
} }
public void set(String key, Set<String> value) { public void set(String key, Set<String> value) {
try { try {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
@@ -120,7 +186,8 @@ public class NetworkPackage {
jsonArray.put(str); jsonArray.put(str);
} }
mBody.put(key, jsonArray); mBody.put(key, jsonArray);
} catch(Exception e) { } } catch (Exception e) {
}
} }
public List<String> getStringList(String key) { public List<String> getStringList(String key) {
@@ -132,14 +199,17 @@ public class NetworkPackage {
try { try {
String str = jsonArray.getString(i); String str = jsonArray.getString(i);
list.add(str); list.add(str);
} catch(Exception e) { } } catch (Exception e) {
}
} }
return list; return list;
} }
public List<String> getStringList(String key, List<String> defaultValue) { public List<String> getStringList(String key, List<String> defaultValue) {
if (mBody.has(key)) return getStringList(key); if (mBody.has(key)) return getStringList(key);
else return defaultValue; else return defaultValue;
} }
public void set(String key, List<String> value) { public void set(String key, List<String> value) {
try { try {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
@@ -147,9 +217,13 @@ public class NetworkPackage {
jsonArray.put(str); jsonArray.put(str);
} }
mBody.put(key, jsonArray); mBody.put(key, jsonArray);
} catch(Exception e) { } } catch (Exception e) {
}
}
public boolean has(String key) {
return mBody.has(key);
} }
public boolean has(String key) { return mBody.has(key); }
public String serialize() throws JSONException { public String serialize() throws JSONException {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();

View File

@@ -36,6 +36,7 @@ public class ClipboardListener {
public interface ClipboardObserver { public interface ClipboardObserver {
void clipboardChanged(String content); void clipboardChanged(String content);
} }
private HashSet<ClipboardObserver> observers = new HashSet<>(); private HashSet<ClipboardObserver> observers = new HashSet<>();
private final Context context; private final Context context;
@@ -45,6 +46,7 @@ public class ClipboardListener {
private ClipboardManager.OnPrimaryClipChangedListener listener; private ClipboardManager.OnPrimaryClipChangedListener listener;
private static ClipboardListener _instance = null; private static ClipboardListener _instance = null;
public static ClipboardListener instance(Context context) { public static ClipboardListener instance(Context context) {
if (_instance == null) { if (_instance == null) {
_instance = new ClipboardListener(context); _instance = new ClipboardListener(context);
@@ -105,9 +107,7 @@ public class ClipboardListener {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(text); clipboard.setText(text);
} } else {
else
{
cm.setText(text); cm.setText(text);
} }
} }

View File

@@ -10,7 +10,8 @@ public class KeyInputConnection extends BaseInputConnection {
view = targetView; view = targetView;
} }
@Override public boolean commitText(CharSequence text, int newCursorPosition) { @Override
public boolean commitText(CharSequence text, int newCursorPosition) {
view.sendChars(text); view.sendChars(text);
return true; return true;
} }

View File

@@ -38,11 +38,13 @@ public class KeyListenerView extends View {
private String deviceId; private String deviceId;
private static SparseIntArray SpecialKeysMap = new SparseIntArray(); private static SparseIntArray SpecialKeysMap = new SparseIntArray();
static { static {
int i = 0; int i = 0;
SpecialKeysMap.put(KeyEvent.KEYCODE_DEL, ++i); // 1 SpecialKeysMap.put(KeyEvent.KEYCODE_DEL, ++i); // 1
SpecialKeysMap.put(KeyEvent.KEYCODE_TAB, ++i); // 2 SpecialKeysMap.put(KeyEvent.KEYCODE_TAB, ++i); // 2
SpecialKeysMap.put(KeyEvent.KEYCODE_ENTER, 12); ++i; // 3 is not used, return is 12 instead SpecialKeysMap.put(KeyEvent.KEYCODE_ENTER, 12);
++i; // 3 is not used, return is 12 instead
SpecialKeysMap.put(KeyEvent.KEYCODE_DPAD_LEFT, ++i); // 4 SpecialKeysMap.put(KeyEvent.KEYCODE_DPAD_LEFT, ++i); // 4
SpecialKeysMap.put(KeyEvent.KEYCODE_DPAD_UP, ++i); // 5 SpecialKeysMap.put(KeyEvent.KEYCODE_DPAD_UP, ++i); // 5
SpecialKeysMap.put(KeyEvent.KEYCODE_DPAD_RIGHT, ++i); // 6 SpecialKeysMap.put(KeyEvent.KEYCODE_DPAD_RIGHT, ++i); // 6

View File

@@ -62,11 +62,15 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
enum ClickType { enum ClickType {
RIGHT, MIDDLE, NONE; RIGHT, MIDDLE, NONE;
static ClickType fromString(String s) { static ClickType fromString(String s) {
switch (s) { switch (s) {
case "right": return RIGHT; case "right":
case "middle": return MIDDLE; return RIGHT;
default: return NONE; case "middle":
return MIDDLE;
default:
return NONE;
} }
} }
} }
@@ -240,8 +244,7 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
} }
@Override @Override
public boolean onGenericMotionEvent(MotionEvent e) public boolean onGenericMotionEvent(MotionEvent e) {
{
if (android.os.Build.VERSION.SDK_INT >= 12) { // MotionEvent.getAxisValue is >= 12 if (android.os.Build.VERSION.SDK_INT >= 12) { // MotionEvent.getAxisValue is >= 12
if (e.getAction() == MotionEvent.ACTION_SCROLL) { if (e.getAction() == MotionEvent.ACTION_SCROLL) {
final float distanceY = e.getAxisValue(MotionEvent.AXIS_VSCROLL); final float distanceY = e.getAxisValue(MotionEvent.AXIS_VSCROLL);
@@ -268,8 +271,7 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
isScrolling = true; isScrolling = true;
accumulatedDistanceY += distanceY; accumulatedDistanceY += distanceY;
if (accumulatedDistanceY > MinDistanceToSendScroll || accumulatedDistanceY < -MinDistanceToSendScroll) if (accumulatedDistanceY > MinDistanceToSendScroll || accumulatedDistanceY < -MinDistanceToSendScroll) {
{
sendScroll(scrollDirection * accumulatedDistanceY); sendScroll(scrollDirection * accumulatedDistanceY);
accumulatedDistanceY = 0; accumulatedDistanceY = 0;

View File

@@ -78,6 +78,7 @@ public final class AlbumArtCache {
/** /**
* Initializes the disk cache. Needs to be called at least once before trying to use the cache * Initializes the disk cache. Needs to be called at least once before trying to use the cache
*
* @param context The context * @param context The context
*/ */
public static void initializeDiskCache(Context context) { public static void initializeDiskCache(Context context) {
@@ -99,6 +100,7 @@ public final class AlbumArtCache {
/** /**
* Registers a mpris plugin, such that it gets notified of fetched album art * Registers a mpris plugin, such that it gets notified of fetched album art
*
* @param mpris The mpris plugin * @param mpris The mpris plugin
*/ */
public static void registerPlugin(MprisPlugin mpris) { public static void registerPlugin(MprisPlugin mpris) {
@@ -107,6 +109,7 @@ public final class AlbumArtCache {
/** /**
* Deregister a mpris plugin * Deregister a mpris plugin
*
* @param mpris The mpris plugin * @param mpris The mpris plugin
*/ */
public static void deregisterPlugin(MprisPlugin mpris) { public static void deregisterPlugin(MprisPlugin mpris) {
@@ -192,6 +195,7 @@ public final class AlbumArtCache {
/** /**
* Fetches an album art url and puts it in the cache * Fetches an album art url and puts it in the cache
*
* @param url The url * @param url The url
*/ */
private static void fetchUrl(URL url) { private static void fetchUrl(URL url) {
@@ -233,6 +237,7 @@ public final class AlbumArtCache {
/** /**
* Opens the http(s) connection * Opens the http(s) connection
*
* @return True if succeeded * @return True if succeeded
* @throws IOException * @throws IOException
*/ */
@@ -324,7 +329,9 @@ public final class AlbumArtCache {
--numFetching; --numFetching;
initiateFetch(); initiateFetch();
} }
}; }
;
/** /**
* Does the actual fetching and makes sure only not too many fetches are running at the same time * Does the actual fetching and makes sure only not too many fetches are running at the same time
@@ -357,6 +364,7 @@ public final class AlbumArtCache {
/** /**
* The disk cache requires mostly alphanumeric characters, and at most 64 characters. * The disk cache requires mostly alphanumeric characters, and at most 64 characters.
* So hash the url to get a valid key * So hash the url to get a valid key
*
* @param url The url * @param url The url
* @return A valid disk cache key * @return A valid disk cache key
*/ */
@@ -378,6 +386,7 @@ public final class AlbumArtCache {
/** /**
* Transfer an asked-for album art payload to the disk cache. * Transfer an asked-for album art payload to the disk cache.
*
* @param albumUrl The url of the album art (should be a file:// url) * @param albumUrl The url of the album art (should be a file:// url)
* @param payload The payload input stream * @param payload The payload input stream
*/ */

View File

@@ -69,10 +69,12 @@ public class MprisActivity extends AppCompatActivity {
} }
text.append(minutes).append(':'); text.append(minutes).append(':');
int seconds = (length % 60); int seconds = (length % 60);
if(seconds < 10) text.append('0'); // needed to show length properly (eg 4:05 instead of 4:5) if (seconds < 10)
text.append('0'); // needed to show length properly (eg 4:05 instead of 4:5)
text.append(seconds); text.append(seconds);
return text.toString(); return text.toString();
} }
protected void connectToPlugin(final String targetPlayerName) { protected void connectToPlugin(final String targetPlayerName) {
BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() { BackgroundService.RunCommand(this, new BackgroundService.InstanceCallback() {

View File

@@ -42,7 +42,7 @@ import java.util.HashSet;
/** /**
* Controls the mpris media control notification * Controls the mpris media control notification
* * <p>
* There are two parts to this: * There are two parts to this:
* - The notification (with buttons etc.) * - The notification (with buttons etc.)
* - The media session (via MediaSessionCompat; for lock screen control on * - The media session (via MediaSessionCompat; for lock screen control on
@@ -53,9 +53,11 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
public final static String MPRIS_MEDIA_SESSION_TAG = "org.kde.kdeconnect_tp.media_session"; public final static String MPRIS_MEDIA_SESSION_TAG = "org.kde.kdeconnect_tp.media_session";
private static MprisMediaSession instance = new MprisMediaSession(); private static MprisMediaSession instance = new MprisMediaSession();
public static MprisMediaSession getInstance() { public static MprisMediaSession getInstance() {
return instance; return instance;
} }
public static MediaSessionCompat getMediaSession() { public static MediaSessionCompat getMediaSession() {
return instance.mediaSession; return instance.mediaSession;
} }
@@ -106,8 +108,9 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
/** /**
* Called by the mpris plugin when it wants media control notifications for its device * Called by the mpris plugin when it wants media control notifications for its device
* * <p>
* Can be called multiple times, once for each device * Can be called multiple times, once for each device
*
* @param _context The context * @param _context The context
* @param mpris The mpris plugin * @param mpris The mpris plugin
* @param device The device id * @param device The device id
@@ -128,8 +131,9 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
/** /**
* Called when a device disconnects/does not want notifications anymore * Called when a device disconnects/does not want notifications anymore
* * <p>
* Can be called multiple times, once for each device * Can be called multiple times, once for each device
*
* @param mpris The mpris plugin * @param mpris The mpris plugin
* @param device The device id * @param device The device id
*/ */
@@ -147,9 +151,10 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
/** /**
* Updates which device+player we're going to use in the notification * Updates which device+player we're going to use in the notification
* * <p>
* Prefers playing devices/mpris players, but tries to keep displaying the same * Prefers playing devices/mpris players, but tries to keep displaying the same
* player and device, while possible. * player and device, while possible.
*
* @param service The background service * @param service The background service
*/ */
private void updateCurrentPlayer(BackgroundService service) { private void updateCurrentPlayer(BackgroundService service) {

View File

@@ -92,7 +92,9 @@ public class MprisPlugin extends Plugin {
return volume; return volume;
} }
public long getLength(){ return length; } public long getLength() {
return length;
}
public boolean isPlaying() { public boolean isPlaying() {
return playing; return playing;
@@ -124,6 +126,7 @@ public class MprisPlugin extends Plugin {
/** /**
* Returns the album art (if available). Note that this can return null even if hasAlbumArt() returns true. * Returns the album art (if available). Note that this can return null even if hasAlbumArt() returns true.
*
* @return The album art, or null if not available * @return The album art, or null if not available
*/ */
public Bitmap getAlbumArt() { public Bitmap getAlbumArt() {
@@ -288,7 +291,9 @@ public class MprisPlugin extends Plugin {
//Turn the url into canonical form (and check its validity) //Turn the url into canonical form (and check its validity)
URL newAlbumArtUrl = new URL(newAlbumArtUrlstring); URL newAlbumArtUrl = new URL(newAlbumArtUrlstring);
playerStatus.albumArtUrl = newAlbumArtUrl.toString(); playerStatus.albumArtUrl = newAlbumArtUrl.toString();
} catch (MalformedURLException ignored) {} } catch (MalformedURLException ignored) {
}
for (String key : playerStatusUpdated.keySet()) { for (String key : playerStatusUpdated.keySet()) {
try { try {
playerStatusUpdated.get(key).dispatchMessage(new Message()); playerStatusUpdated.get(key).dispatchMessage(new Message());
@@ -395,6 +400,7 @@ public class MprisPlugin extends Plugin {
/** /**
* Returns a playing mpris player, if any exist * Returns a playing mpris player, if any exist
*
* @return null if no players are playing, a playing player otherwise * @return null if no players are playing, a playing player otherwise
*/ */
public MprisPlayer getPlayingPlayer() { public MprisPlayer getPlayingPlayer() {

View File

@@ -75,6 +75,7 @@ public abstract class Plugin {
public String getPluginKey() { public String getPluginKey() {
return getPluginKey(this.getClass()); return getPluginKey(this.getClass());
} }
public static String getPluginKey(Class<? extends Plugin> p) { public static String getPluginKey(Class<? extends Plugin> p) {
return p.getSimpleName(); return p.getSimpleName();
} }
@@ -146,7 +147,8 @@ public abstract class Plugin {
/** /**
* Implement here what your plugin should do when clicked * Implement here what your plugin should do when clicked
*/ */
public void startMainActivity(Activity parentActivity) { } public void startMainActivity(Activity parentActivity) {
}
/** /**
* Return true if the entry for this app should appear in the context menu instead of the main view * Return true if the entry for this app should appear in the context menu instead of the main view
@@ -167,14 +169,17 @@ public abstract class Plugin {
* Finish any ongoing operations, remove listeners... so * Finish any ongoing operations, remove listeners... so
* this object could be garbage collected. * this object could be garbage collected.
*/ */
public void onDestroy() { } public void onDestroy() {
}
/** /**
* Called when a plugin receives a package. By convention we return true * Called when a plugin receives a package. By convention we return true
* when we have done something in response to the package or false * when we have done something in response to the package or false
* otherwise, even though that value is unused as of now. * otherwise, even though that value is unused as of now.
*/ */
public boolean onPackageReceived(NetworkPackage np) { return false; } public boolean onPackageReceived(NetworkPackage np) {
return false;
}
/** /**
* Should return the list of NetworkPackage types that this plugin can handle * Should return the list of NetworkPackage types that this plugin can handle

View File

@@ -79,7 +79,9 @@ public class PluginFactory {
return icon; return icon;
} }
public boolean hasSettings() { return hasSettings; } public boolean hasSettings() {
return hasSettings;
}
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return enabledByDefault; return enabledByDefault;

View File

@@ -93,7 +93,10 @@ public class ReceiveNotificationsPlugin extends Plugin {
} }
final InputStream input = np.getPayload(); final InputStream input = np.getPayload();
largeIcon = BitmapFactory.decodeStream(np.getPayload()); largeIcon = BitmapFactory.decodeStream(np.getPayload());
try { input.close(); } catch (Exception e) { } try {
input.close();
} catch (Exception e) {
}
if (largeIcon != null) { if (largeIcon != null) {
//Log.i("NotificationsPlugin", "hasPayload: size=" + largeIcon.getWidth() + "/" + largeIcon.getHeight() + " opti=" + width + "/" + height); //Log.i("NotificationsPlugin", "hasPayload: size=" + largeIcon.getWidth() + "/" + largeIcon.getHeight() + " opti=" + width + "/" + height);
if (largeIcon.getWidth() > width || largeIcon.getHeight() > height) { if (largeIcon.getWidth() > width || largeIcon.getHeight() > height) {

View File

@@ -52,17 +52,21 @@ public class RemoteKeyboardPlugin extends Plugin {
*/ */
private static ArrayList<RemoteKeyboardPlugin> instances = new ArrayList<RemoteKeyboardPlugin>(); private static ArrayList<RemoteKeyboardPlugin> instances = new ArrayList<RemoteKeyboardPlugin>();
private static ReentrantLock instancesLock = new ReentrantLock(true); private static ReentrantLock instancesLock = new ReentrantLock(true);
public static ArrayList<RemoteKeyboardPlugin> getInstances() { public static ArrayList<RemoteKeyboardPlugin> getInstances() {
return instances; return instances;
} }
public static ArrayList<RemoteKeyboardPlugin> acquireInstances() { public static ArrayList<RemoteKeyboardPlugin> acquireInstances() {
instancesLock.lock(); instancesLock.lock();
return getInstances(); return getInstances();
} }
public static ArrayList<RemoteKeyboardPlugin> releaseInstances() { public static ArrayList<RemoteKeyboardPlugin> releaseInstances() {
instancesLock.unlock(); instancesLock.unlock();
return getInstances(); return getInstances();
} }
public static boolean isConnected() { public static boolean isConnected() {
return instances.size() > 0; return instances.size() > 0;
} }

View File

@@ -53,7 +53,7 @@ public class RunCommandPlugin extends Plugin {
interface CommandsChangedCallback { interface CommandsChangedCallback {
void update(); void update();
}; }
public ArrayList<JSONObject> getCommandList() { public ArrayList<JSONObject> getCommandList() {
return commandList; return commandList;

View File

@@ -78,6 +78,7 @@ class SimpleSftpServer {
Security.insertProviderAt(SslHelper.BC, 1); Security.insertProviderAt(SslHelper.BC, 1);
SecurityUtils.setRegisterBouncyCastle(false); SecurityUtils.setRegisterBouncyCastle(false);
} }
private final SshServer sshd = SshServer.setUpDefaultServer(); private final SshServer sshd = SshServer.setUpDefaultServer();
public void init(Context context, Device device) { public void init(Context context, Device device) {

View File

@@ -80,7 +80,10 @@ public class ShareActivity extends AppCompatActivity {
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
try { Thread.sleep(1500); } catch (InterruptedException ignored) { } try {
Thread.sleep(1500);
} catch (InterruptedException ignored) {
}
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@@ -33,7 +33,7 @@ import org.kde.kdeconnect.BackgroundService;
/** /**
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
* to be used with AppCompat. * to be used with AppCompat.
* * <p>
* This technique can be used with an {@link android.app.Activity} class, not just * This technique can be used with an {@link android.app.Activity} class, not just
* {@link android.preference.PreferenceActivity}. * {@link android.preference.PreferenceActivity}.
*/ */

View File

@@ -73,7 +73,6 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
mActivity.getSupportActionBar().setTitle(R.string.pairing_title); mActivity.getSupportActionBar().setTitle(R.string.pairing_title);
setHasOptionsMenu(true); setHasOptionsMenu(true);
rootView = inflater.inflate(R.layout.activity_refresh_list, container, false); rootView = inflater.inflate(R.layout.activity_refresh_list, container, false);
@@ -113,7 +112,10 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
try { Thread.sleep(1500); } catch (InterruptedException ignored) { } try {
Thread.sleep(1500);
} catch (InterruptedException ignored) {
}
mActivity.runOnUiThread(new Runnable() { mActivity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@@ -137,7 +137,11 @@ public class LanLinkTest extends AndroidTestCase {
socket.connect(new InetSocketAddress(address.getAddress(), tcpPort)); socket.connect(new InetSocketAddress(address.getAddress(), tcpPort));
np.setPayload(socket.getInputStream(), np.getPayloadSize()); np.setPayload(socket.getInputStream(), np.getPayloadSize());
} catch (Exception e) { } catch (Exception e) {
try { socket.close(); } catch(Exception ignored) { throw ignored; } try {
socket.close();
} catch (Exception ignored) {
throw ignored;
}
e.printStackTrace(); e.printStackTrace();
Log.e("KDE/LanLinkTest", "Exception connecting to remote socket"); Log.e("KDE/LanLinkTest", "Exception connecting to remote socket");
throw e; throw e;