diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6879f07..c51eea5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -18,7 +18,8 @@ ss + + android:launchMode="singleInstance" > diff --git a/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java b/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java index 9da2501..9188e28 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java @@ -94,6 +94,9 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + + getSupportActionBar().setIcon(R.drawable.ic_launcher); + mAdView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); diff --git a/app/src/main/java/com/bluealeaf/dota2ticker/MatchDetailsActivity.java b/app/src/main/java/com/bluealeaf/dota2ticker/MatchDetailsActivity.java index 07e072e..8f1e1ec 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/MatchDetailsActivity.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/MatchDetailsActivity.java @@ -31,6 +31,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_match_details); + getSupportActionBar().setLogo(R.drawable.ic_launcher); final Match match = getIntent().getParcelableExtra("MATCH_ID"); if(match != null){ @@ -67,15 +68,17 @@ protected void onCreate(Bundle savedInstanceState) { long mins = (time % 3600) / 60; StringBuilder sb = new StringBuilder(); - sb.append("in ").append(String.valueOf(hours)).append("h").append(" ").append(String.valueOf(mins)).append("m"); + + //If only 5 mins left for match make it live if(DateTime.now(DateTimeZone.UTC).getMillis() > match.getETA()-5*60*1000){ status.setText("LIVE"); } else{ - status.setText(sb.toString()); - status.setTextColor(getResources().getColor(R.color.black)); + status.setText(hours == 0 + ?sb.append(String.valueOf(mins)).append("m") + :sb.append(String.valueOf(hours)).append("h").append(" ").append(String.valueOf(mins)).append("m")); } if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){ diff --git a/app/src/main/java/com/bluealeaf/dota2ticker/adapters/MatchListAdapter.java b/app/src/main/java/com/bluealeaf/dota2ticker/adapters/MatchListAdapter.java index 289c05b..6375a01 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/adapters/MatchListAdapter.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/adapters/MatchListAdapter.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.os.Parcelable; +import android.support.v7.widget.SwitchCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -13,7 +14,6 @@ import android.widget.Filter; import android.widget.Filterable; import android.widget.ImageView; -import android.widget.Switch; import android.widget.TextView; import com.bluealeaf.dota2ticker.R; @@ -30,6 +30,8 @@ import greendao.Match; +//import android.widget.Switch; + /** * Created by samidh on 5/1/15. */ @@ -53,7 +55,8 @@ static class ViewHolder{ TextView ETA; ImageView teamOneCnt; ImageView teamTwoCnt; - Switch alarmSwitch; + SwitchCompat alarmSwitch; +// Switch alarmSwitch; } public MatchListAdapter(Context context, List match) { @@ -93,10 +96,12 @@ public View getView(int position, View convertView, ViewGroup parent) throws Il viewHolder.teamTwo = (TextView) view.findViewById(R.id.teamTwo); viewHolder.vs = (TextView) view.findViewById(R.id.vs); viewHolder.ETA = (TextView) view.findViewById(R.id.ETA); - viewHolder.alarmSwitch = (Switch) view.findViewById(R.id.alarmSwitch); + viewHolder.alarmSwitch = (SwitchCompat) view.findViewById(R.id.alarmSwitchCompat); viewHolder.teamOneCnt = (ImageView) view.findViewById(R.id.teamOneCnt); viewHolder.teamTwoCnt = (ImageView) view.findViewById(R.id.teamTwoCnt); view.setTag(viewHolder); + + } else{ viewHolder = (ViewHolder) view.getTag(); @@ -104,12 +109,6 @@ public View getView(int position, View convertView, ViewGroup parent) throws Il - long temp = match_data.getETA() - millisCurrent; - temp /= 1000; - long hours = temp / 3600; - long mins = (temp % 3600) / 60; - StringBuilder sb = new StringBuilder(); - sb.append(String.valueOf(hours)).append("h").append(" ").append(String.valueOf(mins)).append("m"); viewHolder.teamOne.setText(match_data.getT1()); viewHolder.teamTwo.setText(match_data.getT2()); @@ -132,6 +131,8 @@ public View getView(int position, View convertView, ViewGroup parent) throws Il viewHolder.teamOneCnt.setImageResource(t1Resource); viewHolder.teamTwoCnt.setImageResource(t2Resource); + + viewHolder.alarmSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -158,7 +159,17 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { } }); viewHolder.alarmSwitch.setChecked(match_data.getAlarm_set()); - viewHolder.ETA.setText(sb.toString()); + + long temp = match_data.getETA() - millisCurrent; + temp /= 1000; + long hours = temp / 3600; + long mins = (temp % 3600) / 60; + + StringBuilder sb = new StringBuilder(); + + viewHolder.ETA.setText(hours == 0 + ?sb.append(String.valueOf(mins)).append("m") + :sb.append(String.valueOf(hours)).append("h").append(" ").append(String.valueOf(mins)).append("m")); return view; } 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 8c10fc8..a9303cc 100644 --- a/app/src/main/java/com/bluealeaf/dota2ticker/notification/NotificationActivity.java +++ b/app/src/main/java/com/bluealeaf/dota2ticker/notification/NotificationActivity.java @@ -6,6 +6,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.graphics.BitmapFactory; import android.os.Build; import com.bluealeaf.dota2ticker.MatchDetailsActivity; @@ -36,7 +37,8 @@ public void onReceive(Context context, Intent intent) { if (Build.VERSION.SDK_INT >= 16) { notification = new Notification.Builder(context) .setContentTitle(match.getT1() + " vs. " + match.getT2()) - .setSmallIcon(R.drawable.abc_ab_share_pack_holo_dark) + .setSmallIcon(R.drawable.watch) + .setLargeIcon(BitmapFactory.decodeResource(context.getResources(),R.drawable.ic_launcher)) .setContentIntent(pendingIntent) .setAutoCancel(true) .build(); diff --git a/app/src/main/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png index 96a442e..3f93b43 100644 Binary files a/app/src/main/res/drawable-hdpi/ic_launcher.png and b/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png index 359047d..47016bd 100644 Binary files a/app/src/main/res/drawable-mdpi/ic_launcher.png and b/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png index 71c6d76..3d8a66d 100644 Binary files a/app/src/main/res/drawable-xhdpi/ic_launcher.png and b/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png index 4df1894..fc2f224 100644 Binary files a/app/src/main/res/drawable-xxhdpi/ic_launcher.png and b/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..78dd1b2 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/drawable/circle.xml b/app/src/main/res/drawable/circle.xml new file mode 100644 index 0000000..ff094ba --- /dev/null +++ b/app/src/main/res/drawable/circle.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/watch.png b/app/src/main/res/drawable/watch.png new file mode 100644 index 0000000..e3ebaf3 Binary files /dev/null and b/app/src/main/res/drawable/watch.png differ diff --git a/app/src/main/res/layout/activity_main_list.xml b/app/src/main/res/layout/activity_main_list.xml index 336807d..957d821 100644 --- a/app/src/main/res/layout/activity_main_list.xml +++ b/app/src/main/res/layout/activity_main_list.xml @@ -27,7 +27,7 @@ android:textStyle="bold" android:id="@+id/teamOne" android:layout_toRightOf="@+id/teamOneCnt" - android:fontFamily="sans-serif-condensed" + android:fontFamily="sans-serif" android:layout_marginLeft="10dp"/> @@ -49,7 +49,7 @@ - + + + + + + + + + @@ -85,9 +94,10 @@ android:layout_centerVertical="true" android:layout_toRightOf="@+id/teamTwoCnt" android:textStyle="bold" - android:fontFamily="sans-serif-condensed" + android:fontFamily="sans-serif" android:layout_marginLeft="10dp" - android:id="@+id/teamTwo"/> + android:id="@+id/teamTwo" + android:focusable="false" /> - - + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + android:orientation="vertical" + android:background="@android:color/white"> - + - + - android:layout_gravity="center" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> + - + - - - - - + android:id="@+id/leagueName" - + android:layout_gravity="center" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> - android:layout_width="0dp" + + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin"> + + + + + + + + + + - + - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" /> + - + + - + + diff --git a/app/src/main/res/values/color.xml b/app/src/main/res/values/color.xml index cacd0e7..166556e 100644 --- a/app/src/main/res/values/color.xml +++ b/app/src/main/res/values/color.xml @@ -11,5 +11,9 @@ #FFAA66CC #FF99CC00 #FFFFBB33 + #FFF + + #eff4ff + #2b5797 diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index b603b80..2e88912 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,9 +1,12 @@ - + - - - - \ No newline at end of file