Android Open Source - prim-ftpd Encrypting Edit Text Preference






From Project

Back to project page prim-ftpd.

License

The source code is released under:

Apache License

If you think the Android project prim-ftpd listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.primftpd;
/* w w w .  ja v  a2s  . c o  m*/
import org.primftpd.util.EncryptionUtil;
import org.primftpd.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;

public class EncryptingEditTextPreference extends EditTextPreference
{

  public EncryptingEditTextPreference(Context context)
  {
    super(context);
  }

  public EncryptingEditTextPreference(
      Context context,
      AttributeSet attrs,
      int defStyle)
  {
    super(context, attrs, defStyle);
  }

  public EncryptingEditTextPreference(Context context, AttributeSet attrs)
  {
    super(context, attrs);
  }


  protected static final Logger logger = LoggerFactory.getLogger(EncryptingEditTextPreference.class);

  @Override
  public String getText()
  {
    logger.debug("getText()");

    return "";
  }

  @Override
  public void setText(String text)
  {
    logger.debug("setText()");

    if (StringUtils.isBlank(text)) {
      logger.debug("is blank");

      super.setText(null);
      return;
    }
    super.setText(EncryptionUtil.encrypt(text));
  }

  @Override
  protected void onSetInitialValue(boolean restoreValue, Object defaultValue)
  {
    super.setText(restoreValue
        ? getPersistedString(null)
        : (String) defaultValue);
  }
}




Java Source Code List

org.primftpd.AndroidPrefsUserManager.java
org.primftpd.EncryptingEditTextPreference.java
org.primftpd.FtpPrefsActivity.java
org.primftpd.FtpPrefsFragment.java
org.primftpd.FtpServerService.java
org.primftpd.NotificationUtil.java
org.primftpd.PrefsBean.java
org.primftpd.PrimitiveFtpdActivity.java
org.primftpd.filesystem.AndroidFileSystemFactory.java
org.primftpd.filesystem.AndroidFileSystemView.java
org.primftpd.filesystem.AndroidFtpFile.java
org.primftpd.util.EncryptionUtil.java
org.primftpd.util.KeyStoreUtil.java
org.primftpd.util.StringUtils.java
org.slf4j.ILoggerFactory.java
org.slf4j.IMarkerFactory.java
org.slf4j.LoggerFactory.java
org.slf4j.Logger.java
org.slf4j.MDC.java
org.slf4j.MarkerFactory.java
org.slf4j.Marker.java
org.slf4j.helpers.BasicMDCAdapter.java
org.slf4j.helpers.BasicMarkerFactory.java
org.slf4j.helpers.BasicMarker.java
org.slf4j.helpers.FormattingTuple.java
org.slf4j.helpers.MarkerIgnoringBase.java
org.slf4j.helpers.MessageFormatter.java
org.slf4j.helpers.NOPLoggerFactory.java
org.slf4j.helpers.NOPLogger.java
org.slf4j.helpers.NOPMDCAdapter.java
org.slf4j.helpers.NamedLoggerBase.java
org.slf4j.helpers.SubstituteLoggerFactory.java
org.slf4j.helpers.Util.java
org.slf4j.impl.AndroidLoggerFactory.java
org.slf4j.impl.AndroidLogger.java
org.slf4j.impl.StaticLoggerBinder.java
org.slf4j.impl.StaticMDCBinder.java
org.slf4j.impl.StaticMarkerBinder.java
org.slf4j.spi.LocationAwareLogger.java
org.slf4j.spi.LoggerFactoryBinder.java
org.slf4j.spi.MDCAdapter.java
org.slf4j.spi.MarkerFactoryBinder.java