Skip to content

Commit

Permalink
Added logo.Added notification small and big icons.Minor UI changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
samidhtalsania committed Apr 14, 2015
1 parent 250d0c6 commit a379fc8
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 126 deletions.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleInstance" >ss

android:launchMode="singleInstance" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/bluealeaf/dota2ticker/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -30,6 +30,8 @@

import greendao.Match;

//import android.widget.Switch;

/**
* Created by samidh on 5/1/15.
*/
Expand All @@ -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> match) {
Expand Down Expand Up @@ -93,23 +96,19 @@ 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();
}



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());
Expand All @@ -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) {
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Binary file modified app/src/main/res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="@color/metro_dark"></solid>

</shape>
Binary file added app/src/main/res/drawable/watch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 16 additions & 6 deletions app/src/main/res/layout/activity_main_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

</RelativeLayout>
Expand All @@ -49,7 +49,7 @@
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/alarmSwitch"
android:layout_toLeftOf="@+id/alarmSwitchCompat"
android:background="@drawable/rounded_corner"
android:padding="5dp"
android:layout_marginRight="20dp"
Expand All @@ -59,15 +59,24 @@
android:fontFamily="sans-serif"
android:id="@+id/ETA"/>

<Switch
android:id="@+id/alarmSwitch"
<android.support.v7.widget.SwitchCompat
android:id="@+id/alarmSwitchCompat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:layout_alignParentRight = "true"
android:layout_centerVertical="true"/>


<!--<Switch-->
<!--android:id="@+id/alarmSwitch"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:focusable="false"-->
<!--android:layout_alignParentRight = "true"-->
<!--android:layout_centerVertical="true"/>-->


</RelativeLayout>


Expand All @@ -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" />

<ImageView
android:id="@+id/teamTwoCnt"
Expand Down
Loading

0 comments on commit a379fc8

Please sign in to comment.