Ejemplo n.º 1
0
    @Override
    protected void onPostExecute(Bundle result) {
      String requestID = null;
      if (result.getBoolean(RESULT_POST_PHOTO)) {
        requestID = REQUEST_POST_PHOTO;
      } else if (result.getBoolean(RESULT_POST_LINK)) {
        requestID = REQUEST_POST_LINK;
      } else {
        requestID = REQUEST_POST_MESSAGE;
      }

      mRequests.remove(requestID);

      String error = result.containsKey(RESULT_ERROR) ? result.getString(RESULT_ERROR) : null;

      if (mLocalListeners.get(requestID) != null) {
        if (error == null) {
          ((OnPostingCompleteListener) mLocalListeners.get(requestID)).onPostSuccessfully(getID());
        } else {
          mLocalListeners.get(requestID).onError(getID(), requestID, error, null);
        }
      }

      mLocalListeners.remove(requestID);
    }
  @Override
  protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    ((TextSwitcher) findViewById(R.id.trucoAnnotator_scoreTeam1))
        .setText(savedInstanceState.getCharSequence(SCORE_TEAM_1));
    ((TextSwitcher) findViewById(R.id.trucoAnnotator_scoreTeam2))
        .setText(savedInstanceState.getCharSequence(SCORE_TEAM_2));

    boolean isTeamEnabled = savedInstanceState.getBoolean(TEAM_1_STATUS);
    if (!isTeamEnabled) {
      List<Integer> controlsId = new ArrayList<Integer>();
      controlsId.add(R.id.trucoAnnotator_labelTeam1);
      controlsId.add(R.id.trucoAnnotator_scoreTeam1);
      controlsId.add(R.id.trucoAnnotator_substractButtonTeam1);
      disableControls(controlsId);
    }

    isTeamEnabled = savedInstanceState.getBoolean(TEAM_2_STATUS);
    if (!isTeamEnabled) {
      List<Integer> controlsId = new ArrayList<Integer>();
      controlsId.add(R.id.trucoAnnotator_labelTeam2);
      controlsId.add(R.id.trucoAnnotator_scoreTeam2);
      controlsId.add(R.id.trucoAnnotator_substractButtonTeam2);
      disableControls(controlsId);
    }
  }
  @Override
  protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
      Bundle bundle = (Bundle) state;

      mMode = Mode.mapIntToMode(bundle.getInt(STATE_MODE, 0));
      mCurrentMode = Mode.mapIntToMode(bundle.getInt(STATE_CURRENT_MODE, 0));

      mDisableScrollingWhileRefreshing =
          bundle.getBoolean(STATE_DISABLE_SCROLLING_REFRESHING, true);
      mShowViewWhileRefreshing = bundle.getBoolean(STATE_SHOW_REFRESHING_VIEW, true);

      // Let super Restore Itself
      super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER));

      final int viewState = bundle.getInt(STATE_STATE, PULL_TO_REFRESH);
      if (viewState == REFRESHING) {
        setRefreshingInternal(true);
        mState = viewState;
      }
      return;
    }

    super.onRestoreInstanceState(state);
  }
 private void setPickerFragmentSettingsFromBundle(Bundle inState) {
   // We do this in a separate non-overridable method so it is safe to call from the constructor.
   if (inState != null) {
     showPictures = inState.getBoolean(SHOW_PICTURES_BUNDLE_KEY, showPictures);
     String extraFieldsString = inState.getString(EXTRA_FIELDS_BUNDLE_KEY);
     if (extraFieldsString != null) {
       String[] strings = extraFieldsString.split(",");
       setExtraFields(Arrays.asList(strings));
     }
     showTitleBar = inState.getBoolean(SHOW_TITLE_BAR_BUNDLE_KEY, showTitleBar);
     String titleTextString = inState.getString(TITLE_TEXT_BUNDLE_KEY);
     if (titleTextString != null) {
       titleText = titleTextString;
       if (titleTextView != null) {
         titleTextView.setText(titleText);
       }
     }
     String doneButtonTextString = inState.getString(DONE_BUTTON_TEXT_BUNDLE_KEY);
     if (doneButtonTextString != null) {
       doneButtonText = doneButtonTextString;
       if (doneButton != null) {
         doneButton.setText(doneButtonText);
       }
     }
   }
 }
    // load from settings/instanceState
    private void loadSettingsAndInstanceState(Activity context, Bundle savedInstanceState) {
      SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
      this.mCurrentPath = sharedPref.getString(STATE_CurrentPath, this.mCurrentPath);
      this.mDirQueryID = sharedPref.getInt(STATE_DirQueryID, this.getDirQueryID());
      this.mSortID = sharedPref.getInt(STATE_SortID, this.mSortID);
      this.mSortAscending = sharedPref.getBoolean(STATE_SortAscending, this.mSortAscending);
      this.mCurrentLatLon.get(
          DirectoryFormatter.parseLatLon(sharedPref.getString(STATE_LAT_LON, null)));

      // instance state overrides settings
      if (savedInstanceState != null) {
        this.mCurrentPath = savedInstanceState.getString(STATE_CurrentPath, this.mCurrentPath);
        this.mDirQueryID = savedInstanceState.getInt(STATE_DirQueryID, this.getDirQueryID());
        this.mSortID = savedInstanceState.getInt(STATE_SortID, this.mSortID);
        this.mSortAscending =
            savedInstanceState.getBoolean(STATE_SortAscending, this.mSortAscending);
        this.mFilter = savedInstanceState.getParcelable(STATE_Filter);
        this.mCurrentLatLon.get(
            DirectoryFormatter.parseLatLon(savedInstanceState.getString(STATE_LAT_LON)));

        this.mUseLatLon = savedInstanceState.getBoolean(STATE_LAT_LON_ACTIVE, this.mUseLatLon);
      }

      if (this.mFilter == null) {
        this.mFilter = new GalleryFilterParameterParcelable();
        mFilter.loadSettings(sharedPref);
      }
      // extra parameter
      this.mGalleryContentQuery = context.getIntent().getParcelableExtra(EXTRA_QUERY);
      if (this.mGalleryContentQuery == null)
        this.mGalleryContentQuery = FotoSql.getQuery(FotoSql.QUERY_TYPE_DEFAULT);
    }
Ejemplo n.º 6
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_new_event);
   newEvent = new EventTracker();
   if (savedInstanceState != null) {
     ((TextView) findViewById(R.id.setStartTime))
         .setText(savedInstanceState.getString("startTime"));
     ((TextView) findViewById(R.id.setEndTime)).setText(savedInstanceState.getString("endTime"));
     ((TextView) findViewById(R.id.setStartDate))
         .setText(savedInstanceState.getString("startDate"));
     ((TextView) findViewById(R.id.setEndDate)).setText(savedInstanceState.getString("endDate"));
     ((EditText) findViewById(R.id.eventName)).setText(savedInstanceState.getString("eventName"));
     startTimeSet = savedInstanceState.getBoolean("startTimeSet");
     endTimeSet = savedInstanceState.getBoolean("endTimeSet");
     startDateSet = savedInstanceState.getBoolean("startDateSet");
     endDateSet = savedInstanceState.getBoolean("endDateSet");
     newEvent.setStartTimeInMillis(savedInstanceState.getLong("eStartTime"));
     newEvent.setEndTimeInMillis(savedInstanceState.getLong("eEndTime"));
   } else {
     startTimeSet = false;
     endTimeSet = false;
     startDateSet = false;
     endDateSet = false;
   }
 }
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      mDPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
      mKeyStore = KeyStore.getInstance();
      mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this.getActivity());

      // Defaults to needing to confirm credentials
      final boolean confirmCredentials =
          getActivity().getIntent().getBooleanExtra(CONFIRM_CREDENTIALS, true);
      if (getActivity() instanceof ChooseLockGeneric.InternalActivity) {
        mPasswordConfirmed = !confirmCredentials;
      }

      if (savedInstanceState != null) {
        mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
        mWaitingForConfirmation = savedInstanceState.getBoolean(WAITING_FOR_CONFIRMATION);
        mFinishPending = savedInstanceState.getBoolean(FINISH_PENDING);
      }

      if (mPasswordConfirmed) {
        updatePreferencesOrFinish();
      } else if (!mWaitingForConfirmation) {
        ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this.getActivity(), this);
        if (!helper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST, null, null)) {
          mPasswordConfirmed = true; // no password set, so no need to confirm
          updatePreferencesOrFinish();
        } else {
          mWaitingForConfirmation = true;
        }
      }
    }
Ejemplo n.º 8
0
  @Override
  protected void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
      Bundle bundle = (Bundle) state;
      super.onRestoreInstanceState(bundle.getParcelable(INATANCE_STATE));
      mMaxProcess = bundle.getInt(INSTANCE_MAX_PROCESS);
      mCurProcess = bundle.getInt(INSTANCE_CUR_PROCESS);
      mReachedColor = bundle.getInt(INSTANCE_REACHED_COLOR);
      mReachedWidth = bundle.getFloat(INSTANCE_REACHED_WIDTH);
      isHasReachedCornerRound = bundle.getBoolean(INSTANCE_REACHED_CORNER_ROUND);
      mUnreachedColor = bundle.getInt(INSTANCE_UNREACHED_COLOR);
      mUnreachedWidth = bundle.getFloat(INSTANCE_UNREACHED_WIDTH);
      mPointerColor = bundle.getInt(INSTANCE_POINTER_COLOR);
      mPointerRadius = bundle.getFloat(INSTANCE_POINTER_RADIUS);
      isHasPointerShadow = bundle.getBoolean(INSTANCE_POINTER_SHADOW);
      mPointerShadowRadius = bundle.getFloat(INSTANCE_POINTER_SHADOW_RADIUS);
      isHasWheelShadow = bundle.getBoolean(INSTANCE_WHEEL_SHADOW);
      mPointerShadowRadius = bundle.getFloat(INSTANCE_WHEEL_SHADOW_RADIUS);
      isHasCache = bundle.getBoolean(INSTANCE_WHEEL_HAS_CACHE);
      isCanTouch = bundle.getBoolean(INSTANCE_WHEEL_CAN_TOUCH);
      initPaints();
    } else {
      super.onRestoreInstanceState(state);
    }

    if (mChangListener != null) {
      mChangListener.onChanged(this, mMaxProcess, mCurProcess);
    }
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (savedInstanceState != null
       && savedInstanceState.containsKey(KEY_HOUR_OF_DAY)
       && savedInstanceState.containsKey(KEY_MINUTE)
       && savedInstanceState.containsKey(KEY_IS_24_HOUR_VIEW)) {
     mInitialHourOfDay = savedInstanceState.getInt(KEY_HOUR_OF_DAY);
     mInitialMinute = savedInstanceState.getInt(KEY_MINUTE);
     mIs24HourMode = savedInstanceState.getBoolean(KEY_IS_24_HOUR_VIEW);
     mInKbMode = savedInstanceState.getBoolean(KEY_IN_KB_MODE);
     mStyleResId = savedInstanceState.getInt(KEY_STYLE);
     if (savedInstanceState.containsKey(KEY_FUTURE_MINUTES_LIMIT)) {
       mFutureMinutesLimit = savedInstanceState.getInt(KEY_FUTURE_MINUTES_LIMIT);
     }
     if (savedInstanceState.containsKey(KEY_PAST_MINUTES_LIMIT)) {
       mPastMinutesLimit = savedInstanceState.getInt(KEY_PAST_MINUTES_LIMIT);
     }
     if (savedInstanceState.containsKey(KEY_CURRENT_DATE)) {
       mValidateDateTime = (Calendar) savedInstanceState.getSerializable(KEY_CURRENT_DATE);
     }
     if (savedInstanceState.containsKey(KEY_PICKER_DATE)) {
       mPickerDate = (Calendar) savedInstanceState.getSerializable(KEY_PICKER_DATE);
     }
   } else {
     if (mIs24HourMode == null) {
       mIs24HourMode = DateFormat.is24HourFormat(getContext());
     }
   }
 }
Ejemplo n.º 10
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (savedInstanceState != null) {
     mCategoryId = savedInstanceState.getInt("category_id");
     mSelectionMode = savedInstanceState.getBoolean("selection_mode");
     mIsEditing = savedInstanceState.getBoolean("edit_category");
     mCategoryIcon = savedInstanceState.getInt("category_icon");
     mCategoryName = savedInstanceState.getString("category_name");
     IconSetter dialog = (IconSetter) getFragmentManager().findFragmentByTag("set_icon");
     if (dialog != null) {
       dialog.setListener(
           new IconSetter.OnIconChosen() {
             @Override
             public void onChosen(int id) {
               mCategoryIcon = id;
               mCategoryIconView.setImageResource(Application.getThemedIcons()[mCategoryIcon]);
             }
           });
     }
   } else {
     mCategoryId = AccountManager.ALL_CATEGORY_ID;
     mSelectionMode = mIsEditing = false;
     mCategoryIcon = -1;
     mCategoryName = null;
   }
   mFabIn = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_bottom);
   mFabOut = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_out_bottom);
   mFabIn.setAnimationListener(this);
   mFabOut.setAnimationListener(this);
 }
  @Override
  public void onCreate(Bundle data, Bundle restoreState) {
    super.onCreate(data, restoreState);
    initializeViews();
    initializeData(data);
    Context context = mActivity.getAndroidContext();
    mGetContent = data.getBoolean(GalleryActivity.KEY_GET_CONTENT, false);
    mGetAlbum = data.getBoolean(GalleryActivity.KEY_GET_ALBUM, false);
    mTitle = data.getString(AlbumSetPage.KEY_SET_TITLE);
    mSubtitle = data.getString(AlbumSetPage.KEY_SET_SUBTITLE);
    mEyePosition = new EyePosition(context, this);
    mDetailsSource = new MyDetailsSource();
    mActionBar = mActivity.getGalleryActionBar();
    mSelectedAction =
        data.getInt(AlbumSetPage.KEY_SELECTED_CLUSTER_TYPE, FilterUtils.CLUSTER_BY_ALBUM);

    mHandler =
        new SynchronizedHandler(mActivity.getGLRoot()) {
          @Override
          public void handleMessage(Message message) {
            switch (message.what) {
              case MSG_PICK_ALBUM:
                {
                  pickAlbum(message.arg1);
                  break;
                }
              default:
                throw new AssertionError(message.what);
            }
          }
        };
  }
