Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
e29c020e
Kaydet (Commit)
e29c020e
authored
Agu 23, 2012
tarafından
Andrzej J.R. Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Manual IP adding implemented.
Change-Id: Ifad2a206e3ddbb46094be6638581358484522695
üst
e4b0ce88
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
196 additions
and
1 deletion
+196
-1
AndroidManifest.xml
android/sdremote/AndroidManifest.xml
+3
-1
dialog_addserver.xml
android/sdremote/res/layout/dialog_addserver.xml
+47
-0
selector_activity.xml
android/sdremote/res/menu/selector_activity.xml
+7
-0
strings.xml
android/sdremote/res/values/strings.xml
+7
-0
styles.xml
android/sdremote/res/values/styles.xml
+4
-0
SelectorActivity.java
...e/src/org/libreoffice/impressremote/SelectorActivity.java
+75
-0
CommunicationService.java
...ice/impressremote/communication/CommunicationService.java
+53
-0
No files found.
android/sdremote/AndroidManifest.xml
Dosyayı görüntüle @
e29c020e
...
...
@@ -15,7 +15,9 @@
<application
android:label=
"@string/app_name"
android:theme=
"@style/Theme.ImpressRemote"
>
<activity
android:name=
".SelectorActivity"
>
<activity
android:name=
".SelectorActivity"
android:uiOptions=
"splitActionBarWhenNarrow"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
android/sdremote/res/layout/dialog_addserver.xml
0 → 100644
Dosyayı görüntüle @
e29c020e
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/addserver_root"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/addserver_namelabel"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/addserver_entername"
/>
<EditText
android:id=
"@+id/addserver_nameentry"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textCapWords"
>
<requestFocus
/>
</EditText>
<TextView
android:id=
"@+id/addserver_addressabel"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/addserver_enteraddress"
/>
<EditText
android:id=
"@+id/addserver_addressentry"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:inputType=
"textUri"
>
</EditText>
<CheckBox
android:id=
"@+id/addserver_remember"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:checked=
"true"
android:text=
"@string/addserver_remember"
/>
</LinearLayout>
\ No newline at end of file
android/sdremote/res/menu/selector_activity.xml
0 → 100644
Dosyayı görüntüle @
e29c020e
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@+id/menu_selector_addServer"
android:title=
"@string/addserver"
android:showAsAction=
"always"
></item>
</menu>
\ No newline at end of file
android/sdremote/res/values/strings.xml
Dosyayı görüntüle @
e29c020e
...
...
@@ -32,5 +32,11 @@
<string
name=
"about_close"
>
Close
</string>
<string
name=
"about_versionstring"
>
Version: {0} (Build ID: {1})
</string>
<string
name=
"about_copyright"
>
Copyright \u00A9 2012 LibreOffice Contributors and/or their affiliates.
</string>
<string
name=
"addserver"
>
Add Server
</string>
<string
name=
"addserver_entername"
>
Server name:
</string>
<string
name=
"addserver_enteraddress"
>
Server address as IP or hostname:
</string>
<string
name=
"addserver_remember"
>
Remember this server next time
</string>
<string
name=
"addserver_add"
>
Add
</string>
<string
name=
"addserver_cancel"
>
Cancel
</string>
</resources>
\ No newline at end of file
android/sdremote/res/values/styles.xml
Dosyayı görüntüle @
e29c020e
...
...
@@ -24,6 +24,8 @@
<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"
>
...
...
@@ -54,6 +56,7 @@
<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>
</style>
</resources>
\ No newline at end of file
android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java
Dosyayı görüntüle @
e29c020e
...
...
@@ -16,21 +16,29 @@ import org.libreoffice.impressremote.communication.CommunicationService;
import
org.libreoffice.impressremote.communication.Server
;
import
org.libreoffice.impressremote.communication.Server.Protocol
;
import
android.app.AlertDialog
;
import
android.content.BroadcastReceiver
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.DialogInterface
;
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
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.CheckBox
;
import
android.widget.EditText
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.actionbarsherlock.app.SherlockActivity
;
import
com.actionbarsherlock.view.Menu
;
import
com.actionbarsherlock.view.MenuInflater
;
import
com.actionbarsherlock.view.MenuItem
;
public
class
SelectorActivity
extends
SherlockActivity
{
...
...
@@ -68,6 +76,73 @@ public class SelectorActivity extends SherlockActivity {
LocalBroadcastManager
.
getInstance
(
this
).
unregisterReceiver
(
mListener
);
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
MenuInflater
inflater
=
getSupportMenuInflater
();
inflater
.
inflate
(
R
.
menu
.
selector_activity
,
menu
);
return
true
;
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
menu_selector_addServer
:
AlertDialog
.
Builder
builder
;
AlertDialog
alertDialog
;
LayoutInflater
inflater
=
(
LayoutInflater
)
getSystemService
(
LAYOUT_INFLATER_SERVICE
);
final
View
layout
=
inflater
.
inflate
(
R
.
layout
.
dialog_addserver
,
null
);
// TextView text = (TextView) layout.findViewById(R.id.text);
// text.setText("Hello, this is a custom dialog!");
// ImageView image = (ImageView) layout.findViewById(R.id.image);
// image.setImageResource(R.drawable.android);
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setView
(
layout
);
builder
.
setTitle
(
R
.
string
.
addserver
);
builder
.
setPositiveButton
(
R
.
string
.
addserver_add
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
EditText
aAddressEntry
=
(
EditText
)
layout
.
findViewById
(
R
.
id
.
addserver_addressentry
);
EditText
aNameEntry
=
(
EditText
)
layout
.
findViewById
(
R
.
id
.
addserver_nameentry
);
CheckBox
aRememberServer
=
(
CheckBox
)
layout
.
findViewById
(
R
.
id
.
addserver_remember
);
mCommunicationService
.
addServer
(
aAddressEntry
.
getText
()
.
toString
(),
aNameEntry
.
getText
()
.
toString
(),
aRememberServer
.
isChecked
());
refreshLists
();
}
});
builder
.
setNegativeButton
(
R
.
string
.
addserver_cancel
,
null
);
alertDialog
=
builder
.
create
();
alertDialog
.
show
();
// Context mContext = getApplicationContext();
// Dialog dialog = new Dialog(mContext);
//
// dialog.setContentView(R.layout.dialog_addserver);
// dialog.setTitle(R.string.addserver);
// TextView text = (TextView) dialog.findViewById(R.id.text);
// text.setText("Hello, this is a custom dialog!");
// ImageView image = (ImageView) dialog.findViewById(R.id.image);
// image.setImageResource(R.drawable.android);
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
@Override
public
void
onBackPressed
()
{
mCommunicationService
.
stopSearching
();
...
...
android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
Dosyayı görüntüle @
e29c020e
...
...
@@ -9,10 +9,17 @@
package
org
.
libreoffice
.
impressremote
.
communication
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.libreoffice.impressremote.communication.Server.Protocol
;
import
android.app.Service
;
import
android.bluetooth.BluetoothAdapter
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences.Editor
;
import
android.os.Binder
;
import
android.os.IBinder
;
...
...
@@ -173,6 +180,8 @@ public class CommunicationService extends Service implements Runnable {
@Override
public
void
onCreate
()
{
// TODO Create a notification (if configured).
loadServersFromPreferences
();
mThread
=
new
Thread
(
this
);
mThread
.
start
();
}
...
...
@@ -180,6 +189,8 @@ public class CommunicationService extends Service implements Runnable {
@Override
public
void
onDestroy
()
{
// TODO Destroy the notification (as necessary).
mManualServers
.
clear
();
mThread
.
interrupt
();
mThread
=
null
;
}
...
...
@@ -192,6 +203,7 @@ public class CommunicationService extends Service implements Runnable {
ArrayList
<
Server
>
aServers
=
new
ArrayList
<
Server
>();
aServers
.
addAll
(
mNetworkFinder
.
getServerList
());
aServers
.
addAll
(
mBluetoothFinder
.
getServerList
());
aServers
.
addAll
(
mManualServers
.
values
());
return
aServers
.
toArray
(
new
Server
[
aServers
.
size
()]);
}
...
...
@@ -203,5 +215,45 @@ public class CommunicationService extends Service implements Runnable {
return
mReceiver
.
isSlideShowRunning
();
}
/**
* Manually add a new (network) server to the list of servers.
* @param aAddress
* @param aRemember
*/
public
void
addServer
(
String
aAddress
,
String
aName
,
boolean
aRemember
)
{
for
(
String
aServer
:
mManualServers
.
keySet
())
{
if
(
aServer
.
equals
(
aAddress
))
return
;
}
mManualServers
.
put
(
aAddress
,
new
Server
(
Protocol
.
NETWORK
,
aAddress
,
aName
,
0
));
if
(
aRemember
)
{
SharedPreferences
aPref
=
getSharedPreferences
(
SERVERSTORAGE_KEY
,
MODE_PRIVATE
);
Editor
aEditor
=
aPref
.
edit
();
aEditor
.
putString
(
aAddress
,
aName
);
aEditor
.
apply
();
}
}
/**
* Key to use with getSharedPreferences to obtain a Map of stored servers.
* The keys are the ip/hostnames, the values are the friendly names.
*/
private
static
final
String
SERVERSTORAGE_KEY
=
"sdremote_storedServers"
;
private
HashMap
<
String
,
Server
>
mManualServers
=
new
HashMap
<
String
,
Server
>();
void
loadServersFromPreferences
()
{
SharedPreferences
aPref
=
getSharedPreferences
(
SERVERSTORAGE_KEY
,
MODE_PRIVATE
);
Map
<
String
,
String
>
aStoredMap
=
(
Map
<
String
,
String
>)
aPref
.
getAll
();
for
(
Entry
<
String
,
String
>
aServerEntry
:
aStoredMap
.
entrySet
())
{
mManualServers
.
put
(
aServerEntry
.
getKey
(),
new
Server
(
Protocol
.
NETWORK
,
aServerEntry
.
getKey
(),
aServerEntry
.
getValue
(),
0
));
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment