diff options
Diffstat (limited to 'src/main')
30 files changed, 420 insertions, 31 deletions
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 9f9787bf4..f98122d0d 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -241,6 +241,9 @@ </intent-filter> </activity> <activity + android:name=".ui.SearchActivity" + android:label="@string/title_activity_search" /> + <activity android:name=".ui.ShowFullscreenMessageActivity" android:configChanges="orientation|screenSize" android:theme="@style/ConversationsTheme.FullScreen"></activity> diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index def3c00f6..371bdb5e5 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -118,6 +118,7 @@ import rocks.xmpp.addr.Jid; import static de.pixart.messenger.ui.XmppActivity.EXTRA_ACCOUNT; import static de.pixart.messenger.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION; +import static de.pixart.messenger.ui.util.SoftKeyboardUtils.hideSoftKeyboard; import static de.pixart.messenger.xmpp.Patches.ENCRYPTION_EXCEPTIONS; public class ConversationFragment extends XmppFragment implements EditMessage.KeyboardListener { @@ -612,14 +613,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke return null; } - private static void hideSoftKeyboard(final Activity activity) { - InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); - View view = activity.getCurrentFocus(); - if (view != null && imm != null) { - imm.hideSoftInputFromWindow(view.getWindowToken(), 0); - } - } - private static boolean scrolledToBottom(AbsListView listView) { final int count = listView.getCount(); if (count == 0) { diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java index 6c478e92f..63dc9b699 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsOverviewFragment.java @@ -31,11 +31,15 @@ package de.pixart.messenger.ui; import android.app.Activity; import android.app.Fragment; +import android.content.Intent; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.util.Log; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -51,6 +55,7 @@ import de.pixart.messenger.ui.interfaces.OnConversationSelected; import de.pixart.messenger.ui.util.PendingActionHelper; import de.pixart.messenger.ui.util.PendingItem; import de.pixart.messenger.ui.util.ScrollState; +import de.pixart.messenger.utils.MenuDoubleTabUtil; public class ConversationsOverviewFragment extends XmppFragment { @@ -127,11 +132,15 @@ public class ConversationsOverviewFragment extends XmppFragment { } @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - Log.d(Config.LOGTAG, "onCreateView"); this.binding = DataBindingUtil.inflate(inflater, R.layout.fragment_conversations_overview, container, false); this.binding.fab.setOnClickListener((view) -> StartConversationActivity.launch(getActivity())); - this.conversationsAdapter = new ConversationAdapter(this.activity, this.conversations); this.conversationsAdapter.setConversationClickListener((view, conversation) -> { if (activity instanceof OnConversationSelected) { @@ -147,6 +156,11 @@ public class ConversationsOverviewFragment extends XmppFragment { } @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { + menuInflater.inflate(R.menu.fragment_conversations_overview, menu); + } + + @Override public void onBackendConnected() { refresh(); } @@ -190,6 +204,19 @@ public class ConversationsOverviewFragment extends XmppFragment { } @Override + public boolean onOptionsItemSelected(final MenuItem item) { + if (MenuDoubleTabUtil.shouldIgnoreTap()) { + return false; + } + switch (item.getItemId()) { + case R.id.action_search: + startActivity(new Intent(getActivity(), SearchActivity.class)); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override void refresh() { if (this.binding == null || this.activity == null) { Log.d(Config.LOGTAG, "ConversationsOverviewFragment.refresh() skipped updated because view binding or activity was null"); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 7aa352342..407a967a7 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -64,6 +64,7 @@ import de.pixart.messenger.services.XmppConnectionService.OnCaptchaRequested; import de.pixart.messenger.ui.adapter.KnownHostsAdapter; import de.pixart.messenger.ui.adapter.PresenceTemplateAdapter; import de.pixart.messenger.ui.util.PendingItem; +import de.pixart.messenger.ui.util.SoftKeyboardUtils; import de.pixart.messenger.utils.CryptoHelper; import de.pixart.messenger.utils.MenuDoubleTabUtil; import de.pixart.messenger.utils.UIHelper; @@ -401,7 +402,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat protected void finishInitialSetup(final Avatar avatar) { runOnUiThread(() -> { - hideKeyboard(); + SoftKeyboardUtils.hideSoftKeyboard(EditAccountActivity.this); final Intent intent; final XmppConnection connection = mAccount.getXmppConnection(); final boolean wasFirstAccount = xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1; diff --git a/src/main/java/de/pixart/messenger/ui/SearchActivity.java b/src/main/java/de/pixart/messenger/ui/SearchActivity.java new file mode 100644 index 000000000..152544c7e --- /dev/null +++ b/src/main/java/de/pixart/messenger/ui/SearchActivity.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2018, Daniel Gultsch All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package de.pixart.messenger.ui; + +import android.databinding.DataBindingUtil; +import android.os.Bundle; +import android.support.v7.widget.Toolbar; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.EditText; + +import java.util.ArrayList; +import java.util.List; + +import de.pixart.messenger.Config; +import de.pixart.messenger.R; +import de.pixart.messenger.databinding.ActivitySearchBinding; +import de.pixart.messenger.entities.Message; +import de.pixart.messenger.ui.adapter.MessageAdapter; + +import static de.pixart.messenger.ui.util.SoftKeyboardUtils.hideSoftKeyboard; +import static de.pixart.messenger.ui.util.SoftKeyboardUtils.showKeyboard; + +public class SearchActivity extends XmppActivity implements TextWatcher { + + private final List<Message> messages = new ArrayList<>(); + private ActivitySearchBinding binding; + private MessageAdapter messageListAdapter; + + @Override + public void onCreate(final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + this.binding = DataBindingUtil.setContentView(this, R.layout.activity_search); + setSupportActionBar((Toolbar) this.binding.toolbar); + configureActionBar(getSupportActionBar()); + this.messageListAdapter = new MessageAdapter(this, this.messages); + this.binding.searchResults.setAdapter(messageListAdapter); + } + + @Override + public boolean onCreateOptionsMenu(final Menu menu) { + getMenuInflater().inflate(R.menu.activity_search, menu); + MenuItem searchActionMenuItem = menu.findItem(R.id.action_search); + EditText searchField = searchActionMenuItem.getActionView().findViewById(R.id.search_field); + searchField.addTextChangedListener(this); + searchField.setHint(R.string.search_messages); + showKeyboard(searchField); + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + hideSoftKeyboard(this); + } + return super.onOptionsItemSelected(item); + } + + @Override + protected void refreshUiReal() { + + } + + @Override + void onBackendConnected() { + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + Log.d(Config.LOGTAG, "searching for " + s); + } + +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 70995e8d2..8f153be6f 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -71,6 +71,7 @@ import de.pixart.messenger.services.XmppConnectionService.OnRosterUpdate; import de.pixart.messenger.ui.adapter.ListItemAdapter; import de.pixart.messenger.ui.interfaces.OnBackendConnected; import de.pixart.messenger.ui.util.PendingItem; +import de.pixart.messenger.ui.util.SoftKeyboardUtils; import de.pixart.messenger.utils.MenuDoubleTabUtil; import de.pixart.messenger.utils.XmppUri; import de.pixart.messenger.xmpp.OnUpdateBlocklist; @@ -118,7 +119,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override public boolean onMenuItemActionCollapse(MenuItem item) { - hideKeyboard(); + SoftKeyboardUtils.hideSoftKeyboard(StartConversationActivity.this); mSearchEditText.setText(""); filter(null); return true; @@ -188,7 +189,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne return true; } } - hideKeyboard(); + SoftKeyboardUtils.hideSoftKeyboard(StartConversationActivity.this); mListPagerAdapter.requestFocus(pos); return true; } @@ -345,6 +346,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne protected void openConversationForContact(Contact contact) { Conversation conversation = xmppConnectionService.findOrCreateConversation(contact.getAccount(), contact.getJid(), false, true); + SoftKeyboardUtils.hideSoftKeyboard(this); switchToConversation(conversation); } @@ -386,6 +388,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne bookmark.setAutojoin(true); xmppConnectionService.pushBookmarks(bookmark.getAccount()); } + SoftKeyboardUtils.hideSoftKeyboard(this); switchToConversation(conversation); } diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 0b425c0d8..991111634 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -45,7 +45,6 @@ import android.util.Pair; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.Spinner; @@ -266,16 +265,6 @@ public abstract class XmppActivity extends ActionBarActivity { } } - protected void hideKeyboard() { - final InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - - View focus = getCurrentFocus(); - - if (focus != null && inputManager != null) { - inputManager.hideSoftInputFromWindow(focus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); - } - } - public boolean hasPgp() { return xmppConnectionService.getPgpEngine() != null; } diff --git a/src/main/java/de/pixart/messenger/ui/util/SoftKeyboardUtils.java b/src/main/java/de/pixart/messenger/ui/util/SoftKeyboardUtils.java new file mode 100644 index 000000000..b92a020b0 --- /dev/null +++ b/src/main/java/de/pixart/messenger/ui/util/SoftKeyboardUtils.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018, Daniel Gultsch All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package de.pixart.messenger.ui.util; + +import android.app.Activity; +import android.content.Context; +import android.view.View; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; + +public class SoftKeyboardUtils { + + public static void hideSoftKeyboard(final Activity activity) { + InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm == null) { + return; + } + View view = activity.getCurrentFocus(); + if (view == null) { + view = new View(activity); + } + imm.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + + public static void showKeyboard(EditText editText) { + editText.requestFocus(); + InputMethodManager inputMethodManager = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + if (inputMethodManager != null) { + inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); + } + } +}
\ No newline at end of file diff --git a/src/main/res/drawable-hdpi/ic_search_background_black.png b/src/main/res/drawable-hdpi/ic_search_background_black.png Binary files differnew file mode 100644 index 000000000..85db4f1d2 --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_search_background_black.png diff --git a/src/main/res/drawable-hdpi/ic_search_background_white.png b/src/main/res/drawable-hdpi/ic_search_background_white.png Binary files differnew file mode 100644 index 000000000..6ea523d3d --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_search_background_white.png diff --git a/src/main/res/drawable-mdpi/ic_search_background_black.png b/src/main/res/drawable-mdpi/ic_search_background_black.png Binary files differnew file mode 100644 index 000000000..9d40a03ee --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_search_background_black.png diff --git a/src/main/res/drawable-mdpi/ic_search_background_white.png b/src/main/res/drawable-mdpi/ic_search_background_white.png Binary files differnew file mode 100644 index 000000000..6b63fbd99 --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_search_background_white.png diff --git a/src/main/res/drawable-xhdpi/ic_search_background_black.png b/src/main/res/drawable-xhdpi/ic_search_background_black.png Binary files differnew file mode 100644 index 000000000..bf9283d3d --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_search_background_black.png diff --git a/src/main/res/drawable-xhdpi/ic_search_background_white.png b/src/main/res/drawable-xhdpi/ic_search_background_white.png Binary files differnew file mode 100644 index 000000000..60ad729b0 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_search_background_white.png diff --git a/src/main/res/drawable-xxhdpi/ic_search_background_black.png b/src/main/res/drawable-xxhdpi/ic_search_background_black.png Binary files differnew file mode 100644 index 000000000..97be6790a --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_search_background_black.png diff --git a/src/main/res/drawable-xxhdpi/ic_search_background_white.png b/src/main/res/drawable-xxhdpi/ic_search_background_white.png Binary files differnew file mode 100644 index 000000000..f71fe7e2d --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_search_background_white.png diff --git a/src/main/res/drawable-xxxhdpi/ic_search_background_black.png b/src/main/res/drawable-xxxhdpi/ic_search_background_black.png Binary files differnew file mode 100644 index 000000000..37d065fd7 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_search_background_black.png diff --git a/src/main/res/drawable-xxxhdpi/ic_search_background_white.png b/src/main/res/drawable-xxxhdpi/ic_search_background_white.png Binary files differnew file mode 100644 index 000000000..7bf84c8d9 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_search_background_white.png diff --git a/src/main/res/drawable/search_background_dark.xml b/src/main/res/drawable/search_background_dark.xml new file mode 100644 index 000000000..cb42396b4 --- /dev/null +++ b/src/main/res/drawable/search_background_dark.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (c) 2018, Daniel Gultsch All rights reserved. + ~ + ~ Redistribution and use in source and binary forms, with or without modification, + ~ are permitted provided that the following conditions are met: + ~ + ~ 1. Redistributions of source code must retain the above copyright notice, this + ~ list of conditions and the following disclaimer. + ~ + ~ 2. Redistributions in binary form must reproduce the above copyright notice, + ~ this list of conditions and the following disclaimer in the documentation and/or + ~ other materials provided with the distribution. + ~ + ~ 3. Neither the name of the copyright holder nor the names of its contributors + ~ may be used to endorse or promote products derived from this software without + ~ specific prior written permission. + ~ + ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + ~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + ~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + ~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:drawable="@color/grey800" /> + + <item> + <bitmap + android:alpha="0.12" + android:gravity="center" + android:src="@drawable/ic_search_background_white" /> + </item> +</layer-list>
\ No newline at end of file diff --git a/src/main/res/drawable/search_background_light.xml b/src/main/res/drawable/search_background_light.xml new file mode 100644 index 000000000..aecd39e9a --- /dev/null +++ b/src/main/res/drawable/search_background_light.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (c) 2018, Daniel Gultsch All rights reserved. + ~ + ~ Redistribution and use in source and binary forms, with or without modification, + ~ are permitted provided that the following conditions are met: + ~ + ~ 1. Redistributions of source code must retain the above copyright notice, this + ~ list of conditions and the following disclaimer. + ~ + ~ 2. Redistributions in binary form must reproduce the above copyright notice, + ~ this list of conditions and the following disclaimer in the documentation and/or + ~ other materials provided with the distribution. + ~ + ~ 3. Neither the name of the copyright holder nor the names of its contributors + ~ may be used to endorse or promote products derived from this software without + ~ specific prior written permission. + ~ + ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + ~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + ~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + ~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:drawable="@color/grey50" /> + + <item> + <bitmap + android:alpha="0.12" + android:gravity="center" + android:src="@drawable/ic_search_background_black" /> + </item> +</layer-list>
\ No newline at end of file diff --git a/src/main/res/drawable/white_cursor.xml b/src/main/res/drawable/white_cursor.xml new file mode 100644 index 000000000..d89e81235 --- /dev/null +++ b/src/main/res/drawable/white_cursor.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (c) 2018, Daniel Gultsch All rights reserved. + ~ + ~ Redistribution and use in source and binary forms, with or without modification, + ~ are permitted provided that the following conditions are met: + ~ + ~ 1. Redistributions of source code must retain the above copyright notice, this + ~ list of conditions and the following disclaimer. + ~ + ~ 2. Redistributions in binary form must reproduce the above copyright notice, + ~ this list of conditions and the following disclaimer in the documentation and/or + ~ other materials provided with the distribution. + ~ + ~ 3. Neither the name of the copyright holder nor the names of its contributors + ~ may be used to endorse or promote products derived from this software without + ~ specific prior written permission. + ~ + ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + ~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + ~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + ~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <size android:width="1.75dp" /> + <solid android:color="@color/white87" /> +</shape>
\ No newline at end of file diff --git a/src/main/res/layout/activity_search.xml b/src/main/res/layout/activity_search.xml index eaafdf291..9fc9d15d5 100644 --- a/src/main/res/layout/activity_search.xml +++ b/src/main/res/layout/activity_search.xml @@ -43,7 +43,7 @@ android:id="@+id/search_results" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="?attr/color_background_secondary" + android:background="?attr/activity_background_search" android:divider="@android:color/transparent" android:dividerHeight="0dp" /> </LinearLayout> diff --git a/src/main/res/menu/activity_conversations.xml b/src/main/res/menu/activity_conversations.xml index a396194c6..4f19bcbdd 100644 --- a/src/main/res/menu/activity_conversations.xml +++ b/src/main/res/menu/activity_conversations.xml @@ -4,6 +4,7 @@ <item android:id="@+id/action_scan_qr_code" android:icon="?attr/icon_scan_qr_code" + android:orderInCategory="10" android:title="@string/scan_qr_code" android:visible="@bool/show_qr_code_scan" app:showAsAction="always" /> @@ -19,12 +20,12 @@ app:showAsAction="never" /> <item android:id="@+id/action_check_updates" - app:showAsAction="never" - android:title="@string/action_check_update" /> + android:title="@string/action_check_update" + app:showAsAction="never" /> <item android:id="@+id/action_invite_user" android:orderInCategory="100" - app:showAsAction="never" - android:title="@string/invite_user" /> + android:title="@string/invite_user" + app:showAsAction="never" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/activity_search.xml b/src/main/res/menu/activity_search.xml new file mode 100644 index 000000000..b758b0554 --- /dev/null +++ b/src/main/res/menu/activity_search.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + ~ Copyright (c) 2018, Daniel Gultsch All rights reserved. + ~ + ~ Redistribution and use in source and binary forms, with or without modification, + ~ are permitted provided that the following conditions are met: + ~ + ~ 1. Redistributions of source code must retain the above copyright notice, this + ~ list of conditions and the following disclaimer. + ~ + ~ 2. Redistributions in binary form must reproduce the above copyright notice, + ~ this list of conditions and the following disclaimer in the documentation and/or + ~ other materials provided with the distribution. + ~ + ~ 3. Neither the name of the copyright holder nor the names of its contributors + ~ may be used to endorse or promote products derived from this software without + ~ specific prior written permission. + ~ + ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + ~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + ~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + ~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> + +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <item + android:id="@+id/action_search" + android:icon="?attr/icon_search" + android:title="@string/search" + app:actionLayout="@layout/actionview_search" + app:showAsAction="always" /> +</menu>
\ No newline at end of file diff --git a/src/main/res/menu/fragment_conversations_overview.xml b/src/main/res/menu/fragment_conversations_overview.xml new file mode 100644 index 000000000..2d37afd1b --- /dev/null +++ b/src/main/res/menu/fragment_conversations_overview.xml @@ -0,0 +1,37 @@ +<!-- + ~ Copyright (c) 2018, Daniel Gultsch All rights reserved. + ~ + ~ Redistribution and use in source and binary forms, with or without modification, + ~ are permitted provided that the following conditions are met: + ~ + ~ 1. Redistributions of source code must retain the above copyright notice, this + ~ list of conditions and the following disclaimer. + ~ + ~ 2. Redistributions in binary form must reproduce the above copyright notice, + ~ this list of conditions and the following disclaimer in the documentation and/or + ~ other materials provided with the distribution. + ~ + ~ 3. Neither the name of the copyright holder nor the names of its contributors + ~ may be used to endorse or promote products derived from this software without + ~ specific prior written permission. + ~ + ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + ~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + ~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + ~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> + +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/action_search" + android:orderInCategory="50" + android:title="@string/title_activity_search" + app:showAsAction="never" /> +</menu>
\ No newline at end of file diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index 6cb9893ea..655f80230 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -7,7 +7,7 @@ <attr name="TextSizeSubhead" format="dimension" /> <attr name="TextSizeBody1" format="dimension" /> <attr name="TextSizeBody2" format="dimension" /> - <attr name="TextSizeDisplay2" format="dimension"/> + <attr name="TextSizeDisplay2" format="dimension" /> <attr name="TextSizeInput" format="dimension" /> <attr name="TextSeparation" format="dimension" /> <attr name="TextSizeBody" format="dimension" /> @@ -20,7 +20,9 @@ <attr name="color_background_secondary" format="reference|color" /> <attr name="color_background_primary" format="reference|color" /> <attr name="color_warning" format="reference|color" /> - <attr name="EmojiColor" format="reference|color"/> + <attr name="EmojiColor" format="reference|color" /> + + <attr name="activity_background_search" format="reference" /> <attr name="ic_send_cancel_offline" format="reference" /> <attr name="ic_send_location_offline" format="reference" /> diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml index ffb542fc1..c573107f1 100644 --- a/src/main/res/values/colors.xml +++ b/src/main/res/values/colors.xml @@ -12,6 +12,7 @@ <color name="white">#ffe2e7f1</color> <color name="white12">#1fffffff</color> <color name="white70">#b2e2e7f1</color> + <color name="white87">#deffffff</color> <color name="grey50">#fafafa</color> <color name="grey200">#ffeeeeee</color> <color name="grey300">#ffe0e0e0</color> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 876bf8f75..515e440c1 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -781,4 +781,6 @@ <string name="create_shortcut">Create Shortcut</string> <string name="not_encrypted_for_this_device">Message was not encrypted for this device.</string> <string name="no_microphone_permission">Conversations needs access to the microphone</string> + <string name="title_activity_search">Search</string> + <string name="search_messages">Search messages</string> </resources> diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index 3c6edba4f..11430e064 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -36,6 +36,7 @@ <item name="android:textColorHint">@color/white70</item> <item name="android:background">@android:color/transparent</item> <item name="android:textSize">18sp</item> + <item name="android:textCursorDrawable">@drawable/white_cursor</item> </style> <style name="Widget.Conversations.CheckBox" parent="Widget.AppCompat.CompoundButton.CheckBox"> diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 2860b5c59..fec28b976 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -13,6 +13,9 @@ <item name="color_background_primary">@color/grey50</item> <item name="color_background_secondary">@color/grey200</item> <item name="color_warning">@color/red_a700</item> + + <item name="activity_background_search">@drawable/search_background_light</item> + <item name="EmojiColor">@color/realblack</item> <item name="color_bubble_light">@color/lightwhite</item> @@ -128,6 +131,9 @@ <item name="color_background_primary">@color/grey900</item> <item name="color_background_secondary">@color/realblack</item> <item name="color_warning">@color/red_a700</item> + + <item name="activity_background_search">@drawable/search_background_dark</item> + <item name="EmojiColor">@color/realwhite</item> <item name="color_bubble_light">@color/darkwhite</item> |