Skip to content

Commit

Permalink
Remove the dependencies on com.google.android.material:material
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyTangAndroid committed May 5, 2022
1 parent ad378b9 commit 87ccda7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 37 deletions.
1 change: 0 additions & 1 deletion wood/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -57,7 +57,7 @@ public class LeafDetailFragment extends Fragment implements View.OnClickListener
private AppCompatTextView tv_body;
private final Debouncer<String> 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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
27 changes: 9 additions & 18 deletions wood/src/main/res/layout/wood_activity_leaf_details.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".LeafDetailsActivity">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/wood_details_appbar"
<androidx.appcompat.widget.Toolbar
android:id="@+id/wood_details_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<androidx.appcompat.widget.Toolbar
android:id="@+id/wood_details_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</com.google.android.material.appbar.AppBarLayout>

android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<FrameLayout
android:id="@+id/fl_fragment_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
android:layout_height="0dp"
android:layout_weight="1" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
8 changes: 3 additions & 5 deletions wood/src/main/res/layout/wood_fragment_leaf_detail.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -22,14 +21,13 @@
android:textIsSelectable="true" />
</androidx.core.widget.NestedScrollView>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/wood_details_search_fab"
<Button
android:id="@+id/wood_details_search_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/wood_ic_search_white_24dp"
app:fabSize="mini" />
android:text="Search" />

<LinearLayout
android:id="@+id/wood_details_search_bar"
Expand Down

0 comments on commit 87ccda7

Please sign in to comment.