Ejemplo n.º 12
0
  @Override
  protected final void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
      Bundle bundle = (Bundle) state;

      setMode(Mode.mapIntToValue(bundle.getInt(STATE_MODE, 0)));
      mCurrentMode = Mode.mapIntToValue(bundle.getInt(STATE_CURRENT_MODE, 0));

      mScrollingWhileRefreshingEnabled =
          bundle.getBoolean(STATE_SCROLLING_REFRESHING_ENABLED, false);
      mShowViewWhileRefreshing = bundle.getBoolean(STATE_SHOW_REFRESHING_VIEW, true);

      // Let super Restore Itself
      super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER));

      State viewState = State.mapIntToValue(bundle.getInt(STATE_STATE, 0));
      if (viewState == State.REFRESHING || viewState == State.MANUAL_REFRESHING) {
        setState(viewState, true);
      }

      // Now let derivative classes restore their state
      onPtrRestoreInstanceState(bundle);
      return;
    }

    super.onRestoreInstanceState(state);
  }
Ejemplo n.º 13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE); // 去掉标题栏
    setContentView(R.layout.activity_local);

    intentFromMain = getIntent();
    Bundle bundle = intentFromMain.getExtras();
    listPosition = bundle.getInt("listPosition");
    play_bt_press = bundle.getBoolean("bt_press");
    play_bt_check = bundle.getBoolean("bt_check");
    isFirstTime = bundle.getBoolean("isFirstTime");
    isPlaying = bundle.getBoolean("isPlaying");
    isPause = bundle.getBoolean("isPause");
    msg = bundle.getInt("msg");

    preferences = getSharedPreferences("songPosition", MODE_PRIVATE);
    editor = preferences.edit();

    appState = ((MApplication) getApplicationContext());
    helper = appState.getDBHelper();
    helperFavorite = appState.getDBHelperFavorite();
    fileInfos = appState.getFileInfos();

    findViewById(); // 从界面上根据id获取控件
    setViewOnclickListener(); // 给每一个控件设置监听器
    initLocalMusicList(); // 初始化歌曲列表

    playerReceiver = new PlayerReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(PlayerService.UPDATE_ACTION);
    filter.addAction(PlayerService.MUSIC_PLAY_PAUSE);
    registerReceiver(playerReceiver, filter);
  }
Ejemplo n.º 14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState); // Always call the superclass first
    setContentView(R.layout.activity_main);

    txt = (TextView) findViewById(R.id.textView);

    // peidab actionbar-i riba üleval, kus on rakenduse nimi kirjas
    // getActionBar().hide(); --> see ei toiminud, styles.xml-is pidi muutma
    // parent="Theme.AppCompat.Light.NoActionBar" lõpu ära

    // Check whether we're recreating a previously destroyed instance
    if (savedInstanceState != null) {
      // Restore value of members from saved state
      nrEkraanil = savedInstanceState.getString("nrEkraanil");
      esimNr = savedInstanceState.getDouble("esimNr");
      misTehe = savedInstanceState.getString("misTehe");
      teineNr = savedInstanceState.getDouble("teineNr");
      arvutuseVastus = savedInstanceState.getDouble("arvutuseVastus");
      kasTeine = savedInstanceState.getBoolean("kasTeine");
      kasVordusOlnud = savedInstanceState.getBoolean("kasVordunud");
      txt.setText(savedInstanceState.getString("txtView"));
    } else {
      // Probably initialize members with default values for a new instance
    }
  }
