void UploadDocument() {

    if (llPhotoRow.getChildCount() <= 0 && documentList.size() <= 0) {

      Util.showToastMessage(mContext, "Please upload a document first", Toast.LENGTH_LONG);

    } else if (documentList != null
        && documentList.size() > 0
        && (documentList.get(0).contains("/"))) {

      relProgress.setVisibility(View.VISIBLE);
      UploadAllFilesTask uploadFiles = new UploadAllFilesTask();
      uploadFiles.context = mContext;
      // uploadFiles.szFileName = "iqra";
      // uploadFiles.szFilePath =
      // Environment.getExternalStorageDirectory()
      // + "/apk/iqra.jpg";// "/sdcard/apk/pic.jpg";
      uploadFiles.execute();

    } else {
      if (isDeleteSuccess && llPhotoRow.getChildCount() >= 1) {
        Util.setIsDocumentsUploaded(mContext, true);
        finish();
        Intent tutorialIntent = new Intent(mContext, TutorialActivity.class);
        if (bIsFromRegistration)
          tutorialIntent.putExtra(Constants.FROM_REGISTRATION_COMPLETE, true);
        startActivity(tutorialIntent);
      } else {
        Util.showToastMessage(mContext, "Please upload a document first", Toast.LENGTH_LONG);
      }

      // Util.showToastMessage(mContext, "No new document to upload",
      // Toast.LENGTH_LONG);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    tfGS = Typeface.createFromAsset(getAssets(), "fonts/GillSans.ttc");
    ref = (Button) findViewById(R.id.btn_resources_used);
    disc = (Button) findViewById(R.id.btn_disc);
    ref.setOnClickListener(this);
    disc.setOnClickListener(this);
    ll1 = (LinearLayout) findViewById(R.id.aboutSection);
    ll2 = (LinearLayout) findViewById(R.id.references);
    ll3 = (LinearLayout) findViewById(R.id.disclaimer);

    ll2.setVisibility(View.GONE);
    ll3.setVisibility(View.GONE);

    currStep = 1;

    int childcount = ll1.getChildCount();
    for (int i = 0; i < childcount; i++) {
      View v = ll1.getChildAt(i);
      if (v instanceof TextView) {
        TextView t = (TextView) v;
        t.setTypeface(tfGS);
      }
    }
    childcount = ll2.getChildCount();
    for (int i = 0; i < childcount; i++) {
      View v = ll2.getChildAt(i);
      if (v instanceof TextView) {
        TextView t = (TextView) v;
        t.setTypeface(tfGS);
      }
    }
  }
  /** 选择的Column里面的Tab */
  private void selectTab(int tab_postion) {
    columnSelectIndex = tab_postion;
    for (int i = 0; i < mRadioGroup_content.getChildCount(); i++) {
      View checkView = mRadioGroup_content.getChildAt(tab_postion);
      int k = checkView.getMeasuredWidth();
      int l = checkView.getLeft();
      int i2 = l + k / 2 - mScreenWidth / 2;
      // rg_nav_content.getParent()).smoothScrollTo(i2, 0);
      mColumnHorizontalScrollView.smoothScrollTo(i2, 0);
      // mColumnHorizontalScrollView.smoothScrollTo((position - 2) *
      // mItemWidth , 0);
    }

    // 判断是否选中
    for (int j = 0; j < mRadioGroup_content.getChildCount(); j++) {
      View checkView = mRadioGroup_content.getChildAt(j);
      boolean ischeck;
      if (j == tab_postion) {
        ischeck = true;
      } else {
        ischeck = false;
      }
      checkView.setSelected(ischeck);
    }
  }
Beispiel #4
0
  // used when switching languages or building a hebrew page
  // reverse the order of every row in the grid
  private void flipViews(boolean flipTabsAlso) {

    int numChildren;
    if (tabRoot != null && flipTabsAlso) {
      numChildren = tabRoot.getChildCount();
      for (int i = 0; i < numChildren; i++) {
        View tempView = tabRoot.getChildAt(numChildren - 1);
        tabRoot.removeViewAt(numChildren - 1);
        tabRoot.addView(tempView, i);
      }
    }

    for (int i = 0; i < gridRoot.getChildCount(); i++) {
      View v = gridRoot.getChildAt(i);
      if (v instanceof LinearLayout) {
        LinearLayout ll = (LinearLayout) v;
        numChildren = ll.getChildCount();
        for (int j = 0; j < numChildren - 1; j++) {
          View tempView = ll.getChildAt(numChildren - 1);
          ll.removeViewAt(numChildren - 1);
          ll.addView(tempView, j);
        }
      }
    }
  }
Beispiel #5
0
  private static void serializeDirectoryView(LinearLayout dirView, Parcel parcel) {
    // Save own view state.
    parcel.writeString(((TextView) dirView.findViewById(R.id.name)).getText().toString());
    parcel.writeByte((byte) (dirView.isActivated() ? 1 : 0));
    parcel.writeInt(dirView.getChildCount());
    GlobReply entry = (GlobReply) dirView.getTag();
    parcel.writeSerializable(entry);

    // Save child view state.
    for (int i = 1; i < dirView.getChildCount(); ++i) {
      serializeView(dirView.getChildAt(i), parcel);
    }
  }
  public void a(FoodItem fooditem) {
    fooditem = fooditem.d();
    UsedNutritionalValue ausednutritionalvalue[] = UsedNutritionalValue.values();
    int i1 = ausednutritionalvalue.length;
    int i = 0;
    while (i < i1) {
      UsedNutritionalValue usednutritionalvalue = ausednutritionalvalue[i];
      Object obj = a.inflate(0x7f0401dd, null);
      View view = ((View) (obj)).findViewById(0x7f1104bf);
      TextView textview1 = (TextView) ((View) (obj)).findViewById(0x7f11011f);
      TextView textview = (TextView) ((View) (obj)).findViewById(0x7f1104bc);
      int l;
      if (usednutritionalvalue.e() && usednutritionalvalue.d()) {
        l = 1;
      } else {
        l = 0;
      }
      textview1.setTypeface(textview1.getTypeface(), l);
      textview.setTypeface(textview.getTypeface(), l);
      if (usednutritionalvalue.d()) {
        view.setPadding(0, 0, 0, 0);
      }
      if (usednutritionalvalue.e()) {
        b.addView(((View) (obj)));
      } else {
        c.addView(((View) (obj)));
      }
      textview1.setText(bv.a(getContext().getString(usednutritionalvalue.a())));
      obj = (Double) fooditem.get(usednutritionalvalue.b());
      if (obj == null
          || ((Double) (obj)).isNaN()
          || an.a(((Double) (obj)).doubleValue(), 0) == 0.0D) {
        textview.setText("-");
      } else {
        textview.setText(e.a(getContext(), ((Double) (obj)), usednutritionalvalue.c()));
      }
      i++;
    }
    for (int j = 0; j < b.getChildCount(); j++) {
      if (j % 2 != 0) {
        b.getChildAt(j).setBackgroundColor(getResources().getColor(0x7f0f0098));
      }
    }

    for (int k = 0; k < c.getChildCount(); k++) {
      if (k % 2 != 0) {
        c.getChildAt(k).setBackgroundColor(getResources().getColor(0x7f0f0098));
      }
    }
  }
  private void onMediaUnselected(MediaModel image) {

    for (int i = 0; i < mSelectedImagesContainer.getChildCount(); i++) {
      View childView = mSelectedImagesContainer.getChildAt(i);
      if (childView.getTag().equals(image.url)) {
        mSelectedImagesContainer.removeViewAt(i);
        break;
      }
    }
    // if (mImageSelectedCount == 0 && mVideoSelectedCount == 0) {
    if (mSelectedImagesContainer.getChildCount() == 0) {
      mSelectedImagesContainer.setVisibility(View.GONE);
      mSelectedImageEmptyMessage.setVisibility(View.VISIBLE);
    }
  }
  /**
   * 添加icon到容器中
   *
   * @param context
   * @param id
   * @param iconText
   * @return
   */
  public BottomTabLayout addItem(Context context, int id, String iconText) {

    final BottomTab tab = new BottomTab(context, id, iconText, unSelectColor, selectColor);

    tab.setTabPosition(mTabLayout.getChildCount());
    tab.setLayoutParams(mTabParams);

    mTabLayout.addView(tab);
    tab.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            if (mListener == null) return;

            int pos = tab.getTabPosition();
            if (mCurrentPosition == pos) {
              mListener.onTabReselected(pos);
            } else {
              mListener.onTabSelected(pos, mCurrentPosition);
              tab.setSelected(true);

              mTabLayout.getChildAt(mCurrentPosition).setSelected(false);
              mCurrentPosition = pos;
            }
          }
        });
    return this;
  }
