private void displaySubjectwiseMarks() { testwisePager.setVisibility(View.GONE); subjectwisePager.removeAllViews(); subjectwisePager.setVisibility(View.VISIBLE); List<Fragment> fragments = getFragments(mSubjectwiseSparseArrayList.size(), mSubjectwiseSparseArrayList); MyPageAdapter pageAdapter = new MyPageAdapter(getSupportFragmentManager(), fragments); pageAdapter.notifyDataSetChanged(); subjectwisePager.setAdapter(pageAdapter); updateIndicator(0, fragments.size()); }
private void setupBaseLayout() { if (getSupportFragmentManager().getBackStackEntryCount() == 0) { mMenuDrawer.setDrawerIndicatorEnabled(true); mViewPager.setVisibility(View.VISIBLE); mTabView.setVisibility(View.VISIBLE); } else { mMenuDrawer.setDrawerIndicatorEnabled(false); mViewPager.setVisibility(View.GONE); mTabView.setVisibility(View.GONE); } }
/** * Goes back to usual Phone UI with tags. Previously selected Tag and associated Fragment should * be automatically focused again. */ private void exitSearchUi() { final ActionBar actionBar = getActionBar(); // Hide the search fragment, if exists. if (mSearchFragment != null) { mSearchFragment.setUserVisibleHint(false); final FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.hide(mSearchFragment); transaction.commitAllowingStateLoss(); } // We want to hide SearchView and show Tabs. Also focus on previously selected one. actionBar.setDisplayShowCustomEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); sendFragmentVisibilityChange(mViewPager.getCurrentItem(), true); // Before exiting the search screen, reset swipe state. mDuringSwipe = false; mUserTabClick = false; mViewPager.setVisibility(View.VISIBLE); hideInputMethod(getCurrentFocus()); // Request to update option menu. invalidateOptionsMenu(); // See comments in onActionViewExpanded() mSearchView.onActionViewCollapsed(); mInSearchUi = false; }
private void updateUi() { LogUtil.d("MVBaseFragment", "MVBaseFragment updateUi()"); viewPager.setVisibility(View.VISIBLE); tabiIndicator.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); mvPagerAdapter.notifyDataSetChanged(); tabiIndicator.notifyDataSetChanged(); }
private void getVisibility() { TabLayout tabLayout = (TabLayout) getActivity().findViewById(R.id.tabLayout); tabLayout.setVisibility(View.GONE); ViewPager viewPager = (ViewPager) getActivity().findViewById(R.id.viewPager); viewPager.setVisibility(View.GONE); FrameLayout outTabContent = (FrameLayout) getActivity().findViewById(R.id.outTabContent); outTabContent.setVisibility(View.VISIBLE); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); pager = (ViewPager) findViewById(R.id.pager); adapter = new ContentsAdapter(this); pager.setAdapter(adapter); findViewById(R.id.progressBar1).setVisibility(View.GONE); pager.setVisibility(View.VISIBLE); }
@Override protected void initView(Bundle savedInstanceState) { setContentView(R.layout.layout_guide); btn_guide_in = getViewById(R.id.btn_guide_in); viewpager_guide_page = getViewById(R.id.viewpager_guide_page); indicator = getViewById(R.id.indicator_guide_page); indicator.setVisibility(View.VISIBLE); viewpager_guide_page.setVisibility(View.VISIBLE); initGuideGallery(); }
private void showGUIListMenu() { if (mGuiMenu != null && mGuiMenu.getVisibility() != View.VISIBLE) { mGuiMenu.setVisibility(View.VISIBLE); mGuiMenu.startAnimation(mInAnimationFromLeft); if (!mTabletVersion) { mGuiFooter.setVisibility(View.GONE); mPager.setVisibility(View.GONE); mPager.startAnimation(mOutAnimation2Right); } mMenuShown = true; } }
protected void hideGUIListMenu() { if (mGuiMenu != null && mGuiMenu.getVisibility() == View.VISIBLE) { mGuiMenu.setVisibility(View.GONE); mGuiMenu.startAnimation(mOutAnimation2Left); if (!mTabletVersion) { mGuiFooter.setVisibility(View.VISIBLE); mPager.setVisibility(View.VISIBLE); mPager.startAnimation(mInAnimationFromRight); } mMenuShown = false; InputMethodManager im = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (im != null && im.isActive()) { im.hideSoftInputFromWindow(mGuiMenu.getWindowToken(), 0); } } }
private void setOneFragmentInScreen(FermatFragmentFactory walletFragmentFactory) { try { WalletNavigationStructure walletRuntime = getWalletRuntimeManager().getLastWallet(); String walletPublicKey = walletRuntime.getPublicKey(); String walletCategory = walletRuntime.getWalletCategory(); String walletType = walletRuntime.getWalletType(); FermatSession walletSession = getWalletSessionManager().getWalletSession(walletPublicKey); String fragment = walletRuntime.getLastActivity().getLastFragment().getType(); if (walletFragmentFactory != null) { TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.setVisibility(View.GONE); ViewPager pagertabs = (ViewPager) findViewById(R.id.pager); pagertabs.setVisibility(View.VISIBLE); adapter = new TabsPagerAdapter( getFragmentManager(), getApplicationContext(), walletFragmentFactory, fragment, walletSession, getWalletResourcesProviderManager()); pagertabs.setAdapter(adapter); // pagertabs.setCurrentItem(); final int pageMargin = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pagertabs.setPageMargin(pageMargin); // pagertabs.setCurrentItem(tabStrip.getStartItem(), true); // tabLayout.setupWithViewPager(pagertabs); // pagertabs.setOffscreenPageLimit(tabStrip.getTabs().size()); } } catch (Exception e) { e.printStackTrace(); } }
/** Hides every tab and shows search UI for phone lookup. */ private void enterSearchUi() { if (mSearchFragment == null) { // We add the search fragment dynamically in the first onLayoutChange() and // mSearchFragment is set sometime later when the fragment transaction is actually // executed, which means there's a window when users are able to hit the (physical) // search key but mSearchFragment is still null. // It's quite hard to handle this case right, so let's just ignore the search key // in this case. Users can just hit it again and it will work this time. return; } if (mSearchView == null) { prepareSearchView(); } final ActionBar actionBar = getActionBar(); final Tab tab = actionBar.getSelectedTab(); // User can search during the call, but we don't want to remember the status. if (tab != null && !DialpadFragment.phoneIsInUse()) { mLastManuallySelectedFragment = tab.getPosition(); } mSearchView.setQuery(null, true); actionBar.setDisplayShowCustomEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); sendFragmentVisibilityChange(mViewPager.getCurrentItem(), false); // Show the search fragment and hide everything else. mSearchFragment.setUserVisibleHint(true); final FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.show(mSearchFragment); transaction.commitAllowingStateLoss(); mViewPager.setVisibility(View.GONE); // We need to call this and onActionViewCollapsed() manually, since we are using a custom // layout instead of asking the search menu item to take care of SearchView. mSearchView.onActionViewExpanded(); mInSearchUi = true; }
private void setOneFragmentInScreen() throws InvalidParameterException { SubAppRuntimeManager subAppRuntimeManager = getSubAppRuntimeMiddleware(); SubApps subAppType = subAppRuntimeManager.getLastSubApp().getType(); com.bitdubai.fermat_android_api.layer.definition.wallet.interfaces.SubAppFragmentFactory subAppFragmentFactory = SubAppFragmentFactory.getFragmentFactoryBySubAppType(subAppType); String fragment = subAppRuntimeManager.getLastSubApp().getLastActivity().getLastFragment().getType(); SubAppsSession subAppsSession = getSubAppSessionManager().getSubAppsSession(subAppType); try { if (subAppFragmentFactory != null) { TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.setVisibility(View.GONE); ViewPager pagertabs = (ViewPager) findViewById(R.id.pager); pagertabs.setVisibility(View.VISIBLE); adapter = new TabsPagerAdapter( getFragmentManager(), getApplicationContext(), subAppFragmentFactory, fragment, subAppsSession, getSubAppResourcesProviderManager(), getResources()); pagertabs.setAdapter(adapter); final int pageMargin = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pagertabs.setPageMargin(pageMargin); } } catch (Exception e) { e.printStackTrace(); } }
@Override public void onCreate(Bundle savedInstanceState) { // it is necessary to set the view first before calling super because of the nav drawer in // BaseDrawerActivity setContentView(R.layout.activity_accounts); super.onCreate(savedInstanceState); final Intent intent = getIntent(); handleOpenFileIntent(intent); init(); mPager = (ViewPager) findViewById(R.id.pager); mTitlePageIndicator = (TitlePageIndicator) findViewById(R.id.titles); String action = intent.getAction(); if (action != null && action.equals(Intent.ACTION_INSERT_OR_EDIT)) { // enter account creation/edit mode if that was specified mPager.setVisibility(View.GONE); mTitlePageIndicator.setVisibility(View.GONE); String accountUID = intent.getStringExtra(UxArgument.SELECTED_ACCOUNT_UID); if (accountUID != null) showEditAccountFragment(accountUID); else { String parentAccountUID = intent.getStringExtra(UxArgument.PARENT_ACCOUNT_UID); showAddAccountFragment(parentAccountUID); } } else { // show the simple accounts list PagerAdapter mPagerAdapter = new AccountViewPagerAdapter(getSupportFragmentManager()); mPager.setAdapter(mPagerAdapter); mTitlePageIndicator.setViewPager(mPager); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); int lastTabIndex = preferences.getInt(LAST_OPEN_TAB_INDEX, INDEX_TOP_LEVEL_ACCOUNTS_FRAGMENT); int index = intent.getIntExtra(EXTRA_TAB_INDEX, lastTabIndex); mPager.setCurrentItem(index); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transactions); ViewPager pager = (ViewPager) findViewById(R.id.pager); mTitlePageIndicator = (TitlePageIndicator) findViewById(R.id.titles); mSectionHeaderTransactions = (TextView) findViewById(R.id.section_header_transactions); if (sLastTitleColor == -1) // if this is first launch of app. Previous launches would have set the color already sLastTitleColor = getResources().getColor(R.color.title_green); mAccountId = getIntent().getLongExtra(UxArgument.SELECTED_ACCOUNT_ID, -1); mAccountsDbAdapter = new AccountsDbAdapter(this); setupActionBarNavigation(); if (getIntent().getAction().equals(Intent.ACTION_INSERT_OR_EDIT)) { pager.setVisibility(View.GONE); mTitlePageIndicator.setVisibility(View.GONE); initializeCreateOrEditTransaction(); } else { // load the transactions list mSectionHeaderTransactions.setVisibility(View.GONE); PagerAdapter pagerAdapter = new AccountViewPagerAdapter(getSupportFragmentManager()); pager.setAdapter(pagerAdapter); mTitlePageIndicator.setViewPager(pager); pager.setCurrentItem(INDEX_TRANSACTIONS_FRAGMENT); } // done creating, activity now running mActivityRunning = true; }
@Override void showMaster() { master.setVisibility(View.VISIBLE); detail.setVisibility(View.GONE); }
@Override public void handleMessage(Message msg) { System.out.println("---第一次运行,显示引导页"); vp_guide.setAdapter(new MyAdapter()); vp_guide.setVisibility(View.VISIBLE); }
public void showProgress(boolean show) { pb.setVisibility(show ? View.VISIBLE : View.GONE); mViewPager.setVisibility(show ? View.GONE : View.VISIBLE); }
@Override protected void onCreate(Bundle savedInstanceState) { getMyApplication().applyTheme(this); super.onCreate(savedInstanceState); updateDownloads(); setContentView(R.layout.download); singleTab = getIntent() != null && getIntent().getBooleanExtra(SINGLE_TAB, false); int currentTab = 0; String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN); if (tab != null) { if (tab.equals(DOWNLOAD_TAB)) { currentTab = 1; } else if (tab.equals(UPDATES_TAB)) { currentTab = 2; } } if (singleTab) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setVisibility(View.GONE); Fragment f = currentTab == 0 ? new LocalIndexesFragment() : (currentTab == 1 ? new DownloadIndexFragment() : new UpdatesIndexFragment()); String tag = currentTab == 0 ? LOCAL_TAB : (currentTab == 1 ? DOWNLOAD_TAB : UPDATES_TAB); findViewById(R.id.layout).setVisibility(View.VISIBLE); android.support.v4.app.FragmentManager manager = getSupportFragmentManager(); if (manager.findFragmentByTag(tag) == null) { getSupportFragmentManager().beginTransaction().add(R.id.layout, f, tag).commit(); } } else { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); PagerSlidingTabStrip mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tabs); mTabs.add( new TabActivity.TabItem( getString(R.string.download_tab_local), LocalIndexesFragment.class)); mTabs.add( new TabActivity.TabItem( getString(R.string.download_tab_downloads), DownloadIndexFragment.class)); mTabs.add( new TabActivity.TabItem( getString(R.string.download_tab_updates), UpdatesIndexFragment.class)); viewPager.setAdapter( new TabActivity.OsmandFragmentPagerAdapter(getSupportFragmentManager(), mTabs)); mSlidingTabLayout.setViewPager(viewPager); viewPager.setCurrentItem(currentTab); } settings = ((OsmandApplication) getApplication()).getSettings(); indeterminateProgressBar = (ProgressBar) findViewById(R.id.IndeterminateProgressBar); determinateProgressBar = (ProgressBar) findViewById(R.id.memory_progress); progressView = findViewById(R.id.ProgressView); progressMessage = (TextView) findViewById(R.id.ProgressMessage); progressPercent = (TextView) findViewById(R.id.ProgressPercent); cancel = (ImageView) findViewById(R.id.Cancel); cancel.setImageDrawable( getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_remove_dark)); cancel.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { makeSureUserCancelDownload(); } }); findViewById(R.id.DownloadButton) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { downloadFilesCheckFreeVersion(); } }); downloadTypes = createDownloadTypes(); final Intent intent = getIntent(); if (intent != null && intent.getExtras() != null) { final String filter = intent.getExtras().getString(FILTER_KEY); if (filter != null) { initialFilter = filter; } final String filterCat = intent.getExtras().getString(FILTER_CAT); if (filterCat != null) { DownloadActivityType type = DownloadActivityType.getIndexType(filterCat.toLowerCase()); if (type != null) { downloadTypes.remove(type); downloadTypes.add(0, type); } } } changeType(downloadTypes.get(0)); }
@Override void showDetail(int position) { master.setVisibility(View.GONE); detail.setVisibility(View.VISIBLE); detail.setCurrentItem(position, false); }