Exemplo n.º 1
0
 public void onClick(View paramView) {
   if (SettingsActivity.e(this.apF).isChecked()) ;
   for (a.CL = true; ; a.CL = false) {
     c.c(this.apF, a.CL);
     return;
   }
 }
 private boolean isNeedUpdate(int appWidgetId, Context context) {
   String settingLang = SettingsActivity.loadPrefs(context, appWidgetId);
   if (settingLang == null || settingLang.isEmpty()) {
     return false;
   }
   return true;
 }
Exemplo n.º 3
0
 /// 1. set applying paper id
 /// 2. save using paper id for current theme, which restore while
 /// come back to the theme later, see to: markThemeAsApply()
 public static void markPaperAsApply(Context context, String productId) {
   MarketUtils.updatePlugIn(context, productId, true, MarketUtils.CATEGORY_WALLPAPER);
   ThemeInfo themeInfo = HomeManager.getInstance().getCurrentThemeInfo();
   if (null != themeInfo) {
     SettingsActivity.setWallpaperId(context, themeInfo.mProductID, productId);
   }
 }
  @Background
  void finishLogin(String apiUrl, String name, String password, Boolean hasAdminPermissions) {
    boolean endpointChanged = false;
    if (!TextUtils.equals(apiUrl, authenticator.getApiUrl())
        || !TextUtils.equals(name, authenticator.getUserName())) {
      endpointChanged = true;
    }

    if (accountManager.getAccountsByType(MovirtAuthenticator.ACCOUNT_TYPE).length == 0) {
      if (accountManager.addAccountExplicitly(MovirtAuthenticator.MOVIRT_ACCOUNT, password, null)) {
        ContentResolver.setIsSyncable(
            MovirtAuthenticator.MOVIRT_ACCOUNT, OVirtContract.CONTENT_AUTHORITY, 1);
        ContentResolver.setSyncAutomatically(
            MovirtAuthenticator.MOVIRT_ACCOUNT, OVirtContract.CONTENT_AUTHORITY, true);
        SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
        if (sharedPreferences.getBoolean(SettingsActivity.KEY_PERIODIC_SYNC, false)) {
          int intervalInMinutes = SettingsActivity.getSyncIntervalInMinutes(sharedPreferences);
          addPeriodicSync(intervalInMinutes);
        }
      }
    }

    setUserData(MovirtAuthenticator.MOVIRT_ACCOUNT, apiUrl, name, password, hasAdminPermissions);

    changeProgressVisibilityTo(View.VISIBLE);

    try {
      String token = client.login(apiUrl, name, password, hasAdminPermissions);
      onTokenReceived(token, endpointChanged);
    } catch (Exception e) {
      changeProgressVisibilityTo(View.GONE);
      showToast("Error logging in: " + e.getMessage());
    }
  }