Beispiel #9
0
  protected void initItem() {
    items = new ArrayList<ImageView>();
    LinearLayout topbar = (LinearLayout) findViewById(R.id.top_bar);
    itemCount = topbar.getChildCount();

    for (int i = 0; i < itemCount; i++) {
      ImageView image = (ImageView) topbar.getChildAt(i);

      image.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              for (int n = 0; n < itemCount; n++) {
                ImageView view = items.get(n);
                if ((ImageView) v == view) {
                  currentItem = n;

                  viewPager.setCurrentItem(n);
                  view.setSelected(true);
                } else {
                  view.setSelected(false);
                }
              }
            }
          });

      items.add(image);
    }
    items.get(0).setSelected(true);
  }
 /**
  * 切换菜单
  *
  * @param target
  */
 private void switchMenu(View target) {
   System.out.println(current_tab_position);
   for (int i = 0; i < tabMenuView.getChildCount(); i = i + 2) {
     if (target == tabMenuView.getChildAt(i)) {
       if (current_tab_position == i) {
         closeMenu();
       } else {
         if (current_tab_position == -1) {
           popupMenuViews.setVisibility(View.VISIBLE);
           popupMenuViews.setAnimation(
               AnimationUtils.loadAnimation(getContext(), R.anim.dd_menu_in));
           maskView.setVisibility(VISIBLE);
           maskView.setAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.dd_mask_in));
           popupMenuViews.getChildAt(i / 2).setVisibility(View.VISIBLE);
         } else {
           popupMenuViews.getChildAt(i / 2).setVisibility(View.VISIBLE);
         }
         current_tab_position = i;
         ((TextView) tabMenuView.getChildAt(i)).setTextColor(textSelectedColor);
         ((TextView) tabMenuView.getChildAt(i))
             .setCompoundDrawablesWithIntrinsicBounds(
                 null, null, getResources().getDrawable(menuSelectedIcon), null);
       }
     } else {
       ((TextView) tabMenuView.getChildAt(i)).setTextColor(textUnselectedColor);
       ((TextView) tabMenuView.getChildAt(i))
           .setCompoundDrawablesWithIntrinsicBounds(
               null, null, getResources().getDrawable(menuUnselectedIcon), null);
       popupMenuViews.getChildAt(i / 2).setVisibility(View.GONE);
     }
   }
 }
  @Override
  public void onBackPressed() {

    for (int i = 0; i < rowContainer.getChildCount(); i++) {

      View rowView = rowContainer.getChildAt(i);
      ViewPropertyAnimator propertyAnimator =
          rowView.animate().setStartDelay(i * SCALE_DELAY).scaleX(0).scaleY(0);

      propertyAnimator.setListener(
          new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animator) {}

            @Override
            public void onAnimationEnd(Animator animator) {

              finishAfterTransition();
            }

            @Override
            public void onAnimationCancel(Animator animator) {}

            @Override
            public void onAnimationRepeat(Animator animator) {}
          });
    }
  }
