Android Open Source - Tree-Task Settings






From Project

Back to project page Tree-Task.

License

The source code is released under:

Apache License

If you think the Android project Tree-Task 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.ghsoft.treetaskapp;
/*  w w  w. jav  a  2 s.c  o m*/
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;

import com.ghsoft.treetask.R;

public class Settings extends PreferenceActivity {

  @SuppressWarnings("deprecation")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.settings);

    final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);

    Preference button = (Preference) findPreference("reset_all");
    button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
      @Override
      public boolean onPreferenceClick(Preference arg0) {
        AlertDialog.Builder builder;
        AlertDialog alert;
        builder = new AlertDialog.Builder(Settings.this);
        builder.setMessage(R.string.sure_to_reset).setCancelable(false).setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {

            settings.edit().clear().commit();
            Intent intent = getIntent();
            finish();
            startActivity(intent);
            overridePendingTransition(0, 0);

          }
        }).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
          }
        });
        alert = builder.create();
        alert.show();

        return true;
      }
    });

  }

  @Override
  public void onBackPressed() {
    super.onBackPressed();

    Intent i;
    i = new Intent(Settings.this, Main.class);
    finish();
    startActivity(i);
    overridePendingTransition(R.anim.back_short_zoom, R.anim.slide_down);

  }
}




Java Source Code List

com.ghsoft.treetask.MetaData.java
com.ghsoft.treetask.TaskDummy.java
com.ghsoft.treetask.TaskHead.java
com.ghsoft.treetask.TaskLeaf.java
com.ghsoft.treetask.TaskManager.java
com.ghsoft.treetask.TaskNode.java
com.ghsoft.treetask.Task.java
com.ghsoft.treetask.TextTreeBuilder.java
com.ghsoft.treetaskapp.About.java
com.ghsoft.treetaskapp.EditTask.java
com.ghsoft.treetaskapp.ExportView.java
com.ghsoft.treetaskapp.HtmlTreeBuilder.java
com.ghsoft.treetaskapp.MainListItem.java
com.ghsoft.treetaskapp.MainViewFragment.java
com.ghsoft.treetaskapp.Main.java
com.ghsoft.treetaskapp.ModifyTaskActivity.java
com.ghsoft.treetaskapp.NewTask.java
com.ghsoft.treetaskapp.NewTreeTask.java
com.ghsoft.treetaskapp.NewTreeView.java
com.ghsoft.treetaskapp.Settings.java
com.ghsoft.treetaskapp.TaskViewListItem.java
com.ghsoft.treetaskapp.TaskView.java
com.ghsoft.treetaskapp.TreeTaskProgressBar.java
com.ghsoft.treetaskapp.TreeView.java