Skip to content

Commit

Permalink
Fullscreen chat implementation. pans window instead of resizing, not …
Browse files Browse the repository at this point in the history
…easly fixable
  • Loading branch information
Rey Rey authored and pocmo committed Jul 2, 2011
1 parent a5d81a1 commit 93e77ea
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/res/layout/conversations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="textImeMultiLine"
android:imeOptions="actionSend" />
android:imeOptions="actionSend|flagNoExtractUi" />
<Button
android:id="@+id/speech"
android:layout_width="wrap_content"
Expand Down
3 changes: 3 additions & 0 deletions application/res/values/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<string name="key_autocap_sentences">autocap_sentences</string>
<string name="default_autocap_sentences">false</string>

<string name="key_fullscreen_conversation">fullscreen conversation</string>
<string name="default_fullscreen_conversation">false</string>

<string name="key_history_size">history_size</string>
<string name="default_history_size">30</string>
</resources>
2 changes: 2 additions & 0 deletions application/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@
<string name="settings_autocorrect_text_desc">Use dictionary to autocorrect typed text in chat</string>
<string name="settings_autocap_sentences_title">Auto-capitalize sentences</string>
<string name="settings_autocap_sentences_desc">Automatically capitalize the first word of sentences</string>
<string name="settings_fullscreen_conversation_title">Fullscreen chat window</string>
<string name="settings_fullscreen_conversation_desc">Automatically fullscreen the conversation when focused</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>
5 changes: 5 additions & 0 deletions application/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
android:summary="@string/settings_autocap_sentences_desc"
android:key="@string/key_autocap_sentences"
android:defaultValue="@string/default_autocap_sentences" />
<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"
Expand Down
6 changes: 5 additions & 1 deletion application/src/org/yaaic/activity/ConversationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnKeyListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
Expand Down Expand Up @@ -179,6 +180,7 @@ protected void onCreate(Bundle savedInstanceState)

serverId = getIntent().getExtras().getInt("serverId");
server = Yaaic.getInstance().getServerById(serverId);
Settings settings = new Settings(this);

// Finish activity if server does not exist anymore - See #55
if (server == null) {
Expand All @@ -188,6 +190,9 @@ protected void onCreate(Bundle savedInstanceState)
setTitle("Yaaic - " + server.getTitle());

setContentView(R.layout.conversations);
if (settings.fullscreenConversations()){
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

boolean isLandscape = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);

Expand All @@ -208,7 +213,6 @@ protected void onCreate(Bundle savedInstanceState)
deck.setOnItemClickListener(new ConversationClickListener(deckAdapter, switcher));
deck.setBackgroundDrawable(new NonScalingBackgroundDrawable(this, deck, R.drawable.background));

Settings settings = new Settings(this);
historySize = settings.getHistorySize();

if (server.getStatus() == Status.PRE_CONNECTING) {
Expand Down
11 changes: 11 additions & 0 deletions application/src/org/yaaic/model/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,17 @@ public boolean autoCapSentences()
);
}

/**
* 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.
*
Expand Down

0 comments on commit 93e77ea

Please sign in to comment.