Skip to content

Commit 87ccda7

Browse files
Remove the dependencies on com.google.android.material:material
1 parent ad378b9 commit 87ccda7

5 files changed

Lines changed: 19 additions & 37 deletions

File tree

wood/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ dependencies {
5151

5252
implementation "javax.inject:javax.inject:$injectVersion"
5353
implementation "com.jakewharton.timber:timber:$timberVersion"
54-
implementation "com.google.android.material:material:$materialVersioon"
5554
implementation "androidx.appcompat:appcompat:$appcompatVersioon"
5655
implementation "androidx.room:room-runtime:$roomVersion"
5756
//noinspection GradleDependency

wood/src/main/java/com/tonytangandroid/wood/LeafDetailFragment.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import android.os.Bundle;
1010
import androidx.annotation.NonNull;
1111
import androidx.annotation.Nullable;
12-
import com.google.android.material.floatingactionbutton.FloatingActionButton;
1312
import androidx.fragment.app.Fragment;
1413
import androidx.core.widget.NestedScrollView;
1514
import androidx.appcompat.app.ActionBar;
@@ -27,6 +26,7 @@
2726
import android.view.View;
2827
import android.view.ViewGroup;
2928
import android.view.inputmethod.InputMethodManager;
29+
import android.widget.Button;
3030
import android.widget.EditText;
3131
import android.widget.TextView;
3232
import android.widget.Toast;
@@ -57,7 +57,7 @@ public class LeafDetailFragment extends Fragment implements View.OnClickListener
5757
private AppCompatTextView tv_body;
5858
private final Debouncer<String> searchDebouncer = new Debouncer<>(400, this::onSearchKeyEmitted);
5959
private NestedScrollView nested_scroll_view;
60-
private FloatingActionButton floating_action_button;
60+
private Button wood_details_search_btn;
6161

6262

6363
public static LeafDetailFragment newInstance(long id) {
@@ -89,14 +89,14 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
8989
private void bindView(View rootView) {
9090
tv_body = rootView.findViewById(R.id.wood_details_body);
9191
nested_scroll_view = rootView.findViewById(R.id.wood_details_scroll_parent);
92-
floating_action_button = rootView.findViewById(R.id.wood_details_search_fab);
92+
wood_details_search_btn = rootView.findViewById(R.id.wood_details_search_btn);
9393
search_bar = rootView.findViewById(R.id.wood_details_search_bar);
9494
View searchBarPrev = rootView.findViewById(R.id.wood_details_search_prev);
9595
View searchBarNext = rootView.findViewById(R.id.wood_details_search_next);
9696
View searchBarClose = rootView.findViewById(R.id.wood_details_search_close);
9797
et_key_word = rootView.findViewById(R.id.wood_details_search);
9898
tv_search_count = rootView.findViewById(R.id.wood_details_search_count);
99-
floating_action_button.setOnClickListener(this);
99+
wood_details_search_btn.setOnClickListener(this);
100100
searchBarPrev.setOnClickListener(this);
101101
searchBarNext.setOnClickListener(this);
102102
searchBarClose.setOnClickListener(this);
@@ -137,7 +137,6 @@ private void transactionUpdated(Leaf transaction) {
137137

138138
private void populateUI() {
139139
int color = colorUtil.getTransactionColor(leaf);
140-
floating_action_button.setBackgroundTintList(colorStateList(color));
141140
search_bar.setBackgroundColor(color);
142141
et_key_word.setHint(R.string.wood_search_hint);
143142
populateBody();
@@ -255,7 +254,7 @@ public void setUserVisibleHint(boolean isVisibleToUser) {
255254
@Override
256255
public void onClick(View v) {
257256
int id = v.getId();
258-
if (id == R.id.wood_details_search_fab) {
257+
if (id == R.id.wood_details_search_btn) {
259258
showSearch();
260259
} else if (id == R.id.wood_details_search_close) {
261260
clearSearch();
@@ -268,7 +267,7 @@ public void onClick(View v) {
268267

269268
private void clearSearch() {
270269
if (TextUtil.isNullOrWhiteSpace(searchKey)) {
271-
floating_action_button.show();
270+
wood_details_search_btn.setVisibility(View.VISIBLE);
272271
search_bar.setVisibility(View.GONE);
273272
nested_scroll_view.setPadding(0, 0, 0, nested_scroll_view.getBottom());
274273
hideKeyboard();
@@ -278,7 +277,7 @@ private void clearSearch() {
278277
}
279278

280279
private void showSearch() {
281-
floating_action_button.hide();
280+
wood_details_search_btn.setVisibility(View.GONE);
282281
search_bar.setVisibility(View.VISIBLE);
283282
nested_scroll_view.setPadding(0, getResources().getDimensionPixelSize(R.dimen.wood_search_bar_height), 0, nested_scroll_view.getBottom());
284283
showKeyboard();

wood/src/main/java/com/tonytangandroid/wood/LeafDetailsActivity.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import android.content.Intent;
55
import android.os.Bundle;
66
import androidx.annotation.Nullable;
7-
import com.google.android.material.appbar.AppBarLayout;
87
import androidx.fragment.app.Fragment;
98
import androidx.appcompat.app.ActionBar;
109
import androidx.appcompat.app.AppCompatActivity;
@@ -29,10 +28,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
2928
super.onCreate(savedInstanceState);
3029
setContentView(R.layout.wood_activity_leaf_details);
3130
long id = getIntent().getLongExtra(ARG_TRANSACTION_ID, 0);
32-
int priority = getIntent().getIntExtra(ARG_PRIORITY, Log.VERBOSE);
33-
WoodColorUtil colorUtil = WoodColorUtil.getInstance(this);
34-
AppBarLayout appBarLayout = findViewById(R.id.wood_details_appbar);
35-
appBarLayout.setBackgroundColor(colorUtil.getTransactionColor(priority));
3631
Toolbar toolbar = findViewById(R.id.wood_details_toolbar);
3732
setSupportActionBar(toolbar);
3833
final ActionBar actionBar = getSupportActionBar();
Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:id="@+id/main_content"
66
android:layout_width="match_parent"
77
android:layout_height="match_parent"
88
android:fitsSystemWindows="true"
9+
android:orientation="vertical"
910
tools:context=".LeafDetailsActivity">
1011

11-
<com.google.android.material.appbar.AppBarLayout
12-
android:id="@+id/wood_details_appbar"
12+
<androidx.appcompat.widget.Toolbar
13+
android:id="@+id/wood_details_toolbar"
1314
android:layout_width="match_parent"
14-
android:layout_height="wrap_content"
15-
android:background="?colorPrimary"
16-
android:fitsSystemWindows="true"
17-
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
18-
19-
<androidx.appcompat.widget.Toolbar
20-
android:id="@+id/wood_details_toolbar"
21-
android:layout_width="match_parent"
22-
android:layout_height="?attr/actionBarSize"
23-
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
24-
</com.google.android.material.appbar.AppBarLayout>
25-
15+
android:layout_height="?attr/actionBarSize"
16+
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
2617

2718
<FrameLayout
2819
android:id="@+id/fl_fragment_holder"
2920
android:layout_width="match_parent"
30-
android:layout_height="match_parent"
31-
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
21+
android:layout_height="0dp"
22+
android:layout_weight="1" />
3223

33-
</androidx.coordinatorlayout.widget.CoordinatorLayout>
24+
</LinearLayout>

wood/src/main/res/layout/wood_fragment_leaf_detail.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
43
xmlns:tools="http://schemas.android.com/tools"
54
android:layout_width="match_parent"
65
android:layout_height="match_parent"
@@ -22,14 +21,13 @@
2221
android:textIsSelectable="true" />
2322
</androidx.core.widget.NestedScrollView>
2423

25-
<com.google.android.material.floatingactionbutton.FloatingActionButton
26-
android:id="@+id/wood_details_search_fab"
24+
<Button
25+
android:id="@+id/wood_details_search_btn"
2726
android:layout_width="wrap_content"
2827
android:layout_height="wrap_content"
2928
android:layout_gravity="bottom|end"
3029
android:layout_margin="16dp"
31-
android:src="@drawable/wood_ic_search_white_24dp"
32-
app:fabSize="mini" />
30+
android:text="Search" />
3331

3432
<LinearLayout
3533
android:id="@+id/wood_details_search_bar"

0 commit comments

Comments
 (0)