1 package mhr.app.fragments.toolbox;
3 import mhr.app.AppMainActivity;
5 import mhr.app.debug.DebugToolSettingsFragment;
6 import mhr.appcore.commands.imagecommands.ApplyUndoPatchCommand;
7 import android.app.Activity;
8 import android.app.Fragment;
9 import android.app.FragmentTransaction;
10 import android.os.Bundle;
11 import android.util.SparseArray;
12 import android.view.LayoutInflater;
13 import android.view.View;
14 import android.view.View.OnClickListener;
15 import android.view.ViewGroup;
16 import android.widget.ImageView;
17 import android.widget.TextView;
39 protected SparseArray<Fragment>
fragments =
new SparseArray<Fragment>();
54 protected View
initView(LayoutInflater
inflater, ViewGroup container, Bundle savedInstanceState) {
55 root = inflater.inflate(
R.layout.fragment_toolbox_pane, container,
false);
81 root.findViewById(
R.id.ToolBoxToolbarBorder).setOnClickListener(
this);
82 root.findViewById(
R.id.ToolBoxCaptionTV).setOnClickListener(
this);
83 root.findViewById(
R.id.UndoRedoBtn).setOnClickListener(
this);
94 protected void addTool(
int id,
int imageId,
int nameId, Fragment settingsFragment) {
95 ViewGroup item = (ViewGroup)
inflater.inflate(
R.layout.toolbox_item, null);
97 ((ImageView) item.findViewById(
R.id.ToolBoxItemImage)).setImageResource(imageId);
98 ((TextView) item.findViewById(
R.id.ToolBoxItemName)).setText(nameId);
99 item.setOnClickListener(
this);
101 fragments.put(Integer.valueOf(
id), settingsFragment);
116 FragmentTransaction ft = getFragmentManager().beginTransaction();
117 ft.replace(
R.id.ToolSettingPlaceholder, f);
152 case R.id.ToolBoxToolbarBorder:
155 case R.id.ToolBoxCaptionTV:
158 case R.id.UndoRedoBtn:
171 super.onAttach(activity);
176 inflater = activity.getLayoutInflater();
203 return initView(inflater, container, savedInstanceState);