mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 18:07:55 +00:00
Removed old UI
This commit is contained in:
parent
0e40327a50
commit
92e4fa864a
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.kde.kdeconnect_tp"
|
package="org.kde.kdeconnect_tp"
|
||||||
android:versionCode="900"
|
android:versionCode="901"
|
||||||
android:versionName="0.9">
|
android:versionName="0.9">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="9"
|
<uses-sdk android:minSdkVersion="9"
|
||||||
@ -46,7 +46,7 @@
|
|||||||
</service>
|
</service>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.NewUserInterface.MaterialActivity"
|
android:name="org.kde.kdeconnect.UserInterface.MaterialActivity"
|
||||||
android:label="KDE Connect"
|
android:label="KDE Connect"
|
||||||
android:theme="@style/KdeConnectTheme.NoActionBar">
|
android:theme="@style/KdeConnectTheme.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -55,66 +55,29 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name="org.kde.kdeconnect.UserInterface.MainActivity"
|
|
||||||
android:label="KDE Connect"
|
|
||||||
>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name="org.kde.kdeconnect.UserInterface.MainSettingsActivity"
|
|
||||||
android:label="@string/settings"
|
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity" >
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
|
||||||
</activity>
|
|
||||||
<activity
|
|
||||||
android:name="org.kde.kdeconnect.UserInterface.DeviceActivity"
|
|
||||||
android:label="@string/device"
|
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity"
|
|
||||||
>
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
|
||||||
</activity>
|
|
||||||
<activity
|
|
||||||
android:name="org.kde.kdeconnect.UserInterface.PairActivity"
|
|
||||||
android:label="@string/pair_device"
|
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.MainActivity"
|
|
||||||
>
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
|
||||||
android:value="org.kde.kdeconnect.UserInterface.MainActivity" />
|
|
||||||
</activity>
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.UserInterface.SettingsActivity"
|
android:name="org.kde.kdeconnect.UserInterface.SettingsActivity"
|
||||||
android:label="@string/device_menu_plugins"
|
android:label="@string/device_menu_plugins"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.DeviceActivity" >
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.DeviceActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.UserInterface.CustomDevicesActivity"
|
android:name="org.kde.kdeconnect.UserInterface.CustomDevicesActivity"
|
||||||
android:label="@string/custom_devices_settings"
|
android:label="@string/custom_devices_settings"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.DeviceActivity" >
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.DeviceActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.SharePlugin.SendFileActivity"
|
android:name="org.kde.kdeconnect.Plugins.SharePlugin.SendFileActivity"
|
||||||
android:label="KDE Connect"
|
android:label="KDE Connect"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.DeviceActivity" >
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.DeviceActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.UserInterface.PluginSettingsActivity"
|
android:name="org.kde.kdeconnect.UserInterface.PluginSettingsActivity"
|
||||||
@ -161,22 +124,22 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.MprisPlugin.MprisActivity"
|
android:name="org.kde.kdeconnect.Plugins.MprisPlugin.MprisActivity"
|
||||||
android:label="@string/remote_control"
|
android:label="@string/remote_control"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.DeviceActivity"
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity"
|
||||||
>
|
>
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.DeviceActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.MousePadPlugin.MousePadActivity"
|
android:name="org.kde.kdeconnect.Plugins.MousePadPlugin.MousePadActivity"
|
||||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
android:label="@string/remote_control"
|
android:label="@string/remote_control"
|
||||||
android:parentActivityName="org.kde.kdeconnect.UserInterface.DeviceActivity"
|
android:parentActivityName="org.kde.kdeconnect.UserInterface.MaterialActivity"
|
||||||
android:screenOrientation="fullSensor"
|
android:screenOrientation="fullSensor"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize" >
|
android:windowSoftInputMode="stateHidden|adjustResize" >
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value="org.kde.kdeconnect.UserInterface.DeviceActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.MaterialActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="org.kde.kdeconnect.Plugins.SharePlugin.ShareActivity"
|
android:name="org.kde.kdeconnect.Plugins.SharePlugin.ShareActivity"
|
||||||
|
@ -1,9 +1,89 @@
|
|||||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout 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/buttons_list"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="16dip"
|
android:padding="@dimen/activity_vertical_margin"
|
||||||
android:fillViewport="true"
|
tools:context=".DeviceFragment"
|
||||||
tools:context=".DeviceActivity"
|
android:orientation="vertical">
|
||||||
/>
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:id="@+id/pairing_buttons"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/pair_progress" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dip"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:text="@string/device_not_paired"
|
||||||
|
android:id="@+id/pair_message"
|
||||||
|
android:layout_gravity="left|center_vertical"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/pair_button"
|
||||||
|
android:background="@drawable/button_round"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/request_pairing"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:id="@+id/pair_request"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:background="@drawable/button_round"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:layout_margin="4dip"
|
||||||
|
android:id="@+id/accept_button"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/pairing_accept"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:background="@drawable/button_round"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:layout_margin="4dip"
|
||||||
|
android:id="@+id/reject_button"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/pairing_reject"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/unpair_message"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/unreachable_description"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/buttons_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true"
|
||||||
|
tools:context=".DeviceActivity"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
11
res/layout/activity_list.xml
Normal file
11
res/layout/activity_list.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="16dip"
|
||||||
|
tools:context=".MainActivity"
|
||||||
|
android:id="@+id/listView1"
|
||||||
|
android:addStatesFromChildren="true"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
</ListView>
|
@ -1,11 +1,40 @@
|
|||||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.DrawerLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
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"
|
||||||
android:layout_margin="16dip"
|
android:fitsSystemWindows="true"
|
||||||
tools:context=".MainActivity"
|
tools:context="org.kde.kdeconnect.UserInterface.MaterialActivity"> <!-- fitSystemWindows to make the drawer slide below the Lollipop transparent status bar -->
|
||||||
android:id="@+id/listView1"
|
|
||||||
android:addStatesFromChildren="true"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
</ListView>
|
<LinearLayout
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||||
|
android:background="?attr/colorPrimary" />
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
</FrameLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<android.support.design.widget.NavigationView
|
||||||
|
android:id="@+id/navigation_drawer"
|
||||||
|
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_height="match_parent"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
app:headerLayout="@layout/nav_header"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
<android.support.v4.widget.DrawerLayout
|
|
||||||
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"
|
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
tools:context="org.kde.kdeconnect.NewUserInterface.MaterialActivity"> <!-- fitSystemWindows to make the drawer slide below the Lollipop transparent status bar -->
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<android.support.v7.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
|
||||||
android:background="?attr/colorPrimary" />
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
</FrameLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<android.support.design.widget.NavigationView
|
|
||||||
android:id="@+id/navigation_drawer"
|
|
||||||
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_height="match_parent"
|
|
||||||
android:layout_gravity="start"
|
|
||||||
app:headerLayout="@layout/nav_header"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
|
@ -1,64 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:padding="@dimen/activity_vertical_margin"
|
|
||||||
tools:context=".MainActivity"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/pair_progress" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:text="@string/device_not_paired"
|
|
||||||
android:id="@+id/pair_message"
|
|
||||||
android:layout_gravity="left|center_vertical"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/pair_button"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/request_pairing"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/unpair_button"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/device_menu_unpair"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/pair_request"
|
|
||||||
android:layout_gravity="center">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/accept_button"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/pairing_accept"
|
|
||||||
android:layout_weight="1"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/reject_button"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/pairing_reject"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,89 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:padding="@dimen/activity_vertical_margin"
|
|
||||||
tools:context=".DeviceFragment"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:id="@+id/pairing_buttons"
|
|
||||||
android:layout_gravity="center">
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/pair_progress" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="8dip"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:text="@string/device_not_paired"
|
|
||||||
android:id="@+id/pair_message"
|
|
||||||
android:layout_gravity="left|center_vertical"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/pair_button"
|
|
||||||
android:background="@drawable/button_round"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/request_pairing"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/pair_request"
|
|
||||||
android:layout_gravity="center">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:background="@drawable/button_round"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:layout_margin="4dip"
|
|
||||||
android:id="@+id/accept_button"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/pairing_accept"
|
|
||||||
android:layout_weight="1"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:background="@drawable/button_round"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:layout_margin="4dip"
|
|
||||||
android:id="@+id/reject_button"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/pairing_reject"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/unpair_message"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/unreachable_description"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/buttons_list"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:fillViewport="true"
|
|
||||||
tools:context=".DeviceActivity"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,5 +0,0 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
<item android:id="@+id/action_settings" android:title="@string/settings"
|
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
|
||||||
</menu>
|
|
@ -1,36 +0,0 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:kdeconnect="http://schemas.android.com/apk/res-auto/android">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_refresh"
|
|
||||||
android:icon="@drawable/ic_action_refresh"
|
|
||||||
android:orderInCategory="200"
|
|
||||||
kdeconnect:showAsAction="ifRoom"
|
|
||||||
android:title="@string/reconnect"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_progress"
|
|
||||||
android:orderInCategory="200"
|
|
||||||
android:visible="false"
|
|
||||||
kdeconnect:showAsAction="ifRoom"
|
|
||||||
kdeconnect:actionViewClass="android.widget.ProgressBar"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_settings"
|
|
||||||
android:icon="@drawable/ic_action_settings"
|
|
||||||
android:orderInCategory="300"
|
|
||||||
android:title="@string/settings"
|
|
||||||
kdeconnect:showAsAction="never"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/menu_custom_device_list"
|
|
||||||
android:icon="@drawable/ic_action_settings"
|
|
||||||
android:orderInCategory="900"
|
|
||||||
android:title="@string/custom_device_list"
|
|
||||||
kdeconnect:showAsAction="never"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</menu>
|
|
@ -6,7 +6,7 @@
|
|||||||
android:icon="@drawable/ic_action_refresh"
|
android:icon="@drawable/ic_action_refresh"
|
||||||
android:orderInCategory="200"
|
android:orderInCategory="200"
|
||||||
kdeconnect:showAsAction="ifRoom"
|
kdeconnect:showAsAction="ifRoom"
|
||||||
android:title="@string/reconnect"
|
android:title="@string/refresh"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
|
@ -37,11 +37,9 @@ import android.util.Base64;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.kde.kdeconnect.Backends.BaseLink;
|
import org.kde.kdeconnect.Backends.BaseLink;
|
||||||
import org.kde.kdeconnect.NewUserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||||
import org.kde.kdeconnect.UserInterface.MainActivity;
|
|
||||||
import org.kde.kdeconnect.UserInterface.PairActivity;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
import java.security.KeyFactory;
|
import java.security.KeyFactory;
|
||||||
|
@ -34,8 +34,8 @@ import android.util.Log;
|
|||||||
|
|
||||||
import org.kde.kdeconnect.Helpers.AppsHelper;
|
import org.kde.kdeconnect.Helpers.AppsHelper;
|
||||||
import org.kde.kdeconnect.NetworkPackage;
|
import org.kde.kdeconnect.NetworkPackage;
|
||||||
|
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.UserInterface.DeviceActivity;
|
|
||||||
import org.kde.kdeconnect.UserInterface.SettingsActivity;
|
import org.kde.kdeconnect.UserInterface.SettingsActivity;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||||
deviceActivity.startActivityForResult(intent, DeviceActivity.RESULT_NEEDS_RELOAD);
|
deviceActivity.startActivityForResult(intent, MaterialActivity.RESULT_NEEDS_RELOAD);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener() {
|
||||||
|
@ -30,9 +30,8 @@ import android.support.v4.app.NotificationCompat;
|
|||||||
import android.support.v4.app.TaskStackBuilder;
|
import android.support.v4.app.TaskStackBuilder;
|
||||||
|
|
||||||
import org.kde.kdeconnect.NetworkPackage;
|
import org.kde.kdeconnect.NetworkPackage;
|
||||||
import org.kde.kdeconnect.NewUserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.UserInterface.MainActivity;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,21 +20,9 @@
|
|||||||
|
|
||||||
package org.kde.kdeconnect.Plugins.SharePlugin;
|
package org.kde.kdeconnect.Plugins.SharePlugin;
|
||||||
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -53,8 +41,6 @@ import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
|||||||
import org.kde.kdeconnect.UserInterface.List.SectionItem;
|
import org.kde.kdeconnect.UserInterface.List.SectionItem;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -67,7 +53,7 @@ public class ShareActivity extends ActionBarActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.main, menu);
|
inflater.inflate(R.menu.refresh, menu);
|
||||||
menuProgress = menu.findItem(R.id.menu_progress);
|
menuProgress = menu.findItem(R.id.menu_progress);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -207,12 +193,12 @@ public class ShareActivity extends ActionBarActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_list);
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
|
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,221 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License or (at your option) version 3 or any later version
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy
|
|
||||||
* defined in Section 14 of version 3 of the license.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.support.v7.app.ActionBarActivity;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
|
||||||
import org.kde.kdeconnect.Device;
|
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.ButtonItem;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.CustomItem;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.SectionItem;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.SmallEntryItem;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.TextItem;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.ConcurrentModificationException;
|
|
||||||
|
|
||||||
public class DeviceActivity extends ActionBarActivity {
|
|
||||||
|
|
||||||
static private String deviceId; //Static because if we get here by using the back button in the action bar, the extra deviceId will not be set.
|
|
||||||
private Device device;
|
|
||||||
|
|
||||||
public static final int RESULT_NEEDS_RELOAD = Activity.RESULT_FIRST_USER;
|
|
||||||
|
|
||||||
TextView errorHeader;
|
|
||||||
|
|
||||||
private final Device.PluginsChangedListener pluginsChangedListener = new Device.PluginsChangedListener() {
|
|
||||||
@Override
|
|
||||||
public void onPluginsChanged(final Device device) {
|
|
||||||
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
try {
|
|
||||||
ArrayList<ListAdapter.Item> items = new ArrayList<>();
|
|
||||||
|
|
||||||
if (!device.isReachable()) {
|
|
||||||
//Not reachable, show unpair button
|
|
||||||
Button b = new Button(DeviceActivity.this);
|
|
||||||
b.setText(R.string.device_menu_unpair);
|
|
||||||
b.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
device.unpair();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
items.add(new TextItem(getString(R.string.device_not_reachable)));
|
|
||||||
items.add(new ButtonItem(b));
|
|
||||||
} else {
|
|
||||||
//Plugins button list
|
|
||||||
final Collection<Plugin> plugins = device.getLoadedPlugins().values();
|
|
||||||
for (Plugin p : plugins) {
|
|
||||||
Button b = p.getInterfaceButton(DeviceActivity.this);
|
|
||||||
if (b != null) {
|
|
||||||
items.add(new SectionItem(p.getDisplayName()));
|
|
||||||
items.add(new ButtonItem(b));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Failed plugins List
|
|
||||||
final Collection<Plugin> failed = device.getFailedPlugins().values();
|
|
||||||
if (!failed.isEmpty()) {
|
|
||||||
if (errorHeader == null) {
|
|
||||||
errorHeader = new TextView(DeviceActivity.this);
|
|
||||||
errorHeader.setPadding(0, 48, 0, 0);
|
|
||||||
errorHeader.setOnClickListener(null);
|
|
||||||
errorHeader.setOnLongClickListener(null);
|
|
||||||
errorHeader.setText(getResources().getString(R.string.plugins_failed_to_load));
|
|
||||||
}
|
|
||||||
items.add(new CustomItem(errorHeader));
|
|
||||||
for (final Plugin p : failed) {
|
|
||||||
items.add(new SmallEntryItem(p.getDisplayName(), new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
p.getErrorDialog(DeviceActivity.this).show();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView buttonsList = (ListView)findViewById(R.id.buttons_list);
|
|
||||||
ListAdapter adapter = new ListAdapter(DeviceActivity.this, items);
|
|
||||||
buttonsList.setAdapter(adapter);
|
|
||||||
|
|
||||||
} catch(ConcurrentModificationException e) {
|
|
||||||
Log.e("DeviceActivity", "ConcurrentModificationException");
|
|
||||||
this.run(); //Try again
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_device);
|
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
|
||||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
|
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
if (getIntent().hasExtra("deviceId")) {
|
|
||||||
deviceId = getIntent().getStringExtra("deviceId");
|
|
||||||
}
|
|
||||||
|
|
||||||
BackgroundService.RunCommand(DeviceActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
device = service.getDevice(deviceId);
|
|
||||||
if (device == null) return;
|
|
||||||
setTitle(device.getName());
|
|
||||||
device.addPluginsChangedListener(pluginsChangedListener);
|
|
||||||
pluginsChangedListener.onPluginsChanged(device);
|
|
||||||
if (!device.hasPluginsLoaded()) {
|
|
||||||
device.reloadPluginsFromSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
BackgroundService.RunCommand(DeviceActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
Device device = service.getDevice(deviceId);
|
|
||||||
if (device == null) return;
|
|
||||||
device.removePluginsChangedListener(pluginsChangedListener);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
||||||
super.onPrepareOptionsMenu(menu);
|
|
||||||
menu.clear();
|
|
||||||
if (device != null && device.isPaired()) {
|
|
||||||
menu.add(R.string.device_menu_plugins).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
|
||||||
Intent intent = new Intent(DeviceActivity.this, SettingsActivity.class);
|
|
||||||
intent.putExtra("deviceId", deviceId);
|
|
||||||
startActivity(intent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
menu.add(R.string.device_menu_unpair).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
|
||||||
device.unpair();
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
switch (requestCode)
|
|
||||||
{
|
|
||||||
case RESULT_NEEDS_RELOAD:
|
|
||||||
BackgroundService.RunCommand(DeviceActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
Device device = service.getDevice(deviceId);
|
|
||||||
device.reloadPluginsFromSettings();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -18,7 +18,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.kde.kdeconnect.NewUserInterface;
|
package org.kde.kdeconnect.UserInterface;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
@ -39,12 +39,11 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
import org.kde.kdeconnect.BackgroundService;
|
||||||
import org.kde.kdeconnect.Device;
|
import org.kde.kdeconnect.Device;
|
||||||
import org.kde.kdeconnect.NewUserInterface.List.PluginItem;
|
import org.kde.kdeconnect.UserInterface.List.PluginItem;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.UserInterface.List.CustomItem;
|
import org.kde.kdeconnect.UserInterface.List.CustomItem;
|
||||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
||||||
import org.kde.kdeconnect.UserInterface.List.SmallEntryItem;
|
import org.kde.kdeconnect.UserInterface.List.SmallEntryItem;
|
||||||
import org.kde.kdeconnect.UserInterface.SettingsActivity;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -91,7 +90,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
rootView = inflater.inflate(R.layout.material_device, container, false);
|
rootView = inflater.inflate(R.layout.activity_device, container, false);
|
||||||
|
|
||||||
final String deviceId = getArguments().getString(ARG_DEVICE_ID);
|
final String deviceId = getArguments().getString(ARG_DEVICE_ID);
|
||||||
if (deviceId != null) {
|
if (deviceId != null) {
|
@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License or (at your option) version 3 or any later version
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy
|
|
||||||
* defined in Section 14 of version 3 of the license.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface.List;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
public class ButtonItem implements ListAdapter.Item {
|
|
||||||
|
|
||||||
private final Button button;
|
|
||||||
|
|
||||||
public ButtonItem(Button b) {
|
|
||||||
this.button = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View inflateView(LayoutInflater layoutInflater) {
|
|
||||||
return button;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License or (at your option) version 3 or any later version
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy
|
|
||||||
* defined in Section 14 of version 3 of the license.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface.List;
|
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.kde.kdeconnect.Device;
|
|
||||||
import org.kde.kdeconnect.UserInterface.DeviceActivity;
|
|
||||||
import org.kde.kdeconnect.UserInterface.PairActivity;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
|
||||||
|
|
||||||
public class DeviceItem implements ListAdapter.Item {
|
|
||||||
|
|
||||||
private final Device device;
|
|
||||||
private final Activity activity;
|
|
||||||
|
|
||||||
public DeviceItem(Activity activity, Device device) {
|
|
||||||
this.device = device;
|
|
||||||
this.activity = activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View inflateView(LayoutInflater layoutInflater) {
|
|
||||||
final View v = layoutInflater.inflate(R.layout.list_item_entry, null);
|
|
||||||
|
|
||||||
TextView titleView = (TextView)v.findViewById(R.id.list_item_entry_title);
|
|
||||||
if (titleView != null) titleView.setText(device.getName());
|
|
||||||
if (device.compareProtocolVersion() != 0) {
|
|
||||||
TextView summaryView = (TextView)v.findViewById(R.id.list_item_entry_summary);
|
|
||||||
summaryView.setVisibility(View.VISIBLE);
|
|
||||||
if (device.compareProtocolVersion() > 0) {
|
|
||||||
summaryView.setText(R.string.protocol_version_newer);
|
|
||||||
} else {
|
|
||||||
summaryView.setText(R.string.protocol_version_older);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
v.findViewById(R.id.list_item_entry_summary).setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
v.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent intent;
|
|
||||||
if (device.isPaired()) {
|
|
||||||
intent = new Intent(activity, DeviceActivity.class);
|
|
||||||
} else {
|
|
||||||
intent = new Intent(activity, PairActivity.class);
|
|
||||||
}
|
|
||||||
intent.putExtra("deviceId", device.getDeviceId());
|
|
||||||
activity.startActivity(intent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -18,21 +18,14 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.kde.kdeconnect.NewUserInterface.List;
|
package org.kde.kdeconnect.UserInterface.List;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.kde.kdeconnect.Device;
|
import org.kde.kdeconnect.Device;
|
||||||
import org.kde.kdeconnect.UserInterface.DeviceActivity;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
|
||||||
import org.kde.kdeconnect.UserInterface.PairActivity;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
public class PairingDeviceItem implements ListAdapter.Item {
|
public class PairingDeviceItem implements ListAdapter.Item {
|
@ -18,7 +18,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.kde.kdeconnect.NewUserInterface.List;
|
package org.kde.kdeconnect.UserInterface.List;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -26,7 +26,6 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
public class PluginItem implements ListAdapter.Item {
|
public class PluginItem implements ListAdapter.Item {
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License or (at your option) version 3 or any later version
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy
|
|
||||||
* defined in Section 14 of version 3 of the license.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface.List;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
public class TextItem implements ListAdapter.Item {
|
|
||||||
|
|
||||||
private final String title;
|
|
||||||
|
|
||||||
public TextItem(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View inflateView(LayoutInflater layoutInflater) {
|
|
||||||
|
|
||||||
TextView v = new TextView(layoutInflater.getContext());
|
|
||||||
v.setText(title);
|
|
||||||
v.setTextAppearance(layoutInflater.getContext(), android.support.v7.appcompat.R.style.TextAppearance_AppCompat_Medium /*android.R.style.TextAppearance_DeviceDefault_Medium*/);
|
|
||||||
return v;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,211 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License or (at your option) version 3 or any later version
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy
|
|
||||||
* defined in Section 14 of version 3 of the license.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface;
|
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.support.v7.app.ActionBarActivity;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuInflater;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ListView;
|
|
||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
|
||||||
import org.kde.kdeconnect.Device;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.DeviceItem;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.SectionItem;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public class MainActivity extends ActionBarActivity {
|
|
||||||
|
|
||||||
private MenuItem menuProgress;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
|
||||||
inflater.inflate(R.menu.main, menu);
|
|
||||||
menuProgress = menu.findItem(R.id.menu_progress);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case R.id.menu_refresh:
|
|
||||||
updateComputerList();
|
|
||||||
BackgroundService.RunCommand(MainActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
service.onNetworkChange();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
item.setVisible(false);
|
|
||||||
menuProgress.setVisible(true);
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try { Thread.sleep(1500); } catch (InterruptedException e) { }
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
menuProgress.setVisible(false);
|
|
||||||
item.setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
break;
|
|
||||||
case R.id.menu_settings:
|
|
||||||
startActivity(new Intent(this, org.kde.kdeconnect.UserInterface.MainSettingsActivity.class));
|
|
||||||
break;
|
|
||||||
case R.id.menu_custom_device_list:
|
|
||||||
startActivity(new Intent(this, org.kde.kdeconnect.UserInterface.CustomDevicesActivity.class));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
|
||||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Device list
|
|
||||||
//
|
|
||||||
|
|
||||||
void updateComputerList() {
|
|
||||||
|
|
||||||
BackgroundService.RunCommand(MainActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(final BackgroundService service) {
|
|
||||||
|
|
||||||
Collection<Device> devices = service.getDevices().values();
|
|
||||||
final ArrayList<ListAdapter.Item> items = new ArrayList<>();
|
|
||||||
|
|
||||||
SectionItem section;
|
|
||||||
|
|
||||||
Resources res = getResources();
|
|
||||||
|
|
||||||
section = new SectionItem(res.getString(R.string.category_connected_devices));
|
|
||||||
section.isSectionEmpty = true;
|
|
||||||
items.add(section);
|
|
||||||
for(Device d : devices) {
|
|
||||||
if (d.isReachable() && d.isPaired()) {
|
|
||||||
items.add(new DeviceItem(MainActivity.this, d));
|
|
||||||
section.isSectionEmpty = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
section = new SectionItem(res.getString(R.string.category_not_paired_devices));
|
|
||||||
section.isSectionEmpty = true;
|
|
||||||
items.add(section);
|
|
||||||
for(Device d : devices) {
|
|
||||||
if (d.isReachable() && !d.isPaired()) {
|
|
||||||
items.add(new DeviceItem(MainActivity.this, d));
|
|
||||||
section.isSectionEmpty = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
section = new SectionItem(res.getString(R.string.category_remembered_devices));
|
|
||||||
section.isSectionEmpty = true;
|
|
||||||
items.add(section);
|
|
||||||
for(Device d : devices) {
|
|
||||||
if (!d.isReachable() && d.isPaired()) {
|
|
||||||
items.add(new DeviceItem(MainActivity.this, d));
|
|
||||||
section.isSectionEmpty = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (section.isSectionEmpty) {
|
|
||||||
items.remove(items.size()-1); //Remove remembered devices section if empty
|
|
||||||
}
|
|
||||||
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ListView list = (ListView)findViewById(R.id.listView1);
|
|
||||||
list.setAdapter(new ListAdapter(MainActivity.this, items));
|
|
||||||
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
||||||
view.performClick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
BackgroundService.RunCommand(MainActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
service.onNetworkChange();
|
|
||||||
service.addDeviceListChangedCallback("MainActivity", new BackgroundService.DeviceListChangedCallback() {
|
|
||||||
@Override
|
|
||||||
public void onDeviceListChanged() {
|
|
||||||
updateComputerList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
BackgroundService.RunCommand(MainActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
service.removeDeviceListChangedCallback("MainActivity");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
super.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
updateComputerList();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License or (at your option) version 3 or any later version
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy
|
|
||||||
* defined in Section 14 of version 3 of the license.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.EditTextPreference;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceFragment;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
|
||||||
import org.kde.kdeconnect.Helpers.DeviceHelper;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
|
||||||
|
|
||||||
public class MainSettingsActivity extends AppCompatPreferenceActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
DeviceHelper.getDeviceName(this); //To make sure the preference is initialized
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
|
|
||||||
addPreferencesOldApi();
|
|
||||||
} else {
|
|
||||||
getFragmentManager().beginTransaction().
|
|
||||||
replace(android.R.id.content, new GeneralPrefsFragment()).commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
//ActionBar's back button
|
|
||||||
if (item.getItemId() == android.R.id.home) {
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void addPreferencesOldApi() {
|
|
||||||
addPreferencesFromResource(R.xml.general_preferences);
|
|
||||||
initPreferences((EditTextPreference) findPreference(DeviceHelper.KEY_DEVICE_NAME_PREFERENCE));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initPreferences(final EditTextPreference deviceNamePref) {
|
|
||||||
|
|
||||||
final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
|
||||||
deviceNamePref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newDeviceNameObject) {
|
|
||||||
|
|
||||||
String newDeviceName = newDeviceNameObject == null ? "" : newDeviceNameObject.toString();
|
|
||||||
|
|
||||||
if (newDeviceName.isEmpty()) {
|
|
||||||
|
|
||||||
Toast.makeText(
|
|
||||||
MainSettingsActivity.this,
|
|
||||||
getString(R.string.invalid_device_name),
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Log.i("MainSettingsActivity", "New device name: " + newDeviceName);
|
|
||||||
deviceNamePref.setSummary(newDeviceName);
|
|
||||||
|
|
||||||
//Broadcast the device information again since it has changed
|
|
||||||
BackgroundService.RunCommand(MainSettingsActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
service.onNetworkChange();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
deviceNamePref.setSummary(sharedPreferences.getString(DeviceHelper.KEY_DEVICE_NAME_PREFERENCE,""));
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
public static class GeneralPrefsFragment extends PreferenceFragment {
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
addPreferencesFromResource(R.xml.general_preferences);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
|
||||||
super.onActivityCreated(savedInstanceState);
|
|
||||||
if (getActivity() != null) {
|
|
||||||
((MainSettingsActivity)getActivity()).initPreferences(
|
|
||||||
(EditTextPreference) findPreference(DeviceHelper.KEY_DEVICE_NAME_PREFERENCE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.kde.kdeconnect.NewUserInterface;
|
package org.kde.kdeconnect.UserInterface;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@ -49,7 +49,7 @@ public class MaterialActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_material);
|
setContentView(R.layout.activity_main);
|
||||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
mNavigationView = (NavigationView) findViewById(R.id.navigation_drawer);
|
mNavigationView = (NavigationView) findViewById(R.id.navigation_drawer);
|
||||||
|
|
@ -1,202 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Albert Vaca Cintora <albertvaka@gmail.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of
|
|
||||||
* the License or (at your option) version 3 or any later version
|
|
||||||
* accepted by the membership of KDE e.V. (or its successor approved
|
|
||||||
* by the membership of KDE e.V.), which shall act as a proxy
|
|
||||||
* defined in Section 14 of version 3 of the license.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.kde.kdeconnect.UserInterface;
|
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.support.v7.app.ActionBarActivity;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
|
||||||
import org.kde.kdeconnect.Device;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
|
||||||
|
|
||||||
public class PairActivity extends ActionBarActivity {
|
|
||||||
|
|
||||||
private String deviceId;
|
|
||||||
private Device device = null;
|
|
||||||
|
|
||||||
private final Device.PairingCallback pairingCallback = new Device.PairingCallback() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void incomingRequest() {
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
((TextView) findViewById(R.id.pair_message)).setText(R.string.pair_requested);
|
|
||||||
findViewById(R.id.pair_progress).setVisibility(View.GONE);
|
|
||||||
findViewById(R.id.pair_button).setVisibility(View.GONE);
|
|
||||||
findViewById(R.id.pair_request).setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
notificationManager.cancel(device.getNotificationId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void pairingSuccessful() {
|
|
||||||
setResult(1, getIntent());
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void pairingFailed(final String error) {
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
((TextView) findViewById(R.id.pair_message)).setText(error);
|
|
||||||
findViewById(R.id.pair_progress).setVisibility(View.GONE);
|
|
||||||
findViewById(R.id.pair_button).setVisibility(View.VISIBLE);
|
|
||||||
findViewById(R.id.pair_request).setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unpaired() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_pair);
|
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
|
||||||
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
|
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
deviceId = getIntent().getStringExtra("deviceId");
|
|
||||||
|
|
||||||
final Button pairButton = (Button)findViewById(R.id.pair_button);
|
|
||||||
pairButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
pairButton.setVisibility(View.GONE);
|
|
||||||
((TextView) findViewById(R.id.pair_message)).setText("");
|
|
||||||
findViewById(R.id.pair_progress).setVisibility(View.VISIBLE);
|
|
||||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
device = service.getDevice(deviceId);
|
|
||||||
if (device == null) return;
|
|
||||||
device.requestPairing();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final Button unpairButton = (Button)findViewById(R.id.unpair_button);
|
|
||||||
unpairButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
((TextView) findViewById(R.id.pair_message)).setText(getString(R.string.device_not_paired));
|
|
||||||
unpairButton.setVisibility(View.GONE);
|
|
||||||
pairButton.setVisibility(View.VISIBLE);
|
|
||||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
device = service.getDevice(deviceId);
|
|
||||||
if (device == null) return;
|
|
||||||
device.unpair();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
findViewById(R.id.accept_button).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
if (device != null) {
|
|
||||||
device.acceptPairing();
|
|
||||||
}
|
|
||||||
setResult(1, getIntent());
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
findViewById(R.id.reject_button).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
if (device != null) {
|
|
||||||
device.rejectPairing();
|
|
||||||
}
|
|
||||||
setResult(0, getIntent());
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
device = service.getDevice(deviceId);
|
|
||||||
if (device == null) return;
|
|
||||||
setTitle(device.getName());
|
|
||||||
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
notificationManager.cancel(device.getNotificationId());
|
|
||||||
((TextView) findViewById(R.id.pair_message)).setText(getString(device.isPaired() ? R.string.device_paired : R.string.device_not_paired));
|
|
||||||
pairButton.setVisibility(device.isPaired() ? View.GONE : View.VISIBLE);
|
|
||||||
unpairButton.setVisibility(device.isPaired() ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
BackgroundService.RunCommand(PairActivity.this, new BackgroundService.InstanceCallback() {
|
|
||||||
@Override
|
|
||||||
public void onServiceStart(BackgroundService service) {
|
|
||||||
device = service.getDevice(deviceId);
|
|
||||||
if (device == null) return;
|
|
||||||
device.addPairingCallback(pairingCallback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
if (device != null) device.removePairingCallback(pairingCallback);
|
|
||||||
super.onStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -18,7 +18,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.kde.kdeconnect.NewUserInterface;
|
package org.kde.kdeconnect.UserInterface;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -37,8 +37,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
import org.kde.kdeconnect.BackgroundService;
|
||||||
import org.kde.kdeconnect.Device;
|
import org.kde.kdeconnect.Device;
|
||||||
import org.kde.kdeconnect.NewUserInterface.List.PairingDeviceItem;
|
import org.kde.kdeconnect.UserInterface.List.PairingDeviceItem;
|
||||||
import org.kde.kdeconnect.UserInterface.CustomDevicesActivity;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
||||||
import org.kde.kdeconnect.UserInterface.List.SectionItem;
|
import org.kde.kdeconnect.UserInterface.List.SectionItem;
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
@ -74,7 +73,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
|
|||||||
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
rootView = inflater.inflate(R.layout.activity_main, container, false);
|
rootView = inflater.inflate(R.layout.activity_list, container, false);
|
||||||
|
|
||||||
TextView text = new TextView(inflater.getContext());
|
TextView text = new TextView(inflater.getContext());
|
||||||
text.setText(getString(R.string.pairing_description));
|
text.setText(getString(R.string.pairing_description));
|
||||||
@ -225,7 +224,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
inflater.inflate(R.menu.new_pairing, menu);
|
inflater.inflate(R.menu.pairing, menu);
|
||||||
menuProgress = menu.findItem(R.id.menu_progress);
|
menuProgress = menu.findItem(R.id.menu_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +247,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb
|
|||||||
mActivity.runOnUiThread(new Runnable() {
|
mActivity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
item.setVisible(true);
|
menuProgress.setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.kde.kdeconnect.NewUserInterface;
|
package org.kde.kdeconnect.UserInterface;
|
||||||
|
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.view.View;
|
import android.view.View;
|
@ -26,7 +26,6 @@ import android.view.MenuItem;
|
|||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
import org.kde.kdeconnect.BackgroundService;
|
||||||
import org.kde.kdeconnect.Device;
|
import org.kde.kdeconnect.Device;
|
||||||
import org.kde.kdeconnect.NewUserInterface.PluginPreference;
|
|
||||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user