Exemple #1
0
  private void loadUserInfo() {
    try {
      connMgr = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
      networkInfo = connMgr.getActiveNetworkInfo();

      if (networkInfo != null && networkInfo.isConnected()) {
        noInternetLayout.setVisibility(View.GONE);
        scrollViewLayout.setVisibility(View.VISIBLE);
        noInternetLayoutInfo.setVisibility(View.GONE);

        // fetch data
        if (sUserId != null) {
          new ProfileTask().execute(sUserId);
        } else if (sPagesId != null) {
          new ProfileTask().execute(sPagesId);
        }
      } else {
        // display error
        noInternetLayoutInfo.setVisibility(View.VISIBLE);
        scrollViewLayout.setVisibility(View.GONE);
        noInternetLayout.setVisibility(View.VISIBLE);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      noInternetLayoutInfo.setVisibility(View.VISIBLE);
      scrollViewLayout.setVisibility(View.GONE);
      noInternetLayout.setVisibility(View.VISIBLE);
    }
  }
 public void initData() {
   getFragmentArguments();
   if (pageNo == 1) {
     llRelatedVideos.setVisibility(View.GONE);
     scrollView.setVisibility(View.VISIBLE);
     tvVideoLongDescription.setText(videoObject.getVideoLongDescription());
   } else {
     scrollView.setVisibility(View.GONE);
     llRelatedVideos.setVisibility(View.VISIBLE);
     relatedVideosTask = new FetchRelatedRecords();
     relatedVideosTask.execute(videoObject);
   }
 }
  public void reset() {
    if (null != mScrollText) {
      mScrollText.setVisibility(View.GONE);
    }

    if (null != mImageView) {
      mImageView.setVisibility(View.GONE);
    }

    if (null != mAudioPlayer) {
      stopAudio();
    }

    if (null != mVideoView) {
      stopVideo();
      mVideoView.setVisibility(View.GONE);
    }

    if (null != mTextView) {
      mTextView.setVisibility(View.GONE);
    }

    if (mScrollViewPort != null) {
      mScrollViewPort.scrollTo(0, 0);
      mScrollViewPort.setLayoutParams(
          new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 0, 0));
    }
  }
 protected void a() {
   Object localObject = (ScrollView) g.a(mContext).inflate(2130903099, null);
   d = ((ScrollView) localObject).findViewById(2131362077);
   e = d.findViewById(2131362078);
   f = d.findViewById(2131362082);
   f.setVisibility(8);
   g = d.findViewById(2131362083);
   g.setVisibility(8);
   n = new ha(this, mContext);
   n.a();
   a(e);
   i = ((ScrollView) localObject).findViewById(2131362086);
   j = i.findViewById(2131362078);
   k = i.findViewById(2131362082);
   a = new e(mContext);
   a(j, 0);
   a(k, 1);
   setContentView((View) localObject);
   ((ScrollView) localObject).setScrollbarFadingEnabled(false);
   if (!(ad.a(mContext).ak() | ad.a(mContext).am())) {
     i.setVisibility(8);
     ((ScrollView) localObject).findViewById(2131362084).setVisibility(8);
   }
   localObject = null;
   if (FileExplorerActivity.J() != null) {
     localObject = FileExplorerActivity.J().z();
   }
   if ((localObject != null) && (am.aN((String) localObject))) {
     a(1);
     a(2);
   }
 }
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity_frag);

    if (savedInstanceState == null) {
      FragmentManager manager = getFragmentManager();

      // Start transaction
      FragmentTransaction transaction = manager.beginTransaction();

      // Create fragments
      menu = new MenuFragment();
      main = new NewsListFragment();
      top = new TopFragment();

      // Add fragments
      transaction.add(RIGHT_FRAG, main);
      transaction.add(LEFT_FRAG, menu);
      transaction.add(BOTTOM_FRAG, top);

      transaction.commit();
    }

    if (!ObjectStorage.menuHidden) {
      ScrollView scrollview = (ScrollView) findViewById(R.id.fragleft);
      scrollview.setVisibility(View.VISIBLE);
      FrameLayout menuFrame = (FrameLayout) findViewById(R.id.fragmentcontainerleft);
      menuFrame.setVisibility(View.VISIBLE);
    }
    // For convienence get the list of images early on... Slow connection propogation
    // new GetImageUrlTask().execute();
  }
