Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New search window with library #3225

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ dependencies {
implementation "androidx.core:core-ktx:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "ch.acra:acra-core:5.7.0"

implementation "xyz.quaver:floatingsearchview:1.2.0-rc2"
}

configurations.all {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import kotlin.Unit;

public class MainActivity extends PermissionsActivity
implements SmbConnectionListener,
Expand Down Expand Up @@ -1633,6 +1634,8 @@ void initialiseViews() {
if (!queue.isEmpty()) {
mainActivityHelper.search(getPrefs(), queue);
}

return Unit.INSTANCE;
});
appBarLayout = getAppbar().getAppbarLayout();

Expand Down

This file was deleted.

73 changes: 73 additions & 0 deletions app/src/main/java/com/amaze/filemanager/ui/views/appbar/AppBar.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2014-2020 Arpit Khurana <arpitkh96@gmail.com>, Vishal Nehra <vishalmeham2@gmail.com>,
* Emmanuel Messulam<emmanuelbendavid@gmail.com>, Raymond Lai <airwave209gt at gmail.com> and Contributors.
*
* This file is part of Amaze File Manager.
*
* Amaze File Manager 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.amaze.filemanager.ui.views.appbar

import android.content.SharedPreferences
import android.os.Build
import androidx.annotation.StringRes
import androidx.appcompat.widget.Toolbar
import com.amaze.filemanager.R
import com.amaze.filemanager.ui.activities.MainActivity
import com.google.android.material.appbar.AppBarLayout
import com.amaze.filemanager.ui.fragments.preference_fragments.PreferencesConstants

/**
* layout_appbar.xml contains the layout for AppBar and BottomBar
*
* This is a class containing containing methods to each section of the AppBar, creating the
* object loads the views.
*/
class AppBar(
mainActivity: MainActivity,
sharedPref: SharedPreferences,
onSearch: (queue: String?) -> Unit
) {

val toolbar: Toolbar = mainActivity.findViewById(R.id.action_bar)
val searchView: SearchView = SearchView(this, mainActivity, onSearch)
val bottomBar: BottomBar = BottomBar(this, mainActivity)
val appbarLayout: AppBarLayout = mainActivity.findViewById(R.id.lin)

init {
if (Build.VERSION.SDK_INT >= 21) {
toolbar.elevation = 0f
}

if (!sharedPref.getBoolean(PreferencesConstants.PREFERENCE_INTELLI_HIDE_TOOLBAR, true)) {
val params = toolbar.layoutParams as AppBarLayout.LayoutParams
params.scrollFlags = 0
appbarLayout.setExpanded(true, true)
}
}

/**
* Sets the app title, or sets it as empty if null is passed
*/
fun setTitle(title: String?) {
toolbar.title = title
}

/**
* Sets the app title
*/
fun setTitle(@StringRes title: Int) {
toolbar.setTitle(title)
}
}
Loading