android.app.fragmentmanager Java Examples

The following examples show how to use android.app.fragmentmanager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FoldingDrawerLayoutActivity.java    From FoldingNavigationDrawer-Android with Apache License 2.0 6 votes vote down vote up
private void selectItem(int position) {
	// update the main content by replacing fragments
	Fragment fragment = new AnimalFragment();
	Bundle args = new Bundle();
	args.putInt(AnimalFragment.ARG_ANIMAL_NUMBER, position);
	fragment.setArguments(args);

	FragmentManager fragmentManager = getFragmentManager();
	fragmentManager.beginTransaction()
			.replace(R.id.content_frame, fragment).commit();

	// update selected item and title, then close the drawer
	mDrawerList.setItemChecked(position, true);
	setTitle(mAnimalTitles[position]);
	mDrawerLayout.closeDrawer(mDrawerList);
}
 
Example #2
Source File: AbstractBrowserFragment.java    From SimpleExplorer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    final AbstractBrowserActivity activity = (AbstractBrowserActivity) getActivity();
    final FragmentManager fm = getFragmentManager();

    switch (item.getItemId()) {
        case R.id.folderinfo:
            final DialogFragment dirInfo = new DirectoryInfoDialog();
            dirInfo.show(fm, AbstractBrowserActivity.TAG_DIALOG);
            return true;
        case R.id.search:
            Intent sintent = new Intent(activity, SearchActivity.class);
            startActivity(sintent);
            return true;
        case R.id.paste:
            final PasteTaskExecutor ptc = new PasteTaskExecutor(activity, mCurrentPath);
            ptc.start();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example #3
Source File: ThreadActivity.java    From Ouroboros with GNU General Public License v3.0 6 votes vote down vote up
public void doPositiveClickInternal(String threadNo, String boardName) {
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

    //clear dialog fragments
    fragmentManager.popBackStack("threadDialog", FragmentManager.POP_BACK_STACK_INCLUSIVE);
    if (!threadNo.equals("0")){
        threadDepth = threadDepth + 1;
        threadFragment = new ThreadFragment().newInstance(threadNo, boardName);
        fragmentTransaction.replace(R.id.placeholder_card, threadFragment)
                .addToBackStack("threadDepth" + String.valueOf(threadDepth))
                .commit();
    } else {
        Intent intent = new Intent(this, CatalogActivity.class);
        intent.putExtra(Util.INTENT_BOARD_NAME, boardName);
        startActivity(intent);

    }

}
 
Example #4
Source File: DevTool.java    From debugkit with Apache License 2.0 6 votes vote down vote up
/**
 * Build the tool and show it.
 *
 * @return this to allow chaining.
 */
public Builder build() {
    if (devToolsEnabled) {
        if (mFunctions != null && mFunctions.size() > 0)
            fragment.setFunctionList(mFunctions);

        if (mTextSize != null)
            fragment.setConsoleTextSize(mTextSize);

        fragment.displayAt(startX, starty);

        try {
            FragmentManager fragmentManager = activity.getFragmentManager();
            fragmentManager.beginTransaction()
                    .add(android.R.id.content, fragment)
                    .commit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }

        fragment.setTheme(mTheme);
    }
    return this;
}
 
Example #5
Source File: TVDetailsTest.java    From moviedb-android with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the fragment to a new blank activity, thereby fully
 * initializing its view.
 */
@Before
public void setUp() {
    tvDetailsFragment = new TVDetails();
    activity = Robolectric.buildActivity(MainActivity.class).create().get();
    FragmentManager manager = activity.getFragmentManager();
    Bundle bundle = new Bundle();
    bundle.putInt("id", 1);
    tvDetailsFragment.setArguments(bundle);
    manager.beginTransaction().add(tvDetailsFragment, FRAGMENT_TAG).commit();

    tvDetailsFragmentView = tvDetailsFragment.getView();
    moreIcon = (CircledImageView) tvDetailsFragmentView.findViewById(R.id.moreIcon);
    homeIcon = (CircledImageView) tvDetailsFragmentView.findViewById(R.id.homeIcon);
    galleryIcon = (CircledImageView) tvDetailsFragmentView.findViewById(R.id.galleryIcon);
}
 
Example #6
Source File: MapsAppActivity.java    From maps-app-android with Apache License 2.0 6 votes vote down vote up
/**
 * Opens the content browser that shows the user's maps.
 */
private void showContentBrowser() {
	FragmentManager fragmentManager = getFragmentManager();
	Fragment browseFragment = fragmentManager.findFragmentByTag(ContentBrowserFragment.TAG);
	if (browseFragment == null) {
		browseFragment = new ContentBrowserFragment();
	}

	if (!browseFragment.isVisible()) {
		FragmentTransaction transaction = fragmentManager.beginTransaction();
		transaction.add(R.id.maps_app_activity_content_frame, browseFragment, ContentBrowserFragment.TAG);
		transaction.addToBackStack(null);
		transaction.commit();

		invalidateOptionsMenu(); // reload the options menu
	}

	mDrawerLayout.closeDrawers();
}
 
Example #7
Source File: ArrayPagerAdapter.java    From cwac-pager with Apache License 2.0 6 votes vote down vote up
public ArrayPagerAdapter(FragmentManager fragmentManager,
                         List<PageDescriptor> descriptors,
                         RetentionStrategy retentionStrategy) {
  this.fm=fragmentManager;
  this.entries=new ArrayList<PageEntry>();

  for (PageDescriptor desc : descriptors) {
    validatePageDescriptor(desc);

    entries.add(new PageEntry(desc));
  }

  this.retentionStrategy=retentionStrategy;

  if (this.retentionStrategy == null) {
    this.retentionStrategy=KEEP;
  }
}
 
Example #8
Source File: GenresList.java    From moviedb-android with Apache License 2.0 6 votes vote down vote up
/**
 * Callback method to be invoked when an item in this AdapterView has been clicked.
 *
 * @param parent   The AdapterView where the click happened.
 * @param view     The view within the AdapterView that was clicked (this will be a view provided by the adapter)
 * @param position The position of the view in the adapter.
 * @param id       The row id of the item that was clicked.
 */
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
                        long id) {
    if (movieList.getCurrentList().equals("genre/" + genresList.get(position).getId() + "/movies"))
        movieList.setBackState(1);
    else {
        movieList.setCurrentList("genre/" + genresList.get(position).getId() + "/movies");
        movieList.setBackState(0);
    }
    movieList.setTitle(genresList.get(position).getName());
    FragmentManager manager = getFragmentManager();
    FragmentTransaction transaction = manager.beginTransaction();
    Bundle args = new Bundle();
    args.putString("currentList", "genresList");
    movieList.setArguments(args);
    transaction.replace(R.id.frame_container, movieList);
    // add the current transaction to the back stack:
    transaction.addToBackStack("genresList");
    transaction.commit();
    backState = 1;
}
 
