Code Monkey home page Code Monkey logo

searchapi's People

Watchers

James Cloos avatar Jay K avatar

searchapi's Issues

Wrapping something with a CardView is abusing the widget's purpose

<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:iconifiedByDefault="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:queryBackground="@null">
<androidx.appcompat.widget.SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:queryHint="Search"
app:iconifiedByDefault="false"
app:queryBackground="@null"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.cardview.widget.CardView>

CardView isn't meant to be used this way. That said, it's a clever way to solve the problem of making SearchView look more material, and I'd recommend leaving a comment as to why you did it.

CardView shouldn't be used for a header

<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:iconifiedByDefault="false"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:queryBackground="@null">
<TextView
android:id="@+id/teamsButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textSize="24sp"
android:text="Team"
android:gravity="center"
android:textColor="@color/colorBlack"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.cardview.widget.CardView>

If you want to wrap a TextView in an elevated layout, you could very easily wrap it with a FrameLayout that has a background and add elevation.

Add unit tests

Whether a company asks for it or not, I highly recommend adding unit tests to your code challenge.

It shows that you understand how to write well-written, and highly maintainable software.

Don't use ConstraintLayout when LinearLayout could do the job

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:background="@color/materialBackgroundGrey"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cardView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>

There are times when ConstraintLayout makes sense. It's usually as a replacement to RelativeLayout. In this layout, you could easily use LinearLayout instead and get a performance bump.

It's not the biggest deal in the world, but good to keep in mind.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.