mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-25 02:12:16 -05:00
Remove fullscreen option from settings.
There's no need anymore on new devices and the app should not cover the notification bar.
This commit is contained in:
parent
9884ef1bff
commit
743eae9b85
@ -19,7 +19,7 @@ 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/>.
|
||||
-->
|
||||
<org.yaaic.view.ConversationLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
@ -55,4 +55,4 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:drawableLeft="@android:drawable/ic_btn_speak_now"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</org.yaaic.view.ConversationLayout>
|
||||
</LinearLayout>
|
||||
|
@ -60,9 +60,6 @@
|
||||
<string name="key_ime_extract">ime_extract</string>
|
||||
<string name="default_ime_extract">true</string>
|
||||
|
||||
<string name="key_fullscreen_conversation">fullscreen_conversations</string>
|
||||
<string name="default_fullscreen_conversation">false</string>
|
||||
|
||||
<string name="key_history_size">history_size</string>
|
||||
<string name="default_history_size">50</string>
|
||||
</resources>
|
||||
|
@ -230,8 +230,6 @@
|
||||
<string name="settings_autocap_sentences_desc">Automatically capitalize the first word of sentences</string>
|
||||
<string name="settings_ime_extract_title">Fullscreen input in landscape</string>
|
||||
<string name="settings_ime_extract_desc">Use fullscreen keyboard when in landscape mode</string>
|
||||
<string name="settings_fullscreen_conversation_title">Fullscreen chats</string>
|
||||
<string name="settings_fullscreen_conversation_desc">Fullscreen the application when chatting</string>
|
||||
<string name="settings_history_size_title">History size</string>
|
||||
<string name="settings_history_size_desc">Number of lines of conversation history to keep</string>
|
||||
</resources>
|
||||
|
@ -114,11 +114,6 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
||||
android:summary="@string/settings_ime_extract_desc"
|
||||
android:key="@string/key_ime_extract"
|
||||
android:defaultValue="@string/default_ime_extract" />
|
||||
<CheckBoxPreference
|
||||
android:title="@string/settings_fullscreen_conversation_title"
|
||||
android:summary="@string/settings_fullscreen_conversation_desc"
|
||||
android:key="@string/key_fullscreen_conversation"
|
||||
android:defaultValue="@string/default_fullscreen_conversation" />
|
||||
<EditTextPreference
|
||||
android:title="@string/settings_history_size_title"
|
||||
android:summary="@string/settings_history_size_desc"
|
||||
|
@ -69,7 +69,6 @@ import android.text.method.TextKeyListener;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
@ -194,10 +193,6 @@ public class ConversationActivity extends SherlockActivity implements ServiceCon
|
||||
|
||||
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);
|
||||
|
@ -30,11 +30,11 @@ import android.preference.PreferenceManager;
|
||||
/**
|
||||
* The settings class is a helper class to access the different preferences via
|
||||
* small and simple methods.
|
||||
*
|
||||
*
|
||||
* Note: As this class carries a Context instance as private member, instances of
|
||||
* this class should be thrown away not later than when the Context should
|
||||
* be gone. Otherwise this could leak memory.
|
||||
*
|
||||
*
|
||||
* @author Sebastian Kaspari <sebastian@yaaic.org>
|
||||
*/
|
||||
public class Settings
|
||||
@ -44,7 +44,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Create a new Settings instance
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public Settings(Context context)
|
||||
@ -55,7 +55,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Prefix all messages with a timestamp?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showTimestamp()
|
||||
@ -68,7 +68,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Show icons to highlight special events
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showIcons()
|
||||
@ -81,7 +81,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Show colors to highlight special events?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean showColors()
|
||||
@ -107,7 +107,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Use 24 hour format for timestamps?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean use24hFormat()
|
||||
@ -120,7 +120,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Is reconnect on disconnect enabled?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isReconnectEnabled()
|
||||
@ -133,7 +133,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Get the reconnect interval
|
||||
*
|
||||
*
|
||||
* @return The reconnect interval in minutes
|
||||
*/
|
||||
public int getReconnectInterval()
|
||||
@ -143,7 +143,7 @@ public class Settings
|
||||
resources.getString(R.string.default_reconnect_interval)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ignore the automatic MOTD?
|
||||
*
|
||||
@ -159,7 +159,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Get the quit message
|
||||
*
|
||||
*
|
||||
* @return The message to display when the user disconnects
|
||||
*/
|
||||
public String getQuitMessage()
|
||||
@ -172,7 +172,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Get the font size
|
||||
*
|
||||
*
|
||||
* @return The font size for conversation messages
|
||||
*/
|
||||
public int getFontSize()
|
||||
@ -185,7 +185,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Is voice recognition enabled?
|
||||
*
|
||||
*
|
||||
* @return True if voice recognition is enabled, false otherwise
|
||||
*/
|
||||
public boolean isVoiceRecognitionEnabled()
|
||||
@ -198,7 +198,7 @@ public class Settings
|
||||
|
||||
/**
|
||||
* Play notification sound on highlight?
|
||||
*
|
||||
*
|
||||
* @return True if sound should be played on highlight, false otherwise
|
||||
*/
|
||||
public boolean isSoundHighlightEnabled()
|
||||
@ -307,17 +307,6 @@ public class Settings
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether conversations should be viewed in Fullscreen glory.
|
||||
*/
|
||||
public boolean fullscreenConversations()
|
||||
{
|
||||
return preferences.getBoolean(
|
||||
resources.getString(R.string.key_fullscreen_conversation),
|
||||
Boolean.parseBoolean(resources.getString(R.string.default_fullscreen_conversation))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the conversation history size.
|
||||
*
|
||||
|
@ -1,148 +0,0 @@
|
||||
/*
|
||||
Yaaic - Yet Another Android IRC Client
|
||||
|
||||
Copyright 2009-2012 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.view;
|
||||
|
||||
import org.yaaic.model.Settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* ConversationLayout: LinearLayout that resizes correctly when an IME
|
||||
* comes up in fullscreen mode
|
||||
*
|
||||
* @author Steven Luo <steven+android@steven676.net>
|
||||
*/
|
||||
public class ConversationLayout extends LinearLayout
|
||||
{
|
||||
private Activity activity;
|
||||
|
||||
int curHeight = 0;
|
||||
boolean fullscreen = false;
|
||||
boolean isLandscape = false;
|
||||
boolean redoLayout = false;
|
||||
|
||||
/**
|
||||
* Create a new conversation linear layout
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public ConversationLayout(Context context)
|
||||
{
|
||||
super(context);
|
||||
doInit(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new conversation linear layout
|
||||
*
|
||||
* @param context
|
||||
* @param attrs
|
||||
*/
|
||||
public ConversationLayout(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
doInit(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the ConversationLayout
|
||||
*/
|
||||
private void doInit(Context context)
|
||||
{
|
||||
activity = (Activity) context;
|
||||
fullscreen = (new Settings(context)).fullscreenConversations();
|
||||
isLandscape = (activity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of the window's visible area
|
||||
*/
|
||||
private int getWindowHeight()
|
||||
{
|
||||
Rect visible = new Rect();
|
||||
getWindowVisibleDisplayFrame(visible);
|
||||
return visible.height();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the height of the view to avoid scrolling and hide UI components
|
||||
* if necessary to save space
|
||||
*
|
||||
* @author Steven Luo <steven+android@steven676.net>
|
||||
* @author Reynaldo Cortorreal <reyncor@gmail.com>
|
||||
*/
|
||||
private void adjustHeight()
|
||||
{
|
||||
int height = getWindowHeight();
|
||||
|
||||
if (!fullscreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
//here to forth the code applies only to full screen
|
||||
if (curHeight != height && height != 0) {
|
||||
curHeight = height;
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.FILL_PARENT,
|
||||
height
|
||||
);
|
||||
|
||||
params.gravity = Gravity.BOTTOM | Gravity.CLIP_VERTICAL;
|
||||
setLayoutParams(params);
|
||||
redoLayout = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onMeasure (ask the view how much space it wants)
|
||||
* This is called when the window size changes, so we can hook into it to
|
||||
* resize ourselves when the IME comes up
|
||||
*/
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||
{
|
||||
adjustHeight();
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* onDraw (draw the view)
|
||||
*/
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas)
|
||||
{
|
||||
if (redoLayout) {
|
||||
// Layout params have changed -- force a layout update
|
||||
requestLayout();
|
||||
redoLayout = false;
|
||||
}
|
||||
super.onDraw(canvas);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user