Example #9
Source File: ShoppingListFragment.java    From ShoppingList with Apache License 2.0 6 votes vote down vote up
@Override
    public void onError(ResponseHelper error) {
//        if(error.getType() == CONSTS.APP_ERROR_IO) {
//            getList();
//            return;
//        }

        resetRefreshing();
        ErrorFragment errFR;
        Bundle args = new Bundle();
        args.putString("error_code", error.getContent());
        errFR = new ErrorFragment();
        errFR.setArguments(args);
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.replace(R.id.fragment_container, errFR);
        transaction.addToBackStack(null);
        transaction.commitAllowingStateLoss();
    }
 
Example #10
Source File: ElementGridPagerAdapter.java    From WearViewStub with Apache License 2.0 6 votes vote down vote up
public ElementGridPagerAdapter(List<Element> elements, FragmentManager fm) {
    super(fm);

    this.mRows = new ArrayList<>();
    this.mElement = elements;

    //Construit le tableau des éléménts à afficher
    for (Element element : elements) {
        mRows.add(new Row(
                        //pour l'instant nous ne mettrons qu'un élément par ligne
                        createElementFragment(),
                        CardFragment.create(element.getTitre(), element.getTexte()),
                        createActionFragment(),
                        createActionFragment()
                )
        );
    }
}
 
Example #11
Source File: MainFragment.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void submit(String spell) {
    String input = mEt_Spelling.getText().toString().trim();
    if (input.length() == 0) {
        Toast.makeText(mContext, "Please enter the spelling",
                Toast.LENGTH_SHORT).show();

    } else {
        mAlert.dismiss();

        String answered = mEt_Spelling.getText().toString().trim();
        db.markAnswered(Integer.parseInt(spell), answered);

        Bundle arguments = new Bundle();
        arguments.putString(Intent.EXTRA_TEXT, String.valueOf(spell));

        Fragment frag = ResponseFragment.newInstance();
        frag.setArguments(arguments);

        getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        getActivity().getSupportFragmentManager().beginTransaction().replace(((ViewGroup) getView().getParent()).getId(), frag).addToBackStack(null).commit();

    }
}
 