Beispiel #12
0
 /**
  * Set the enabled state of the progress bar.
  *
  * @param One of {@link View#VISIBLE}, {@link View#INVISIBLE}, or {@link View#GONE}.
  */
 public void setProgressBarVisibility(int visibility) {
   int count = mActionsView.getChildCount();
   //		Log.e("ProgressBar", "visibility is "+(visibility == VISIBLE ? "VISIBLE" : "GONE")+" count
   // is "+count+" "+visibility);
   if (count <= 0) {
     mProgress.setVisibility(visibility);
     return;
   }
   mProgress.setVisibility(GONE);
   for (int i = count - 1; i >= 0; i--) {
     View view = mActionsView.getChildAt(i);
     ProgressBar progressbar = (ProgressBar) view.findViewById(R.id.actionbar_progress);
     if (progressbar != null) {
       View item = view.findViewById(R.id.actionbar_item);
       if (visibility == VISIBLE) {
         if (item != null) item.setVisibility(View.GONE);
         progressbar.setVisibility(VISIBLE);
       } else {
         if (item != null) item.setVisibility(View.VISIBLE);
         progressbar.setVisibility(GONE);
       }
       break;
     }
   }
 }
  // region Lifecycle Methods
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quick_return_twitter);
    ButterKnife.inject(this);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mTabs.setAllCaps(false);
    mTabs.setShouldExpand(true);
    mTabs.setTextSize(QuickReturnUtils.dp2px(this, 16));
    mTabs.setTabBackground(R.drawable.selector_bg_tab);
    mTabs.setIndicatorColorResource(R.color.steel_blue);
    mTabs.setIndicatorHeight(QuickReturnUtils.dp2px(this, 5));
    mTabs.setOnPageChangeListener(mTabsOnPageChangeListener);
    mTabs.setViewPager(mViewPager);

    // Set first tab selected
    mTabsLinearLayout = ((LinearLayout) mTabs.getChildAt(0));

    for (int i = 0; i < mTabsLinearLayout.getChildCount(); i++) {
      TextView tv = (TextView) mTabsLinearLayout.getChildAt(i);

      if (i == 0) {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Medium.ttf"));
      } else {
        tv.setTextColor(getResources().getColor(R.color.steel_blue));
        tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf"));
      }
    }
  }
