• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 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 package com.android.settings.inputmethod;
17 
18 import android.app.ActionBar;
19 import android.content.Intent;
20 import android.os.Bundle;
21 
22 import com.android.settings.SettingsActivity;
23 
24 public class InputMethodAndSubtypeEnablerActivity extends SettingsActivity {
25     private static final String FRAGMENT_NAME = InputMethodAndSubtypeEnabler.class.getName();
26 
27     @Override
onCreate(final Bundle savedState)28     protected void onCreate(final Bundle savedState) {
29         super.onCreate(savedState);
30         final ActionBar actionBar = getActionBar();
31         if (actionBar != null) {
32             actionBar.setDisplayHomeAsUpEnabled(true);
33             actionBar.setHomeButtonEnabled(true);
34         }
35     }
36 
37     @Override
onNavigateUp()38     public boolean onNavigateUp() {
39         finish();
40         return true;
41     }
42 
43     @Override
getIntent()44     public Intent getIntent() {
45         final Intent modIntent = new Intent(super.getIntent());
46         if (!modIntent.hasExtra(EXTRA_SHOW_FRAGMENT)) {
47             modIntent.putExtra(EXTRA_SHOW_FRAGMENT, FRAGMENT_NAME);
48         }
49         return modIntent;
50     }
51 
52     @Override
isValidFragment(String fragmentName)53     protected boolean isValidFragment(String fragmentName) {
54         return FRAGMENT_NAME.equals(fragmentName);
55     }
56 }
57