[Libreoffice-commits] core.git: Branch 'feature/android-remote-ng' - 5 commits - android/sdremote

Artur Dryomov artur.dryomov at gmail.com
Tue Jul 2 14:07:30 PDT 2013


 android/sdremote/AndroidManifest.xml                                                       |   79 ++-
 android/sdremote/res/drawable-hdpi/actionbar_tab_selected.9.png                            |binary
 android/sdremote/res/drawable-hdpi/actionbar_tab_selected_pressed.9.png                    |binary
 android/sdremote/res/drawable-hdpi/actionbar_tab_unselected.9.png                          |binary
 android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected.9.png                       |binary
 android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected_pressed.9.png               |binary
 android/sdremote/res/drawable-land-hdpi/actionbar_tab_unselected.9.png                     |binary
 android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected.9.png                       |binary
 android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected_pressed.9.png               |binary
 android/sdremote/res/drawable-land-mdpi/actionbar_tab_unselected.9.png                     |binary
 android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected.9.png                      |binary
 android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected_pressed.9.png              |binary
 android/sdremote/res/drawable-land-xhdpi/actionbar_tab_unselected.9.png                    |binary
 android/sdremote/res/drawable-mdpi/actionbar_tab_selected.9.png                            |binary
 android/sdremote/res/drawable-mdpi/actionbar_tab_selected_pressed.9.png                    |binary
 android/sdremote/res/drawable-mdpi/actionbar_tab_unselected.9.png                          |binary
 android/sdremote/res/drawable-xhdpi/actionbar_tab_selected.9.png                           |binary
 android/sdremote/res/drawable-xhdpi/actionbar_tab_selected_pressed.9.png                   |binary
 android/sdremote/res/drawable-xhdpi/actionbar_tab_unselected.9.png                         |binary
 android/sdremote/res/drawable/actionbar_tab.xml                                            |   26 +
 android/sdremote/res/drawable/ic_logo.png                                                  |binary
 android/sdremote/res/layout/activity_licenses.xml                                          |    5 
 android/sdremote/res/layout/dialog_about.xml                                               |    2 
 android/sdremote/res/layout/list_item.xml                                                  |    8 
 android/sdremote/res/menu/menu_action_bar_computers.xml                                    |    9 
 android/sdremote/res/values-v10/styles.xml                                                 |   18 
 android/sdremote/res/values/colors.xml                                                     |   17 
 android/sdremote/res/values/dimens.xml                                                     |    8 
 android/sdremote/res/values/strings.xml                                                    |   11 
 android/sdremote/res/values/styles.xml                                                     |   80 ---
 android/sdremote/res/values/themes.xml                                                     |   46 ++
 android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java               |   46 ++
 android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java                  |   83 +++
 android/sdremote/src/org/libreoffice/impressremote/ComputersAdapter.java                   |   65 +++
 android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java                  |  214 ++++++++++
 android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java                   |   59 ++
 android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java |   12 
 android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java     |   10 
 android/sdremote/src/org/libreoffice/impressremote/communication/Server.java               |    2 
 dev/null                                                                                   |binary
 40 files changed, 659 insertions(+), 141 deletions(-)

New commits:
commit 79fd6337975f993379f6a1fe7adb583f425844a2
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Tue Jul 2 23:37:04 2013 +0300

    Add the licenses activity for showing open source licenses.
    
    Change-Id: I2198cea9ef27cfbdf760a8da41e0c7af8e04f20e

diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index f85e1df..36064da 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -63,6 +63,11 @@
             android:label="@string/reconnect">
         </activity>
 
+        <activity
+            android:name=".LicensesActivity"
+            android:label="@string/title_licenses">
+        </activity>
+
         <service
             android:name=".communication.CommunicationService"
             android:label="@string/startpresentation_title">
diff --git a/android/sdremote/res/layout/activity_licenses.xml b/android/sdremote/res/layout/activity_licenses.xml
new file mode 100644
index 0000000..5bc5886
--- /dev/null
+++ b/android/sdremote/res/layout/activity_licenses.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WebView xmlns:android="http://schemas.android.com/apk/res/android"
+         android:id="@+id/view_licenses"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"/>
\ No newline at end of file
diff --git a/android/sdremote/res/menu/menu_action_bar_computers.xml b/android/sdremote/res/menu/menu_action_bar_computers.xml
new file mode 100644
index 0000000..ee7cfb8
--- /dev/null
+++ b/android/sdremote/res/menu/menu_action_bar_computers.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item
+        android:id="@+id/menu_licenses"
+        android:title="@string/menu_licenses"
+        android:showAsAction="never"/>
+
+</menu>
\ No newline at end of file
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 981b6f1..865067d 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -68,5 +68,8 @@
     <string name="title_computers">Computers</string>
     <string name="title_bluetooth" translatable="false">Bluetooth</string>
     <string name="title_wifi" translatable="false">WiFi</string>
+    <string name="title_licenses">Open source licenses</string>
+
+    <string name="menu_licenses">Open source licenses</string>
 
 </resources>
diff --git a/android/sdremote/res/values/themes.xml b/android/sdremote/res/values/themes.xml
index d53ae53..2dcde14 100644
--- a/android/sdremote/res/values/themes.xml
+++ b/android/sdremote/res/values/themes.xml
@@ -14,6 +14,9 @@
     <style name="Theme.ImpressRemote.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
         <item name="android:background">@color/background_action_bar</item>
         <item name="background">@color/background_action_bar</item>