Exemple #6
0
  private void startShowProgressBar(Boolean bFoolGone) {

    scrollForMes.setVisibility(View.GONE);

    frame_for_progress_bar.setVisibility(View.VISIBLE);
    frame_for_progress_bar.bringToFront();
  }
 public void setTextVisibility(boolean visible) {
   if (mConformanceMode) {
     if (mTextView != null) {
       mTextView.setVisibility(visible ? View.VISIBLE : View.GONE);
     }
   } else if (mScrollText != null) {
     mScrollText.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
   }
 }
 private void displaySide() {
   // If menu is hidden, display the image
   if (ObjectStorage.menuHidden) {
     ObjectStorage.menuHidden = false;
     ScrollView scrollview = (ScrollView) findViewById(R.id.fragleft);
     scrollview.setVisibility(View.VISIBLE);
     FrameLayout menuFrame = (FrameLayout) findViewById(R.id.fragmentcontainerleft);
     menuFrame.setVisibility(View.VISIBLE);
   } else {
     // If the menu is visible, hide it
     ObjectStorage.menuHidden = true;
     // menuVisibility.setBackgroundResource(R.drawable.navigationnextitem);
     ScrollView scrollview = (ScrollView) findViewById(R.id.fragleft);
     scrollview.setVisibility(View.GONE);
     FrameLayout menuFrame = (FrameLayout) findViewById(R.id.fragmentcontainerleft);
     menuFrame.setVisibility(View.GONE);
   }
 }
  private void handleResult(AsyncResult ar) {
    if (ar.exception == null) {
      if (DBG) log("handleResult: success!");

      if (mState == EntryState.ES_PUK) {
        mScrollView.setVisibility(View.VISIBLE);
        mIccPUKPanel.setVisibility(View.GONE);
      }
      // TODO: show success feedback
      showConfirmation();

      mHandler.postDelayed(
          new Runnable() {
            public void run() {
              finish();
            }
          },
          3000);

    } else if (ar.exception instanceof CommandException
    /*  && ((CommandException)ar.exception).getCommandError() ==
    CommandException.Error.PASSWORD_INCORRECT */ ) {
      if (mState == EntryState.ES_PIN) {
        if (DBG) log("handleResult: pin failed!");
        mOldPin.getText().clear();
        mBadPinError.setVisibility(View.VISIBLE);
        CommandException ce = (CommandException) ar.exception;
        if (ce.getCommandError() == CommandException.Error.SIM_PUK2) {
          if (DBG) log("handleResult: puk requested!");
          mState = EntryState.ES_PUK;
          displayPUKAlert();
          mScrollView.setVisibility(View.GONE);
          mIccPUKPanel.setVisibility(View.VISIBLE);
          mPUKCode.requestFocus();
        }
      } else if (mState == EntryState.ES_PUK) {
        // should really check to see if the error is CommandException.PASSWORD_INCORRECT...
        if (DBG) log("handleResult: puk2 failed!");
        displayPUKAlert();
        mPUKCode.getText().clear();
        mPUKCode.requestFocus();
      }
    }
  }
