Project

General

Profile

« Previous | Next » 

Revision b88cdd91

Added by Leszek Koltunski over 2 years ago

Download Update icons.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogUpdates.java
19 19

  
20 20
package org.distorted.dialogs;
21 21

  
22
import java.util.ArrayList;
23

  
22 24
import android.app.Dialog;
23 25
import android.content.DialogInterface;
26
import android.graphics.Bitmap;
24 27
import android.os.Bundle;
25 28
import android.util.DisplayMetrics;
26 29
import android.util.TypedValue;
......
49 52
  private LinearLayout mLayout;
50 53
  private int mMargin, mSize, mFontSize, mPadding;
51 54

  
55
  private ArrayList<RubikDialogUpdateView> mPanes;
56

  
52 57
///////////////////////////////////////////////////////////////////////////////////////////////////
53 58

  
54 59
  private View createView(FragmentActivity act, LayoutInflater inflater, float size, int minH)
......
72 77
  @Override
73 78
  public Dialog onCreateDialog(Bundle savedInstanceState)
74 79
    {
80
    if( mPanes==null ) mPanes = new ArrayList<>();
81

  
75 82
    FragmentActivity act = getActivity();
76 83
    LayoutInflater inflater = act.getLayoutInflater();
77 84
    AlertDialog.Builder builder = new AlertDialog.Builder(act);
......
166 173
          RubikDialogUpdateView rubikView = new RubikDialogUpdateView();
167 174
          View pane = rubikView.createView(act,info,mFontSize,mPadding,pI,pV,pT,pB);
168 175
          mLayout.addView(pane);
176
          mPanes.add(rubikView);
169 177
          }
170 178

  
171 179
        int numS = updates.getStartedNumber();
......
176 184
          RubikDialogUpdateView rubikView = new RubikDialogUpdateView();
177 185
          View pane = rubikView.createView(act,info,mFontSize,mPadding,pI,pV,pT,pB);
178 186
          mLayout.addView(pane);
187
          mPanes.add(rubikView);
179 188
          }
180 189

  
181 190
        RubikNetwork network = RubikNetwork.getInstance();
......
216 225

  
217 226
///////////////////////////////////////////////////////////////////////////////////////////////////
218 227

  
219
  public void iconDownloaded()
228
  public void iconDownloaded(int ordinal, Bitmap icon)
220 229
    {
230
    FragmentActivity act = getActivity();
221 231

  
232
    if( act!=null )
233
      {
234
      act.runOnUiThread(new Runnable()
235
        {
236
        @Override
237
        public void run()
238
          {
239
          RubikDialogUpdateView view = mPanes.get(ordinal);
240
          if( view!=null ) view.setIcon(icon);
241
          }
242
        });
243
      }
222 244
    }
223 245

  
224 246
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff