Project

General

Profile

« Previous | Next » 

Revision 10373dc7

Added by Leszek Koltunski over 2 years ago

Progress downloading updates.

View differences:

src/main/java/org/distorted/network/RubikUpdates.java
142 142
      }
143 143
    }
144 144

  
145
///////////////////////////////////////////////////////////////////////////////////////////////////
146

  
147
  public int getNumberOfUpdates()
148
    {
149
    int newO = mNewObjects.size();
150
    int newE = mNewExtras.size();
151
    int updO = mUpdObjects.size();
152
    int updE = mUpdExtras.size();
153

  
154
    return newO+newE+updO+updE;
155
    }
156

  
145 157
///////////////////////////////////////////////////////////////////////////////////////////////////
146 158

  
147 159
  public void showDebug()
src/main/java/org/distorted/screens/RubikScreenPlay.java
35 35
import android.widget.LinearLayout;
36 36
import android.widget.PopupWindow;
37 37
import android.widget.RelativeLayout;
38
import android.widget.TextView;
38 39

  
39 40
import org.distorted.network.RubikNetwork;
40 41
import org.distorted.network.RubikUpdates;
......
75 76
  private TransparentButton mPlayButton;
76 77
  private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup;
77 78
  private LinearLayout mPlayLayout;
79
  private TextView mBubbleUpdates;
78 80
  private int mObjectSize, mMenuLayoutWidth, mMenuLayoutHeight, mPlayLayoutWidth;
79 81
  private int mLevelValue;
80 82
  private float mButtonSize, mMenuItemSize, mMenuTextSize;
......
360 362
        }
361 363
      });
362 364

  
365
    mBubbleUpdates = layout.findViewById(R.id.bubbleUpdates);
366
    mBubbleUpdates.setVisibility(View.INVISIBLE);
367

  
363 368
    RubikNetwork network = RubikNetwork.getInstance();
364 369
    network.signUpForUpdates(this);
365 370
    }
......
696 701

  
697 702
  public void receiveUpdate(RubikUpdates updates)
698 703
    {
699
    updates.showDebug();
704
    int num = updates.getNumberOfUpdates();
705

  
706
    if( num>0 )
707
      {
708
      String shownNum = String.valueOf(num);
709
      mBubbleUpdates.setText(shownNum);
710
      mBubbleUpdates.setVisibility(View.VISIBLE);
711
      }
700 712
    }
701 713

  
702 714
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/res/layout/popup_object.xml
43 43
           android:layout_height="wrap_content"
44 44
           android:layout_alignTop="@+id/buttonDow"
45 45
           android:layout_alignEnd="@+id/buttonDow"
46
           android:text="4"
47 46
           android:textColor="#FFF"
48 47
           android:textSize="16sp"
49 48
           android:textStyle="bold"

Also available in: Unified diff