diff --git a/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java b/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java index fd01166..327053b 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBarActivity; import android.util.Log; @@ -227,6 +228,7 @@ public void onSaveInstanceState(Bundle bundle){ bundle.putInt(TOP,top); } + //Search logic implemented here @Override public boolean onCreateOptionsMenu(Menu menu) { @@ -241,6 +243,30 @@ public boolean onCreateOptionsMenu(Menu menu) { searchView.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); + + MenuItemCompat.setOnActionExpandListener(menu.findItem(R.id.action_search), new MenuItemCompat.OnActionExpandListener() { + @Override + public boolean onMenuItemActionExpand(MenuItem item) { +// getSupportActionBar().setDisplayShowHomeEnabled(false); +// getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.grey)); + + + Log.d("search","expand"); + return true; + } + + @Override + public boolean onMenuItemActionCollapse(MenuItem item) { +// getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.blue_app_theme)); +// getSupportActionBar().setDisplayShowHomeEnabled(true); + Log.d("search","collapse"); + return true; + + } + }); + + + searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { diff --git a/app/src/main/java/com/bluealeaf/dota2ticker/SettingsActivity.java b/app/src/main/java/com/bluealeaf/dota2ticker/SettingsActivity.java index c0e2c6f..9e30786 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/SettingsActivity.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/SettingsActivity.java @@ -1,8 +1,11 @@ package com.bluealeaf.dota2ticker; import android.annotation.TargetApi; +import android.content.ActivityNotFoundException; import android.content.Context; +import android.content.Intent; import android.content.res.Configuration; +import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; @@ -81,6 +84,37 @@ private void setupSimplePreferencesScreen() { // to reflect the new value, per the Android Design guidelines. bindPreferenceSummaryToValue(findPreference("alarm_list")); + + Preference rate_app_pref = (Preference)findPreference("rate_app"); + rate_app_pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Uri uri = Uri.parse("market://details?id=" + getPackageName() ); + Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); + try { + startActivity(goToMarket); + } catch (ActivityNotFoundException e) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + getPackageName()))); + } + return true; + } + }); + + rate_app_pref.setSummary(getResources().getString(R.string.rate_summary)); + + Preference share_app_pref = (Preference)findPreference("share_app"); + share_app_pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Intent sendIntent = new Intent(); + sendIntent.setAction(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.share_string)); + sendIntent.setType("text/plain"); + startActivity(Intent.createChooser(sendIntent, "Share using...")); + return true; + } + }); + share_app_pref.setSummary(getResources().getString(R.string.share_summary)); } /** @@ -113,9 +147,6 @@ private static boolean isSimplePreferences(Context context) { || !isXLargeTablet(context); } - /** - * {@inheritDoc} - */ @Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onBuildHeaders(List
target) { diff --git a/app/src/main/java/com/bluealeaf/dota2ticker/async/RestClient.java b/app/src/main/java/com/bluealeaf/dota2ticker/async/RestClient.java index 43531fc..3477167 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/async/RestClient.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/async/RestClient.java @@ -33,7 +33,7 @@ public static void getMatchesList(long id){ RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(Endpoints.GET_MATCHES_ENDPOINT) - .setLogLevel(RestAdapter.LogLevel.FULL) + .setLogLevel(RestAdapter.LogLevel.NONE) .setConverter(new GsonConverter(gson)) .setClient(new OkClient(BusProvider.getClientInstance())) .build(); diff --git a/app/src/main/java/com/bluealeaf/dota2ticker/notification/NotificationActivity.java b/app/src/main/java/com/bluealeaf/dota2ticker/notification/NotificationActivity.java index 78f42ef..8c10fc8 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/notification/NotificationActivity.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/notification/NotificationActivity.java @@ -47,10 +47,14 @@ public void onReceive(Context context, Intent intent) { notification.flags |= Notification.FLAG_AUTO_CANCEL; + notification.defaults = Notification.DEFAULT_ALL ; + NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(safeLongToInt(match.getId())+65535, notification); + + } } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2cd059e..273af02 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -63,7 +63,7 @@ android:layout_height="wrap_content" android:visibility="gone" ads:adSize="SMART_BANNER" - ads:adUnitId="@string/banner_ad_unit_id"> + ads:adUnitId="@string/banner_ad_unit_id_MainActivity"> diff --git a/app/src/main/res/layout/activity_match_details.xml b/app/src/main/res/layout/activity_match_details.xml index 94d9d63..cca1c2e 100644 --- a/app/src/main/res/layout/activity_match_details.xml +++ b/app/src/main/res/layout/activity_match_details.xml @@ -135,7 +135,7 @@ android:visibility="gone" android:layout_alignParentBottom="true" ads:adSize="SMART_BANNER" - ads:adUnitId="@string/banner_ad_unit_id"> + ads:adUnitId="@string/banner_ad_unit_id_MainActivity"> \ No newline at end of file diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 1c7741e..6f0450b 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -10,7 +10,7 @@ Dota 2 Ticker Hello world! Settings + Search MatchDetailsActivity - ca-app-pub-3940256099942544/6300978111 + + ca-app-pub-3940256099942544/6300978111 + ca-app-pub-3940256099942544/6300978111 + + Search Matches + Checkout dotobuzz! Now never miss your favourite team\'s match. View upcoming pro matches and set remainders with this app. + Like this app? Rate it on play store! + Spread the love, share this app! + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 879e984..a9ce432 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -6,6 +6,7 @@ @style/MyActionBar @color/blue_app_theme + @@ -13,5 +14,10 @@ parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse"> @color/blue_app_theme @color/blue_app_theme + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index 60f7ca9..280746d 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -4,12 +4,19 @@ + + +