2 * Copyright (C) 2013 Koushik Dutta (@koush)
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.koushikdutta.superuser;
19 import android.annotation.SuppressLint;
20 import android.app.Fragment;
21 import android.content.Context;
22 import android.os.Bundle;
23 import android.view.ContextThemeWrapper;
24 import android.view.LayoutInflater;
25 import android.view.View;
26 import android.view.ViewGroup;
28 import com.koushikdutta.widgets.NativeFragment;
30 @SuppressLint("NewApi")
31 public class LogNativeFragment extends NativeFragment<LogFragmentInternal> {
32 ContextThemeWrapper mWrapper;
33 public Context getContext() {
36 mWrapper = new ContextThemeWrapper(super.getContext(), R.style.SuperuserDark);
41 public LogFragmentInternal createFragmentInterface() {
42 return new LogFragmentInternal(this) {
44 public Context getContext() {
45 return LogNativeFragment.this.getContext();
51 LogNativeFragment.this.onDelete(getListContentId());
57 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
58 return super.onCreateView((LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE), container, savedInstanceState);
61 void onDelete(int id) {
62 // getFragmentManager().beginTransaction().remove(this).commit();
63 // getFragmentManager().popBackStack("content", FragmentManager.POP_BACK_STACK_INCLUSIVE);
64 Fragment f = getFragmentManager().findFragmentById(id);
65 if (f != null && f instanceof PolicyNativeFragment) {
66 PolicyNativeFragment p = (PolicyNativeFragment)f;
67 ((PolicyFragmentInternal)p.getInternal()).load();
68 ((PolicyFragmentInternal)p.getInternal()).showAllLogs();