mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-22 17:02:21 -05:00
Code cleanup (Formatting)
This commit is contained in:
parent
4edaa4436d
commit
0fb2338f9c
@ -13,14 +13,14 @@ import android.os.Bundle;
|
|||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.Window;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
|
||||||
|
|
||||||
public class AddAliasActivity extends Activity implements OnClickListener, OnItemClickListener, TextWatcher
|
public class AddAliasActivity extends Activity implements OnClickListener, OnItemClickListener, TextWatcher
|
||||||
{
|
{
|
||||||
@ -65,6 +65,7 @@ public class AddAliasActivity extends Activity implements OnClickListener, OnIte
|
|||||||
/**
|
/**
|
||||||
* On Click
|
* On Click
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
@ -92,6 +93,7 @@ public class AddAliasActivity extends Activity implements OnClickListener, OnIte
|
|||||||
/**
|
/**
|
||||||
* On item clicked
|
* On item clicked
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||||
{
|
{
|
||||||
final String alias = adapter.getItem(position);
|
final String alias = adapter.getItem(position);
|
||||||
@ -101,6 +103,7 @@ public class AddAliasActivity extends Activity implements OnClickListener, OnIte
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(alias);
|
builder.setTitle(alias);
|
||||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int item) {
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case 0: // Remove
|
case 0: // Remove
|
||||||
@ -115,14 +118,17 @@ public class AddAliasActivity extends Activity implements OnClickListener, OnIte
|
|||||||
alert.show();
|
alert.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
addButton.setEnabled(aliasInput.getText().length() > 0);
|
addButton.setEnabled(aliasInput.getText().length() > 0);
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,14 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.Window;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adding auto join channels to a server
|
* Adding auto join channels to a server
|
||||||
@ -88,6 +88,7 @@ public class AddChannelActivity extends Activity implements OnClickListener, OnI
|
|||||||
/**
|
/**
|
||||||
* On Click
|
* On Click
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
@ -115,6 +116,7 @@ public class AddChannelActivity extends Activity implements OnClickListener, OnI
|
|||||||
/**
|
/**
|
||||||
* On item clicked
|
* On item clicked
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||||
{
|
{
|
||||||
final String channel = adapter.getItem(position);
|
final String channel = adapter.getItem(position);
|
||||||
@ -124,6 +126,7 @@ public class AddChannelActivity extends Activity implements OnClickListener, OnI
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(channel);
|
builder.setTitle(channel);
|
||||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int item) {
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case 0: // Remove
|
case 0: // Remove
|
||||||
|
@ -31,14 +31,14 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.Window;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adding commands (to execute after connect) to a server
|
* Adding commands (to execute after connect) to a server
|
||||||
@ -89,6 +89,7 @@ public class AddCommandsActivity extends Activity implements OnClickListener, On
|
|||||||
/**
|
/**
|
||||||
* On Click
|
* On Click
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
@ -121,6 +122,7 @@ public class AddCommandsActivity extends Activity implements OnClickListener, On
|
|||||||
/**
|
/**
|
||||||
* On item clicked
|
* On item clicked
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||||
{
|
{
|
||||||
final String command = adapter.getItem(position);
|
final String command = adapter.getItem(position);
|
||||||
@ -130,6 +132,7 @@ public class AddCommandsActivity extends Activity implements OnClickListener, On
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(command);
|
builder.setTitle(command);
|
||||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int item) {
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case 0: // Remove
|
case 0: // Remove
|
||||||
|
@ -54,6 +54,7 @@ public class JoinActivity extends Activity implements OnClickListener
|
|||||||
/**
|
/**
|
||||||
* On click
|
* On click
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
|
@ -22,6 +22,20 @@ package org.yaaic.activity;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.yaaic.R;
|
||||||
|
import org.yaaic.Yaaic;
|
||||||
|
import org.yaaic.adapter.ServerListAdapter;
|
||||||
|
import org.yaaic.db.Database;
|
||||||
|
import org.yaaic.irc.IRCBinder;
|
||||||
|
import org.yaaic.irc.IRCService;
|
||||||
|
import org.yaaic.layout.NonScalingBackgroundDrawable;
|
||||||
|
import org.yaaic.listener.ServerListener;
|
||||||
|
import org.yaaic.model.Broadcast;
|
||||||
|
import org.yaaic.model.Extra;
|
||||||
|
import org.yaaic.model.Server;
|
||||||
|
import org.yaaic.model.Status;
|
||||||
|
import org.yaaic.receiver.ServerReceiver;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@ -36,23 +50,9 @@ import android.view.MenuInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemLongClickListener;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.AdapterView.OnItemLongClickListener;
|
|
||||||
|
|
||||||
import org.yaaic.R;
|
|
||||||
import org.yaaic.Yaaic;
|
|
||||||
import org.yaaic.adapter.ServerListAdapter;
|
|
||||||
import org.yaaic.db.Database;
|
|
||||||
import org.yaaic.irc.IRCBinder;
|
|
||||||
import org.yaaic.irc.IRCService;
|
|
||||||
import org.yaaic.layout.NonScalingBackgroundDrawable;
|
|
||||||
import org.yaaic.listener.ServerListener;
|
|
||||||
import org.yaaic.model.Broadcast;
|
|
||||||
import org.yaaic.model.Extra;
|
|
||||||
import org.yaaic.model.Server;
|
|
||||||
import org.yaaic.model.Status;
|
|
||||||
import org.yaaic.receiver.ServerReceiver;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of servers
|
* List of servers
|
||||||
@ -121,6 +121,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
|||||||
/**
|
/**
|
||||||
* Service connected to Activity
|
* Service connected to Activity
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onServiceConnected(ComponentName name, IBinder service)
|
public void onServiceConnected(ComponentName name, IBinder service)
|
||||||
{
|
{
|
||||||
binder = (IRCBinder) service;
|
binder = (IRCBinder) service;
|
||||||
@ -129,6 +130,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
|||||||
/**
|
/**
|
||||||
* Service disconnected from Activity
|
* Service disconnected from Activity
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onServiceDisconnected(ComponentName name)
|
public void onServiceDisconnected(ComponentName name)
|
||||||
{
|
{
|
||||||
binder = null;
|
binder = null;
|
||||||
@ -161,6 +163,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
|||||||
/**
|
/**
|
||||||
* On long click
|
* On long click
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> l, View v, int position, long id)
|
public boolean onItemLongClick(AdapterView<?> l, View v, int position, long id)
|
||||||
{
|
{
|
||||||
final Server server = adapter.getItem(position);
|
final Server server = adapter.getItem(position);
|
||||||
@ -180,6 +183,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
|||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(server.getTitle());
|
builder.setTitle(server.getTitle());
|
||||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int item) {
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
case 0: // Connect
|
case 0: // Connect
|
||||||
@ -231,6 +235,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
|||||||
/**
|
/**
|
||||||
* Options Menu (Menu Button pressed)
|
* Options Menu (Menu Button pressed)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu)
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
{
|
{
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
@ -304,6 +309,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
|||||||
/**
|
/**
|
||||||
* On server status update
|
* On server status update
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onStatusUpdate()
|
public void onStatusUpdate()
|
||||||
{
|
{
|
||||||
adapter.loadServers();
|
adapter.loadServers();
|
||||||
|
@ -27,9 +27,9 @@ import android.app.Activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -73,6 +73,7 @@ public class UserActivity extends Activity implements OnClickListener
|
|||||||
/**
|
/**
|
||||||
* On button click
|
* On button click
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
|
@ -64,6 +64,7 @@ public class UsersActivity extends ListActivity implements OnItemClickListener
|
|||||||
/**
|
/**
|
||||||
* On user selected
|
* On user selected
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
public void onItemClick(AdapterView<?> list, View item, int position, long id)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
|
@ -63,6 +63,7 @@ public class DeckAdapter extends BaseAdapter
|
|||||||
/**
|
/**
|
||||||
* Get number of item
|
* Get number of item
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getCount()
|
public int getCount()
|
||||||
{
|
{
|
||||||
return conversations.size();
|
return conversations.size();
|
||||||
@ -71,6 +72,7 @@ public class DeckAdapter extends BaseAdapter
|
|||||||
/**
|
/**
|
||||||
* Get item at position
|
* Get item at position
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Conversation getItem(int position)
|
public Conversation getItem(int position)
|
||||||
{
|
{
|
||||||
if (position >= 0 && position < conversations.size()) {
|
if (position >= 0 && position < conversations.size()) {
|
||||||
@ -82,6 +84,7 @@ public class DeckAdapter extends BaseAdapter
|
|||||||
/**
|
/**
|
||||||
* Get id of item at position
|
* Get id of item at position
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getItemId(int position)
|
public long getItemId(int position)
|
||||||
{
|
{
|
||||||
return position;
|
return position;
|
||||||
@ -180,6 +183,7 @@ public class DeckAdapter extends BaseAdapter
|
|||||||
/**
|
/**
|
||||||
* Get view at given position
|
* Get view at given position
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent)
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
{
|
{
|
||||||
Conversation conversation = getItem(position);
|
Conversation conversation = getItem(position);
|
||||||
|
@ -38,8 +38,8 @@ import android.widget.TextView;
|
|||||||
*/
|
*/
|
||||||
public class MessageListAdapter extends BaseAdapter
|
public class MessageListAdapter extends BaseAdapter
|
||||||
{
|
{
|
||||||
private LinkedList<TextView> messages;
|
private final LinkedList<TextView> messages;
|
||||||
private Context context;
|
private final Context context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new MessageAdapter
|
* Create a new MessageAdapter
|
||||||
@ -117,6 +117,7 @@ public class MessageListAdapter extends BaseAdapter
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getCount()
|
public int getCount()
|
||||||
{
|
{
|
||||||
return messages.size();
|
return messages.size();
|
||||||
@ -128,6 +129,7 @@ public class MessageListAdapter extends BaseAdapter
|
|||||||
* @param position
|
* @param position
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public TextView getItem(int position)
|
public TextView getItem(int position)
|
||||||
{
|
{
|
||||||
return messages.get(position);
|
return messages.get(position);
|
||||||
@ -139,6 +141,7 @@ public class MessageListAdapter extends BaseAdapter
|
|||||||
* @param position
|
* @param position
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getItemId(int position)
|
public long getItemId(int position)
|
||||||
{
|
{
|
||||||
return position;
|
return position;
|
||||||
@ -152,6 +155,7 @@ public class MessageListAdapter extends BaseAdapter
|
|||||||
* @param parent
|
* @param parent
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent)
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
{
|
{
|
||||||
return getItem(position);
|
return getItem(position);
|
||||||
|
@ -65,6 +65,7 @@ public class ServerListAdapter extends BaseAdapter
|
|||||||
/**
|
/**
|
||||||
* Get number of items
|
* Get number of items
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getCount()
|
public int getCount()
|
||||||
{
|
{
|
||||||
int size = servers.size();
|
int size = servers.size();
|
||||||
@ -82,6 +83,7 @@ public class ServerListAdapter extends BaseAdapter
|
|||||||
*
|
*
|
||||||
* @param position
|
* @param position
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Server getItem(int position)
|
public Server getItem(int position)
|
||||||
{
|
{
|
||||||
if (servers.size() == 0) {
|
if (servers.size() == 0) {
|
||||||
@ -96,6 +98,7 @@ public class ServerListAdapter extends BaseAdapter
|
|||||||
*
|
*
|
||||||
* @param position
|
* @param position
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long getItemId(int position)
|
public long getItemId(int position)
|
||||||
{
|
{
|
||||||
if (servers.size() == 0) {
|
if (servers.size() == 0) {
|
||||||
@ -112,6 +115,7 @@ public class ServerListAdapter extends BaseAdapter
|
|||||||
* @param convertView
|
* @param convertView
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public View getView(int position, View convertView, ViewGroup parent)
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
{
|
{
|
||||||
Server server = getItem(position);
|
Server server = getItem(position);
|
||||||
|
@ -22,8 +22,6 @@ package org.yaaic.command;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
import org.yaaic.command.handler.AMsgHandler;
|
import org.yaaic.command.handler.AMsgHandler;
|
||||||
import org.yaaic.command.handler.AwayHandler;
|
import org.yaaic.command.handler.AwayHandler;
|
||||||
import org.yaaic.command.handler.CloseHandler;
|
import org.yaaic.command.handler.CloseHandler;
|
||||||
@ -55,6 +53,8 @@ import org.yaaic.model.Conversation;
|
|||||||
import org.yaaic.model.Message;
|
import org.yaaic.model.Message;
|
||||||
import org.yaaic.model.Server;
|
import org.yaaic.model.Server;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parser for commands
|
* Parser for commands
|
||||||
*
|
*
|
||||||
@ -62,8 +62,8 @@ import org.yaaic.model.Server;
|
|||||||
*/
|
*/
|
||||||
public class CommandParser
|
public class CommandParser
|
||||||
{
|
{
|
||||||
private HashMap<String, BaseHandler> commands;
|
private final HashMap<String, BaseHandler> commands;
|
||||||
private HashMap<String, String> aliases;
|
private final HashMap<String, String> aliases;
|
||||||
private static CommandParser instance;
|
private static CommandParser instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@ import android.os.Binder;
|
|||||||
*/
|
*/
|
||||||
public class IRCBinder extends Binder
|
public class IRCBinder extends Binder
|
||||||
{
|
{
|
||||||
private IRCService service;
|
private final IRCService service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new binder for given service
|
* Create a new binder for given service
|
||||||
|
@ -31,9 +31,10 @@ import android.view.View;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||||
*/
|
*/
|
||||||
public class NonScalingBackgroundDrawable extends Drawable {
|
public class NonScalingBackgroundDrawable extends Drawable
|
||||||
private View view;
|
{
|
||||||
private Drawable drawable;
|
private final View view;
|
||||||
|
private final Drawable drawable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new non scaling background drawable
|
* Create a new non scaling background drawable
|
||||||
@ -51,6 +52,7 @@ public class NonScalingBackgroundDrawable extends Drawable {
|
|||||||
/**
|
/**
|
||||||
* Draw the background drawable
|
* Draw the background drawable
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void draw(Canvas canvas)
|
public void draw(Canvas canvas)
|
||||||
{
|
{
|
||||||
int left = (view.getWidth() / 2) - (drawable.getIntrinsicWidth() / 2);
|
int left = (view.getWidth() / 2) - (drawable.getIntrinsicWidth() / 2);
|
||||||
@ -66,6 +68,7 @@ public class NonScalingBackgroundDrawable extends Drawable {
|
|||||||
/**
|
/**
|
||||||
* Get the opacity
|
* Get the opacity
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getOpacity()
|
public int getOpacity()
|
||||||
{
|
{
|
||||||
return drawable.getOpacity();
|
return drawable.getOpacity();
|
||||||
@ -74,6 +77,7 @@ public class NonScalingBackgroundDrawable extends Drawable {
|
|||||||
/**
|
/**
|
||||||
* Set the alpha
|
* Set the alpha
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setAlpha(int alpha)
|
public void setAlpha(int alpha)
|
||||||
{
|
{
|
||||||
drawable.setAlpha(alpha);
|
drawable.setAlpha(alpha);
|
||||||
@ -82,6 +86,7 @@ public class NonScalingBackgroundDrawable extends Drawable {
|
|||||||
/**
|
/**
|
||||||
* Set the color filter
|
* Set the color filter
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setColorFilter(ColorFilter cf)
|
public void setColorFilter(ColorFilter cf)
|
||||||
{
|
{
|
||||||
drawable.setColorFilter(cf);
|
drawable.setColorFilter(cf);
|
||||||
|
@ -20,17 +20,17 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
package org.yaaic.listener;
|
package org.yaaic.listener;
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.ViewSwitcher;
|
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
|
||||||
import android.widget.TableLayout.LayoutParams;
|
|
||||||
|
|
||||||
import org.yaaic.adapter.DeckAdapter;
|
import org.yaaic.adapter.DeckAdapter;
|
||||||
import org.yaaic.model.Conversation;
|
import org.yaaic.model.Conversation;
|
||||||
import org.yaaic.view.MessageListView;
|
import org.yaaic.view.MessageListView;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TableLayout.LayoutParams;
|
||||||
|
import android.widget.ViewSwitcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener for clicks on conversations
|
* Listener for clicks on conversations
|
||||||
*
|
*
|
||||||
@ -38,8 +38,8 @@ import org.yaaic.view.MessageListView;
|
|||||||
*/
|
*/
|
||||||
public class ConversationClickListener implements OnItemClickListener
|
public class ConversationClickListener implements OnItemClickListener
|
||||||
{
|
{
|
||||||
private DeckAdapter adapter;
|
private final DeckAdapter adapter;
|
||||||
private ViewSwitcher switcher;
|
private final ViewSwitcher switcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ConversationClickListener
|
* Create a new ConversationClickListener
|
||||||
@ -56,6 +56,7 @@ public class ConversationClickListener implements OnItemClickListener
|
|||||||
/**
|
/**
|
||||||
* On conversation item clicked
|
* On conversation item clicked
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
|
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
|
||||||
{
|
{
|
||||||
Conversation conversation = adapter.getItem(position);
|
Conversation conversation = adapter.getItem(position);
|
||||||
|
@ -20,6 +20,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
package org.yaaic.listener;
|
package org.yaaic.listener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener for conversations
|
||||||
|
*
|
||||||
|
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||||
|
*/
|
||||||
public interface ConversationListener
|
public interface ConversationListener
|
||||||
{
|
{
|
||||||
public void onConversationMessage(String target);
|
public void onConversationMessage(String target);
|
||||||
|
@ -20,15 +20,15 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
package org.yaaic.listener;
|
package org.yaaic.listener;
|
||||||
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.AdapterView.OnItemSelectedListener;
|
|
||||||
|
|
||||||
import org.yaaic.model.Conversation;
|
import org.yaaic.model.Conversation;
|
||||||
import org.yaaic.model.Server;
|
import org.yaaic.model.Server;
|
||||||
import org.yaaic.view.ConversationSwitcher;
|
import org.yaaic.view.ConversationSwitcher;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.AdapterView.OnItemSelectedListener;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener for conversation selections
|
* Listener for conversation selections
|
||||||
*
|
*
|
||||||
@ -36,9 +36,9 @@ import org.yaaic.view.ConversationSwitcher;
|
|||||||
*/
|
*/
|
||||||
public class ConversationSelectedListener implements OnItemSelectedListener
|
public class ConversationSelectedListener implements OnItemSelectedListener
|
||||||
{
|
{
|
||||||
private Server server;
|
private final Server server;
|
||||||
private TextView titleView;
|
private final TextView titleView;
|
||||||
private ConversationSwitcher switcher;
|
private final ConversationSwitcher switcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ConversationSelectedListener
|
* Create a new ConversationSelectedListener
|
||||||
@ -56,6 +56,7 @@ public class ConversationSelectedListener implements OnItemSelectedListener
|
|||||||
/**
|
/**
|
||||||
* On conversation selected/focused
|
* On conversation selected/focused
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> deck, View view, int position, long id)
|
public void onItemSelected(AdapterView<?> deck, View view, int position, long id)
|
||||||
{
|
{
|
||||||
Conversation conversation = (Conversation) deck.getItemAtPosition(position);
|
Conversation conversation = (Conversation) deck.getItemAtPosition(position);
|
||||||
@ -84,6 +85,7 @@ public class ConversationSelectedListener implements OnItemSelectedListener
|
|||||||
/**
|
/**
|
||||||
* On no conversation selected/focused
|
* On no conversation selected/focused
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> deck)
|
public void onNothingSelected(AdapterView<?> deck)
|
||||||
{
|
{
|
||||||
titleView.setText(server.getTitle());
|
titleView.setText(server.getTitle());
|
||||||
|
@ -62,6 +62,7 @@ public class MessageClickListener implements OnItemClickListener
|
|||||||
/**
|
/**
|
||||||
* On message item clicked
|
* On message item clicked
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onItemClick(AdapterView<?> group, View view, int position, long id)
|
public void onItemClick(AdapterView<?> group, View view, int position, long id)
|
||||||
{
|
{
|
||||||
MessageListAdapter adapter = (MessageListAdapter) group.getAdapter();
|
MessageListAdapter adapter = (MessageListAdapter) group.getAdapter();
|
||||||
|
@ -35,7 +35,7 @@ import android.view.View.OnClickListener;
|
|||||||
*/
|
*/
|
||||||
public class SpeechClickListener implements OnClickListener
|
public class SpeechClickListener implements OnClickListener
|
||||||
{
|
{
|
||||||
private Activity activity;
|
private final Activity activity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new listener for speech button
|
* Create a new listener for speech button
|
||||||
@ -51,6 +51,7 @@ public class SpeechClickListener implements OnClickListener
|
|||||||
/**
|
/**
|
||||||
* On Click on speech button
|
* On Click on speech button
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
|
||||||
|
@ -44,9 +44,9 @@ public abstract class Conversation
|
|||||||
|
|
||||||
public static final int HISTORY_SIZE = 30;
|
public static final int HISTORY_SIZE = 30;
|
||||||
|
|
||||||
private LinkedList<Message> buffer;
|
private final LinkedList<Message> buffer;
|
||||||
private LinkedList<Message> history;
|
private final LinkedList<Message> history;
|
||||||
private String name;
|
private final String name;
|
||||||
private MessageListAdapter adapter;
|
private MessageListAdapter adapter;
|
||||||
private int status = 1;
|
private int status = 1;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||||||
public class Identity
|
public class Identity
|
||||||
{
|
{
|
||||||
private String nickname;
|
private String nickname;
|
||||||
private List<String> aliases = new ArrayList<String>();
|
private final List<String> aliases = new ArrayList<String>();
|
||||||
private String ident;
|
private String ident;
|
||||||
private String realname;
|
private String realname;
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ public class Message {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private int icon = -1;
|
private int icon = -1;
|
||||||
private String text;
|
private final String text;
|
||||||
private String sender;
|
private final String sender;
|
||||||
private SpannableString canvas;
|
private SpannableString canvas;
|
||||||
private int color = -1;
|
private int color = -1;
|
||||||
private long timestamp;
|
private final long timestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message without an icon
|
* Create a new message without an icon
|
||||||
@ -135,7 +135,9 @@ public class Message {
|
|||||||
private int getSenderColor()
|
private int getSenderColor()
|
||||||
{
|
{
|
||||||
/* It might be worth to use some hash table here */
|
/* It might be worth to use some hash table here */
|
||||||
if (sender == null) return COLOR_DEFAULT;
|
if (sender == null) {
|
||||||
|
return COLOR_DEFAULT;
|
||||||
|
}
|
||||||
int color = 0;
|
int color = 0;
|
||||||
for(int i = 0; i < sender.length(); i++){
|
for(int i = 0; i < sender.length(); i++){
|
||||||
color += sender.charAt(i);
|
color += sender.charAt(i);
|
||||||
|
@ -40,6 +40,7 @@ public class Query extends Conversation
|
|||||||
/**
|
/**
|
||||||
* Get the type of this conversation
|
* Get the type of this conversation
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getType()
|
public int getType()
|
||||||
{
|
{
|
||||||
return Conversation.TYPE_QUERY;
|
return Conversation.TYPE_QUERY;
|
||||||
|
@ -31,7 +31,7 @@ public class Scrollback
|
|||||||
{
|
{
|
||||||
public static final int MAX_HISTORY = 10;
|
public static final int MAX_HISTORY = 10;
|
||||||
|
|
||||||
private LinkedList<String> messages;
|
private final LinkedList<String> messages;
|
||||||
private int pointer;
|
private int pointer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +42,7 @@ public class Server
|
|||||||
private boolean useSSL = false;
|
private boolean useSSL = false;
|
||||||
private Identity identity;
|
private Identity identity;
|
||||||
|
|
||||||
private LinkedHashMap<String, Conversation> conversations = new LinkedHashMap<String, Conversation>();
|
private final LinkedHashMap<String, Conversation> conversations = new LinkedHashMap<String, Conversation>();
|
||||||
private ArrayList<String> autoJoinChannels;
|
private ArrayList<String> autoJoinChannels;
|
||||||
private ArrayList<String> connectCommands;
|
private ArrayList<String> connectCommands;
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ package org.yaaic.model;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||||
*/
|
*/
|
||||||
public class Status {
|
public class Status
|
||||||
|
{
|
||||||
public static final int DISCONNECTED = 0;
|
public static final int DISCONNECTED = 0;
|
||||||
public static final int CONNECTING = 1;
|
public static final int CONNECTING = 1;
|
||||||
public static final int CONNECTED = 2;
|
public static final int CONNECTED = 2;
|
||||||
|
@ -20,14 +20,14 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
package org.yaaic.receiver;
|
package org.yaaic.receiver;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
import org.yaaic.listener.ConversationListener;
|
import org.yaaic.listener.ConversationListener;
|
||||||
import org.yaaic.model.Broadcast;
|
import org.yaaic.model.Broadcast;
|
||||||
import org.yaaic.model.Extra;
|
import org.yaaic.model.Extra;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A channel receiver for receiving channel updates
|
* A channel receiver for receiving channel updates
|
||||||
*
|
*
|
||||||
@ -35,8 +35,8 @@ import org.yaaic.model.Extra;
|
|||||||
*/
|
*/
|
||||||
public class ConversationReceiver extends BroadcastReceiver
|
public class ConversationReceiver extends BroadcastReceiver
|
||||||
{
|
{
|
||||||
private ConversationListener listener;
|
private final ConversationListener listener;
|
||||||
private int serverId;
|
private final int serverId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new channel receiver
|
* Create a new channel receiver
|
||||||
|
@ -33,7 +33,7 @@ import android.content.Intent;
|
|||||||
*/
|
*/
|
||||||
public class ServerReceiver extends BroadcastReceiver
|
public class ServerReceiver extends BroadcastReceiver
|
||||||
{
|
{
|
||||||
private ServerListener listener;
|
private final ServerListener listener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new server receiver
|
* Create a new server receiver
|
||||||
|
@ -37,6 +37,7 @@ public class NaiveTrustManager implements X509TrustManager
|
|||||||
*
|
*
|
||||||
* @throws CertificateException if not trusted
|
* @throws CertificateException if not trusted
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
|
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
|
||||||
{
|
{
|
||||||
// No Exception == Trust
|
// No Exception == Trust
|
||||||
@ -47,6 +48,7 @@ public class NaiveTrustManager implements X509TrustManager
|
|||||||
*
|
*
|
||||||
* @throws CertificateException if not trusted
|
* @throws CertificateException if not trusted
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
|
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
|
||||||
{
|
{
|
||||||
// No Exception == Trust
|
// No Exception == Trust
|
||||||
@ -55,6 +57,7 @@ public class NaiveTrustManager implements X509TrustManager
|
|||||||
/**
|
/**
|
||||||
* Get accepted issuers
|
* Get accepted issuers
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public X509Certificate[] getAcceptedIssuers()
|
public X509Certificate[] getAcceptedIssuers()
|
||||||
{
|
{
|
||||||
return new X509Certificate[0];
|
return new X509Certificate[0];
|
||||||
|
@ -39,7 +39,7 @@ import android.view.View;
|
|||||||
public class ConversationSwitcher extends View
|
public class ConversationSwitcher extends View
|
||||||
{
|
{
|
||||||
private Server server;
|
private Server server;
|
||||||
private Paint paint;
|
private final Paint paint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ConversationSwitcher
|
* Create a new ConversationSwitcher
|
||||||
@ -70,6 +70,7 @@ public class ConversationSwitcher extends View
|
|||||||
* @param widthMeasureSpec
|
* @param widthMeasureSpec
|
||||||
* @param heightMeasureSpec
|
* @param heightMeasureSpec
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||||
{
|
{
|
||||||
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 16);
|
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 16);
|
||||||
@ -78,6 +79,7 @@ public class ConversationSwitcher extends View
|
|||||||
/**
|
/**
|
||||||
* On draw
|
* On draw
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void onDraw(Canvas canvas)
|
protected void onDraw(Canvas canvas)
|
||||||
{
|
{
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
|
@ -38,7 +38,7 @@ import android.widget.ListView;
|
|||||||
public class MessageListView extends ListView
|
public class MessageListView extends ListView
|
||||||
{
|
{
|
||||||
private boolean delegate = true;
|
private boolean delegate = true;
|
||||||
private View parent;
|
private final View parent;
|
||||||
private int parentWidth;
|
private int parentWidth;
|
||||||
private int parentHeight;
|
private int parentHeight;
|
||||||
|
|
||||||
@ -109,6 +109,7 @@ public class MessageListView extends ListView
|
|||||||
*
|
*
|
||||||
* @return The MessageListAdapter
|
* @return The MessageListAdapter
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public MessageListAdapter getAdapter()
|
public MessageListAdapter getAdapter()
|
||||||
{
|
{
|
||||||
return (MessageListAdapter) super.getAdapter();
|
return (MessageListAdapter) super.getAdapter();
|
||||||
|
Loading…
Reference in New Issue
Block a user