Example #12
Source File: PaymentActivity.java    From yandex-money-sdk-android with MIT License 6 votes vote down vote up
private void replaceFragment(@Nullable Fragment fragment, boolean clearBackStack) {
    if (fragment == null || isStateSaved) {
        return;
    }

    Fragment currentFragment = getCurrentFragment();
    FragmentManager manager = getFragmentManager();
    if (clearBackStack) {
        manager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }

    @SuppressLint("CommitTransaction")
    FragmentTransaction transaction = manager.beginTransaction()
            .replace(R.id.ym_container, fragment);
    if (!clearBackStack && currentFragment != null) {
        transaction.addToBackStack(fragment.getTag());
    }
    transaction.commit();
    hideKeyboard();
}
 
Example #13
Source File: CameraPreview.java    From cordova-plugin-camera-preview with MIT License 6 votes vote down vote up
private boolean stopCamera(CallbackContext callbackContext) {
  if(webViewParent != null) {
    cordova.getActivity().runOnUiThread(new Runnable() {
      @Override
      public void run() {
        ((ViewGroup)webView.getView()).bringToFront();
        webViewParent = null;
      }
    });
  }

  if(this.hasView(callbackContext) == false){
    return true;
  }

  FragmentManager fragmentManager = cordova.getActivity().getFragmentManager();
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  fragmentTransaction.remove(fragment);
  fragmentTransaction.commit();
  fragment = null;

  callbackContext.success();
  return true;
}
 
Example #14
Source File: DirectoryChooserActivity.java    From droid-stealth with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setupActionBar();

	setContentView(R.layout.directory_chooser_activity);

	final String newDirName = getIntent().getStringExtra(EXTRA_NEW_DIR_NAME);
	final String initialDir = getIntent().getStringExtra(EXTRA_INITIAL_DIRECTORY);

	if (newDirName == null) {
		throw new IllegalArgumentException(
				"You must provide EXTRA_NEW_DIR_NAME when starting the DirectoryChooserActivity.");
	}

	if (savedInstanceState == null) {
		final FragmentManager fragmentManager = getFragmentManager();
		final DirectoryChooserFragment fragment = DirectoryChooserFragment.newInstance(newDirName, initialDir);
		fragmentManager.beginTransaction()
				.add(R.id.main, fragment)
				.commit();
	}
}
 
Example #15
Source File: IRKitVirtualDeviceListActivity.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
@Override
public boolean dispatchKeyEvent(final KeyEvent event) {
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_BACK:
                FragmentManager fm = getFragmentManager();
                int cnt = fm.getBackStackEntryCount();
                if (cnt <= 1) {
                    finish();
                    return false;
                } else {
                    currentPage--;
                }
                break;
            default:
                break;
        }
    }
    return super.dispatchKeyEvent(event);
}
 
Example #16
Source File: HtmlDialog.java    From HtmlDialog with Apache License 2.0 6 votes vote down vote up
/**
 * The sole constructor for {@code HtmlDialog}.
 *
 * @param fm  The {@code FragmentManager} from the calling activity that is used
 *            internally to show the {@code DialogFragment}.
 */
public HtmlDialog(FragmentManager fm)
{
    // See if there are any DialogFragments from the FragmentManager
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(HtmlDialogFragment.TAG_HTML_DIALOG_FRAGMENT);

    // Remove if found
    if (prev != null)
    {
        ft.remove(prev);
        ft.commit();
    }

    mFragmentManager = fm;
}
 
Example #17
Source File: SettingsActivity.java    From openapk with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    setInitialConfiguration();

    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    SettingsFragment fragment = new SettingsFragment();
    fragmentTransaction.add(R.id.fragment_container, fragment);
    fragmentTransaction.commit();
}
 
Example #18
Source File: PreferencesActivity.java    From external-nfc-api with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
	prefs.registerOnSharedPreferenceChangeListener(this);
	
	// Display the fragment as the main content.
	FragmentManager mFragmentManager = getFragmentManager();
	FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction();
	PrefsFragment mPrefsFragment = new PrefsFragment();
	mFragmentTransaction.replace(android.R.id.content, mPrefsFragment);
	mFragmentTransaction.commit();

}
 
Example #19
Source File: ServerFragment.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
public static void show(FragmentManager fm, RootInfo root) {
    final ServerFragment fragment = new ServerFragment();
    final Bundle args = new Bundle();
    args.putParcelable(EXTRA_ROOT, root);
    fragment.setArguments(args);
    final FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.container_directory, fragment);
    ft.commitAllowingStateLoss();
}
 