+
+        <item name="android:displayOptions">showTitle|showHome|homeAsUp|useLogo</item>
+        <item name="displayOptions">showTitle|showHome|homeAsUp|useLogo</item>
     </style>
 
     <style name="Theme.ImpressRemote.ActionBar.Tab" parent="Widget.Sherlock.Light.ActionBar.TabView.Inverse">
@@ -29,6 +32,9 @@
     <style name="Theme.ImpressRemote.Computers.ActionBar" parent="Theme.ImpressRemote.ActionBar">
         <item name="android:navigationMode">tabMode</item>
         <item name="navigationMode">tabMode</item>
+
+        <item name="android:displayOptions">showTitle|showHome|useLogo</item>
+        <item name="displayOptions">showTitle|showHome|useLogo</item>
     </style>
 
     <style name="Theme.ImpressRemote.ActionBarWidget" parent="android:style/Widget.Holo.Light">
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
index e4e9d5f..0a5ea2f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
@@ -8,11 +8,14 @@
  */
 package org.libreoffice.impressremote;
 
+import android.content.Intent;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 
 import com.actionbarsherlock.app.ActionBar;
 import com.actionbarsherlock.app.SherlockFragmentActivity;
+import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuItem;
 
 public class ComputersActivity extends SherlockFragmentActivity {
     @Override
@@ -51,6 +54,30 @@ public class ComputersActivity extends SherlockFragmentActivity {
 
         return buildActionBarTab(aFragment, R.string.title_wifi);
     }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu aMenu) {
+        getSupportMenuInflater().inflate(R.menu.menu_action_bar_computers, aMenu);
+
+        return true;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem aMenuItem) {
+        switch (aMenuItem.getItemId()) {
+            case R.id.menu_licenses:
+                callLicensesActivity();
+                return true;
+
+            default:
+                return super.onOptionsItemSelected(aMenuItem);
+        }
+    }
+
+    private void callLicensesActivity() {
+        Intent aIntent = new Intent(this, LicensesActivity.class);
+        startActivity(aIntent);
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java b/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java
new file mode 100644
index 0000000..ae97c2f
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/LicensesActivity.java
@@ -0,0 +1,59 @@
+package org.libreoffice.impressremote;
+
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.NavUtils;
+import android.webkit.WebView;
+
+import com.actionbarsherlock.app.SherlockActivity;
+import com.actionbarsherlock.view.MenuItem;
+
+public class LicensesActivity extends SherlockActivity {
+    private static final String SCHEME = ContentResolver.SCHEME_FILE;
+    private static final String AUTHORITY = "android_asset";
+    private static final String PATH = "licenses.html";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_licenses);
+
+        setUpHomeButton();
+
+        setUpLicenses();
+    }
+
+    private void setUpHomeButton() {
+        getSupportActionBar().setHomeButtonEnabled(true);
+    }
+
+    private void setUpLicenses() {
+        getLicensesView().loadUrl(buildLicensesUri());
+    }
+
+    private WebView getLicensesView() {
+        return (WebView) findViewById(R.id.view_licenses);
+    }
+
+    private String buildLicensesUri() {
+        return String.format("%s:///%s/%s", SCHEME, AUTHORITY, PATH);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem aMenuItem) {
+        switch (aMenuItem.getItemId()) {
+            case android.R.id.home:
+                navigateUp();
+                return true;
+
+            default:
+                return super.onOptionsItemSelected(aMenuItem);
+        }
+        }
+
+    private void navigateUp() {
+        Intent aIntent = new Intent(this, ComputersActivity.class);
+        NavUtils.navigateUpTo(this, aIntent);
+    }
+}
commit d19ea892cf4cd38144d35cc5757fef7fd07f190b
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Tue Jul 2 22:10:13 2013 +0300

    Add basic functionality of displaying servers list to the new UI.
    
    Change-Id: I1df9d85d7c03884c9572a33957232edc576c9965

diff --git a/android/sdremote/res/layout/list_item.xml b/android/sdremote/res/layout/list_item.xml
new file mode 100644
index 0000000..275b9ba
--- /dev/null
+++ b/android/sdremote/res/layout/list_item.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+          android:singleLine="true"
+          android:textSize="@dimen/text_size_list_item"
+          android:gravity="center_vertical"
+          android:padding="@dimen/padding_horizontal_list_item"
+          android:layout_width="fill_parent"
+          android:layout_height="?android:attr/listPreferredItemHeight" />
\ No newline at end of file
diff --git a/android/sdremote/res/values/dimens.xml b/android/sdremote/res/values/dimens.xml
new file mode 100644
index 0000000..61f9ded
--- /dev/null
+++ b/android/sdremote/res/values/dimens.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <dimen name="padding_horizontal_list_item">8dp</dimen>
+
+    <dimen name="text_size_list_item">18sp</dimen>
+
+</resources>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
index 4675ca1..e4e9d5f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
@@ -30,7 +30,8 @@ public class ComputersActivity extends SherlockFragmentActivity {
     }
 
     private ActionBar.Tab buildBluetoothServersTab() {
-        ComputersFragment aFragment = ComputersFragment.newInstance();
+        ComputersFragment aFragment = ComputersFragment.newInstance(
+            ComputersFragment.Type.BLUETOOTH);
 
         return buildActionBarTab(aFragment, R.string.title_bluetooth);
     }
@@ -45,7 +46,8 @@ public class ComputersActivity extends SherlockFragmentActivity {
     }
 
     private ActionBar.Tab buildWiFiServersTab() {
-        ComputersFragment aFragment = ComputersFragment.newInstance();
+        ComputersFragment aFragment = ComputersFragment.newInstance(
+            ComputersFragment.Type.WIFI);
 
         return buildActionBarTab(aFragment, R.string.title_wifi);
     }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersAdapter.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersAdapter.java