Exemple #10
0
 private void showProgressBar(boolean show) {
   ProgressBar spinner = (ProgressBar) findViewById(R.id.progressBar_changepassword);
   ScrollView sv = (ScrollView) findViewById(R.id.aux14);
   Button button = (Button) findViewById(R.id.button_changepassword);
   // show progress bar?
   if (show) {
     spinner.setVisibility(View.VISIBLE);
     // hide scroll view
     sv.setVisibility(View.GONE);
     // disable sign in button
     button.setEnabled(false);
   } else {
     spinner.setVisibility(View.GONE);
     // show scroll view
     sv.setVisibility(View.VISIBLE);
     // enable sign in button
     button.setEnabled(true);
   }
 }
  public void backToDisplay(View v) // work's on back click
      {
    if (llForAdding.getVisibility() == View.VISIBLE) {
      llForAdding.setVisibility(View.GONE);

      llForDisplay.setVisibility(View.VISIBLE);

      tvAddItem.setVisibility(View.VISIBLE);
    }
  }
  /** Shows the progress UI and hides the register form. */
  @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
  private void showProgress(final boolean show) {
    // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
    // for very easy animations. If available, use these APIs to fade-in
    // the progress spinner.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
      int shortAnimTime =
          getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);

      garageProgress.setVisibility(View.VISIBLE);
      garageProgress
          .animate()
          .setDuration(shortAnimTime)
          .alpha(show ? 1 : 0)
          .setListener(
              new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                  garageProgress.setVisibility(show ? View.VISIBLE : View.GONE);
                }
              });

      garageForm.setVisibility(View.VISIBLE);
      garageForm
          .animate()
          .setDuration(shortAnimTime)
          .alpha(show ? 0 : 1)
          .setListener(
              new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                  garageForm.setVisibility(show ? View.GONE : View.VISIBLE);
                }
              });
    } else {
      // The ViewPropertyAnimator APIs are not available, so simply show
      // and hide the relevant UI components.
      garageProgress.setVisibility(show ? View.VISIBLE : View.GONE);
      garageForm.setVisibility(show ? View.GONE : View.VISIBLE);
    }
  }
  /** 用来显示该popwindow,保证在调用该方法之前已经调用{@link #addItemToBottomPopWindow(int, int, String)}方法 */
  protected void showBottomPopWindow() {
    if (Build.VERSION.SDK_INT >= 11) {
      // 如果上次的动画还在执行,直接停止
      if (reverseAnimation != null) {
        reverseAnimation.end();
      }
      sv_bottom_content.setVisibility(View.VISIBLE);
      ll_full_screen.setVisibility(View.VISIBLE);
      // 需要滚动到顶部
      sv_bottom_content.scrollTo(0, 0);
      if (popAnimation == null) {
        popAnimation =
            ObjectAnimator.ofInt(sv_bottom_content, "bottomMargin", -scrollViewMeasureHeight, 0);
        popAnimation.addUpdateListener(
            new ValueAnimator.AnimatorUpdateListener() {
              @Override
              public void onAnimationUpdate(ValueAnimator animation) {
                int value = (Integer) animation.getAnimatedValue();
                RelativeLayout.LayoutParams params =
                    (RelativeLayout.LayoutParams) sv_bottom_content.getLayoutParams();
                params.bottomMargin = value;
                sv_bottom_content.setLayoutParams(params);
                ((View) (sv_bottom_content.getParent())).invalidate();

                ll_full_screen.setAlpha(
                    (float)
                        (((scrollViewMeasureHeight + value) * 1.0)
                            / (scrollViewMeasureHeight * 1.0)));
              }
            });
        popAnimation.setDuration(500);
      }
      popAnimation.start();
    } else {
      ll_full_screen.setVisibility(View.VISIBLE);
      sv_bottom_content.setVisibility(View.VISIBLE);
      // 需要滚动到顶部
      sv_bottom_content.scrollTo(0, 0);
    }
  }
  /*
   * This handles hiding and showing various views depending on the privacy
   * settings of the app and the current state of the phone (keyguard on or off)
   */
  private final void refreshPrivacy() {
    if (Log.DEBUG) Log.v("refreshPrivacy()");
    messageViewed = true;

    if (message.getMessageType() == SmsMmsMessage.MESSAGE_TYPE_SMS) {
      if (privacyMode) {
        // We need to init the keyguard class so we can check if the keyguard is
        // on
        ManageKeyguard.initialize(getApplicationContext());

        if (ManageKeyguard.inKeyguardRestrictedInputMode()) {
          messageViewed = false;

          if (privacyView == null) {
            privacyView = privacyViewStub.inflate();

            // The view button (if in privacy mode)
            Button viewButton = (Button) privacyView.findViewById(R.id.ViewButton);
            viewButton.setOnClickListener(
                new OnClickListener() {
                  public void onClick(View v) {
                    viewMessage();
                  }
                });
          }
          messageScrollView.setVisibility(View.GONE);
        } else {
          if (privacyView != null) {
            privacyView.setVisibility(View.GONE);
          }
          messageScrollView.setVisibility(View.VISIBLE);
        }
      } else {
        if (privacyView != null) {
          privacyView.setVisibility(View.GONE);
        }
        messageScrollView.setVisibility(View.VISIBLE);
      }
    }
  }
  private void initView() {
    goback = (ImageButton) findViewById(R.id.goback);
    btn_submit = (Button) findViewById(R.id.btn_submit);
    scroll_page_main = (ScrollView) findViewById(R.id.scroll_page_main);
    scroll_page_sub = (ScrollView) findViewById(R.id.scroll_page_sub);
    linear_main = (LinearLayout) findViewById(R.id.linear_main);
    linear_sub = (LinearLayout) findViewById(R.id.linear_sub);
    scroll_page_main.setVisibility(View.VISIBLE);
    scroll_page_sub.setVisibility(View.GONE);
    params =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    params.height = 1;
    params.leftMargin = 40;
    goback.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
          }
        });
    btn_submit.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            code = "";
            value = "不限";
            Intent intent = new Intent();
            intent.putExtra(POSITION_CODES, code);
            intent.putExtra(POSITION_VALUES, value);
            ((Activity) context).setResult(SubscribeActivity.REQUESTCODE_POSITIONCLASS, intent);
            finish();
          }
        });
  }
        @Override
        public void onCompleted(Exception e, PlusPerson plusPerson) {
          progressBarSpinner.setVisibility(View.GONE);
          d(
              "[DEBUG] fucverg.saulmm.gdg.gui.fragments.GroupFragment.onCompleted ",
              "Posts completed...");

          if (plusPerson != null) {
            baseLayout.setVisibility(View.VISIBLE);
            scrollView.setVisibility(View.VISIBLE);
            errorLayout.setVisibility(View.INVISIBLE);

            String content = plusPerson.getAboutMe().replaceAll("<br />", "");

            fillUrlsLayout(plusPerson.getUrls());

            GroupInfo apiGroupInfo = new GroupInfo();
            apiGroupInfo.setAbout(content);
            apiGroupInfo.setId(plusPerson.getId());
            apiGroupInfo.setTagLine(plusPerson.getTagline());
            apiGroupInfo.setName(plusPerson.getDisplayName());

            fillAboutUIElements(apiGroupInfo);

            dbHandler.insertElement(GroupInfo.class, apiGroupInfo.getFields());

          } else {
            e(
                "[ERROR] fucverg.saulmm.gdg.gui.fragments.AboutFragment.onCompleted ",
                "Error retrieving the gdg about data.");

            errorLayout.setVisibility(View.VISIBLE);
            scrollView.setVisibility(View.INVISIBLE);

            GuiUtils.showShortToast(getActivity(), "No hay red");
          }
        }
  private void getData(final boolean isSave) {
    mProgressWheel.setVisibility(View.VISIBLE);
    mPickYmsView.setEnabled(false);
    mScrollView.setVisibility(View.GONE);
    mNoCourseLinearLayout.setVisibility(View.GONE);
    mHolidayTextView.setVisibility(View.GONE);
    mSwipeRefreshLayout.setEnabled(false);

    Helper.getCourseTimeTable(
        this,
        mYms.split(",")[0],
        mYms.split(",")[1],
        new CourseCallback() {

          @Override
          public void onSuccess(List<List<CourseModel>> modelList) {
            super.onSuccess(modelList);

            if (isSave
                && Memory.getBoolean(CourseActivity.this, Constant.PREF_COURSE_NOTIFY, false)) {
              AlarmHelper.setCourseNotification(CourseActivity.this, modelList);
            }

            mList = modelList;
            setUpCourseTable();
            mPickYmsView.setEnabled(true);
          }

          @Override
          public void onFail(String errorMessage) {
            super.onFail(errorMessage);

            mList.clear();
            isRetry = true;
            setUpCourseTable();
            mPickYmsView.setEnabled(true);
          }

          @Override
          public void onTokenExpired() {
            super.onTokenExpired();
            Utils.createTokenExpired(CourseActivity.this).show();
            mTracker.send(
                new HitBuilders.EventBuilder().setCategory("token").setAction("expired").build());
          }
        });
  }
  private void setBitmap() {
    mBitmap = Bitmap.createBitmap(screenWidth, screenHeight * totalPages, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(mBitmap);
    scrollView.draw(canvas);

    page1 = Bitmap.createBitmap(screenWidth, screenHeight, Bitmap.Config.ARGB_8888);
    Canvas canvas1 = new Canvas(page1);
    canvas1.drawBitmap(mBitmap, 0, 0, new Paint());
    page2 = Bitmap.createBitmap(screenWidth, screenHeight, Bitmap.Config.ARGB_8888);
    Canvas canvas2 = new Canvas(page2);
    canvas2.drawBitmap(mBitmap, 0, -screenHeight, new Paint());
    // removeAllViews();
    scrollView.setVisibility(View.GONE);
    //
    mBookView.init(page1, page2);
    //
  }
  public void changeGUI() {

    if (oTable != null && oGraph != null && oChart != null) {
      int iRun = 0, iWalk = 0, iBike = 0;
      int iTableSize = oTable.size();
      for (int i = 0; i < iTableSize; i++) {

        if (oTable.get(i).getiTypeExercise() == 0) {
          // Run
          try {
            iRun = Integer.parseInt(oTable.get(i).getsDistance().replace(" ", ""));
          } catch (NumberFormatException e) {
            iRun = 0;
          }
          oTxtRun.setText(oTable.get(i).getsDistance() + sUnit);
          oTxtKalRun.setText(oTable.get(i).getsCalories() + " " + getString(R.string.kalories));
        } else if (oTable.get(i).getiTypeExercise() == 1) {
          // Bike
          try {
            iBike = Integer.parseInt(oTable.get(i).getsDistance().replace(" ", ""));
          } catch (NumberFormatException e) {
            iBike = 0;
          }
          oTxtBike.setText(oTable.get(i).getsDistance() + sUnit);
          oTxtKalBike.setText(oTable.get(i).getsCalories() + " " + getString(R.string.kalories));
        } else if (oTable.get(i).getiTypeExercise() == 100) {
          // walk
          try {
            iWalk = Integer.parseInt(oTable.get(i).getsDistance().replace(" ", ""));
          } catch (NumberFormatException e) {
            iWalk = 0;
          }
          oTxtWalk.setText(oTable.get(i).getsDistance() + sUnit);
          oTxtKalWalk.setText(oTable.get(i).getsCalories() + " " + getString(R.string.kalories));
        }
      }
      oTxtTot.setText((iRun + iBike + iWalk) + sUnit);

      // Log.v(this.getClass().getCanonicalName(),"End Child: "+ oGraph.getChildCount());
      if (oWaitForLoad != null) {
        oWaitForLoad.setVisibility(View.GONE);
        oScroll.setVisibility(View.VISIBLE);
      }
    }
  }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   gvIndex = position + 1;
   if (isShowHelper) {
     // 开启了照相辅助后如果点击的index超出了原有的项,直接拍照
     if (gvIndex > itemCount) {
       showCameraDialog();
     } else {
       titleView.setTitleName("拍照辅助");
       titleView.getIbtRight().setVisibility(View.VISIBLE);
       gvDisImg.setVisibility(View.GONE);
       svCameraHelper.setVisibility(View.VISIBLE);
       setSv();
     }
   } else {
     showCameraDialog();
   }
 }
  protected void onActivityResult(
      int requestCode, int resultCode, Intent data) // after we get an image from camera
      {
    if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
      Bitmap photo = (Bitmap) data.getExtras().get("data");

      base64 = convertBitMapToBase64(photo);

      // System.out.println("  "+base64);

      if (llForDisplay.getVisibility() == View.VISIBLE) {
        llForAdding.setVisibility(View.VISIBLE);

        llForDisplay.setVisibility(View.GONE);

        tvAddItem.setVisibility(View.GONE);
      }
    }
  }
  /** 执行反向动画将其隐藏 */
  private void doReverseAnimation() {
    if (Build.VERSION.SDK_INT < 11) {
      sv_bottom_content.setVisibility(View.GONE);
      ll_full_screen.setVisibility(View.GONE);
    } else {
      // 如果弹出动画还在执行,则直接将弹出动画的值置为最终值,代表该动画结束,接着直接进行收进动画
      popAnimation.end();
      // 避免用户连续快速点击造成短时间内执行两次收进动画,此处进行判断
      if (reverseAnimation != null && reverseAnimation.isRunning()) {
        return;
      }
      if (reverseAnimation == null) {
        reverseAnimation =
            ObjectAnimator.ofInt(sv_bottom_content, "bottomMargin", 0, -scrollViewMeasureHeight);
        reverseAnimation.addUpdateListener(
            new ValueAnimator.AnimatorUpdateListener() {
              @Override
              public void onAnimationUpdate(ValueAnimator animation) {
                int value = (Integer) animation.getAnimatedValue();
                RelativeLayout.LayoutParams params =
                    (RelativeLayout.LayoutParams) sv_bottom_content.getLayoutParams();
                params.bottomMargin = value;
                sv_bottom_content.setLayoutParams(params);
                ((View) (sv_bottom_content.getParent())).invalidate();
                if (value <= -scrollViewMeasureHeight) {
                  sv_bottom_content.setVisibility(View.GONE);
                }

                ll_full_screen.setAlpha(
                    (float)
                        (((scrollViewMeasureHeight + value) * 1.0)
                            / (scrollViewMeasureHeight * 1.0)));
                if (ll_full_screen.getAlpha() <= 0) {
                  ll_full_screen.setVisibility(View.GONE);
                }
              }
            });
        reverseAnimation.setDuration(500);
      }
      reverseAnimation.start();
    }
  }
  /** 请求数据 */
  public void requestData() {
    sv_medicine.setVisibility(View.INVISIBLE);
    new NetTask(baseContext) {
      @Override
      protected JSONObject onLoad() {
        return PatientEngine.getMedicineSchedule(patientId);
      }

      @Override
      protected void onSuccess(JSONObject jsonObject) throws Exception {
        Log.d("getMedicineSchedule", jsonObject.toString());
        Gson gson = new Gson();
        Type type = new TypeToken<ArrayList<Medicine>>() {}.getType();
        medicines = gson.fromJson(jsonObject.getString("Data"), type);
        sv_medicine.setVisibility(View.VISIBLE);
        if (medicines == null) Toast.makeText(baseContext, "暂无服药方案", Toast.LENGTH_SHORT).show();
        initMedicine();
      }

      @Override
      protected void onError(int errorCode, String errorStr) {
        super.onError(errorCode, errorStr);
      }

      @Override
      protected void onStart() {
        super.onStart();
        myProgressDialog.show();
      }

      @Override
      protected void onFail() {
        super.onFail();
      }

      @Override
      protected void onFinish() {
        super.onFinish();
        myProgressDialog.dismiss();
      }
    }.execute();
  }
  private void changeVisibility() {

    scrollView.setVisibility(View.VISIBLE);

    if (selectAddressChild.getVisibility() == View.GONE) {
      selectAddress.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_minus, 0, 0, 0);
      if (addNewAddressChild.getVisibility() == View.GONE) {

        expand(selectAddressChild);
      } else {

        expand(selectAddressChild);
        selectAddress.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_plus, 0, 0, 0);
        //
        // addNewAddressChild.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_plus,0,0,0);
        collapse(addNewAddressChild);
      }

    } // if it is visible then execute the else part and collapse it
    else {
      selectAddress.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_plus, 0, 0, 0);
      collapse(selectAddressChild);
    }
  }