Ejemplo n.º 15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    mEtTextToType = (EditText) findViewById(R.id.et_text_to_be_typed);
    mCbClearText = (CheckBox) findViewById(R.id.cb_clear_text);
    mCbPerformAction = (CheckBox) findViewById(R.id.cb_perform_action);

    if (savedInstanceState == null) {
      Bundle localeBundle =
          getIntent().getBundleExtra(com.twofortyfouram.locale.Intent.EXTRA_BUNDLE);
      if (localeBundle != null) {
        String text = localeBundle.getString(Constants.EXTRA_TEXT);
        if (text != null) {
          mEtTextToType.setText(text);
        }
        boolean clearText = localeBundle.getBoolean(Constants.EXTRA_CLEAR_BEFORE, false);
        mCbClearText.setChecked(clearText);
        boolean performAction = localeBundle.getBoolean(Constants.EXTRA_END_WITH_ACTION, false);
        mCbPerformAction.setChecked(performAction);
      }
    }

    if (!TaskerPlugin.Setting.hostSupportsOnFireVariableReplacement(this)) {
      mEtTextToType.setHint(R.string.variable_replacement_not_ok);
    }

    if (!isKeyboardEnabled()) {
      showDialogKeyboardNotEnabled();
    }
  }
Ejemplo n.º 16
0
  public static SelectModeDialogFragment newInstance(
      Bundle args, ArrayList<String> ways, String title) {
    ArrayList<String> choicesDisplay;
    if (ways == null) {
      choicesDisplay = new ArrayList<String>();
    } else {
      choicesDisplay = new ArrayList<String>(ways);
    }
    if (args != null && args.getBoolean(CHOICE_MODE_MULTIPLE)) {
      args.putBoolean(WITH_CANCEL_ITEM, false);
    }
    if (args != null && args.getBoolean(WITH_CANCEL_ITEM, false)) {
      choicesDisplay.add(CustomApplication.getStringById(R.string.Dialog_Button_Label_Negative));
    }

    SelectModeDialogFragment fragment = new SelectModeDialogFragment();
    if (args == null) args = new Bundle();
    args = initializeSettings(args, title, null, null);
    if (!args.getBoolean(CHOICE_MODE_MULTIPLE, false)
        && !args.getBoolean(CHOICE_MODE_SINGLE, false)) {
      args.putString(POSITIVE_TEXT, null);
      args.putString(NEGATIVE_TEXT, null);
    }
    args.putStringArray(WAYS, choicesDisplay.toArray(new String[] {}));
    fragment.setArguments(args);
    return fragment;
  }
  @Override
  public void onCreate(Bundle savedState) {
    super.onCreate(savedState);

    parseArguments();
    setBaseUri();

    LogUtils.d(LOG_TAG, "onCreate in ConversationViewFragment (this=%s)", this);
    // Not really, we just want to get a crack to store a reference to the change_folder item
    setHasOptionsMenu(true);

    if (savedState != null) {
      mViewState = savedState.getParcelable(BUNDLE_VIEW_STATE);
      mUserVisible = savedState.getBoolean(BUNDLE_USER_VISIBLE);
      mIsDetached = savedState.getBoolean(BUNDLE_DETACHED, false);
      mHasConversationBeenTransformed =
          savedState.getBoolean(BUNDLE_KEY_HAS_CONVERSATION_BEEN_TRANSFORMED, false);
      mHasConversationTransformBeenReverted =
          savedState.getBoolean(BUNDLE_KEY_HAS_CONVERSATION_BEEN_REVERTED, false);
    } else {
      mViewState = getNewViewState();
      mHasConversationBeenTransformed = false;
      mHasConversationTransformBeenReverted = false;
    }
  }
Ejemplo n.º 18
0
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   setFullScreen(savedInstanceState.getBoolean("FullScreen"));
   m_started = savedInstanceState.getBoolean("Started");
   if (m_started) m_surface.applicationStared();
 }
  @Override
  protected void onCreate(Bundle data, Bundle restoreState) {
    super.onCreate(data, restoreState);
    mUserDistance = GalleryUtils.meterToPixel(USER_DISTANCE_METER);
    initializeViews();
    initializeData(data);
    mGetContent = data.getBoolean(GalleryActivity.KEY_GET_CONTENT, false);
    mShowClusterMenu = data.getBoolean(KEY_SHOW_CLUSTER_MENU, false);
    mDetailsSource = new MyDetailsSource();
    Context context = mActivity.getAndroidContext();

    if (data.getBoolean(KEY_AUTO_SELECT_ALL)) {
      mSelectionManager.selectAll();
    }

    mLaunchedFromPhotoPage = mActivity.getStateManager().hasStateClass(FilmstripPage.class);
    mInCameraApp = data.getBoolean(PhotoPage.KEY_APP_BRIDGE, false);

    mHandler =
        new SynchronizedHandler(mActivity.getGLRoot()) {
          @Override
          public void handleMessage(Message message) {
            switch (message.what) {
              case MSG_PICK_PHOTO:
                {
                  pickPhoto(message.arg1);
                  break;
                }
              default:
                throw new AssertionError(message.what);
            }
          }
        };
  }