Exemplo n.º 5
0
  public void changeState(CamcorderNodeService.State state) {
    if (mCurrentState == state) {
      Log.w(TAG, "Redundant state change to " + state + " ignored.");
    } else {
      Log.i(TAG, "Alerting for state " + state);

      switch (state) {
        case ACTIVE:
        case STREAMING:
          setNotification(state);
          if (state == CamcorderNodeService.State.STREAMING) {
            EnumSet<CameraPolicy> policies = SettingsActivity.getPolicy(getContext());

            if (policies.contains(CameraPolicy.POLICY_SUBJECT_WARNING)) {
              /*
               * Play an alert sound and although we don't control the
               * code here directly, we'll also flash the Camera LED
               * to warn the recipient that they are about to be
               * recorded.
               */
              playAlertSound();
            }
          }
          break;
        case DEACTIVE:
          removeNotification();
          break;
      }

      mCurrentState = state;
    }
  }
  static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
    Log.d(TAG, "updateAppWidget ID:" + appWidgetId);

    boolean isContentProviderInstalled = isPackageInstalled(CONTENT_PROVIDER_PACKAGE, context);
    /*
            Log.d(TAG, "is On This Day installed:"+isContentProviderInstalled);
            Log.d(TAG, "is ContentProviderInstalled:"+DataFetcher.isProviderInstalled(context));
    */

    // save current Lang
    Resources res = context.getResources();
    Configuration conf = res.getConfiguration();
    String currentLang = conf.locale.getLanguage();

    // get settings lang
    String settingLang = SettingsActivity.loadPrefs(context, appWidgetId);
    if (settingLang == null || settingLang.isEmpty()) {
      settingLang = currentLang;
    }

    Date currentDate = new Date();

    RemoteViews rv;
    if (!isContentProviderInstalled) {
      // no content provider

      rv = new RemoteViews(context.getPackageName(), R.layout.plz_install_widget_layout);

      // Create an Intent to launch Play Market

      Intent intent;
      // TODO check is market:// parsed
      try {
        intent =
            new Intent(
                Intent.ACTION_VIEW, Uri.parse("market://details?id=" + CONTENT_PROVIDER_PACKAGE));
      } catch (android.content.ActivityNotFoundException anfe) {
        intent =
            new Intent(
                Intent.ACTION_VIEW,
                Uri.parse(
                    "https://play.google.com/store/apps/details?id=" + CONTENT_PROVIDER_PACKAGE));
      }
      PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
      rv.setOnClickPendingIntent(R.id.installView, pendingIntent);

    } else {
      rv = new RemoteViews(context.getPackageName(), R.layout.atd_widget_layout);

      setTitle(rv, context, settingLang, currentDate);

      // start service for getData and create Views
      setList(rv, context, settingLang, currentDate, appWidgetId);
    }

    //
    // Do additional processing specific to this app widget...
    //
    appWidgetManager.updateAppWidget(appWidgetId, rv);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.menu_item_settings:
        SettingsActivity.show(mActivity);
        return true;
      case R.id.menu_item_search:
        mActivity.onSearchRequested();
        return true;
      case R.id.menu_item_connect:
        onUserInitiatesConnect();
        return true;
      case R.id.menu_item_disconnect:
        mService.disconnect();
        return true;
      case R.id.menu_item_poweron:
        mService.powerOn();
        return true;
      case R.id.menu_item_poweroff:
        mService.powerOff();
        return true;
      case R.id.menu_item_playlist:
        CurrentPlaylistActivity.show(mActivity);
        break;
      case R.id.menu_item_players:
        PlayerListActivity.show(mActivity);
        return true;
      case R.id.menu_item_about:
        new AboutDialog().show(getFragmentManager(), "AboutDialog");
        return true;
    }

    return super.onOptionsItemSelected(item);
  }
Exemplo n.º 8
0
 public static void play(Context context, int resource) {
   stop(context);
   if (SettingsActivity.getBgSound(context)) { // 判断是否要播放背景音乐
     mp = MediaPlayer.create(context, resource);
     mp.setLooping(true); // 是否要循环播放
     mp.start();
   }
 }
Exemplo n.º 9
0
  public static int getWallpaperMaxSize(Activity context) {
    int result = SettingsActivity.getPreferredWallpaperSize(context, -1);

    if (result < 0) {
      result = context.getResources().getInteger(R.integer.wallpaper_max_size);
      int sizeByResolution = getPaperSizeByResolution(context);
      if (result < sizeByResolution) {
        result = sizeByResolution;
      }
      SettingsActivity.setPreferredWallpaperSize(context, result);
    }

    if (HomeUtils.DEBUG) {
      Log.v(HomeUtils.TAG, "getWallpaperMaxSize maxSize = " + result + ", result =" + result);
    }
    return result;
  }
Exemplo n.º 10
0
 public void init(Context context) {
   File file = new File(HomeUtils.get3DHomePath() + File.separator + ".debug");
   if (file.exists()) {
     HomeUtils.DEBUG = true;
   }
   System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
   SESceneManager.getInstance().initEngine(context);
   SESceneManager.getInstance().enableLight(true);
   SESceneManager.setDebug_JNI(HomeUtils.DEBUG);
   createOrUpgradeDB();
   LauncherModel.getInstance().loadAllData(false);
   mTimeCallBacks = new ArrayList<TimeChangeCallBack>();
   mAppWidgetManager = AppWidgetManager.getInstance(context);
   mAppIconBackgroundType = SettingsActivity.getAppIconBackgroundType(getContext());
   mShowAppShef = SettingsActivity.getShowShelfSetting(getContext());
   mShowDeskObjectShef = SettingsActivity.getShowDeskObjectShelfSetting(getContext());
   mShowAllIndicator = SettingsActivity.isEnableWallIndicator(getContext());
   mShowHelpDialog = !SettingsActivity.getHelpStatus(getContext());
   mCurSceneOrientation = SceneOrientation.AUTO_PORT;
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case NoPhoneZone.QUIT_APP:
        SettingsActivity.setVolume(getApplicationContext(), false);
        NoPhoneZone.dh.clearWarnings();
        this.finish();
        System.exit(RESULT_OK);
        return (true);
    }

    return (super.onOptionsItemSelected(item));
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    switch (id) {
      case R.id.action_settings:
        SettingsActivity.startActivity(SelectBlockoutTimes.this);
        break;
      case R.id.action_logout:
        UserData.logout(SelectBlockoutTimes.this);
        // signOut();
        break;
    }

    return super.onOptionsItemSelected(item);
  }
