mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-22 08:52:18 -05:00
added inline documentation
This commit is contained in:
parent
2cc0b983bc
commit
c1e69b0a64
@ -85,6 +85,9 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
*/
|
*/
|
||||||
private IrcBinder binder;
|
private IrcBinder binder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On Create
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
@ -113,6 +116,9 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
this.initAnimation();
|
this.initAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and apply animations for the server list (on create)
|
||||||
|
*/
|
||||||
public void initAnimation()
|
public void initAnimation()
|
||||||
{
|
{
|
||||||
AnimationSet set = new AnimationSet(true);
|
AnimationSet set = new AnimationSet(true);
|
||||||
@ -133,6 +139,9 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
lv.setLayoutAnimation(controller);
|
lv.setLayoutAnimation(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On Resume
|
||||||
|
*/
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
Log.d(TAG, "onResume");
|
Log.d(TAG, "onResume");
|
||||||
@ -140,6 +149,9 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On Pause
|
||||||
|
*/
|
||||||
public void onPause()
|
public void onPause()
|
||||||
{
|
{
|
||||||
Log.d(TAG, "onPause");
|
Log.d(TAG, "onPause");
|
||||||
@ -147,6 +159,9 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On Destroy
|
||||||
|
*/
|
||||||
public void onDestroy()
|
public void onDestroy()
|
||||||
{
|
{
|
||||||
Log.d(TAG, "onDestroy");
|
Log.d(TAG, "onDestroy");
|
||||||
@ -154,9 +169,12 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
db.close();
|
db.close();
|
||||||
unbindService(this);
|
unbindService(this); // disconnect service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Click Listener
|
||||||
|
*/
|
||||||
public void onListItemClick(ListView listView, View view, int position, long id)
|
public void onListItemClick(ListView listView, View view, int position, long id)
|
||||||
{
|
{
|
||||||
TextView tv = (TextView) view.findViewById(R.id.server_title);
|
TextView tv = (TextView) view.findViewById(R.id.server_title);
|
||||||
@ -167,6 +185,9 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
//cursor.requery();
|
//cursor.requery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Long Click Listener
|
||||||
|
*/
|
||||||
public boolean onItemLongClick(AdapterView<?> av, View v, int position, long id) {
|
public boolean onItemLongClick(AdapterView<?> av, View v, int position, long id) {
|
||||||
final TextView tv = (TextView) v.findViewById(R.id.server_title);
|
final TextView tv = (TextView) v.findViewById(R.id.server_title);
|
||||||
|
|
||||||
@ -182,6 +203,12 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server selected (Long click)
|
||||||
|
*
|
||||||
|
* @param item id/position of item selected
|
||||||
|
* @param title title of item (server title [unique id])
|
||||||
|
*/
|
||||||
public void onServerDialogSelect(int item, String title)
|
public void onServerDialogSelect(int item, String title)
|
||||||
{
|
{
|
||||||
Log.d(TAG, "ServerDialogSelect: Item #" + item);
|
Log.d(TAG, "ServerDialogSelect: Item #" + item);
|
||||||
@ -206,26 +233,38 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options Menu (Menu Button pressed)
|
||||||
|
*/
|
||||||
public boolean onCreateOptionsMenu(Menu menu)
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
{
|
{
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
|
// inflate from xml
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.main, menu);
|
inflater.inflate(R.menu.main, menu);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener for menu items
|
||||||
|
*/
|
||||||
public boolean onOptionsItemSelected(MenuItem item)
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
{
|
{
|
||||||
switch (item.getItemId())
|
switch (item.getItemId())
|
||||||
{
|
{
|
||||||
|
// Add a new server
|
||||||
case R.id.server_add:
|
case R.id.server_add:
|
||||||
Intent serverAddIntent = new Intent(this, ServerAdd.class);
|
Intent serverAddIntent = new Intent(this, ServerAdd.class);
|
||||||
startActivity(serverAddIntent);
|
startActivity(serverAddIntent);
|
||||||
return true;
|
return true;
|
||||||
|
// Show settings
|
||||||
case R.id.settings:
|
case R.id.settings:
|
||||||
Intent settingsIntent = new Intent(this, Settings.class);
|
Intent settingsIntent = new Intent(this, Settings.class);
|
||||||
startActivity(settingsIntent);
|
startActivity(settingsIntent);
|
||||||
return true;
|
return true;
|
||||||
|
// Show about window
|
||||||
case R.id.about:
|
case R.id.about:
|
||||||
Intent aboutIntent = new Intent(this, About.class);
|
Intent aboutIntent = new Intent(this, About.class);
|
||||||
startActivity(aboutIntent);
|
startActivity(aboutIntent);
|
||||||
@ -234,13 +273,16 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener: IrcService connected to activity
|
||||||
|
*/
|
||||||
public void onServiceConnected(ComponentName name, IBinder service)
|
public void onServiceConnected(ComponentName name, IBinder service)
|
||||||
{
|
{
|
||||||
Log.d(TAG, "Service connected");
|
Log.d(TAG, "Service connected");
|
||||||
|
|
||||||
binder = (IrcBinder) service;
|
binder = (IrcBinder) service;
|
||||||
|
|
||||||
// AutoConnect
|
// Look for AutoConnect servers and connect if needed
|
||||||
Cursor autoCursor = db.getAutoConnectServers();
|
Cursor autoCursor = db.getAutoConnectServers();
|
||||||
while(autoCursor.moveToNext()) {
|
while(autoCursor.moveToNext()) {
|
||||||
binder.connect(
|
binder.connect(
|
||||||
@ -253,11 +295,19 @@ public class ServerList extends ListActivity implements OnItemLongClickListener,
|
|||||||
autoCursor.close();
|
autoCursor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener: IrcServers disconnected from activity
|
||||||
|
*/
|
||||||
public void onServiceDisconnected(ComponentName name)
|
public void onServiceDisconnected(ComponentName name)
|
||||||
{
|
{
|
||||||
Log.d(TAG, "Service disconnected");
|
Log.d(TAG, "Service disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to given server
|
||||||
|
*
|
||||||
|
* @param title Title of server (unique id)
|
||||||
|
*/
|
||||||
private void connectToServer(String title)
|
private void connectToServer(String title)
|
||||||
{
|
{
|
||||||
Cursor cursor = db.getServer(title);
|
Cursor cursor = db.getServer(title);
|
||||||
|
Loading…
Reference in New Issue
Block a user