Ejemplo n.º 20
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // check if already logged in
    if (authManager.isSignedIn()) {
      startMainActivity();
      return;
    }

    // setup sign in button
    signInButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            signInClicked = true;
            if (signInSuccessful) startMainActivity();
            else if (signInConnectionResult != null) resolveSignInError();
            // else do nothing and wait for callbacks
          }
        });

    // restore state
    if (savedInstanceState != null) {
      authInProgress = savedInstanceState.getBoolean(STATE_AUTH_PENDING);
      signInSuccessful = savedInstanceState.getBoolean(STATE_SIGN_IN_SUCCESSFUL);
      signInClicked = savedInstanceState.getBoolean(STATE_SIGN_IN_CLICKED);
      signInConnectionResult = savedInstanceState.getParcelable(STATE_SIGN_IN_CONNECTION_RESULT);
    }
  }
    @Override
    public void handleMessage(Message msg) {
      if (msg.what == Status.SUCCESS) {
        Bundle data = msg.getData();

        // cek apakah anak ini yang mau di update datanya...
        String idMonitoring = data.getString("idMonitoring");
        // .................................................
        LogMonakFileManager.debug("handler di invoke");

        if (daftarMonitoring.dataMonitorings != null
            && daftarMonitoring.dataMonitorings.size() > 0) {
          boolean all = false;
          if (idMonitoring.equals(daftarMonitoring.anak.getIdAnak())) {
            all = true;
          }
          LogMonakFileManager.debug("dapat dataMonitoring dengan idMonitoring : " + idMonitoring);
          for (DataMonitoring dataMonitoring : daftarMonitoring.dataMonitorings) {
            LogMonakFileManager.debug(
                "dapat for dengan id datamonitoring for : " + dataMonitoring.getIdMonitoring());

            if (all) {
              dataMonitoring.setAktif(data.getBoolean("aktif"));
              continue;
            }
            if (dataMonitoring.getIdMonitoring().equals(idMonitoring)) {
              dataMonitoring.setAktif(data.getBoolean("aktif"));
            }
          }
          daftarMonitoring.daftarMonitoringAdapter.notifyDataSetChanged();
        }
      }
    }
Ejemplo n.º 22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video_activity_layout);
    Bundle budleIn = getIntent().getExtras();
    if (budleIn != null) {
      if (budleIn.containsKey("closeOnFinish")) {
        closeOnFinish = budleIn.getBoolean("closeOnFinish");
        if (closeOnFinish) persentsDownloadToStartPlay = 1000;
      }
      if (budleIn.containsKey("videoUrl")) {
        {
          this.embedUrlStr = budleIn.getString("videoUrl");
        }
      }
      if (budleIn.containsKey("streamMode")) {
        {
          this.streamMode = budleIn.getBoolean("streamMode");
          // streamMode=false;
        }
      }
    }
    // String url = getIntent().getExtras().getString("videoUrl");
    // this.embedUrlStr = "http://www.youtube.com/embed/n7hfg1Zd-_o";
    // "http://new.padcms.adyax.com//resize/thumbnail/none/element/00/00/01/52/resource.mp4";

    // "http://www.mp4point.com/downloads/55ecd9809707.mp4";
    // "http://www.youtube.com/embed/n7hfg1Zd-_o";//
    // "http://gsmnet.ru/3gp/kipelov_i_zdes.3gp";
    //
    // closeOnFinish = getIntent().getExtras().getBoolean("close");

    initializeContols();
    defineTopContols();
    defineBottomControls();

    // this.prepareCashFolder();
    showDialog(DIALOG_PREPARING);
    this.initializeCashFile();
    if (this.isOnline()) {
      this.makePreparationOfVideoSourceOnBaseURL(embedUrlStr);
    } else {
      if (!streamMode) this.playVideoInUi();
      else
        this.showErrorAlert(
            getString(R.string.error_message_title), getString(R.string.error_no_connection));
    }

    /*
     * initializeContols(); defineTopContols(); defineBottomControls();
     */

    /* startVideo(url); */

    /* playVideoInUi(); */

    // seekBarUpdaterStart();
    defineRootOnClickListener();
  }
