lint warnings & hardcoded text
This commit is contained in:
@@ -34,9 +34,10 @@ public class FavoriteProviderHelper {
|
|||||||
String selection = FavoriteColumns.TITLE + "=?";
|
String selection = FavoriteColumns.TITLE + "=?";
|
||||||
String[] selectionArgs = new String[]{movie.getTitle()};
|
String[] selectionArgs = new String[]{movie.getTitle()};
|
||||||
Cursor cursor = mResolver.query(FavoriteProvider.Favorites.FAVORITES_URI, projection, selection, selectionArgs, null);
|
Cursor cursor = mResolver.query(FavoriteProvider.Favorites.FAVORITES_URI, projection, selection, selectionArgs, null);
|
||||||
if (cursor != null && cursor.getCount() > 0)
|
boolean isFavourite = (cursor != null && cursor.getCount() > 0)
|
||||||
return true;
|
if(cursor != null)
|
||||||
return false;
|
cursor.close();
|
||||||
|
return isFavourite;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFavorite(Movie movie) {
|
public void addFavorite(Movie movie) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
tools:ignore="InconsistentLayout"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -13,7 +14,8 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:baselineAligned="false">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
@@ -31,7 +33,7 @@
|
|||||||
android:id="@+id/main_details_placeHolderText"
|
android:id="@+id/main_details_placeHolderText"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:text="Please select a movie"
|
android:text="@string/details_frag_placeholder_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:text="No videos found."
|
android:text="@string/movie_details_no_movies_found"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<item android:icon="@drawable/ic_action_share" android:id="@+id/action_share" android:title="Share" app:showAsAction="ifRoom" />
|
<item android:icon="@drawable/ic_action_share" android:id="@+id/action_share" android:title="@string/details_action_share" app:showAsAction="ifRoom" />
|
||||||
<item android:id="@+id/action_favorite" android:title="Add/Remove Favorite" app:showAsAction="ifRoom" />
|
<item android:id="@+id/action_favorite" android:title="@string/details_action_favorite" app:showAsAction="ifRoom" />
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
||||||
<item android:id="@+id/action_sort_popularity" android:title="Popular movies" app:showAsAction="never" />
|
<item android:id="@+id/action_sort_popularity" android:title="@string/list_action_popular" app:showAsAction="never" />
|
||||||
<item android:id="@+id/action_sort_rating" android:title="Highest av. rating" app:showAsAction="never" />
|
<item android:id="@+id/action_sort_rating" android:title="@string/list_action_rating" app:showAsAction="never" />
|
||||||
<item android:id="@+id/action_sort_favorites" android:title="Favorites" app:showAsAction="never" />
|
<item android:id="@+id/action_sort_favorites" android:title="@string/list_action_favorites" app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
|
||||||
<bool name="master_detail">false</bool>
|
<bool name="master_detail">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -3,4 +3,11 @@
|
|||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="movie_release_date">Release: %1$s</string>
|
<string name="movie_release_date">Release: %1$s</string>
|
||||||
<string name="movie_rating">Rating: %1$s/10.0</string>
|
<string name="movie_rating">Rating: %1$s/10.0</string>
|
||||||
|
<string name="details_action_share">Share</string>
|
||||||
|
<string name="details_action_favorite">Add/Remove Favorite</string>
|
||||||
|
<string name="list_action_popular">Popular movies</string>
|
||||||
|
<string name="list_action_rating">Highest av. rating</string>
|
||||||
|
<string name="list_action_favorites">Favorites</string>
|
||||||
|
<string name="movie_details_no_movies_found">No videos found.</string>
|
||||||
|
<string name="details_frag_placeholder_text">Please select a movie</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user