Example #20
Source File: TVDetailsTest.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testTVDetailsOverview() throws Exception {
    TVDetailsOverview tvDetailsOverview = new TVDetailsOverview();
    FragmentManager manager = activity.getFragmentManager();
    manager.beginTransaction().add(tvDetailsOverview, "tvDetailsOverview").commit();

    assertNotNull("tv details overview is null", tvDetailsOverview);
    View movieDetailsOverviewRoot = tvDetailsOverview.getView();
    assertNotNull("tv details overview is null", movieDetailsOverviewRoot);
    assertNotNull("biographyContent is null", movieDetailsOverviewRoot.findViewById(R.id.overviewContent));
    assertNotNull("scrollView is null", movieDetailsOverviewRoot.findViewById(R.id.tvdetailsoverview));

}
 
Example #21
Source File: ConfirmSyncDataStateMachine.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Run this state machine, displaying the appropriate dialogs.
 * @param callback One of the two functions of the {@link ConfirmImportSyncDataDialog.Listener}
 *         are guaranteed to be called.
 */
public static void run(String oldAccountName, String newAccountName,
        ImportSyncType importSyncType, FragmentManager fragmentManager, Context context,
        ConfirmImportSyncDataDialog.Listener callback) {
    ConfirmSyncDataStateMachine stateMachine = new ConfirmSyncDataStateMachine(oldAccountName,
            newAccountName, importSyncType, fragmentManager, context, callback);
    stateMachine.progress();
}
 
Example #22
Source File: MainFragment.java    From HaiNaBaiChuan with Apache License 2.0 5 votes vote down vote up
/**
 * 添加写作页面的fragment
 */
private void addWriteFragment() {
    FragmentManager manager = getFragmentManager();
    String tag = EditorFragment.class.getSimpleName();
    if (manager.findFragmentByTag(tag) == null) {
        manager.beginTransaction().add(R.id.bottom_sheet, EditorFragment.newInstance(), tag).commit();
    }
}
 
Example #23
Source File: NotificationSettingsFragment.java    From United4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    if (getView() == null) return;
    if (((Checkable) getView().findViewById(R.id.notify_all)).isChecked())
        P.set("which_notifications", "ALL");
    else if (((Checkable) getView().findViewById(R.id.notify_direct)).isChecked())
        P.set("which_notifications", "DIRECT");
    else if (((Checkable) getView().findViewById(R.id.notify_direct_and_created)).isChecked())
        P.set("which_notifications", "DIRECT_AND_CREATED");
    if (!b) return;
    GenericProgressDialogFragment.newInstance("Marking existing replies as notified, please wait...", getFragmentManager());
    final FragmentManager mgr = getFragmentManager();
    final Context act = getActivity();
    new java.lang.Thread(new Runnable() {
        @Override
        public void run() {
            List<Thread> threads = NotificationWorker.pullNotifications(act);
            for (Thread t : threads) {
                NotificationWorker.setNotified(t.post_id);
            }
            // without this, sometimes we try to dismiss the dialog
            // before it's actually created, and it stays up forever
            try { java.lang.Thread.sleep(100); } catch (Exception ignored) { }
            GenericProgressDialogFragment.dismiss(mgr);
        }
    }).start();
}
 
Example #24
Source File: RssfeedActivity.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
private static void addDetailFragment(RssfeedDetailFragment detailFragment, int containerId, boolean addToBackStack, FragmentManager fm) {
	FragmentTransaction trx = fm.beginTransaction();
	if (addToBackStack) {
		trx.replace(containerId, detailFragment, TAG_DETAIL);
		trx.addToBackStack(null);
	} else {
		trx.add(containerId, detailFragment, TAG_DETAIL);
	}
	trx.commit();
}
 
Example #25
Source File: ConfirmManagedSyncDataDialog.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Create the dialog to show when switching from a managed account.
 * @param callback Callback for result.
 * @param fragmentManager FragmentManaged to display the dialog.
 * @param resources Resources to load the strings.
 * @param domain The domain of the managed account.
 * @param oldAccount The old account email address.
 * @param newAccount The new account email address.
 */
public static void showSwitchFromManagedAccountDialog(Listener callback,
        FragmentManager fragmentManager, Resources resources, String domain, String oldAccount,
        String newAccount) {
    String title = resources.getString(R.string.sign_out_managed_account);
    String positive = resources.getString(R.string.accept_and_switch_accounts);
    String negative = resources.getString(R.string.cancel);
    String desc = resources.getString(R.string.switch_from_managed_account_description,
            oldAccount, newAccount, domain);
    showNewInstance(title, desc, positive, negative, fragmentManager, callback);
}
 