Beispiel #14
0
  @Override
  public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
    final boolean lockedExpanded = widthMode == MeasureSpec.EXACTLY;
    setFillViewport(lockedExpanded);

    final int childCount = mTabLayout.getChildCount();
    if (childCount > 1 && (widthMode == MeasureSpec.EXACTLY || widthMode == MeasureSpec.AT_MOST)) {
      if (childCount > 2) {
        mMaxTabWidth = (int) (MeasureSpec.getSize(widthMeasureSpec) * 0.4f);
      } else {
        mMaxTabWidth = MeasureSpec.getSize(widthMeasureSpec) / 2;
      }
    } else {
      mMaxTabWidth = -1;
    }

    final int oldWidth = getMeasuredWidth();
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    final int newWidth = getMeasuredWidth();

    if (lockedExpanded && oldWidth != newWidth) {
      // Recenter the tab display if we're at a new (scrollable) size.
      updateTab(mSelectedTabIndex);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_players);

    llPlayers = (LinearLayout) findViewById(R.id.llPlayers);
    btnAddPlayer = (Button) findViewById(R.id.btnAddPlayer);
    btnStartGame = (Button) findViewById(R.id.btnStartGame);
    etName = (EditText) findViewById(R.id.etName);

    TextClearButtonHelper.set(etName, getResources().getDrawable(R.drawable.delete), this);

    btnAddPlayer.setEnabled(false);

    btnAddPlayer.setOnClickListener(this);
    btnStartGame.setOnClickListener(this);
    etName.setOnKeyListener(this);

    ThumbnailTextItemView view =
        new ThumbnailTextItemView(
            getBaseContext(),
            llPlayers.getChildCount(),
            getResources().getDrawable(R.drawable.golfer),
            "Me");

    llPlayers.addView(view);
  }
Beispiel #16
0
 @Override
 public void setContent(int layoutId) {
   LinearLayout right = (LinearLayout) findViewById(CONTENT_CONTAINER_ID);
   if (right.getChildCount() > 0) throw new IllegalArgumentException("主视图已存在");
   View content = LayoutInflater.from(getContext()).inflate(layoutId, null, false);
   setContent(content);
 }
