Project

General

Profile

« Previous | Next » 

Revision 179f7189

Added by Leszek Koltunski over 2 years ago

Downloading updates: dialog progress.

View differences:

src/main/java/org/distorted/screens/RubikScreenPlay.java
19 19

  
20 20
package org.distorted.screens;
21 21

  
22
import java.lang.ref.WeakReference;
23

  
24
import android.app.Activity;
22 25
import android.content.Context;
23 26
import android.content.SharedPreferences;
24 27
import android.content.res.Resources;
......
86 89
  private boolean mShouldReactToEndOfScrambling;
87 90
  private int mBottomHeight;
88 91
  private float mScreenWidth;
92
  private WeakReference<RubikActivity> mWeakAct;
89 93

  
90 94
///////////////////////////////////////////////////////////////////////////////////////////////////
91 95

  
......
98 102

  
99 103
  void enterScreen(final RubikActivity act)
100 104
    {
105
    mWeakAct = new WeakReference<>(act);
101 106
    int numObjects = RubikObjectList.getNumObjects();
102 107
    mScreenWidth = act.getScreenWidthInPixels();
103 108
    mUpperBarHeight = act.getHeightUpperBar();
......
707 712
    {
708 713
    updates.showDebug();
709 714

  
710
    int numN = updates.getNewNumber();
711
    int numU = updates.getUpdNumber();
712
    int num = numN+numU;
715
    Activity act = mWeakAct.get();
713 716

  
714
    if( num>0 )
715
      {
716
      String shownNum = String.valueOf(num);
717
      mBubbleUpdates.setText(shownNum);
718
      mBubbleUpdates.setVisibility(View.VISIBLE);
719
      int height = (int)(0.05f*mScreenWidth);
720
      mBubbleUpdates.setTextSize(TypedValue.COMPLEX_UNIT_PX,height);
721
      }
722
    else
717
    if( act!=null )
723 718
      {
724
      mBubbleUpdates.setVisibility(View.INVISIBLE);
719
      act.runOnUiThread(new Runnable()
720
        {
721
        @Override
722
        public void run()
723
          {
724
          int numN = updates.getNewNumber();
725
          int numU = updates.getUpdNumber();
726
          int num = numN+numU;
727

  
728
          if( num>0 )
729
            {
730
            String shownNum = String.valueOf(num);
731
            mBubbleUpdates.setText(shownNum);
732
            mBubbleUpdates.setVisibility(View.VISIBLE);
733
            int height = (int)(0.05f*mScreenWidth);
734
            mBubbleUpdates.setTextSize(TypedValue.COMPLEX_UNIT_PX,height);
735
            }
736
         else
737
            {
738
            mBubbleUpdates.setVisibility(View.INVISIBLE);
739
            }
740
          }
741
        });
725 742
      }
726 743
    }
727 744

  

Also available in: Unified diff