Exemple #25
0
  public void setDashboardVisibility(
      boolean visible, DashboardType type, DashboardType prevItem, boolean animation) {
    if (visible == this.visible && type == visibleType) {
      return;
    }
    this.previousVisibleType = prevItem;
    this.visible = visible;
    boolean refresh = this.visibleType == type;
    this.visibleType = type;
    DashboardOnMap.staticVisible = visible;
    DashboardOnMap.staticVisibleType = type;
    mapActivity.enableDrawer();
    if (visible) {
      mapViewLocation = mapActivity.getMapLocation();
      mapRotation = mapActivity.getMapRotate();
      mapLinkedToLocation = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
      myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
      mapActivity.getMapViewTrackingUtilities().setDashboard(this);
      mapActivity.disableDrawer();
      dashboardView.setVisibility(View.VISIBLE);
      if (isActionButtonVisible()) {
        actionButton.setVisibility(View.VISIBLE);
      } else {
        hideActionButton();
      }
      updateDownloadBtn();
      View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
      ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
      if (visibleType == DashboardType.DASHBOARD) {
        addOrUpdateDashboardFragments();
        scrollView.setVisibility(View.VISIBLE);
        scrollView.scrollTo(0, 0);
        listViewLayout.setVisibility(View.GONE);
        onScrollChanged(scrollView.getScrollY(), false, false);
      } else {
        scrollView.setVisibility(View.GONE);
        listViewLayout.setVisibility(View.VISIBLE);
        if (listView instanceof ObservableListView) {
          onScrollChanged(listView.getScrollY(), false, false);
        }
        if (refresh) {
          refreshContent(false);
        } else {
          updateListAdapter();
          updateListBackgroundHeight();
        }
      }
      mapActivity
          .findViewById(R.id.toolbar_back)
          .setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
      mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);

      updateToolbarActions();
      // fabButton.showFloatingActionButton();
      open(dashboardView.findViewById(R.id.animateContent), animation);
      updateLocation(true, true, false);
      //			addOrUpdateDashboardFragments();
    } else {
      mapActivity.getMapViewTrackingUtilities().setDashboard(null);
      hide(dashboardView.findViewById(R.id.animateContent), animation);
      mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.VISIBLE);
      hideActionButton();
      for (WeakReference<DashBaseFragment> df : fragList) {
        if (df.get() != null) {
          df.get().onCloseDash();
        }
      }
    }
  }
 @Override
 public void showProgress() {
   progressBar.setVisibility(View.VISIBLE);
   contentScrollView.setVisibility(View.INVISIBLE);
 }
 private void showView() {
   allDetailContent.setVisibility(View.VISIBLE);
   detail_go_pindan_btn.setVisibility(View.VISIBLE);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Bundle arguments = getArguments();
    if (arguments != null) {
      mMovies = arguments.getParcelable(FragmentDetailActivity.DETAIL_MOVIE);
    }

    View rootView = inflater.inflate(R.layout.fragment_activity_detail, container, false);

    mContainerScroll = (ScrollView) rootView.findViewById(R.id.detail_layout);

    if (mMovies != null) {
      mContainerScroll.setVisibility(View.VISIBLE);
    } else {
      mContainerScroll.setVisibility(View.INVISIBLE);
    }

    mMoviesPosterImage = (ImageView) rootView.findViewById(R.id.detail_movies_poster);

    mMoviesTrailersLinear = (LinearListView) rootView.findViewById(R.id.detail_movies_trailers);
    mMoviesReviewsLinear = (LinearListView) rootView.findViewById(R.id.detail_movies_reviews);

    mMoviesReviewsCard = (CardView) rootView.findViewById(R.id.detail_movies_reviews_cardview);
    mMoviesTrailersCard = (CardView) rootView.findViewById(R.id.detail_movies_trailers_cardview);

    mMoviesTitleText = (TextView) rootView.findViewById(R.id.detail_movies_title);
    mMoviesOverviewText = (TextView) rootView.findViewById(R.id.detail_movies_overview);
    mMoviesReleaseDateText = (TextView) rootView.findViewById(R.id.detail_movies_date);
    mMoviesVoteAverageText = (TextView) rootView.findViewById(R.id.detail_movies_vote_average);

    mTrailerAdapter = new TrailerAdapter(getActivity(), new ArrayList<Trailer>());
    mMoviesTrailersLinear.setAdapter(mTrailerAdapter);

    // Launch movie trailer via Intent
    mMoviesTrailersLinear.setOnItemClickListener(
        new LinearListView.OnItemClickListener() {
          @Override
          public void onItemClick(LinearListView linearListView, View view, int position, long id) {
            Trailer trailer = mTrailerAdapter.getItem(position);
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("http://www.youtube.com/watch?v=" + trailer.getKey()));
            startActivity(intent);
          }
        });

    mReviewAdapter = new ReviewAdapter(getActivity(), new ArrayList<Review>());
    mMoviesReviewsLinear.setAdapter(mReviewAdapter);

    if (mMovies != null) {

      String poster_url = Utility.moviePosterUrl(342, mMovies.getPosterB());

      Glide.with(this).load(poster_url).into(mMoviesPosterImage);

      mMoviesTitleText.setText(mMovies.getTitle());
      mMoviesOverviewText.setText(mMovies.getOverview());

      String releaseDate = mMovies.getDate();

      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

      try {
        String date =
            DateUtils.formatDateTime(
                getActivity(),
                dateFormat.parse(releaseDate).getTime(),
                DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR);
        mMoviesReleaseDateText.setText(date);
      } catch (ParseException e) {
        e.printStackTrace();
      }

      mMoviesVoteAverageText.setText(Integer.toString(mMovies.getRating()));
    }
    return rootView;
  }