Example #26
Source File: ConfirmSyncDataStateMachine.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Run this state machine, displaying the appropriate dialogs.
 * @param callback One of the two functions of the {@link ConfirmImportSyncDataDialog.Listener}
 *         are guaranteed to be called.
 */
public static void run(String oldAccountName, String newAccountName,
        ImportSyncType importSyncType, FragmentManager fragmentManager, Context context,
        ConfirmImportSyncDataDialog.Listener callback) {
    // Includes implicit not-null assertion.
    assert !newAccountName.equals("") : "New account name must be provided.";

    ConfirmSyncDataStateMachine stateMachine = new ConfirmSyncDataStateMachine(oldAccountName,
            newAccountName, importSyncType, fragmentManager, context, callback);
    stateMachine.progress();
}
 
Example #27
Source File: SplashFragment.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_splash, container, false);

    final Activity mActivity = getActivity();
    final String result[] = DataUtils.readTitleAuthor();
    TextView title = (TextView) rootView.findViewById(R.id.title);
    TextView author_name = (TextView) rootView.findViewById(R.id.author_name);

    title.setText(result[0]);
    author_name.setText(result[1]);
    ((TextViewPlus) rootView.findViewById(R.id.intro_text)).setText(getResources().getString(R.string.main_title_info));

    rootView.findViewById(R.id.enter).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
            getActivity().getSupportFragmentManager().beginTransaction().replace(((ViewGroup) getView().getParent()).getId(), MainActivityFragment.newInstance()).addToBackStack(null).commit();
        }
    });

    InfoDb db = new InfoDb(mActivity);
    db.open();
    db.deleteAll();

    long numColumns = db.getCount();
    db.close();
    if (numColumns == 0) {
        FetchXMLTask xmlTask = new FetchXMLTask(getActivity());
        xmlTask.execute(Constants.XMLFileName);
    }
    return rootView;
}
 
Example #28
Source File: FragmentBasicActivity.java    From HelloActivityAndFragment with Apache License 2.0 5 votes vote down vote up
private void removeFragmentB() {
    FragmentManager fragmentManager = getFragmentManager();
    Fragment fragment = fragmentManager.findFragmentByTag(FragmentB.TAG);
    if (null != fragment) {
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.remove(fragment);
        fragmentTransaction.commit();
    }
}
 
Example #29
Source File: MainTvActivity.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (mMediaLibrary.getMediaItems().isEmpty()) {
        if (mSettings.getBoolean(PreferencesActivity.AUTO_RESCAN, true))
            mMediaLibrary.scanMediaItems(false);
        else
            mMediaLibrary.loadMedaItems();
    }

    if (!VLCInstance.testCompatibleCPU(this)) {
        finish();
        return;
    }

    mContext = this;
    setContentView(R.layout.tv_main_fragment);

    mDefaultBackground = getResources().getDrawable(R.drawable.background);
    final FragmentManager fragmentManager = getFragmentManager();
    mBrowseFragment = (BrowseFragment) fragmentManager.findFragmentById(
            R.id.browse_fragment);
    mProgressBar = (ProgressBar) findViewById(R.id.tv_main_progress);

    // Set display parameters for the BrowseFragment
    mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
    mBrowseFragment.setTitle(getString(R.string.app_name));
    mBrowseFragment.setBadgeDrawable(getResources().getDrawable(R.drawable.icon));

    // add a listener for selected items
    mBrowseFragment.setOnItemViewClickedListener(this);
    mBrowseFragment.setOnItemViewSelectedListener(this);

    if (!Build.MANUFACTURER.equalsIgnoreCase("amazon")) { //Hide search for Amazon Fire TVs
        mBrowseFragment.setOnSearchClickedListener(this);
        // set search icon color
        mBrowseFragment.setSearchAffordanceColor(getResources().getColor(R.color.orange500));
    }
    mRootContainer = mBrowseFragment.getView();
}
 
Example #30
Source File: SettingsActivity.java    From Document-Scanner with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    DocumentScannerApplication.getInstance().trackScreenView("Settings");
    FragmentManager fm=getFragmentManager();
    FragmentTransaction ft=fm.beginTransaction();

    sf=new SettingsFragment();
    ft.replace(android.R.id.content, sf);
    ft.commit();
}