diff options
Diffstat (limited to 'src/com/cyanogenmod/filemanager/activities/NavigationActivity.java')
-rw-r--r-- | src/com/cyanogenmod/filemanager/activities/NavigationActivity.java | 413 |
1 files changed, 306 insertions, 107 deletions
diff --git a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java index 97473c06..6770acfa 100644 --- a/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java +++ b/src/com/cyanogenmod/filemanager/activities/NavigationActivity.java @@ -69,6 +69,9 @@ import com.cyanogenmod.filemanager.console.ConsoleAllocException; import com.cyanogenmod.filemanager.console.ConsoleBuilder; import com.cyanogenmod.filemanager.console.InsufficientPermissionsException; import com.cyanogenmod.filemanager.console.NoSuchFileOrDirectory; +import com.cyanogenmod.filemanager.console.VirtualConsole; +import com.cyanogenmod.filemanager.console.VirtualMountPointConsole; +import com.cyanogenmod.filemanager.console.secure.SecureConsole; import com.cyanogenmod.filemanager.listeners.OnHistoryListener; import com.cyanogenmod.filemanager.listeners.OnRequestRefreshListener; import com.cyanogenmod.filemanager.model.Bookmark; @@ -170,6 +173,12 @@ public class NavigationActivity extends Activity public static final String EXTRA_NAVIGATE_TO = "extra_navigate_to"; //$NON-NLS-1$ + /** + * Constant for extra information for request to add navigation to the history + */ + public static final String EXTRA_ADD_TO_HISTORY = + "extra_add_to_history"; //$NON-NLS-1$ + // The timeout needed to reset the exit status for back button // After this time user need to tap 2 times the back button to // exit, and the toast is shown again after the first tap. @@ -295,11 +304,88 @@ public class NavigationActivity extends Activity FileHelper.sReloadDateTimeFormats = true; NavigationActivity.this.getCurrentNavigationView().refresh(); } + } else if (intent.getAction().compareTo( + FileManagerSettings.INTENT_MOUNT_STATUS_CHANGED) == 0) { + onRequestBookmarksRefresh(); + removeUnmountedHistory(); + removeUnmountedSelection(); } } } }; + private OnClickListener mOnClickDrawerTabListener = new OnClickListener() { + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.drawer_bookmarks_tab: + if (!mBookmarksTab.isSelected()) { + mBookmarksTab.setSelected(true); + mHistoryTab.setSelected(false); + mBookmarksTab.setTextAppearance( + NavigationActivity.this, R.style.primary_text_appearance); + mHistoryTab.setTextAppearance( + NavigationActivity.this, R.style.secondary_text_appearance); + mHistoryLayout.setVisibility(View.GONE); + mBookmarksLayout.setVisibility(View.VISIBLE); + applyTabTheme(); + + try { + Preferences.savePreference(FileManagerSettings.USER_PREF_LAST_DRAWER_TAB, + Integer.valueOf(0), true); + } catch (Exception ex) { + Log.e(TAG, "Can't save last drawer tab", ex); //$NON-NLS-1$ + } + + mClearHistory.setVisibility(View.GONE); + } + break; + case R.id.drawer_history_tab: + if (!mHistoryTab.isSelected()) { + mHistoryTab.setSelected(true); + mBookmarksTab.setSelected(false); + mHistoryTab.setTextAppearance( + NavigationActivity.this, R.style.primary_text_appearance); + mBookmarksTab.setTextAppearance( + NavigationActivity.this, R.style.secondary_text_appearance); + mBookmarksLayout.setVisibility(View.GONE); + mHistoryLayout.setVisibility(View.VISIBLE); + applyTabTheme(); + + try { + Preferences.savePreference(FileManagerSettings.USER_PREF_LAST_DRAWER_TAB, + Integer.valueOf(1), true); + } catch (Exception ex) { + Log.e(TAG, "Can't save last drawer tab", ex); //$NON-NLS-1$ + } + + mClearHistory.setVisibility(mHistory.size() > 0 ? View.VISIBLE : View.GONE); + } + break; + default: + break; + } + } + }; + + private OnClickListener mOnClickDrawerActionBarListener = new OnClickListener() { + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.ab_settings: + mDrawerLayout.closeDrawer(mDrawer); + openSettings(); + break; + case R.id.ab_clear_history: + clearHistory(); + mClearHistory.setVisibility(View.GONE); + break; + default: + break; + } + } + }; + /** * @hide */ @@ -312,11 +398,19 @@ public class NavigationActivity extends Activity private SelectionView mSelectionBar; private DrawerLayout mDrawerLayout; - private ScrollView mDrawer; + private ViewGroup mDrawer; private ActionBarDrawerToggle mDrawerToggle; private LinearLayout mDrawerHistory; private TextView mDrawerHistoryEmpty; + private TextView mBookmarksTab; + private TextView mHistoryTab; + private View mBookmarksLayout; + private View mHistoryLayout; + + private ButtonItem mSettings; + private ButtonItem mClearHistory; + private List<Bookmark> mBookmarks; private LinearLayout mDrawerBookmarks; @@ -337,6 +431,8 @@ public class NavigationActivity extends Activity */ Handler mHandler; + private AsyncTask<Void, Void, Boolean> mBookmarksTask; + /** * {@inheritDoc} */ @@ -355,6 +451,7 @@ public class NavigationActivity extends Activity filter.addAction(Intent.ACTION_DATE_CHANGED); filter.addAction(Intent.ACTION_TIME_CHANGED); filter.addAction(Intent.ACTION_TIMEZONE_CHANGED); + filter.addAction(FileManagerSettings.INTENT_MOUNT_STATUS_CHANGED); registerReceiver(this.mNotificationReceiver, filter); // Set the theme before setContentView @@ -447,6 +544,22 @@ public class NavigationActivity extends Activity if (!FileManagerApplication.checkRestrictSecondaryUsersAccess(this, mChRooted)) { return; } + + // Check that the current dir is mounted (for virtual filesystems) + String curDir = mNavigationViews[mCurrentNavigationView].getCurrentDir(); + if (curDir != null) { + VirtualMountPointConsole vc = VirtualMountPointConsole.getVirtualConsoleForPath( + mNavigationViews[mCurrentNavigationView].getCurrentDir()); + if (vc != null && !vc.isMounted()) { + onRequestBookmarksRefresh(); + removeUnmountedHistory(); + removeUnmountedSelection(); + + Intent intent = new Intent(); + intent.putExtra(EXTRA_ADD_TO_HISTORY, false); + initNavigation(NavigationActivity.this.mCurrentNavigationView, false, intent); + } + } } @Override @@ -536,7 +649,7 @@ public class NavigationActivity extends Activity ((Boolean)FileManagerSettings.SETTINGS_FIRST_USE.getDefaultValue()).booleanValue()); //Display the welcome message? - if (firstUse && !FileManagerApplication.isDeviceRooted()) { + if (firstUse && FileManagerApplication.isDeviceRooted()) { // open navigation drawer to show user that it exists mDrawerLayout.openDrawer(mDrawer); @@ -620,11 +733,10 @@ public class NavigationActivity extends Activity } }); - // Have overflow menu? + // Have overflow menu? Actually no. There is only a search action, so just hide + // the overflow View overflow = findViewById(R.id.ab_overflow); - boolean showOptionsMenu = AndroidHelper.showOptionsMenu(getApplicationContext()); - overflow.setVisibility(showOptionsMenu ? View.VISIBLE : View.GONE); - this.mOptionsAnchorView = showOptionsMenu ? overflow : this.mActionBar; + overflow.setVisibility(View.GONE); // Show the status bar View statusBar = findViewById(R.id.navigation_statusbar_portrait_holder); @@ -643,11 +755,30 @@ public class NavigationActivity extends Activity */ private void initDrawer() { mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); - mDrawer = (ScrollView) findViewById(R.id.drawer); + mDrawer = (ViewGroup) findViewById(R.id.drawer); mDrawerBookmarks = (LinearLayout) findViewById(R.id.bookmarks_list); mDrawerHistory = (LinearLayout) findViewById(R.id.history_list); mDrawerHistoryEmpty = (TextView) findViewById(R.id.history_empty); + mBookmarksLayout = findViewById(R.id.drawer_bookmarks); + mHistoryLayout = findViewById(R.id.drawer_history); + mBookmarksTab = (TextView) findViewById(R.id.drawer_bookmarks_tab); + mHistoryTab = (TextView) findViewById(R.id.drawer_history_tab); + mBookmarksTab.setOnClickListener(mOnClickDrawerTabListener); + mHistoryTab.setOnClickListener(mOnClickDrawerTabListener); + + mSettings = (ButtonItem) findViewById(R.id.ab_settings); + mSettings.setOnClickListener(mOnClickDrawerActionBarListener); + mClearHistory = (ButtonItem) findViewById(R.id.ab_clear_history); + mClearHistory.setOnClickListener(mOnClickDrawerActionBarListener); + + // Restore the last tab pressed + Integer lastTab = Preferences.getSharedPreferences().getInt( + FileManagerSettings.USER_PREF_LAST_DRAWER_TAB.getId(), + (Integer) FileManagerSettings.USER_PREF_LAST_DRAWER_TAB + .getDefaultValue()); + mOnClickDrawerTabListener.onClick(lastTab == 0 ? mBookmarksTab : mHistoryTab); + // Set the navigation drawer "hamburger" icon mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_holo_light_navigation_drawer, @@ -661,7 +792,6 @@ public class NavigationActivity extends Activity | ActionBar.DISPLAY_SHOW_HOME); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); - invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ @@ -681,8 +811,6 @@ public class NavigationActivity extends Activity "action_bar_title", "id", "android"); TextView v = (TextView) findViewById(titleId); theme.setTextColor(NavigationActivity.this, v, "text_color"); //$NON-NLS-1$ - - invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; @@ -694,7 +822,7 @@ public class NavigationActivity extends Activity } /** - * Method adds a history entry to the history list in the drawer + * Method that adds a history entry to the history list in the drawer */ private void addHistoryToDrawer(int index, HistoryNavigable navigable) { // hide empty message @@ -712,10 +840,7 @@ public class NavigationActivity extends Activity TextView name = (TextView) view.findViewById(R.id.history_item_name); TextView directory = (TextView) view .findViewById(R.id.history_item_directory); - TextView position = (TextView) view - .findViewById(R.id.history_item_position); - // if (history.getItem() instanceof NavigationViewInfoParcelable) Drawable icon = iconholder.getDrawable("ic_fso_folder_drawable"); //$NON-NLS-1$ if (navigable instanceof SearchInfoParcelable) { icon = iconholder.getDrawable("ic_history_search_drawable"); //$NON-NLS-1$ @@ -729,11 +854,9 @@ public class NavigationActivity extends Activity name.setText(title); directory.setText(navigable.getDescription()); - position.setText(String.format("#%d", index + 1)); theme.setTextColor(this, name, "text_color"); theme.setTextColor(this, directory, "text_color"); - theme.setTextColor(this, position, "text_color"); // handle item click view.setOnClickListener(new OnClickListener() { @@ -750,6 +873,9 @@ public class NavigationActivity extends Activity // add as first child mDrawerHistory.addView(view, 0); + + // Show clear button if history tab is selected + mClearHistory.setVisibility(mHistoryTab.getVisibility()); } /** @@ -904,12 +1030,17 @@ public class NavigationActivity extends Activity /** * Method that initializes the bookmarks. */ - private void initBookmarks() { + private synchronized void initBookmarks() { + if (mBookmarksTask != null && + !mBookmarksTask.getStatus().equals(AsyncTask.Status.FINISHED)) { + return; + } + // Retrieve the loading view final View waiting = findViewById(R.id.bookmarks_loading); // Load bookmarks in background - AsyncTask<Void, Void, Boolean> task = new AsyncTask<Void, Void, Boolean>() { + mBookmarksTask = new AsyncTask<Void, Void, Boolean>() { Exception mCause; @Override @@ -945,14 +1076,16 @@ public class NavigationActivity extends Activity NavigationActivity.this, this.mCause); } } + mBookmarksTask = null; } @Override protected void onCancelled() { waiting.setVisibility(View.GONE); + mBookmarksTask = null; } }; - task.execute(); + mBookmarksTask.execute(); } /** @@ -971,6 +1104,7 @@ public class NavigationActivity extends Activity bookmarks.addAll(loadFilesystemBookmarks()); } bookmarks.addAll(loadSdStorageBookmarks()); + bookmarks.addAll(loadVirtualBookmarks()); bookmarks.addAll(loadUserBookmarks()); return bookmarks; } @@ -1103,6 +1237,32 @@ public class NavigationActivity extends Activity } /** + * Method that loads all virtual mount points. + * + * @return List<Bookmark> The bookmarks loaded + */ + private List<Bookmark> loadVirtualBookmarks() { + // Initialize the bookmarks + List<Bookmark> bookmarks = new ArrayList<Bookmark>(); + List<MountPoint> mps = VirtualMountPointConsole.getVirtualMountPoints(); + for (MountPoint mp : mps) { + BOOKMARK_TYPE type = null; + String name = null; + if (mp.isSecure()) { + type = BOOKMARK_TYPE.SECURE; + name = getString(R.string.bookmarks_secure); + } else if (mp.isRemote()) { + type = BOOKMARK_TYPE.REMOTE; + name = getString(R.string.bookmarks_remote); + } else { + continue; + } + bookmarks.add(new Bookmark(type, name, mp.getMountPoint())); + } + return bookmarks; + } + + /** * Method that loads the user bookmarks (added by the user). * * @return List<Bookmark> The bookmarks loaded @@ -1133,6 +1293,17 @@ public class NavigationActivity extends Activity /** NON BLOCK **/ } } + + // Remove bookmarks from virtual storage if the filesystem is not mount + int c = bookmarks.size() - 1; + for (int i = c; i >= 0; i--) { + VirtualMountPointConsole vc = + VirtualMountPointConsole.getVirtualConsoleForPath(bookmarks.get(i).mPath); + if (vc != null && !vc.isMounted()) { + bookmarks.remove(i); + } + } + return bookmarks; } @@ -1223,6 +1394,15 @@ public class NavigationActivity extends Activity initialDir = navigateTo; } + // Add to history + final boolean addToHistory = intent.getBooleanExtra(EXTRA_ADD_TO_HISTORY, true); + + // We cannot navigate to a secure console if is unmount, go to root in that case + VirtualConsole vc = VirtualMountPointConsole.getVirtualConsoleForPath(initialDir); + if (vc != null && vc instanceof SecureConsole && !((SecureConsole) vc).isMounted()) { + initialDir = FileHelper.ROOT_DIRECTORY; + } + if (this.mChRooted) { // Initial directory is the first external sdcard (sdcard, emmc, usb, ...) if (!StorageHelper.isPathInStorageVolume(initialDir)) { @@ -1257,17 +1437,19 @@ public class NavigationActivity extends Activity this, ipex, false, true, new OnRelaunchCommandResult() { @Override public void onSuccess() { - navigationView.changeCurrentDir(absInitialDir); + navigationView.changeCurrentDir(absInitialDir, addToHistory); } @Override public void onFailed(Throwable cause) { showInitialInvalidDirectoryMsg(userInitialDir); - navigationView.changeCurrentDir(FileHelper.ROOT_DIRECTORY); + navigationView.changeCurrentDir(FileHelper.ROOT_DIRECTORY, + addToHistory); } @Override public void onCancelled() { showInitialInvalidDirectoryMsg(userInitialDir); - navigationView.changeCurrentDir(FileHelper.ROOT_DIRECTORY); + navigationView.changeCurrentDir(FileHelper.ROOT_DIRECTORY, + addToHistory); } }); @@ -1289,7 +1471,7 @@ public class NavigationActivity extends Activity } // Change the current directory to the user-defined initial directory - navigationView.changeCurrentDir(initialDir); + navigationView.changeCurrentDir(initialDir, addToHistory); } /** @@ -1368,65 +1550,6 @@ public class NavigationActivity extends Activity } /** - * {@inheritDoc} - */ - @Override - public boolean onOptionsItemSelected(MenuItem item) { - // Pass the event to ActionBarDrawerToggle, if it returns - // true, then it has handled the app icon touch event - if (mDrawerToggle.onOptionsItemSelected(item)) { - return true; - } - - // just handle the drawer list here - switch (item.getItemId()) { - case R.id.mnu_actions_add_to_bookmarks_current_folder: - // TODO add bookmark - Log.d(TAG, "add bookmark"); - return true; - case R.id.mnu_clear_history: - clearHistory(); - return true; - case R.id.mnu_settings: - openSettings(); - return true; - } - - return super.onOptionsItemSelected(item); - } - - /** - * Called when the menu is created. Just includes the drawer's overflow - * menu. All entries are hidden until onPrepareOptionsMenu unhides them. - */ - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.drawer, menu); - return true; - } - - /** - * Called whenever we call invalidateOptionsMenu() - */ - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawer); - - for (int i = 0; i < menu.size(); i++) { - // show all items if drawer is open, - // hide them if not - menu.getItem(i).setVisible(drawerOpen); - - if (menu.getItem(i).getItemId() == R.id.mnu_clear_history) { - menu.getItem(i).setEnabled(mHistory.size() > 0); - } - } - - return super.onPrepareOptionsMenu(menu); - } - - /** * Method invoked when an action item is clicked. * * @param view The button pushed @@ -1535,14 +1658,16 @@ public class NavigationActivity extends Activity case INTENT_REQUEST_SEARCH: if (resultCode == RESULT_OK) { //Change directory? - FileSystemObject fso = - (FileSystemObject)data. - getSerializableExtra(EXTRA_SEARCH_ENTRY_SELECTION); - SearchInfoParcelable searchInfo = - data.getParcelableExtra(EXTRA_SEARCH_LAST_SEARCH_DATA); - if (fso != null) { - //Goto to new directory - getCurrentNavigationView().open(fso, searchInfo); + Bundle bundle = data.getExtras(); + if (bundle != null) { + FileSystemObject fso = (FileSystemObject) bundle.getSerializable( + EXTRA_SEARCH_ENTRY_SELECTION); + SearchInfoParcelable searchInfo = + bundle.getParcelable(EXTRA_SEARCH_LAST_SEARCH_DATA); + if (fso != null) { + //Goto to new directory + getCurrentNavigationView().open(fso, searchInfo); + } } } else if (resultCode == RESULT_CANCELED) { SearchInfoParcelable searchInfo = @@ -1606,6 +1731,14 @@ public class NavigationActivity extends Activity * {@inheritDoc} */ @Override + public void onRequestBookmarksRefresh() { + initBookmarks(); + } + + /** + * {@inheritDoc} + */ + @Override public void onRequestRemove(Object o, boolean clearSelection) { if (o instanceof FileSystemObject) { // Remove from view @@ -1797,6 +1930,13 @@ public class NavigationActivity extends Activity if (breadcrumb.getMountPointInfo().compareTo(mountPoint) == 0) { breadcrumb.updateMountPointInfo(); } + if (mountPoint.isSecure()) { + // Secure mountpoints only can be unmount, so we need to move the navigation + // to a secure storage (do not add to history) + Intent intent = new Intent(); + intent.putExtra(EXTRA_ADD_TO_HISTORY, false); + initNavigation(NavigationActivity.this.mCurrentNavigationView, false, intent); + } } }); dialog.show(); @@ -2044,17 +2184,19 @@ public class NavigationActivity extends Activity * Method that remove the {@link FileSystemObject} from the history */ private void removeFromHistory(FileSystemObject fso) { - // TODO remove drawer entry here, too if (this.mHistory != null) { - int cc = this.mHistory.size(); - for (int i = cc-1; i >= 0 ; i--) { + int cc = this.mHistory.size() - 1; + for (int i = cc; i >= 0 ; i--) { History history = this.mHistory.get(i); if (history.getItem() instanceof NavigationViewInfoParcelable) { String p0 = fso.getFullPath(); - String p1 = - ((NavigationViewInfoParcelable)history.getItem()).getCurrentDir(); + String p1 = ((NavigationViewInfoParcelable) history.getItem()).getCurrentDir(); if (p0.compareTo(p1) == 0) { this.mHistory.remove(i); + mDrawerHistory.removeViewAt(mDrawerHistory.getChildCount() - i - 1); + mDrawerHistoryEmpty.setVisibility( + mDrawerHistory.getChildCount() == 0 ? View.VISIBLE : View.GONE); + updateHistoryPositions(); } } } @@ -2062,6 +2204,17 @@ public class NavigationActivity extends Activity } /** + * Update the history positions after one of the history is removed from drawer + */ + private void updateHistoryPositions() { + int cc = this.mHistory.size() - 1; + for (int i = 0; i <= cc ; i++) { + History history = this.mHistory.get(i); + history.setPosition(i + 1); + } + } + + /** * Method that ask the user to change the access mode prior to crash. * @hide */ @@ -2208,11 +2361,8 @@ public class NavigationActivity extends Activity rbw += bw; } } - int w = abw + rbw; - boolean showOptionsMenu = AndroidHelper.showOptionsMenu(getApplicationContext()); - if (!showOptionsMenu) { - w -= bw; - } + // Currently there isn't overflow menu + int w = abw + rbw - bw; // Add to the new location ViewGroup newParent = (ViewGroup)findViewById(R.id.navigation_title_landscape_holder); @@ -2262,6 +2412,40 @@ public class NavigationActivity extends Activity } /** + * Method that removes all the history items that refers to virtual unmounted filesystems + */ + private void removeUnmountedHistory() { + int cc = mHistory.size() - 1; + for (int i = cc; i >= 0; i--) { + History history = mHistory.get(i); + if (history.getItem() instanceof NavigationViewInfoParcelable) { + NavigationViewInfoParcelable navigableInfo = + ((NavigationViewInfoParcelable) history.getItem()); + VirtualMountPointConsole vc = + VirtualMountPointConsole.getVirtualConsoleForPath( + navigableInfo.getCurrentDir()); + if (vc != null && !vc.isMounted()) { + mHistory.remove(i); + mDrawerHistory.removeViewAt(mDrawerHistory.getChildCount() - i - 1); + } + } + } + mDrawerHistoryEmpty.setVisibility( + mDrawerHistory.getChildCount() == 0 ? View.VISIBLE : View.GONE); + updateHistoryPositions(); + } + + /** + * Method that removes all the selection items that refers to virtual unmounted filesystems + */ + private void removeUnmountedSelection() { + for (NavigationView view : mNavigationViews) { + view.removeUnmountedSelection(); + } + mSelectionBar.setSelection(getNavigationView(mCurrentNavigationView).getSelectedFiles()); + } + + /** * Method that applies the current theme to the activity * @hide */ @@ -2269,6 +2453,7 @@ public class NavigationActivity extends Activity int orientation = getResources().getConfiguration().orientation; Theme theme = ThemeManager.getCurrentTheme(this); theme.setBaseTheme(this, false); + applyTabTheme(); // imitate a closed drawer while layout is rebuilt to avoid NullPointerException boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawer); @@ -2318,11 +2503,6 @@ public class NavigationActivity extends Activity theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ // - Navigation drawer - theme.setBackgroundColor(this, mDrawer, "drawer_color"); - v = findViewById(R.id.bookmarks_header); - theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ - v = findViewById(R.id.history_header); - theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ v = findViewById(R.id.history_empty); theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ mDrawerToggle.setDrawerImageResource(theme.getResourceId(this, "drawer_icon")); @@ -2334,8 +2514,6 @@ public class NavigationActivity extends Activity theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ v = item.findViewById(R.id.history_item_directory); theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ - v = item.findViewById(R.id.history_item_position); - theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ } //- NavigationView @@ -2350,4 +2528,25 @@ public class NavigationActivity extends Activity } } + /** + * Method that applies the current theme to the tab host + */ + private void applyTabTheme() { + // Apply the theme + Theme theme = ThemeManager.getCurrentTheme(this); + + View v = findViewById(R.id.drawer); + theme.setBackgroundDrawable(this, v, "background_drawable"); //$NON-NLS-1$ + + v = findViewById(R.id.drawer_bookmarks_tab); + theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ + v = findViewById(R.id.drawer_history_tab); + theme.setTextColor(this, (TextView)v, "text_color"); //$NON-NLS-1$ + + v = findViewById(R.id.ab_settings); + theme.setImageDrawable(this, (ButtonItem) v, "ab_settings_drawable"); //$NON-NLS-1$ + v = findViewById(R.id.ab_clear_history); + theme.setImageDrawable(this, (ButtonItem) v, "ab_delete_drawable"); //$NON-NLS-1$ + } + } |