mirror of
https://github.com/moparisthebest/Yaaic
synced 2025-01-08 12:18:07 -05:00
Add ActionBarSherlock to all activities. Restructure menu items. Fixes #96.
This commit is contained in:
parent
3e9735760a
commit
fbdebc2ca5
@ -26,7 +26,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" />
|
||||
<application
|
||||
android:icon="@drawable/icon"
|
||||
android:label="Yaaic">
|
||||
android:label="Yaaic"
|
||||
android:theme="@style/Theme.Sherlock">
|
||||
<activity
|
||||
android:name=".activity.ServersActivity"
|
||||
android:label="@string/app_name"
|
||||
|
@ -19,27 +19,14 @@ GNU General Public License for more details.
|
||||
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="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp">
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@android:drawable/ic_menu_add"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="5dp" />
|
||||
<TextView
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:drawableLeft="@drawable/actionbar_add"
|
||||
android:drawablePadding="5dip"
|
||||
android:padding="10dip"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/add_server_list"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -24,12 +24,12 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#3f5d9b" />
|
||||
android:color="#FF181818" />
|
||||
<padding
|
||||
android:left="3dp"
|
||||
android:top="3dp"
|
||||
android:right="3dp"
|
||||
android:bottom="3dp" />
|
||||
<solid
|
||||
android:color="#ff181818" />
|
||||
android:color="#FF000000" />
|
||||
</shape>
|
@ -27,16 +27,13 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:text="@string/server"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="2dp" />
|
||||
android:layout_marginBottom="3dip"
|
||||
style="?android:attr/listSeparatorTextViewStyle" />
|
||||
<TextView
|
||||
android:text="@string/server_title"
|
||||
android:layout_width="fill_parent"
|
||||
@ -100,11 +97,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:text="@string/user"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="2dp" />
|
||||
android:layout_marginBottom="3dip"
|
||||
style="?android:attr/listSeparatorTextViewStyle" />
|
||||
<TextView
|
||||
android:text="@string/nickname"
|
||||
android:layout_width="fill_parent"
|
||||
@ -147,11 +141,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:text="@string/on_connect"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="2dp" />
|
||||
android:layout_marginBottom="3dip"
|
||||
style="?android:attr/listSeparatorTextViewStyle" />
|
||||
<Button
|
||||
android:id="@+id/authentication"
|
||||
android:layout_width="fill_parent"
|
||||
@ -172,11 +163,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:text="@string/preferences"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ff333333"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="3dp"
|
||||
android:layout_margin="2dp" />
|
||||
android:layout_marginBottom="3dip"
|
||||
style="?android:attr/listSeparatorTextViewStyle" />
|
||||
<TextView
|
||||
android:text="@string/charset"
|
||||
android:layout_width="fill_parent"
|
||||
|
28
application/res/menu/addserver.xml
Normal file
28
application/res/menu/addserver.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Yaaic - Yet Another Android IRC Client
|
||||
|
||||
Copyright 2009-2011 Sebastian Kaspari
|
||||
|
||||
This file is part of Yaaic.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/save"
|
||||
android:title="@string/server_save"
|
||||
android:icon="@drawable/actionbar_save"
|
||||
android:showAsAction="ifRoom|withText" />
|
||||
</menu>
|
@ -23,17 +23,21 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
<item
|
||||
android:id="@+id/join"
|
||||
android:title="@string/join_channel"
|
||||
android:icon="@android:drawable/ic_menu_add" />
|
||||
android:icon="@drawable/actionbar_add"
|
||||
android:showAsAction="ifRoom|withText" />
|
||||
<item
|
||||
android:id="@+id/users"
|
||||
android:title="@string/users"
|
||||
android:icon="@drawable/menu_users" />
|
||||
android:icon="@drawable/actionbar_users"
|
||||
android:showAsAction="ifRoom|withText" />
|
||||
<item
|
||||
android:id="@+id/close"
|
||||
android:title="@string/close"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel" />
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||
android:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/disconnect"
|
||||
android:title="@string/disconnect"
|
||||
android:icon="@android:drawable/ic_menu_revert" />
|
||||
android:icon="@android:drawable/ic_menu_revert"
|
||||
android:showAsAction="never" />
|
||||
</menu>
|
@ -23,11 +23,13 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
<item
|
||||
android:id="@+id/add"
|
||||
android:title="@string/add_server_menu"
|
||||
android:icon="@android:drawable/ic_menu_add" />
|
||||
android:icon="@drawable/actionbar_add"
|
||||
android:showAsAction="ifRoom|withText" />
|
||||
<item
|
||||
android:id="@+id/settings"
|
||||
android:title="@string/settings_menu"
|
||||
android:icon="@android:drawable/ic_menu_preferences" />
|
||||
android:icon="@drawable/actionbar_settings"
|
||||
android:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about_menu"
|
||||
|
@ -13,6 +13,7 @@
|
||||
<string name="users_label">Users</string>
|
||||
<string name="channels_label">Channels</string>
|
||||
<string name="add_server_label">Add new server</string>
|
||||
<string name="edit_server_label">Edit server</string>
|
||||
|
||||
<string name="server_title">Title</string>
|
||||
<string name="server_host">Host</string>
|
||||
|
@ -34,7 +34,6 @@ import org.yaaic.model.Identity;
|
||||
import org.yaaic.model.Server;
|
||||
import org.yaaic.model.Status;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@ -47,12 +46,17 @@ import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
/**
|
||||
* Add a new server to the list
|
||||
*
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class AddServerActivity extends Activity implements OnClickListener
|
||||
public class AddServerActivity extends SherlockActivity implements OnClickListener
|
||||
{
|
||||
private static final int REQUEST_CODE_CHANNELS = 1;
|
||||
private static final int REQUEST_CODE_COMMANDS = 2;
|
||||
@ -95,6 +99,8 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if (extras != null && extras.containsKey(Extra.SERVER)) {
|
||||
setTitle(R.string.edit_server_label);
|
||||
|
||||
// Request to edit an existing server
|
||||
Database db = new Database(this);
|
||||
this.server = db.getServerById(extras.getInt(Extra.SERVER));
|
||||
@ -149,6 +155,35 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On options menu requested
|
||||
*/
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
{
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.addserver, menu);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* On menu item selected
|
||||
*/
|
||||
@Override
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item)
|
||||
{
|
||||
switch (item.getItemId()) {
|
||||
case R.id.save:
|
||||
save();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onMenuItemSelected(featureId, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* On activity result
|
||||
*/
|
||||
@ -215,6 +250,20 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
break;
|
||||
|
||||
case R.id.add:
|
||||
save();
|
||||
break;
|
||||
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to save server.
|
||||
*/
|
||||
private void save() {
|
||||
try {
|
||||
validateServer();
|
||||
validateIdentity();
|
||||
@ -228,13 +277,6 @@ public class AddServerActivity extends Activity implements OnClickListener
|
||||
} catch(ValidationException e) {
|
||||
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.cancel:
|
||||
setResult(RESULT_CANCELED);
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,7 +49,6 @@ import org.yaaic.model.User;
|
||||
import org.yaaic.receiver.ConversationReceiver;
|
||||
import org.yaaic.receiver.ServerReceiver;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ComponentName;
|
||||
import android.content.DialogInterface;
|
||||
@ -66,14 +65,9 @@ import android.os.IBinder;
|
||||
import android.speech.RecognizerIntent;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.text.InputType;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -81,14 +75,20 @@ import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import com.viewpagerindicator.TitlePageIndicator;
|
||||
import com.viewpagerindicator.TitlePageIndicator.IndicatorStyle;
|
||||
|
||||
/**
|
||||
* The server view with a scrollable list of all channels
|
||||
*
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class ConversationActivity extends Activity implements ServiceConnection, ServerListener, ConversationListener
|
||||
public class ConversationActivity extends SherlockActivity implements ServiceConnection, ServerListener, ConversationListener
|
||||
{
|
||||
public static final int REQUEST_CODE_SPEECH = 99;
|
||||
|
||||
@ -171,7 +171,6 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
serverId = getIntent().getExtras().getInt("serverId");
|
||||
server = Yaaic.getInstance().getServerById(serverId);
|
||||
@ -182,13 +181,17 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
this.finish();
|
||||
}
|
||||
|
||||
setTitle("Yaaic - " + server.getTitle());
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
setContentView(R.layout.conversations);
|
||||
if (settings.fullscreenConversations()){
|
||||
setTitle(server.getTitle());
|
||||
|
||||
if (settings.fullscreenConversations()) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
|
||||
setContentView(R.layout.conversations);
|
||||
|
||||
boolean isLandscape = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||
|
||||
EditText input = (EditText) findViewById(R.id.input);
|
||||
@ -199,10 +202,21 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
pagerAdapter = new ConversationPagerAdapter(server);
|
||||
pager.setAdapter(pagerAdapter);
|
||||
|
||||
final float density = getResources().getDisplayMetrics().density;
|
||||
|
||||
TitlePageIndicator indicator = (TitlePageIndicator) findViewById(R.id.titleIndicator);
|
||||
indicator.setTypeface(Typeface.MONOSPACE);
|
||||
indicator.setViewPager(pager);
|
||||
|
||||
indicator.setFooterColor(0xFF31B6E7);
|
||||
indicator.setFooterLineHeight(1 * density);
|
||||
indicator.setFooterIndicatorHeight(3 * density);
|
||||
indicator.setFooterIndicatorStyle(IndicatorStyle.Underline);
|
||||
indicator.setTextColor(0xFFDDDDDD);
|
||||
indicator.setSelectedColor(0xFFFFFFFF);
|
||||
indicator.setSelectedBold(true);
|
||||
indicator.setBackgroundColor(0xFF181818);
|
||||
|
||||
historySize = settings.getHistorySize();
|
||||
|
||||
if (server.getStatus() == Status.PRE_CONNECTING) {
|
||||
@ -211,12 +225,12 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
server.getConversation(ServerInfo.DEFAULT_NAME).setHistorySize(historySize);
|
||||
}
|
||||
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
float fontSize = settings.getFontSize() * dm.scaledDensity;
|
||||
final float scaledDensity = getResources().getDisplayMetrics().density;
|
||||
|
||||
float fontSize = settings.getFontSize() * scaledDensity;
|
||||
indicator.setTextSize(fontSize);
|
||||
|
||||
int padding = (int) (5 * dm.scaledDensity);
|
||||
int padding = (int) (5 * scaledDensity);
|
||||
input.setPadding(padding, padding, padding, padding);
|
||||
indicator.setTypeface(Typeface.MONOSPACE);
|
||||
|
||||
@ -410,7 +424,7 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
// inflate from xml
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.conversations, menu);
|
||||
|
||||
return true;
|
||||
@ -436,6 +450,10 @@ public class ConversationActivity extends Activity implements ServiceConnection,
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item)
|
||||
{
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
break;
|
||||
|
||||
case R.id.disconnect:
|
||||
server.setStatus(Status.DISCONNECTED);
|
||||
server.setMayReconnect(false);
|
||||
|
@ -28,7 +28,6 @@ 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;
|
||||
@ -37,7 +36,6 @@ import org.yaaic.model.Status;
|
||||
import org.yaaic.receiver.ServerReceiver;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ListActivity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
@ -45,21 +43,24 @@ import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.AdapterView.OnItemLongClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.AdapterView.OnItemLongClickListener;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
/**
|
||||
* List of servers
|
||||
*
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class ServersActivity extends ListActivity implements ServiceConnection, ServerListener, OnItemLongClickListener {
|
||||
public class ServersActivity extends SherlockActivity implements ServiceConnection, ServerListener, OnItemClickListener, OnItemLongClickListener {
|
||||
private IRCBinder binder;
|
||||
private ServerReceiver receiver;
|
||||
private ServerListAdapter adapter;
|
||||
@ -89,11 +90,11 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
setContentView(R.layout.servers);
|
||||
|
||||
adapter = new ServerListAdapter();
|
||||
setListAdapter(adapter);
|
||||
|
||||
list = getListView();
|
||||
list = (ListView) findViewById(android.R.id.list);
|
||||
list.setAdapter(adapter);
|
||||
list.setOnItemClickListener(this);
|
||||
list.setOnItemLongClickListener(this);
|
||||
list.setBackgroundDrawable(new NonScalingBackgroundDrawable(this, list, R.drawable.background));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,7 +165,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
* On server selected
|
||||
*/
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
Server server = adapter.getItem(position);
|
||||
|
||||
if (server == null) {
|
||||
@ -266,7 +267,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
super.onCreateOptionsMenu(menu);
|
||||
|
||||
// inflate from xml
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
MenuInflater inflater = new MenuInflater(this);
|
||||
inflater.inflate(R.menu.servers, menu);
|
||||
|
||||
return true;
|
||||
@ -345,5 +346,4 @@ public class ServersActivity extends ListActivity implements ServiceConnection,
|
||||
list.setBackgroundDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,14 +23,15 @@ package org.yaaic.activity;
|
||||
import org.yaaic.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockPreferenceActivity;
|
||||
|
||||
/**
|
||||
* Settings
|
||||
*
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class SettingsActivity extends PreferenceActivity
|
||||
public class SettingsActivity extends SherlockPreferenceActivity
|
||||
{
|
||||
/**
|
||||
* On create
|
||||
|
@ -247,6 +247,7 @@ public class ConversationPagerAdapter extends PagerAdapter implements TitleProvi
|
||||
convInfo.adapter = adapter;
|
||||
}
|
||||
|
||||
|
||||
list.setAdapter(adapter);
|
||||
list.setSelection(adapter.getCount() - 1); // scroll to bottom
|
||||
|
||||
|
@ -564,6 +564,7 @@ public class IRCService extends Service
|
||||
}
|
||||
|
||||
synchronized(alarmIntentsLock) {
|
||||
// XXX: alarmIntents can be null
|
||||
PendingIntent pendingRIntent = alarmIntents.get(serverId);
|
||||
if (pendingRIntent != null) {
|
||||
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
|
||||
|
@ -1,94 +0,0 @@
|
||||
/*
|
||||
Yaaic - Yet Another Android IRC Client
|
||||
|
||||
Copyright 2009-2011 Sebastian Kaspari
|
||||
|
||||
This file is part of Yaaic.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.yaaic.layout;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Wrapper for background drawables that should not be scaled
|
||||
*
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class NonScalingBackgroundDrawable extends Drawable
|
||||
{
|
||||
private final View view;
|
||||
private final Drawable drawable;
|
||||
|
||||
/**
|
||||
* Create a new non scaling background drawable
|
||||
*
|
||||
* @param context
|
||||
* @param view
|
||||
* @param resource
|
||||
*/
|
||||
public NonScalingBackgroundDrawable(Context context, View view, int resource)
|
||||
{
|
||||
this.view = view;
|
||||
this.drawable = context.getResources().getDrawable(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background drawable
|
||||
*/
|
||||
@Override
|
||||
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();
|
||||
|
||||
drawable.setBounds(left, top, right, bottom);
|
||||
|
||||
drawable.draw(canvas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the opacity
|
||||
*/
|
||||
@Override
|
||||
public int getOpacity()
|
||||
{
|
||||
return drawable.getOpacity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the alpha
|
||||
*/
|
||||
@Override
|
||||
public void setAlpha(int alpha)
|
||||
{
|
||||
drawable.setAlpha(alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the color filter
|
||||
*/
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf)
|
||||
{
|
||||
drawable.setColorFilter(cf);
|
||||
}
|
||||
}
|
@ -47,16 +47,16 @@ public class MessageListView extends ListView
|
||||
|
||||
setDivider(null);
|
||||
|
||||
setBackgroundResource(R.layout.border);
|
||||
setCacheColorHint(0xFF181818);
|
||||
setCacheColorHint(0x000000);
|
||||
setVerticalFadingEdgeEnabled(false);
|
||||
setBackgroundResource(R.layout.conversation_background);
|
||||
setScrollBarStyle(SCROLLBARS_OUTSIDE_INSET);
|
||||
setTranscriptMode(TRANSCRIPT_MODE_ALWAYS_SCROLL);
|
||||
|
||||
// Scale padding by screen density
|
||||
float density = context.getResources().getDisplayMetrics().density;
|
||||
int padding = (int) (5 * density);
|
||||
setPadding(padding, padding, padding, 0);
|
||||
setPadding(padding, padding, padding, padding);
|
||||
|
||||
// XXX: This should be dynamically
|
||||
setTranscriptMode(TRANSCRIPT_MODE_ALWAYS_SCROLL);
|
||||
|
Loading…
Reference in New Issue
Block a user