Home | History | Annotate | Download | only in content
      1 /*
      2  * Copyright (C) 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.example.android.apis.content;
     18 
     19 import android.app.Activity;
     20 //import android.content.UndoManager;
     21 import android.os.Parcelable;
     22 import android.view.View;
     23 import android.widget.Button;
     24 import com.example.android.apis.R;
     25 
     26 import android.os.Bundle;
     27 import android.widget.TextView;
     28 
     29 /**
     30  * Simple example of using an UndoManager for editing text in a TextView.
     31  */
     32 public class TextUndoActivity extends Activity {
     33     //UndoManager mUndoManager;
     34 
     35     @Override
     36     protected void onCreate(Bundle savedInstanceState) {
     37         super.onCreate(savedInstanceState);
     38 
     39         /*
     40         mUndoManager = new UndoManager();
     41         if (savedInstanceState != null) {
     42             Parcelable p = savedInstanceState.getParcelable("undo");
     43             if (p != null) {
     44                 mUndoManager.restoreInstanceState(p);
     45             }
     46         }
     47         */
     48 
     49         setContentView(R.layout.text_undo);
     50 
     51         /*
     52         ((TextView)findViewById(R.id.text)).setUndoManager(mUndoManager, "text");
     53         ((Button)findViewById(R.id.undo)).setOnClickListener(new View.OnClickListener() {
     54             @Override
     55             public void onClick(View v) {
     56                 mUndoManager.undo(null, 1);
     57             }
     58         });
     59         ((Button)findViewById(R.id.redo)).setOnClickListener(new View.OnClickListener() {
     60             @Override
     61             public void onClick(View v) {
     62                 mUndoManager.redo(null, 1);
     63             }
     64         });
     65         */
     66      }
     67 
     68     @Override
     69     protected void onSaveInstanceState(Bundle outState) {
     70         super.onSaveInstanceState(outState);
     71         //outState.putParcelable("undo", mUndoManager.saveInstanceState());
     72     }
     73 }
     74