Exemplo n.º 1
1
  @Override
  public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    mDialogInstance.mTextMsg = savedInstanceState.getParcelable(TEXT);
    CatLog.d(LOGTAG, "onRestoreInstanceState - [" + mDialogInstance.mTextMsg + "]");
  }
Exemplo n.º 2
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    CatLog.d(LOGTAG, "onCreate+");
    // Remove the default title, customized one is used.
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // Set the layout for this activity.
    setContentView(R.layout.stk_menu_list);

    mTitleTextView = (TextView) findViewById(R.id.title_text);
    mTitleIconView = (ImageView) findViewById(R.id.title_icon);
    mProgressView = (ProgressBar) findViewById(R.id.progress_bar);
    getListView().setOnCreateContextMenuListener(mOnCreateContextMenuListener);
    if (!mMenuInstance.handleOnCreate(getBaseContext(), getIntent(), true)) {
      CatLog.d(LOGTAG, "finish!");
      finish();
    }

    /*
    // Change content background color to support theme mananger.
    if (FeatureOption.MTK_THEMEMANAGER_APP) {
        View contentView = this.findViewById(android.R.id.content);
        contentView.setThemeContentBgColor(Color.TRANSPARENT);
    }
    */
    registerReceiver(mSIMStateChangeReceiver, mSIMStateChangeFilter);
    CatLog.d(LOGTAG, "onCreate-");
  }
Exemplo n.º 3
0
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    CatLog.d(LOGTAG, "onNewIntent");
    if (!mMenuInstance.handleNewIntent(intent, true)) {
      CatLog.d(LOGTAG, "finish!");
      finish();
    }
  }
Exemplo n.º 4
0
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    CatLog.d(LOGTAG, "onCreate");

    CatLog.d(LOGTAG, "onCreate - mbSendResp[" + mDialogInstance.mbSendResp + "]");
    mDialogInstance.parent = this;

    mDialogInstance.initFromIntent(getIntent());
    if (mDialogInstance.mTextMsg == null) {
      finish();
      return;
    }

    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    Window window = getWindow();

    setContentView(R.layout.stk_msg_dialog);
    TextView mMessageView = (TextView) window.findViewById(R.id.dialog_message);

    Button okButton = (Button) findViewById(R.id.button_ok);
    Button cancelButton = (Button) findViewById(R.id.button_cancel);

    okButton.setOnClickListener(this);

    //
    // okButton.setHighFocusPriority(true);
    cancelButton.setOnClickListener(this);

    setTitle(mDialogInstance.mTextMsg.title);
    if (!(mDialogInstance.mTextMsg.iconSelfExplanatory && mDialogInstance.mTextMsg.icon != null)) {
      if ((mDialogInstance.mTextMsg.text == null)
          || (mDialogInstance.mTextMsg.text.length() < mDialogInstance.MIN_LENGTH)) {
        mMessageView.setMinWidth(mDialogInstance.MIN_WIDTH);
      }
      mMessageView.setText(mDialogInstance.mTextMsg.text);
    }

    if (mDialogInstance.mTextMsg.icon == null) {
      CatLog.d(LOGTAG, "onCreate icon is null");
      window.setFeatureDrawableResource(
          Window.FEATURE_LEFT_ICON, com.android.internal.R.drawable.stat_notify_sim_toolkit);
    } else {
      CatLog.d(LOGTAG, "onCreate icon is not null");
      window.setFeatureDrawable(
          Window.FEATURE_LEFT_ICON, new BitmapDrawable(mDialogInstance.mTextMsg.icon));
    }

    // clear optionmenu in stkDialog activity
    window.clearFlags(WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY);

    registerReceiver(mSIMStateChangeReceiver, mSIMStateChangeFilter);
  }
Exemplo n.º 5
0
        @Override
        public void onReceive(Context context, Intent intent) {
          if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) {
            String simState = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
            int simId =
                intent.getIntExtra(
                    com.android.internal.telephony.PhoneConstants.GEMINI_SIM_ID_KEY, -1);

            CatLog.d(
                LOGTAG,
                "mSIMStateChangeReceiver() - simId["
                    + simId
                    + "]  state["
                    + simState
                    + "], mSimId: "
                    + mDialogInstance.mSimId);

            if ((simId == mDialogInstance.mSimId)
                && (IccCardConstants.INTENT_VALUE_ICC_NOT_READY.equals(simState)
                    || IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simState))) {
              mDialogInstance.cancelTimeOut();
              mDialogInstance.sendResponse(StkAppService.RES_ID_CONFIRM, false);
              finish();
            }
          }
        }
Exemplo n.º 6
0
  @Override
  public void onSaveInstanceState(Bundle outState) {
    CatLog.d(LOGTAG, "onSaveInstanceState");

    super.onSaveInstanceState(outState);
    outState.putParcelable(TEXT, mDialogInstance.mTextMsg);
  }