Beispiel #17
0
 @Override
 public void setMenu(int layoutId) {
   LinearLayout left = (LinearLayout) findViewById(MENU_CONTAINER_ID);
   if (left.getChildCount() > 0) throw new IllegalArgumentException("菜单视图已存在");
   View menu = LayoutInflater.from(getContext()).inflate(layoutId, null, false);
   setMenu(menu);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    // 如果activity是被用户按下back或者调用finish终止的,那onCreate里面的savedInstanceState变量为null
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ui_test_layout1);

    rootLayout = (LinearLayout) findViewById(R.id.ll_linearlayout_root);

    int count = rootLayout.getChildCount();
    for (int i = 0; i < count; i++) {

      Log.d(TAG, rootLayout.getChildAt(i).toString());
    }

    mTextView = (TextView) findViewById(R.id.textView1);

    if (savedInstanceState == null) {

      createActivitySharedPreference();
    } else {

      if (savedInstanceState.containsKey(TEXTVIEW_STATE_KEY)) {

        mTextView.setText(savedInstanceState.getString(TEXTVIEW_STATE_KEY));
      }
    }
  }
Beispiel #19
0
 public void clearStats() {
   LinearLayout linearLayout = (LinearLayout) this.getChildAt(0);
   for (int i = 0; i < linearLayout.getChildCount(); i = i + 2) {
     TextView textView = (TextView) linearLayout.getChildAt(i);
     textView.setText("--");
   }
 }
  public void update() {
    LinearLayout main = (LinearLayout) (seminar.findViewById(R.id.main_layout));
    if (text.equals("Loading...")) {
      TextView textview = new TextView(main.getContext());
      textview.setText(text);
      textview.setTextColor(Color.WHITE);
      main.addView(textview);
    } else {
      if (main.getChildCount() > 0) main.removeAllViews();

      JSONArray jarray;
      try {
        jarray = new JSONArray(text);
        for (int i = 0; i < jarray.length(); i++) {
          // create a new textview
          JSONObject json = jarray.getJSONObject(i);

          CustomRelativeView event = new CustomRelativeView(main.getContext(), json, i);
          main.addView(event);
        }
        View ruler = new View(main.getContext());
        ruler.setBackgroundColor(Color.LTGRAY);
        main.addView(ruler, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 2));
      } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
Beispiel #21
0
  public void addButton(final String text, final String tag, final OnButtonClickListener listener) {
    final Button button =
        (Button) LayoutInflater.from(getContext()).inflate(R.layout.doorhanger_button, null);
    button.setText(text);
    button.setTag(tag);

    button.setOnClickListener(
        new Button.OnClickListener() {
          @Override
          public void onClick(View v) {
            listener.onButtonClick(DoorHanger.this, tag);
          }
        });

    if (mChoicesLayout.getChildCount() == 0) {
      // If this is the first button we're adding, make the choices layout visible.
      mChoicesLayout.setVisibility(View.VISIBLE);
      // Make the divider above the buttons visible.
      View divider = findViewById(R.id.divider_choices);
      divider.setVisibility(View.VISIBLE);
      divider.setBackgroundColor(mDividerColor);
    } else {
      // Add a vertical divider between additional buttons.
      Divider divider = new Divider(getContext(), null);
      divider.setOrientation(Divider.Orientation.VERTICAL);
      divider.setBackgroundColor(mDividerColor);
      mChoicesLayout.addView(divider);
    }

    mChoicesLayout.addView(button, sButtonParams);
  }
Beispiel #22
0
  public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
    if (colorPreview == null) return;
    this.colorPreview = colorPreview;
    if (selectedColor == null) selectedColor = 0;
    int children = colorPreview.getChildCount();
    if (children == 0 || colorPreview.getVisibility() != View.VISIBLE) return;

    for (int i = 0; i < children; i++) {
      View childView = colorPreview.getChildAt(i);
      if (!(childView instanceof LinearLayout)) continue;
      LinearLayout childLayout = (LinearLayout) childView;
      if (i == selectedColor) {
        childLayout.setBackgroundColor(Color.WHITE);
      }
      ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
      childImage.setClickable(true);
      childImage.setTag(i);
      childImage.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              if (v == null) return;
              Object tag = v.getTag();
              if (tag == null || !(tag instanceof Integer)) return;
              setSelectedColor((int) tag);
            }
          });
    }
  }
