Skip to content
Snippets Groups Projects
Commit 2ff33731 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Added formatting menu

parent 42421cd5
No related branches found
No related tags found
No related merge requests found
Showing
with 79 additions and 21 deletions
......@@ -2,6 +2,14 @@ apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
dependencies {
repositories {
flatDir {
dirs 'libs'
}
}
}
if (project.hasProperty("storeFile")) {
android {
signingConfigs {
......@@ -104,7 +112,7 @@ dependencies {
compile 'joda-time:joda-time:2.9.1'
compile 'org.joda:joda-convert:1.8'
compile 'com.bignerdranch.android:expandablerecyclerview:2.0.4'
compile 'com.sothree.slidinguppanel:library:3.2.1'
compile(name:'asup-release', ext:'aar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
......@@ -112,8 +120,8 @@ dependencies {
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile files('libs/aspm-annotations.jar')
apt files('libs/aspm-compiler.jar')
compile(name:'aspm-annotations', ext:'jar')
apt(name:'aspm-compiler', ext:'jar')
compile 'com.jakewharton:butterknife:8.0.0-SNAPSHOT'
apt 'com.jakewharton:butterknife-compiler:8.0.0-SNAPSHOT'
......
......@@ -9,7 +9,6 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true">
<service android:name=".service.QuasselService" />
<activity
......@@ -19,10 +18,10 @@
android:theme="@style/AppTheme.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
......@@ -30,6 +30,7 @@ import de.kuschku.libquassel.primitives.types.QVariant;
import de.kuschku.libquassel.syncables.types.BufferSyncer;
import de.kuschku.libquassel.syncables.types.BufferViewConfig;
import de.kuschku.libquassel.syncables.types.BufferViewManager;
import de.kuschku.libquassel.syncables.types.Identity;
import de.kuschku.libquassel.syncables.types.IgnoreListManager;
import de.kuschku.libquassel.syncables.types.IrcChannel;
import de.kuschku.libquassel.syncables.types.IrcUser;
......@@ -65,6 +66,7 @@ public class Client {
private BufferSyncer bufferSyncer;
private ClientData clientData;
private IgnoreListManager ignoreListManager;
private Map<Integer, Identity> Identities = new HashMap<>();
public Client(@NonNull final BusProvider busProvider) {
this(new SimpleBacklogManager(busProvider), busProvider);
......@@ -286,4 +288,12 @@ public class Client {
public void setIgnoreListManager(IgnoreListManager ignoreListManager) {
this.ignoreListManager = ignoreListManager;
}
public void addIdentity(int id, Identity identity) {
Identities.put(id, identity);
}
public Identity getIdentity(int id) {
return Identities.get(id);
}
}
......@@ -259,7 +259,7 @@ public class Identity extends SyncableObject<Identity> {
@Override
public void init(@NonNull InitDataFunction function, @NonNull BusProvider provider, @NonNull Client client) {
client.addIdentity(Integer.valueOf(function.objectName), this);
}
@Override
......
......@@ -10,23 +10,31 @@ import android.support.annotation.IntRange;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.NestedScrollView;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.ActionMenuView;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatImageButton;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
import android.widget.Scroller;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.common.base.Splitter;
import com.mikepenz.fastadapter.FastAdapter;
import com.mikepenz.fastadapter.IExpandable;
import com.mikepenz.fastadapter.IItem;
import com.mikepenz.fastadapter.adapters.ItemAdapter;
import com.mikepenz.materialdrawer.AccountHeader;
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
import com.mikepenz.materialdrawer.Drawer;
......@@ -34,6 +42,7 @@ import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.sothree.slidinguppanel.ScrollableViewHelper;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import java.util.Map;
......@@ -78,6 +87,8 @@ public class ChatActivity extends AppCompatActivity {
@Bind(R.id.sliding_layout)
SlidingUpPanelLayout slidingLayout;
@Bind(R.id.chatlineScroller)
ScrollView chatlineScroller;
@Bind(R.id.chatline)
AppCompatEditText chatline;
@Bind(R.id.send)
......@@ -91,6 +102,9 @@ public class ChatActivity extends AppCompatActivity {
@Bind(R.id.messages)
RecyclerView messages;
@Bind(R.id.amvMenu)
ActionMenuView formattingMenu;
@PreferenceWrapper(BuildConfig.APPLICATION_ID)
public static abstract class Settings {
@StringPreference("QUASSEL_LIGHT")
......@@ -216,12 +230,35 @@ public class ChatActivity extends AppCompatActivity {
}
});
getMenuInflater().inflate(R.menu.formatting,formattingMenu.getMenu());
messages.setItemAnimator(new DefaultItemAnimator());
messages.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, true));
messageAdapter = new MessageAdapter(this, context, new AutoScroller(messages));
messages.setAdapter(messageAdapter);
msgHistory.setAdapter(new FastAdapter<>());
FastAdapter<IItem> fastAdapter = new FastAdapter<>();
ItemAdapter<IItem> itemAdapter = new ItemAdapter<>();
itemAdapter.wrap(fastAdapter);
itemAdapter.add(
new PrimaryDrawerItem().withName("Entry #1"),
new PrimaryDrawerItem().withName("Entry #2"),
new PrimaryDrawerItem().withName("Entry #3"),
new PrimaryDrawerItem().withName("Entry #4"),
new PrimaryDrawerItem().withName("Entry #5"),
new PrimaryDrawerItem().withName("Entry #6"),
new PrimaryDrawerItem().withName("Entry #7"),
new PrimaryDrawerItem().withName("Entry #8"),
new PrimaryDrawerItem().withName("Entry #9"),
new PrimaryDrawerItem().withName("Entry #10"),
new PrimaryDrawerItem().withName("Entry #11"),
new PrimaryDrawerItem().withName("Entry #12"),
new PrimaryDrawerItem().withName("Entry #13"),
new PrimaryDrawerItem().withName("Entry #14"),
new PrimaryDrawerItem().withName("Entry #15"),
new PrimaryDrawerItem().withName("Entry #16")
);
msgHistory.setAdapter(fastAdapter);
msgHistory.setLayoutManager(new LinearLayoutManager(this));
msgHistory.setItemAnimator(new DefaultItemAnimator());
......@@ -233,6 +270,7 @@ public class ChatActivity extends AppCompatActivity {
send.setOnClickListener(view -> sendInput());
slidingLayout.setAntiDragView(R.id.card_panel);
slidingLayout.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
......@@ -241,24 +279,12 @@ public class ChatActivity extends AppCompatActivity {
@Override
public void onPanelCollapsed(View panel) {
int selectionStart = chatline.getSelectionStart();
int selectionEnd = chatline.getSelectionEnd();
chatline.getLayoutParams().height =context.getThemeUtil().res.actionBarSize;
chatline.setSingleLine(true);
chatline.setSelection(selectionStart, selectionEnd);
setChatlineExpanded(false);
}
@Override
public void onPanelExpanded(View panel) {
int selectionStart = chatline.getSelectionStart();
int selectionEnd = chatline.getSelectionEnd();
chatline.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
chatline.setSingleLine(false);
chatline.setSelection(selectionStart, selectionEnd);
setChatlineExpanded(true);
}
@Override
......@@ -271,6 +297,21 @@ public class ChatActivity extends AppCompatActivity {
}
});
setChatlineExpanded(slidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED);
}
public void setChatlineExpanded(boolean expanded) {
int selectionStart = chatline.getSelectionStart();
int selectionEnd = chatline.getSelectionEnd();
if (expanded) {
chatlineScroller.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
chatlineScroller.getLayoutParams().height = context.getThemeUtil().res.actionBarSize;
}
chatline.setSingleLine(!expanded);
chatline.setSelection(selectionStart, selectionEnd);
}
public void showThemeDialog() {
......
app/src/main/res/drawable-hdpi/ic_format_bold_dark.png

432 B

app/src/main/res/drawable-hdpi/ic_format_bold_light.png

543 B

app/src/main/res/drawable-hdpi/ic_format_fill_dark.png

435 B

app/src/main/res/drawable-hdpi/ic_format_fill_light.png

642 B

app/src/main/res/drawable-hdpi/ic_format_italic_dark.png

319 B

app/src/main/res/drawable-hdpi/ic_format_italic_light.png

428 B

app/src/main/res/drawable-hdpi/ic_format_paint_dark.png

301 B

app/src/main/res/drawable-hdpi/ic_format_paint_light.png

316 B

app/src/main/res/drawable-hdpi/ic_format_underline_dark.png

424 B

app/src/main/res/drawable-hdpi/ic_format_underline_light.png

529 B

app/src/main/res/drawable-mdpi/ic_format_bold_dark.png

316 B

app/src/main/res/drawable-mdpi/ic_format_bold_light.png

375 B

app/src/main/res/drawable-mdpi/ic_format_fill_dark.png

303 B

app/src/main/res/drawable-mdpi/ic_format_fill_light.png

453 B

app/src/main/res/drawable-mdpi/ic_format_italic_dark.png

273 B

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment