diff --git a/wood/build.gradle b/wood/build.gradle index d140ffa..dcdd80f 100644 --- a/wood/build.gradle +++ b/wood/build.gradle @@ -51,7 +51,6 @@ dependencies { implementation "javax.inject:javax.inject:$injectVersion" implementation "com.jakewharton.timber:timber:$timberVersion" - implementation "com.google.android.material:material:$materialVersioon" implementation "androidx.appcompat:appcompat:$appcompatVersioon" implementation "androidx.room:room-runtime:$roomVersion" //noinspection GradleDependency diff --git a/wood/src/main/java/com/tonytangandroid/wood/LeafDetailFragment.java b/wood/src/main/java/com/tonytangandroid/wood/LeafDetailFragment.java index 02dcc0e..4667a5b 100644 --- a/wood/src/main/java/com/tonytangandroid/wood/LeafDetailFragment.java +++ b/wood/src/main/java/com/tonytangandroid/wood/LeafDetailFragment.java @@ -9,7 +9,6 @@ import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.google.android.material.floatingactionbutton.FloatingActionButton; import androidx.fragment.app.Fragment; import androidx.core.widget.NestedScrollView; import androidx.appcompat.app.ActionBar; @@ -27,6 +26,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; +import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; @@ -57,7 +57,7 @@ public class LeafDetailFragment extends Fragment implements View.OnClickListener private AppCompatTextView tv_body; private final Debouncer searchDebouncer = new Debouncer<>(400, this::onSearchKeyEmitted); private NestedScrollView nested_scroll_view; - private FloatingActionButton floating_action_button; + private Button wood_details_search_btn; public static LeafDetailFragment newInstance(long id) { @@ -89,14 +89,14 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c private void bindView(View rootView) { tv_body = rootView.findViewById(R.id.wood_details_body); nested_scroll_view = rootView.findViewById(R.id.wood_details_scroll_parent); - floating_action_button = rootView.findViewById(R.id.wood_details_search_fab); + wood_details_search_btn = rootView.findViewById(R.id.wood_details_search_btn); search_bar = rootView.findViewById(R.id.wood_details_search_bar); View searchBarPrev = rootView.findViewById(R.id.wood_details_search_prev); View searchBarNext = rootView.findViewById(R.id.wood_details_search_next); View searchBarClose = rootView.findViewById(R.id.wood_details_search_close); et_key_word = rootView.findViewById(R.id.wood_details_search); tv_search_count = rootView.findViewById(R.id.wood_details_search_count); - floating_action_button.setOnClickListener(this); + wood_details_search_btn.setOnClickListener(this); searchBarPrev.setOnClickListener(this); searchBarNext.setOnClickListener(this); searchBarClose.setOnClickListener(this); @@ -137,7 +137,6 @@ private void transactionUpdated(Leaf transaction) { private void populateUI() { int color = colorUtil.getTransactionColor(leaf); - floating_action_button.setBackgroundTintList(colorStateList(color)); search_bar.setBackgroundColor(color); et_key_word.setHint(R.string.wood_search_hint); populateBody(); @@ -255,7 +254,7 @@ public void setUserVisibleHint(boolean isVisibleToUser) { @Override public void onClick(View v) { int id = v.getId(); - if (id == R.id.wood_details_search_fab) { + if (id == R.id.wood_details_search_btn) { showSearch(); } else if (id == R.id.wood_details_search_close) { clearSearch(); @@ -268,7 +267,7 @@ public void onClick(View v) { private void clearSearch() { if (TextUtil.isNullOrWhiteSpace(searchKey)) { - floating_action_button.show(); + wood_details_search_btn.setVisibility(View.VISIBLE); search_bar.setVisibility(View.GONE); nested_scroll_view.setPadding(0, 0, 0, nested_scroll_view.getBottom()); hideKeyboard(); @@ -278,7 +277,7 @@ private void clearSearch() { } private void showSearch() { - floating_action_button.hide(); + wood_details_search_btn.setVisibility(View.GONE); search_bar.setVisibility(View.VISIBLE); nested_scroll_view.setPadding(0, getResources().getDimensionPixelSize(R.dimen.wood_search_bar_height), 0, nested_scroll_view.getBottom()); showKeyboard(); diff --git a/wood/src/main/java/com/tonytangandroid/wood/LeafDetailsActivity.java b/wood/src/main/java/com/tonytangandroid/wood/LeafDetailsActivity.java index e876291..5527694 100644 --- a/wood/src/main/java/com/tonytangandroid/wood/LeafDetailsActivity.java +++ b/wood/src/main/java/com/tonytangandroid/wood/LeafDetailsActivity.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.os.Bundle; import androidx.annotation.Nullable; -import com.google.android.material.appbar.AppBarLayout; import androidx.fragment.app.Fragment; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; @@ -29,10 +28,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wood_activity_leaf_details); long id = getIntent().getLongExtra(ARG_TRANSACTION_ID, 0); - int priority = getIntent().getIntExtra(ARG_PRIORITY, Log.VERBOSE); - WoodColorUtil colorUtil = WoodColorUtil.getInstance(this); - AppBarLayout appBarLayout = findViewById(R.id.wood_details_appbar); - appBarLayout.setBackgroundColor(colorUtil.getTransactionColor(priority)); Toolbar toolbar = findViewById(R.id.wood_details_toolbar); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); diff --git a/wood/src/main/res/layout/wood_activity_leaf_details.xml b/wood/src/main/res/layout/wood_activity_leaf_details.xml index a7b3eb2..019b9bb 100644 --- a/wood/src/main/res/layout/wood_activity_leaf_details.xml +++ b/wood/src/main/res/layout/wood_activity_leaf_details.xml @@ -1,33 +1,24 @@ - - - - - - + android:layout_height="?attr/actionBarSize" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> + android:layout_height="0dp" + android:layout_weight="1" /> - \ No newline at end of file + \ No newline at end of file diff --git a/wood/src/main/res/layout/wood_fragment_leaf_detail.xml b/wood/src/main/res/layout/wood_fragment_leaf_detail.xml index d2c002c..584f983 100644 --- a/wood/src/main/res/layout/wood_fragment_leaf_detail.xml +++ b/wood/src/main/res/layout/wood_fragment_leaf_detail.xml @@ -1,6 +1,5 @@ - + android:text="Search" />