mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-26 02:42:16 -05:00
Replace all tabs with four spaces!
This commit is contained in:
parent
f3f195f631
commit
02b7ec1741
@ -20,12 +20,12 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.yaaic"
|
||||
android:versionCode="7"
|
||||
android:versionName="0.6">
|
||||
package="org.yaaic"
|
||||
android:versionCode="7"
|
||||
android:versionName="0.6">
|
||||
<application
|
||||
android:icon="@drawable/icon"
|
||||
android:label="Yaaic">
|
||||
android:icon="@drawable/icon"
|
||||
android:label="Yaaic">
|
||||
<activity
|
||||
android:name=".activity.ServersActivity"
|
||||
android:label="@string/app_name"
|
||||
@ -38,12 +38,12 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
<activity
|
||||
android:name=".activity.AddServerActivity"
|
||||
android:label="@string/add_server_label">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="irc"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="irc"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.ConversationActivity"
|
||||
@ -69,25 +69,25 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AddAliasActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
android:name=".activity.AddAliasActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AddChannelActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
android:name=".activity.AddChannelActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AddCommandsActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
android:name=".activity.AddCommandsActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.MessageActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
android:name=".activity.MessageActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.UserActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
android:name=".activity.UserActivity"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<service android:name=".irc.IRCService"></service>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="3" />
|
||||
|
@ -26,50 +26,50 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="10px">
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Yaaic"
|
||||
android:textSize="16px"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="#FF6CB600" />
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_full_name"
|
||||
android:textSize="10px" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" - " />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_version"
|
||||
android:textSize="10px" />
|
||||
</LinearLayout>
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Yaaic"
|
||||
android:textSize="16px"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColor="#FF6CB600" />
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_full_name"
|
||||
android:textSize="10px" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=" - " />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_version"
|
||||
android:textSize="10px" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_copyright"
|
||||
android:textSize="12px"
|
||||
android:gravity="center_horizontal" />
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_copyright"
|
||||
android:textSize="12px"
|
||||
android:gravity="center_horizontal" />
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_homepage"
|
||||
android:linksClickable="true"
|
||||
android:autoLink="web"
|
||||
android:textColorLink="#FF6CB600"
|
||||
android:textSize="16px"
|
||||
android:gravity="center_horizontal" />
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_homepage"
|
||||
android:linksClickable="true"
|
||||
android:autoLink="web"
|
||||
android:textColorLink="#FF6CB600"
|
||||
android:textSize="16px"
|
||||
android:gravity="center_horizontal" />
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/licence_info"
|
||||
android:textSize="12px" />
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/licence_info"
|
||||
android:textSize="12px" />
|
||||
</LinearLayout>
|
@ -1,48 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/alias_add_description"
|
||||
android:padding="5px" />
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/alias_add_description"
|
||||
android:padding="5px" />
|
||||
<ListView
|
||||
android:id="@+id/aliases"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/alias"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:text="Add" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ok"
|
||||
android:text="Ok" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cancel"
|
||||
android:text="Cancel" />
|
||||
</LinearLayout>
|
||||
android:id="@+id/aliases"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/alias"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:text="Add" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ok"
|
||||
android:text="Ok" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cancel"
|
||||
android:text="Cancel" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
||||
|
@ -20,49 +20,49 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/channel_add_description"
|
||||
android:padding="5px" />
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/channel_add_description"
|
||||
android:padding="5px" />
|
||||
<ListView
|
||||
android:id="@+id/channels"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="#"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_add" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ok"
|
||||
android:text="@string/action_ok" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cancel"
|
||||
android:text="@string/action_cancel" />
|
||||
</LinearLayout>
|
||||
android:id="@+id/channels"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="#"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_add" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ok"
|
||||
android:text="@string/action_ok" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cancel"
|
||||
android:text="@string/action_cancel" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -20,10 +20,10 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="3px">
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="3px">
|
||||
<EditText
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -20,9 +20,9 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
@ -20,49 +20,49 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/command_add_description"
|
||||
android:padding="5px" />
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/command_add_description"
|
||||
android:padding="5px" />
|
||||
<ListView
|
||||
android:id="@+id/commands"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/command"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="/"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_add" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ok"
|
||||
android:text="@string/action_ok" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cancel"
|
||||
android:text="@string/action_cancel" />
|
||||
</LinearLayout>
|
||||
android:id="@+id/commands"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<EditText
|
||||
android:id="@+id/command"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="/"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_add" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ok"
|
||||
android:text="@string/action_ok" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/cancel"
|
||||
android:text="@string/action_cancel" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -20,9 +20,9 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
@ -26,56 +26,56 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:layout_height="fill_parent"
|
||||
android:background="#ff181818">
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="3px">
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/disconnected"/>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="3px"
|
||||
android:textSize="12px"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<ViewSwitcher
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="3px">
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/disconnected"/>
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="3px"
|
||||
android:textSize="12px"
|
||||
android:layout_weight="1" />
|
||||
</LinearLayout>
|
||||
<ViewSwitcher
|
||||
android:id="@+id/switcher"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<Gallery
|
||||
android:id="@+id/deck"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<Gallery
|
||||
android:id="@+id/deck"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_margin="0px"
|
||||
android:spacing="5px"
|
||||
android:unselectedAlpha="100"/>
|
||||
</ViewSwitcher>
|
||||
<org.yaaic.view.ConversationSwitcher
|
||||
android:id="@+id/dots"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<EditText
|
||||
android:id="@+id/input"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
</ViewSwitcher>
|
||||
<org.yaaic.view.ConversationSwitcher
|
||||
android:id="@+id/dots"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<EditText
|
||||
android:id="@+id/input"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:imeOptions="actionSend" />
|
||||
<Button
|
||||
<Button
|
||||
android:id="@+id/speech"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@android:drawable/ic_btn_speak_now"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -20,21 +20,21 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:padding="5px">
|
||||
<EditText
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ems="10"
|
||||
android:text="#" />
|
||||
<Button
|
||||
android:id="@+id/join"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/join" />
|
||||
android:id="@+id/channel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ems="10"
|
||||
android:text="#" />
|
||||
<Button
|
||||
android:id="@+id/join"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/join" />
|
||||
</LinearLayout>
|
@ -20,21 +20,21 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10px"
|
||||
android:autoLink="all"
|
||||
android:linksClickable="true" />
|
||||
<LinearLayout
|
||||
android:id="@+id/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
</LinearLayout>
|
||||
android:id="@+id/message"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10px"
|
||||
android:autoLink="all"
|
||||
android:linksClickable="true" />
|
||||
<LinearLayout
|
||||
android:id="@+id/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -20,21 +20,21 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1px"
|
||||
android:color="#55ffffff" />
|
||||
android:width="1px"
|
||||
android:color="#55ffffff" />
|
||||
<padding
|
||||
android:left="3px"
|
||||
android:top="3px"
|
||||
android:right="3px"
|
||||
android:bottom="3px" />
|
||||
<solid
|
||||
android:color="#cc000000" />
|
||||
<corners
|
||||
android:bottomRightRadius="10dp"
|
||||
android:bottomLeftRadius="10dp"
|
||||
android:topLeftRadius="10dp"
|
||||
android:topRightRadius="10dp" />
|
||||
android:left="3px"
|
||||
android:top="3px"
|
||||
android:right="3px"
|
||||
android:bottom="3px" />
|
||||
<solid
|
||||
android:color="#cc000000" />
|
||||
<corners
|
||||
android:bottomRightRadius="10dp"
|
||||
android:bottomLeftRadius="10dp"
|
||||
android:topLeftRadius="10dp"
|
||||
android:topRightRadius="10dp" />
|
||||
</shape>
|
@ -20,75 +20,75 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:scrollbarStyle="outsideInset">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:text="@string/server"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="14px"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3px"
|
||||
android:layout_margin="2px" />
|
||||
<TextView
|
||||
android:text="@string/server_title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
<TextView
|
||||
android:text="@string/server_host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
<TextView
|
||||
android:text="@string/server_port"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/port"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:minEms="6"
|
||||
android:text="6667" />
|
||||
<TextView
|
||||
android:text="@string/server_password"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:password="true"
|
||||
android:minEms="10"
|
||||
android:maxEms="10" />
|
||||
<CheckBox
|
||||
android:id="@+id/autoconnect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/server_port"
|
||||
android:visibility="gone" />
|
||||
<CheckBox
|
||||
android:id="@+id/useSSL"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/server_useSSL" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:scrollbarStyle="outsideInset">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:text="@string/server"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="14px"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3px"
|
||||
android:layout_margin="2px" />
|
||||
<TextView
|
||||
android:text="@string/server_title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
<TextView
|
||||
android:text="@string/server_host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
<TextView
|
||||
android:text="@string/server_port"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/port"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:minEms="6"
|
||||
android:text="6667" />
|
||||
<TextView
|
||||
android:text="@string/server_password"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:password="true"
|
||||
android:minEms="10"
|
||||
android:maxEms="10" />
|
||||
<CheckBox
|
||||
android:id="@+id/autoconnect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/server_port"
|
||||
android:visibility="gone" />
|
||||
<CheckBox
|
||||
android:id="@+id/useSSL"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/server_useSSL" />
|
||||
<!-- ############################################################################ -->
|
||||
<TextView
|
||||
android:text="@string/user"
|
||||
@ -134,62 +134,62 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:text=""
|
||||
android:singleLine="true" />
|
||||
<!-- ############################################################################ -->
|
||||
<TextView
|
||||
android:text="@string/on_connect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="14px"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3px"
|
||||
android:layout_margin="2px" />
|
||||
<Button
|
||||
android:id="@+id/channels"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/channels" />
|
||||
<Button
|
||||
android:id="@+id/commands"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/commands" />
|
||||
<TextView
|
||||
android:text="@string/on_connect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="14px"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3px"
|
||||
android:layout_margin="2px" />
|
||||
<Button
|
||||
android:id="@+id/channels"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/channels" />
|
||||
<Button
|
||||
android:id="@+id/commands"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/commands" />
|
||||
<!-- ############################################################################ -->
|
||||
<TextView
|
||||
android:text="@string/preferences"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="14px"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3px"
|
||||
android:layout_margin="2px" />
|
||||
<TextView
|
||||
android:text="@string/preferences"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="14px"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3px"
|
||||
android:layout_margin="2px" />
|
||||
<TextView
|
||||
android:text="@string/charset"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Spinner
|
||||
android:id="@+id/charset"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:prompt="@string/select_charset" />
|
||||
android:id="@+id/charset"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:prompt="@string/select_charset" />
|
||||
<!-- ############################################################################ -->
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10px">
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:text="@string/server_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/add"
|
||||
android:text="@string/server_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/cancel"
|
||||
android:text="@string/action_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -35,17 +35,17 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="5px">
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textSize="16px" />
|
||||
<TextView
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textSize="16px" />
|
||||
<TextView
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -20,67 +20,67 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<TextView
|
||||
android:id="@+id/nickname"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10px"
|
||||
android:autoLink="all"
|
||||
android:linksClickable="true"
|
||||
android:textSize="20px" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/op"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_op" />
|
||||
<Button
|
||||
android:id="@+id/deop"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_deop" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/voice"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_voice" />
|
||||
<Button
|
||||
android:id="@+id/devoice"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_devoice" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/kick"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_kick" />
|
||||
<Button
|
||||
android:id="@+id/ban"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_ban" />
|
||||
</LinearLayout>
|
||||
android:id="@+id/nickname"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10px"
|
||||
android:autoLink="all"
|
||||
android:linksClickable="true"
|
||||
android:textSize="20px" />
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/op"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_op" />
|
||||
<Button
|
||||
android:id="@+id/deop"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_deop" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/voice"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_voice" />
|
||||
<Button
|
||||
android:id="@+id/devoice"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_devoice" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/kick"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_kick" />
|
||||
<Button
|
||||
android:id="@+id/ban"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/button_ban" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -20,9 +20,9 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
||||
android:id="@+id/host"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="7px"
|
||||
android:text=""
|
||||
android:textSize="12px" />
|
@ -24,10 +24,10 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:id="@+id/join"
|
||||
android:title="@string/join_channel"
|
||||
android:icon="@android:drawable/ic_menu_add" />
|
||||
<item
|
||||
android:id="@+id/users"
|
||||
android:title="@string/users"
|
||||
android:icon="@drawable/menu_users" />
|
||||
<item
|
||||
android:id="@+id/users"
|
||||
android:title="@string/users"
|
||||
android:icon="@drawable/menu_users" />
|
||||
<item
|
||||
android:id="@+id/close"
|
||||
android:title="@string/close"
|
||||
|
@ -24,16 +24,16 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:id="@+id/add"
|
||||
android:title="@string/add_server_menu"
|
||||
android:icon="@android:drawable/ic_menu_add" />
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings_menu"
|
||||
android:icon="@android:drawable/ic_menu_preferences" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about_menu"
|
||||
android:icon="@android:drawable/ic_menu_help" />
|
||||
<item
|
||||
android:id="@+id/exit"
|
||||
android:title="@string/exit_menu"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings_menu"
|
||||
android:icon="@android:drawable/ic_menu_preferences" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about_menu"
|
||||
android:icon="@android:drawable/ic_menu_help" />
|
||||
<item
|
||||
android:id="@+id/exit"
|
||||
android:title="@string/exit_menu"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
</menu>
|
@ -7,7 +7,7 @@
|
||||
<string name="app_copyright">(C) 2009-2010 Sebastian Kaspari</string>
|
||||
|
||||
<string name="licence_info">
|
||||
Yaaic 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.
|
||||
Yaaic 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.
|
||||
</string>
|
||||
Yaaic 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.
|
||||
Yaaic 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.
|
||||
</string>
|
||||
</resources>
|
@ -1,69 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="charsets">
|
||||
<item name="UTF-8">UTF-8</item>
|
||||
<item name="Big">Big5</item>
|
||||
<item name="BOCU-1">BOCU-1</item>
|
||||
<item name="CESU-8">CESU-8</item>
|
||||
<item name="cp864">cp864</item>
|
||||
<item name="EUC-JP">EUC-JP</item>
|
||||
<item name="EUC-KR">EUC-KR</item>
|
||||
<item name="GBK">GBK</item>
|
||||
<item name="HZ-GB-2312">HZ-GB-2312</item>
|
||||
<item name="ISO-2022-JP">ISO-2022-JP</item>
|
||||
<item name="ISO-8859-1">ISO-8859-1</item>
|
||||
<item name="ISO-8859-10">ISO-8859-10</item>
|
||||
<item name="ISO-8859-13">ISO-8859-13</item>
|
||||
<item name="ISO-8859-14">ISO-8859-14</item>
|
||||
<item name="ISO-8859-15">ISO-8859-15</item>
|
||||
<item name="ISO-8859-16">ISO-8859-16</item>
|
||||
<item name="ISO-8859-2">ISO-8859-2</item>
|
||||
<item name="ISO-8859-3">ISO-8859-3</item>
|
||||
<item name="ISO-8859-4">ISO-8859-4</item>
|
||||
<item name="ISO-8859-5">ISO-8859-5</item>
|
||||
<item name="ISO-8859-6">ISO-8859-6</item>
|
||||
<item name="ISO-8859-7">ISO-8859-7</item>
|
||||
<item name="ISO-8859-8">ISO-8859-8</item>
|
||||
<item name="ISO-8859-9">ISO-8859-9</item>
|
||||
<item name="KOI8-R">KOI8-R</item>
|
||||
<item name="macintosh">macintosh</item>
|
||||
<item name="SCSU">SCSU</item>
|
||||
<item name="Shift_JIS">Shift_JIS</item>
|
||||
<item name="TIS-620">TIS-620</item>
|
||||
<item name="US-ASCII">US-ASCII</item>
|
||||
<item name="UTF-16">UTF-16</item>
|
||||
<item name="UTF-16BE">UTF-16BE</item>
|
||||
<item name="UTF-16LE">UTF-16LE</item>
|
||||
<item name="UTF-32">UTF-32</item>
|
||||
<item name="UTF-32BE">UTF-32BE</item>
|
||||
<item name="UTF-32LE">UTF-32LE</item>
|
||||
<item name="UTF-7">UTF-7</item>
|
||||
<item name="windows-1250">windows-1250</item>
|
||||
<item name="windows-1251">windows-1251</item>
|
||||
<item name="windows-1252">windows-1252</item>
|
||||
<item name="windows-1253">windows-1253</item>
|
||||
<item name="windows-1254">windows-1254</item>
|
||||
<item name="windows-1255">windows-1255</item>
|
||||
<item name="windows-1256">windows-1256</item>
|
||||
<item name="windows-1257">windows-1257</item>
|
||||
<item name="windows-1258">windows-1258</item>
|
||||
<item name="x-docomo-shift_jis-2007">x-docomo-shift_jis-2007</item>
|
||||
<item name="x-gsm-03.38-2000">x-gsm-03.38-2000</item>
|
||||
<item name="x-ibm-1383_P110-1999">x-ibm-1383_P110-1999</item>
|
||||
<item name="x-IMAP-mailbox-name">x-IMAP-mailbox-name</item>
|
||||
<item name="x-iscii-be">x-iscii-be</item>
|
||||
<item name="x-iscii-de">x-iscii-de</item>
|
||||
<item name="x-iscii-gu">x-iscii-gu</item>
|
||||
<item name="x-iscii-ka">x-iscii-ka</item>
|
||||
<item name="x-iscii-ma">x-iscii-ma</item>
|
||||
<item name="x-iscii-or">x-iscii-or</item>
|
||||
<item name="x-iscii-pa">x-iscii-pa</item>
|
||||
<item name="x-iscii-ta">x-iscii-ta</item>
|
||||
<item name="x-iscii-te">x-iscii-te</item>
|
||||
<item name="x-iso-8859_11-2001">x-iso-8859_11-2001</item>
|
||||
<item name="x-UTF16_OppositeEndian">x-UTF16_OppositeEndian</item>
|
||||
<item name="x-UTF16_PlatformEndian">x-UTF16_PlatformEndian</item>
|
||||
<item name="x-UTF32_OppositeEndian">x-UTF32_OppositeEndian</item>
|
||||
<item name="x-UTF32_PlatformEndian">x-UTF32_PlatformEndian</item>
|
||||
</string-array>
|
||||
<string-array name="charsets">
|
||||
<item name="UTF-8">UTF-8</item>
|
||||
<item name="Big">Big5</item>
|
||||
<item name="BOCU-1">BOCU-1</item>
|
||||
<item name="CESU-8">CESU-8</item>
|
||||
<item name="cp864">cp864</item>
|
||||
<item name="EUC-JP">EUC-JP</item>
|
||||
<item name="EUC-KR">EUC-KR</item>
|
||||
<item name="GBK">GBK</item>
|
||||
<item name="HZ-GB-2312">HZ-GB-2312</item>
|
||||
<item name="ISO-2022-JP">ISO-2022-JP</item>
|
||||
<item name="ISO-8859-1">ISO-8859-1</item>
|
||||
<item name="ISO-8859-10">ISO-8859-10</item>
|
||||
<item name="ISO-8859-13">ISO-8859-13</item>
|
||||
<item name="ISO-8859-14">ISO-8859-14</item>
|
||||
<item name="ISO-8859-15">ISO-8859-15</item>
|
||||
<item name="ISO-8859-16">ISO-8859-16</item>
|
||||
<item name="ISO-8859-2">ISO-8859-2</item>
|
||||
<item name="ISO-8859-3">ISO-8859-3</item>
|
||||
<item name="ISO-8859-4">ISO-8859-4</item>
|
||||
<item name="ISO-8859-5">ISO-8859-5</item>
|
||||
<item name="ISO-8859-6">ISO-8859-6</item>
|
||||
<item name="ISO-8859-7">ISO-8859-7</item>
|
||||
<item name="ISO-8859-8">ISO-8859-8</item>
|
||||
<item name="ISO-8859-9">ISO-8859-9</item>
|
||||
<item name="KOI8-R">KOI8-R</item>
|
||||
<item name="macintosh">macintosh</item>
|
||||
<item name="SCSU">SCSU</item>
|
||||
<item name="Shift_JIS">Shift_JIS</item>
|
||||
<item name="TIS-620">TIS-620</item>
|
||||
<item name="US-ASCII">US-ASCII</item>
|
||||
<item name="UTF-16">UTF-16</item>
|
||||
<item name="UTF-16BE">UTF-16BE</item>
|
||||
<item name="UTF-16LE">UTF-16LE</item>
|
||||
<item name="UTF-32">UTF-32</item>
|
||||
<item name="UTF-32BE">UTF-32BE</item>
|
||||
<item name="UTF-32LE">UTF-32LE</item>
|
||||
<item name="UTF-7">UTF-7</item>
|
||||
<item name="windows-1250">windows-1250</item>
|
||||
<item name="windows-1251">windows-1251</item>
|
||||
<item name="windows-1252">windows-1252</item>
|
||||
<item name="windows-1253">windows-1253</item>
|
||||
<item name="windows-1254">windows-1254</item>
|
||||
<item name="windows-1255">windows-1255</item>
|
||||
<item name="windows-1256">windows-1256</item>
|
||||
<item name="windows-1257">windows-1257</item>
|
||||
<item name="windows-1258">windows-1258</item>
|
||||
<item name="x-docomo-shift_jis-2007">x-docomo-shift_jis-2007</item>
|
||||
<item name="x-gsm-03.38-2000">x-gsm-03.38-2000</item>
|
||||
<item name="x-ibm-1383_P110-1999">x-ibm-1383_P110-1999</item>
|
||||
<item name="x-IMAP-mailbox-name">x-IMAP-mailbox-name</item>
|
||||
<item name="x-iscii-be">x-iscii-be</item>
|
||||
<item name="x-iscii-de">x-iscii-de</item>
|
||||
<item name="x-iscii-gu">x-iscii-gu</item>
|
||||
<item name="x-iscii-ka">x-iscii-ka</item>
|
||||
<item name="x-iscii-ma">x-iscii-ma</item>
|
||||
<item name="x-iscii-or">x-iscii-or</item>
|
||||
<item name="x-iscii-pa">x-iscii-pa</item>
|
||||
<item name="x-iscii-ta">x-iscii-ta</item>
|
||||
<item name="x-iscii-te">x-iscii-te</item>
|
||||
<item name="x-iso-8859_11-2001">x-iso-8859_11-2001</item>
|
||||
<item name="x-UTF16_OppositeEndian">x-UTF16_OppositeEndian</item>
|
||||
<item name="x-UTF16_PlatformEndian">x-UTF16_PlatformEndian</item>
|
||||
<item name="x-UTF32_OppositeEndian">x-UTF32_OppositeEndian</item>
|
||||
<item name="x-UTF32_PlatformEndian">x-UTF32_PlatformEndian</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -1,32 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="key_show_timestamp">show_timestamp</string>
|
||||
<string name="default_show_timestamp">false</string>
|
||||
<string name="key_show_timestamp">show_timestamp</string>
|
||||
<string name="default_show_timestamp">false</string>
|
||||
|
||||
<string name="key_show_icons">show_icons</string>
|
||||
<string name="default_show_icons">true</string>
|
||||
<string name="key_show_icons">show_icons</string>
|
||||
<string name="default_show_icons">true</string>
|
||||
|
||||
<string name="key_show_colors">show_colors</string>
|
||||
<string name="default_show_colors">true</string>
|
||||
<string name="key_show_colors">show_colors</string>
|
||||
<string name="default_show_colors">true</string>
|
||||
|
||||
<string name="key_show_colors_nick">show_colors_nick</string>
|
||||
<string name="default_show_colors_nick">false</string>
|
||||
<string name="key_show_colors_nick">show_colors_nick</string>
|
||||
<string name="default_show_colors_nick">false</string>
|
||||
|
||||
<string name="key_24h_format">24h_format</string>
|
||||
<string name="default_24h_format">true</string>
|
||||
<string name="key_24h_format">24h_format</string>
|
||||
<string name="default_24h_format">true</string>
|
||||
|
||||
<string name="key_reconnect">reconnect</string>
|
||||
<string name="default_reconnect">false</string>
|
||||
<string name="key_reconnect">reconnect</string>
|
||||
<string name="default_reconnect">false</string>
|
||||
|
||||
<string name="key_quitmessage">quitmessage</string>
|
||||
<string name="default_quitmessage">Yaaic - Yet another Android IRC client - http://www.yaaic.org</string>
|
||||
<string name="key_quitmessage">quitmessage</string>
|
||||
<string name="default_quitmessage">Yaaic - Yet another Android IRC client - http://www.yaaic.org</string>
|
||||
|
||||
<string name="key_fontsize">fontsize</string>
|
||||
<string name="default_fontsize">11</string>
|
||||
<string name="key_fontsize">fontsize</string>
|
||||
<string name="default_fontsize">11</string>
|
||||
|
||||
<string name="key_voice_recognition">voice_recognition</string>
|
||||
<string name="default_voice_recognition">false</string>
|
||||
<string name="key_voice_recognition">voice_recognition</string>
|
||||
<string name="default_voice_recognition">false</string>
|
||||
|
||||
<string name="key_vibrate_highlight">vibrate_highlight</string>
|
||||
<string name="default_vibrate_highlight">true</string>
|
||||
<string name="key_vibrate_highlight">vibrate_highlight</string>
|
||||
<string name="default_vibrate_highlight">true</string>
|
||||
</resources>
|
||||
|
@ -20,18 +20,18 @@ You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_connection">
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_reconnect_title"
|
||||
android:summary="@string/settings_reconnect_desc"
|
||||
android:key="@string/key_reconnect"
|
||||
android:defaultValue="@string/default_reconnect" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_chat">
|
||||
<ListPreference
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_connection">
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_reconnect_title"
|
||||
android:summary="@string/settings_reconnect_desc"
|
||||
android:key="@string/key_reconnect"
|
||||
android:defaultValue="@string/default_reconnect" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_chat">
|
||||
<ListPreference
|
||||
android:title="@string/settings_fontsize_title"
|
||||
android:summary="@string/settings_fontsize_desc"
|
||||
android:dialogTitle="@string/settings_fontsize_dialog_title"
|
||||
@ -39,52 +39,52 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:entryValues="@array/fontsize_values"
|
||||
android:key="@string/key_fontsize"
|
||||
android:defaultValue="@string/default_fontsize" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_icons_title"
|
||||
android:summary="@string/settings_icons_desc"
|
||||
android:key="@string/key_show_icons"
|
||||
android:defaultValue="@string/default_show_icons" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_colors_title"
|
||||
android:summary="@string/settings_colors_desc"
|
||||
android:key="@string/key_show_colors"
|
||||
android:defaultValue="@string/default_show_colors"/>
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_colors_nick_title"
|
||||
android:key="@string/key_show_colors_nick"
|
||||
android:summary="@string/settings_colors_nick_desc"
|
||||
android:defaultValue="@string/default_show_colors_nick"/>
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_timestamp_title"
|
||||
android:summary="@string/settings_timestamp_desc"
|
||||
android:key="@string/key_show_timestamp"
|
||||
android:defaultValue="@string/default_show_timestamp" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_24h_title"
|
||||
android:summary="@string/settings_24h_desc"
|
||||
android:key="@string/key_24h_format"
|
||||
android:defaultValue="@string/default_24h_format"
|
||||
android:dependency="@string/key_show_timestamp" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_icons_title"
|
||||
android:summary="@string/settings_icons_desc"
|
||||
android:key="@string/key_show_icons"
|
||||
android:defaultValue="@string/default_show_icons" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_colors_title"
|
||||
android:summary="@string/settings_colors_desc"
|
||||
android:key="@string/key_show_colors"
|
||||
android:defaultValue="@string/default_show_colors"/>
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_colors_nick_title"
|
||||
android:key="@string/key_show_colors_nick"
|
||||
android:summary="@string/settings_colors_nick_desc"
|
||||
android:defaultValue="@string/default_show_colors_nick"/>
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_timestamp_title"
|
||||
android:summary="@string/settings_timestamp_desc"
|
||||
android:key="@string/key_show_timestamp"
|
||||
android:defaultValue="@string/default_show_timestamp" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_24h_title"
|
||||
android:summary="@string/settings_24h_desc"
|
||||
android:key="@string/key_24h_format"
|
||||
android:defaultValue="@string/default_24h_format"
|
||||
android:dependency="@string/key_show_timestamp" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_misc">
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_misc">
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_voice_recognition_title"
|
||||
android:summary="@string/settings_voice_recognition_desc"
|
||||
android:key="@string/key_voice_recognition"
|
||||
android:defaultValue="@string/default_voice_recognition" />
|
||||
<EditTextPreference
|
||||
android:title="@string/settings_quitmessage_title"
|
||||
android:summary="@string/settings_quitmessage_desc"
|
||||
android:key="@string/key_quitmessage"
|
||||
android:defaultValue="@string/default_quitmessage"
|
||||
android:dialogTitle="@string/settings_quitmessage_dialog_title"
|
||||
android:dialogMessage="@string/settings_quitmessage_dialog_desc" />
|
||||
<EditTextPreference
|
||||
android:title="@string/settings_quitmessage_title"
|
||||
android:summary="@string/settings_quitmessage_desc"
|
||||
android:key="@string/key_quitmessage"
|
||||
android:defaultValue="@string/default_quitmessage"
|
||||
android:dialogTitle="@string/settings_quitmessage_dialog_title"
|
||||
android:dialogMessage="@string/settings_quitmessage_dialog_desc" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_vibrate_highlight_title"
|
||||
android:summary="@string/settings_vibrate_highlight_desc"
|
||||
android:key="@string/key_vibrate_highlight"
|
||||
android:defaultValue="@string/default_vibrate_highlight" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
@ -22,9 +22,9 @@ package org.jibble.pircbot;
|
||||
* @version 1.4.6 (Build time: Wed Apr 11 19:20:59 2007)
|
||||
*/
|
||||
public class IrcException extends Exception {
|
||||
private static final long serialVersionUID = -3705541066912475928L;
|
||||
private static final long serialVersionUID = -3705541066912475928L;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructs a new IrcException.
|
||||
*
|
||||
* @param e The error message to report.
|
||||
|
@ -25,9 +25,9 @@ package org.jibble.pircbot;
|
||||
* @version 1.4.6 (Build time: Wed Apr 11 19:20:59 2007)
|
||||
*/
|
||||
public class NickAlreadyInUseException extends IrcException {
|
||||
private static final long serialVersionUID = -4724325464519465479L;
|
||||
private static final long serialVersionUID = -4724325464519465479L;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructs a new IrcException.
|
||||
*
|
||||
* @param e The error message to report.
|
||||
|
@ -158,21 +158,21 @@ public abstract class PircBot implements ReplyConstants {
|
||||
// XXX: PircBot Patch for SSL
|
||||
Socket socket;
|
||||
if (_useSSL) {
|
||||
try {
|
||||
SSLContext context = SSLContext.getInstance("TLS");
|
||||
context.init(null, new X509TrustManager[] { new NaiveTrustManager() }, null);
|
||||
SSLSocketFactory factory = context.getSocketFactory();
|
||||
SSLSocket ssocket = (SSLSocket) factory.createSocket(hostname, port);
|
||||
ssocket.startHandshake();
|
||||
socket = ssocket;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
// XXX: It's not really an IOException :)
|
||||
throw new IOException("Cannot open SSL socket");
|
||||
}
|
||||
try {
|
||||
SSLContext context = SSLContext.getInstance("TLS");
|
||||
context.init(null, new X509TrustManager[] { new NaiveTrustManager() }, null);
|
||||
SSLSocketFactory factory = context.getSocketFactory();
|
||||
SSLSocket ssocket = (SSLSocket) factory.createSocket(hostname, port);
|
||||
ssocket.startHandshake();
|
||||
socket = ssocket;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
// XXX: It's not really an IOException :)
|
||||
throw new IOException("Cannot open SSL socket");
|
||||
}
|
||||
} else {
|
||||
socket = new Socket(hostname, port);
|
||||
socket = new Socket(hostname, port);
|
||||
}
|
||||
|
||||
_inetAddress = socket.getLocalAddress();
|
||||
@ -245,7 +245,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
|
||||
// XXX: PircBot patch - We are not connected to server if nothing received
|
||||
if (line == null) {
|
||||
throw new IOException("Could not connect to server");
|
||||
throw new IOException("Could not connect to server");
|
||||
}
|
||||
|
||||
// This makes the socket timeout on read operations after 5 minutes.
|
||||
@ -293,7 +293,7 @@ public abstract class PircBot implements ReplyConstants {
|
||||
*/
|
||||
public void setUseSSL(boolean useSSL)
|
||||
{
|
||||
_useSSL = useSSL;
|
||||
_useSSL = useSSL;
|
||||
}
|
||||
|
||||
|
||||
@ -1014,9 +1014,9 @@ public abstract class PircBot implements ReplyConstants {
|
||||
else if (command.equals("QUIT")) {
|
||||
// Someone has quit from the IRC server.
|
||||
|
||||
// XXX: Pircbot Patch - Call onQuit before removing the user. This way we
|
||||
// are able to know which channels the user was on.
|
||||
this.onQuit(sourceNick, sourceLogin, sourceHostname, line.substring(line.indexOf(" :") + 2));
|
||||
// XXX: Pircbot Patch - Call onQuit before removing the user. This way we
|
||||
// are able to know which channels the user was on.
|
||||
this.onQuit(sourceNick, sourceLogin, sourceHostname, line.substring(line.indexOf(" :") + 2));
|
||||
|
||||
if (sourceNick.equals(this.getNick())) {
|
||||
this.removeAllChannels();
|
||||
|
@ -36,112 +36,112 @@ import android.content.Context;
|
||||
*/
|
||||
public class Yaaic
|
||||
{
|
||||
public static Yaaic instance;
|
||||
public static Yaaic instance;
|
||||
|
||||
private HashMap<Integer, Server> servers;
|
||||
private boolean serversLoaded = false;
|
||||
private HashMap<Integer, Server> servers;
|
||||
private boolean serversLoaded = false;
|
||||
|
||||
/**
|
||||
* Private constructor, you may want to use static getInstance()
|
||||
*/
|
||||
private Yaaic()
|
||||
{
|
||||
servers = new HashMap<Integer, Server>();
|
||||
}
|
||||
/**
|
||||
* Private constructor, you may want to use static getInstance()
|
||||
*/
|
||||
private Yaaic()
|
||||
{
|
||||
servers = new HashMap<Integer, Server>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load servers from database
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public void loadServers(Context context)
|
||||
{
|
||||
if (!serversLoaded) {
|
||||
Database db = new Database(context);
|
||||
servers = db.getServers();
|
||||
db.close();
|
||||
/**
|
||||
* Load servers from database
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public void loadServers(Context context)
|
||||
{
|
||||
if (!serversLoaded) {
|
||||
Database db = new Database(context);
|
||||
servers = db.getServers();
|
||||
db.close();
|
||||
|
||||
//context.sendBroadcast(new Intent(Broadcast.SERVER_UPDATE));
|
||||
serversLoaded = true;
|
||||
}
|
||||
}
|
||||
//context.sendBroadcast(new Intent(Broadcast.SERVER_UPDATE));
|
||||
serversLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get global Yaaic instance
|
||||
*
|
||||
* @return the global Yaaic instance
|
||||
*/
|
||||
public static Yaaic getInstance()
|
||||
{
|
||||
if (instance == null) {
|
||||
instance = new Yaaic();
|
||||
}
|
||||
/**
|
||||
* Get global Yaaic instance
|
||||
*
|
||||
* @return the global Yaaic instance
|
||||
*/
|
||||
public static Yaaic getInstance()
|
||||
{
|
||||
if (instance == null) {
|
||||
instance = new Yaaic();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get server by id
|
||||
*
|
||||
* @return Server object with given unique id
|
||||
*/
|
||||
public Server getServerById(int serverId)
|
||||
{
|
||||
return servers.get(serverId);
|
||||
}
|
||||
/**
|
||||
* Get server by id
|
||||
*
|
||||
* @return Server object with given unique id
|
||||
*/
|
||||
public Server getServerById(int serverId)
|
||||
{
|
||||
return servers.get(serverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove server with given unique id from list
|
||||
*
|
||||
* @param serverId
|
||||
*/
|
||||
public void removeServerById(int serverId)
|
||||
{
|
||||
servers.remove(serverId);
|
||||
}
|
||||
/**
|
||||
* Remove server with given unique id from list
|
||||
*
|
||||
* @param serverId
|
||||
*/
|
||||
public void removeServerById(int serverId)
|
||||
{
|
||||
servers.remove(serverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set servers
|
||||
*
|
||||
* @param servers
|
||||
*/
|
||||
public void setServers(HashMap<Integer, Server> servers)
|
||||
{
|
||||
this.servers = servers;
|
||||
}
|
||||
/**
|
||||
* Set servers
|
||||
*
|
||||
* @param servers
|
||||
*/
|
||||
public void setServers(HashMap<Integer, Server> servers)
|
||||
{
|
||||
this.servers = servers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add server to list
|
||||
*/
|
||||
public void addServer(Server server)
|
||||
{
|
||||
if (!servers.containsKey(server.getId())) {
|
||||
servers.put(server.getId(), server);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add server to list
|
||||
*/
|
||||
public void addServer(Server server)
|
||||
{
|
||||
if (!servers.containsKey(server.getId())) {
|
||||
servers.put(server.getId(), server);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a server in list
|
||||
*/
|
||||
public void updateServer(Server server)
|
||||
{
|
||||
servers.put(server.getId(), server);
|
||||
}
|
||||
/**
|
||||
* Update a server in list
|
||||
*/
|
||||
public void updateServer(Server server)
|
||||
{
|
||||
servers.put(server.getId(), server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of servers
|
||||
*
|
||||
* @return list of servers
|
||||
*/
|
||||
public ArrayList<Server> getServersAsArrayList()
|
||||
{
|
||||
ArrayList<Server> serverList = new ArrayList<Server>();
|
||||
/**
|
||||
* Get list of servers
|
||||
*
|
||||
* @return list of servers
|
||||
*/
|
||||
public ArrayList<Server> getServersAsArrayList()
|
||||
{
|
||||
ArrayList<Server> serverList = new ArrayList<Server>();
|
||||
|
||||
Set<Integer> mKeys = servers.keySet();
|
||||
for (int key : mKeys) {
|
||||
serverList.add(servers.get(key));
|
||||
}
|
||||
Set<Integer> mKeys = servers.keySet();
|
||||
for (int key : mKeys) {
|
||||
serverList.add(servers.get(key));
|
||||
}
|
||||
|
||||
return serverList;
|
||||
}
|
||||
return serverList;
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,15 @@ import android.view.Window;
|
||||
*/
|
||||
public class AboutActivity extends Activity
|
||||
{
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.about);
|
||||
}
|
||||
|
@ -24,106 +24,106 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||
|
||||
public class AddAliasActivity extends Activity implements OnClickListener, OnItemClickListener, TextWatcher
|
||||
{
|
||||
private EditText aliasInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> aliases;
|
||||
private Button addButton;
|
||||
private Button okButton;
|
||||
private EditText aliasInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> aliases;
|
||||
private Button addButton;
|
||||
private Button okButton;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.aliasadd);
|
||||
setContentView(R.layout.aliasadd);
|
||||
|
||||
aliasInput = (EditText) findViewById(R.id.alias);
|
||||
aliasInput.addTextChangedListener(this);
|
||||
aliasInput = (EditText) findViewById(R.id.alias);
|
||||
aliasInput.addTextChangedListener(this);
|
||||
|
||||
adapter = new ArrayAdapter<String>(this, R.layout.aliasitem);
|
||||
adapter = new ArrayAdapter<String>(this, R.layout.aliasitem);
|
||||
|
||||
ListView list = (ListView) findViewById(R.id.aliases);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
ListView list = (ListView) findViewById(R.id.aliases);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
|
||||
addButton = (Button) findViewById(R.id.add);
|
||||
addButton.setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
addButton = (Button) findViewById(R.id.add);
|
||||
addButton.setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
|
||||
aliases = getIntent().getExtras().getStringArrayList(Extra.ALIASES);
|
||||
aliases = getIntent().getExtras().getStringArrayList(Extra.ALIASES);
|
||||
|
||||
for (String alias : aliases) {
|
||||
adapter.add(alias);
|
||||
}
|
||||
}
|
||||
for (String alias : aliases) {
|
||||
adapter.add(alias);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On Click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.add:
|
||||
String alias = aliasInput.getText().toString().trim();
|
||||
aliases.add(alias);
|
||||
adapter.add(alias);
|
||||
aliasInput.setText("");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
case R.id.ok:
|
||||
// Get list and return as result
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.ALIASES, aliases);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* On Click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.add:
|
||||
String alias = aliasInput.getText().toString().trim();
|
||||
aliases.add(alias);
|
||||
adapter.add(alias);
|
||||
aliasInput.setText("");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
case R.id.ok:
|
||||
// Get list and return as result
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.ALIASES, aliases);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
final String alias = adapter.getItem(position);
|
||||
/**
|
||||
* On item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
final String alias = adapter.getItem(position);
|
||||
|
||||
String[] items = { getResources().getString(R.string.action_remove) };
|
||||
String[] items = { getResources().getString(R.string.action_remove) };
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(alias);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Remove
|
||||
adapter.remove(alias);
|
||||
aliases.remove(alias);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(alias);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Remove
|
||||
adapter.remove(alias);
|
||||
aliases.remove(alias);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
|
||||
public void afterTextChanged(Editable s) {
|
||||
// Do nothing.
|
||||
}
|
||||
public void afterTextChanged(Editable s) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
// Do nothing.
|
||||
}
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
addButton.setEnabled(aliasInput.getText().length() > 0);
|
||||
}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
addButton.setEnabled(aliasInput.getText().length() > 0);
|
||||
}
|
||||
}
|
||||
|
@ -47,94 +47,94 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||
*/
|
||||
public class AddChannelActivity extends Activity implements OnClickListener, OnItemClickListener
|
||||
{
|
||||
private EditText channelInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> channels;
|
||||
private Button okButton;
|
||||
private EditText channelInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> channels;
|
||||
private Button okButton;
|
||||
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.channeladd);
|
||||
setContentView(R.layout.channeladd);
|
||||
|
||||
channelInput = (EditText) findViewById(R.id.channel);
|
||||
channelInput = (EditText) findViewById(R.id.channel);
|
||||
|
||||
adapter = new ArrayAdapter<String>(this, R.layout.channelitem);
|
||||
adapter = new ArrayAdapter<String>(this, R.layout.channelitem);
|
||||
|
||||
ListView list = (ListView) findViewById(R.id.channels);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
ListView list = (ListView) findViewById(R.id.channels);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
|
||||
((Button) findViewById(R.id.add)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.add)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
|
||||
channels = getIntent().getExtras().getStringArrayList(Extra.CHANNELS);
|
||||
channels = getIntent().getExtras().getStringArrayList(Extra.CHANNELS);
|
||||
|
||||
for (String channel : channels) {
|
||||
adapter.add(channel);
|
||||
}
|
||||
}
|
||||
for (String channel : channels) {
|
||||
adapter.add(channel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On Click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.add:
|
||||
String channel = channelInput.getText().toString().trim();
|
||||
channels.add(channel);
|
||||
adapter.add(channel);
|
||||
channelInput.setText("#");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
case R.id.ok:
|
||||
// Get list and return as result
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.CHANNELS, channels);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* On Click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.add:
|
||||
String channel = channelInput.getText().toString().trim();
|
||||
channels.add(channel);
|
||||
adapter.add(channel);
|
||||
channelInput.setText("#");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
case R.id.ok:
|
||||
// Get list and return as result
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.CHANNELS, channels);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
final String channel = adapter.getItem(position);
|
||||
/**
|
||||
* On item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
final String channel = adapter.getItem(position);
|
||||
|
||||
String[] items = { getResources().getString(R.string.action_remove) };
|
||||
String[] items = { getResources().getString(R.string.action_remove) };
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(channel);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Remove
|
||||
adapter.remove(channel);
|
||||
channels.remove(channel);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(channel);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Remove
|
||||
adapter.remove(channel);
|
||||
channels.remove(channel);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
|
@ -47,100 +47,100 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||
*/
|
||||
public class AddCommandsActivity extends Activity implements OnClickListener, OnItemClickListener
|
||||
{
|
||||
private EditText commandInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> commands;
|
||||
private Button okButton;
|
||||
private EditText commandInput;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private ArrayList<String> commands;
|
||||
private Button okButton;
|
||||
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.commandadd);
|
||||
setContentView(R.layout.commandadd);
|
||||
|
||||
commandInput = (EditText) findViewById(R.id.command);
|
||||
commandInput = (EditText) findViewById(R.id.command);
|
||||
|
||||
adapter = new ArrayAdapter<String>(this, R.layout.commanditem);
|
||||
adapter = new ArrayAdapter<String>(this, R.layout.commanditem);
|
||||
|
||||
ListView list = (ListView) findViewById(R.id.commands);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
ListView list = (ListView) findViewById(R.id.commands);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
|
||||
((Button) findViewById(R.id.add)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.ok)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.add)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.ok)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
||||
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
okButton = (Button) findViewById(R.id.ok);
|
||||
okButton.setOnClickListener(this);
|
||||
okButton.setEnabled(false);
|
||||
|
||||
commands = getIntent().getExtras().getStringArrayList(Extra.COMMANDS);
|
||||
commands = getIntent().getExtras().getStringArrayList(Extra.COMMANDS);
|
||||
|
||||
for (String command : commands) {
|
||||
adapter.add(command);
|
||||
}
|
||||
}
|
||||
for (String command : commands) {
|
||||
adapter.add(command);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On Click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.add:
|
||||
String command = commandInput.getText().toString().trim();
|
||||
/**
|
||||
* On Click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.add:
|
||||
String command = commandInput.getText().toString().trim();
|
||||
|
||||
if (!command.startsWith("/")) {
|
||||
command = "/" + command;
|
||||
}
|
||||
if (!command.startsWith("/")) {
|
||||
command = "/" + command;
|
||||
}
|
||||
|
||||
commands.add(command);
|
||||
adapter.add(command);
|
||||
commandInput.setText("/");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
case R.id.ok:
|
||||
// Get list and return as result
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.COMMANDS, commands);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
commands.add(command);
|
||||
adapter.add(command);
|
||||
commandInput.setText("/");
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
case R.id.ok:
|
||||
// Get list and return as result
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.COMMANDS, commands);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
final String command = adapter.getItem(position);
|
||||
/**
|
||||
* On item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
final String command = adapter.getItem(position);
|
||||
|
||||
String[] items = { getResources().getString(R.string.action_remove) };
|
||||
String[] items = { getResources().getString(R.string.action_remove) };
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(command);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Remove
|
||||
adapter.remove(command);
|
||||
commands.remove(command);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(command);
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Remove
|
||||
adapter.remove(command);
|
||||
commands.remove(command);
|
||||
okButton.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
|
@ -53,19 +53,19 @@ import org.yaaic.model.Status;
|
||||
*/
|
||||
public class AddServerActivity extends Activity implements OnClickListener
|
||||
{
|
||||
private static final int REQUEST_CODE_CHANNELS = 1;
|
||||
private static final int REQUEST_CODE_COMMANDS = 2;
|
||||
private static final int REQUEST_CODE_ALIASES = 3;
|
||||
private static final int REQUEST_CODE_CHANNELS = 1;
|
||||
private static final int REQUEST_CODE_COMMANDS = 2;
|
||||
private static final int REQUEST_CODE_ALIASES = 3;
|
||||
|
||||
private Server server;
|
||||
private ArrayList<String> aliases;
|
||||
private ArrayList<String> channels;
|
||||
private ArrayList<String> commands;
|
||||
private Server server;
|
||||
private ArrayList<String> aliases;
|
||||
private ArrayList<String> channels;
|
||||
private ArrayList<String> commands;
|
||||
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -89,327 +89,327 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if (extras != null && extras.containsKey(Extra.SERVER)) {
|
||||
// Request to edit an existing server
|
||||
Database db = new Database(this);
|
||||
this.server = db.getServerById(extras.getInt(Extra.SERVER));
|
||||
aliases.addAll(server.getIdentity().getAliases());
|
||||
this.channels = db.getChannelsByServerId(server.getId());
|
||||
this.commands = db.getCommandsByServerId(server.getId());
|
||||
db.close();
|
||||
// Request to edit an existing server
|
||||
Database db = new Database(this);
|
||||
this.server = db.getServerById(extras.getInt(Extra.SERVER));
|
||||
aliases.addAll(server.getIdentity().getAliases());
|
||||
this.channels = db.getChannelsByServerId(server.getId());
|
||||
this.commands = db.getCommandsByServerId(server.getId());
|
||||
db.close();
|
||||
|
||||
// Set server values
|
||||
((EditText) findViewById(R.id.title)).setText(server.getTitle());
|
||||
((EditText) findViewById(R.id.host)).setText(server.getHost());
|
||||
((EditText) findViewById(R.id.port)).setText(String.valueOf(server.getPort()));
|
||||
((EditText) findViewById(R.id.password)).setText(server.getPassword());
|
||||
// Set server values
|
||||
((EditText) findViewById(R.id.title)).setText(server.getTitle());
|
||||
((EditText) findViewById(R.id.host)).setText(server.getHost());
|
||||
((EditText) findViewById(R.id.port)).setText(String.valueOf(server.getPort()));
|
||||
((EditText) findViewById(R.id.password)).setText(server.getPassword());
|
||||
|
||||
((EditText) findViewById(R.id.nickname)).setText(server.getIdentity().getNickname());
|
||||
((EditText) findViewById(R.id.ident)).setText(server.getIdentity().getIdent());
|
||||
((EditText) findViewById(R.id.realname)).setText(server.getIdentity().getRealName());
|
||||
((CheckBox) findViewById(R.id.useSSL)).setChecked(server.useSSL());
|
||||
((EditText) findViewById(R.id.nickname)).setText(server.getIdentity().getNickname());
|
||||
((EditText) findViewById(R.id.ident)).setText(server.getIdentity().getIdent());
|
||||
((EditText) findViewById(R.id.realname)).setText(server.getIdentity().getRealName());
|
||||
((CheckBox) findViewById(R.id.useSSL)).setChecked(server.useSSL());
|
||||
|
||||
// Select charset
|
||||
if (server.getCharset() != null) {
|
||||
for (int i = 0; i < charsets.length; i++) {
|
||||
if (server.getCharset().equals(charsets[i])) {
|
||||
spinner.setSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Select charset
|
||||
if (server.getCharset() != null) {
|
||||
for (int i = 0; i < charsets.length; i++) {
|
||||
if (server.getCharset().equals(charsets[i])) {
|
||||
spinner.setSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Uri uri = getIntent().getData();
|
||||
if (uri != null && uri.getScheme().equals("irc")) {
|
||||
// handling an irc:// uri
|
||||
// handling an irc:// uri
|
||||
|
||||
((EditText) findViewById(R.id.host)).setText(uri.getHost());
|
||||
if (uri.getPort() != -1) {
|
||||
((EditText) findViewById(R.id.port)).setText(String.valueOf(uri.getPort()));
|
||||
}
|
||||
((EditText) findViewById(R.id.host)).setText(uri.getHost());
|
||||
if (uri.getPort() != -1) {
|
||||
((EditText) findViewById(R.id.port)).setText(String.valueOf(uri.getPort()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On activity result
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
if (resultCode != RESULT_OK) {
|
||||
return; // ignore everything else
|
||||
}
|
||||
/**
|
||||
* On activity result
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
if (resultCode != RESULT_OK) {
|
||||
return; // ignore everything else
|
||||
}
|
||||
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_ALIASES:
|
||||
aliases.clear();
|
||||
aliases.addAll(data.getExtras().getStringArrayList(Extra.ALIASES));
|
||||
break;
|
||||
case REQUEST_CODE_CHANNELS:
|
||||
channels = data.getExtras().getStringArrayList(Extra.CHANNELS);
|
||||
break;
|
||||
case REQUEST_CODE_COMMANDS:
|
||||
commands = data.getExtras().getStringArrayList(Extra.COMMANDS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_ALIASES:
|
||||
aliases.clear();
|
||||
aliases.addAll(data.getExtras().getStringArrayList(Extra.ALIASES));
|
||||
break;
|
||||
case REQUEST_CODE_CHANNELS:
|
||||
channels = data.getExtras().getStringArrayList(Extra.CHANNELS);
|
||||
break;
|
||||
case REQUEST_CODE_COMMANDS:
|
||||
commands = data.getExtras().getStringArrayList(Extra.COMMANDS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On click add server or cancel activity
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.aliases:
|
||||
Intent aliasIntent = new Intent(this, AddAliasActivity.class);
|
||||
aliasIntent.putExtra(Extra.ALIASES, aliases);
|
||||
startActivityForResult(aliasIntent, REQUEST_CODE_ALIASES);
|
||||
break;
|
||||
case R.id.channels:
|
||||
Intent channelIntent = new Intent(this, AddChannelActivity.class);
|
||||
channelIntent.putExtra(Extra.CHANNELS, channels);
|
||||
startActivityForResult(channelIntent, REQUEST_CODE_CHANNELS);
|
||||
break;
|
||||
case R.id.commands:
|
||||
Intent commandsIntent = new Intent(this, AddCommandsActivity.class);
|
||||
commandsIntent.putExtra(Extra.COMMANDS, commands);
|
||||
startActivityForResult(commandsIntent, REQUEST_CODE_COMMANDS);
|
||||
break;
|
||||
case R.id.add:
|
||||
try {
|
||||
validateServer();
|
||||
validateIdentity();
|
||||
if (server == null) {
|
||||
addServer();
|
||||
} else {
|
||||
updateServer();
|
||||
}
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
} catch(ValidationException e) {
|
||||
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* On click add server or cancel activity
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
switch (v.getId()) {
|
||||
case R.id.aliases:
|
||||
Intent aliasIntent = new Intent(this, AddAliasActivity.class);
|
||||
aliasIntent.putExtra(Extra.ALIASES, aliases);
|
||||
startActivityForResult(aliasIntent, REQUEST_CODE_ALIASES);
|
||||
break;
|
||||
case R.id.channels:
|
||||
Intent channelIntent = new Intent(this, AddChannelActivity.class);
|
||||
channelIntent.putExtra(Extra.CHANNELS, channels);
|
||||
startActivityForResult(channelIntent, REQUEST_CODE_CHANNELS);
|
||||
break;
|
||||
case R.id.commands:
|
||||
Intent commandsIntent = new Intent(this, AddCommandsActivity.class);
|
||||
commandsIntent.putExtra(Extra.COMMANDS, commands);
|
||||
startActivityForResult(commandsIntent, REQUEST_CODE_COMMANDS);
|
||||
break;
|
||||
case R.id.add:
|
||||
try {
|
||||
validateServer();
|
||||
validateIdentity();
|
||||
if (server == null) {
|
||||
addServer();
|
||||
} else {
|
||||
updateServer();
|
||||
}
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
} catch(ValidationException e) {
|
||||
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add server to database
|
||||
*/
|
||||
private void addServer()
|
||||
{
|
||||
Database db = new Database(this);
|
||||
/**
|
||||
* Add server to database
|
||||
*/
|
||||
private void addServer()
|
||||
{
|
||||
Database db = new Database(this);
|
||||
|
||||
Identity identity = getIdentityFromView();
|
||||
long identityId = db.addIdentity(
|
||||
identity.getNickname(),
|
||||
identity.getIdent(),
|
||||
identity.getRealName(),
|
||||
identity.getAliases()
|
||||
);
|
||||
Identity identity = getIdentityFromView();
|
||||
long identityId = db.addIdentity(
|
||||
identity.getNickname(),
|
||||
identity.getIdent(),
|
||||
identity.getRealName(),
|
||||
identity.getAliases()
|
||||
);
|
||||
|
||||
Server server = getServerFromView();
|
||||
long serverId = db.addServer(
|
||||
server.getTitle(),
|
||||
server.getHost(),
|
||||
server.getPort(),
|
||||
server.getPassword(),
|
||||
false, // auto connect
|
||||
server.useSSL(),
|
||||
identityId,
|
||||
server.getCharset()
|
||||
);
|
||||
Server server = getServerFromView();
|
||||
long serverId = db.addServer(
|
||||
server.getTitle(),
|
||||
server.getHost(),
|
||||
server.getPort(),
|
||||
server.getPassword(),
|
||||
false, // auto connect
|
||||
server.useSSL(),
|
||||
identityId,
|
||||
server.getCharset()
|
||||
);
|
||||
|
||||
db.setChannels((int) serverId, channels);
|
||||
db.setCommands((int) serverId, commands);
|
||||
db.setChannels((int) serverId, channels);
|
||||
db.setCommands((int) serverId, commands);
|
||||
|
||||
db.close();
|
||||
db.close();
|
||||
|
||||
server.setId((int) serverId);
|
||||
server.setIdentity(identity);
|
||||
server.setAutoJoinChannels(channels);
|
||||
server.setConnectCommands(commands);
|
||||
server.setId((int) serverId);
|
||||
server.setIdentity(identity);
|
||||
server.setAutoJoinChannels(channels);
|
||||
server.setConnectCommands(commands);
|
||||
|
||||
Yaaic.getInstance().addServer(server);
|
||||
}
|
||||
Yaaic.getInstance().addServer(server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update server
|
||||
*/
|
||||
private void updateServer()
|
||||
{
|
||||
Database db = new Database(this);
|
||||
/**
|
||||
* Update server
|
||||
*/
|
||||
private void updateServer()
|
||||
{
|
||||
Database db = new Database(this);
|
||||
|
||||
int serverId = this.server.getId();
|
||||
int identityId = db.getIdentityIdByServerId(serverId);
|
||||
int serverId = this.server.getId();
|
||||
int identityId = db.getIdentityIdByServerId(serverId);
|
||||
|
||||
Server server = getServerFromView();
|
||||
db.updateServer(
|
||||
serverId,
|
||||
server.getTitle(),
|
||||
server.getHost(),
|
||||
server.getPort(),
|
||||
server.getPassword(),
|
||||
false, // auto connect
|
||||
server.useSSL(),
|
||||
identityId,
|
||||
server.getCharset()
|
||||
);
|
||||
Server server = getServerFromView();
|
||||
db.updateServer(
|
||||
serverId,
|
||||
server.getTitle(),
|
||||
server.getHost(),
|
||||
server.getPort(),
|
||||
server.getPassword(),
|
||||
false, // auto connect
|
||||
server.useSSL(),
|
||||
identityId,
|
||||
server.getCharset()
|
||||
);
|
||||
|
||||
Identity identity = getIdentityFromView();
|
||||
db.updateIdentity(
|
||||
identityId,
|
||||
identity.getNickname(),
|
||||
identity.getIdent(),
|
||||
identity.getNickname(),
|
||||
identity.getAliases()
|
||||
);
|
||||
Identity identity = getIdentityFromView();
|
||||
db.updateIdentity(
|
||||
identityId,
|
||||
identity.getNickname(),
|
||||
identity.getIdent(),
|
||||
identity.getNickname(),
|
||||
identity.getAliases()
|
||||
);
|
||||
|
||||
db.setChannels(serverId, channels);
|
||||
db.setCommands(serverId, commands);
|
||||
db.setChannels(serverId, channels);
|
||||
db.setCommands(serverId, commands);
|
||||
|
||||
db.close();
|
||||
db.close();
|
||||
|
||||
server.setId(this.server.getId());
|
||||
server.setIdentity(identity);
|
||||
server.setAutoJoinChannels(channels);
|
||||
server.setConnectCommands(commands);
|
||||
server.setId(this.server.getId());
|
||||
server.setIdentity(identity);
|
||||
server.setAutoJoinChannels(channels);
|
||||
server.setConnectCommands(commands);
|
||||
|
||||
Yaaic.getInstance().updateServer(server);
|
||||
}
|
||||
Yaaic.getInstance().updateServer(server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate a server object from the data in the view
|
||||
*
|
||||
* @return The server object
|
||||
*/
|
||||
private Server getServerFromView()
|
||||
{
|
||||
String title = ((EditText) findViewById(R.id.title)).getText().toString().trim();
|
||||
String host = ((EditText) findViewById(R.id.host)).getText().toString().trim();
|
||||
int port = Integer.parseInt(((EditText) findViewById(R.id.port)).getText().toString().trim());
|
||||
String password = ((EditText) findViewById(R.id.password)).getText().toString().trim();
|
||||
String charset = ((Spinner) findViewById(R.id.charset)).getSelectedItem().toString();
|
||||
Boolean useSSL = ((CheckBox) findViewById(R.id.useSSL)).isChecked();
|
||||
/**
|
||||
* Populate a server object from the data in the view
|
||||
*
|
||||
* @return The server object
|
||||
*/
|
||||
private Server getServerFromView()
|
||||
{
|
||||
String title = ((EditText) findViewById(R.id.title)).getText().toString().trim();
|
||||
String host = ((EditText) findViewById(R.id.host)).getText().toString().trim();
|
||||
int port = Integer.parseInt(((EditText) findViewById(R.id.port)).getText().toString().trim());
|
||||
String password = ((EditText) findViewById(R.id.password)).getText().toString().trim();
|
||||
String charset = ((Spinner) findViewById(R.id.charset)).getSelectedItem().toString();
|
||||
Boolean useSSL = ((CheckBox) findViewById(R.id.useSSL)).isChecked();
|
||||
|
||||
// not in use yet
|
||||
//boolean autoConnect = ((CheckBox) findViewById(R.id.autoconnect)).isChecked();
|
||||
// not in use yet
|
||||
//boolean autoConnect = ((CheckBox) findViewById(R.id.autoconnect)).isChecked();
|
||||
|
||||
Server server = new Server();
|
||||
server.setHost(host);
|
||||
server.setPort(port);
|
||||
server.setPassword(password);
|
||||
server.setTitle(title);
|
||||
server.setCharset(charset);
|
||||
server.setUseSSL(useSSL);
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
Server server = new Server();
|
||||
server.setHost(host);
|
||||
server.setPort(port);
|
||||
server.setPassword(password);
|
||||
server.setTitle(title);
|
||||
server.setCharset(charset);
|
||||
server.setUseSSL(useSSL);
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
|
||||
return server;
|
||||
}
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate an identity object from the data in the view
|
||||
*
|
||||
* @return The identity object
|
||||
*/
|
||||
private Identity getIdentityFromView()
|
||||
{
|
||||
String nickname = ((EditText) findViewById(R.id.nickname)).getText().toString().trim();
|
||||
String ident = ((EditText) findViewById(R.id.ident)).getText().toString().trim();
|
||||
String realname = ((EditText) findViewById(R.id.realname)).getText().toString().trim();
|
||||
/**
|
||||
* Populate an identity object from the data in the view
|
||||
*
|
||||
* @return The identity object
|
||||
*/
|
||||
private Identity getIdentityFromView()
|
||||
{
|
||||
String nickname = ((EditText) findViewById(R.id.nickname)).getText().toString().trim();
|
||||
String ident = ((EditText) findViewById(R.id.ident)).getText().toString().trim();
|
||||
String realname = ((EditText) findViewById(R.id.realname)).getText().toString().trim();
|
||||
|
||||
Identity identity = new Identity();
|
||||
identity.setNickname(nickname);
|
||||
identity.setIdent(ident);
|
||||
identity.setRealName(realname);
|
||||
Identity identity = new Identity();
|
||||
identity.setNickname(nickname);
|
||||
identity.setIdent(ident);
|
||||
identity.setRealName(realname);
|
||||
|
||||
identity.setAliases(aliases);
|
||||
identity.setAliases(aliases);
|
||||
|
||||
return identity;
|
||||
}
|
||||
return identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the input for a server
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
private void validateServer() throws ValidationException
|
||||
{
|
||||
String title = ((EditText) findViewById(R.id.title)).getText().toString();
|
||||
String host = ((EditText) findViewById(R.id.host)).getText().toString();
|
||||
String port = ((EditText) findViewById(R.id.port)).getText().toString();
|
||||
String charset = ((Spinner) findViewById(R.id.charset)).getSelectedItem().toString();
|
||||
/**
|
||||
* Validate the input for a server
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
private void validateServer() throws ValidationException
|
||||
{
|
||||
String title = ((EditText) findViewById(R.id.title)).getText().toString();
|
||||
String host = ((EditText) findViewById(R.id.host)).getText().toString();
|
||||
String port = ((EditText) findViewById(R.id.port)).getText().toString();
|
||||
String charset = ((Spinner) findViewById(R.id.charset)).getSelectedItem().toString();
|
||||
|
||||
if (title.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_title));
|
||||
}
|
||||
if (title.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_title));
|
||||
}
|
||||
|
||||
if (host.trim().equals("")) {
|
||||
// XXX: We should use some better host validation
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_host));
|
||||
}
|
||||
if (host.trim().equals("")) {
|
||||
// XXX: We should use some better host validation
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_host));
|
||||
}
|
||||
|
||||
try {
|
||||
Integer.parseInt(port);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_invalid_port));
|
||||
}
|
||||
try {
|
||||
Integer.parseInt(port);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_invalid_port));
|
||||
}
|
||||
|
||||
try {
|
||||
"".getBytes(charset);
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_unsupported_charset));
|
||||
}
|
||||
try {
|
||||
"".getBytes(charset);
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_unsupported_charset));
|
||||
}
|
||||
|
||||
Database db = new Database(this);
|
||||
if (db.isTitleUsed(title) && (server == null || !server.getTitle().equals(title))) {
|
||||
db.close();
|
||||
throw new ValidationException(getResources().getString(R.string.validation_title_used));
|
||||
}
|
||||
db.close();
|
||||
}
|
||||
Database db = new Database(this);
|
||||
if (db.isTitleUsed(title) && (server == null || !server.getTitle().equals(title))) {
|
||||
db.close();
|
||||
throw new ValidationException(getResources().getString(R.string.validation_title_used));
|
||||
}
|
||||
db.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the input for a identity
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
private void validateIdentity() throws ValidationException
|
||||
{
|
||||
String nickname = ((EditText) findViewById(R.id.nickname)).getText().toString();
|
||||
String ident = ((EditText) findViewById(R.id.ident)).getText().toString();
|
||||
String realname = ((EditText) findViewById(R.id.realname)).getText().toString();
|
||||
/**
|
||||
* Validate the input for a identity
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
private void validateIdentity() throws ValidationException
|
||||
{
|
||||
String nickname = ((EditText) findViewById(R.id.nickname)).getText().toString();
|
||||
String ident = ((EditText) findViewById(R.id.ident)).getText().toString();
|
||||
String realname = ((EditText) findViewById(R.id.realname)).getText().toString();
|
||||
|
||||
if (nickname.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_nickname));
|
||||
}
|
||||
if (nickname.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_nickname));
|
||||
}
|
||||
|
||||
if (ident.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_ident));
|
||||
}
|
||||
if (ident.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_ident));
|
||||
}
|
||||
|
||||
if (realname.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_realname));
|
||||
}
|
||||
if (realname.trim().equals("")) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_blank_realname));
|
||||
}
|
||||
|
||||
// RFC 1459: <nick> ::= <letter> { <letter> | <number> | <special> }
|
||||
// <special> ::= '-' | '[' | ']' | '\' | '`' | '^' | '{' | '}'
|
||||
// Chars that are not in RFC 1459 but are supported too:
|
||||
// | and _
|
||||
Pattern nickPattern = Pattern.compile("^[a-zA-Z_][a-zA-Z0-9^\\-`\\[\\]{}|_\\\\]*$");
|
||||
if (!nickPattern.matcher(nickname).matches()) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_invalid_nickname));
|
||||
}
|
||||
// RFC 1459: <nick> ::= <letter> { <letter> | <number> | <special> }
|
||||
// <special> ::= '-' | '[' | ']' | '\' | '`' | '^' | '{' | '}'
|
||||
// Chars that are not in RFC 1459 but are supported too:
|
||||
// | and _
|
||||
Pattern nickPattern = Pattern.compile("^[a-zA-Z_][a-zA-Z0-9^\\-`\\[\\]{}|_\\\\]*$");
|
||||
if (!nickPattern.matcher(nickname).matches()) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_invalid_nickname));
|
||||
}
|
||||
|
||||
// We currently only allow chars and numbers as ident
|
||||
Pattern identPattern = Pattern.compile("^[a-zA-Z0-9]+$");
|
||||
if (!identPattern.matcher(ident).matches()) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_invalid_ident));
|
||||
}
|
||||
}
|
||||
// We currently only allow chars and numbers as ident
|
||||
Pattern identPattern = Pattern.compile("^[a-zA-Z0-9]+$");
|
||||
if (!identPattern.matcher(ident).matches()) {
|
||||
throw new ValidationException(getResources().getString(R.string.validation_invalid_ident));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -38,9 +38,9 @@ import android.widget.EditText;
|
||||
*/
|
||||
public class JoinActivity extends Activity implements OnClickListener
|
||||
{
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
@ -54,11 +54,11 @@ public class JoinActivity extends Activity implements OnClickListener
|
||||
/**
|
||||
* On click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("channel", ((EditText) findViewById(R.id.channel)).getText().toString());
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
public void onClick(View v)
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("channel", ((EditText) findViewById(R.id.channel)).getText().toString());
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -35,19 +35,19 @@ import android.widget.TextView;
|
||||
*/
|
||||
public class MessageActivity extends Activity
|
||||
{
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.message);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.message);
|
||||
|
||||
((TextView) findViewById(R.id.message)).setText(
|
||||
getIntent().getExtras().getString(Extra.MESSAGE)
|
||||
);
|
||||
((TextView) findViewById(R.id.message)).setText(
|
||||
getIntent().getExtras().getString(Extra.MESSAGE)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -60,14 +60,14 @@ import org.yaaic.receiver.ServerReceiver;
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class ServersActivity extends ListActivity implements ServiceConnection, ServerListener, OnItemLongClickListener {
|
||||
private IRCBinder binder;
|
||||
private ServerReceiver receiver;
|
||||
private ServerListAdapter adapter;
|
||||
private ListView list;
|
||||
private IRCBinder binder;
|
||||
private ServerReceiver receiver;
|
||||
private ServerListAdapter adapter;
|
||||
private ListView list;
|
||||
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
@ -88,7 +88,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
super.onResume();
|
||||
|
||||
// Start and connect to service
|
||||
Intent intent = new Intent(this, IRCService.class);
|
||||
@ -96,10 +96,10 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
startService(intent);
|
||||
bindService(intent, this, 0);
|
||||
|
||||
receiver = new ServerReceiver(this);
|
||||
registerReceiver(receiver, new IntentFilter(Broadcast.SERVER_UPDATE));
|
||||
receiver = new ServerReceiver(this);
|
||||
registerReceiver(receiver, new IntentFilter(Broadcast.SERVER_UPDATE));
|
||||
|
||||
adapter.loadServers();
|
||||
adapter.loadServers();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,210 +108,210 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
@Override
|
||||
public void onPause()
|
||||
{
|
||||
super.onPause();
|
||||
super.onPause();
|
||||
|
||||
if (binder != null && binder.getService() != null) {
|
||||
binder.getService().checkServiceStatus();
|
||||
}
|
||||
if (binder != null && binder.getService() != null) {
|
||||
binder.getService().checkServiceStatus();
|
||||
}
|
||||
|
||||
unbindService(this);
|
||||
unregisterReceiver(receiver);
|
||||
unbindService(this);
|
||||
unregisterReceiver(receiver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Service connected to Activity
|
||||
*/
|
||||
public void onServiceConnected(ComponentName name, IBinder service)
|
||||
{
|
||||
binder = (IRCBinder) service;
|
||||
}
|
||||
public void onServiceConnected(ComponentName name, IBinder service)
|
||||
{
|
||||
binder = (IRCBinder) service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Service disconnected from Activity
|
||||
*/
|
||||
public void onServiceDisconnected(ComponentName name)
|
||||
{
|
||||
binder = null;
|
||||
}
|
||||
/**
|
||||
* Service disconnected from Activity
|
||||
*/
|
||||
public void onServiceDisconnected(ComponentName name)
|
||||
{
|
||||
binder = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* On server selected
|
||||
*/
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
Server server = adapter.getItem(position);
|
||||
/**
|
||||
* On server selected
|
||||
*/
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
Server server = adapter.getItem(position);
|
||||
|
||||
if (server == null) {
|
||||
// "Add server" was selected
|
||||
startActivityForResult(new Intent(this, AddServerActivity.class), 0);
|
||||
return;
|
||||
}
|
||||
if (server == null) {
|
||||
// "Add server" was selected
|
||||
startActivityForResult(new Intent(this, AddServerActivity.class), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, ConversationActivity.class);
|
||||
Intent intent = new Intent(this, ConversationActivity.class);
|
||||
|
||||
if (server.getStatus() == Status.DISCONNECTED) {
|
||||
server.setStatus(Status.PRE_CONNECTING);
|
||||
intent.putExtra("connect", true);
|
||||
}
|
||||
if (server.getStatus() == Status.DISCONNECTED) {
|
||||
server.setStatus(Status.PRE_CONNECTING);
|
||||
intent.putExtra("connect", true);
|
||||
}
|
||||
|
||||
intent.putExtra("serverId", server.getId());
|
||||
startActivity(intent);
|
||||
}
|
||||
intent.putExtra("serverId", server.getId());
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* On long click
|
||||
*/
|
||||
public boolean onItemLongClick(AdapterView<?> l, View v, int position, long id)
|
||||
{
|
||||
final Server server = adapter.getItem(position);
|
||||
/**
|
||||
* On long click
|
||||
*/
|
||||
public boolean onItemLongClick(AdapterView<?> l, View v, int position, long id)
|
||||
{
|
||||
final Server server = adapter.getItem(position);
|
||||
|
||||
if (server == null) {
|
||||
// "Add server" view selected
|
||||
return true;
|
||||
}
|
||||
if (server == null) {
|
||||
// "Add server" view selected
|
||||
return true;
|
||||
}
|
||||
|
||||
final CharSequence[] items = {
|
||||
getString(R.string.connect),
|
||||
getString(R.string.disconnect),
|
||||
getString(R.string.edit),
|
||||
getString(R.string.delete)
|
||||
};
|
||||
final CharSequence[] items = {
|
||||
getString(R.string.connect),
|
||||
getString(R.string.disconnect),
|
||||
getString(R.string.edit),
|
||||
getString(R.string.delete)
|
||||
};
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(server.getTitle());
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Connect
|
||||
if (server.getStatus() == Status.DISCONNECTED) {
|
||||
binder.connect(server);
|
||||
server.setStatus(Status.CONNECTING);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
break;
|
||||
case 1: // Disconnect
|
||||
server.clearConversations();
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
binder.getService().getConnection(server.getId()).quitServer();
|
||||
break;
|
||||
case 2: // Edit
|
||||
editServer(server.getId());
|
||||
break;
|
||||
case 3: // Delete
|
||||
binder.getService().getConnection(server.getId()).quitServer();
|
||||
deleteServer(server.getId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
return true;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(server.getTitle());
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int item) {
|
||||
switch (item) {
|
||||
case 0: // Connect
|
||||
if (server.getStatus() == Status.DISCONNECTED) {
|
||||
binder.connect(server);
|
||||
server.setStatus(Status.CONNECTING);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
break;
|
||||
case 1: // Disconnect
|
||||
server.clearConversations();
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
binder.getService().getConnection(server.getId()).quitServer();
|
||||
break;
|
||||
case 2: // Edit
|
||||
editServer(server.getId());
|
||||
break;
|
||||
case 3: // Delete
|
||||
binder.getService().getConnection(server.getId()).quitServer();
|
||||
deleteServer(server.getId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start activity to edit server with given id
|
||||
*
|
||||
* @param serverId The id of the server
|
||||
*/
|
||||
private void editServer(int serverId)
|
||||
{
|
||||
Server server = Yaaic.getInstance().getServerById(serverId);
|
||||
/**
|
||||
* Start activity to edit server with given id
|
||||
*
|
||||
* @param serverId The id of the server
|
||||
*/
|
||||
private void editServer(int serverId)
|
||||
{
|
||||
Server server = Yaaic.getInstance().getServerById(serverId);
|
||||
|
||||
if (server.getStatus() != Status.DISCONNECTED) {
|
||||
Toast.makeText(this, getResources().getString(R.string.disconnect_before_editing), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
Intent intent = new Intent(this, AddServerActivity.class);
|
||||
intent.putExtra(Extra.SERVER, serverId);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
}
|
||||
if (server.getStatus() != Status.DISCONNECTED) {
|
||||
Toast.makeText(this, getResources().getString(R.string.disconnect_before_editing), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
else {
|
||||
Intent intent = new Intent(this, AddServerActivity.class);
|
||||
intent.putExtra(Extra.SERVER, serverId);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Options Menu (Menu Button pressed)
|
||||
*/
|
||||
/**
|
||||
* Options Menu (Menu Button pressed)
|
||||
*/
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
{
|
||||
super.onCreateOptionsMenu(menu);
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
// inflate from xml
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.servers, menu);
|
||||
// inflate from xml
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.servers, menu);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* On menu item selected
|
||||
*/
|
||||
@Override
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item)
|
||||
{
|
||||
switch (item.getItemId()) {
|
||||
case R.id.add:
|
||||
startActivityForResult(new Intent(this, AddServerActivity.class), 0);
|
||||
break;
|
||||
case R.id.about:
|
||||
startActivity(new Intent(this, AboutActivity.class));
|
||||
break;
|
||||
case R.id.settings:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.exit:
|
||||
ArrayList<Server> mServers = Yaaic.getInstance().getServersAsArrayList();
|
||||
for (Server server : mServers) {
|
||||
if (binder.getService().hasConnection(server.getId())) {
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
binder.getService().getConnection(server.getId()).quitServer();
|
||||
}
|
||||
}
|
||||
// ugly
|
||||
binder.getService().stopForegroundCompat(R.string.app_name);
|
||||
finish();
|
||||
}
|
||||
@Override
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item)
|
||||
{
|
||||
switch (item.getItemId()) {
|
||||
case R.id.add:
|
||||
startActivityForResult(new Intent(this, AddServerActivity.class), 0);
|
||||
break;
|
||||
case R.id.about:
|
||||
startActivity(new Intent(this, AboutActivity.class));
|
||||
break;
|
||||
case R.id.settings:
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
break;
|
||||
case R.id.exit:
|
||||
ArrayList<Server> mServers = Yaaic.getInstance().getServersAsArrayList();
|
||||
for (Server server : mServers) {
|
||||
if (binder.getService().hasConnection(server.getId())) {
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
binder.getService().getConnection(server.getId()).quitServer();
|
||||
}
|
||||
}
|
||||
// ugly
|
||||
binder.getService().stopForegroundCompat(R.string.app_name);
|
||||
finish();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* On activity result
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Refresh list from database
|
||||
adapter.loadServers();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* On activity result
|
||||
*/
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
if (resultCode == RESULT_OK) {
|
||||
// Refresh list from database
|
||||
adapter.loadServers();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete server
|
||||
*
|
||||
* @param serverId
|
||||
*/
|
||||
public void deleteServer(int serverId)
|
||||
{
|
||||
Database db = new Database(this);
|
||||
db.removeServerById(serverId);
|
||||
db.close();
|
||||
/**
|
||||
* Delete server
|
||||
*
|
||||
* @param serverId
|
||||
*/
|
||||
public void deleteServer(int serverId)
|
||||
{
|
||||
Database db = new Database(this);
|
||||
db.removeServerById(serverId);
|
||||
db.close();
|
||||
|
||||
Yaaic.getInstance().removeServerById(serverId);
|
||||
adapter.loadServers();
|
||||
}
|
||||
Yaaic.getInstance().removeServerById(serverId);
|
||||
adapter.loadServers();
|
||||
}
|
||||
|
||||
/**
|
||||
* On server status update
|
||||
*/
|
||||
public void onStatusUpdate()
|
||||
{
|
||||
adapter.loadServers();
|
||||
/**
|
||||
* On server status update
|
||||
*/
|
||||
public void onStatusUpdate()
|
||||
{
|
||||
adapter.loadServers();
|
||||
|
||||
if (adapter.getCount() > 2) {
|
||||
// Hide background if there are servers in the list
|
||||
list.setBackgroundDrawable(null);
|
||||
}
|
||||
}
|
||||
if (adapter.getCount() > 2) {
|
||||
// Hide background if there are servers in the list
|
||||
list.setBackgroundDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -32,10 +32,10 @@ import android.preference.PreferenceActivity;
|
||||
*/
|
||||
public class SettingsActivity extends PreferenceActivity
|
||||
{
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -41,44 +41,44 @@ import android.widget.TextView;
|
||||
*/
|
||||
public class UserActivity extends Activity implements OnClickListener
|
||||
{
|
||||
private String nickname;
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
nickname = getIntent().getStringExtra(Extra.USER);
|
||||
setContentView(R.layout.user);
|
||||
nickname = getIntent().getStringExtra(Extra.USER);
|
||||
setContentView(R.layout.user);
|
||||
|
||||
// Use full width
|
||||
LayoutParams params = getWindow().getAttributes();
|
||||
params.width = WindowManager.LayoutParams.FILL_PARENT;
|
||||
getWindow().setAttributes(params);
|
||||
// Use full width
|
||||
LayoutParams params = getWindow().getAttributes();
|
||||
params.width = WindowManager.LayoutParams.FILL_PARENT;
|
||||
getWindow().setAttributes(params);
|
||||
|
||||
((Button) findViewById(R.id.op)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.deop)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.voice)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.devoice)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.kick)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.ban)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.op)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.deop)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.voice)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.devoice)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.kick)).setOnClickListener(this);
|
||||
((Button) findViewById(R.id.ban)).setOnClickListener(this);
|
||||
|
||||
((TextView) findViewById(R.id.nickname)).setText(nickname);
|
||||
}
|
||||
((TextView) findViewById(R.id.nickname)).setText(nickname);
|
||||
}
|
||||
|
||||
/**
|
||||
* On button click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.ACTION, v.getId());
|
||||
intent.putExtra(Extra.USER, nickname);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
/**
|
||||
* On button click
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.ACTION, v.getId());
|
||||
intent.putExtra(Extra.USER, nickname);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -41,34 +41,34 @@ import android.widget.ArrayAdapter;
|
||||
*/
|
||||
public class UsersActivity extends ListActivity implements OnItemClickListener
|
||||
{
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.users);
|
||||
setContentView(R.layout.users);
|
||||
|
||||
final String[] users = getIntent().getExtras().getStringArray(Extra.USERS);
|
||||
getListView().setOnItemClickListener(this);
|
||||
final String[] users = getIntent().getExtras().getStringArray(Extra.USERS);
|
||||
getListView().setOnItemClickListener(this);
|
||||
|
||||
// Add sorted list of users in own thread to avoid blocking UI
|
||||
// TODO: Move to a background task and show loading indicator while sorting
|
||||
Arrays.sort(users, String.CASE_INSENSITIVE_ORDER);
|
||||
getListView().setAdapter(new ArrayAdapter<String>(UsersActivity.this, R.layout.useritem, users));
|
||||
}
|
||||
// Add sorted list of users in own thread to avoid blocking UI
|
||||
// TODO: Move to a background task and show loading indicator while sorting
|
||||
Arrays.sort(users, String.CASE_INSENSITIVE_ORDER);
|
||||
getListView().setAdapter(new ArrayAdapter<String>(UsersActivity.this, R.layout.useritem, users));
|
||||
}
|
||||
|
||||
/**
|
||||
* On user selected
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.USER, (String) getListView().getAdapter().getItem(position));
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
/**
|
||||
* On user selected
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Extra.USER, (String) getListView().getAdapter().getItem(position));
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -40,186 +40,186 @@ import android.widget.ListView;
|
||||
*/
|
||||
public class DeckAdapter extends BaseAdapter
|
||||
{
|
||||
private LinkedList<Conversation> conversations;
|
||||
private MessageListView currentView;
|
||||
private String currentChannel;
|
||||
private LinkedList<Conversation> conversations;
|
||||
private MessageListView currentView;
|
||||
private String currentChannel;
|
||||
|
||||
/**
|
||||
* Create a new DeckAdapter instance
|
||||
*/
|
||||
public DeckAdapter()
|
||||
{
|
||||
conversations = new LinkedList<Conversation>();
|
||||
}
|
||||
/**
|
||||
* Create a new DeckAdapter instance
|
||||
*/
|
||||
public DeckAdapter()
|
||||
{
|
||||
conversations = new LinkedList<Conversation>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear conversations
|
||||
*/
|
||||
public void clearConversations()
|
||||
{
|
||||
conversations = new LinkedList<Conversation>();
|
||||
}
|
||||
/**
|
||||
* Clear conversations
|
||||
*/
|
||||
public void clearConversations()
|
||||
{
|
||||
conversations = new LinkedList<Conversation>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of item
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
return conversations.size();
|
||||
}
|
||||
/**
|
||||
* Get number of item
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
return conversations.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item at position
|
||||
*/
|
||||
public Conversation getItem(int position)
|
||||
{
|
||||
if (position >= 0 && position < conversations.size()) {
|
||||
return conversations.get(position);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Get item at position
|
||||
*/
|
||||
public Conversation getItem(int position)
|
||||
{
|
||||
if (position >= 0 && position < conversations.size()) {
|
||||
return conversations.get(position);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id of item at position
|
||||
*/
|
||||
public long getItemId(int position)
|
||||
{
|
||||
return position;
|
||||
}
|
||||
/**
|
||||
* Get id of item at position
|
||||
*/
|
||||
public long getItemId(int position)
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item
|
||||
*
|
||||
* @param channel Name of the channel
|
||||
* @param view The view object
|
||||
*/
|
||||
public void addItem(Conversation conversation)
|
||||
{
|
||||
conversations.add(conversation);
|
||||
/**
|
||||
* Add an item
|
||||
*
|
||||
* @param channel Name of the channel
|
||||
* @param view The view object
|
||||
*/
|
||||
public void addItem(Conversation conversation)
|
||||
{
|
||||
conversations.add(conversation);
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item by the channel's name
|
||||
*
|
||||
* @param channel
|
||||
* @return The item
|
||||
*/
|
||||
public int getPositionByName(String name)
|
||||
{
|
||||
// Optimization - cache field lookups
|
||||
int mSize = conversations.size();
|
||||
LinkedList<Conversation> mItems = this.conversations;
|
||||
/**
|
||||
* Get an item by the channel's name
|
||||
*
|
||||
* @param channel
|
||||
* @return The item
|
||||
*/
|
||||
public int getPositionByName(String name)
|
||||
{
|
||||
// Optimization - cache field lookups
|
||||
int mSize = conversations.size();
|
||||
LinkedList<Conversation> mItems = this.conversations;
|
||||
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
if (mItems.get(i).getName().equalsIgnoreCase(name)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
if (mItems.get(i).getName().equalsIgnoreCase(name)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an item
|
||||
*
|
||||
* @param channel
|
||||
*/
|
||||
public void removeItem(String target)
|
||||
{
|
||||
int position = getPositionByName(target);
|
||||
/**
|
||||
* Remove an item
|
||||
*
|
||||
* @param channel
|
||||
*/
|
||||
public void removeItem(String target)
|
||||
{
|
||||
int position = getPositionByName(target);
|
||||
|
||||
if (position != -1) {
|
||||
conversations.remove(position);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
if (position != -1) {
|
||||
conversations.remove(position);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set single channel view
|
||||
*
|
||||
* @param switched
|
||||
*/
|
||||
public void setSwitched(String channel, MessageListView current)
|
||||
{
|
||||
currentChannel = channel;
|
||||
currentView = current;
|
||||
}
|
||||
/**
|
||||
* Set single channel view
|
||||
*
|
||||
* @param switched
|
||||
*/
|
||||
public void setSwitched(String channel, MessageListView current)
|
||||
{
|
||||
currentChannel = channel;
|
||||
currentView = current;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get single channel view
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MessageListView getSwitchedView()
|
||||
{
|
||||
return currentView;
|
||||
}
|
||||
/**
|
||||
* Get single channel view
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MessageListView getSwitchedView()
|
||||
{
|
||||
return currentView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of channel (single channel view)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getSwitchedName()
|
||||
{
|
||||
return currentChannel;
|
||||
}
|
||||
/**
|
||||
* Get name of channel (single channel view)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getSwitchedName()
|
||||
{
|
||||
return currentChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the view been switched to single channel view?
|
||||
*
|
||||
* @return view true if view is in single channel view, false otherwise
|
||||
*/
|
||||
public boolean isSwitched()
|
||||
{
|
||||
return currentView != null;
|
||||
}
|
||||
/**
|
||||
* Has the view been switched to single channel view?
|
||||
*
|
||||
* @return view true if view is in single channel view, false otherwise
|
||||
*/
|
||||
public boolean isSwitched()
|
||||
{
|
||||
return currentView != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get view at given position
|
||||
*/
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
Conversation conversation = getItem(position);
|
||||
return renderConversation(conversation, parent);
|
||||
}
|
||||
/**
|
||||
* Get view at given position
|
||||
*/
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
Conversation conversation = getItem(position);
|
||||
return renderConversation(conversation, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a conversation view (MessageListView)
|
||||
*
|
||||
* @param channel The conversation of the view
|
||||
* @param parent The parent view (context)
|
||||
* @return The rendered MessageListView
|
||||
*/
|
||||
public MessageListView renderConversation(Conversation conversation, ViewGroup parent)
|
||||
{
|
||||
MessageListView list = new MessageListView(parent.getContext(), parent);
|
||||
list.setOnItemClickListener(MessageClickListener.getInstance());
|
||||
/**
|
||||
* Render a conversation view (MessageListView)
|
||||
*
|
||||
* @param channel The conversation of the view
|
||||
* @param parent The parent view (context)
|
||||
* @return The rendered MessageListView
|
||||
*/
|
||||
public MessageListView renderConversation(Conversation conversation, ViewGroup parent)
|
||||
{
|
||||
MessageListView list = new MessageListView(parent.getContext(), parent);
|
||||
list.setOnItemClickListener(MessageClickListener.getInstance());
|
||||
|
||||
MessageListAdapter adapter = conversation.getMessageListAdapter();
|
||||
if (adapter == null) {
|
||||
adapter = new MessageListAdapter(conversation, parent.getContext());
|
||||
conversation.setMessageListAdapter(adapter);
|
||||
}
|
||||
MessageListAdapter adapter = conversation.getMessageListAdapter();
|
||||
if (adapter == null) {
|
||||
adapter = new MessageListAdapter(conversation, parent.getContext());
|
||||
conversation.setMessageListAdapter(adapter);
|
||||
}
|
||||
|
||||
list.setAdapter(adapter);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
list.setDivider(null);
|
||||
list.setLayoutParams(new Gallery.LayoutParams(
|
||||
parent.getWidth() / 100 * 85,
|
||||
parent.getHeight()
|
||||
));
|
||||
list.setDivider(null);
|
||||
list.setLayoutParams(new Gallery.LayoutParams(
|
||||
parent.getWidth() / 100 * 85,
|
||||
parent.getHeight()
|
||||
));
|
||||
|
||||
list.setBackgroundResource(R.layout.rounded);
|
||||
list.setCacheColorHint(0xee000000);
|
||||
list.setPadding(5, 5, 5, 5);
|
||||
list.setVerticalFadingEdgeEnabled(false);
|
||||
list.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_INSET);
|
||||
list.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
|
||||
list.setSelection(list.getAdapter().getCount() - 1); // scroll to bottom
|
||||
list.setBackgroundResource(R.layout.rounded);
|
||||
list.setCacheColorHint(0xee000000);
|
||||
list.setPadding(5, 5, 5, 5);
|
||||
list.setVerticalFadingEdgeEnabled(false);
|
||||
list.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_INSET);
|
||||
list.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
|
||||
list.setSelection(list.getAdapter().getCount() - 1); // scroll to bottom
|
||||
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -38,122 +38,122 @@ import android.widget.TextView;
|
||||
*/
|
||||
public class MessageListAdapter extends BaseAdapter
|
||||
{
|
||||
private LinkedList<TextView> messages;
|
||||
private Context context;
|
||||
private LinkedList<TextView> messages;
|
||||
private Context context;
|
||||
|
||||
/**
|
||||
* Create a new MessageAdapter
|
||||
*
|
||||
* @param channel
|
||||
* @param context
|
||||
*/
|
||||
public MessageListAdapter(Conversation conversation, Context context)
|
||||
{
|
||||
LinkedList<TextView> messages = new LinkedList<TextView>();
|
||||
/**
|
||||
* Create a new MessageAdapter
|
||||
*
|
||||
* @param channel
|
||||
* @param context
|
||||
*/
|
||||
public MessageListAdapter(Conversation conversation, Context context)
|
||||
{
|
||||
LinkedList<TextView> messages = new LinkedList<TextView>();
|
||||
|
||||
// Render channel name as first message in channel
|
||||
if (conversation.getType() != Conversation.TYPE_SERVER) {
|
||||
Message header = new Message(conversation.getName());
|
||||
header.setColor(Message.COLOR_RED);
|
||||
messages.add(header.renderTextView(context));
|
||||
}
|
||||
// Render channel name as first message in channel
|
||||
if (conversation.getType() != Conversation.TYPE_SERVER) {
|
||||
Message header = new Message(conversation.getName());
|
||||
header.setColor(Message.COLOR_RED);
|
||||
messages.add(header.renderTextView(context));
|
||||
}
|
||||
|
||||
// Optimization - cache field lookups
|
||||
LinkedList<Message> mHistory = conversation.getHistory();
|
||||
int mSize = mHistory.size();
|
||||
// Optimization - cache field lookups
|
||||
LinkedList<Message> mHistory = conversation.getHistory();
|
||||
int mSize = mHistory.size();
|
||||
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
messages.add(mHistory.get(i).renderTextView(context));
|
||||
}
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
messages.add(mHistory.get(i).renderTextView(context));
|
||||
}
|
||||
|
||||
// XXX: We don't want to clear the buffer, we want to add only
|
||||
// buffered messages that are not already added (history)
|
||||
conversation.clearBuffer();
|
||||
// XXX: We don't want to clear the buffer, we want to add only
|
||||
// buffered messages that are not already added (history)
|
||||
conversation.clearBuffer();
|
||||
|
||||
this.messages = messages;
|
||||
this.context = context;
|
||||
}
|
||||
this.messages = messages;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message to the list
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public void addMessage(Message message)
|
||||
{
|
||||
messages.add(message.renderTextView(context));
|
||||
/**
|
||||
* Add a message to the list
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public void addMessage(Message message)
|
||||
{
|
||||
messages.add(message.renderTextView(context));
|
||||
|
||||
if (messages.size() > Conversation.HISTORY_SIZE) {
|
||||
messages.remove(0);
|
||||
}
|
||||
if (messages.size() > Conversation.HISTORY_SIZE) {
|
||||
messages.remove(0);
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a list of messages to the list
|
||||
*
|
||||
* @param messages
|
||||
*/
|
||||
public void addBulkMessages(LinkedList<Message> messages)
|
||||
{
|
||||
LinkedList<TextView> mMessages = this.messages;
|
||||
Context mContext = this.context;
|
||||
int mSize = messages.size();
|
||||
/**
|
||||
* Add a list of messages to the list
|
||||
*
|
||||
* @param messages
|
||||
*/
|
||||
public void addBulkMessages(LinkedList<Message> messages)
|
||||
{
|
||||
LinkedList<TextView> mMessages = this.messages;
|
||||
Context mContext = this.context;
|
||||
int mSize = messages.size();
|
||||
|
||||
for (int i = mSize - 1; i > -1; i--) {
|
||||
mMessages.add(messages.get(i).renderTextView(mContext));
|
||||
for (int i = mSize - 1; i > -1; i--) {
|
||||
mMessages.add(messages.get(i).renderTextView(mContext));
|
||||
|
||||
if (mMessages.size() > Conversation.HISTORY_SIZE) {
|
||||
mMessages.remove(0);
|
||||
}
|
||||
}
|
||||
if (mMessages.size() > Conversation.HISTORY_SIZE) {
|
||||
mMessages.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of items
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
return messages.size();
|
||||
}
|
||||
/**
|
||||
* Get number of items
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
return messages.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item at given position
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
*/
|
||||
public TextView getItem(int position)
|
||||
{
|
||||
return messages.get(position);
|
||||
}
|
||||
/**
|
||||
* Get item at given position
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
*/
|
||||
public TextView getItem(int position)
|
||||
{
|
||||
return messages.get(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id of item at given position
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
*/
|
||||
public long getItemId(int position)
|
||||
{
|
||||
return position;
|
||||
}
|
||||
/**
|
||||
* Get id of item at given position
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
*/
|
||||
public long getItemId(int position)
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item view for the given position
|
||||
*
|
||||
* @param position
|
||||
* @param convertView
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
return getItem(position);
|
||||
}
|
||||
/**
|
||||
* Get item view for the given position
|
||||
*
|
||||
* @param position
|
||||
* @param convertView
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
return getItem(position);
|
||||
}
|
||||
}
|
||||
|
@ -41,95 +41,95 @@ import android.widget.TextView;
|
||||
*/
|
||||
public class ServerListAdapter extends BaseAdapter
|
||||
{
|
||||
private ArrayList<Server> servers;
|
||||
private ArrayList<Server> servers;
|
||||
|
||||
/**
|
||||
* Create a new adapter for server lists
|
||||
*/
|
||||
public ServerListAdapter()
|
||||
{
|
||||
loadServers();
|
||||
}
|
||||
/**
|
||||
* Create a new adapter for server lists
|
||||
*/
|
||||
public ServerListAdapter()
|
||||
{
|
||||
loadServers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load servers from database
|
||||
*
|
||||
* Delegate call to yaaic instance
|
||||
*/
|
||||
public void loadServers()
|
||||
{
|
||||
servers = Yaaic.getInstance().getServersAsArrayList();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
/**
|
||||
* Load servers from database
|
||||
*
|
||||
* Delegate call to yaaic instance
|
||||
*/
|
||||
public void loadServers()
|
||||
{
|
||||
servers = Yaaic.getInstance().getServersAsArrayList();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of items
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
int size = servers.size();
|
||||
/**
|
||||
* Get number of items
|
||||
*/
|
||||
public int getCount()
|
||||
{
|
||||
int size = servers.size();
|
||||
|
||||
// Display "Add server" item
|
||||
if (size == 0) {
|
||||
return 1;
|
||||
}
|
||||
// Display "Add server" item
|
||||
if (size == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item at position
|
||||
*
|
||||
* @param position
|
||||
*/
|
||||
public Server getItem(int position)
|
||||
{
|
||||
if (servers.size() == 0) {
|
||||
return null; // No server object for the "add server" view
|
||||
}
|
||||
/**
|
||||
* Get item at position
|
||||
*
|
||||
* @param position
|
||||
*/
|
||||
public Server getItem(int position)
|
||||
{
|
||||
if (servers.size() == 0) {
|
||||
return null; // No server object for the "add server" view
|
||||
}
|
||||
|
||||
return servers.get(position);
|
||||
}
|
||||
return servers.get(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id of item at position
|
||||
*
|
||||
* @param position
|
||||
*/
|
||||
public long getItemId(int position)
|
||||
{
|
||||
if (servers.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Get id of item at position
|
||||
*
|
||||
* @param position
|
||||
*/
|
||||
public long getItemId(int position)
|
||||
{
|
||||
if (servers.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return getItem(position).getId();
|
||||
}
|
||||
return getItem(position).getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get view for item at given position
|
||||
*
|
||||
* @param position
|
||||
* @param convertView
|
||||
* @param parent
|
||||
*/
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
Server server = getItem(position);
|
||||
/**
|
||||
* Get view for item at given position
|
||||
*
|
||||
* @param position
|
||||
* @param convertView
|
||||
* @param parent
|
||||
*/
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
Server server = getItem(position);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
if (server == null) {
|
||||
// Return "Add server" view
|
||||
return inflater.inflate(R.layout.addserveritem, null);
|
||||
}
|
||||
if (server == null) {
|
||||
// Return "Add server" view
|
||||
return inflater.inflate(R.layout.addserveritem, null);
|
||||
}
|
||||
|
||||
View v = inflater.inflate(R.layout.serveritem, null);
|
||||
View v = inflater.inflate(R.layout.serveritem, null);
|
||||
|
||||
((TextView) v.findViewById(R.id.title)).setText(server.getTitle());
|
||||
((TextView) v.findViewById(R.id.host)).setText(server.getIdentity().getNickname() + " @ " + server.getHost() + " : " + server.getPort());
|
||||
((TextView) v.findViewById(R.id.title)).setText(server.getTitle());
|
||||
((TextView) v.findViewById(R.id.host)).setText(server.getIdentity().getNickname() + " @ " + server.getHost() + " : " + server.getPort());
|
||||
|
||||
((ImageView) v.findViewById(R.id.status)).setImageResource(server.getStatusIcon());
|
||||
((ImageView) v.findViewById(R.id.status)).setImageResource(server.getStatusIcon());
|
||||
|
||||
return v;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
@ -34,57 +34,57 @@ import android.content.Context;
|
||||
*/
|
||||
public abstract class BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute the command
|
||||
*
|
||||
* @param params The params given (0 is the command itself)
|
||||
* @param server The server object
|
||||
* @param channel The channel object or null if no channel is selected
|
||||
* @param service The service with all server connections
|
||||
* @throws CommandException if command couldn't be executed
|
||||
*/
|
||||
public abstract void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException;
|
||||
/**
|
||||
* Execute the command
|
||||
*
|
||||
* @param params The params given (0 is the command itself)
|
||||
* @param server The server object
|
||||
* @param channel The channel object or null if no channel is selected
|
||||
* @param service The service with all server connections
|
||||
* @throws CommandException if command couldn't be executed
|
||||
*/
|
||||
public abstract void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException;
|
||||
|
||||
/**
|
||||
* Get the usage description for this command
|
||||
*
|
||||
* @return The usage description
|
||||
*/
|
||||
public abstract String getUsage();
|
||||
/**
|
||||
* Get the usage description for this command
|
||||
*
|
||||
* @return The usage description
|
||||
*/
|
||||
public abstract String getUsage();
|
||||
|
||||
/**
|
||||
* Get the description for this command
|
||||
*
|
||||
* @param context The current context. Needed for getting string resources
|
||||
* @return
|
||||
*/
|
||||
public abstract String getDescription(Context context);
|
||||
/**
|
||||
* Get the description for this command
|
||||
*
|
||||
* @param context The current context. Needed for getting string resources
|
||||
* @return
|
||||
*/
|
||||
public abstract String getDescription(Context context);
|
||||
|
||||
/**
|
||||
* Merge params to a string
|
||||
*
|
||||
* @params params The params to merge
|
||||
*/
|
||||
public static String mergeParams(String[] params)
|
||||
{
|
||||
return mergeParams(params, 1);
|
||||
}
|
||||
/**
|
||||
* Merge params to a string
|
||||
*
|
||||
* @params params The params to merge
|
||||
*/
|
||||
public static String mergeParams(String[] params)
|
||||
{
|
||||
return mergeParams(params, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge params to a string
|
||||
*
|
||||
* @param params The params to merge
|
||||
* @param position Start at given param
|
||||
*/
|
||||
public static String mergeParams(String[] params, int position)
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
/**
|
||||
* Merge params to a string
|
||||
*
|
||||
* @param params The params to merge
|
||||
* @param position Start at given param
|
||||
*/
|
||||
public static String mergeParams(String[] params, int position)
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
for (; position < params.length; position++) {
|
||||
buffer.append(params[position]);
|
||||
buffer.append(" ");
|
||||
}
|
||||
for (; position < params.length; position++) {
|
||||
buffer.append(params[position]);
|
||||
buffer.append(" ");
|
||||
}
|
||||
|
||||
return buffer.toString().trim();
|
||||
}
|
||||
return buffer.toString().trim();
|
||||
}
|
||||
}
|
||||
|
@ -62,175 +62,175 @@ import org.yaaic.model.Server;
|
||||
*/
|
||||
public class CommandParser
|
||||
{
|
||||
private HashMap<String, BaseHandler> commands;
|
||||
private HashMap<String, String> aliases;
|
||||
private static CommandParser instance;
|
||||
private HashMap<String, BaseHandler> commands;
|
||||
private HashMap<String, String> aliases;
|
||||
private static CommandParser instance;
|
||||
|
||||
/**
|
||||
* Create a new CommandParser instance
|
||||
*/
|
||||
private CommandParser()
|
||||
{
|
||||
commands = new HashMap<String, BaseHandler>();
|
||||
/**
|
||||
* Create a new CommandParser instance
|
||||
*/
|
||||
private CommandParser()
|
||||
{
|
||||
commands = new HashMap<String, BaseHandler>();
|
||||
|
||||
// Commands
|
||||
commands.put("nick", new NickHandler());
|
||||
commands.put("join", new JoinHandler());
|
||||
commands.put("me", new MeHandler());
|
||||
commands.put("names", new NamesHandler());
|
||||
commands.put("echo", new EchoHandler());
|
||||
commands.put("topic", new TopicHandler());
|
||||
commands.put("quit", new QuitHandler());
|
||||
commands.put("op", new OpHandler());
|
||||
commands.put("voice", new VoiceHandler());
|
||||
commands.put("deop", new DeopHandler());
|
||||
commands.put("devoice", new DevoiceHandler());
|
||||
commands.put("kick", new KickHandler());
|
||||
commands.put("query", new QueryHandler());
|
||||
commands.put("part", new PartHandler());
|
||||
commands.put("close", new CloseHandler());
|
||||
commands.put("notice", new NoticeHandler());
|
||||
commands.put("dcc", new DCCHandler());
|
||||
commands.put("mode", new ModeHandler());
|
||||
commands.put("help", new HelpHandler());
|
||||
commands.put("away", new AwayHandler());
|
||||
commands.put("whois", new WhoisHandler());
|
||||
commands.put("msg", new MsgHandler());
|
||||
commands.put("quote", new RawHandler());
|
||||
commands.put("amsg", new AMsgHandler());
|
||||
// Commands
|
||||
commands.put("nick", new NickHandler());
|
||||
commands.put("join", new JoinHandler());
|
||||
commands.put("me", new MeHandler());
|
||||
commands.put("names", new NamesHandler());
|
||||
commands.put("echo", new EchoHandler());
|
||||
commands.put("topic", new TopicHandler());
|
||||
commands.put("quit", new QuitHandler());
|
||||
commands.put("op", new OpHandler());
|
||||
commands.put("voice", new VoiceHandler());
|
||||
commands.put("deop", new DeopHandler());
|
||||
commands.put("devoice", new DevoiceHandler());
|
||||
commands.put("kick", new KickHandler());
|
||||
commands.put("query", new QueryHandler());
|
||||
commands.put("part", new PartHandler());
|
||||
commands.put("close", new CloseHandler());
|
||||
commands.put("notice", new NoticeHandler());
|
||||
commands.put("dcc", new DCCHandler());
|
||||
commands.put("mode", new ModeHandler());
|
||||
commands.put("help", new HelpHandler());
|
||||
commands.put("away", new AwayHandler());
|
||||
commands.put("whois", new WhoisHandler());
|
||||
commands.put("msg", new MsgHandler());
|
||||
commands.put("quote", new RawHandler());
|
||||
commands.put("amsg", new AMsgHandler());
|
||||
|
||||
aliases = new HashMap<String, String>();
|
||||
aliases = new HashMap<String, String>();
|
||||
|
||||
// Aliases
|
||||
aliases.put("j","join");
|
||||
aliases.put("q", "query");
|
||||
aliases.put("h", "help");
|
||||
aliases.put("raw", "quote");
|
||||
aliases.put("w", "whois");
|
||||
}
|
||||
// Aliases
|
||||
aliases.put("j","join");
|
||||
aliases.put("q", "query");
|
||||
aliases.put("h", "help");
|
||||
aliases.put("raw", "quote");
|
||||
aliases.put("w", "whois");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global CommandParser instance
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized CommandParser getInstance()
|
||||
{
|
||||
if (instance == null) {
|
||||
instance = new CommandParser();
|
||||
}
|
||||
/**
|
||||
* Get the global CommandParser instance
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized CommandParser getInstance()
|
||||
{
|
||||
if (instance == null) {
|
||||
instance = new CommandParser();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the commands HashMap
|
||||
*
|
||||
* @return HashMap - command, commandHandler
|
||||
*/
|
||||
public HashMap<String, BaseHandler> getCommands()
|
||||
{
|
||||
return commands;
|
||||
}
|
||||
/**
|
||||
* Get the commands HashMap
|
||||
*
|
||||
* @return HashMap - command, commandHandler
|
||||
*/
|
||||
public HashMap<String, BaseHandler> getCommands()
|
||||
{
|
||||
return commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the command aliases HashMap
|
||||
*
|
||||
* @return HashMap - alias, command the alias belogs to
|
||||
*/
|
||||
public HashMap<String, String> getAliases()
|
||||
{
|
||||
return aliases;
|
||||
}
|
||||
/**
|
||||
* Get the command aliases HashMap
|
||||
*
|
||||
* @return HashMap - alias, command the alias belogs to
|
||||
*/
|
||||
public HashMap<String, String> getAliases()
|
||||
{
|
||||
return aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the given command a valid client command?
|
||||
*
|
||||
* @param command The (client) command to check (/command)
|
||||
* @return true if the command can be handled by the client, false otherwise
|
||||
*/
|
||||
public boolean isClientCommand(String command)
|
||||
{
|
||||
return commands.containsKey(command.toLowerCase()) || aliases.containsKey(command.toLowerCase());
|
||||
}
|
||||
/**
|
||||
* Is the given command a valid client command?
|
||||
*
|
||||
* @param command The (client) command to check (/command)
|
||||
* @return true if the command can be handled by the client, false otherwise
|
||||
*/
|
||||
public boolean isClientCommand(String command)
|
||||
{
|
||||
return commands.containsKey(command.toLowerCase()) || aliases.containsKey(command.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a client command
|
||||
*
|
||||
* @param type Type of the command (/type param1 param2 ..)
|
||||
* @param params The parameters of the command (0 is the command itself)
|
||||
* @param server The current server
|
||||
* @param conversation The selected conversation
|
||||
* @param service The service handling the connections
|
||||
*/
|
||||
public void handleClientCommand(String type, String[] params, Server server, Conversation conversation, IRCService service)
|
||||
{
|
||||
BaseHandler command = null;
|
||||
if (commands.containsKey(type.toLowerCase())) {
|
||||
command = commands.get(type);
|
||||
} else if (aliases.containsKey(type.toLowerCase())) {
|
||||
String commandInCommands = aliases.get(type.toLowerCase());
|
||||
command = commands.get(commandInCommands);
|
||||
}
|
||||
try {
|
||||
command.execute(params, server, conversation, service);
|
||||
} catch(CommandException e) {
|
||||
// Command could not be executed
|
||||
if (conversation != null) {
|
||||
Message errorMessage = new Message(type + ": " + e.getMessage());
|
||||
errorMessage.setColor(Message.COLOR_RED);
|
||||
conversation.addMessage(errorMessage);
|
||||
/**
|
||||
* Handle a client command
|
||||
*
|
||||
* @param type Type of the command (/type param1 param2 ..)
|
||||
* @param params The parameters of the command (0 is the command itself)
|
||||
* @param server The current server
|
||||
* @param conversation The selected conversation
|
||||
* @param service The service handling the connections
|
||||
*/
|
||||
public void handleClientCommand(String type, String[] params, Server server, Conversation conversation, IRCService service)
|
||||
{
|
||||
BaseHandler command = null;
|
||||
if (commands.containsKey(type.toLowerCase())) {
|
||||
command = commands.get(type);
|
||||
} else if (aliases.containsKey(type.toLowerCase())) {
|
||||
String commandInCommands = aliases.get(type.toLowerCase());
|
||||
command = commands.get(commandInCommands);
|
||||
}
|
||||
try {
|
||||
command.execute(params, server, conversation, service);
|
||||
} catch(CommandException e) {
|
||||
// Command could not be executed
|
||||
if (conversation != null) {
|
||||
Message errorMessage = new Message(type + ": " + e.getMessage());
|
||||
errorMessage.setColor(Message.COLOR_RED);
|
||||
conversation.addMessage(errorMessage);
|
||||
|
||||
// XXX:I18N - How to get a context here? (command_syntax)
|
||||
Message usageMessage = new Message("Syntax: " + command.getUsage());
|
||||
conversation.addMessage(usageMessage);
|
||||
// XXX:I18N - How to get a context here? (command_syntax)
|
||||
Message usageMessage = new Message("Syntax: " + command.getUsage());
|
||||
conversation.addMessage(usageMessage);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a server command
|
||||
*
|
||||
* @param type Type of the command (/type param1 param2 ..)
|
||||
* @param params The parameters of the command (0 is the command itself)
|
||||
* @param server The current server
|
||||
* @param conversation The selected conversation
|
||||
* @param service The service handling the connections
|
||||
*/
|
||||
public void handleServerCommand(String type, String[] params, Server server, Conversation conversation, IRCService service)
|
||||
{
|
||||
if (params.length > 1) {
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue(
|
||||
type.toUpperCase() + " " + BaseHandler.mergeParams(params)
|
||||
);
|
||||
} else {
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue(type.toUpperCase());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handle a server command
|
||||
*
|
||||
* @param type Type of the command (/type param1 param2 ..)
|
||||
* @param params The parameters of the command (0 is the command itself)
|
||||
* @param server The current server
|
||||
* @param conversation The selected conversation
|
||||
* @param service The service handling the connections
|
||||
*/
|
||||
public void handleServerCommand(String type, String[] params, Server server, Conversation conversation, IRCService service)
|
||||
{
|
||||
if (params.length > 1) {
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue(
|
||||
type.toUpperCase() + " " + BaseHandler.mergeParams(params)
|
||||
);
|
||||
} else {
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue(type.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given line
|
||||
*
|
||||
* @param line
|
||||
*/
|
||||
public void parse(String line, Server server, Conversation conversation, IRCService service)
|
||||
{
|
||||
line = line.trim().substring(1); // cut the slash
|
||||
String[] params = line.split(" ");
|
||||
String type = params[0];
|
||||
/**
|
||||
* Parse the given line
|
||||
*
|
||||
* @param line
|
||||
*/
|
||||
public void parse(String line, Server server, Conversation conversation, IRCService service)
|
||||
{
|
||||
line = line.trim().substring(1); // cut the slash
|
||||
String[] params = line.split(" ");
|
||||
String type = params[0];
|
||||
|
||||
if (isClientCommand(type)) {
|
||||
handleClientCommand(type, params, server, conversation, service);
|
||||
} else {
|
||||
handleServerCommand(type, params, server, conversation, service);
|
||||
}
|
||||
}
|
||||
if (isClientCommand(type)) {
|
||||
handleClientCommand(type, params, server, conversation, service);
|
||||
} else {
|
||||
handleServerCommand(type, params, server, conversation, service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,53 +43,53 @@ import android.content.Intent;
|
||||
*/
|
||||
public class AMsgHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /amsg
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 1) {
|
||||
String text = BaseHandler.mergeParams(params);
|
||||
/**
|
||||
* Execute /amsg
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 1) {
|
||||
String text = BaseHandler.mergeParams(params);
|
||||
|
||||
|
||||
Collection<Conversation> mConversations = server.getConversations();
|
||||
for (Conversation currentConversation : mConversations) {
|
||||
if (currentConversation.getType() == Conversation.TYPE_CHANNEL) {
|
||||
Message message = new Message("<" + service.getConnection(server.getId()).getNick() + "> " + text);
|
||||
currentConversation.addMessage(message);
|
||||
Collection<Conversation> mConversations = server.getConversations();
|
||||
for (Conversation currentConversation : mConversations) {
|
||||
if (currentConversation.getType() == Conversation.TYPE_CHANNEL) {
|
||||
Message message = new Message("<" + service.getConnection(server.getId()).getNick() + "> " + text);
|
||||
currentConversation.addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
currentConversation.getName()
|
||||
);
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
currentConversation.getName()
|
||||
);
|
||||
|
||||
service.sendBroadcast(intent);
|
||||
service.sendBroadcast(intent);
|
||||
|
||||
service.getConnection(server.getId()).sendMessage(currentConversation.getName(), text);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
service.getConnection(server.getId()).sendMessage(currentConversation.getName(), text);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /amsg
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/amsg <message>";
|
||||
}
|
||||
/**
|
||||
* Usage of /amsg
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/amsg <message>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /amsg
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_amsg);
|
||||
}
|
||||
/**
|
||||
* Description of /amsg
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_amsg);
|
||||
}
|
||||
}
|
||||
|
@ -38,30 +38,30 @@ import android.content.Context;
|
||||
*/
|
||||
public class AwayHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /away
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue("AWAY " + BaseHandler.mergeParams(params));
|
||||
}
|
||||
/**
|
||||
* Execute /away
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue("AWAY " + BaseHandler.mergeParams(params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description of /away
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_away);
|
||||
}
|
||||
/**
|
||||
* Get description of /away
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_away);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usage of /away
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/away [<reason>]";
|
||||
}
|
||||
/**
|
||||
* Get usage of /away
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/away [<reason>]";
|
||||
}
|
||||
}
|
||||
|
@ -40,48 +40,48 @@ import android.content.Intent;
|
||||
*/
|
||||
public class CloseHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /close
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() == Conversation.TYPE_SERVER) {
|
||||
throw new CommandException(service.getString(R.string.close_server_window));
|
||||
}
|
||||
/**
|
||||
* Execute /close
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() == Conversation.TYPE_SERVER) {
|
||||
throw new CommandException(service.getString(R.string.close_server_window));
|
||||
}
|
||||
|
||||
if (params.length == 1) {
|
||||
if (conversation.getType() == Conversation.TYPE_CHANNEL) {
|
||||
service.getConnection(server.getId()).partChannel(conversation.getName());
|
||||
}
|
||||
if (conversation.getType() == Conversation.TYPE_QUERY) {
|
||||
server.removeConversation(conversation.getName());
|
||||
if (params.length == 1) {
|
||||
if (conversation.getType() == Conversation.TYPE_CHANNEL) {
|
||||
service.getConnection(server.getId()).partChannel(conversation.getName());
|
||||
}
|
||||
if (conversation.getType() == Conversation.TYPE_QUERY) {
|
||||
server.removeConversation(conversation.getName());
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_REMOVE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_REMOVE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /close
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/close";
|
||||
}
|
||||
/**
|
||||
* Usage of /close
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/close";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /close
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_close);
|
||||
}
|
||||
/**
|
||||
* Description of /close
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_close);
|
||||
}
|
||||
}
|
||||
|
@ -42,50 +42,50 @@ import android.content.Context;
|
||||
*/
|
||||
public class DCCHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /dcc
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 4) {
|
||||
if (!params[1].equalsIgnoreCase("SEND")) {
|
||||
throw new CommandException(service.getString(R.string.dcc_only_send));
|
||||
}
|
||||
File file = new File(params[3]);
|
||||
if (!file.exists()) {
|
||||
throw new CommandException(service.getString(R.string.dcc_file_not_found, params[3]));
|
||||
}
|
||||
/**
|
||||
* Execute /dcc
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 4) {
|
||||
if (!params[1].equalsIgnoreCase("SEND")) {
|
||||
throw new CommandException(service.getString(R.string.dcc_only_send));
|
||||
}
|
||||
File file = new File(params[3]);
|
||||
if (!file.exists()) {
|
||||
throw new CommandException(service.getString(R.string.dcc_file_not_found, params[3]));
|
||||
}
|
||||
|
||||
service.getConnection(server.getId()).dccSendFile(file, params[2], 60000);
|
||||
service.getConnection(server.getId()).dccSendFile(file, params[2], 60000);
|
||||
|
||||
Message message = new Message(service.getString(R.string.dcc_waiting_accept, params[2]));
|
||||
message.setColor(Message.COLOR_GREY);
|
||||
conversation.addMessage(message);
|
||||
Message message = new Message(service.getString(R.string.dcc_waiting_accept, params[2]));
|
||||
message.setColor(Message.COLOR_GREY);
|
||||
conversation.addMessage(message);
|
||||
|
||||
service.sendBroadcast(
|
||||
Broadcast.createConversationIntent(Broadcast.CONVERSATION_MESSAGE, server.getId(), conversation.getName())
|
||||
);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
service.sendBroadcast(
|
||||
Broadcast.createConversationIntent(Broadcast.CONVERSATION_MESSAGE, server.getId(), conversation.getName())
|
||||
);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /dcc
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/dcc SEND <nickname> <file>";
|
||||
}
|
||||
/**
|
||||
* Usage of /dcc
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/dcc SEND <nickname> <file>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /dcc
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_dcc);
|
||||
}
|
||||
/**
|
||||
* Description of /dcc
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_dcc);
|
||||
}
|
||||
}
|
||||
|
@ -36,38 +36,38 @@ import android.content.Context;
|
||||
*/
|
||||
public class DeopHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /deop
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /deop
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).deOp(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).deOp(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/deop <nickname>";
|
||||
}
|
||||
/**
|
||||
* Usage of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/deop <nickname>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_deop);
|
||||
}
|
||||
/**
|
||||
* Description of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_deop);
|
||||
}
|
||||
}
|
||||
|
@ -36,38 +36,38 @@ import android.content.Context;
|
||||
*/
|
||||
public class DevoiceHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /devoice
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /devoice
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).deVoice(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).deVoice(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /devoice
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/devoice <nickname>";
|
||||
}
|
||||
/**
|
||||
* Usage of /devoice
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/devoice <nickname>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /devoice
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_devoice);
|
||||
}
|
||||
/**
|
||||
* Description of /devoice
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_devoice);
|
||||
}
|
||||
}
|
||||
|
@ -39,42 +39,42 @@ import android.content.Intent;
|
||||
*/
|
||||
public class EchoHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /echo
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 1) {
|
||||
Message message = new Message(BaseHandler.mergeParams(params));
|
||||
conversation.addMessage(message);
|
||||
/**
|
||||
* Execute /echo
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 1) {
|
||||
Message message = new Message(BaseHandler.mergeParams(params));
|
||||
conversation.addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.text_missing));
|
||||
}
|
||||
}
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.text_missing));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /echo
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/echo <text>";
|
||||
}
|
||||
/**
|
||||
* Usage of /echo
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/echo <text>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /echo
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_echo);
|
||||
}
|
||||
/**
|
||||
* Description of /echo
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_echo);
|
||||
}
|
||||
}
|
||||
|
@ -44,112 +44,112 @@ import android.content.Intent;
|
||||
*/
|
||||
public class HelpHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /help
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
showCommandDetails(service, server, conversation, params[1]);
|
||||
} else if (params.length == 1) {
|
||||
showAllCommands(service, server, conversation);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute /help
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
showCommandDetails(service, server, conversation, params[1]);
|
||||
} else if (params.length == 1) {
|
||||
showAllCommands(service, server, conversation);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all available commands
|
||||
*
|
||||
* @param conversation
|
||||
* @param server
|
||||
* @param service
|
||||
*/
|
||||
private void showAllCommands(IRCService service, Server server, Conversation conversation)
|
||||
{
|
||||
CommandParser cp = CommandParser.getInstance();
|
||||
/**
|
||||
* Show all available commands
|
||||
*
|
||||
* @param conversation
|
||||
* @param server
|
||||
* @param service
|
||||
*/
|
||||
private void showAllCommands(IRCService service, Server server, Conversation conversation)
|
||||
{
|
||||
CommandParser cp = CommandParser.getInstance();
|
||||
|
||||
StringBuffer commandList = new StringBuffer(service.getString(R.string.available_commands));
|
||||
commandList.append("\n");
|
||||
StringBuffer commandList = new StringBuffer(service.getString(R.string.available_commands));
|
||||
commandList.append("\n");
|
||||
|
||||
HashMap<String, BaseHandler> commands = cp.getCommands();
|
||||
HashMap<String, String> aliases = cp.getAliases();
|
||||
HashMap<String, BaseHandler> commands = cp.getCommands();
|
||||
HashMap<String, String> aliases = cp.getAliases();
|
||||
|
||||
Set<String> commandKeys = commands.keySet();
|
||||
Set<String> aliasesKeys = aliases.keySet();
|
||||
Set<String> commandKeys = commands.keySet();
|
||||
Set<String> aliasesKeys = aliases.keySet();
|
||||
|
||||
for (Object command : commandKeys) {
|
||||
String alias = "";
|
||||
for (Object aliasCommand : aliasesKeys) {
|
||||
if (command.equals(aliases.get(aliasCommand))) {
|
||||
alias = " " + service.getString(R.string.logical_or) + " /" + aliasCommand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
commandList.append("/" + command.toString() + alias + " - "+commands.get(command).getDescription(service) + "\n");
|
||||
}
|
||||
for (Object command : commandKeys) {
|
||||
String alias = "";
|
||||
for (Object aliasCommand : aliasesKeys) {
|
||||
if (command.equals(aliases.get(aliasCommand))) {
|
||||
alias = " " + service.getString(R.string.logical_or) + " /" + aliasCommand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
commandList.append("/" + command.toString() + alias + " - "+commands.get(command).getDescription(service) + "\n");
|
||||
}
|
||||
|
||||
Message message = new Message(commandList.toString());
|
||||
message.setColor(Message.COLOR_YELLOW);
|
||||
conversation.addMessage(message);
|
||||
Message message = new Message(commandList.toString());
|
||||
message.setColor(Message.COLOR_YELLOW);
|
||||
conversation.addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show details of a single command
|
||||
*
|
||||
* @param conversation
|
||||
* @param server
|
||||
* @param service
|
||||
* @param command
|
||||
* @throws CommandException
|
||||
*/
|
||||
private void showCommandDetails(IRCService service, Server server, Conversation conversation, String command) throws CommandException
|
||||
{
|
||||
CommandParser cp = CommandParser.getInstance();
|
||||
HashMap<String, BaseHandler> commands = cp.getCommands();
|
||||
/**
|
||||
* Show details of a single command
|
||||
*
|
||||
* @param conversation
|
||||
* @param server
|
||||
* @param service
|
||||
* @param command
|
||||
* @throws CommandException
|
||||
*/
|
||||
private void showCommandDetails(IRCService service, Server server, Conversation conversation, String command) throws CommandException
|
||||
{
|
||||
CommandParser cp = CommandParser.getInstance();
|
||||
HashMap<String, BaseHandler> commands = cp.getCommands();
|
||||
|
||||
if (commands.containsKey(command)) {
|
||||
// XXX:I18N - String building salad :)
|
||||
Message message = new Message("Help of /" + command + "\n" + commands.get(command).getUsage() + "\n" + commands.get(command).getDescription(service) + "\n");
|
||||
message.setColor(Message.COLOR_YELLOW);
|
||||
conversation.addMessage(message);
|
||||
if (commands.containsKey(command)) {
|
||||
// XXX:I18N - String building salad :)
|
||||
Message message = new Message("Help of /" + command + "\n" + commands.get(command).getUsage() + "\n" + commands.get(command).getDescription(service) + "\n");
|
||||
message.setColor(Message.COLOR_YELLOW);
|
||||
conversation.addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
|
||||
service.sendBroadcast(intent);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.unknown_command, command));
|
||||
}
|
||||
}
|
||||
service.sendBroadcast(intent);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.unknown_command, command));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /help
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/help [<command>]";
|
||||
}
|
||||
/**
|
||||
* Usage of /help
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/help [<command>]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /help
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_help);
|
||||
}
|
||||
/**
|
||||
* Description of /help
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_help);
|
||||
}
|
||||
}
|
||||
|
@ -36,36 +36,36 @@ import android.content.Context;
|
||||
*/
|
||||
public class JoinHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /join
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).joinChannel(params[1]);
|
||||
} else if (params.length == 3) {
|
||||
service.getConnection(server.getId()).joinChannel(params[1], params[2]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute /join
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).joinChannel(params[1]);
|
||||
} else if (params.length == 3) {
|
||||
service.getConnection(server.getId()).joinChannel(params[1], params[2]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /join
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/join <channel> [<key>]";
|
||||
}
|
||||
/**
|
||||
* Usage of /join
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/join <channel> [<key>]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /join
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_join);
|
||||
}
|
||||
/**
|
||||
* Description of /join
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_join);
|
||||
}
|
||||
}
|
||||
|
@ -38,38 +38,38 @@ import android.content.Context;
|
||||
*/
|
||||
public class KickHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /kick
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /kick
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).kick(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).kick(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /kick
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/kick <nickname>";
|
||||
}
|
||||
/**
|
||||
* Usage of /kick
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/kick <nickname>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /kick
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_kick);
|
||||
}
|
||||
/**
|
||||
* Description of /kick
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_kick);
|
||||
}
|
||||
}
|
||||
|
@ -39,52 +39,52 @@ import android.content.Intent;
|
||||
*/
|
||||
public class MeHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /me
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() == Conversation.TYPE_SERVER) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel_or_query));
|
||||
}
|
||||
/**
|
||||
* Execute /me
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() == Conversation.TYPE_SERVER) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel_or_query));
|
||||
}
|
||||
|
||||
if (params.length > 1) {
|
||||
String action = BaseHandler.mergeParams(params);
|
||||
String nickname = service.getConnection(server.getId()).getNick();
|
||||
if (params.length > 1) {
|
||||
String action = BaseHandler.mergeParams(params);
|
||||
String nickname = service.getConnection(server.getId()).getNick();
|
||||
|
||||
Message message = new Message(nickname + " " + action);
|
||||
message.setIcon(R.drawable.action);
|
||||
server.getConversation(conversation.getName()).addMessage(message);
|
||||
Message message = new Message(nickname + " " + action);
|
||||
message.setIcon(R.drawable.action);
|
||||
server.getConversation(conversation.getName()).addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
|
||||
service.getConnection(server.getId()).sendAction(conversation.getName(), action);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.text_missing));
|
||||
}
|
||||
}
|
||||
service.getConnection(server.getId()).sendAction(conversation.getName(), action);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.text_missing));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /me
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/me <text>";
|
||||
}
|
||||
/**
|
||||
* Usage of /me
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/me <text>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /me
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_me);
|
||||
}
|
||||
/**
|
||||
* Description of /me
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_me);
|
||||
}
|
||||
}
|
||||
|
@ -38,36 +38,36 @@ import android.content.Context;
|
||||
*/
|
||||
public class ModeHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /mode
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 2) {
|
||||
String modes = BaseHandler.mergeParams(params, 2);
|
||||
/**
|
||||
* Execute /mode
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 2) {
|
||||
String modes = BaseHandler.mergeParams(params, 2);
|
||||
|
||||
service.getConnection(server.getId()).setMode(params[1], modes);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
service.getConnection(server.getId()).setMode(params[1], modes);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /mode
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/mode <channel> <mode>";
|
||||
}
|
||||
/**
|
||||
* Usage of /mode
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/mode <channel> <mode>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /mode
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_mode);
|
||||
}
|
||||
/**
|
||||
* Description of /mode
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_mode);
|
||||
}
|
||||
}
|
||||
|
@ -41,50 +41,50 @@ import android.content.Intent;
|
||||
*/
|
||||
public class MsgHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /msg
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 2) {
|
||||
String text = BaseHandler.mergeParams(params, 2);
|
||||
service.getConnection(server.getId()).sendMessage(params[1], text);
|
||||
/**
|
||||
* Execute /msg
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 2) {
|
||||
String text = BaseHandler.mergeParams(params, 2);
|
||||
service.getConnection(server.getId()).sendMessage(params[1], text);
|
||||
|
||||
Conversation targetConversation = server.getConversation(params[1]);
|
||||
Conversation targetConversation = server.getConversation(params[1]);
|
||||
|
||||
if (targetConversation != null) {
|
||||
Message message = new Message("<" + service.getConnection(server.getId()).getNick() + "> " + text);
|
||||
targetConversation.addMessage(message);
|
||||
if (targetConversation != null) {
|
||||
Message message = new Message("<" + service.getConnection(server.getId()).getNick() + "> " + text);
|
||||
targetConversation.addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
targetConversation.getName()
|
||||
);
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
targetConversation.getName()
|
||||
);
|
||||
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /msg
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/msg <target> <message>";
|
||||
}
|
||||
/**
|
||||
* Usage of /msg
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/msg <target> <message>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /msg
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_msg);
|
||||
}
|
||||
/**
|
||||
* Description of /msg
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_msg);
|
||||
}
|
||||
}
|
||||
|
@ -41,53 +41,53 @@ import android.content.Intent;
|
||||
*/
|
||||
public class NamesHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /names
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /names
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
StringBuffer userList = new StringBuffer(service.getString(R.string.message_users_on_chan, conversation.getName()));
|
||||
StringBuffer userList = new StringBuffer(service.getString(R.string.message_users_on_chan, conversation.getName()));
|
||||
|
||||
User[] mUsers = service.getConnection(server.getId()).getUsers(conversation.getName());
|
||||
int mSize = mUsers.length;
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
userList.append(" ");
|
||||
userList.append(mUsers[i].getPrefix());
|
||||
userList.append(mUsers[i].getNick());
|
||||
}
|
||||
User[] mUsers = service.getConnection(server.getId()).getUsers(conversation.getName());
|
||||
int mSize = mUsers.length;
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
userList.append(" ");
|
||||
userList.append(mUsers[i].getPrefix());
|
||||
userList.append(mUsers[i].getNick());
|
||||
}
|
||||
|
||||
Message message = new Message(userList.toString());
|
||||
message.setColor(Message.COLOR_YELLOW);
|
||||
conversation.addMessage(message);
|
||||
Message message = new Message(userList.toString());
|
||||
message.setColor(Message.COLOR_YELLOW);
|
||||
conversation.addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /names
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/names";
|
||||
}
|
||||
/**
|
||||
* Usage of /names
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/names";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /names
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_names);
|
||||
}
|
||||
/**
|
||||
* Description of /names
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_names);
|
||||
}
|
||||
}
|
||||
|
@ -36,34 +36,34 @@ import android.content.Context;
|
||||
*/
|
||||
public class NickHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /nick
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).changeNick(params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute /nick
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).changeNick(params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /nick
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/nick <nickname>";
|
||||
}
|
||||
/**
|
||||
* Usage of /nick
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/nick <nickname>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /nick
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_nick);
|
||||
}
|
||||
/**
|
||||
* Description of /nick
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_nick);
|
||||
}
|
||||
}
|
||||
|
@ -41,47 +41,47 @@ import android.content.Intent;
|
||||
*/
|
||||
public class NoticeHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /notice
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 2) {
|
||||
String text = BaseHandler.mergeParams(params);
|
||||
/**
|
||||
* Execute /notice
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 2) {
|
||||
String text = BaseHandler.mergeParams(params);
|
||||
|
||||
Message message = new Message(">" + params[1] + "< " + text);
|
||||
message.setIcon(R.drawable.info);
|
||||
conversation.addMessage(message);
|
||||
Message message = new Message(">" + params[1] + "< " + text);
|
||||
message.setIcon(R.drawable.info);
|
||||
conversation.addMessage(message);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
conversation.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
|
||||
service.getConnection(server.getId()).sendNotice(params[1], text);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
service.getConnection(server.getId()).sendNotice(params[1], text);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /notice
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/notice <nickname> <message>";
|
||||
}
|
||||
/**
|
||||
* Usage of /notice
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/notice <nickname> <message>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /notice
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_notice);
|
||||
}
|
||||
/**
|
||||
* Description of /notice
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_notice);
|
||||
}
|
||||
}
|
||||
|
@ -36,38 +36,38 @@ import android.content.Context;
|
||||
*/
|
||||
public class OpHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /deop
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /deop
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).op(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).op(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/op <nickname>";
|
||||
}
|
||||
/**
|
||||
* Usage of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/op <nickname>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_op);
|
||||
}
|
||||
/**
|
||||
* Description of /deop
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_op);
|
||||
}
|
||||
}
|
||||
|
@ -38,40 +38,40 @@ import android.content.Context;
|
||||
*/
|
||||
public class PartHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /part
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 1) {
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /part
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 1) {
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
service.getConnection(server.getId()).partChannel(conversation.getName());
|
||||
} else if (params.length == 2) {
|
||||
service.getConnection(server.getId()).partChannel(params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
service.getConnection(server.getId()).partChannel(conversation.getName());
|
||||
} else if (params.length == 2) {
|
||||
service.getConnection(server.getId()).partChannel(params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /part
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/part [<channel>]";
|
||||
}
|
||||
/**
|
||||
* Usage of /part
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/part [<channel>]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /part
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_part);
|
||||
}
|
||||
/**
|
||||
* Description of /part
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_part);
|
||||
}
|
||||
}
|
||||
|
@ -41,53 +41,53 @@ import android.content.Intent;
|
||||
*/
|
||||
public class QueryHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /query
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
// Simple validation
|
||||
if (params[1].startsWith("#")) {
|
||||
throw new CommandException(service.getString(R.string.query_to_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /query
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 2) {
|
||||
// Simple validation
|
||||
if (params[1].startsWith("#")) {
|
||||
throw new CommandException(service.getString(R.string.query_to_channel));
|
||||
}
|
||||
|
||||
Conversation query = server.getConversation(params[1]);
|
||||
Conversation query = server.getConversation(params[1]);
|
||||
|
||||
if (query != null) {
|
||||
throw new CommandException(service.getString(R.string.query_exists));
|
||||
}
|
||||
if (query != null) {
|
||||
throw new CommandException(service.getString(R.string.query_exists));
|
||||
}
|
||||
|
||||
query = new Query(params[1]);
|
||||
server.addConversationl(query);
|
||||
query = new Query(params[1]);
|
||||
server.addConversationl(query);
|
||||
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_NEW,
|
||||
server.getId(),
|
||||
query.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
Intent intent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_NEW,
|
||||
server.getId(),
|
||||
query.getName()
|
||||
);
|
||||
service.sendBroadcast(intent);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /query
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/query <nickname>";
|
||||
}
|
||||
/**
|
||||
* Usage of /query
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/query <nickname>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /query
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_query);
|
||||
}
|
||||
/**
|
||||
* Description of /query
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_query);
|
||||
}
|
||||
}
|
||||
|
@ -36,34 +36,34 @@ import android.content.Context;
|
||||
*/
|
||||
public class QuitHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /quit
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 1) {
|
||||
service.getConnection(server.getId()).quitServer();
|
||||
} else {
|
||||
service.getConnection(server.getId()).quitServer(BaseHandler.mergeParams(params));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute /quit
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length == 1) {
|
||||
service.getConnection(server.getId()).quitServer();
|
||||
} else {
|
||||
service.getConnection(server.getId()).quitServer(BaseHandler.mergeParams(params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /quit
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/quit [<reason>]";
|
||||
}
|
||||
/**
|
||||
* Usage of /quit
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/quit [<reason>]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /quit
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_quit);
|
||||
}
|
||||
/**
|
||||
* Description of /quit
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_quit);
|
||||
}
|
||||
}
|
||||
|
@ -38,35 +38,35 @@ import android.content.Context;
|
||||
*/
|
||||
public class RawHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /raw
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 1) {
|
||||
String line = BaseHandler.mergeParams(params);
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue(line);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.line_missing));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Execute /raw
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length > 1) {
|
||||
String line = BaseHandler.mergeParams(params);
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue(line);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.line_missing));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /raw
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/raw <line>";
|
||||
}
|
||||
/**
|
||||
* Usage of /raw
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/raw <line>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /raw
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_raw);
|
||||
}
|
||||
/**
|
||||
* Description of /raw
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_raw);
|
||||
}
|
||||
}
|
||||
|
@ -39,42 +39,42 @@ import android.content.Context;
|
||||
*/
|
||||
public class TopicHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /topic
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /topic
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
Channel channel = (Channel) conversation;
|
||||
Channel channel = (Channel) conversation;
|
||||
|
||||
if (params.length == 1) {
|
||||
// Show topic
|
||||
service.getConnection(server.getId()).onTopic(channel.getName(), channel.getTopic(), "", 0, false);
|
||||
} else if (params.length > 1) {
|
||||
// Change topic
|
||||
service.getConnection(server.getId()).setTopic(channel.getName(), BaseHandler.mergeParams(params));
|
||||
}
|
||||
}
|
||||
if (params.length == 1) {
|
||||
// Show topic
|
||||
service.getConnection(server.getId()).onTopic(channel.getName(), channel.getTopic(), "", 0, false);
|
||||
} else if (params.length > 1) {
|
||||
// Change topic
|
||||
service.getConnection(server.getId()).setTopic(channel.getName(), BaseHandler.mergeParams(params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /topic
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/topic [<topic>]";
|
||||
}
|
||||
/**
|
||||
* Usage of /topic
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/topic [<topic>]";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /topic
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_topic);
|
||||
}
|
||||
/**
|
||||
* Description of /topic
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_topic);
|
||||
}
|
||||
}
|
||||
|
@ -36,38 +36,38 @@ import android.content.Context;
|
||||
*/
|
||||
public class VoiceHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /voice
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
/**
|
||||
* Execute /voice
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (conversation.getType() != Conversation.TYPE_CHANNEL) {
|
||||
throw new CommandException(service.getString(R.string.only_usable_from_channel));
|
||||
}
|
||||
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).voice(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
if (params.length == 2) {
|
||||
service.getConnection(server.getId()).voice(conversation.getName(), params[1]);
|
||||
} else {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Usage of /voice
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/voice <nickname>";
|
||||
}
|
||||
/**
|
||||
* Usage of /voice
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/voice <nickname>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of /voice
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_voice);
|
||||
}
|
||||
/**
|
||||
* Description of /voice
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_voice);
|
||||
}
|
||||
}
|
||||
|
@ -38,34 +38,34 @@ import android.content.Context;
|
||||
*/
|
||||
public class WhoisHandler extends BaseHandler
|
||||
{
|
||||
/**
|
||||
* Execute /whois
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length != 2) {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
/**
|
||||
* Execute /whois
|
||||
*/
|
||||
@Override
|
||||
public void execute(String[] params, Server server, Conversation conversation, IRCService service) throws CommandException
|
||||
{
|
||||
if (params.length != 2) {
|
||||
throw new CommandException(service.getString(R.string.invalid_number_of_params));
|
||||
}
|
||||
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue("WHOIS " + params[1]);
|
||||
}
|
||||
service.getConnection(server.getId()).sendRawLineViaQueue("WHOIS " + params[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description of /whois
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_whois);
|
||||
}
|
||||
/**
|
||||
* Get description of /whois
|
||||
*/
|
||||
@Override
|
||||
public String getDescription(Context context)
|
||||
{
|
||||
return context.getString(R.string.command_desc_whois);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get usage of /whois
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/whois <nickname>";
|
||||
}
|
||||
/**
|
||||
* Get usage of /whois
|
||||
*/
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "/whois <nickname>";
|
||||
}
|
||||
}
|
||||
|
@ -4,16 +4,16 @@ import android.provider.BaseColumns;
|
||||
|
||||
public class AliasConstants implements BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "aliases";
|
||||
public static final String TABLE_NAME = "aliases";
|
||||
|
||||
// fields
|
||||
public static final String ALIAS = "alias";
|
||||
public static final String IDENTITY = "identity";
|
||||
// fields
|
||||
public static final String ALIAS = "alias";
|
||||
public static final String IDENTITY = "identity";
|
||||
|
||||
public static final String[] ALL = {
|
||||
_ID,
|
||||
ALIAS,
|
||||
IDENTITY,
|
||||
};
|
||||
public static final String[] ALL = {
|
||||
_ID,
|
||||
ALIAS,
|
||||
IDENTITY,
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -29,19 +29,19 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public interface ChannelConstants extends BaseColumns
|
||||
{
|
||||
public static final String TABLE_NAME = "channels";
|
||||
public static final String TABLE_NAME = "channels";
|
||||
|
||||
// fields
|
||||
public static final String NAME = "name";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String SERVER = "server";
|
||||
// fields
|
||||
public static final String NAME = "name";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String SERVER = "server";
|
||||
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
NAME,
|
||||
PASSWORD,
|
||||
SERVER
|
||||
};
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
NAME,
|
||||
PASSWORD,
|
||||
SERVER
|
||||
};
|
||||
}
|
||||
|
@ -29,17 +29,17 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public interface CommandConstants extends BaseColumns
|
||||
{
|
||||
public static final String TABLE_NAME = "commands";
|
||||
public static final String TABLE_NAME = "commands";
|
||||
|
||||
// fields
|
||||
public static final String COMMAND = "command";
|
||||
public static final String SERVER = "server";
|
||||
// fields
|
||||
public static final String COMMAND = "command";
|
||||
public static final String SERVER = "server";
|
||||
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
COMMAND,
|
||||
SERVER
|
||||
};
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
COMMAND,
|
||||
SERVER
|
||||
};
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,20 +29,20 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public class IdentityConstants implements BaseColumns
|
||||
{
|
||||
public static final String TABLE_NAME = "identities";
|
||||
public static final String TABLE_NAME = "identities";
|
||||
|
||||
// fields
|
||||
public static final String NICKNAME = "nickname";
|
||||
public static final String IDENT = "ident";
|
||||
public static final String REALNAME = "realname";
|
||||
// fields
|
||||
public static final String NICKNAME = "nickname";
|
||||
public static final String IDENT = "ident";
|
||||
public static final String REALNAME = "realname";
|
||||
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
_ID,
|
||||
NICKNAME,
|
||||
IDENT,
|
||||
REALNAME,
|
||||
};
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
_ID,
|
||||
NICKNAME,
|
||||
IDENT,
|
||||
REALNAME,
|
||||
};
|
||||
}
|
||||
|
@ -29,30 +29,30 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public interface ServerConstants extends BaseColumns
|
||||
{
|
||||
public static final String TABLE_NAME = "servers";
|
||||
public static final String TABLE_NAME = "servers";
|
||||
|
||||
// fields
|
||||
public static final String TITLE = "title";
|
||||
public static final String HOST = "host";
|
||||
public static final String PORT = "port";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String AUTOCONNECT = "autoConnect";
|
||||
public static final String USE_SSL = "useSSL";
|
||||
public static final String CHARSET = "charset";
|
||||
public static final String IDENTITY = "identity";
|
||||
// fields
|
||||
public static final String TITLE = "title";
|
||||
public static final String HOST = "host";
|
||||
public static final String PORT = "port";
|
||||
public static final String PASSWORD = "password";
|
||||
public static final String AUTOCONNECT = "autoConnect";
|
||||
public static final String USE_SSL = "useSSL";
|
||||
public static final String CHARSET = "charset";
|
||||
public static final String IDENTITY = "identity";
|
||||
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
_ID,
|
||||
TITLE,
|
||||
HOST,
|
||||
PORT,
|
||||
PASSWORD,
|
||||
AUTOCONNECT,
|
||||
USE_SSL,
|
||||
CHARSET,
|
||||
IDENTITY
|
||||
};
|
||||
/**
|
||||
* All fields of the table
|
||||
*/
|
||||
public static final String[] ALL = {
|
||||
_ID,
|
||||
TITLE,
|
||||
HOST,
|
||||
PORT,
|
||||
PASSWORD,
|
||||
AUTOCONNECT,
|
||||
USE_SSL,
|
||||
CHARSET,
|
||||
IDENTITY
|
||||
};
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ package org.yaaic.exception;
|
||||
*/
|
||||
public class CommandException extends Throwable
|
||||
{
|
||||
private static final long serialVersionUID = -8317993941455253288L;
|
||||
private static final long serialVersionUID = -8317993941455253288L;
|
||||
|
||||
/**
|
||||
* Create a new CommandException object
|
||||
*/
|
||||
public CommandException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
/**
|
||||
* Create a new CommandException object
|
||||
*/
|
||||
public CommandException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
@ -27,15 +27,15 @@ package org.yaaic.exception;
|
||||
*/
|
||||
public class ValidationException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 6951535205062761539L;
|
||||
private static final long serialVersionUID = 6951535205062761539L;
|
||||
|
||||
/**
|
||||
* Create a new ValidationException with the given message
|
||||
*
|
||||
* @param message The error message
|
||||
*/
|
||||
public ValidationException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
/**
|
||||
* Create a new ValidationException with the given message
|
||||
*
|
||||
* @param message The error message
|
||||
*/
|
||||
public ValidationException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
@ -31,36 +31,36 @@ import android.os.Binder;
|
||||
*/
|
||||
public class IRCBinder extends Binder
|
||||
{
|
||||
private IRCService service;
|
||||
private IRCService service;
|
||||
|
||||
/**
|
||||
* Create a new binder for given service
|
||||
*
|
||||
* @param service
|
||||
*/
|
||||
public IRCBinder(IRCService service)
|
||||
{
|
||||
super();
|
||||
/**
|
||||
* Create a new binder for given service
|
||||
*
|
||||
* @param service
|
||||
*/
|
||||
public IRCBinder(IRCService service)
|
||||
{
|
||||
super();
|
||||
|
||||
this.service = service;
|
||||
}
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to given server
|
||||
*
|
||||
* @param server
|
||||
*/
|
||||
public void connect(final Server server)
|
||||
{
|
||||
service.connect(server);
|
||||
}
|
||||
/**
|
||||
* Connect to given server
|
||||
*
|
||||
* @param server
|
||||
*/
|
||||
public void connect(final Server server)
|
||||
{
|
||||
service.connect(server);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get service associated with this service
|
||||
* @return
|
||||
*/
|
||||
public IRCService getService()
|
||||
{
|
||||
return service;
|
||||
}
|
||||
/**
|
||||
* Get service associated with this service
|
||||
* @return
|
||||
*/
|
||||
public IRCService getService()
|
||||
{
|
||||
return service;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,13 +51,13 @@ import android.content.Intent;
|
||||
*/
|
||||
public class IRCService extends Service
|
||||
{
|
||||
private IRCBinder binder;
|
||||
private HashMap<Integer, IRCConnection> connections;
|
||||
private boolean foreground = false;
|
||||
private IRCBinder binder;
|
||||
private HashMap<Integer, IRCConnection> connections;
|
||||
private boolean foreground = false;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Class[] mStartForegroundSignature = new Class[] { int.class, Notification.class };
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Class[] mStartForegroundSignature = new Class[] { int.class, Notification.class };
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Class[] mStopForegroundSignature = new Class[] { boolean.class };
|
||||
|
||||
public static final String ACTION_FOREGROUND = "org.yaaic.service.foreground";
|
||||
@ -71,26 +71,26 @@ public class IRCService extends Service
|
||||
private Notification notification;
|
||||
private Settings settings;
|
||||
|
||||
/**
|
||||
* Create new service
|
||||
*/
|
||||
public IRCService()
|
||||
{
|
||||
super();
|
||||
/**
|
||||
* Create new service
|
||||
*/
|
||||
public IRCService()
|
||||
{
|
||||
super();
|
||||
|
||||
this.connections = new HashMap<Integer, IRCConnection>();
|
||||
this.binder = new IRCBinder(this);
|
||||
}
|
||||
this.connections = new HashMap<Integer, IRCConnection>();
|
||||
this.binder = new IRCBinder(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate()
|
||||
{
|
||||
super.onCreate();
|
||||
/**
|
||||
* On create
|
||||
*/
|
||||
@Override
|
||||
public void onCreate()
|
||||
{
|
||||
super.onCreate();
|
||||
|
||||
settings = new Settings(getBaseContext());
|
||||
settings = new Settings(getBaseContext());
|
||||
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
|
||||
try {
|
||||
@ -101,49 +101,49 @@ public class IRCService extends Service
|
||||
mStartForeground = mStopForeground = null;
|
||||
}
|
||||
|
||||
// Load servers from Database
|
||||
// Load servers from Database
|
||||
Database db = new Database(this);
|
||||
Yaaic.getInstance().setServers(db.getServers());
|
||||
db.close();
|
||||
Yaaic.getInstance().setServers(db.getServers());
|
||||
db.close();
|
||||
|
||||
// Broadcast changed server list
|
||||
sendBroadcast(new Intent(Broadcast.SERVER_UPDATE));
|
||||
}
|
||||
// Broadcast changed server list
|
||||
sendBroadcast(new Intent(Broadcast.SERVER_UPDATE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Settings object
|
||||
*
|
||||
* @return the settings helper object
|
||||
*/
|
||||
public Settings getSettings()
|
||||
{
|
||||
return settings;
|
||||
}
|
||||
/**
|
||||
* Get Settings object
|
||||
*
|
||||
* @return the settings helper object
|
||||
*/
|
||||
public Settings getSettings()
|
||||
{
|
||||
return settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* On start (will be called on pre-2.0 platform. On 2.0 or later onStartCommand()
|
||||
* will be called)
|
||||
*/
|
||||
@Override
|
||||
public void onStart(Intent intent, int startId)
|
||||
{
|
||||
super.onStart(intent, startId);
|
||||
handleCommand(intent);
|
||||
}
|
||||
/**
|
||||
* On start (will be called on pre-2.0 platform. On 2.0 or later onStartCommand()
|
||||
* will be called)
|
||||
*/
|
||||
@Override
|
||||
public void onStart(Intent intent, int startId)
|
||||
{
|
||||
super.onStart(intent, startId);
|
||||
handleCommand(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* On start command (Android >= 2.0)
|
||||
*
|
||||
* @param intent
|
||||
* @param flags
|
||||
* @param startId
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* On start command (Android >= 2.0)
|
||||
*
|
||||
* @param intent
|
||||
* @param flags
|
||||
* @param startId
|
||||
* @return
|
||||
*/
|
||||
public int onStartCommand(Intent intent, int flags, int startId)
|
||||
{
|
||||
if (intent != null) {
|
||||
handleCommand(intent);
|
||||
}
|
||||
if (intent != null) {
|
||||
handleCommand(intent);
|
||||
}
|
||||
|
||||
// We want this service to continue running until it is explicitly
|
||||
// stopped, so return sticky.
|
||||
@ -160,22 +160,22 @@ public class IRCService extends Service
|
||||
private void handleCommand(Intent intent)
|
||||
{
|
||||
if (ACTION_FOREGROUND.equals(intent.getAction())) {
|
||||
if (foreground) {
|
||||
return; // XXX: We are already in foreground...
|
||||
}
|
||||
foreground = true;
|
||||
if (foreground) {
|
||||
return; // XXX: We are already in foreground...
|
||||
}
|
||||
foreground = true;
|
||||
|
||||
// Set the icon, scrolling text and timestamp
|
||||
notification = new Notification(R.drawable.icon, "", System.currentTimeMillis());
|
||||
// Set the icon, scrolling text and timestamp
|
||||
notification = new Notification(R.drawable.icon, "", System.currentTimeMillis());
|
||||
|
||||
// The PendingIntent to launch our activity if the user selects this notification
|
||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0);
|
||||
// The PendingIntent to launch our activity if the user selects this notification
|
||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0);
|
||||
|
||||
// Set the info for the views that show in the notification panel.
|
||||
notification.setLatestEventInfo(this, getText(R.string.app_name), "", contentIntent);
|
||||
// Set the info for the views that show in the notification panel.
|
||||
notification.setLatestEventInfo(this, getText(R.string.app_name), "", contentIntent);
|
||||
|
||||
startForegroundCompat(R.string.app_name, notification);
|
||||
} else if (ACTION_BACKGROUND.equals(intent.getAction()) && !foreground) {
|
||||
startForegroundCompat(R.string.app_name, notification);
|
||||
} else if (ACTION_BACKGROUND.equals(intent.getAction()) && !foreground) {
|
||||
stopForegroundCompat(R.string.app_name);
|
||||
}
|
||||
}
|
||||
@ -193,21 +193,21 @@ public class IRCService extends Service
|
||||
/**
|
||||
* Update notification and vibrate if needed
|
||||
*
|
||||
* @param text The text to display
|
||||
* @param text The text to display
|
||||
* @param vibrate True if the device should vibrate, false otherwise
|
||||
*/
|
||||
public void updateNotification(String text, boolean vibrate)
|
||||
{
|
||||
if (foreground) {
|
||||
notificationManager.cancel(R.string.app_name);
|
||||
notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
|
||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0);
|
||||
notification.setLatestEventInfo(this, getText(R.string.app_name), text, contentIntent);
|
||||
if (vibrate) {
|
||||
notification.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
}
|
||||
notificationManager.notify(R.string.app_name, notification);
|
||||
}
|
||||
if (foreground) {
|
||||
notificationManager.cancel(R.string.app_name);
|
||||
notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
|
||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, ServersActivity.class), 0);
|
||||
notification.setLatestEventInfo(this, getText(R.string.app_name), text, contentIntent);
|
||||
if (vibrate) {
|
||||
notification.defaults |= Notification.DEFAULT_VIBRATE;
|
||||
}
|
||||
notificationManager.notify(R.string.app_name, notification);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -228,9 +228,9 @@ public class IRCService extends Service
|
||||
// Should not happen.
|
||||
}
|
||||
} else {
|
||||
// Fall back on the old API.
|
||||
setForeground(true);
|
||||
notificationManager.notify(id, notification);
|
||||
// Fall back on the old API.
|
||||
setForeground(true);
|
||||
notificationManager.notify(id, notification);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class IRCService extends Service
|
||||
*/
|
||||
public void stopForegroundCompat(int id)
|
||||
{
|
||||
foreground = false;
|
||||
foreground = false;
|
||||
|
||||
// If we have the new stopForeground API, then use it.
|
||||
if (mStopForeground != null) {
|
||||
@ -253,10 +253,10 @@ public class IRCService extends Service
|
||||
// Should not happen.
|
||||
}
|
||||
} else {
|
||||
// Fall back on the old API. Note to cancel BEFORE changing the
|
||||
// foreground state, since we could be killed at that point.
|
||||
notificationManager.cancel(id);
|
||||
setForeground(false);
|
||||
// Fall back on the old API. Note to cancel BEFORE changing the
|
||||
// foreground state, since we could be killed at that point.
|
||||
notificationManager.cancel(id);
|
||||
setForeground(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,135 +265,135 @@ public class IRCService extends Service
|
||||
*/
|
||||
public void connect(final Server server)
|
||||
{
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
IRCConnection connection = getConnection(server.getId());
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
IRCConnection connection = getConnection(server.getId());
|
||||
|
||||
connection.setNickname(server.getIdentity().getNickname());
|
||||
connection.setAliases(server.getIdentity().getAliases());
|
||||
connection.setIdent(server.getIdentity().getIdent());
|
||||
connection.setRealName(server.getIdentity().getRealName());
|
||||
connection.setUseSSL(server.useSSL());
|
||||
connection.setNickname(server.getIdentity().getNickname());
|
||||
connection.setAliases(server.getIdentity().getAliases());
|
||||
connection.setIdent(server.getIdentity().getIdent());
|
||||
connection.setRealName(server.getIdentity().getRealName());
|
||||
connection.setUseSSL(server.useSSL());
|
||||
|
||||
if (server.getCharset() != null) {
|
||||
connection.setEncoding(server.getCharset());
|
||||
}
|
||||
if (server.getCharset() != null) {
|
||||
connection.setEncoding(server.getCharset());
|
||||
}
|
||||
|
||||
if (server.getPassword() != "") {
|
||||
connection.connect(server.getHost(), server.getPort(), server.getPassword());
|
||||
} else {
|
||||
connection.connect(server.getHost(), server.getPort());
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
if (server.getPassword() != "") {
|
||||
connection.connect(server.getHost(), server.getPort(), server.getPassword());
|
||||
} else {
|
||||
connection.connect(server.getHost(), server.getPort());
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
|
||||
Intent sIntent = Broadcast.createServerIntent(Broadcast.SERVER_UPDATE, server.getId());
|
||||
sendBroadcast(sIntent);
|
||||
Intent sIntent = Broadcast.createServerIntent(Broadcast.SERVER_UPDATE, server.getId());
|
||||
sendBroadcast(sIntent);
|
||||
|
||||
IRCConnection connection = getConnection(server.getId());
|
||||
IRCConnection connection = getConnection(server.getId());
|
||||
|
||||
Message message;
|
||||
Message message;
|
||||
|
||||
if (e instanceof NickAlreadyInUseException) {
|
||||
message = new Message(getString(R.string.nickname_in_use, connection.getNick()));
|
||||
} else if (e instanceof IrcException) {
|
||||
message = new Message(getString(R.string.irc_login_error, server.getHost(), server.getPort()));
|
||||
} else {
|
||||
message = new Message(getString(R.string.could_not_connect, server.getHost(), server.getPort()));
|
||||
}
|
||||
if (e instanceof NickAlreadyInUseException) {
|
||||
message = new Message(getString(R.string.nickname_in_use, connection.getNick()));
|
||||
} else if (e instanceof IrcException) {
|
||||
message = new Message(getString(R.string.irc_login_error, server.getHost(), server.getPort()));
|
||||
} else {
|
||||
message = new Message(getString(R.string.could_not_connect, server.getHost(), server.getPort()));
|
||||
}
|
||||
|
||||
message.setColor(Message.COLOR_RED);
|
||||
message.setIcon(R.drawable.error);
|
||||
server.getConversation(ServerInfo.DEFAULT_NAME).addMessage(message);
|
||||
message.setColor(Message.COLOR_RED);
|
||||
message.setIcon(R.drawable.error);
|
||||
server.getConversation(ServerInfo.DEFAULT_NAME).addMessage(message);
|
||||
|
||||
Intent cIntent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
ServerInfo.DEFAULT_NAME
|
||||
);
|
||||
sendBroadcast(cIntent);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
Intent cIntent = Broadcast.createConversationIntent(
|
||||
Broadcast.CONVERSATION_MESSAGE,
|
||||
server.getId(),
|
||||
ServerInfo.DEFAULT_NAME
|
||||
);
|
||||
sendBroadcast(cIntent);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get connection for given server
|
||||
*
|
||||
* @param serverId
|
||||
* @return
|
||||
*/
|
||||
public synchronized IRCConnection getConnection(int serverId)
|
||||
{
|
||||
IRCConnection connection = connections.get(serverId);
|
||||
/**
|
||||
* Get connection for given server
|
||||
*
|
||||
* @param serverId
|
||||
* @return
|
||||
*/
|
||||
public synchronized IRCConnection getConnection(int serverId)
|
||||
{
|
||||
IRCConnection connection = connections.get(serverId);
|
||||
|
||||
if (connection == null) {
|
||||
connection = new IRCConnection(this, serverId);
|
||||
connections.put(serverId, connection);
|
||||
}
|
||||
if (connection == null) {
|
||||
connection = new IRCConnection(this, serverId);
|
||||
connections.put(serverId, connection);
|
||||
}
|
||||
|
||||
return connection;
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the service keep a connection object for this server?
|
||||
*
|
||||
* @return true if there's a connection object, false otherwise
|
||||
*/
|
||||
public boolean hasConnection(int serverId)
|
||||
{
|
||||
return connections.containsKey(serverId);
|
||||
}
|
||||
/**
|
||||
* Does the service keep a connection object for this server?
|
||||
*
|
||||
* @return true if there's a connection object, false otherwise
|
||||
*/
|
||||
public boolean hasConnection(int serverId)
|
||||
{
|
||||
return connections.containsKey(serverId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check status of service
|
||||
*/
|
||||
public void checkServiceStatus()
|
||||
{
|
||||
boolean shutDown = true;
|
||||
ArrayList<Server> mServers = Yaaic.getInstance().getServersAsArrayList();
|
||||
int mSize = mServers.size();
|
||||
Server server;
|
||||
/**
|
||||
* Check status of service
|
||||
*/
|
||||
public void checkServiceStatus()
|
||||
{
|
||||
boolean shutDown = true;
|
||||
ArrayList<Server> mServers = Yaaic.getInstance().getServersAsArrayList();
|
||||
int mSize = mServers.size();
|
||||
Server server;
|
||||
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
server = mServers.get(i);
|
||||
if (server.isDisconnected()) {
|
||||
connections.remove(server.getId());
|
||||
} else {
|
||||
shutDown = false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
server = mServers.get(i);
|
||||
if (server.isDisconnected()) {
|
||||
connections.remove(server.getId());
|
||||
} else {
|
||||
shutDown = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (shutDown) {
|
||||
foreground = false;
|
||||
stopForegroundCompat(R.string.app_name);
|
||||
stopSelf();
|
||||
}
|
||||
}
|
||||
if (shutDown) {
|
||||
foreground = false;
|
||||
stopForegroundCompat(R.string.app_name);
|
||||
stopSelf();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On Destroy
|
||||
*/
|
||||
/**
|
||||
* On Destroy
|
||||
*/
|
||||
@Override
|
||||
public void onDestroy()
|
||||
{
|
||||
// Make sure our notification is gone.
|
||||
if (foreground) {
|
||||
stopForegroundCompat(R.string.app_name);
|
||||
}
|
||||
if (foreground) {
|
||||
stopForegroundCompat(R.string.app_name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On Activity binding to this service
|
||||
*
|
||||
* @param intent
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IRCBinder onBind(Intent intent)
|
||||
{
|
||||
return binder;
|
||||
}
|
||||
/**
|
||||
* On Activity binding to this service
|
||||
*
|
||||
* @param intent
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IRCBinder onBind(Intent intent)
|
||||
{
|
||||
return binder;
|
||||
}
|
||||
}
|
||||
|
@ -53,14 +53,14 @@ public class NonScalingBackgroundDrawable extends Drawable {
|
||||
*/
|
||||
public void draw(Canvas canvas)
|
||||
{
|
||||
int left = (view.getWidth() / 2) - (drawable.getIntrinsicWidth() / 2);
|
||||
int top = (view.getHeight() / 2) - (drawable.getIntrinsicHeight() / 2);
|
||||
int right = left + drawable.getIntrinsicWidth();
|
||||
int bottom = top + drawable.getIntrinsicHeight();
|
||||
int left = (view.getWidth() / 2) - (drawable.getIntrinsicWidth() / 2);
|
||||
int top = (view.getHeight() / 2) - (drawable.getIntrinsicHeight() / 2);
|
||||
int right = left + drawable.getIntrinsicWidth();
|
||||
int bottom = top + drawable.getIntrinsicHeight();
|
||||
|
||||
drawable.setBounds(left, top, right, bottom);
|
||||
drawable.setBounds(left, top, right, bottom);
|
||||
|
||||
drawable.draw(canvas);
|
||||
drawable.draw(canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +76,7 @@ public class NonScalingBackgroundDrawable extends Drawable {
|
||||
*/
|
||||
public void setAlpha(int alpha)
|
||||
{
|
||||
drawable.setAlpha(alpha);
|
||||
drawable.setAlpha(alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,6 +84,6 @@ public class NonScalingBackgroundDrawable extends Drawable {
|
||||
*/
|
||||
public void setColorFilter(ColorFilter cf)
|
||||
{
|
||||
drawable.setColorFilter(cf);
|
||||
drawable.setColorFilter(cf);
|
||||
}
|
||||
}
|
||||
|
@ -38,35 +38,35 @@ import org.yaaic.view.MessageListView;
|
||||
*/
|
||||
public class ConversationClickListener implements OnItemClickListener
|
||||
{
|
||||
private DeckAdapter adapter;
|
||||
private ViewSwitcher switcher;
|
||||
private DeckAdapter adapter;
|
||||
private ViewSwitcher switcher;
|
||||
|
||||
/**
|
||||
* Create a new ConversationClickListener
|
||||
*
|
||||
* @param adapter
|
||||
* @param switcher
|
||||
*/
|
||||
public ConversationClickListener(DeckAdapter adapter, ViewSwitcher switcher)
|
||||
{
|
||||
this.adapter = adapter;
|
||||
this.switcher = switcher;
|
||||
}
|
||||
/**
|
||||
* Create a new ConversationClickListener
|
||||
*
|
||||
* @param adapter
|
||||
* @param switcher
|
||||
*/
|
||||
public ConversationClickListener(DeckAdapter adapter, ViewSwitcher switcher)
|
||||
{
|
||||
this.adapter = adapter;
|
||||
this.switcher = switcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* On conversation item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
|
||||
{
|
||||
Conversation conversation = adapter.getItem(position);
|
||||
/**
|
||||
* On conversation item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
|
||||
{
|
||||
Conversation conversation = adapter.getItem(position);
|
||||
|
||||
MessageListView canvas = adapter.renderConversation(conversation, switcher);
|
||||
canvas.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
|
||||
canvas.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
canvas.setDelegateTouchEvents(false); // Do not delegate
|
||||
MessageListView canvas = adapter.renderConversation(conversation, switcher);
|
||||
canvas.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
|
||||
canvas.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
canvas.setDelegateTouchEvents(false); // Do not delegate
|
||||
|
||||
adapter.setSwitched(conversation.getName(), canvas);
|
||||
switcher.addView(canvas);
|
||||
switcher.showNext();
|
||||
}
|
||||
adapter.setSwitched(conversation.getName(), canvas);
|
||||
switcher.addView(canvas);
|
||||
switcher.showNext();
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ package org.yaaic.listener;
|
||||
|
||||
public interface ConversationListener
|
||||
{
|
||||
public void onConversationMessage(String target);
|
||||
public void onNewConversation(String target);
|
||||
public void onRemoveConversation(String target);
|
||||
public void onConversationMessage(String target);
|
||||
public void onNewConversation(String target);
|
||||
public void onRemoveConversation(String target);
|
||||
}
|
||||
|
@ -36,56 +36,56 @@ import org.yaaic.view.ConversationSwitcher;
|
||||
*/
|
||||
public class ConversationSelectedListener implements OnItemSelectedListener
|
||||
{
|
||||
private Server server;
|
||||
private TextView titleView;
|
||||
private ConversationSwitcher switcher;
|
||||
private Server server;
|
||||
private TextView titleView;
|
||||
private ConversationSwitcher switcher;
|
||||
|
||||
/**
|
||||
* Create a new ConversationSelectedListener
|
||||
*
|
||||
* @param server
|
||||
* @param titleView
|
||||
*/
|
||||
public ConversationSelectedListener(Server server, TextView titleView, ConversationSwitcher switcher)
|
||||
{
|
||||
this.server = server;
|
||||
this.titleView = titleView;
|
||||
this.switcher = switcher;
|
||||
}
|
||||
/**
|
||||
* Create a new ConversationSelectedListener
|
||||
*
|
||||
* @param server
|
||||
* @param titleView
|
||||
*/
|
||||
public ConversationSelectedListener(Server server, TextView titleView, ConversationSwitcher switcher)
|
||||
{
|
||||
this.server = server;
|
||||
this.titleView = titleView;
|
||||
this.switcher = switcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* On conversation selected/focused
|
||||
*/
|
||||
public void onItemSelected(AdapterView<?> deck, View view, int position, long id)
|
||||
{
|
||||
Conversation conversation = (Conversation) deck.getItemAtPosition(position);
|
||||
/**
|
||||
* On conversation selected/focused
|
||||
*/
|
||||
public void onItemSelected(AdapterView<?> deck, View view, int position, long id)
|
||||
{
|
||||
Conversation conversation = (Conversation) deck.getItemAtPosition(position);
|
||||
|
||||
if (conversation != null && conversation.getType() != Conversation.TYPE_SERVER) {
|
||||
titleView.setText(server.getTitle() + " - " + conversation.getName());
|
||||
} else {
|
||||
onNothingSelected(deck);
|
||||
}
|
||||
if (conversation != null && conversation.getType() != Conversation.TYPE_SERVER) {
|
||||
titleView.setText(server.getTitle() + " - " + conversation.getName());
|
||||
} else {
|
||||
onNothingSelected(deck);
|
||||
}
|
||||
|
||||
// Remember selection
|
||||
if (conversation != null) {
|
||||
Conversation previousConversation = server.getConversation(server.getSelectedConversation());
|
||||
// Remember selection
|
||||
if (conversation != null) {
|
||||
Conversation previousConversation = server.getConversation(server.getSelectedConversation());
|
||||
|
||||
if (previousConversation != null) {
|
||||
previousConversation.setStatus(Conversation.STATUS_DEFAULT);
|
||||
}
|
||||
if (previousConversation != null) {
|
||||
previousConversation.setStatus(Conversation.STATUS_DEFAULT);
|
||||
}
|
||||
|
||||
conversation.setStatus(Conversation.STATUS_SELECTED);
|
||||
server.setSelectedConversation(conversation.getName());
|
||||
}
|
||||
conversation.setStatus(Conversation.STATUS_SELECTED);
|
||||
server.setSelectedConversation(conversation.getName());
|
||||
}
|
||||
|
||||
switcher.invalidate();
|
||||
}
|
||||
switcher.invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* On no conversation selected/focused
|
||||
*/
|
||||
public void onNothingSelected(AdapterView<?> deck)
|
||||
{
|
||||
titleView.setText(server.getTitle());
|
||||
}
|
||||
/**
|
||||
* On no conversation selected/focused
|
||||
*/
|
||||
public void onNothingSelected(AdapterView<?> deck)
|
||||
{
|
||||
titleView.setText(server.getTitle());
|
||||
}
|
||||
}
|
||||
|
@ -36,38 +36,38 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||
*/
|
||||
public class MessageClickListener implements OnItemClickListener
|
||||
{
|
||||
private static MessageClickListener instance;
|
||||
private static MessageClickListener instance;
|
||||
|
||||
/**
|
||||
* Private constructor
|
||||
*/
|
||||
private MessageClickListener()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Private constructor
|
||||
*/
|
||||
private MessageClickListener()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get global instance of message click listener
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized MessageClickListener getInstance()
|
||||
{
|
||||
if (instance == null) {
|
||||
instance = new MessageClickListener();
|
||||
}
|
||||
/**
|
||||
* Get global instance of message click listener
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized MessageClickListener getInstance()
|
||||
{
|
||||
if (instance == null) {
|
||||
instance = new MessageClickListener();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* On message item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> group, View view, int position, long id)
|
||||
{
|
||||
MessageListAdapter adapter = (MessageListAdapter) group.getAdapter();
|
||||
/**
|
||||
* On message item clicked
|
||||
*/
|
||||
public void onItemClick(AdapterView<?> group, View view, int position, long id)
|
||||
{
|
||||
MessageListAdapter adapter = (MessageListAdapter) group.getAdapter();
|
||||
|
||||
Intent intent = new Intent(group.getContext(), MessageActivity.class);
|
||||
intent.putExtra(Extra.MESSAGE, adapter.getItem(position).getText().toString());
|
||||
group.getContext().startActivity(intent);
|
||||
}
|
||||
Intent intent = new Intent(group.getContext(), MessageActivity.class);
|
||||
intent.putExtra(Extra.MESSAGE, adapter.getItem(position).getText().toString());
|
||||
group.getContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ package org.yaaic.listener;
|
||||
|
||||
public interface ServerListener
|
||||
{
|
||||
public void onStatusUpdate();
|
||||
public void onStatusUpdate();
|
||||
}
|
||||
|
@ -35,29 +35,29 @@ import android.view.View.OnClickListener;
|
||||
*/
|
||||
public class SpeechClickListener implements OnClickListener
|
||||
{
|
||||
private Activity activity;
|
||||
private Activity activity;
|
||||
|
||||
/**
|
||||
* Create a new listener for speech button
|
||||
*
|
||||
* @param activity
|
||||
* @param input
|
||||
*/
|
||||
public SpeechClickListener(Activity activity)
|
||||
{
|
||||
this.activity = activity;
|
||||
}
|
||||
/**
|
||||
* Create a new listener for speech button
|
||||
*
|
||||
* @param activity
|
||||
* @param input
|
||||
*/
|
||||
public SpeechClickListener(Activity activity)
|
||||
{
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* On Click on speech button
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
||||
/**
|
||||
* On Click on speech button
|
||||
*/
|
||||
public void onClick(View v)
|
||||
{
|
||||
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
||||
|
||||
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
|
||||
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "");
|
||||
|
||||
activity.startActivityForResult(intent, ConversationActivity.REQUEST_CODE_SPEECH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,43 +29,43 @@ import android.content.Intent;
|
||||
*/
|
||||
public abstract class Broadcast
|
||||
{
|
||||
public static final String SERVER_UPDATE = "org.yaaic.server.status";
|
||||
public static final String SERVER_UPDATE = "org.yaaic.server.status";
|
||||
|
||||
public static final String CONVERSATION_MESSAGE = "org.yaaic.conversation.message";
|
||||
public static final String CONVERSATION_NEW = "org.yaaic.conversation.new";
|
||||
public static final String CONVERSATION_REMOVE = "org.yaaic.conversation.remove";
|
||||
public static final String CONVERSATION_MESSAGE = "org.yaaic.conversation.message";
|
||||
public static final String CONVERSATION_NEW = "org.yaaic.conversation.new";
|
||||
public static final String CONVERSATION_REMOVE = "org.yaaic.conversation.remove";
|
||||
|
||||
/**
|
||||
* Create an Intent for conversation broadcasting
|
||||
*
|
||||
* @param broadcastType The type of the broadcast, some constant of Broadcast.*
|
||||
* @param serverId The id of the server
|
||||
* @param conversationName The unique name of the conversation
|
||||
* @return The created Intent
|
||||
*/
|
||||
public static Intent createConversationIntent(String broadcastType, int serverId, String conversationName)
|
||||
{
|
||||
Intent intent = new Intent(broadcastType);
|
||||
/**
|
||||
* Create an Intent for conversation broadcasting
|
||||
*
|
||||
* @param broadcastType The type of the broadcast, some constant of Broadcast.*
|
||||
* @param serverId The id of the server
|
||||
* @param conversationName The unique name of the conversation
|
||||
* @return The created Intent
|
||||
*/
|
||||
public static Intent createConversationIntent(String broadcastType, int serverId, String conversationName)
|
||||
{
|
||||
Intent intent = new Intent(broadcastType);
|
||||
|
||||
intent.putExtra(Extra.SERVER, serverId);
|
||||
intent.putExtra(Extra.CONVERSATION, conversationName);
|
||||
intent.putExtra(Extra.SERVER, serverId);
|
||||
intent.putExtra(Extra.CONVERSATION, conversationName);
|
||||
|
||||
return intent;
|
||||
}
|
||||
return intent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an Intent for server broadcasting
|
||||
*
|
||||
* @param broadcastType The typo of the broadcast, some constant of Broadcast.*
|
||||
* @param serverId The id of the server
|
||||
* @return The created Intent
|
||||
*/
|
||||
public static Intent createServerIntent(String broadcastType, int serverId)
|
||||
{
|
||||
Intent intent = new Intent(broadcastType);
|
||||
/**
|
||||
* Create an Intent for server broadcasting
|
||||
*
|
||||
* @param broadcastType The typo of the broadcast, some constant of Broadcast.*
|
||||
* @param serverId The id of the server
|
||||
* @return The created Intent
|
||||
*/
|
||||
public static Intent createServerIntent(String broadcastType, int serverId)
|
||||
{
|
||||
Intent intent = new Intent(broadcastType);
|
||||
|
||||
intent.putExtra(Extra.SERVER, serverId);
|
||||
intent.putExtra(Extra.SERVER, serverId);
|
||||
|
||||
return intent;
|
||||
}
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
|
@ -27,45 +27,45 @@ package org.yaaic.model;
|
||||
*/
|
||||
public class Channel extends Conversation
|
||||
{
|
||||
private String topic;
|
||||
private String topic;
|
||||
|
||||
/**
|
||||
* Create a new channel object
|
||||
*
|
||||
* @param name of the channel
|
||||
*/
|
||||
public Channel(String name)
|
||||
{
|
||||
super(name);
|
||||
this.topic = "";
|
||||
}
|
||||
/**
|
||||
* Create a new channel object
|
||||
*
|
||||
* @param name of the channel
|
||||
*/
|
||||
public Channel(String name)
|
||||
{
|
||||
super(name);
|
||||
this.topic = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of this conversation
|
||||
*/
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return Conversation.TYPE_CHANNEL;
|
||||
}
|
||||
/**
|
||||
* Get the type of this conversation
|
||||
*/
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return Conversation.TYPE_CHANNEL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the channel's topic
|
||||
*
|
||||
* @param topic The topic of the channel
|
||||
*/
|
||||
public void setTopic(String topic)
|
||||
{
|
||||
this.topic = topic;
|
||||
}
|
||||
/**
|
||||
* Set the channel's topic
|
||||
*
|
||||
* @param topic The topic of the channel
|
||||
*/
|
||||
public void setTopic(String topic)
|
||||
{
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the topic of the channel
|
||||
*
|
||||
* @return The channel's topic
|
||||
*/
|
||||
public String getTopic()
|
||||
{
|
||||
return topic;
|
||||
}
|
||||
/**
|
||||
* Get the topic of the channel
|
||||
*
|
||||
* @return The channel's topic
|
||||
*/
|
||||
public String getTopic()
|
||||
{
|
||||
return topic;
|
||||
}
|
||||
}
|
||||
|
@ -33,163 +33,163 @@ import org.yaaic.adapter.MessageListAdapter;
|
||||
*/
|
||||
public abstract class Conversation
|
||||
{
|
||||
public static final int TYPE_CHANNEL = 1;
|
||||
public static final int TYPE_QUERY = 2;
|
||||
public static final int TYPE_SERVER = 3;
|
||||
public static final int TYPE_CHANNEL = 1;
|
||||
public static final int TYPE_QUERY = 2;
|
||||
public static final int TYPE_SERVER = 3;
|
||||
|
||||
public static final int STATUS_DEFAULT = 1;
|
||||
public static final int STATUS_SELECTED = 2;
|
||||
public static final int STATUS_MESSAGE = 3;
|
||||
public static final int STATUS_HIGHLIGHT = 4;
|
||||
public static final int STATUS_DEFAULT = 1;
|
||||
public static final int STATUS_SELECTED = 2;
|
||||
public static final int STATUS_MESSAGE = 3;
|
||||
public static final int STATUS_HIGHLIGHT = 4;
|
||||
|
||||
public static final int HISTORY_SIZE = 30;
|
||||
public static final int HISTORY_SIZE = 30;
|
||||
|
||||
private LinkedList<Message> buffer;
|
||||
private LinkedList<Message> history;
|
||||
private String name;
|
||||
private MessageListAdapter adapter;
|
||||
private int status = 1;
|
||||
private LinkedList<Message> buffer;
|
||||
private LinkedList<Message> history;
|
||||
private String name;
|
||||
private MessageListAdapter adapter;
|
||||
private int status = 1;
|
||||
|
||||
/**
|
||||
* Get the type of conversation (channel, query, ..)
|
||||
*
|
||||
* @return See the constants: Conversation.TYPE_*
|
||||
*/
|
||||
public abstract int getType();
|
||||
/**
|
||||
* Get the type of conversation (channel, query, ..)
|
||||
*
|
||||
* @return See the constants: Conversation.TYPE_*
|
||||
*/
|
||||
public abstract int getType();
|
||||
|
||||
/**
|
||||
* Create a new conversation with the given name
|
||||
*
|
||||
* @param name The name of the conversation (channel, user)
|
||||
*/
|
||||
public Conversation(String name)
|
||||
{
|
||||
this.buffer = new LinkedList<Message>();
|
||||
this.history = new LinkedList<Message>();
|
||||
this.name = name.toLowerCase();
|
||||
}
|
||||
/**
|
||||
* Create a new conversation with the given name
|
||||
*
|
||||
* @param name The name of the conversation (channel, user)
|
||||
*/
|
||||
public Conversation(String name)
|
||||
{
|
||||
this.buffer = new LinkedList<Message>();
|
||||
this.history = new LinkedList<Message>();
|
||||
this.name = name.toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of the conversation (channel, user)
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* Get name of the conversation (channel, user)
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message to the channel
|
||||
*/
|
||||
public void addMessage(Message message)
|
||||
{
|
||||
buffer.add(0, message);
|
||||
history.add(message);
|
||||
/**
|
||||
* Add a message to the channel
|
||||
*/
|
||||
public void addMessage(Message message)
|
||||
{
|
||||
buffer.add(0, message);
|
||||
history.add(message);
|
||||
|
||||
if (history.size() > HISTORY_SIZE) {
|
||||
history.remove(0);
|
||||
}
|
||||
}
|
||||
if (history.size() > HISTORY_SIZE) {
|
||||
history.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the history
|
||||
*/
|
||||
public LinkedList<Message> getHistory()
|
||||
{
|
||||
return history;
|
||||
}
|
||||
/**
|
||||
* Get the history
|
||||
*/
|
||||
public LinkedList<Message> getHistory()
|
||||
{
|
||||
return history;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message of the history at the given position
|
||||
*
|
||||
* @param position
|
||||
* @return The message at the given position
|
||||
*/
|
||||
public Message getHistoryMessage(int position)
|
||||
{
|
||||
return history.get(position);
|
||||
}
|
||||
/**
|
||||
* Get message of the history at the given position
|
||||
*
|
||||
* @param position
|
||||
* @return The message at the given position
|
||||
*/
|
||||
public Message getHistoryMessage(int position)
|
||||
{
|
||||
return history.get(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last buffered message
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Message pollBufferedMessage()
|
||||
{
|
||||
Message message = buffer.get(buffer.size() - 1);
|
||||
buffer.remove(buffer.size() - 1);
|
||||
return message;
|
||||
}
|
||||
/**
|
||||
* Get last buffered message
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Message pollBufferedMessage()
|
||||
{
|
||||
Message message = buffer.get(buffer.size() - 1);
|
||||
buffer.remove(buffer.size() - 1);
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the buffer
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LinkedList<Message> getBuffer()
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
/**
|
||||
* Get the buffer
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LinkedList<Message> getBuffer()
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the channel have buffered messages?
|
||||
*/
|
||||
public boolean hasBufferedMessages()
|
||||
{
|
||||
return buffer.size() > 0;
|
||||
}
|
||||
/**
|
||||
* Does the channel have buffered messages?
|
||||
*/
|
||||
public boolean hasBufferedMessages()
|
||||
{
|
||||
return buffer.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the message buffer
|
||||
*/
|
||||
public void clearBuffer()
|
||||
{
|
||||
buffer.clear();
|
||||
}
|
||||
/**
|
||||
* Clear the message buffer
|
||||
*/
|
||||
public void clearBuffer()
|
||||
{
|
||||
buffer.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the adapter of this conversation
|
||||
*/
|
||||
public void setMessageListAdapter(MessageListAdapter adapter)
|
||||
{
|
||||
this.adapter = adapter;
|
||||
}
|
||||
/**
|
||||
* Store the adapter of this conversation
|
||||
*/
|
||||
public void setMessageListAdapter(MessageListAdapter adapter)
|
||||
{
|
||||
this.adapter = adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MessageList Adapter of this conversation if known
|
||||
*/
|
||||
public MessageListAdapter getMessageListAdapter()
|
||||
{
|
||||
return adapter;
|
||||
}
|
||||
/**
|
||||
* Get the MessageList Adapter of this conversation if known
|
||||
*/
|
||||
public MessageListAdapter getMessageListAdapter()
|
||||
{
|
||||
return adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set status of conversation
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(int status)
|
||||
{
|
||||
// Selected status can only be changed by deselecting
|
||||
if (this.status == STATUS_SELECTED && status != STATUS_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Set status of conversation
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(int status)
|
||||
{
|
||||
// Selected status can only be changed by deselecting
|
||||
if (this.status == STATUS_SELECTED && status != STATUS_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Highlight status can only be changed by selecting
|
||||
if (this.status == STATUS_HIGHLIGHT && status != STATUS_SELECTED) {
|
||||
return;
|
||||
}
|
||||
// Highlight status can only be changed by selecting
|
||||
if (this.status == STATUS_HIGHLIGHT && status != STATUS_SELECTED) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.status = status;
|
||||
}
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status of conversation
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* Get status of conversation
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
@ -27,14 +27,14 @@ package org.yaaic.model;
|
||||
*/
|
||||
public class Extra
|
||||
{
|
||||
public static final String SERVER = "server";
|
||||
public static final String CONVERSATION = "conversation";
|
||||
public static final String USERS = "users";
|
||||
public static final String SERVER = "server";
|
||||
public static final String CONVERSATION = "conversation";
|
||||
public static final String USERS = "users";
|
||||
|
||||
public static final String ALIASES = "aliases";
|
||||
public static final String CHANNELS = "channels";
|
||||
public static final String COMMANDS = "commands";
|
||||
public static final String MESSAGE = "message";
|
||||
public static final String USER = "user";
|
||||
public static final String ACTION = "action";
|
||||
public static final String ALIASES = "aliases";
|
||||
public static final String CHANNELS = "channels";
|
||||
public static final String COMMANDS = "commands";
|
||||
public static final String MESSAGE = "message";
|
||||
public static final String USER = "user";
|
||||
public static final String ACTION = "action";
|
||||
}
|
||||
|
@ -32,77 +32,77 @@ import java.util.List;
|
||||
*/
|
||||
public class Identity
|
||||
{
|
||||
private String nickname;
|
||||
private List<String> aliases = new ArrayList<String>();
|
||||
private String ident;
|
||||
private String realname;
|
||||
private String nickname;
|
||||
private List<String> aliases = new ArrayList<String>();
|
||||
private String ident;
|
||||
private String realname;
|
||||
|
||||
/**
|
||||
* Set the nickname of this identity
|
||||
*
|
||||
* @param nickname The nickname to be set
|
||||
*/
|
||||
public void setNickname(String nickname)
|
||||
{
|
||||
this.nickname = nickname;
|
||||
}
|
||||
/**
|
||||
* Set the nickname of this identity
|
||||
*
|
||||
* @param nickname The nickname to be set
|
||||
*/
|
||||
public void setNickname(String nickname)
|
||||
{
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nickname of this identity
|
||||
*
|
||||
* @return The nickname
|
||||
*/
|
||||
public String getNickname()
|
||||
{
|
||||
return nickname;
|
||||
}
|
||||
/**
|
||||
* Get the nickname of this identity
|
||||
*
|
||||
* @return The nickname
|
||||
*/
|
||||
public String getNickname()
|
||||
{
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setAliases(Collection<String> aliases) {
|
||||
this.aliases.clear();
|
||||
this.aliases.addAll(aliases);
|
||||
}
|
||||
public void setAliases(Collection<String> aliases) {
|
||||
this.aliases.clear();
|
||||
this.aliases.addAll(aliases);
|
||||
}
|
||||
|
||||
public List<String> getAliases() {
|
||||
return Collections.unmodifiableList(aliases);
|
||||
}
|
||||
public List<String> getAliases() {
|
||||
return Collections.unmodifiableList(aliases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ident of this identity
|
||||
*
|
||||
* @param ident The ident to be set
|
||||
*/
|
||||
public void setIdent(String ident)
|
||||
{
|
||||
this.ident = ident;
|
||||
}
|
||||
/**
|
||||
* Set the ident of this identity
|
||||
*
|
||||
* @param ident The ident to be set
|
||||
*/
|
||||
public void setIdent(String ident)
|
||||
{
|
||||
this.ident = ident;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ident of this identity
|
||||
*
|
||||
* @return The identity
|
||||
*/
|
||||
public String getIdent()
|
||||
{
|
||||
return ident;
|
||||
}
|
||||
/**
|
||||
* Get the ident of this identity
|
||||
*
|
||||
* @return The identity
|
||||
*/
|
||||
public String getIdent()
|
||||
{
|
||||
return ident;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the real name of this identity
|
||||
*
|
||||
* @param realname The real name to be set
|
||||
*/
|
||||
public void setRealName(String realname)
|
||||
{
|
||||
this.realname = realname;
|
||||
}
|
||||
/**
|
||||
* Set the real name of this identity
|
||||
*
|
||||
* @param realname The real name to be set
|
||||
*/
|
||||
public void setRealName(String realname)
|
||||
{
|
||||
this.realname = realname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the real name of this identity
|
||||
*
|
||||
* @return The realname
|
||||
*/
|
||||
public String getRealName()
|
||||
{
|
||||
return realname;
|
||||
}
|
||||
/**
|
||||
* Get the real name of this identity
|
||||
*
|
||||
* @return The realname
|
||||
*/
|
||||
public String getRealName()
|
||||
{
|
||||
return realname;
|
||||
}
|
||||
}
|
||||
|
@ -37,191 +37,191 @@ import android.widget.TextView;
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class Message {
|
||||
public static final int COLOR_GREEN = 0xFF458509;
|
||||
public static final int COLOR_RED = 0xFFcc0000;
|
||||
public static final int COLOR_BLUE = 0xFF729fcf;
|
||||
public static final int COLOR_YELLOW = 0xFFbe9b01;
|
||||
public static final int COLOR_GREY = 0xFFaaaaaa;
|
||||
public static final int COLOR_DEFAULT = 0xFFeeeeee;
|
||||
public static final int COLOR_GREEN = 0xFF458509;
|
||||
public static final int COLOR_RED = 0xFFcc0000;
|
||||
public static final int COLOR_BLUE = 0xFF729fcf;
|
||||
public static final int COLOR_YELLOW = 0xFFbe9b01;
|
||||
public static final int COLOR_GREY = 0xFFaaaaaa;
|
||||
public static final int COLOR_DEFAULT = 0xFFeeeeee;
|
||||
|
||||
public static final int[] colors = {
|
||||
0xFFffffff, //White
|
||||
0xFFffff00, //Yellow
|
||||
0xFFff00ff, //Fuchsia
|
||||
0xFFff0000, //Red
|
||||
0xFFc0c0c0, //Silver
|
||||
0xFF808080, //Gray
|
||||
0xFF808000, //Olive
|
||||
0xFF800080, //Purple
|
||||
0xFF800000, //Maroon
|
||||
0xFF00ffff, //Agua
|
||||
0xFF00ff00, //Lime
|
||||
0xFF008080, //Teal
|
||||
0xFF008000, //Green
|
||||
0xFF0000FF, //Blue
|
||||
0xFF000080, //Navy
|
||||
0xFF000000, //Black
|
||||
};
|
||||
public static final int[] colors = {
|
||||
0xFFffffff, //White
|
||||
0xFFffff00, //Yellow
|
||||
0xFFff00ff, //Fuchsia
|
||||
0xFFff0000, //Red
|
||||
0xFFc0c0c0, //Silver
|
||||
0xFF808080, //Gray
|
||||
0xFF808000, //Olive
|
||||
0xFF800080, //Purple
|
||||
0xFF800000, //Maroon
|
||||
0xFF00ffff, //Agua
|
||||
0xFF00ff00, //Lime
|
||||
0xFF008080, //Teal
|
||||
0xFF008000, //Green
|
||||
0xFF0000FF, //Blue
|
||||
0xFF000080, //Navy
|
||||
0xFF000000, //Black
|
||||
};
|
||||
|
||||
private int icon = -1;
|
||||
private String text;
|
||||
private String sender;
|
||||
private SpannableString canvas;
|
||||
private int color = -1;
|
||||
private long timestamp;
|
||||
private int icon = -1;
|
||||
private String text;
|
||||
private String sender;
|
||||
private SpannableString canvas;
|
||||
private int color = -1;
|
||||
private long timestamp;
|
||||
|
||||
/**
|
||||
* Create a new message without an icon
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
public Message(String text)
|
||||
{
|
||||
this(text, null);
|
||||
}
|
||||
/**
|
||||
* Create a new message sent by a user without an icon
|
||||
*
|
||||
* @param text
|
||||
* @param sender
|
||||
*/
|
||||
public Message(String text, String sender)
|
||||
{
|
||||
this.text = text;
|
||||
this.sender = sender;
|
||||
this.timestamp = new Date().getTime();
|
||||
}
|
||||
/**
|
||||
* Create a new message without an icon
|
||||
*
|
||||
* @param text
|
||||
*/
|
||||
public Message(String text)
|
||||
{
|
||||
this(text, null);
|
||||
}
|
||||
/**
|
||||
* Create a new message sent by a user without an icon
|
||||
*
|
||||
* @param text
|
||||
* @param sender
|
||||
*/
|
||||
public Message(String text, String sender)
|
||||
{
|
||||
this.text = text;
|
||||
this.sender = sender;
|
||||
this.timestamp = new Date().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message's icon
|
||||
*/
|
||||
public void setIcon(int icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
/**
|
||||
* Set the message's icon
|
||||
*/
|
||||
public void setIcon(int icon)
|
||||
{
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message's icon
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
/**
|
||||
* Get the message's icon
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text of this message
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getText()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
/**
|
||||
* Get the text of this message
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getText()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the color of this message
|
||||
*/
|
||||
public void setColor(int color)
|
||||
{
|
||||
this.color = color;
|
||||
}
|
||||
/**
|
||||
* Associate a color with a sender name
|
||||
*
|
||||
* @return a color hexa
|
||||
*/
|
||||
private int getSenderColor()
|
||||
{
|
||||
/* It might be worth to use some hash table here */
|
||||
if (sender == null) return COLOR_DEFAULT;
|
||||
int color = 0;
|
||||
for(int i = 0; i < sender.length(); i++){
|
||||
color += sender.charAt(i);
|
||||
}
|
||||
/* we dont want color[colors.length-1] which is black */
|
||||
color = color % (colors.length - 1);
|
||||
return colors[color];
|
||||
}
|
||||
/**
|
||||
* Render message as spannable string
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SpannableString render(Context context)
|
||||
{
|
||||
Settings settings = new Settings(context);
|
||||
/**
|
||||
* Set the color of this message
|
||||
*/
|
||||
public void setColor(int color)
|
||||
{
|
||||
this.color = color;
|
||||
}
|
||||
/**
|
||||
* Associate a color with a sender name
|
||||
*
|
||||
* @return a color hexa
|
||||
*/
|
||||
private int getSenderColor()
|
||||
{
|
||||
/* It might be worth to use some hash table here */
|
||||
if (sender == null) return COLOR_DEFAULT;
|
||||
int color = 0;
|
||||
for(int i = 0; i < sender.length(); i++){
|
||||
color += sender.charAt(i);
|
||||
}
|
||||
/* we dont want color[colors.length-1] which is black */
|
||||
color = color % (colors.length - 1);
|
||||
return colors[color];
|
||||
}
|
||||
/**
|
||||
* Render message as spannable string
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SpannableString render(Context context)
|
||||
{
|
||||
Settings settings = new Settings(context);
|
||||
|
||||
if (canvas == null) {
|
||||
String prefix = icon != -1 && settings.showIcons() ? " " : "";
|
||||
String nick = sender != null ? "<" + sender + "> " : "";
|
||||
String timestamp = settings.showTimestamp() ? Message.generateTimestamp(this.timestamp, settings.use24hFormat()) : "";
|
||||
if (canvas == null) {
|
||||
String prefix = icon != -1 && settings.showIcons() ? " " : "";
|
||||
String nick = sender != null ? "<" + sender + "> " : "";
|
||||
String timestamp = settings.showTimestamp() ? Message.generateTimestamp(this.timestamp, settings.use24hFormat()) : "";
|
||||
|
||||
canvas = new SpannableString(prefix + timestamp + nick + text);
|
||||
canvas = new SpannableString(prefix + timestamp + nick + text);
|
||||
|
||||
if (sender != null) {
|
||||
int start = (prefix + timestamp).length() + 1;
|
||||
int end = start + sender.length();
|
||||
if (settings.showColorsNick()) {
|
||||
canvas.setSpan(new ForegroundColorSpan(getSenderColor()), start, end , Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
if (sender != null) {
|
||||
int start = (prefix + timestamp).length() + 1;
|
||||
int end = start + sender.length();
|
||||
if (settings.showColorsNick()) {
|
||||
canvas.setSpan(new ForegroundColorSpan(getSenderColor()), start, end , Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
if (icon != -1 && settings.showIcons()) {
|
||||
Drawable drawable = context.getResources().getDrawable(icon);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
canvas.setSpan(new ImageSpan(drawable, ImageSpan.ALIGN_BOTTOM), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
if (color != -1 && settings.showColors()) {
|
||||
canvas.setSpan(new ForegroundColorSpan(color), 0, canvas.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
if (icon != -1 && settings.showIcons()) {
|
||||
Drawable drawable = context.getResources().getDrawable(icon);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
canvas.setSpan(new ImageSpan(drawable, ImageSpan.ALIGN_BOTTOM), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
if (color != -1 && settings.showColors()) {
|
||||
canvas.setSpan(new ForegroundColorSpan(color), 0, canvas.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
return canvas;
|
||||
}
|
||||
return canvas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render message as text view
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public TextView renderTextView(Context context)
|
||||
{
|
||||
// XXX: We should not read settings here ALWAYS for EVERY textview
|
||||
Settings settings = new Settings(context);
|
||||
/**
|
||||
* Render message as text view
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public TextView renderTextView(Context context)
|
||||
{
|
||||
// XXX: We should not read settings here ALWAYS for EVERY textview
|
||||
Settings settings = new Settings(context);
|
||||
|
||||
TextView canvas = new TextView(context);
|
||||
TextView canvas = new TextView(context);
|
||||
|
||||
canvas.setText(this.render(context));
|
||||
canvas.setTextSize(settings.getFontSize());
|
||||
canvas.setTypeface(Typeface.MONOSPACE);
|
||||
canvas.setTextColor(COLOR_DEFAULT);
|
||||
canvas.setText(this.render(context));
|
||||
canvas.setTextSize(settings.getFontSize());
|
||||
canvas.setTypeface(Typeface.MONOSPACE);
|
||||
canvas.setTextColor(COLOR_DEFAULT);
|
||||
|
||||
return canvas;
|
||||
}
|
||||
return canvas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a timestamp
|
||||
*
|
||||
* @param use24hFormat
|
||||
* @return
|
||||
*/
|
||||
public static String generateTimestamp(long timestamp, boolean use24hFormat)
|
||||
{
|
||||
Date date = new Date(timestamp);
|
||||
/**
|
||||
* Generate a timestamp
|
||||
*
|
||||
* @param use24hFormat
|
||||
* @return
|
||||
*/
|
||||
public static String generateTimestamp(long timestamp, boolean use24hFormat)
|
||||
{
|
||||
Date date = new Date(timestamp);
|
||||
|
||||
int hours = date.getHours();
|
||||
int minutes = date.getMinutes();
|
||||
int hours = date.getHours();
|
||||
int minutes = date.getMinutes();
|
||||
|
||||
if (!use24hFormat) {
|
||||
hours = Math.abs(12 - hours);
|
||||
if (hours == 12) {
|
||||
hours = 0;
|
||||
}
|
||||
}
|
||||
if (!use24hFormat) {
|
||||
hours = Math.abs(12 - hours);
|
||||
if (hours == 12) {
|
||||
hours = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return "[" + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + "] ";
|
||||
}
|
||||
return "[" + (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + "] ";
|
||||
}
|
||||
}
|
||||
|
@ -27,21 +27,21 @@ package org.yaaic.model;
|
||||
*/
|
||||
public class Query extends Conversation
|
||||
{
|
||||
/**
|
||||
* Create a new query
|
||||
*
|
||||
* @param name The user's nickname
|
||||
*/
|
||||
public Query(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
/**
|
||||
* Create a new query
|
||||
*
|
||||
* @param name The user's nickname
|
||||
*/
|
||||
public Query(String name)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of this conversation
|
||||
*/
|
||||
public int getType()
|
||||
{
|
||||
return Conversation.TYPE_QUERY;
|
||||
}
|
||||
/**
|
||||
* Get the type of this conversation
|
||||
*/
|
||||
public int getType()
|
||||
{
|
||||
return Conversation.TYPE_QUERY;
|
||||
}
|
||||
}
|
||||
|
@ -29,68 +29,68 @@ import java.util.LinkedList;
|
||||
*/
|
||||
public class Scrollback
|
||||
{
|
||||
public static final int MAX_HISTORY = 10;
|
||||
public static final int MAX_HISTORY = 10;
|
||||
|
||||
private LinkedList<String> messages;
|
||||
private int pointer;
|
||||
private LinkedList<String> messages;
|
||||
private int pointer;
|
||||
|
||||
/**
|
||||
* Create a new scrollback object
|
||||
*/
|
||||
public Scrollback()
|
||||
{
|
||||
messages = new LinkedList<String>();
|
||||
}
|
||||
/**
|
||||
* Create a new scrollback object
|
||||
*/
|
||||
public Scrollback()
|
||||
{
|
||||
messages = new LinkedList<String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message to the history
|
||||
*/
|
||||
public void addMessage(String message)
|
||||
{
|
||||
messages.addLast(message);
|
||||
/**
|
||||
* Add a message to the history
|
||||
*/
|
||||
public void addMessage(String message)
|
||||
{
|
||||
messages.addLast(message);
|
||||
|
||||
if (messages.size() > MAX_HISTORY) {
|
||||
messages.removeFirst();
|
||||
}
|
||||
if (messages.size() > MAX_HISTORY) {
|
||||
messages.removeFirst();
|
||||
}
|
||||
|
||||
pointer = messages.size();
|
||||
}
|
||||
pointer = messages.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Go back in history
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String goBack()
|
||||
{
|
||||
if (pointer > 0) {
|
||||
pointer--;
|
||||
}
|
||||
/**
|
||||
* Go back in history
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String goBack()
|
||||
{
|
||||
if (pointer > 0) {
|
||||
pointer--;
|
||||
}
|
||||
|
||||
if (messages.size() > 0) {
|
||||
return messages.get(pointer);
|
||||
}
|
||||
if (messages.size() > 0) {
|
||||
return messages.get(pointer);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Go forward in history
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String goForward()
|
||||
{
|
||||
if (pointer < messages.size() - 1) {
|
||||
pointer++;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* Go forward in history
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String goForward()
|
||||
{
|
||||
if (pointer < messages.size() - 1) {
|
||||
pointer++;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (messages.size() > 0) {
|
||||
return messages.get(pointer);
|
||||
}
|
||||
if (messages.size() > 0) {
|
||||
return messages.get(pointer);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -33,375 +33,375 @@ import org.yaaic.R;
|
||||
*/
|
||||
public class Server
|
||||
{
|
||||
private int id;
|
||||
private String title;
|
||||
private String host;
|
||||
private int port;
|
||||
private String password;
|
||||
private String charset;
|
||||
private boolean useSSL = false;
|
||||
private Identity identity;
|
||||
private int id;
|
||||
private String title;
|
||||
private String host;
|
||||
private int port;
|
||||
private String password;
|
||||
private String charset;
|
||||
private boolean useSSL = false;
|
||||
private Identity identity;
|
||||
|
||||
private LinkedHashMap<String, Conversation> conversations = new LinkedHashMap<String, Conversation>();
|
||||
private ArrayList<String> autoJoinChannels;
|
||||
private ArrayList<String> connectCommands;
|
||||
private LinkedHashMap<String, Conversation> conversations = new LinkedHashMap<String, Conversation>();
|
||||
private ArrayList<String> autoJoinChannels;
|
||||
private ArrayList<String> connectCommands;
|
||||
|
||||
private int status = Status.DISCONNECTED;
|
||||
private String selected = "";
|
||||
private int status = Status.DISCONNECTED;
|
||||
private String selected = "";
|
||||
|
||||
/**
|
||||
* Create a new server object
|
||||
*/
|
||||
public Server()
|
||||
{
|
||||
conversations.put(ServerInfo.DEFAULT_NAME, new ServerInfo());
|
||||
this.selected = ServerInfo.DEFAULT_NAME;
|
||||
}
|
||||
/**
|
||||
* Create a new server object
|
||||
*/
|
||||
public Server()
|
||||
{
|
||||
conversations.put(ServerInfo.DEFAULT_NAME, new ServerInfo());
|
||||
this.selected = ServerInfo.DEFAULT_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the identity for this server
|
||||
*
|
||||
* @param identity The identity for this server
|
||||
*/
|
||||
public void setIdentity(Identity identity)
|
||||
{
|
||||
this.identity = identity;
|
||||
}
|
||||
/**
|
||||
* Set the identity for this server
|
||||
*
|
||||
* @param identity The identity for this server
|
||||
*/
|
||||
public void setIdentity(Identity identity)
|
||||
{
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the identity for this server
|
||||
*
|
||||
* @return identity
|
||||
*/
|
||||
public Identity getIdentity()
|
||||
{
|
||||
return identity;
|
||||
}
|
||||
/**
|
||||
* Get the identity for this server
|
||||
*
|
||||
* @return identity
|
||||
*/
|
||||
public Identity getIdentity()
|
||||
{
|
||||
return identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unique id of server
|
||||
*
|
||||
* @return id
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* Get unique id of server
|
||||
*
|
||||
* @return id
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unique id of server
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* Set unique id of server
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set password of the server
|
||||
*
|
||||
* @param password The password of the server
|
||||
*/
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
/**
|
||||
* Set password of the server
|
||||
*
|
||||
* @param password The password of the server
|
||||
*/
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password of the server
|
||||
*
|
||||
* @return The password of the server
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
/**
|
||||
* Get the password of the server
|
||||
*
|
||||
* @return The password of the server
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title of server
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
/**
|
||||
* Get title of server
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title of server
|
||||
*
|
||||
* @param title
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
/**
|
||||
* Set title of server
|
||||
*
|
||||
* @param title
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hostname of server
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getHost()
|
||||
{
|
||||
return host;
|
||||
}
|
||||
/**
|
||||
* Get hostname of server
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getHost()
|
||||
{
|
||||
return host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set hostname of server
|
||||
*
|
||||
* @param host
|
||||
*/
|
||||
public void setHost(String host)
|
||||
{
|
||||
this.host = host;
|
||||
}
|
||||
/**
|
||||
* Set hostname of server
|
||||
*
|
||||
* @param host
|
||||
*/
|
||||
public void setHost(String host)
|
||||
{
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get port of server
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getPort()
|
||||
{
|
||||
return port;
|
||||
}
|
||||
/**
|
||||
* Get port of server
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getPort()
|
||||
{
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set port of server
|
||||
*
|
||||
* @param port
|
||||
*/
|
||||
public void setPort(int port)
|
||||
{
|
||||
this.port = port;
|
||||
}
|
||||
/**
|
||||
* Set port of server
|
||||
*
|
||||
* @param port
|
||||
*/
|
||||
public void setPort(int port)
|
||||
{
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charset to be used for all messages sent to the server
|
||||
*
|
||||
* @param charset The name of the charset
|
||||
*/
|
||||
public void setCharset(String charset)
|
||||
{
|
||||
this.charset = charset;
|
||||
}
|
||||
/**
|
||||
* Set the charset to be used for all messages sent to the server
|
||||
*
|
||||
* @param charset The name of the charset
|
||||
*/
|
||||
public void setCharset(String charset)
|
||||
{
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the charset to be used with this server
|
||||
*
|
||||
* @return String charset The name of the charset
|
||||
*/
|
||||
public String getCharset()
|
||||
{
|
||||
return charset;
|
||||
}
|
||||
/**
|
||||
* Get the charset to be used with this server
|
||||
*
|
||||
* @return String charset The name of the charset
|
||||
*/
|
||||
public String getCharset()
|
||||
{
|
||||
return charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if this connections needs to use ssl
|
||||
*/
|
||||
public void setUseSSL(boolean useSSL)
|
||||
{
|
||||
this.useSSL = useSSL;
|
||||
}
|
||||
/**
|
||||
* Set if this connections needs to use ssl
|
||||
*/
|
||||
public void setUseSSL(boolean useSSL)
|
||||
{
|
||||
this.useSSL = useSSL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this connection use SSL?
|
||||
*
|
||||
* @return true if SSL should be used, false otherwise
|
||||
*/
|
||||
public boolean useSSL()
|
||||
{
|
||||
return useSSL;
|
||||
}
|
||||
/**
|
||||
* Does this connection use SSL?
|
||||
*
|
||||
* @return true if SSL should be used, false otherwise
|
||||
*/
|
||||
public boolean useSSL()
|
||||
{
|
||||
return useSSL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set connection status of server
|
||||
*
|
||||
* @status See constants Status.*
|
||||
*/
|
||||
public void setStatus(int status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
/**
|
||||
* Set connection status of server
|
||||
*
|
||||
* @status See constants Status.*
|
||||
*/
|
||||
public void setStatus(int status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get connection status of server
|
||||
*
|
||||
* @return See constants Status.*
|
||||
*/
|
||||
public int getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* Get connection status of server
|
||||
*
|
||||
* @return See constants Status.*
|
||||
*/
|
||||
public int getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set list of channels to auto join after connect
|
||||
*
|
||||
* @param channels List of channel names
|
||||
*/
|
||||
public void setAutoJoinChannels(ArrayList<String> autoJoinChannels)
|
||||
{
|
||||
this.autoJoinChannels = autoJoinChannels;
|
||||
}
|
||||
/**
|
||||
* Set list of channels to auto join after connect
|
||||
*
|
||||
* @param channels List of channel names
|
||||
*/
|
||||
public void setAutoJoinChannels(ArrayList<String> autoJoinChannels)
|
||||
{
|
||||
this.autoJoinChannels = autoJoinChannels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of channels to auto join after connect
|
||||
*
|
||||
* @return List of channel names
|
||||
*/
|
||||
public ArrayList<String> getAutoJoinChannels()
|
||||
{
|
||||
return autoJoinChannels;
|
||||
}
|
||||
/**
|
||||
* Get list of channels to auto join after connect
|
||||
*
|
||||
* @return List of channel names
|
||||
*/
|
||||
public ArrayList<String> getAutoJoinChannels()
|
||||
{
|
||||
return autoJoinChannels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set commands to execute after connect
|
||||
*
|
||||
* @param commands List of commands
|
||||
*/
|
||||
public void setConnectCommands(ArrayList<String> connectCommands)
|
||||
{
|
||||
this.connectCommands = connectCommands;
|
||||
}
|
||||
/**
|
||||
* Set commands to execute after connect
|
||||
*
|
||||
* @param commands List of commands
|
||||
*/
|
||||
public void setConnectCommands(ArrayList<String> connectCommands)
|
||||
{
|
||||
this.connectCommands = connectCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get commands to execute after connect
|
||||
*
|
||||
* @return List of commands
|
||||
*/
|
||||
public ArrayList<String> getConnectCommands()
|
||||
{
|
||||
return connectCommands;
|
||||
}
|
||||
/**
|
||||
* Get commands to execute after connect
|
||||
*
|
||||
* @return List of commands
|
||||
*/
|
||||
public ArrayList<String> getConnectCommands()
|
||||
{
|
||||
return connectCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is disconnected?
|
||||
*
|
||||
* @return true if the user is disconnected, false if the user is connected or currently connecting
|
||||
*/
|
||||
public boolean isDisconnected()
|
||||
{
|
||||
return status == Status.DISCONNECTED;
|
||||
}
|
||||
/**
|
||||
* Is disconnected?
|
||||
*
|
||||
* @return true if the user is disconnected, false if the user is connected or currently connecting
|
||||
*/
|
||||
public boolean isDisconnected()
|
||||
{
|
||||
return status == Status.DISCONNECTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is connected?
|
||||
*
|
||||
* @return true if the user is (successfully) connected to this server, false otherwise
|
||||
*/
|
||||
public boolean isConnected()
|
||||
{
|
||||
return status == Status.CONNECTED;
|
||||
}
|
||||
/**
|
||||
* Is connected?
|
||||
*
|
||||
* @return true if the user is (successfully) connected to this server, false otherwise
|
||||
*/
|
||||
public boolean isConnected()
|
||||
{
|
||||
return status == Status.CONNECTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all conversations
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Collection<Conversation> getConversations()
|
||||
{
|
||||
return conversations.values();
|
||||
}
|
||||
/**
|
||||
* Get all conversations
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Collection<Conversation> getConversations()
|
||||
{
|
||||
return conversations.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get conversation by name
|
||||
*/
|
||||
public Conversation getConversation(String name)
|
||||
{
|
||||
return conversations.get(name.toLowerCase());
|
||||
}
|
||||
/**
|
||||
* Get conversation by name
|
||||
*/
|
||||
public Conversation getConversation(String name)
|
||||
{
|
||||
return conversations.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new conversation
|
||||
*
|
||||
* @param conversation The conversation to add
|
||||
*/
|
||||
public void addConversationl(Conversation conversation)
|
||||
{
|
||||
conversations.put(conversation.getName().toLowerCase(), conversation);
|
||||
}
|
||||
/**
|
||||
* Add a new conversation
|
||||
*
|
||||
* @param conversation The conversation to add
|
||||
*/
|
||||
public void addConversationl(Conversation conversation)
|
||||
{
|
||||
conversations.put(conversation.getName().toLowerCase(), conversation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a conversation by name
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void removeConversation(String name)
|
||||
{
|
||||
conversations.remove(name.toLowerCase());
|
||||
}
|
||||
/**
|
||||
* Removes a conversation by name
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void removeConversation(String name)
|
||||
{
|
||||
conversations.remove(name.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all conversations
|
||||
*/
|
||||
public void clearConversations()
|
||||
{
|
||||
conversations.clear();
|
||||
/**
|
||||
* Remove all conversations
|
||||
*/
|
||||
public void clearConversations()
|
||||
{
|
||||
conversations.clear();
|
||||
|
||||
// reset defaults
|
||||
conversations.put(ServerInfo.DEFAULT_NAME, new ServerInfo());
|
||||
this.selected = ServerInfo.DEFAULT_NAME;
|
||||
}
|
||||
// reset defaults
|
||||
conversations.put(ServerInfo.DEFAULT_NAME, new ServerInfo());
|
||||
this.selected = ServerInfo.DEFAULT_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name of currently selected conversation
|
||||
*
|
||||
* @param selected The name of the selected conversation
|
||||
*/
|
||||
public void setSelectedConversation(String selected)
|
||||
{
|
||||
this.selected = selected;
|
||||
}
|
||||
/**
|
||||
* Set name of currently selected conversation
|
||||
*
|
||||
* @param selected The name of the selected conversation
|
||||
*/
|
||||
public void setSelectedConversation(String selected)
|
||||
{
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name of currently selected conversation
|
||||
*
|
||||
* @return The name of the selected conversation
|
||||
*/
|
||||
public String getSelectedConversation()
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
/**
|
||||
* Get name of currently selected conversation
|
||||
*
|
||||
* @return The name of the selected conversation
|
||||
*/
|
||||
public String getSelectedConversation()
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get names of the currently joined channels
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<String> getCurrentChannelNames()
|
||||
{
|
||||
ArrayList<String> channels = new ArrayList<String>();
|
||||
Collection<Conversation> mConversations = conversations.values();
|
||||
/**
|
||||
* Get names of the currently joined channels
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<String> getCurrentChannelNames()
|
||||
{
|
||||
ArrayList<String> channels = new ArrayList<String>();
|
||||
Collection<Conversation> mConversations = conversations.values();
|
||||
|
||||
for (Conversation conversation : mConversations) {
|
||||
if (conversation.getType() == Conversation.TYPE_CHANNEL) {
|
||||
channels.add(conversation.getName());
|
||||
}
|
||||
}
|
||||
for (Conversation conversation : mConversations) {
|
||||
if (conversation.getType() == Conversation.TYPE_CHANNEL) {
|
||||
channels.add(conversation.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return channels;
|
||||
}
|
||||
return channels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon for current server status
|
||||
*
|
||||
* @return int Status icon ressource
|
||||
*/
|
||||
public int getStatusIcon()
|
||||
{
|
||||
switch (status) {
|
||||
case Status.CONNECTED:
|
||||
return R.drawable.connected;
|
||||
case Status.DISCONNECTED:
|
||||
return R.drawable.disconnected;
|
||||
case Status.PRE_CONNECTING:
|
||||
case Status.CONNECTING:
|
||||
return R.drawable.connecting;
|
||||
}
|
||||
/**
|
||||
* Get icon for current server status
|
||||
*
|
||||
* @return int Status icon ressource
|
||||
*/
|
||||
public int getStatusIcon()
|
||||
{
|
||||
switch (status) {
|
||||
case Status.CONNECTED:
|
||||
return R.drawable.connected;
|
||||
case Status.DISCONNECTED:
|
||||
return R.drawable.disconnected;
|
||||
case Status.PRE_CONNECTING:
|
||||
case Status.CONNECTING:
|
||||
return R.drawable.connecting;
|
||||
}
|
||||
|
||||
return R.drawable.connecting;
|
||||
}
|
||||
return R.drawable.connecting;
|
||||
}
|
||||
}
|
||||
|
@ -27,24 +27,24 @@ package org.yaaic.model;
|
||||
*/
|
||||
public class ServerInfo extends Conversation
|
||||
{
|
||||
public static final String DEFAULT_NAME = "";
|
||||
public static final String DEFAULT_NAME = "";
|
||||
|
||||
/**
|
||||
* Create a new ServerInfo object
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public ServerInfo()
|
||||
{
|
||||
super(DEFAULT_NAME);
|
||||
}
|
||||
/**
|
||||
* Create a new ServerInfo object
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public ServerInfo()
|
||||
{
|
||||
super(DEFAULT_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of this conversation
|
||||
*/
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return Conversation.TYPE_SERVER;
|
||||
}
|
||||
/**
|
||||
* Get the type of this conversation
|
||||
*/
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
return Conversation.TYPE_SERVER;
|
||||
}
|
||||
}
|
||||
|
@ -32,143 +32,143 @@ import android.preference.PreferenceManager;
|
||||
* small and simple methods.
|
||||
*
|
||||
* Note: As this class carries a Context instace as private member, instances of
|
||||
* this class should be thrown away not later than when the Context should
|
||||
* be gone. Otherwise this could leak memory.
|
||||
* this class should be thrown away not later than when the Context should
|
||||
* be gone. Otherwise this could leak memory.
|
||||
*
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class Settings
|
||||
{
|
||||
private SharedPreferences preferences;
|
||||
private Resources resources;
|
||||
private SharedPreferences preferences;
|
||||
private Resources resources;
|
||||
|
||||
/**
|
||||
* Create a new Settings instance
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public Settings(Context context)
|
||||
{
|
||||
this.preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.resources = context.getApplicationContext().getResources();
|
||||
}
|
||||
/**
|
||||
* Create a new Settings instance
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public Settings(Context context)
|
||||
{
|
||||
this.preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
this.resources = context.getApplicationContext().getResources();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefix all messages with a timestamp?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showTimestamp()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_timestamp),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_timestamp))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Prefix all messages with a timestamp?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showTimestamp()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_timestamp),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_timestamp))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show icons to highlight special events
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showIcons()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_icons),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_icons))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Show icons to highlight special events
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showIcons()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_icons),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_icons))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show colors to highlight special events?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showColors()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_colors),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_colors))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Show colors to highlight special events?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showColors()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_colors),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_colors))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show colors to highlight nicknames?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showColorsNick()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_colors_nick),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_colors_nick))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Show colors to highlight nicknames?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showColorsNick()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_show_colors_nick),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_show_colors_nick))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use 24 hour format for timestamps?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean use24hFormat()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_24h_format),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_24h_format))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Use 24 hour format for timestamps?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean use24hFormat()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_24h_format),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_24h_format))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is reconnect on disconnect enabled?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isReconnectEnabled()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_reconnect),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_reconnect))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Is reconnect on disconnect enabled?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isReconnectEnabled()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_reconnect),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_reconnect))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the quit message
|
||||
*
|
||||
* @return The message to display when the user disconnects
|
||||
*/
|
||||
public String getQuitMessage()
|
||||
{
|
||||
return preferences.getString(
|
||||
resources.getString(R.string.key_quitmessage),
|
||||
resources.getString(R.string.default_quitmessage)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Get the quit message
|
||||
*
|
||||
* @return The message to display when the user disconnects
|
||||
*/
|
||||
public String getQuitMessage()
|
||||
{
|
||||
return preferences.getString(
|
||||
resources.getString(R.string.key_quitmessage),
|
||||
resources.getString(R.string.default_quitmessage)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the font size
|
||||
*
|
||||
* @return The font size for conversation messages
|
||||
*/
|
||||
public int getFontSize()
|
||||
{
|
||||
return Integer.parseInt(preferences.getString(
|
||||
resources.getString(R.string.key_fontsize),
|
||||
resources.getString(R.string.default_fontsize)
|
||||
));
|
||||
}
|
||||
/**
|
||||
* Get the font size
|
||||
*
|
||||
* @return The font size for conversation messages
|
||||
*/
|
||||
public int getFontSize()
|
||||
{
|
||||
return Integer.parseInt(preferences.getString(
|
||||
resources.getString(R.string.key_fontsize),
|
||||
resources.getString(R.string.default_fontsize)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Is voice recognition enabled?
|
||||
*
|
||||
* @return True if voice recognition is enabled, false otherwise
|
||||
*/
|
||||
public boolean isVoiceRecognitionEnabled()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_voice_recognition),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_voice_recognition))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Is voice recognition enabled?
|
||||
*
|
||||
* @return True if voice recognition is enabled, false otherwise
|
||||
*/
|
||||
public boolean isVoiceRecognitionEnabled()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_voice_recognition),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_voice_recognition))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vibrate on highlight?
|
||||
|
@ -26,8 +26,8 @@ package org.yaaic.model;
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class Status {
|
||||
public static final int DISCONNECTED = 0;
|
||||
public static final int CONNECTING = 1;
|
||||
public static final int CONNECTED = 2;
|
||||
public static final int PRE_CONNECTING = 3;
|
||||
public static final int DISCONNECTED = 0;
|
||||
public static final int CONNECTING = 1;
|
||||
public static final int CONNECTED = 2;
|
||||
public static final int PRE_CONNECTING = 3;
|
||||
}
|
||||
|
@ -35,44 +35,44 @@ import org.yaaic.model.Extra;
|
||||
*/
|
||||
public class ConversationReceiver extends BroadcastReceiver
|
||||
{
|
||||
private ConversationListener listener;
|
||||
private int serverId;
|
||||
private ConversationListener listener;
|
||||
private int serverId;
|
||||
|
||||
/**
|
||||
* Create a new channel receiver
|
||||
*
|
||||
* @param serverId Only listen on channels of this server
|
||||
* @param listener
|
||||
*/
|
||||
public ConversationReceiver(int serverId, ConversationListener listener)
|
||||
{
|
||||
this.listener = listener;
|
||||
this.serverId = serverId;
|
||||
}
|
||||
/**
|
||||
* Create a new channel receiver
|
||||
*
|
||||
* @param serverId Only listen on channels of this server
|
||||
* @param listener
|
||||
*/
|
||||
public ConversationReceiver(int serverId, ConversationListener listener)
|
||||
{
|
||||
this.listener = listener;
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
/**
|
||||
* On receive broadcast
|
||||
*
|
||||
* @param context
|
||||
* @param intent
|
||||
*/
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
int serverId = intent.getExtras().getInt(Extra.SERVER);
|
||||
if (serverId != this.serverId) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* On receive broadcast
|
||||
*
|
||||
* @param context
|
||||
* @param intent
|
||||
*/
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
int serverId = intent.getExtras().getInt(Extra.SERVER);
|
||||
if (serverId != this.serverId) {
|
||||
return;
|
||||
}
|
||||
|
||||
String action = intent.getAction();
|
||||
String action = intent.getAction();
|
||||
|
||||
if (action.equals(Broadcast.CONVERSATION_MESSAGE)) {
|
||||
listener.onConversationMessage(intent.getExtras().getString(Extra.CONVERSATION));
|
||||
} else if (action.equals(Broadcast.CONVERSATION_NEW)) {
|
||||
listener.onNewConversation(intent.getExtras().getString(Extra.CONVERSATION));
|
||||
} else if (action.equals(Broadcast.CONVERSATION_REMOVE)) {
|
||||
listener.onRemoveConversation(intent.getExtras().getString(Extra.CONVERSATION));
|
||||
}
|
||||
if (action.equals(Broadcast.CONVERSATION_MESSAGE)) {
|
||||
listener.onConversationMessage(intent.getExtras().getString(Extra.CONVERSATION));
|
||||
} else if (action.equals(Broadcast.CONVERSATION_NEW)) {
|
||||
listener.onNewConversation(intent.getExtras().getString(Extra.CONVERSATION));
|
||||
} else if (action.equals(Broadcast.CONVERSATION_REMOVE)) {
|
||||
listener.onRemoveConversation(intent.getExtras().getString(Extra.CONVERSATION));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,24 +33,24 @@ import android.content.Intent;
|
||||
*/
|
||||
public class ServerReceiver extends BroadcastReceiver
|
||||
{
|
||||
private ServerListener listener;
|
||||
private ServerListener listener;
|
||||
|
||||
/**
|
||||
* Create a new server receiver
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public ServerReceiver(ServerListener listener)
|
||||
{
|
||||
this.listener = listener;
|
||||
}
|
||||
/**
|
||||
* Create a new server receiver
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public ServerReceiver(ServerListener listener)
|
||||
{
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* On receive broadcast
|
||||
*/
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
listener.onStatusUpdate();
|
||||
}
|
||||
/**
|
||||
* On receive broadcast
|
||||
*/
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
listener.onStatusUpdate();
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user