mirror of
https://github.com/moparisthebest/Yaaic
synced 2025-02-17 23:40:20 -05:00
Added autoscrolling to channel switcher
This commit is contained in:
parent
808f56d978
commit
60b0df6c26
@ -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>
|
|
@ -23,15 +23,19 @@ package org.yaaic.adapter;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import org.yaaic.R;
|
||||||
import org.yaaic.model.Channel;
|
import org.yaaic.model.Channel;
|
||||||
import org.yaaic.model.Message;
|
import org.yaaic.model.Message;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.Gallery;
|
import android.widget.Gallery;
|
||||||
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,11 +189,11 @@ public class DeckAdapter extends BaseAdapter
|
|||||||
public View renderChannel(Channel channel, ViewGroup parent)
|
public View renderChannel(Channel channel, ViewGroup parent)
|
||||||
{
|
{
|
||||||
TextView canvas = new TextView(parent.getContext());
|
TextView canvas = new TextView(parent.getContext());
|
||||||
|
canvas.setBackgroundColor(0xff222222);
|
||||||
|
canvas.setPadding(5, 5, 5, 5);
|
||||||
canvas.setTextSize(11);
|
canvas.setTextSize(11);
|
||||||
canvas.setTypeface(Typeface.MONOSPACE);
|
canvas.setTypeface(Typeface.MONOSPACE);
|
||||||
canvas.setTextColor(0xffeeeeee);
|
canvas.setTextColor(0xffeeeeee);
|
||||||
canvas.setPadding(5, 5, 5, 5);
|
|
||||||
canvas.setBackgroundColor(0xff222222);
|
|
||||||
|
|
||||||
SpannableString welcome = new SpannableString("Joined " + channel.getName());
|
SpannableString welcome = new SpannableString("Joined " + channel.getName());
|
||||||
canvas.setText(welcome);
|
canvas.setText(welcome);
|
||||||
@ -209,6 +213,7 @@ public class DeckAdapter extends BaseAdapter
|
|||||||
int w = (int) vwf;
|
int w = (int) vwf;
|
||||||
int h = (int) vhf;
|
int h = (int) vhf;
|
||||||
|
|
||||||
|
//channelView.setLayoutParams(new Gallery.LayoutParams(w, h));
|
||||||
canvas.setLayoutParams(new Gallery.LayoutParams(w, h));
|
canvas.setLayoutParams(new Gallery.LayoutParams(w, h));
|
||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
|
@ -200,6 +200,9 @@ public class ServerActivity extends Activity implements ServiceConnection, Chann
|
|||||||
|
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
canvas.append(message.render(canvas.getContext()));
|
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();
|
deckAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
if (target.equals(deckAdapter.getSwitchedName())) {
|
if (target.equals(deckAdapter.getSwitchedName())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user