Android Open Source - RSSNewsReaderApp Settings Activity






From Project

Back to project page RSSNewsReaderApp.

License

The source code is released under:

GNU General Public License

If you think the Android project RSSNewsReaderApp 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 com.romanostrechlis.rssnews.settings;
/*w w w.  ja va2s. c o  m*/
import com.romanostrechlis.rssnews.MainActivity;
import com.romanostrechlis.rssnews.R;
import com.romanostrechlis.rssnews.auxiliary.Helper;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.NumberPicker;
import android.widget.NumberPicker.OnValueChangeListener;

/**
 * Enables the change of time interval between updates.
 * 
 * <p> Changes are between one minute and an hour.
 * 
 * @author Romanos Trechlis
 *
 */
public class SettingsActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    
    NumberPicker npInterval = (NumberPicker)findViewById(R.id.npUpdateInterval);
    npInterval.setMaxValue(60);
    npInterval.setMinValue(1);
    npInterval.setValue(Helper.getUpdateInterval(this)/60000);
    npInterval.setOnValueChangedListener(new OnValueChangeListener() {
      
      @Override
      public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
        Helper.setUpdateInterval(SettingsActivity.this, newVal * 60000); /** Sets new interval */
      }
    });
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
  }
  
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
      NavUtils.navigateUpTo(this,
          new Intent(this, MainActivity.class));
      return true;
    }
    return super.onOptionsItemSelected(item);
  }
}




Java Source Code List

com.romanostrechlis.rssnews.DetailActivity.java
com.romanostrechlis.rssnews.MainActivity.java
com.romanostrechlis.rssnews.auxiliary.DatabaseHandler.java
com.romanostrechlis.rssnews.auxiliary.ExpCustomListAdapter.java
com.romanostrechlis.rssnews.auxiliary.Helper.java
com.romanostrechlis.rssnews.auxiliary.ManageCustomArrayAdapter.java
com.romanostrechlis.rssnews.auxiliary.OnSwipeTouchListener.java
com.romanostrechlis.rssnews.auxiliary.RetrieveFeedTask.java
com.romanostrechlis.rssnews.auxiliary.UpdateService.java
com.romanostrechlis.rssnews.content.RssFeed.java
com.romanostrechlis.rssnews.content.RssItem.java
com.romanostrechlis.rssnews.legacy.MainCustomArrayAdapter.java
com.romanostrechlis.rssnews.legacy.NodeDetailActivity.java
com.romanostrechlis.rssnews.legacy.NodeDetailFragment.java
com.romanostrechlis.rssnews.legacy.NodeListActivity.java
com.romanostrechlis.rssnews.legacy.NodeListFragment.java
com.romanostrechlis.rssnews.managefeeds.EditRssFeedActivity.java
com.romanostrechlis.rssnews.managefeeds.ManageActivity.java
com.romanostrechlis.rssnews.managefeeds.NewFeedsActivity.java
com.romanostrechlis.rssnews.settings.SettingsActivity.java