Exemplo n.º 13
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    switch (id) {
      case R.id.action_configure_username:
        {
          Intent intent = SettingsActivity.createIntent(this);
          startActivityForResult(intent, REQUEST_CONFIGURE);
          return true;
        }
      case R.id.action_view_hatebu:
        {
          Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SITE_HATEBU));
          startActivity(intent);
          return true;
        }
      case R.id.action_view_epitome:
        {
          Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SITE_EPITOME));
          startActivity(intent);
          return true;
        }
      case R.id.action_view_about:
        {
          Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SITE_APP));
          startActivity(intent);
          return true;
        }
      case R.id.action_view_setting:
        {
          Intent intent =
              new Intent(
                  Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                  Uri.parse("package:" + getPackageName()));
          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          startActivity(intent);
          return true;
        }
    }

    return super.onOptionsItemSelected(item);
  }
Exemplo n.º 14
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    switch (id) {
      case R.id.cmd_cancel:
        finish();
        return true;
      case R.id.cmd_clear:
        clearFilter();
        return true;
      case R.id.cmd_ok:
        onOk();
        return true;
      case R.id.cmd_about:
        AboutDialogPreference.createAboutDialog(this).show();
        return true;
      case R.id.cmd_settings:
        SettingsActivity.show(this);
        return true;

      case R.id.action_save_as:
        bookmarkController.onSaveAsQuestion("", getAsQuery());
        return true;
      case R.id.action_load_from:
        bookmarkController.onLoadFromQuestion(
            new BookmarkController.IQueryConsumer() {
              @Override
              public void setQuery(QueryParameter newQuery) {
                IGalleryFilter filter = FotoSql.getWhereFilter(newQuery, false);
                toGui(filter);
              }
            },
            getAsQuery());
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
Exemplo n.º 15
0
  /// 1. clear current possible applied theme id
  /// 2. set new applying theme id
  /// 3. set last used paper id for new theme
  public static void markThemeAsApply(Context context, String productId) {
    String where = ThemeColumns.IS_APPLY + "=" + 1;
    ContentValues values = new ContentValues();
    values.put(ThemeColumns.IS_APPLY, 0);
    context.getContentResolver().update(ThemeColumns.CONTENT_URI, values, where, null);

    values = new ContentValues();
    where = ThemeColumns.PRODUCT_ID + "='" + productId + "'";
    int status = 1;
    values.put(ThemeColumns.IS_APPLY, status);
    context.getContentResolver().update(ThemeColumns.CONTENT_URI, values, where, null);
    if (productId != null) {
      MarketUtils.updatePlugIn(context, productId, true, MarketUtils.CATEGORY_THEME);
      WallpaperUtils.clearAppliedFlag(context);
      String themePaperId = SettingsActivity.getWallpaperId(context, productId);
      if (!TextUtils.isEmpty(themePaperId)) {
        MarketUtils.updatePlugIn(context, themePaperId, true, MarketUtils.CATEGORY_WALLPAPER);
      }
    }
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   CharSequence msg = getText(R.string.lockpassword_confirm_your_gesture_header);
   setTitle(msg);
 }
Exemplo n.º 17
0
 public void showSettings() {
   SettingsActivity.start(this);
 }
Exemplo n.º 18
0
 public static int getLabelShownPreference(Context context) {
   return SettingsActivity.getItemLabelShowOnWall(context);
 }