mirror of
https://github.com/imcarlost/Android-Itunes-API.git
synced 2026-04-10 02:46:54 -04:00
- Search button added to the action bar
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package com.hakodev.androiditunesapi.activities;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hakodev.androiditunesapi.R;
|
||||
|
||||
@@ -17,6 +17,22 @@ public class ArtistListActivity extends AppCompatActivity {
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.actionbar_search, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_search) {
|
||||
Toast.makeText(this, "Test", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setupTheme() {
|
||||
setTheme(R.style.AppTheme);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
package com.hakodev.androiditunesapi.models;
|
||||
|
||||
import java.util.List;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Artist {
|
||||
|
||||
@SerializedName("resultCount")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.hakodev.androiditunesapi.models;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/ic_search.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_search.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 626 B |
BIN
app/src/main/res/drawable-mdpi/ic_search.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_search.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 427 B |
BIN
app/src/main/res/drawable-xhdpi/ic_search.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_search.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 818 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_search.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_search.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:opacity="opaque">
|
||||
<item
|
||||
android:drawable="@color/colorBackground"/>
|
||||
<item android:drawable="@color/colorBackground" />
|
||||
</layer-list>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
|
||||
</vector>
|
||||
10
app/src/main/res/menu/actionbar_search.xml
Normal file
10
app/src/main/res/menu/actionbar_search.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_search"
|
||||
android:icon="@drawable/ic_search"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/search"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,3 +1,5 @@
|
||||
<resources>
|
||||
<!-- Common terms -->
|
||||
<string name="app_name">Artist Vault</string>
|
||||
<string name="search">Buscar</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user