diff --git a/app/build.gradle b/app/build.gradle
index 478dfa2..7532455 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -23,7 +23,8 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
- compile "com.android.support:recyclerview-v7:22.0.0"
+ compile 'com.android.support:recyclerview-v7:22.0.0'
+ compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.viewpagerindicator:library:2.4.1@aar'
}
diff --git a/app/src/main/java/org/yaaic/activity/ConversationActivity.java b/app/src/main/java/org/yaaic/activity/ConversationActivity.java
index 771a0ee..bad15c0 100644
--- a/app/src/main/java/org/yaaic/activity/ConversationActivity.java
+++ b/app/src/main/java/org/yaaic/activity/ConversationActivity.java
@@ -1,7 +1,7 @@
/*
Yaaic - Yet Another Android IRC Client
-Copyright 2009-2013 Sebastian Kaspari
+Copyright 2009-2015 Sebastian Kaspari
This file is part of Yaaic.
@@ -20,8 +20,6 @@ along with Yaaic. If not, see .
*/
package org.yaaic.activity;
-import android.app.ActionBar;
-import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.DialogInterface;
@@ -37,6 +35,8 @@ import android.os.Handler;
import android.os.IBinder;
import android.speech.RecognizerIntent;
import android.support.v4.view.ViewPager;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.text.method.TextKeyListener;
import android.view.KeyEvent;
@@ -86,7 +86,7 @@ import java.util.List;
*
* @author Sebastian Kaspari
*/
-public class ConversationActivity extends Activity implements ServiceConnection, ServerListener, ConversationListener
+public class ConversationActivity extends ActionBarActivity implements ServiceConnection, ServerListener, ConversationListener
{
public static final int REQUEST_CODE_SPEECH = 99;
@@ -187,13 +187,15 @@ public class ConversationActivity extends Activity implements ServiceConnection,
this.finish();
}
- ActionBar actionBar = getActionBar();
- actionBar.setDisplayHomeAsUpEnabled(true);
- actionBar.setElevation(0);
-
setTitle(server.getTitle());
- setContentView(R.layout.conversations);
+ setContentView(R.layout.activity_conversations);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ toolbar.setElevation(0);
+ setSupportActionBar(toolbar);
+
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
boolean isLandscape = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
@@ -411,12 +413,8 @@ public class ConversationActivity extends Activity implements ServiceConnection,
return true;
}
- /**
- * On menu item selected
- */
@Override
- public boolean onMenuItemSelected(int featureId, MenuItem item)
- {
+ public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
diff --git a/app/src/main/java/org/yaaic/activity/MainActivity.java b/app/src/main/java/org/yaaic/activity/MainActivity.java
index 7e9ff91..c878d4e 100644
--- a/app/src/main/java/org/yaaic/activity/MainActivity.java
+++ b/app/src/main/java/org/yaaic/activity/MainActivity.java
@@ -18,14 +18,18 @@ 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 .
*/
-package org.yaaic.activity;
+package org.yaaic.a ctivity;
-import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
+import android.support.v4.widget.DrawerLayout;
+import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuItem;
import org.yaaic.R;
import org.yaaic.fragment.OverviewFragment;
@@ -38,7 +42,8 @@ import org.yaaic.model.Status;
/**
* The main activity of Yaaic. We'll add, remove and replace fragments here.
*/
-public class MainActivity extends Activity implements OverviewFragment.Callback, ServiceConnection {
+public class MainActivity extends ActionBarActivity implements OverviewFragment.Callback, ServiceConnection {
+ private ActionBarDrawerToggle toggle;
private IRCBinder binder;
@Override
@@ -46,6 +51,21 @@ public class MainActivity extends Activity implements OverviewFragment.Callback,
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+
+ DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer);
+ toggle = new ActionBarDrawerToggle(this, drawer, toolbar, 0, 0);
+
+ drawer.setDrawerListener(toggle);
+ }
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+
+ toggle.syncState();
}
@Override
@@ -70,6 +90,15 @@ public class MainActivity extends Activity implements OverviewFragment.Callback,
unbindService(this);
}
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (toggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+
+ return false;
+ }
+
@Override
public void onServerSelected(Server server) {
Intent intent = new Intent(this, ConversationActivity.class);
diff --git a/app/src/main/java/org/yaaic/view/ScrimInsetsFrameLayout.java b/app/src/main/java/org/yaaic/view/ScrimInsetsFrameLayout.java
new file mode 100644
index 0000000..d9dd944
--- /dev/null
+++ b/app/src/main/java/org/yaaic/view/ScrimInsetsFrameLayout.java
@@ -0,0 +1,142 @@
+package org.yaaic.view;
+
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.support.v4.view.ViewCompat;
+import android.util.AttributeSet;
+import android.widget.FrameLayout;
+
+import org.yaaic.R;
+
+/**
+ * A layout that draws something in the insets passed to {@link #fitSystemWindows(Rect)}, i.e. the area above UI chrome
+ * (status and navigation bars, overlay action bars).
+ */
+public class ScrimInsetsFrameLayout extends FrameLayout {
+ private Drawable mInsetForeground;
+
+ private Rect mInsets;
+ private Rect mTempRect = new Rect();
+ private OnInsetsCallback mOnInsetsCallback;
+
+ public ScrimInsetsFrameLayout(Context context) {
+ super(context);
+ init(context, null, 0);
+ }
+
+ public ScrimInsetsFrameLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init(context, attrs, 0);
+ }
+
+ public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init(context, attrs, defStyle);
+ }
+
+ private void init(Context context, AttributeSet attrs, int defStyle) {
+ final TypedArray a = context.obtainStyledAttributes(attrs,
+ R.styleable.ScrimInsetsView, defStyle, 0);
+ if (a == null) {
+ return;
+ }
+ mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForeground);
+ a.recycle();
+
+ setWillNotDraw(true);
+ }
+
+ @Override
+ protected boolean fitSystemWindows(Rect insets) {
+ mInsets = new Rect(insets);
+ setWillNotDraw(mInsetForeground == null);
+ ViewCompat.postInvalidateOnAnimation(this);
+ if (mOnInsetsCallback != null) {
+ mOnInsetsCallback.onInsetsChanged(insets);
+ }
+ return true; // consume insets
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ super.draw(canvas);
+
+ int width = getWidth();
+ int height = getHeight();
+ if (mInsets != null && mInsetForeground != null) {
+ int sc = canvas.save();
+ canvas.translate(getScrollX(), getScrollY());
+
+ // Top
+ mTempRect.set(0, 0, width, mInsets.top);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ // Bottom
+ mTempRect.set(0, height - mInsets.bottom, width, height);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ // Left
+ mTempRect.set(0, mInsets.top, mInsets.left, height - mInsets.bottom);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ // Right
+ mTempRect.set(width - mInsets.right, mInsets.top, width, height - mInsets.bottom);
+ mInsetForeground.setBounds(mTempRect);
+ mInsetForeground.draw(canvas);
+
+ canvas.restoreToCount(sc);
+ }
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ if (mInsetForeground != null) {
+ mInsetForeground.setCallback(this);
+ }
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ if (mInsetForeground != null) {
+ mInsetForeground.setCallback(null);
+ }
+ }
+
+ /**
+ * Allows the calling container to specify a callback for custom processing when insets change (i.e. when
+ * {@link #fitSystemWindows(Rect)} is called. This is useful for setting padding on UI elements based on
+ * UI chrome insets (e.g. a Google Map or a ListView). When using with ListView or GridView, remember to set
+ * clipToPadding to false.
+ */
+ public void setOnInsetsCallback(OnInsetsCallback onInsetsCallback) {
+ mOnInsetsCallback = onInsetsCallback;
+ }
+
+ public static interface OnInsetsCallback {
+ public void onInsetsChanged(Rect insets);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_conversations.xml b/app/src/main/res/layout/activity_conversations.xml
new file mode 100644
index 0000000..15f40e7
--- /dev/null
+++ b/app/src/main/res/layout/activity_conversations.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 624ecd0..54f66e9 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,10 +1,51 @@
-.
+-->
+
-
+
+
-
\ No newline at end of file
+ android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/conversations.xml b/app/src/main/res/layout/conversations.xml
deleted file mode 100644
index 3eb6d83..0000000
--- a/app/src/main/res/layout/conversations.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/item_drawer.xml b/app/src/main/res/layout/item_drawer.xml
new file mode 100644
index 0000000..c7d3058
--- /dev/null
+++ b/app/src/main/res/layout/item_drawer.xml
@@ -0,0 +1,30 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_toolbar.xml b/app/src/main/res/layout/item_toolbar.xml
new file mode 100644
index 0000000..0804a33
--- /dev/null
+++ b/app/src/main/res/layout/item_toolbar.xml
@@ -0,0 +1,32 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..fdfa098
--- /dev/null
+++ b/app/src/main/res/values/attrs.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 53dabc1..81f20f2 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,11 +1,13 @@
-