Android Open Source - Aether-s-Notebook-Android-Client Configuration Activity






From Project

Back to project page Aether-s-Notebook-Android-Client.

License

The source code is released under:

GNU General Public License

If you think the Android project Aether-s-Notebook-Android-Client 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 aethers.notebook.appender.managed.file;
/*from w  w w.  j a va 2  s .c  o m*/
import java.io.File;

import aethers.notebook.R;
import aethers.notebook.core.ui.filechooser.FileChooser;
import android.content.Intent;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;

public class ConfigurationActivity 
extends PreferenceActivity
{
    private static final int REQUEST_CODE = 111;
    
    private static final String EXTRA_RESULT = "FILENAME";
    
    private Preference filePathPreference;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        getPreferenceManager().setSharedPreferencesName(Configuration.SHARED_PREFERENCES_NAME);
        addPreferencesFromResource(R.xml.fileappender);
        filePathPreference = findPreference(getString(R.string.FileAppender_Preferences_logfilePath));
        filePathPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener()
        {
            @Override
            public boolean onPreferenceClick(Preference preference) 
            {
                Configuration config = new Configuration(ConfigurationActivity.this);
                File f = new File(config.getLogfilePath());
                Intent i = FileChooser.createStartIntent(
                        ConfigurationActivity.this, f.getParent(),
                        EXTRA_RESULT);
                startActivityForResult(i, REQUEST_CODE);
                return true;
            }
        });
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) 
    {
        if(resultCode == RESULT_CANCELED)
            return;
        if(REQUEST_CODE != requestCode)
            return;
        if(data == null || !data.hasExtra(EXTRA_RESULT))
            return;
        Editor e = getPreferenceManager().getSharedPreferences().edit();
        e.putString(
                filePathPreference.getKey(),
                data.getStringExtra(EXTRA_RESULT));
        e.commit();
    }
}




Java Source Code List

aethers.notebook.appender.managed.file.ConfigurationActivity.java
aethers.notebook.appender.managed.file.Configuration.java
aethers.notebook.appender.managed.file.FileAppender.java
aethers.notebook.appender.managed.uploader.ConfigurationActivity.java
aethers.notebook.appender.managed.uploader.Configuration.java
aethers.notebook.appender.managed.uploader.UploaderAppender.java
aethers.notebook.core.Action.java
aethers.notebook.core.AppenderServiceIdentifier.java
aethers.notebook.core.BootReceiver.java
aethers.notebook.core.ConfigurationTemplate.java
aethers.notebook.core.Configuration.java
aethers.notebook.core.CoreService.java
aethers.notebook.core.LoggerServiceIdentifier.java
aethers.notebook.core.TimeStamp.java
aethers.notebook.core.ui.ConfigurationActivity.java
aethers.notebook.core.ui.EditIntegerPreference.java
aethers.notebook.core.ui.IntegerPreferenceChangeListener.java
aethers.notebook.core.ui.NonPersistingButtonPreference.java
aethers.notebook.core.ui.PersistingButtonPreference.java
aethers.notebook.core.ui.filechooser.DirectoryChooser.java
aethers.notebook.core.ui.filechooser.FileChooser.java
aethers.notebook.core.ui.filechooser.FileListAdapter.java
aethers.notebook.logger.managed.PushLogger.java
aethers.notebook.logger.managed.celllocation.CellLocationLogger.java
aethers.notebook.logger.managed.dataconnectionstate.DataConnectionStateLogger.java
aethers.notebook.logger.managed.position.ConfigurationActivity.java
aethers.notebook.logger.managed.position.Configuration.java
aethers.notebook.logger.managed.position.PositionLogger.java
aethers.notebook.logger.managed.servicestate.ServiceStateLogger.java
aethers.notebook.logger.managed.signalstrength.SignalStrengthLogger.java
aethers.notebook.logger.managed.wifi.ConfigurationActivity.java
aethers.notebook.logger.managed.wifi.Configuration.java
aethers.notebook.logger.managed.wifi.WifiLogger.java
aethers.notebook.util.Logger.java