Ejemplo n.º 23
0
 public final boolean handleMessage(Message paramMessage) {
   dnl localdnl;
   fj[] arrayOffj;
   SlideshowService localSlideshowService;
   Bundle localBundle;
   int i;
   Context localContext;
   String str1;
   String str2;
   String str3;
   boolean bool1;
   boolean bool2;
   Object localObject;
   if (paramMessage.what == 1) {
     localdnl = new dnl(this.a);
     arrayOffj = new fj[1];
     localSlideshowService = this.a;
     localBundle = this.a.b;
     i = localBundle.getInt("account_id", -1);
     localContext = localSlideshowService.getApplicationContext();
     str1 = localBundle.getString("view_id");
     str2 = localBundle.getString("tile_id");
     str3 = localBundle.getString("photo_id");
     bool1 = localBundle.getBoolean("oob_only", false);
     bool2 = localBundle.getBoolean("show_oob_tile", false);
     long l = localBundle.getLong("all_photos_row_id");
     int j = localBundle.getInt("all_photos_offset", 0);
     if (!localSlideshowService.f) {
       break label169;
     }
     localObject = new aqb(localContext, i, null, Long.valueOf(l), j, 10000, 0);
   }
   for (; ; ) {
     arrayOffj[0] = localObject;
     localdnl.execute(arrayOffj);
     return true;
     label169:
     if (localSlideshowService.e) {
       boolean bool3 = localBundle.containsKey("shareables");
       ArrayList localArrayList = null;
       if (bool3) {
         localArrayList = localBundle.getParcelableArrayList("shareables");
       }
       ipf localipf = (ipf) localBundle.getParcelable("photo_ref");
       localObject =
           new dch(
               localContext,
               localArrayList,
               localBundle.getInt("filter", 0),
               localipf,
               str1,
               null);
     } else {
       localObject =
           new def(
               localContext, i, str1, str2, str3, bool2, bool1, localBundle.getInt("filter", 0));
     }
   }
 }
Ejemplo n.º 24
0
  /*
   * serializes a bundle to JSON.
   */
  private static JSONObject convertBundleToJson(Bundle extras) {
    try {
      JSONObject json;
      json = new JSONObject().put("event", "message");

      JSONObject jsondata = new JSONObject();
      Iterator<String> it = extras.keySet().iterator();
      while (it.hasNext()) {
        String key = it.next();
        Object value = extras.get(key);

        // System data from Android
        if (key.equals("from") || key.equals("collapse_key")) {
          json.put(key, value);
        } else if (key.equals("foreground")) {
          json.put(key, extras.getBoolean("foreground"));
        } else if (key.equals("coldstart")) {
          json.put(key, extras.getBoolean("coldstart"));
        } else {
          // Maintain backwards compatibility
          if (key.equals("message") || key.equals("msgcnt") || key.equals("soundname")) {
            json.put(key, value);
          }

          if (value instanceof String) {
            // Try to figure out if the value is another JSON object

            String strValue = (String) value;
            if (strValue.startsWith("{")) {
              try {
                JSONObject json2 = new JSONObject(strValue);
                jsondata.put(key, json2);
              } catch (Exception e) {
                jsondata.put(key, value);
              }
              // Try to figure out if the value is another JSON array
            } else if (strValue.startsWith("[")) {
              try {
                JSONArray json2 = new JSONArray(strValue);
                jsondata.put(key, json2);
              } catch (Exception e) {
                jsondata.put(key, value);
              }
            } else {
              jsondata.put(key, value);
            }
          }
        }
      } // while
      json.put("payload", jsondata);

      Log.v(TAG, "extrasToJSON: " + json.toString());

      return json;
    } catch (JSONException e) {
      Log.e(TAG, "extrasToJSON: JSON exception");
    }
    return null;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle args = getArguments();
    mWipeMedia = args != null && args.getBoolean(MasterClear.WIPE_MEDIA_EXTRA);
    mEraseSdCard = args != null && args.getBoolean(MasterClear.ERASE_EXTERNAL_EXTRA);
  }
Ejemplo n.º 26
0
 @Override
 public void onDetailedStatus(Bundle status) {
   this.status_connected.setStatus(status.getBoolean(Endpoint.CONNECTOR_CONNECTED));
   this.status_enabled.setStatus(status.getBoolean(Endpoint.CONNECTOR_ENABLED));
   this.status_password.setStatus(status.getBoolean(Endpoint.ENDPOINT_PASSWORD));
   this.status_sessions.setStatus(status.getBoolean(Endpoint.CONNECTOR_OPEN_SESSIONS));
   this.status_ssl.setStatus(status.getBoolean(Endpoint.ENDPOINT_SSL));
 }
 private void restoreState(Bundle state) {
   if (state != null) {
     mTagsChanged = state.getBoolean(KEY_TAGS_CHANGED);
     mBlogsChanged = state.getBoolean(KEY_BLOGS_CHANGED);
     mLastAddedTagName = state.getString(KEY_LAST_ADDED_TAG_NAME);
     mHasPerformedUpdate = state.getBoolean(ReaderConstants.KEY_ALREADY_UPDATED);
   }
 }