Exemplo n.º 7
0
  private void init() {
    CatLog.d(LOGTAG, "init");
    Window window = getWindow();
    TextView mMessageView = (TextView) window.findViewById(R.id.dialog_message);

    Button okButton = (Button) findViewById(R.id.button_ok);
    Button cancelButton = (Button) findViewById(R.id.button_cancel);

    okButton.setOnClickListener(this);
    cancelButton.setOnClickListener(this);

    setTitle(mDialogInstance.mTextMsg.title);
    if (!(mDialogInstance.mTextMsg.iconSelfExplanatory && mDialogInstance.mTextMsg.icon != null)) {
      if ((mDialogInstance.mTextMsg.text == null)
          || (mDialogInstance.mTextMsg.text.length() < mDialogInstance.MIN_LENGTH)) {
        mMessageView.setMinWidth(mDialogInstance.MIN_WIDTH);
      }
      mMessageView.setText(mDialogInstance.mTextMsg.text);
    }

    if (mDialogInstance.mTextMsg.icon == null) {
      window.setFeatureDrawableResource(
          Window.FEATURE_LEFT_ICON, com.android.internal.R.drawable.stat_notify_sim_toolkit);
    } else {
      window.setFeatureDrawable(
          Window.FEATURE_LEFT_ICON, new BitmapDrawable(mDialogInstance.mTextMsg.icon));
    }
  }
Exemplo n.º 8
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   boolean result = mMenuInstance.handleOptionItemSelected(item, mProgressView);
   CatLog.d(LOGTAG, "onOptionsItemSelected, result: " + result);
   if (result) return result;
   else return super.onOptionsItemSelected(item);
 }
Exemplo n.º 9
0
  @Override
  public void onResume() {
    super.onResume();

    CatLog.d(LOGTAG, "onResume, sim id: " + mMenuInstance.mSimId);
    int res = mMenuInstance.handleResume(mTitleIconView, mTitleTextView, this, mProgressView);
    switch (res) {
      case StkMenuInstance.FINISH_CAUSE_FLIGHT_MODE:
        mMenuInstance.showTextToast(
            getApplicationContext(), getString(R.string.lable_on_flight_mode));
        finish();
        break;
      case StkMenuInstance.FINISH_CAUSE_NULL_MENU:
        mMenuInstance.showTextToast(
            getApplicationContext(), getString(R.string.main_menu_not_initialized));
        finish();
        break;
      case StkMenuInstance.FINISH_CAUSE_NULL_SERVICE:
        finish();
        break;
      case StkMenuInstance.FINISH_CAUSE_NOT_AVAILABLE:
        finish();
        break;
    }
  }
  private static void setAppState(Context context, boolean install, int slotId) {
    if (context == null) {
      return;
    }
    PackageManager pm = context.getPackageManager();
    if (pm == null) {
      return;
    }

    ComponentName cName;

    // check that STK app package is known to the PackageManager
    if (slotId == 0) {
      cName = new ComponentName("com.android.stk", "com.android.stk.StkLauncherActivity");
    } else {
      cName = new ComponentName("com.android.stk", "com.android.stk.StkLauncherActivity2");
    }

    int state =
        install
            ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
            : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;

    try {
      pm.setComponentEnabledSetting(cName, state, PackageManager.DONT_KILL_APP);
    } catch (Exception e) {
      CatLog.d("StkAppInstaller", "Could not change STK app state");
    }
  }
Exemplo n.º 11
0
        @Override
        public void onReceive(Context context, Intent intent) {
          if (TelephonyIntents.ACTION_SIM_STATE_CHANGED.equals(intent.getAction())) {
            String simState = intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE);
            int simId =
                intent.getIntExtra(
                    com.android.internal.telephony.PhoneConstants.GEMINI_SIM_ID_KEY, -1);

            CatLog.d(
                LOGTAG,
                "mSIMStateChangeReceiver() - simId[" + simId + "]  state[" + simState + "]");
            /* TODO: GEMINI+ */
            if ((simId == com.android.internal.telephony.PhoneConstants.GEMINI_SIM_1)
                && (IccCardConstants.INTENT_VALUE_ICC_NOT_READY.equals(simState)
                    || IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simState))) {
              CatLog.d(LOGTAG, "mSendResp: " + mMenuInstance.mSendResp);
              if (!mMenuInstance.mSendResp) {
                StkMenuActivity.this.mMenuInstance.sendResponse(StkAppService.RES_ID_END_SESSION);
              }
              StkMenuActivity.this.mMenuInstance.cancelTimeOut();
              StkMenuActivity.this.finish();
            }
          }
        }
Exemplo n.º 12
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   unregisterReceiver(mSIMStateChangeReceiver);
   CatLog.d(LOGTAG, "onDestroy");
 }
Exemplo n.º 13
0
 @Override
 public void onPause() {
   super.onPause();
   CatLog.d(LOGTAG, "onPause, sim id: " + mMenuInstance.mSimId);
   mMenuInstance.handlePause();
 }