Beispiel #23
0
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
          mDbHelper.open();
          Cursor v = mDbHelper.getVehicles();
          v.moveToPosition(pos);
          int vNum = v.getInt(v.getColumnIndex(mDbHelper.KEY_ID));
          fuelCursor = mDbHelper.fetchAllFuelByV(vNum);
          if (fuelCursor.getCount() > 2) {
            // set layout
            if (mLayout.getChildCount() > 0) {
              mLayout.removeAllViews();
            }
            mLayout.addView(
                mChartView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
            mCurrentCostSeries.clear();
            mCurrentEffSeries.clear();
            vehicleChange = true;

            // clear any existing labels
            // mRenderer.clearYTextLabels();

            collectFuelStats(vNum, fuelCursor);
            drawChart();
            vehicleChange = false;
          } else {
            mLayout.removeAllViews();
            mDailyCost.setText("");
            // no data. barf on user
            Toast.makeText(
                    AnalyzeFuel.this,
                    getApplicationContext().getResources().getString(R.string.nodata_ned),
                    Toast.LENGTH_LONG)
                .show();
          }
          mDbHelper.close();
        }
  @SuppressWarnings("unused")
  private void initSubFragmentProgress() {
    RelativeLayout subFragmentHolder =
        (RelativeLayout) rootView.findViewById(R.id.wizard_sub_fragments_holder);
    subFragmentHolder.setVisibility(View.VISIBLE);

    subFragmentProgress = (LinearLayout) rootView.findViewById(R.id.wizard_sub_fragments_progress);

    for (int i = 0; i < subFragmentProgress.getChildCount(); i++) {
      try {
        View v = subFragmentProgress.getChildAt(i);
        ((LinearLayout) v.getParent()).removeView(v);
      } catch (NullPointerException e) {
      }
    }

    for (Fragment f : subFragments) {
      ImageView p = new ImageView(a);
      LinearLayout.LayoutParams lp =
          new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
      lp.setMargins(5, 0, 5, 0);
      p.setLayoutParams(lp);
      subFragmentProgress.addView(p);
    }

    subFragmentNext = (ImageButton) rootView.findViewById(R.id.wizard_sub_fragment_next);
    subFragmentNext.setOnClickListener(this);

    advanceWizardSubFragment(subFragments.get(0));
  }
  public boolean removeImage(Uri uri) {

    boolean result = mSelectedImages.remove(uri);

    if (result) {

      if (GalleryFragment.mGalleryAdapter != null) {
        GalleryFragment.mGalleryAdapter.notifyDataSetChanged();
      }

      for (int i = 0; i < mSelectedImagesContainer.getChildCount(); i++) {
        View childView = mSelectedImagesContainer.getChildAt(i);
        if (childView.getTag().equals(uri)) {
          mSelectedImagesContainer.removeViewAt(i);
          break;
        }
      }

      if (mSelectedImages.size() == 0) {
        mSelectedImagesContainer.setVisibility(View.GONE);
        mSelectedImageEmptyMessage.setVisibility(View.VISIBLE);
      }
    }
    return result;
  }
  private void updateBtnColors(boolean b) {
    DataSource dataSource = DataService.getDataSource();
    if (!(dataSource instanceof TableDishRelations)) return;
    LinearLayout btnsParent = (LinearLayout) findViewById(R.id.order_btns);
    for (int i = btnsParent.getChildCount(); i > 0; i--) {
      Button btn = (Button) btnsParent.getChildAt(i - 1);
      int tableNr = Integer.parseInt(btn.getText().toString().replace("Bord ", ""));
      if (tableOrders.getDishesFromTable(tableNr - 1).size() > 0) {
        List<TableHasDish> tbl2 = tableOrders.getDishesFromTable(tableNr - 1);
        List<TableHasDish> tbl1 = tableOrdersLocal.getDishesFromTable(tableNr - 1);

        boolean isEqual = tbl1.size() == tbl2.size();
        if (isEqual) {
          for (TableHasDish hd : tbl1) {
            for (TableHasDish hd2 : tbl2) {
              if (hd.getDish().id != hd2.getDish().id) isEqual = false;
            }
          }
        }
        // om tableOrder == dataSource => lagar mat => orange
        if (isEqual) btn.setBackgroundResource(R.drawable.orange_button);
        // annars => kund äter => grön
        else btn.setBackgroundResource(R.drawable.green_button);
      } else btn.setBackgroundResource(R.drawable.default_button);
    }
  }