Ejemplo n.º 28
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Bundle args = getArguments();
   mDemoMode = args.getBoolean(ARG_DEMO_MODE, false);
   mDemoFocus = args.getBoolean(ARG_DEMO_FOCUS, false);
   mPictureName = args.getString(ARG_DEMO_PICTURE);
 }
Ejemplo n.º 29
0
  /*
   * serializes a bundle to JSON.
   */
  private static JSONObject convertBundleToJson(Bundle extras) {
    try {
      JSONObject json = new JSONObject();
      JSONObject additionalData = new JSONObject();
      Iterator<String> it = extras.keySet().iterator();
      while (it.hasNext()) {
        String key = it.next();
        Object value = extras.get(key);

        Log.d(LOG_TAG, "key = " + key);

        // System data from Android
        if (key.equals("from") || key.equals("collapse_key")) {
          additionalData.put(key, value);
        } else if (key.equals("foreground")) {
          additionalData.put(key, extras.getBoolean("foreground"));
        } else if (key.equals("coldstart")) {
          additionalData.put(key, extras.getBoolean("coldstart"));
        } else if (key.equals("message") || key.equals("body")) {
          json.put("message", value);
        } else if (key.equals("title")) {
          json.put("title", value);
        } else if (key.equals("msgcnt") || key.equals("badge")) {
          json.put("count", value);
        } else if (key.equals("soundname") || key.equals("sound")) {
          json.put("sound", value);
        } else if (key.equals("image")) {
          json.put("image", value);
        } else if (key.equals("callback")) {
          json.put("callback", value);
        } else if (value instanceof String) {
          String strValue = (String) value;
          try {
            // Try to figure out if the value is another JSON object
            if (strValue.startsWith("{")) {
              additionalData.put(key, new JSONObject(strValue));
            }
            // Try to figure out if the value is another JSON array
            else if (strValue.startsWith("[")) {
              additionalData.put(key, new JSONArray(strValue));
            } else {
              additionalData.put(key, value);
            }
          } catch (Exception e) {
            additionalData.put(key, value);
          }
        }
      } // while

      json.put("additionalData", additionalData);
      Log.v(LOG_TAG, "extrasToJSON: " + json.toString());

      return json;
    } catch (JSONException e) {
      Log.e(LOG_TAG, "extrasToJSON: JSON exception");
    }
    return null;
  }
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    Bundle extras = intent.getExtras();
    if (extras != null && extras.getBoolean("GoToChat", false)) {
      LinphoneService.instance().removeMessageNotification();
      String sipUri = extras.getString("ChatContactSipUri");
      displayChat(sipUri);
    } else if (extras != null && extras.getBoolean("Notification", false)) {
      if (LinphoneManager.getLc().getCallsNb() > 0) {
        LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
        if (call.getCurrentParamsCopy().getVideoEnabled()) {
          startVideoActivity(call);
        } else {
          startIncallActivity(call);
        }
      }
    } else {
      if (dialerFragment != null) {
        if (extras != null && extras.containsKey("SipUriOrNumber")) {
          if (getResources().getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) {
            ((DialerFragment) dialerFragment).newOutgoingCall(extras.getString("SipUriOrNumber"));
          } else {
            ((DialerFragment) dialerFragment)
                .displayTextInAddressBar(extras.getString("SipUriOrNumber"));
          }
        } else {
          ((DialerFragment) dialerFragment).newOutgoingCall(intent);
        }
      }
      if (LinphoneManager.getLc().getCalls().length > 0) {
        LinphoneCall calls[] = LinphoneManager.getLc().getCalls();
        if (calls.length > 0) {
          LinphoneCall call = calls[0];

          if (call != null && call.getState() != LinphoneCall.State.IncomingReceived) {
            if (call.getCurrentParamsCopy().getVideoEnabled()) {
              startVideoActivity(call);
            } else {
              startIncallActivity(call);
            }
          }
        }

        // If a call is ringing, start incomingcallactivity
        Collection<LinphoneCall.State> incoming = new ArrayList<LinphoneCall.State>();
        incoming.add(LinphoneCall.State.IncomingReceived);
        if (LinphoneUtils.getCallsInState(LinphoneManager.getLc(), incoming).size() > 0) {
          if (InCallActivity.isInstanciated()) {
            InCallActivity.instance().startIncomingCallActivity();
          } else {
            startActivity(new Intent(this, IncomingCallActivity.class));
          }
        }
      }
    }
  }