new file mode 100644
index 0000000..f3080f1
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersAdapter.java
@@ -0,0 +1,65 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.libreoffice.impressremote;
+
+import java.util.List;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import org.libreoffice.impressremote.communication.Server;
+
+public class ComputersAdapter extends ArrayAdapter<Server> {
+    private final LayoutInflater mLayoutInflater;
+
+    public ComputersAdapter(Context aContext) {
+        super(aContext, R.layout.list_item);
+
+        mLayoutInflater = (LayoutInflater) aContext
+            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+    }
+
+    @Override
+    public View getView(int aPosition, View aConvertView, ViewGroup aParentViewGroup) {
+        TextView aListItem = (TextView) getView(aConvertView, aParentViewGroup);
+
+        aListItem.setText(buildListItemText(aPosition));
+
+        return aListItem;
+    }
+
+    private View getView(View aConvertView, ViewGroup aParentViewGroup) {
+        if (aConvertView != null) {
+            return aConvertView;
+        }
+
+        return mLayoutInflater
+            .inflate(R.layout.list_item, aParentViewGroup, false);
+    }
+
+    private String buildListItemText(int aPosition) {
+        return getItem(aPosition).getName();
+    }
+
+    public void add(List<Server> aServers) {
+        setNotifyOnChange(false);
+
+        for (Server aServer : aServers) {
+            add(aServer);
+        }
+
+        notifyDataSetChanged();
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
index 1e1d59d..b776af5 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
@@ -8,11 +8,206 @@
  */
 package org.libreoffice.impressremote;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.support.v4.content.LocalBroadcastManager;
+
 import com.actionbarsherlock.app.SherlockListFragment;
+import org.libreoffice.impressremote.communication.CommunicationService;
+import org.libreoffice.impressremote.communication.Server;
+
+public class ComputersFragment extends SherlockListFragment implements ServiceConnection {
+    public static enum Type {
+        WIFI, BLUETOOTH
+    }
+
+    private Type mType;
+
+    private CommunicationService mCommunicationService;
+    private BroadcastReceiver mIntentsReceiver;
+
+    public static ComputersFragment newInstance(Type aType) {
+        ComputersFragment aFragment = new ComputersFragment();
+
+        aFragment.setArguments(buildArguments(aType));
+
+        return aFragment;
+    }
+
+    private static Bundle buildArguments(Type aType) {
+        Bundle aArguments = new Bundle();
+
+        aArguments.putSerializable("TYPE", aType);
+
+        return aArguments;
+    }
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        mType = (Type) getArguments().getSerializable("TYPE");
+    }
+
+    @Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+
+        bindService();
+    }
+
+    private void bindService() {
+        Intent aServiceIntent = new Intent(getActivity(), CommunicationService.class);
+
+        getActivity().bindService(aServiceIntent, this, Context.BIND_AUTO_CREATE);
+    }
+
+    @Override
+    public void onServiceConnected(ComponentName aComponentName, IBinder aBinder) {
+        CommunicationService.CBinder aServiceBinder = (CommunicationService.CBinder) aBinder;
+
+        mCommunicationService = aServiceBinder.getService();
+
+        mCommunicationService.startSearch();
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+
+        unbindService();
+    }
+
+    private void unbindService() {
+        if (!isServiceBound()) {
+            return;
+        }
+
+        getActivity().unbindService(this);
+    }
+
+    private boolean isServiceBound() {
+        return mCommunicationService != null;
+    }
+
+    @Override
+    public void onServiceDisconnected(ComponentName aComponentName) {
+        mCommunicationService = null;
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+
+        registerIntentsReceiver();
+    }
+
+    private void registerIntentsReceiver() {
+        mIntentsReceiver = new IntentsReceiver(this);
+        IntentFilter aIntentFilter = buildIntentsReceiverFilter();
+
+        LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mIntentsReceiver, aIntentFilter);
+    }
+
+    private static final class IntentsReceiver extends BroadcastReceiver {
+        private final ComputersFragment mComputersFragment;
+
+        public IntentsReceiver(ComputersFragment aComputersFragment) {
+            mComputersFragment = aComputersFragment;
+        }
+
+        @Override
+        public void onReceive(Context aContext, Intent aIntent) {
+            if (CommunicationService.MSG_SERVERLIST_CHANGED.equals(aIntent.getAction())) {
+                mComputersFragment.loadComputers();
+            }
+        }
+    }
+
+    private IntentFilter buildIntentsReceiverFilter() {
+        IntentFilter aIntentFilter = new IntentFilter();
+        aIntentFilter.addAction(CommunicationService.MSG_SERVERLIST_CHANGED);
+
+        return aIntentFilter;
+    }
+
+    public void loadComputers() {
+        if (!isServiceBound()) {
+            return;
+        }
+
+        if (getComputers().isEmpty()) {
+            return;
+        }
+
+        if (!isComputersAdapterExist()) {
+            setUpComputersAdapter();
+        }
+
+        getComputersAdapter().clear();
+        getComputersAdapter().add(getComputers());
+    }
+
+    private boolean isComputersAdapterExist() {
+        return getComputersAdapter() != null;
+    }
+
+    private ComputersAdapter getComputersAdapter() {
+        return (ComputersAdapter) getListAdapter();
+    }
+
+    private void setUpComputersAdapter() {
+        setListAdapter(new ComputersAdapter(getActivity()));
+    }
+
+    private List<Server> getComputers() {
+        List<Server> aComputers = new ArrayList<Server>();
+
+        for (Server aServer : mCommunicationService.getServers()) {
+            if (isComputerSupportsRequiredType(aServer)) {
+                aComputers.add(aServer);
+            }
+        }
+
+        return aComputers;
+    }
+
+    private boolean isComputerSupportsRequiredType(Server aServer) {
+        switch (mType) {
+            case WIFI:
+                return aServer.getProtocol() == Server.Protocol.TCP;
+
+            case BLUETOOTH:
+                return aServer.getProtocol() == Server.Protocol.BLUETOOTH;
+
+            default:
+                return false;
+        }
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+
+        unregisterIntentsReceiver();
+    }
 
-public class ComputersFragment extends SherlockListFragment {
-    public static ComputersFragment newInstance() {
-        return new ComputersFragment();
+    private void unregisterIntentsReceiver() {
+        try {
+            getActivity().unregisterReceiver(mIntentsReceiver);
+        } catch (IllegalArgumentException e) {
+            // Receiver not registered.
+            // Fixed in Honeycomb: Android’s issue #6191.
+        }
     }
 }
 
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
index c523f61..f51e352 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
@@ -36,7 +36,7 @@ public class Server implements Parcelable {
         this.mTimeDiscovered = aTimeDiscovered;
     }
 
-    protected Server(Protocol aProtocol, String aAddress, String aName) {
+    public Server(Protocol aProtocol, String aAddress, String aName) {
         this.mProtocol = aProtocol;
         this.mAddress = aAddress;
         this.mName = aName;
commit dbc856d9ea68bd0fb9d7d1532fe72b5467666c91
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Tue Jul 2 22:07:57 2013 +0300

    Remove preference requirement for TCP servers search.
    
    Change-Id: I4305ccedd487f39ea3ec1a765f55c55aff096fd1

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 8678286..7718d39 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -203,16 +203,16 @@ public class CommunicationService extends Service implements Runnable, MessagesL
     }
 
     public void startSearch() {
-        SharedPreferences aPref = PreferenceManager
-            .getDefaultSharedPreferences(this);
-        boolean bEnableWifi = aPref.getBoolean("option_enablewifi", false);
-        if (bEnableWifi)
-            mTcpServersFinder.startSearch();
+        mTcpServersFinder.startSearch();
+
         BluetoothAdapter aAdapter = BluetoothAdapter.getDefaultAdapter();
         if (aAdapter != null) {
             mBluetoothPreviouslyEnabled = aAdapter.isEnabled();
-            if (!mBluetoothPreviouslyEnabled)
+
+            if (!mBluetoothPreviouslyEnabled) {
                 aAdapter.enable();
+            }
+
             mBluetoothServersFinder.startSearch();
         }
     }
commit 6226220b36a1e02f90d9ee250c898390d77ec41b
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Tue Jul 2 19:04:09 2013 +0300

    Add missed copyrights.
    
    Change-Id: I3b750e853fc74a19329236e186ee05fd31ee77cc

diff --git a/android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java b/android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java
index 0271dce..66e15b9 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java
@@ -1,3 +1,11 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 package org.libreoffice.impressremote;
 
 import android.support.v4.app.Fragment;
@@ -34,3 +42,5 @@ public class ActionBarTabListener implements ActionBar.TabListener {
     public void onTabReselected(ActionBar.Tab aTab, FragmentTransaction aFragmentTransaction) {
     }
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
index 3b60187..4675ca1 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
@@ -1,3 +1,11 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 package org.libreoffice.impressremote;
 
 import android.os.Bundle;
@@ -42,3 +50,5 @@ public class ComputersActivity extends SherlockFragmentActivity {
         return buildActionBarTab(aFragment, R.string.title_wifi);
     }
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
index e411aa7..1e1d59d 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
@@ -1,3 +1,11 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 package org.libreoffice.impressremote;
 
 import com.actionbarsherlock.app.SherlockListFragment;
@@ -7,3 +15,5 @@ public class ComputersFragment extends SherlockListFragment {
         return new ComputersFragment();
     }
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java b/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java
index 7bc098b..ffad6b9 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/MessagesListener.java
@@ -1,3 +1,11 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 package org.libreoffice.impressremote.communication;
 
 public interface MessagesListener {
@@ -15,3 +23,5 @@ public interface MessagesListener {
 
     public void onSlideNotes(int aSlideIndex, String aNotes);
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 17cd08b17515d0553c530b168c28cac2c0b5dae5
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Tue Jul 2 17:20:08 2013 +0300

    Change the UI to a new look.
    
    * Change action bar color to a more Impress- and Holo-consistent one.
    * Clear used styles.
    * Optimize manifest.
    * Add computers lists activity with proper styling of tabs in landscape
      and portrait modes.
    
    Change-Id: Ie0a5ac15866b8cacdf44c39f7a2ca806e43421a4

diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index 8eaf63d..f85e1df 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -1,67 +1,73 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="org.libreoffice.impressremote"
-    android:versionCode="8"
-    android:versionName="1.0.6+ Impress Remote"
-    android:installLocation="auto" >
+          package="org.libreoffice.impressremote"
+          android:versionCode="8"
+          android:versionName="1.0.6+ Impress Remote"
+          android:installLocation="auto">
 
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.BLUETOOTH" />
-    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
+    <uses-permission android:name="android.permission.INTERNET"/>
+    <uses-permission android:name="android.permission.BLUETOOTH"/>
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
 
     <uses-sdk
         android:minSdkVersion="10"
-        android:targetSdkVersion="14" />
+        android:targetSdkVersion="14"/>
 
     <application
+        android:label="@string/application_name"
         android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name"
-        android:theme="@style/Theme.ImpressRemote"
-        android:title="@string/app_name" >
+        android:logo="@drawable/ic_logo"
+        android:theme="@style/Theme.ImpressRemote">
+
         <activity
-            android:name=".SelectorActivity"
-            android:label="@string/selector_choose_a_computer"
-            android:logo="@drawable/actionbar_icon_computer"
-            android:title="@string/app_name"
-            android:uiOptions="splitActionBarWhenNarrow" >
-            <intent-filter android:label="@string/app_name" >
-                <action android:name="android.intent.action.MAIN" />
+            android:name=".ComputersActivity"
+            android:label="@string/title_computers"
+            android:theme="@style/Theme.ImpressRemote.Computers">
 
-                <category android:name="android.intent.category.LAUNCHER" />
+            <intent-filter android:label="@string/application_name">
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
+
         </activity>
+
         <activity
-            android:name=".PairingActivity"
-            android:icon="@drawable/actionbar_icon_computer"
-            android:logo="@drawable/actionbar_icon_computer"
-            android:noHistory="true" >
+            android:name=".SelectorActivity"
+            android:label="@string/selector_choose_a_computer"
+            android:uiOptions="splitActionBarWhenNarrow">
         </activity>
 
-        <service
-            android:name=".communication.CommunicationService"
-            android:label="@string/startpresentation_title"
-            android:logo="@drawable/actionbar_icon_computer" >
-        </service>
+        <activity
+            android:name=".PairingActivity"
+            android:noHistory="true">
+        </activity>
 
         <activity
             android:name=".StartPresentationActivity"
-            android:logo="@drawable/actionbar_icon_computer"
-            android:label="@string/startpresentation_title" >
+            android:label="@string/startpresentation_title">
         </activity>
+
         <activity
             android:name=".PresentationActivity"
-            android:label="@string/title_activity_presentation" >
+            android:label="@string/title_activity_presentation">
         </activity>
+
         <activity
             android:name=".SettingsActivity"
             android:icon="@drawable/icon_options"
-            android:label="@string/options" >
+            android:label="@string/options">
         </activity>
+
         <activity
             android:name=".communication.ReconnectionActivity"
-            android:logo="@drawable/actionbar_icon_computer"
-            android:label="@string/reconnect" >
+            android:label="@string/reconnect">
         </activity>
+
+        <service
+            android:name=".communication.CommunicationService"
+            android:label="@string/startpresentation_title">
+        </service>
+
     </application>
 
 </manifest>
diff --git a/android/sdremote/res/drawable-hdpi/actionbar_tab_selected.9.png b/android/sdremote/res/drawable-hdpi/actionbar_tab_selected.9.png
new file mode 100755
index 0000000..54eb3ef
Binary files /dev/null and b/android/sdremote/res/drawable-hdpi/actionbar_tab_selected.9.png differ
diff --git a/android/sdremote/res/drawable-hdpi/actionbar_tab_selected_pressed.9.png b/android/sdremote/res/drawable-hdpi/actionbar_tab_selected_pressed.9.png
new file mode 100755
index 0000000..5ceac2d
Binary files /dev/null and b/android/sdremote/res/drawable-hdpi/actionbar_tab_selected_pressed.9.png differ
diff --git a/android/sdremote/res/drawable-hdpi/actionbar_tab_unselected.9.png b/android/sdremote/res/drawable-hdpi/actionbar_tab_unselected.9.png
new file mode 100755
index 0000000..d2b0076
Binary files /dev/null and b/android/sdremote/res/drawable-hdpi/actionbar_tab_unselected.9.png differ
diff --git a/android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected.9.png b/android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected.9.png
new file mode 100755
index 0000000..c572c34
Binary files /dev/null and b/android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected.9.png differ
diff --git a/android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected_pressed.9.png b/android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected_pressed.9.png
new file mode 100755
index 0000000..20d9d69
Binary files /dev/null and b/android/sdremote/res/drawable-land-hdpi/actionbar_tab_selected_pressed.9.png differ
diff --git a/android/sdremote/res/drawable-land-hdpi/actionbar_tab_unselected.9.png b/android/sdremote/res/drawable-land-hdpi/actionbar_tab_unselected.9.png
new file mode 100755
index 0000000..b3e51d8
Binary files /dev/null and b/android/sdremote/res/drawable-land-hdpi/actionbar_tab_unselected.9.png differ
diff --git a/android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected.9.png b/android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected.9.png
new file mode 100755
index 0000000..b9b5da3
Binary files /dev/null and b/android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected.9.png differ
diff --git a/android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected_pressed.9.png b/android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected_pressed.9.png
new file mode 100755
index 0000000..9a63265
Binary files /dev/null and b/android/sdremote/res/drawable-land-mdpi/actionbar_tab_selected_pressed.9.png differ
diff --git a/android/sdremote/res/drawable-land-mdpi/actionbar_tab_unselected.9.png b/android/sdremote/res/drawable-land-mdpi/actionbar_tab_unselected.9.png
new file mode 100755
index 0000000..06fbcbb
Binary files /dev/null and b/android/sdremote/res/drawable-land-mdpi/actionbar_tab_unselected.9.png differ
diff --git a/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected.9.png b/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected.9.png
new file mode 100755
index 0000000..f3aac1a
Binary files /dev/null and b/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected.9.png differ
diff --git a/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected_pressed.9.png b/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected_pressed.9.png
new file mode 100755
index 0000000..f2331fa
Binary files /dev/null and b/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_selected_pressed.9.png differ
diff --git a/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_unselected.9.png b/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_unselected.9.png
new file mode 100755
index 0000000..06741ee
Binary files /dev/null and b/android/sdremote/res/drawable-land-xhdpi/actionbar_tab_unselected.9.png differ
diff --git a/android/sdremote/res/drawable-mdpi/actionbar_tab_selected.9.png b/android/sdremote/res/drawable-mdpi/actionbar_tab_selected.9.png
new file mode 100755
index 0000000..612258e
Binary files /dev/null and b/android/sdremote/res/drawable-mdpi/actionbar_tab_selected.9.png differ
diff --git a/android/sdremote/res/drawable-mdpi/actionbar_tab_selected_pressed.9.png b/android/sdremote/res/drawable-mdpi/actionbar_tab_selected_pressed.9.png
new file mode 100755
index 0000000..524ee6b
Binary files /dev/null and b/android/sdremote/res/drawable-mdpi/actionbar_tab_selected_pressed.9.png differ
diff --git a/android/sdremote/res/drawable-mdpi/actionbar_tab_unselected.9.png b/android/sdremote/res/drawable-mdpi/actionbar_tab_unselected.9.png
new file mode 100755
index 0000000..f433580
Binary files /dev/null and b/android/sdremote/res/drawable-mdpi/actionbar_tab_unselected.9.png differ
diff --git a/android/sdremote/res/drawable-xhdpi/actionbar_tab_selected.9.png b/android/sdremote/res/drawable-xhdpi/actionbar_tab_selected.9.png
new file mode 100755
index 0000000..3a10d7d
Binary files /dev/null and b/android/sdremote/res/drawable-xhdpi/actionbar_tab_selected.9.png differ
diff --git a/android/sdremote/res/drawable-xhdpi/actionbar_tab_selected_pressed.9.png b/android/sdremote/res/drawable-xhdpi/actionbar_tab_selected_pressed.9.png
new file mode 100755
index 0000000..e38ad0f
Binary files /dev/null and b/android/sdremote/res/drawable-xhdpi/actionbar_tab_selected_pressed.9.png differ
diff --git a/android/sdremote/res/drawable-xhdpi/actionbar_tab_unselected.9.png b/android/sdremote/res/drawable-xhdpi/actionbar_tab_unselected.9.png
new file mode 100755
index 0000000..505f7ea
Binary files /dev/null and b/android/sdremote/res/drawable-xhdpi/actionbar_tab_unselected.9.png differ
diff --git a/android/sdremote/res/drawable/actionbar_tab.xml b/android/sdremote/res/drawable/actionbar_tab.xml
new file mode 100644
index 0000000..db9ef14
--- /dev/null
+++ b/android/sdremote/res/drawable/actionbar_tab.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item
+        android:state_focused="false"
+        android:state_selected="false"
+        android:state_pressed="false"
+        android:drawable="@drawable/actionbar_tab_unselected"/>
+
+    <item
+        android:state_focused="false"
+        android:state_selected="true"
+        android:state_pressed="false"
+        android:drawable="@drawable/actionbar_tab_selected"/>
+
+    <item
+        android:state_selected="false"
+        android:state_pressed="true"
+        android:drawable="@drawable/actionbar_tab_selected_pressed"/>
+
+    <item
+        android:state_selected="true"
+        android:state_pressed="true"
+        android:drawable="@drawable/actionbar_tab_selected_pressed"/>
+
+</selector>
\ No newline at end of file
diff --git a/android/sdremote/res/drawable/actionbar_icon_computer.png b/android/sdremote/res/drawable/ic_logo.png
similarity index 100%
rename from android/sdremote/res/drawable/actionbar_icon_computer.png
rename to android/sdremote/res/drawable/ic_logo.png
diff --git a/android/sdremote/res/layout/dialog_about.xml b/android/sdremote/res/layout/dialog_about.xml
index 6ec3c4e..74f4474 100644
--- a/android/sdremote/res/layout/dialog_about.xml
+++ b/android/sdremote/res/layout/dialog_about.xml
@@ -29,7 +29,7 @@
                 android:layout_gravity="center_horizontal"
                 android:layout_margin="10dip"
                 android:gravity="center_horizontal"
-                android:text="@string/app_name"
+                android:text="@string/application_name"
                 android:textAppearance="?android:attr/textAppearanceLarge" />
 
             <TextView
diff --git a/android/sdremote/res/values-v10/styles.xml b/android/sdremote/res/values-v10/styles.xml
deleted file mode 100644
index c43c00d..0000000
--- a/android/sdremote/res/values-v10/styles.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <style name="Theme.ImpressRemote.Dialog" parent="@android:style/Theme.Dialog">
-        <item name="android:windowBackground">@color/light_grey</item>
-        <item name="android:topDark">@color/grey</item>
-        <item name="android:topBright">@color/grey</item>
-        <item name="android:centerDark">@color/light_grey</item>
-        <item name="android:bottomDark">@color/light_grey</item>
-        <item name="android:fullBright">@color/light_grey</item>
-        <item name="android:centerBright">@color/light_grey</item>
-        <item name="android:bottomBright">@color/light_grey</item>
-        <item name="android:bottomMedium">@color/light_grey</item>
-        <item name="android:centerMedium">@color/light_grey</item>
-        <item name="android:textColor">@color/grey</item>
-    </style>
-
-</resources>
\ No newline at end of file
diff --git a/android/sdremote/res/values/colors.xml b/android/sdremote/res/values/colors.xml
new file mode 100644
index 0000000..5cbe66a
--- /dev/null
+++ b/android/sdremote/res/values/colors.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <color name="background_action_bar">#e46f1f</color>
+
+    <color name="orange">#EE4400</color>
+    <color name="grey">#303030</color>
+    <color name="white">#FFFFFF</color>
+    <color name="black">#000000</color>
+    <color name="light_grey">#E8E9E8</color>
+    <color name="medium_grey">#C1C2C1</color>
+    <color name="text_grey">#5E5F5F</color>
+
+    <color name="thumbnail_border">#B4B4B4</color>
+    <color name="thumbnail_border_selected">#EE4400</color>
+
+</resources>
\ No newline at end of file
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 816deae..981b6f1 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
-    <string name="app_name">Impress Remote</string>
     <string name="menu_settings">Settings</string>
     <string name="title_activity_presentation">PresentationActivity</string>
     <string name="presentation_ui_resizehandle">Handle to resize view.</string>
@@ -63,4 +62,11 @@
         <item >45:00</item>
     </string-array>
     <string name="wrong_time_format">You have entered wrong time format</string>
+
+    <string name="application_name">Impress Remote</string>
+
+    <string name="title_computers">Computers</string>
+    <string name="title_bluetooth" translatable="false">Bluetooth</string>
+    <string name="title_wifi" translatable="false">WiFi</string>
+
 </resources>
diff --git a/android/sdremote/res/values/styles.xml b/android/sdremote/res/values/styles.xml
deleted file mode 100644
index 80a4b4a..0000000
--- a/android/sdremote/res/values/styles.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <color name="orange">#EE4400</color>
-    <color name="grey">#303030</color>
-    <color name="white">#FFFFFF</color>
-    <color name="black">#000000</color>
-    <color name="light_grey">#E8E9E8</color>
-    <color name="medium_grey">#C1C2C1</color>
-    <color name="text_grey">#5E5F5F</color>
-
-    <integer name="thumbnail_border_width">3</integer>
-
-    <color name="thumbnail_border">#B4B4B4</color>
-    <color name="thumbnail_border_selected">#EE4400</color>
-
-    <style name="Theme.ImpressRemote.ActionBar.Title" parent="android:style/Widget.Holo.Light.ActionBar">
-        <item name="android:textColor">@color/white</item>
-        <item name="android:textSize">18dp</item>
-    </style>
-
-    <style name="Theme.ImpressRemote.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
-        <item name="android:background">@color/orange</item>
-        <item name="background">@color/orange</item>
-        <item name="android:titleTextStyle">@style/Theme.ImpressRemote.ActionBar.Title</item>
-        <item name="titleTextStyle">@style/Theme.ImpressRemote.ActionBar.Title</item>
-        <item name="backgroundSplit">@color/text_grey</item>
-        <item name="android:backgroundSplit">@color/text_grey</item>
-    </style>
-
-    <style name="Theme.ImpressRemote.ActionBarWidget" parent="android:style/Widget.Holo.Light">
-        <item name="android:background">@color/orange</item>
-        <item name="android:textColor">@color/white</item>
-        <item name="android:textSize">22dp</item>
-    </style>
-
-    <style name="Theme.ImpressRemote.ActionBarMenu" parent="android:style/Widget.Holo.Light.ListPopupWindow">
-        <item name="android:background">@color/grey</item>
-        <!-- <item name="android:popupBackground">@color/black</item> -->
-    </style>
-
-    <style name="Theme.ImpressRemote.ActionBarMenuItem" parent="Widget.Sherlock.Light.Spinner.DropDown.ActionBar">
-        <item name="android:background">@color/grey</item>
-        <item name="android:textColor">@color/white</item>
-        <item name="android:textSize">16dp</item>
-    </style>
-
-    <style name="Theme.ImpressRemote.Dialog" parent="@android:style/Theme.Dialog">
-        <item name="android:windowBackground">@color/light_grey</item>
-        <item name="android:fullDark">@color/light_grey</item>
-        <item name="android:topDark">@color/light_grey</item>
-        <item name="android:centerDark">@color/light_grey</item>
-        <item name="android:bottomDark">@color/light_grey</item>
-        <item name="android:fullBright">@color/light_grey</item>
-        <item name="android:centerBright">@color/light_grey</item>
-        <item name="android:bottomBright">@color/light_grey</item>
-        <item name="android:bottomMedium">@color/light_grey</item>
-        <item name="android:centerMedium">@color/light_grey</item>
-        <item name="android:textColor">@color/grey</item>
-    </style>
-
-    <style name="Theme.ImpressRemote.Dialog.Title" parent="@android:style/Theme.Dialog">
-        <item name="android:textColor">@color/grey</item>
-    </style>
-
-    <style name="Theme.ImpressRemote" parent="Theme.Sherlock.Light.DarkActionBar">
-        <item name="android:actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item>
-        <item name="actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item>
-        <item name="android:popupMenuStyle">@style/Theme.ImpressRemote.ActionBarMenu</item>
-        <item name="android:dropDownListViewStyle">@style/Theme.ImpressRemote.ActionBarMenuItem</item>
-        <item name="android:textAppearanceLargePopupMenu">@style/Theme.ImpressRemote.ActionBarMenuItem</item> <!-- <item name="android:actionBarWidgetTheme">@style/Theme.ImpressRemote.ActionBarWidget</item> -->
-        <item name="android:actionDropDownStyle">@style/Theme.ImpressRemote.ActionBarMenu</item>
-        <item name="android:windowBackground">@color/light_grey</item>
-        <item name="android:homeAsUpIndicator">@drawable/up_indicator_white</item>
-        <item name="android:textColor">@color/text_grey</item>
-        <item name="android:alertDialogStyle">@style/Theme.ImpressRemote.Dialog</item>
-
-    </style>
-
-</resources>
\ No newline at end of file
diff --git a/android/sdremote/res/values/themes.xml b/android/sdremote/res/values/themes.xml
new file mode 100644
index 0000000..d53ae53
--- /dev/null
+++ b/android/sdremote/res/values/themes.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <integer name="thumbnail_border_width">3</integer>
+
+    <style name="Theme.ImpressRemote" parent="Theme.Sherlock.Light.DarkActionBar">
+        <item name="android:actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item>
+        <item name="actionBarStyle">@style/Theme.ImpressRemote.ActionBar</item>
+
+        <item name="android:actionBarTabStyle">@style/Theme.ImpressRemote.ActionBar.Tab</item>
+        <item name="actionBarTabStyle">@style/Theme.ImpressRemote.ActionBar.Tab</item>
+    </style>
+
+    <style name="Theme.ImpressRemote.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
+        <item name="android:background">@color/background_action_bar</item>
+        <item name="background">@color/background_action_bar</item>
+    </style>
+
+    <style name="Theme.ImpressRemote.ActionBar.Tab" parent="Widget.Sherlock.Light.ActionBar.TabView.Inverse">
+        <item name="android:background">@drawable/actionbar_tab</item>
+        <item name="background">@drawable/actionbar_tab</item>
+    </style>
+
+    <style name="Theme.ImpressRemote.Computers" parent="Theme.ImpressRemote">
+        <item name="android:actionBarStyle">@style/Theme.ImpressRemote.Computers.ActionBar</item>
+        <item name="actionBarStyle">@style/Theme.ImpressRemote.Computers.ActionBar</item>
+    </style>
+
+    <style name="Theme.ImpressRemote.Computers.ActionBar" parent="Theme.ImpressRemote.ActionBar">
+        <item name="android:navigationMode">tabMode</item>
+        <item name="navigationMode">tabMode</item>
+    </style>
+
+    <style name="Theme.ImpressRemote.ActionBarWidget" parent="android:style/Widget.Holo.Light">
+        <item name="android:background">@color/orange</item>
+        <item name="android:textColor">@color/white</item>
+        <item name="android:textSize">22dp</item>
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java b/android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java
new file mode 100644
index 0000000..0271dce
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/ActionBarTabListener.java
@@ -0,0 +1,36 @@
+package org.libreoffice.impressremote;
+
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
+
+import com.actionbarsherlock.app.ActionBar;
+
+public class ActionBarTabListener implements ActionBar.TabListener {
+    private final Fragment mTabFragment;
+
+    public ActionBarTabListener(Fragment aTabFragment) {
+        mTabFragment = aTabFragment;
+    }
+
+    @Override
+    public void onTabSelected(ActionBar.Tab aTab, FragmentTransaction aFragmentTransaction) {
+        if (mTabFragment.isDetached()) {
+            aFragmentTransaction.attach(mTabFragment);
+        }
+
+        aFragmentTransaction.replace(android.R.id.content, mTabFragment);
+    }
+
+    @Override
+    public void onTabUnselected(ActionBar.Tab aTab, FragmentTransaction aFragmentTransaction) {
+        if (mTabFragment.isDetached()) {
+            return;
+        }
+
+        aFragmentTransaction.detach(mTabFragment);
+    }
+
+    @Override
+    public void onTabReselected(ActionBar.Tab aTab, FragmentTransaction aFragmentTransaction) {
+    }
+}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
new file mode 100644
index 0000000..3b60187
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersActivity.java
@@ -0,0 +1,44 @@
+package org.libreoffice.impressremote;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockFragmentActivity;
+
+public class ComputersActivity extends SherlockFragmentActivity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setUpTabs();
+    }
+
+    private void setUpTabs() {
+        ActionBar aActionBar = getSupportActionBar();
+
+        aActionBar.addTab(buildBluetoothServersTab());
+        aActionBar.addTab(buildWiFiServersTab());
+    }
+
+    private ActionBar.Tab buildBluetoothServersTab() {
+        ComputersFragment aFragment = ComputersFragment.newInstance();
+
+        return buildActionBarTab(aFragment, R.string.title_bluetooth);
+    }
+
+    private ActionBar.Tab buildActionBarTab(Fragment aFragment, int aTitleResourceId) {
+        ActionBar.Tab aTab = getSupportActionBar().newTab();
+
+        aTab.setTabListener(new ActionBarTabListener(aFragment));
+        aTab.setText(aTitleResourceId);
+
+        return aTab;
+    }
+
+    private ActionBar.Tab buildWiFiServersTab() {
+        ComputersFragment aFragment = ComputersFragment.newInstance();
+
+        return buildActionBarTab(aFragment, R.string.title_wifi);
+    }
+}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
new file mode 100644
index 0000000..e411aa7
--- /dev/null
+++ b/android/sdremote/src/org/libreoffice/impressremote/ComputersFragment.java
@@ -0,0 +1,9 @@
+package org.libreoffice.impressremote;
+
+import com.actionbarsherlock.app.SherlockListFragment;
+
+public class ComputersFragment extends SherlockListFragment {
+    public static ComputersFragment newInstance() {
+        return new ComputersFragment();
+    }
+}


More information about the Libreoffice-commits mailing list