Exemple #29
0
  public void create(View v) {
    idea = ideaText.getText().toString();

    if (idea.equals("") || idea.equals("Title")) {
      DialogFragment dialog = new NoTextDialogFragment();
      dialog.show(getSupportFragmentManager(), "NoTextDialogFragment");
    } else {
      info = infoText.getText().toString();
      if (info.equals("Additional information")) {
        info = "";
      }
      if (!tagsText.getText().toString().contains("#")) {
        tags = tagsText.getText().toString().split(",\\s");
      } else {
        tags = new String[0];
      }
      languagePosition = languageSpinner.getSelectedItemPosition();
      contact = contactText.getText().toString();
      if (contact.equals("Contact information")) {
        contact = "";
      }

      if (context.equals("edit")) {
        contentView.setVisibility(View.GONE);
        lightbulbLayout.setVisibility(View.VISIBLE);
        lightbulbAnimation.start();

        ideaBody = new Idea(idea, info, GeneralSettings.languages[languagePosition]);
        GeneralSettings.ideaweave
            .updateIdea("Bearer " + GeneralSettings.token, ideaId, ideaBody)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(
                new Action1<ResultMessage>() {

                  @Override
                  public void call(ResultMessage m) {
                    lightbulbAnimation.stop();
                    lightbulbLayout.setVisibility(View.GONE);
                    contentView.setVisibility(View.VISIBLE);
                    Toast.makeText(
                            (Context) GeneralSettings.activity,
                            "The idea has been updated",
                            Toast.LENGTH_LONG)
                        .show();
                    Log.d(TAG, m._id + ", " + m.title + ", " + m.owner);

                    GeneralSettings.activity.next();
                  }
                },
                new Action1<Throwable>() {

                  @Override
                  public void call(Throwable t1) {
                    lightbulbAnimation.stop();
                    lightbulbLayout.setVisibility(View.GONE);
                    contentView.setVisibility(View.VISIBLE);
                    Toast.makeText(
                            (Context) GeneralSettings.activity, t1.getMessage(), Toast.LENGTH_LONG)
                        .show();
                    Log.d(TAG, "problem with updating idea: " + t1.getMessage());
                  }
                });

      } else {
        contentView.setVisibility(View.GONE);
        lightbulbLayout.setVisibility(View.VISIBLE);
        lightbulbAnimation.start();

        /*tagObjList = new String[tags.length];
        for(int i = 0; i < tags.length; i++) {
        	count = i;
        	GeneralSettings.ideaweave.createTag(new Tag(tags[count]))
        	.observeOn(AndroidSchedulers.mainThread())
        	.subscribe(new Action1<ResultMessage>() {

        		@Override
        		public void call(ResultMessage m) {
        			tagObjList[count] = m._id;
        			count++;
        		}

        	}, new Action1<Throwable>() {

        		@Override
        		public void call(Throwable arg0) {
        			Toast.makeText((Context) GeneralSettings.activity, "Problem with saving the tags", Toast.LENGTH_LONG).show();
        			Log.d(TAG, arg0.getMessage());
        			System.out.println(arg0.getMessage());
        		}
        	});
        }
        count = 0;*/

        ideaBody = new Idea(idea, info, GeneralSettings.languages[languagePosition]);
        GeneralSettings.ideaweave
            .createIdea("Bearer " + GeneralSettings.token, ideaBody)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(
                new Action1<ResultMessage>() {

                  @Override
                  public void call(ResultMessage m) {
                    lightbulbAnimation.stop();
                    lightbulbLayout.setVisibility(View.GONE);
                    contentView.setVisibility(View.VISIBLE);
                    Toast.makeText(
                            (Context) GeneralSettings.activity,
                            "The idea has been created",
                            Toast.LENGTH_LONG)
                        .show();
                    Log.d(TAG, m._id + ", " + m.title + ", " + m.owner);

                    GeneralSettings.activity.next();
                  }
                },
                new Action1<Throwable>() {

                  @Override
                  public void call(Throwable t1) {
                    lightbulbAnimation.stop();
                    lightbulbLayout.setVisibility(View.GONE);
                    contentView.setVisibility(View.VISIBLE);
                    Toast.makeText(
                            (Context) GeneralSettings.activity, t1.getMessage(), Toast.LENGTH_LONG)
                        .show();
                    Log.d(TAG, "problem with creating idea: " + t1.getMessage());
                  }
                });
      }
    }
  }
  /*
   * Populate all the main SMS/MMS views with content from the actual
   * SmsMmsMessage
   */
  private void populateViews(SmsMmsMessage newMessage) {

    // Store message
    message = newMessage;

    // If it's a MMS message, just show the MMS layout
    if (message.getMessageType() == SmsMmsMessage.MESSAGE_TYPE_MMS) {
      if (mmsView == null) {
        mmsView = mmsViewStub.inflate();
        mmsSubjectTV = (TextView) mmsView.findViewById(R.id.MmsSubjectTextView);

        // The ViewMMS button
        Button viewMmsButton = (Button) mmsView.findViewById(R.id.ViewMmsButton);
        viewMmsButton.setOnClickListener(
            new OnClickListener() {
              public void onClick(View v) {
                replyToMessage();
              }
            });
      }
      messageScrollView.setVisibility(View.GONE);
      // privacyViewStub.setVisibility(View.GONE);
      mmsView.setVisibility(View.VISIBLE);

      // If no MMS subject, hide the subject text view
      if (TextUtils.isEmpty(message.getMessageBody())) {
        mmsSubjectTV.setVisibility(View.GONE);
      } else {
        mmsSubjectTV.setVisibility(View.VISIBLE);
      }
    } else {
      // Otherwise hide MMS layout
      if (mmsView != null) {
        mmsView.setVisibility(View.GONE);
      }

      // Refresh privacy settings (hide/show message) depending on privacy setting
      refreshPrivacy();
    }

    // Fetch contact photo in background
    if (contactPhoto == null) {
      setContactPhotoToDefault(photoImageView);
      new FetchContactPhotoTask().execute(message.getContactId());
    } else {
      setContactPhoto(photoImageView, contactPhoto);
    }

    // Show QuickContact card on photo imageview click (only available on eclair+)
    if (!SmsPopupUtils.PRE_ECLAIR) {

      contactLookupUri = null;
      String contactId = message.getContactId();
      if (contactId != null) {
        contactLookupUri =
            ContactWrapper.getLookupUri(Long.valueOf(contactId), message.getContactLookupKey());
      }

      photoImageView.setOnClickListener(
          new OnClickListener() {
            public void onClick(View v) {
              if (contactLookupUri != null) {
                ContactWrapper.showQuickContact(
                    SmsPopupActivity.this,
                    v,
                    contactLookupUri,
                    ContactWrapper.QUICKCONTACT_MODE_MEDIUM,
                    null);
              }
            }
          });
    }

    // If only 1 unread message waiting
    if (message.getUnreadCount() <= 1) {
      if (unreadCountView != null) {
        unreadCountView.setVisibility(View.GONE);
      }
    } else { // More unread messages waiting, show the extra view
      if (unreadCountView == null) {
        unreadCountView = unreadCountViewStub.inflate();
      }
      unreadCountView.setVisibility(View.VISIBLE);
      TextView tv = (TextView) unreadCountView.findViewById(R.id.UnreadCountTextView);

      String textWaiting = getString(R.string.unread_text_waiting, message.getUnreadCount() - 1);
      tv.setText(textWaiting);

      // The inbox button
      Button inboxButton = (Button) unreadCountView.findViewById(R.id.InboxButton);
      inboxButton.setOnClickListener(
          new OnClickListener() {
            public void onClick(View v) {
              gotoInbox();
            }
          });
    }

    // Update TextView that contains the timestamp for the incoming message
    String headerText = getString(R.string.new_text_at, message.getFormattedTimestamp().toString());

    // Set the from, message and header views
    fromTV.setText(message.getContactName());
    if (message.getMessageType() == SmsMmsMessage.MESSAGE_TYPE_SMS) {
      messageTV.setText(message.getMessageBody());
    } else {
      mmsSubjectTV.setText(getString(R.string.mms_subject) + " " + message.getMessageBody());
    }
    messageReceivedTV.setText(headerText);
  }