diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0da70ba4..d59839e4 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -8,25 +8,30 @@
android:targetSdkVersion="22" />
+ android:largeScreens="true"
+ android:normalScreens="true"
+ android:smallScreens="true"
+ android:xlargeScreens="true" />
-
+
-
+
-
+
-
+
+ android:name="org.kde.kdeconnect.BackgroundService"
+ android:enabled="true" >
-
+ android:name="org.kde.kdeconnect.NewUserInterface.MaterialActivity"
+ android:label="KDE Connect"
+ android:theme="@style/KdeConnectTheme.NoActionBar">
@@ -51,65 +56,74 @@
-
+
+
+
+
+
+
+
+
-
+
-
-
+
-
-
+
-
-
-
+ android:name="org.kde.kdeconnect.UserInterface.CustomDevicesActivity"
+ android:label="@string/custom_devices_settings"
+ android:parentActivityName="org.kde.kdeconnect.UserInterface.DeviceActivity" >
+
-
-
-
+
-
+
-
+
+
@@ -120,7 +134,8 @@
-
+
+ -->
@@ -138,40 +154,44 @@
android:label="@string/remote_control"
android:parentActivityName="org.kde.kdeconnect.UserInterface.DeviceActivity"
>
-
-
-
-
-
+
+
+
-
+
+
+
+
-
+
diff --git a/res/drawable-hdpi/drawer_shadow.9.png b/res/drawable-hdpi/drawer_shadow.9.png
new file mode 100644
index 00000000..236bff55
Binary files /dev/null and b/res/drawable-hdpi/drawer_shadow.9.png differ
diff --git a/res/drawable-hdpi/ic_action_content_add_circle_outline.png b/res/drawable-hdpi/ic_action_content_add_circle_outline.png
new file mode 100644
index 00000000..d3ac0f27
Binary files /dev/null and b/res/drawable-hdpi/ic_action_content_add_circle_outline.png differ
diff --git a/res/drawable-hdpi/ic_action_image_edit.png b/res/drawable-hdpi/ic_action_image_edit.png
new file mode 100644
index 00000000..d740cb34
Binary files /dev/null and b/res/drawable-hdpi/ic_action_image_edit.png differ
diff --git a/res/drawable-hdpi/ic_drawer.png b/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 00000000..65100a57
Binary files /dev/null and b/res/drawable-hdpi/ic_drawer.png differ
diff --git a/res/drawable-mdpi/drawer_shadow.9.png b/res/drawable-mdpi/drawer_shadow.9.png
new file mode 100644
index 00000000..ffe3a28d
Binary files /dev/null and b/res/drawable-mdpi/drawer_shadow.9.png differ
diff --git a/res/drawable-mdpi/ic_action_content_add_circle_outline.png b/res/drawable-mdpi/ic_action_content_add_circle_outline.png
new file mode 100644
index 00000000..3d2861e8
Binary files /dev/null and b/res/drawable-mdpi/ic_action_content_add_circle_outline.png differ
diff --git a/res/drawable-mdpi/ic_action_image_edit.png b/res/drawable-mdpi/ic_action_image_edit.png
new file mode 100644
index 00000000..5c1da971
Binary files /dev/null and b/res/drawable-mdpi/ic_action_image_edit.png differ
diff --git a/res/drawable-mdpi/ic_drawer.png b/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 00000000..632dd87b
Binary files /dev/null and b/res/drawable-mdpi/ic_drawer.png differ
diff --git a/res/drawable-xhdpi/drawer_shadow.9.png b/res/drawable-xhdpi/drawer_shadow.9.png
new file mode 100644
index 00000000..fabe9d96
Binary files /dev/null and b/res/drawable-xhdpi/drawer_shadow.9.png differ
diff --git a/res/drawable-xhdpi/ic_action_content_add_circle_outline.png b/res/drawable-xhdpi/ic_action_content_add_circle_outline.png
new file mode 100644
index 00000000..f2a6b4cf
Binary files /dev/null and b/res/drawable-xhdpi/ic_action_content_add_circle_outline.png differ
diff --git a/res/drawable-xhdpi/ic_action_image_edit.png b/res/drawable-xhdpi/ic_action_image_edit.png
new file mode 100644
index 00000000..4a9089ae
Binary files /dev/null and b/res/drawable-xhdpi/ic_action_image_edit.png differ
diff --git a/res/drawable-xhdpi/ic_drawer.png b/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 00000000..51ca58e8
Binary files /dev/null and b/res/drawable-xhdpi/ic_drawer.png differ
diff --git a/res/drawable-xxhdpi/drawer_shadow.9.png b/res/drawable-xxhdpi/drawer_shadow.9.png
new file mode 100644
index 00000000..b91e9d7f
Binary files /dev/null and b/res/drawable-xxhdpi/drawer_shadow.9.png differ
diff --git a/res/drawable-xxhdpi/ic_action_content_add_circle_outline.png b/res/drawable-xxhdpi/ic_action_content_add_circle_outline.png
new file mode 100644
index 00000000..ad0ac830
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_content_add_circle_outline.png differ
diff --git a/res/drawable-xxhdpi/ic_action_image_edit.png b/res/drawable-xxhdpi/ic_action_image_edit.png
new file mode 100644
index 00000000..d3674e7b
Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_image_edit.png differ
diff --git a/res/drawable-xxhdpi/ic_drawer.png b/res/drawable-xxhdpi/ic_drawer.png
new file mode 100644
index 00000000..c10211e2
Binary files /dev/null and b/res/drawable-xxhdpi/ic_drawer.png differ
diff --git a/res/drawable/button_round.xml b/res/drawable/button_round.xml
new file mode 100644
index 00000000..d90b94fe
--- /dev/null
+++ b/res/drawable/button_round.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/drawer_header.jpeg b/res/drawable/drawer_header.jpeg
new file mode 100644
index 00000000..58ff6468
Binary files /dev/null and b/res/drawable/drawer_header.jpeg differ
diff --git a/res/drawable/drawer_header_noscale.xml b/res/drawable/drawer_header_noscale.xml
new file mode 100644
index 00000000..b9c87071
--- /dev/null
+++ b/res/drawable/drawer_header_noscale.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/res/layout/activity_device.xml b/res/layout/activity_device.xml
index 77e2899e..40c1c30e 100644
--- a/res/layout/activity_device.xml
+++ b/res/layout/activity_device.xml
@@ -3,11 +3,7 @@
android:id="@+id/buttons_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
+ android:layout_margin="16dip"
android:fillViewport="true"
- android:divider="@null"
- tools:context=".MainActivity"
+ tools:context=".DeviceActivity"
/>
\ No newline at end of file
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index 996dc57c..75a946aa 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -2,10 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
+ android:layout_margin="16dip"
tools:context=".MainActivity"
android:id="@+id/listView1"
android:addStatesFromChildren="true"
diff --git a/res/layout/activity_material.xml b/res/layout/activity_material.xml
new file mode 100644
index 00000000..1bd34f30
--- /dev/null
+++ b/res/layout/activity_material.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/fragment_material.xml b/res/layout/fragment_material.xml
new file mode 100644
index 00000000..27d16d3c
--- /dev/null
+++ b/res/layout/fragment_material.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/res/layout/fragment_navigation_drawer.xml b/res/layout/fragment_navigation_drawer.xml
new file mode 100644
index 00000000..012abef5
--- /dev/null
+++ b/res/layout/fragment_navigation_drawer.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/list_item_with_button_entry.xml b/res/layout/list_item_with_button_entry.xml
new file mode 100644
index 00000000..a14808c7
--- /dev/null
+++ b/res/layout/list_item_with_button_entry.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/list_item_with_icon_entry.xml b/res/layout/list_item_with_icon_entry.xml
new file mode 100644
index 00000000..b74f3b33
--- /dev/null
+++ b/res/layout/list_item_with_icon_entry.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/nav_header.xml b/res/layout/nav_header.xml
new file mode 100644
index 00000000..318cd4ba
--- /dev/null
+++ b/res/layout/nav_header.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/menu/global.xml b/res/menu/global.xml
new file mode 100644
index 00000000..cd0fedf0
--- /dev/null
+++ b/res/menu/global.xml
@@ -0,0 +1,5 @@
+
diff --git a/res/menu/new_pairing.xml b/res/menu/new_pairing.xml
new file mode 100644
index 00000000..4f0b81e4
--- /dev/null
+++ b/res/menu/new_pairing.xml
@@ -0,0 +1,36 @@
+
diff --git a/res/menu/refresh.xml b/res/menu/refresh.xml
new file mode 100644
index 00000000..6a190719
--- /dev/null
+++ b/res/menu/refresh.xml
@@ -0,0 +1,20 @@
+
diff --git a/res/values-w820dp/dimens.xml b/res/values-w820dp/dimens.xml
new file mode 100644
index 00000000..63fc8164
--- /dev/null
+++ b/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/res/values/colors.xml b/res/values/colors.xml
new file mode 100644
index 00000000..d7f48fea
--- /dev/null
+++ b/res/values/colors.xml
@@ -0,0 +1,14 @@
+
+
+ #CC000000
+
+
+ #ED1C24
+ #CC0000
+ #B3E5FC
+ #ED1C24
+ #ffffff
+ #ffffff
+ #FFFFFF
+ #B6B6B6
+
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 47c82246..a4dbefe9 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -2,4 +2,13 @@
16dp
16dp
+
+
+ 320dp
+
+
+
+16dp256dp
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c1283422..a0bea8be 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -125,6 +125,8 @@
Invalid device name
Received text, saved to clipboard
Custom device list
+ Pair a new device
+ Unpair %s
Add devices by IP
Noisy notifications
Vibrate and play a sound when receiving a file
@@ -141,5 +143,8 @@
No players found
Use this option only if your device is not automatically detected. Enter IP address or hostname below and touch the button to add it to the list. Touch an existing item to remove it from the list.
%1$s on %2$s
+ Send files
+
+ KDE Connect Devices
diff --git a/res/values/strings_nou.xml b/res/values/strings_nou.xml
new file mode 100644
index 00000000..71252aad
--- /dev/null
+++ b/res/values/strings_nou.xml
@@ -0,0 +1,6 @@
+
+
+ Open navigation drawer
+ Close navigation drawer
+
+
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 5301f8d5..d7928471 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -1,7 +1,22 @@
+ #3daee9
+ #318bba
+ #4ebffa
-
+
+
diff --git a/res/values/styles_nou.xml b/res/values/styles_nou.xml
new file mode 100644
index 00000000..3ec0a804
--- /dev/null
+++ b/res/values/styles_nou.xml
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/src/org/kde/kdeconnect/NewUserInterface/DeviceFragment.java b/src/org/kde/kdeconnect/NewUserInterface/DeviceFragment.java
new file mode 100644
index 00000000..7299d7d9
--- /dev/null
+++ b/src/org/kde/kdeconnect/NewUserInterface/DeviceFragment.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright 2014 Albert Vaca Cintora
+ *
+ * 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 .
+*/
+
+package org.kde.kdeconnect.NewUserInterface;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+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.NewUserInterface.List.PluginItem;
+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.SmallEntryItem;
+import org.kde.kdeconnect.UserInterface.List.TextItem;
+import org.kde.kdeconnect.UserInterface.SettingsActivity;
+import org.kde.kdeconnect_tp.R;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ConcurrentModificationException;
+
+
+/**
+ * Main view. Displays the current device and its plugins
+ */
+
+public class DeviceFragment extends Fragment {
+ /**
+ * The fragment argument representing the section number for this
+ * fragment.
+ */
+ private static final String ARG_DEVICE_ID = "deviceId";
+ private View rootView;
+ static private String mDeviceId; //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;
+
+ private TextView errorHeader;
+ private Activity mActivity;
+
+ public DeviceFragment(String deviceId) {
+ Bundle args = new Bundle();
+ args.putString(ARG_DEVICE_ID, deviceId);
+ this.setArguments(args);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ mActivity = getActivity();
+
+ rootView = inflater.inflate(R.layout.activity_device, container, false);
+
+ String deviceId = getArguments().getString(ARG_DEVICE_ID);
+ if (deviceId != null) {
+ mDeviceId = deviceId;
+ }
+
+ Log.e("DeviceFragment","device: " +deviceId);
+
+ BackgroundService.RunCommand(mActivity, new BackgroundService.InstanceCallback() {
+ @Override
+ public void onServiceStart(BackgroundService service) {
+ device = service.getDevice(mDeviceId);
+ if (device == null) return;
+ mActivity.setTitle(device.getName());
+ device.addPluginsChangedListener(pluginsChangedListener);
+ pluginsChangedListener.onPluginsChanged(device);
+ if (!device.hasPluginsLoaded()) {
+ device.reloadPluginsFromSettings();
+ }
+ }
+ });
+
+
+
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ }
+
+ private final Device.PluginsChangedListener pluginsChangedListener = new Device.PluginsChangedListener() {
+ @Override
+ public void onPluginsChanged(final Device device) {
+
+ mActivity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+
+ try {
+ ArrayList items = new ArrayList();
+
+ if (!device.isReachable()) {
+ //Not reachable, show unpair button
+ Button b = new Button(mActivity);
+ 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 plugins = device.getLoadedPlugins().values();
+ for (final Plugin p : plugins) {
+ if (!p.hasMainActivity()) continue;
+ if (p.displayInContextMenu()) continue;
+
+ items.add(new PluginItem(p, new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ p.startMainActivity(mActivity);
+ }
+ }));
+ }
+
+ //Failed plugins List
+ final Collection failed = device.getFailedPlugins().values();
+ if (!failed.isEmpty()) {
+ if (errorHeader == null) {
+ errorHeader = new TextView(mActivity);
+ 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(mActivity).show();
+ }
+ }));
+ }
+ }
+ }
+
+ ListView buttonsList = (ListView) rootView.findViewById(R.id.buttons_list);
+ ListAdapter adapter = new ListAdapter(mActivity, items);
+ buttonsList.setAdapter(adapter);
+
+ } catch (ConcurrentModificationException e) {
+ Log.e("DeviceActivity", "ConcurrentModificationException");
+ this.run(); //Try again
+ }
+
+ }
+ });
+
+ }
+ };
+
+ @Override
+ public void onDestroyView() {
+ BackgroundService.RunCommand(mActivity, new BackgroundService.InstanceCallback() {
+ @Override
+ public void onServiceStart(BackgroundService service) {
+ Device device = service.getDevice(mDeviceId);
+ if (device == null) return;
+ device.removePluginsChangedListener(pluginsChangedListener);
+ }
+ });
+ super.onDestroyView();
+ }
+
+ @Override
+ public void onPrepareOptionsMenu(Menu menu) {
+
+ super.onPrepareOptionsMenu(menu);
+ menu.clear();
+
+ if (device == null || !device.isPaired()) {
+ return;
+ }
+
+ //Plugins button list
+ final Collection plugins = device.getLoadedPlugins().values();
+ for (final Plugin p : plugins) {
+ if (!p.displayInContextMenu()) {
+ continue;
+ }
+ menu.add(p.getActionName()).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ p.startMainActivity(mActivity);
+ return true;
+ }
+ });
+ }
+
+ menu.add(R.string.device_menu_plugins).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem menuItem) {
+ Intent intent = new Intent(mActivity, SettingsActivity.class);
+ intent.putExtra("deviceId", mDeviceId);
+ 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;
+ }
+ });
+
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ switch (requestCode)
+ {
+ case RESULT_NEEDS_RELOAD:
+ BackgroundService.RunCommand(mActivity, new BackgroundService.InstanceCallback() {
+ @Override
+ public void onServiceStart(BackgroundService service) {
+ Device device = service.getDevice(mDeviceId);
+ device.reloadPluginsFromSettings();
+ }
+ });
+
+ break;
+ default:
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+ }
+
+}
diff --git a/src/org/kde/kdeconnect/NewUserInterface/List/MaterialDeviceItem.java b/src/org/kde/kdeconnect/NewUserInterface/List/MaterialDeviceItem.java
new file mode 100644
index 00000000..6173cd47
--- /dev/null
+++ b/src/org/kde/kdeconnect/NewUserInterface/List/MaterialDeviceItem.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2014 Albert Vaca Cintora
+ *
+ * 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 .
+*/
+
+package org.kde.kdeconnect.NewUserInterface.List;
+
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.graphics.PorterDuff;
+import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.kde.kdeconnect.Device;
+import org.kde.kdeconnect.NewUserInterface.NavigationDrawerFragment;
+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;
+
+public class MaterialDeviceItem implements ListAdapter.Item {
+
+ private final Device device;
+ private final Activity activity;
+ private final NavigationDrawerFragment.NavigationDrawerCallbacks callback;
+ private TextView titleView;
+ private ImageView icon;
+ private View rootView;
+
+ public MaterialDeviceItem(Activity activity, Device device, NavigationDrawerFragment.NavigationDrawerCallbacks callback) {
+ this.device = device;
+ this.activity = activity;
+ this.callback = callback;
+ }
+
+ @Override
+ public View inflateView(LayoutInflater layoutInflater) {
+ rootView = layoutInflater.inflate(R.layout.list_item_with_icon_entry, null);
+
+ icon = (ImageView)rootView.findViewById(R.id.list_item_entry_icon);
+ icon.setImageDrawable(device.getIcon());
+
+ titleView = (TextView)rootView.findViewById(R.id.list_item_entry_title);
+ titleView.setText(device.getName());
+
+ if (device.compareProtocolVersion() != 0) {
+ TextView summaryView = (TextView)rootView.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 {
+ rootView.findViewById(R.id.list_item_entry_summary).setVisibility(View.GONE);
+ }
+
+ rootView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent;
+ if (device.isPaired()) {
+ //intent = new Intent(activity, DeviceActivity.class);
+ //intent.putExtra("deviceId", device.getDeviceId());
+ //activity.startActivity(intent);
+ setSelected(true);
+ callback.onDeviceSelected(device);
+ } else {
+ intent = new Intent(activity, PairActivity.class);
+ intent.putExtra("deviceId", device.getDeviceId());
+ activity.startActivity(intent);
+ }
+
+
+ }
+ });
+
+ return rootView;
+ }
+
+ void setSelected(boolean b) {
+ Resources r = activity.getResources();
+ if (b) {
+ titleView.setTextColor(r.getColor(R.color.primaryDark));
+ titleView.setTypeface(Typeface.DEFAULT_BOLD);
+ } else {
+ titleView.setTextColor(r.getColor(android.R.color.black));
+ titleView.setTypeface(Typeface.DEFAULT);
+ }
+
+ Drawable drawable = device.getIcon();
+ drawable.setColorFilter(r.getColor(R.color.primaryDark), PorterDuff.Mode.SRC_ATOP);
+ icon.setImageDrawable(drawable);
+ }
+
+}
diff --git a/src/org/kde/kdeconnect/NewUserInterface/List/PairingDeviceItem.java b/src/org/kde/kdeconnect/NewUserInterface/List/PairingDeviceItem.java
new file mode 100644
index 00000000..8ea7d556
--- /dev/null
+++ b/src/org/kde/kdeconnect/NewUserInterface/List/PairingDeviceItem.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2014 Albert Vaca Cintora
+ *
+ * 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 .
+*/
+
+package org.kde.kdeconnect.NewUserInterface.List;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.kde.kdeconnect.Device;
+import org.kde.kdeconnect.UserInterface.List.ListAdapter;
+import org.kde.kdeconnect.UserInterface.PairActivity;
+import org.kde.kdeconnect_tp.R;
+
+public class PairingDeviceItem implements ListAdapter.Item {
+
+ private final Device device;
+ private final Activity activity;
+ private TextView titleView;
+ private ImageView icon;
+
+ public PairingDeviceItem(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_with_button_entry, null);
+
+ icon = (ImageView)v.findViewById(R.id.list_item_entry_icon);
+ icon.setImageDrawable(device.getIcon());
+
+ titleView = (TextView)v.findViewById(R.id.list_item_entry_title);
+ 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);
+ }
+
+ Button b = (Button)v.findViewById(R.id.entry_pair_button);
+ b.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent;
+ /*if (device.isPaired()) {
+ //intent = new Intent(activity, DeviceActivity.class);
+ //intent.putExtra("deviceId", device.getDeviceId());
+ //activity.startActivity(intent);
+ //callback.onDeviceSelected(device);
+ } else {
+ intent = new Intent(activity, PairActivity.class);
+ intent.putExtra("deviceId", device.getDeviceId());
+ activity.startActivity(intent);
+ }*/
+
+
+ }
+ });
+
+ return v;
+ }
+
+}
diff --git a/src/org/kde/kdeconnect/NewUserInterface/List/PluginItem.java b/src/org/kde/kdeconnect/NewUserInterface/List/PluginItem.java
new file mode 100644
index 00000000..9b8b7d94
--- /dev/null
+++ b/src/org/kde/kdeconnect/NewUserInterface/List/PluginItem.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2014 Albert Vaca Cintora
+ *
+ * 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 .
+*/
+
+package org.kde.kdeconnect.NewUserInterface.List;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.kde.kdeconnect.Plugins.Plugin;
+import org.kde.kdeconnect.UserInterface.List.ListAdapter;
+import org.kde.kdeconnect_tp.R;
+
+public class PluginItem implements ListAdapter.Item {
+
+ private final Plugin plugin;
+ private final View.OnClickListener clickListener;
+
+ public PluginItem(Plugin p, View.OnClickListener clickListener) {
+ this.plugin = p;
+ this.clickListener = clickListener;
+ }
+
+
+ @Override
+ public View inflateView(final LayoutInflater layoutInflater) {
+ View v = layoutInflater.inflate(R.layout.list_item_with_icon_entry, null);
+
+ TextView titleView = (TextView)v.findViewById(R.id.list_item_entry_title);
+ titleView.setText(plugin.getActionName());
+
+ ImageView imageView = (ImageView)v.findViewById(R.id.list_item_entry_icon);
+ imageView.setImageDrawable(plugin.getIcon());
+
+ v.setOnClickListener(clickListener);
+
+ return v;
+ }
+
+}
diff --git a/src/org/kde/kdeconnect/NewUserInterface/MaterialActivity.java b/src/org/kde/kdeconnect/NewUserInterface/MaterialActivity.java
new file mode 100644
index 00000000..8d53b1c1
--- /dev/null
+++ b/src/org/kde/kdeconnect/NewUserInterface/MaterialActivity.java
@@ -0,0 +1,193 @@
+package org.kde.kdeconnect.NewUserInterface;
+
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.design.widget.NavigationView;
+import android.support.v4.app.Fragment;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.TextView;
+
+import org.kde.kdeconnect.BackgroundService;
+import org.kde.kdeconnect.Device;
+import org.kde.kdeconnect.UserInterface.MainSettingsActivity;
+import org.kde.kdeconnect_tp.R;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+public class MaterialActivity extends AppCompatActivity {
+
+ private static final String STATE_SELECTED_DEVICE = "selected_device";
+
+ private NavigationView mNavigationView;
+ private DrawerLayout mDrawerLayout;
+
+ private String mCurrentDevice;
+
+ HashMap