Android Open Source - field-data-app Settings Activity






From Project

Back to project page field-data-app.

License

The source code is released under:

MIT License

If you think the Android project field-data-app 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 nz.cri.gns.springs.activity;
//from  ww  w.ja v a 2 s. c  o m
import java.util.ArrayList;

import nz.cri.gns.springs.R;
import nz.cri.gns.springs.db.Configuration;
import nz.cri.gns.springs.db.SpringsDbHelper;
import nz.cri.gns.springs.util.UiUtil;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;

public class SettingsActivity extends OrmLiteBaseActivity<SpringsDbHelper> implements OnClickListener {

  
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);      
    }
  
  @Override
  public void onResume() {
    super.onResume();
    
    UiUtil.getChildren(this.findViewById(R.id.settings_table), new ArrayList<View>(), new UiUtil.ViewFilter() {
      
      @Override
      public boolean matches(View view) {
        Object tag = view.getTag();
        if (view instanceof EditText && tag != null) {
          String value = Configuration.getConfiguration(tag.toString(), getHelper());
          if (value != null) {
            ((EditText)view).setText(value);
          }
        }
        return false;
      }
    });
    
        Button saveSettings = (Button)this.findViewById(R.id.save_settings_button);
        saveSettings.setOnClickListener(this);
        
        findViewById(R.id.edit_sample_numbers_button)
        .setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(SettingsActivity.this, EditBiologicalSamplesActivity.class);
                startActivity(intent);
            }
        }); 
        
  }
  @Override
  public void onClick(View v) {
    UiUtil.getChildren(this.findViewById(R.id.settings_table), new ArrayList<View>(), new UiUtil.ViewFilter() {
      
      @Override
      public boolean matches(View view) {
        Object tag = view.getTag();
        if (view instanceof EditText && tag != null) {
          Configuration.setConfiguration(tag.toString(), ((EditText)view).getText().toString(), getHelper());
        }
        return false;
      }
    });
    
    this.finish();
    
  }

}




Java Source Code List

nz.cri.gns.springs.GpsLocation.java
nz.cri.gns.springs.SpringsApplication.java
nz.cri.gns.springs.activity.BioSampleActivity.java
nz.cri.gns.springs.activity.EditBiologicalSamplesActivity.java
nz.cri.gns.springs.activity.MainMenuActivity.java
nz.cri.gns.springs.activity.ManageBioSamplesActivity.java
nz.cri.gns.springs.activity.SettingsActivity.java
nz.cri.gns.springs.db.BiologicalSampleTest.java
nz.cri.gns.springs.db.BiologicalSample.java
nz.cri.gns.springs.db.ChecklistItem.java
nz.cri.gns.springs.db.Configuration.java
nz.cri.gns.springs.db.FeatureTest.java
nz.cri.gns.springs.db.Feature.java
nz.cri.gns.springs.db.PersistentObject.java
nz.cri.gns.springs.db.SpringsDbHelper.java
nz.cri.gns.springs.db.SurveyImage.java
nz.cri.gns.springs.db.SurveyTest.java
nz.cri.gns.springs.db.Survey.java
nz.cri.gns.springs.fragments.AppearanceFragment.java
nz.cri.gns.springs.fragments.BioSampleActivityFragment.java
nz.cri.gns.springs.fragments.BioSampleFragment.java
nz.cri.gns.springs.fragments.ChooseImageFragment.java
nz.cri.gns.springs.fragments.ExportSamplesFragment.java
nz.cri.gns.springs.fragments.FeatureIdFragment.java
nz.cri.gns.springs.fragments.ImageColourPickerFragment.java
nz.cri.gns.springs.fragments.ImageFragment.java
nz.cri.gns.springs.fragments.SpringsDialogFragment.java
nz.cri.gns.springs.fragments.SpringsFragment.java
nz.cri.gns.springs.util.CustomExceptionHandler.java
nz.cri.gns.springs.util.DataStatistics.java
nz.cri.gns.springs.util.DateTimePickerDialog.java
nz.cri.gns.springs.util.UiUtil.java
nz.cri.gns.springs.util.Util.java