Beispiel #27
0
 private void handleUpdateConditions() {
   if (mTransitionHelper.isTransitioning()) {
     mTransitionHelper.pendingUpdateConditions();
     return;
   }
   final int conditionCount = mConditions == null ? 0 : mConditions.length;
   if (DEBUG) Log.d(mTag, "handleUpdateConditions conditionCount=" + conditionCount);
   // forever
   bind(forever(), mZenConditions.getChildAt(FOREVER_CONDITION_INDEX));
   // countdown
   if (mCountdownConditionSupported && mTimeCondition != null) {
     bind(mTimeCondition, mZenConditions.getChildAt(COUNTDOWN_CONDITION_INDEX));
   }
   // provider conditions
   for (int i = 0; i < conditionCount; i++) {
     bind(mConditions[i], mZenConditions.getChildAt(mFirstConditionIndex + i));
   }
   // hide the rest
   for (int i = mZenConditions.getChildCount() - 1;
       i > mFirstConditionIndex + conditionCount;
       i--) {
     mZenConditions.getChildAt(i).setVisibility(GONE);
   }
   // ensure something is selected
   if (mExpanded) {
     ensureSelection();
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View view = inflater.inflate(R.layout.flag_quiz_frag, container, false);

    fileNameList = new ArrayList<String>();
    flagflagList = new ArrayList<String>();
    random = new SecureRandom();

    // shakeAnimation.setRepeatCount(3);

    questionNumberTV = (TextView) view.findViewById(R.id.flagQuestionNumberTV);
    flagView = (ImageView) view.findViewById(R.id.flagImageView);
    guessLinearLayouts = new LinearLayout[2];
    guessLinearLayouts[0] = (LinearLayout) view.findViewById(R.id.flagRow1);
    guessLinearLayouts[1] = (LinearLayout) view.findViewById(R.id.flagRow2);
    answerTextView = (TextView) view.findViewById(R.id.flagAnswer);
    scoreTextView = (TextView) view.findViewById(R.id.flagScoreTextView);

    for (LinearLayout row : guessLinearLayouts) {
      for (int column = 0; column < row.getChildCount(); column++) {
        Button button = (Button) row.getChildAt(column);
        button.setOnClickListener(guessButtonListener);
      }
    }

    questionNumberTV.setText(
        getResources().getString(R.string.questionNumberTV, 1, NUMBER_OF_QUESTIONS));
    scoreTextView.setText(Integer.toString(questionScore));

    scoreHandler.postDelayed(scoreRunnable, 1000);

    return view;
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedinstanceState) {
   View ll = inflater.inflate(R.layout.navbar, container, false);
   mResetButton = (ImageButton) ll.findViewById(R.id.reset_button);
   mResetButton.setOnClickListener(mCommandButtons);
   mAddButton = (ImageButton) ll.findViewById(R.id.add_button);
   mAddButton.setOnClickListener(mCommandButtons);
   mSaveButton = (ImageButton) ll.findViewById(R.id.save_button);
   mSaveButton.setOnClickListener(mCommandButtons);
   mLeftMenu = (ImageView) ll.findViewById(R.id.left_menu);
   mNavBarContainer = (LinearLayout) ll.findViewById(R.id.navbar_container);
   mNavButtonsContainer = (LinearLayout) ll.findViewById(R.id.button_container);
   mButtonViews.clear();
   for (int i = 0; i < mNavButtonsContainer.getChildCount(); i++) {
     ImageButton ib = (ImageButton) mNavButtonsContainer.getChildAt(i);
     mButtonViews.add(ib);
   }
   mRightMenu = (ImageView) ll.findViewById(R.id.right_menu);
   if (mButtons.size() == 0) {
     loadButtons();
   }
   refreshButtons();
   return ll;
 }
Beispiel #30
0
 void addView() {
   ltInflater = getLayoutInflater();
   View item = ltInflater.inflate(R.layout.item, l1, false);
   TextView tvName = (TextView) item.findViewById(R.id.textView1);
   tvName.setText("№" + String.valueOf(l1.getChildCount() + 1) + " - ");
   l1.addView(item);
 }