commit e2d95b5a80bbbb818eee7b9ac60c17f08fdaba56
parent fb426cee79821caa728683a0473903ae31166f00
Author: dankert <devnull@localhost>
Date: Thu, 20 Oct 2011 00:28:05 +0200
Mehrere Server konfigurierbar.
Diffstat:
13 files changed, 392 insertions(+), 53 deletions(-)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
@@ -12,6 +12,7 @@
</activity>
<activity android:name="Configuration" android:label="@string/preferences"></activity>
+ <activity android:name="Server" android:label="@string/preferences"></activity>
<activity android:name="ProjectActivity" android:label="@string/project_list"></activity>
<activity android:name="FolderActivity" android:label="@string/folder_content"></activity>
<activity android:name="PageElementsActivity" android:label="@string/page_content"></activity>
diff --git a/res/drawable/openrat.jpeg b/res/drawable/openrat.jpeg
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="de">
+ <head>
+ <title>OpenRat - Openrat</title>
+ <meta name="author" content="Jan Dankert">
+<!-- Framework CSS -->
+<link rel="stylesheet" href="./files/5864/screen.css" type="text/css" media="screen, projection">
+<link rel="stylesheet" href="./files/5864/print.css" type="text/css" media="print">
+
+<!--[if lt IE 8]><link rel="stylesheet" href="./files/5864/ie.css" type="text/css" media="screen, projection"><![endif]-->
+
+<style type="text/css" media="screen">
+<!--
+li.menu2 a{color:#022A50; font-weight:normal; text-decoration:underline }
+td {font-family:Arial;font-size:13px; vertical-align:top; }
+td.oben { border-bottom:25px solid #7B9CBD; }
+td.submenu { border-right:1px solid #7B9CBD; }
+td.menu { vertical-align:bottom; text-align:right; }
+
+-->
+</style>
+ </head>
+ <body>
+ <table width="100%" cellpadding="10" cellspacing="0">
+ <tr>
+ <td class="oben" id="header">
+ <table width="100%">
+ <tr>
+ <td><a href="./index.de.html"><img src="./images/logos/openrat.png" border="0" alt="OpenRat Logo" width="305" height="70"></a></td>
+ <td class="menu"><a href="./index.de.html">Start</a> · <a href="./doc/index.de.html" title="">Dokumentation</a> · <a href="./download/index.de.html" title="">Download</a> · <a href="./contact/index.de.html" title="">Kontakt</a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table width="100%" cellpadding="10">
+ <tr>
+ <td class="submenu" width="200" id="navigation"><ul class="x0">
+<li class="x0"><strong class="x0">Openrat</strong></li><li class="x0"><a class="x0" href="./overview/features.de.html">Überblick</a>
+</li>
+<li class="x0"><a class="x0" href="./doc/about.de.html">Dokumentation</a>
+</li>
+<li class="x0"><a class="x0" href="./screenshots/4j1.de.html">Screenshots</a>
+</li>
+<li class="x0"><a class="x0" href="./download/index.de.html">Download</a>
+</li>
+<li class="x0"><a class="x0" href="./dev/mithilfe.de.html">Entwicklung</a>
+</li>
+<li class="x0"><a class="x0" href="./contact/index.de.html">Kontakt</a>
+</li>
+<li class="x0"><a class="x0" href="http://demo.openrat.de/">Demo</a></li></ul></td>
+ <td colspan="2" id="content"><img align="right" src="./images/blank.gif" alt="logo" id="stock" width="16" height="16" title="blank"><strong> » </strong><span class="breadcrumb">Openrat</span><br/><br/><p>OpenRat ist ein freies <a href="http://de.wikipedia.org/wiki/CMS">Content-Management-System</a>, welches Ihre Webseiten vorkompiliert und in statischer Form auf dem Webserver ablegt. Durch dieses Prinzip werden Sicherheit und Performance maximiert.</p><p>Erfahren Sie <a href="./overview/features.de.html" title="">mehr über Openrat</a> oder gehen Sie gleich zum <a href="./download/index.de.html" title="">Download</a>.</p><p>Download: <a href="http://dl.openrat.de/openrat-latest-snapshot.tar.gz">Die aktuelle Snapshot-Version</a>.</p><p><img alt="screen-intro" src="./images/ppp.png" border="0" title="" width="737" height="520"></p><h3>Screencast<a name="screencast"></a></h3><p><object width="500" height="320"><param name="movie" value="http://www.youtube.com/v/fhelh1hoBy8&hl=de&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/fhelh1hoBy8&hl=de&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="320"></embed></object></p><h3>Quellen<a name="quellen"></a></h3><ul><li>OpenRat ist Open Source. Die Quellen kann man per <a href="http://de.wikipedia.org/wiki/Mercurial">Mercurial</a> mit dem Befehl <tt>hg clone static-http://scm.openrat.de/latest</tt> auschecken.</li><li><a href="./overview/changelog.de.html" title="">Changelog</a>.</li></ul><h3>Aktuelle Version<a name="aktuelleversion"></a></h3><p>Unter <a href="http://dl.openrat.de">dl.openrat.de</a> ist stets die <a href="http://dl.openrat.de/openrat-latest-snapshot.tar.gz">aktuelle Version</a> verfügbar.</p><p>Es ist auch ein Debian- und Ubuntu-Paket verfügbar: Ergänzen Sie dazu Ihre <tt>/etc/apt/sources.list</tt> wie folgt:</p><pre>deb http://debian.openrat.de/latest ./</pre><p>Ein anschließendes <tt>apt-get install openrat</tt> installiert OpenRat.</p><h3>Demo<a name="demo"></a></h3><p>Eine vollständige Demo mit der letzten Snapshot-Version ist verfügbar unter <a href="http://demo.openrat.de">demo.openrat.de</a>.</p><p>Die Inhalte im Demo-System werden täglich zurückgesetzt.</p><h3>Unterstützung für Open-Id<a name="untersttzungfropen-id"></a></h3><p>OpenRat unterstützt eine Autorisierung per <a href="http://www.openid.net">Open-Id</a>. OpenId ist per Default deaktiviert, kann aber über die Konfiguration in der <tt>security.ini.php</tt> aktiviert werden.</p><h3>Forum und Bugtracker<a name="forumundbugtracker"></a></h3><p>Über Bitbucket ist ein <a href="http://bitbucket.org/braunbaer/openrat/wiki/" title="">Wiki</a> sowie ein <a href="http://bitbucket.org/braunbaer/openrat/issues/?status=new&status=open" title="">Bugtracker</a> verfügbar.</p><h3>WebDAV<a name="webdav"></a></h3><p>OpenRat unterstützt <a href="http://de.wikipedia.org/wiki/WebDAV">WebDAV</a>. Damit kann mit einem WebDAV-Client (z.B. KDE Konqueror, MS Windows Explorer, MS Internet Explorer, MS-Office) direkt auf die Dateien im OpenRat-CMS zugegriffen werden.</p><p>Implementiert ist DAV-Level 1 (keine LOCKs) mit einem vollwertigen Schreibzugriff. Es ist nicht möglich, auf Seiten und Verweise zuzugreifen, da die Komplexität dieser Objekte über WebDAV noch nicht abzubilden ist.</p><p>WebDAV ist im Auslieferungszustand deaktiviert, kann aber über die Datei <tt>webdav.ini.php</tt> aktiviert werden.</p><h3>Wikipedia<a name="wikipedia"></a></h3><p>Noch eine Baustelle und keineswegs relevant: Der <a href="http://de.wikipedia.org/wiki/Benutzer:JanDankert/OpenRat_%28Entwurf%29">OpenRat-Artikel in der Wikipedia</a>. Vielleicht helfen Sie mit?</p><h3>HTML-Editor<a name="html-editor"></a></h3><p>OpenRat enthält den <a href="http://www.ckeditor.com/">CK-Editor</a>.</p><p>Dieser ist aktiv, wenn ein Textabsatz-Element die Eigenschaft <cite>„HTML“</cite> (und nicht <cite>„Wiki“</cite>) besitzt. Beim Editieren eines Textabsatzes im <cite>„Erweitert“</cite>-Modus wird dann der Editor gestartet. Hierzu ist jedoch aktiviertes Javaskript sowie Internet Explorer ab Version 5.5, Mozilla Firefox/Iceweasel ab Version 2 oder Opera 9.5 erforderlich.</p><h3>Status der Entwicklung<a name="statusderentwicklung"></a></h3><p>Openrat ist offziell noch <cite>„beta“</cite> und nicht für produktive Systeme zu empfehlen.</p><br><br><hr size="1"><small>Letzte Änderung 22.06.2010, 23:25, veröffentlicht 07.09.2010, 22:51 | <a href="./index.de.m.html">mobil</a>, <a href="./index.de.html" lang="de">deutsch</a>, <a href="./index.en.html" lang="en">english</a> | <a href="./index.de.pdf" lang="de">PDF deutsch</a>, <a href="./index.en.pdf" lang="en">PDF english</a></small></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </body>
+</html>+
\ No newline at end of file
diff --git a/res/layout/listing.xml b/res/layout/listing.xml
@@ -1,9 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content" android:layout_height="wrap_content">
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <ImageView android:id="@+id/listimage" android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:visibility="invisible" />
+
+ <TextView android:id="@+id/listtitle" android:textSize="14sp"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:visibility="invisible" />
<ListView android:id="@id/android:list" android:textSize="25sp"
- android:layout_width="wrap_content" android:layout_height="wrap_content">
+ android:layout_width="fill_parent" android:layout_height="wrap_content">
</ListView>
diff --git a/res/layout/listing_pageelement.xml b/res/layout/listing_pageelement.xml
@@ -3,8 +3,8 @@
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="5sp">
- <TextView android:text="Name" android:layout_width="wrap_content"
+ <TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/name"
- android:textSize="14sp"></TextView>
+ android:textSize="18sp"></TextView>
</LinearLayout>
diff --git a/res/layout/properties.xml b/res/layout/properties.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical">
- <TableLayout android:layout_width="wrap_content"
+ <TableLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
@@ -15,14 +15,14 @@
<TableRow>
<TextView android:text="@string/filename"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
- <EditText android:id="@+id/filename" android:layout_width="wrap_content"
+ <EditText android:id="@+id/filename" android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
- <TextView android:text="@string/filename"
+ <TextView android:text="@string/description"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
- <EditText android:id="@+id/description" android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
+ <EditText android:id="@+id/description" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:lines="5" />
</TableRow>
</TableLayout>
diff --git a/res/menu/main.xml b/res/menu/main.xml
@@ -1,4 +1,7 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/menu_preferences" android:title="@string/preferences" android:icon="@android:drawable/ic_menu_preferences"></item>
+ <item android:id="@+id/menu_newserver" android:title="@string/newserver"
+ android:icon="@android:drawable/ic_menu_add"></item>
+ <item android:id="@+id/menu_preferences" android:title="@string/preferences"
+ android:icon="@android:drawable/ic_menu_preferences"></item>
</menu>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
@@ -69,4 +69,8 @@
<string name="areyousure">Sicher?</string>
<string name="choosefile">Datei auswählen</string>
<string name="chooseimage">Bild auswählen</string>
+ <string name="newserver">Neuer Server</string>
+ <string name="server">Server</string>
+ <string name="timeout">Zeitablauf</string>
+ <string name="timeout_desc">Timeout der TCP/IP-Verbindung in Sekunden</string>
</resources>
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
@@ -1,25 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/preferences">
- <PreferenceScreen android:title="Server">
-
- <PreferenceCategory android:title="@string/preferences">
- <EditTextPreference android:key="name"
- android:title="Name"></EditTextPreference>
- <EditTextPreference android:key="hostname"
- android:title="@string/hostname"></EditTextPreference>
- <EditTextPreference android:key="port"
- android:defaultValue="80" android:title="@string/port"></EditTextPreference>
- <EditTextPreference android:key="username"
- android:title="@string/username"></EditTextPreference>
- <EditTextPreference android:key="password"
- android:title="@string/password"></EditTextPreference>
-
-
- </PreferenceCategory>
-
- </PreferenceScreen>
-
- <ListPreference android:key="version" android:title="@string/version" android:entries="@array/version_list" android:entryValues="@array/api_list" android:summary="@string/version"></ListPreference>
-
-<CheckBoxPreference android:key="writable" android:title="@string/writable"></CheckBoxPreference>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/preferences">
+ <EditTextPreference android:key="timeout"
+ android:title="@string/timeout" android:summary="@string/timeout_desc"
+ android:defaultValue="30"></EditTextPreference>
+ <EditTextPreference android:key="server"
+ android:title="@string/server"></EditTextPreference>
</PreferenceScreen>
diff --git a/res/xml/server.xml b/res/xml/server.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/server">
+ <PreferenceCategory android:title="@string/preferences">
+ <EditTextPreference android:key="name"
+ android:title="Name"></EditTextPreference>
+ <EditTextPreference android:key="hostname"
+ android:title="@string/hostname"></EditTextPreference>
+ <EditTextPreference android:key="port"
+ android:defaultValue="80" android:title="@string/port"></EditTextPreference>
+ <EditTextPreference android:key="path"
+ android:defaultValue="/" android:title="@string/path"></EditTextPreference>
+ <EditTextPreference android:key="username"
+ android:title="@string/username"></EditTextPreference>
+ <EditTextPreference android:key="password"
+ android:password="true" android:title="@string/password"></EditTextPreference>
+ <ListPreference android:key="version" android:title="@string/version"
+ android:entries="@array/version_list" android:entryValues="@array/api_list"
+ android:summary="@string/version"></ListPreference>
+ </PreferenceCategory>
+
+</PreferenceScreen>
diff --git a/src/de/openrat/android/blog/OpenRatBlog.java b/src/de/openrat/android/blog/OpenRatBlog.java
@@ -19,58 +19,80 @@
package de.openrat.android.blog;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
-import android.app.Activity;
-import android.app.ProgressDialog;
+import android.app.ListActivity;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.util.Log;
+import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
-import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.ImageView;
+import android.widget.ListView;
import android.widget.TextView;
-import android.widget.Toast;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView.OnItemLongClickListener;
+import de.openrat.android.blog.adapter.SimpleNameAdapter;
import de.openrat.android.blog.util.OpenRatClientAsyncTask;
+import de.openrat.android.blog.util.ServerList;
import de.openrat.client.OpenRatClient;
/**
* @author Jan Dankert
*/
-public class OpenRatBlog extends Activity
+public class OpenRatBlog extends ListActivity
{
private static final String PREFS_NAME = "OR_BLOG_PREFS";
private OpenRatClient client;
+ private List<String> serverList;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
+ setContentView(R.layout.listing);
- final SharedPreferences prefs = PreferenceManager
+ ImageView image = (ImageView) findViewById(R.id.listimage);
+ image.setImageResource(R.drawable.openrat);
+ image.setVisibility(View.VISIBLE);
+
+ TextView title = (TextView) findViewById(R.id.listtitle);
+ title.setText(getResources().getString(R.string.connect));
+ title.setVisibility(View.VISIBLE);
+
+ SharedPreferences globalPrefs = PreferenceManager
.getDefaultSharedPreferences(this);
+ serverList = Arrays.asList(TextUtils.split(globalPrefs.getString(
+ "server", ""), ","));
- int port = Integer.parseInt(prefs.getString("port", "80"));
- String path = prefs.getString("path", "/");
- String host = prefs.getString("hostname", "");
+ ArrayList<String> list = new ArrayList<String>();
+ for (String server : serverList)
+ {
+ SharedPreferences preferences = getSharedPreferences(server,
+ MODE_PRIVATE);
+
+ list.add(preferences.getString("name", "?"));
+ }
- client = new OpenRatClient(host, path, port);
+ SimpleNameAdapter adapter = new SimpleNameAdapter(this, list);
- @SuppressWarnings("unused")
- TextView tv = (TextView) findViewById(R.id.hello);
+ ListView lv = getListView();
+ lv.setAdapter(adapter);
- View connect = findViewById(R.id.connect);
- connect.setOnClickListener(new OnClickListener()
+ lv.setOnItemClickListener(new OnItemClickListener()
{
@Override
- public void onClick(View v)
+ public void onItemClick(AdapterView<?> arg0, View arg1,
+ final int pos, long rowId)
{
new OpenRatClientAsyncTask(OpenRatBlog.this,
R.string.waitingforlogin)
@@ -78,6 +100,16 @@ public class OpenRatBlog extends Activity
@Override
protected void callServer() throws IOException
{
+ SharedPreferences prefs = getSharedPreferences(
+ serverList.get(pos), MODE_PRIVATE);
+
+ int port = Integer.parseInt(prefs.getString("port",
+ "80"));
+ String path = prefs.getString("path", "/");
+ String host = prefs.getString("hostname", "");
+
+ client = new OpenRatClient(host, path, port);
+
client.login(prefs.getString("username", ""), prefs
.getString("password", ""));
@@ -96,6 +128,20 @@ public class OpenRatBlog extends Activity
}.execute();
}
+
+ });
+
+ lv.setOnItemLongClickListener(new OnItemLongClickListener()
+ {
+ @Override
+ public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
+ final int pos, long rowId)
+ {
+ Intent intent = new Intent(OpenRatBlog.this, Server.class);
+ intent.putExtra(Server.NAME, serverList.get(pos));
+ startActivity(intent);
+ return true;
+ }
});
}
@@ -116,6 +162,21 @@ public class OpenRatBlog extends Activity
{
case R.id.menu_preferences:
startActivity(new Intent(this, Configuration.class));
+ return true;
+ case R.id.menu_newserver:
+
+ SharedPreferences globalPrefs = PreferenceManager
+ .getDefaultSharedPreferences(this);
+ String newServername = "" + System.currentTimeMillis();
+
+ ServerList list = new ServerList(globalPrefs.getString(
+ "server", "")).addServer(newServername);
+ globalPrefs.edit().putString("server", list.toPlain()).commit();
+
+ Intent intent = new Intent(this, Server.class);
+ intent.putExtra(Server.NAME, newServername);
+ startActivity(intent);
+ return true;
}
return false;
}
@@ -134,5 +195,4 @@ public class OpenRatBlog extends Activity
// Don't forget to commit your edits!!!
editor.commit();
}
-
}
\ No newline at end of file
diff --git a/src/de/openrat/android/blog/Server.java b/src/de/openrat/android/blog/Server.java
@@ -0,0 +1,62 @@
+package de.openrat.android.blog;
+
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceManager;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import de.openrat.android.blog.util.ServerList;
+
+public class Server extends PreferenceActivity
+{
+
+ public static final String NAME = "name";
+ private String serverName;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ this.serverName = getIntent().getStringExtra(NAME);
+ getPreferenceManager().setSharedPreferencesName(serverName);
+
+ addPreferencesFromResource(R.xml.server);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu)
+ {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater mi = new MenuInflater(getApplication());
+ mi.inflate(R.menu.server, menu);
+
+ return true;
+ }
+
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ switch (item.getItemId())
+ {
+ case R.id.menu_delete:
+
+ SharedPreferences globalPrefs = PreferenceManager
+ .getDefaultSharedPreferences(this);
+ ServerList serverList= new ServerList(
+ globalPrefs.getString("server", ""));
+
+ // Server entfernen und alles löschen.
+ serverList.removeServer(serverName);
+ getPreferenceManager().getSharedPreferences().edit().clear().commit();
+
+ globalPrefs.edit().putString("server",
+ serverList.toPlain()).commit();
+ finish();
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/src/de/openrat/android/blog/adapter/SimpleNameAdapter.java b/src/de/openrat/android/blog/adapter/SimpleNameAdapter.java
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package de.openrat.android.blog.adapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+import de.openrat.android.blog.R;
+
+/**
+ * @author dankert
+ *
+ */
+public class SimpleNameAdapter extends BaseAdapter
+{
+
+ /**
+ * Hold onto a copy of the entire Contact List.
+ */
+ private List<String> data = new ArrayList<String>();
+
+ private LayoutInflater inflator;
+
+ public SimpleNameAdapter(Context context, List<String> data)
+ {
+ inflator = (LayoutInflater) context
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ this.data = data;
+ }
+
+ public int getCount()
+ {
+ return data.size();
+ }
+
+ public Object getItem(int position)
+ {
+ return data.get(position);
+ }
+
+ /** Use the array index as a unique id. */
+ public long getItemId(int position)
+ {
+ return position;
+
+ }
+
+ /**
+ * @param convertView
+ * The old view to overwrite, if one is passed
+ * @returns a ContactEntryView that holds wraps around an ContactEntry
+ */
+ public View getView(int position, View convertView, ViewGroup parent)
+ {
+
+ final View view = inflator.inflate(R.layout.listing_pageelement, null);
+
+ TextView name = (TextView) view.findViewById(R.id.name);
+ name.setText(data.get(position));
+
+ return view;
+ }
+
+}
diff --git a/src/de/openrat/android/blog/util/ServerList.java b/src/de/openrat/android/blog/util/ServerList.java
@@ -0,0 +1,62 @@
+/*
+ * Openrat CMS-Client for Android
+ *
+ * Copyright (C) 2011 Jan Dankert
+ *
+ * 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 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.openrat.android.blog.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import android.text.TextUtils;
+
+public class ServerList
+{
+
+ private List<String> serverList;
+
+ public ServerList(String plainList)
+ {
+ if (plainList.length() == 0)
+ {
+ this.serverList = new ArrayList<String>();
+ }
+ else
+ {
+ serverList = new ArrayList<String>(Arrays.asList(TextUtils.split(
+ plainList, ",")));
+ }
+ }
+
+ public ServerList addServer(String name)
+ {
+ this.serverList.add(name);
+ return this;
+ }
+
+ public ServerList removeServer(String name)
+ {
+ this.serverList.remove(name);
+ return this;
+ }
+
+ public String toPlain()
+ {
+ return TextUtils.join(",", serverList);
+ }
+
+}