1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-26 02:42:16 -05:00

Added autoscrolling to channel switcher

This commit is contained in:
Sebastian Kaspari 2010-03-07 01:01:35 +01:00
parent 808f56d978
commit 60b0df6c26
3 changed files with 10 additions and 29 deletions

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Yaaic - Yet Another Android IRC Client
Copyright 2009 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/>.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>

View File

@ -23,15 +23,19 @@ package org.yaaic.adapter;
import java.util.HashMap;
import java.util.LinkedList;
import org.yaaic.R;
import org.yaaic.model.Channel;
import org.yaaic.model.Message;
import android.content.Context;
import android.graphics.Typeface;
import android.text.SpannableString;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ScrollView;
import android.widget.TextView;
/**
@ -185,11 +189,11 @@ public class DeckAdapter extends BaseAdapter
public View renderChannel(Channel channel, ViewGroup parent)
{
TextView canvas = new TextView(parent.getContext());
canvas.setBackgroundColor(0xff222222);
canvas.setPadding(5, 5, 5, 5);
canvas.setTextSize(11);
canvas.setTypeface(Typeface.MONOSPACE);
canvas.setTextColor(0xffeeeeee);
canvas.setPadding(5, 5, 5, 5);
canvas.setBackgroundColor(0xff222222);
SpannableString welcome = new SpannableString("Joined " + channel.getName());
canvas.setText(welcome);
@ -209,6 +213,7 @@ public class DeckAdapter extends BaseAdapter
int w = (int) vwf;
int h = (int) vhf;
//channelView.setLayoutParams(new Gallery.LayoutParams(w, h));
canvas.setLayoutParams(new Gallery.LayoutParams(w, h));
return canvas;

View File

@ -200,6 +200,9 @@ public class ServerActivity extends Activity implements ServiceConnection, Chann
if (canvas != null) {
canvas.append(message.render(canvas.getContext()));
int y = (canvas.getLineCount() * canvas.getLineHeight()) - canvas.getHeight() + 20;
Log.d(TAG, "Scrolling to: " + y);
canvas.scrollTo(0, y);
deckAdapter.notifyDataSetChanged();
if (target.equals(deckAdapter.getSwitchedName())) {