Java Code Examples for android.support.v7.app.ActionBar

The following are top voted examples for showing how to use android.support.v7.app.ActionBar. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Bigbang   File: CopyActivity.java   View source code 7 votes vote down vote up
private void fullScreenMode(boolean fullScreen) {
    ActionBar actionBar = getSupportActionBar();
    isFullScreen = fullScreen;
    if(fullScreen) {
        if(actionBar != null) {
            actionBar.hide();
        }

        adjustActionBarWrap();
    } else {
        if(actionBar != null) {
            actionBar.show();
        }

        copyFab.hide();
        exitFab.hide();
        exitFullScreenFab.hide();
    }
    SPHelper.save(IS_FULL_SCREEN_COPY,fullScreen);
}
 
Example 2
Project: QueryHighlighter   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAdapter = new CheesesAdapter();

    final ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(mAdapter);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setCustomView(R.layout.search_view);
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);

    final EditText editText = (EditText) actionBar.getCustomView();
    editText.addTextChangedListener(mTextWatcher);
    editText.requestFocus();
}
 
Example 3
Project: Phoenix-for-VK   File: LikesFragment.java   View source code 6 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
    if(actionBar != null){
        actionBar.setTitle("likes".equals(getArguments().getString(Extra.FILTER)) ? R.string.like : R.string.shared);
        actionBar.setSubtitle(null);
    }

    new ActivityFeatures.Builder()
            .begin()
            .setBlockNavigationDrawer(false)
            .setStatusBarColored(true)
            .build()
            .apply(getActivity());
}
 
Example 4
Project: changApp   File: PostulacionesActivasActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_postulaciones_activas);
    // Setting ViewPager for each Tabs
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager_pa);
    setupViewPager(viewPager);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerpa);
    // Adding menu icon to Toolbar
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        VectorDrawableCompat indicator
                = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu, getTheme());
        indicator.setTint(ResourcesCompat.getColor(getResources(),R.color.white,getTheme()));
        supportActionBar.setHomeAsUpIndicator(indicator);
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }

}
 
Example 5
Project: simple-stack   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public void handleStateChange(@NonNull StateChange traversal, @NonNull final StateChanger.Callback callback) {
    Path path = traversal.topNewState();
    setTitle(path.getTitle());
    ActionBar actionBar = getSupportActionBar();
    boolean canGoBack = traversal.getNewState().size() > 1;
    actionBar.setDisplayHomeAsUpEnabled(canGoBack);
    actionBar.setHomeButtonEnabled(canGoBack);
    containerAsStateChanger.handleStateChange(traversal, new StateChanger.Callback() {
        @Override
        public void stateChangeComplete() {
            invalidateOptionsMenu();
            callback.stateChangeComplete();
        }
    });
}
 
Example 6
Project: chuck   File: TransactionActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chuck_activity_transaction);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    title = (TextView) findViewById(R.id.toolbar_title);

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
    }

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);

    transactionId = getIntent().getLongExtra(ARG_TRANSACTION_ID, 0);
    getSupportLoaderManager().initLoader(0, null, this);
}
 
Example 7
Project: OneWeather   File: SettingActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);


    ActionBar actionBar = getSupportActionBar();
    if(actionBar != null){
        actionBar.setTitle("    设置");
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_back);
    }


    if (Build.VERSION.SDK_INT >= 21 && Build.VERSION.SDK_INT <23) {
        getWindow().setStatusBarColor(0x22000000);//浅黑
    } else if (Build.VERSION.SDK_INT >= 23) {
        View decorView = getWindow().getDecorView();
        decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    }


}
 
Example 8
Project: Pigeon   File: BaseActivity.java   View source code 6 votes vote down vote up
/**
 * 初始化ToolBar
 *
 * @param toolbar ToolBar的实例
 * @param title 标题
 * @param isBack 是否出现返回按钮
 */
public void initToolBar(Toolbar toolbar, String title, boolean isBack) {
    toolbar.setTitle(title);
    setSupportActionBar(toolbar);
    if (isBack) {
        try {
            ActionBar actionBar = getSupportActionBar();
            if (null != actionBar)
                actionBar.setDisplayHomeAsUpEnabled(true);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }

}
 
Example 9
Project: Phoenix-for-VK   File: DialogsFragment.java   View source code 6 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    Settings.get().ui().notifyPlaceResumed(Place.DIALOGS);

    ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
    if (actionBar != null) {
        actionBar.setTitle(R.string.dialogs);
        actionBar.setSubtitle(getArguments().getString(Extra.SUBTITLE));
    }

    if (getActivity() instanceof OnSectionResumeCallback) {
        ((OnSectionResumeCallback) getActivity()).onSectionResume(NavigationFragment.SECTION_ITEM_DIALOGS);
    }

    new ActivityFeatures.Builder()
            .begin()
            .setBlockNavigationDrawer(false)
            .setStatusBarColored(true)
            .build()
            .apply(getActivity());
}
 
Example 10
Project: android_firebase_green_thumb   File: PlantDetailActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitle("");
    mItemDescription = (TextView) findViewById(R.id.text_view_item_description);
    mItemPrice = (TextView) findViewById(R.id.text_view_item_price);
    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

    setSupportActionBar(mToolbar);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }
    fab.setOnClickListener(this);

    mItemId = getIntent().getIntExtra(INTENT_EXTRA_ITEM, 0);

    getSupportLoaderManager().initLoader(PLANT_DETAIL_LOADER, null, this);
}
 
Example 11
Project: Phoenix-for-VK   File: FwdsFragment.java   View source code 6 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    if(getActivity() instanceof OnSectionResumeCallback){
        ((OnSectionResumeCallback)getActivity()).onClearSelection();
    }

    ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
    if(actionBar != null){
        actionBar.setSubtitle(null);
        actionBar.setTitle(R.string.title_mssages);
    }

    new ActivityFeatures.Builder()
            .begin()
            .setBlockNavigationDrawer(false)
            .setStatusBarColored(true)
            .build()
            .apply(getActivity());
}
 
Example 12
Project: Hello-Music-droid   File: FoldersFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(
            R.layout.fragment_folders, container, false);

    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);

    ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setTitle(R.string.folders);

    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroller);
    mProgressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);

    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

    if (getActivity() != null)
        new loadFolders().execute("");
    return rootView;
}
 
Example 13
Project: IdeaTrackerPlus   File: MainActivity.java   View source code 6 votes vote down vote up
private void selectFavoriteProject() {

        if (!mNoProject) {
            mSelectedProfileIndex = getIndexOfFavorite();
            IProfile activeProfile = mProfiles.get(mSelectedProfileIndex);
            String activeProfileName = activeProfile.getName().getText();

            ActionBar bar;
            if ((bar = getSupportActionBar()) != null) {
                bar.setTitle(activeProfileName);
            }

            DataEntry.setTableName(activeProfileName);

            switchToProjectColors();
        }
    }
 
Example 14
Project: GitHub   File: ThreadExampleActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar.
    final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(android.support.v7.app.ActionBar.NAVIGATION_MODE_TABS);

    SectionsPagerAdapter pageAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(pageAdapter);

    viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    for (int i = 0; i < pageAdapter.getCount(); i++) {
        getSupportActionBar().addTab(getSupportActionBar().newTab()
                .setText(pageAdapter.getPageTitle(i))
                .setTabListener(this));
    }
}
 
Example 15
Project: MovieApp   File: GenreFragment.java   View source code 6 votes vote down vote up
private void init(View view) {
    unbinder = ButterKnife.bind(this, view);

    activity = (AppCompatActivity) getActivity();

    activity.setSupportActionBar(toolbar);
    ActionBar actionBar = activity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(title);
    }

    LinearLayoutManager layoutManager
            = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(activity, layoutManager.getOrientation()));
    recyclerView.setHasFixedSize(true);
    recyclerView.setMotionEventSplittingEnabled(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(genreAdapter);
}
 
Example 16
Project: Nird2   File: IntroductionMessageFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {

	// change toolbar text
	ActionBar actionBar = introductionActivity.getSupportActionBar();
	if (actionBar != null) {
		actionBar.setTitle(R.string.introduction_message_title);
	}

	// inflate view
	View v = inflater.inflate(R.layout.introduction_message, container,
			false);
	ui = new ViewHolder(v);
	ui.text.setVisibility(GONE);
	ui.message.setSendButtonEnabled(false);

	return v;
}
 
Example 17
Project: Companion-For-PUBG-Android   File: ItemDetailActivity.java   View source code 6 votes vote down vote up
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setSupportActionBar(toolbar);

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }

    final Intent intent = getIntent();
    if (intent == null) {
        throw new IllegalStateException("Missing intent");
    }
    final Item item = (Item) intent.getSerializableExtra(EXTRA_ITEM);
    if (item instanceof Weapon) {
        showFragment(WeaponDetailFragment.newInstance((Weapon) item), WeaponDetailFragment.TAG);
    } else if (item instanceof Ammo) {
        showFragment(AmmoDetailFragment.newInstance((Ammo) item), WeaponDetailFragment.TAG);
    } else {
        Toast.makeText(this, "We're still working on this feature!", Toast.LENGTH_SHORT).show();
        finish();
    }
}
 
Example 18
Project: ArcLayout-master   File: DemoLikeTumblrActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.like_a_tumblr);

  Demo demo = getDemo(getIntent());

  ActionBar bar = getSupportActionBar();
  bar.setTitle(demo.titleResId);
  bar.setDisplayHomeAsUpEnabled(true);

  rootLayout = findViewById(R.id.root_layout);
  menuLayout = (ClipRevealFrame) findViewById(R.id.menu_layout);
  arcLayout = (ArcLayout) findViewById(R.id.arc_layout);
  centerItem = findViewById(R.id.center_item);

  centerItem.setOnClickListener(this);
  for (int i = 0, size = arcLayout.getChildCount(); i < size; i++) {
    arcLayout.getChildAt(i).setOnClickListener(this);
  }

  findViewById(R.id.fab).setOnClickListener(this);

}
 
Example 19
Project: social-journal   File: AddNote.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_note);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Get a support ActionBar corresponding to this toolbar
    ActionBar ab = getSupportActionBar();

    // Enable the Up button
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
    }


    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });
}
 
Example 20
Project: thermalprinterhelper   File: PrinterListActivity.java   View source code 6 votes vote down vote up
private void initUi() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.hide();

    printerlist_list = (ListView) findViewById(R.id.printerlist_list);
    toolbar_refresh = (Button) findViewById(R.id.toolbar_refresh);
    toolbar_left_button = (ImageButton) findViewById(R.id.toolbar_left_button);

    printerlist_active = (TextView) findViewById(R.id.printerlist_active);
    printerlist_progress = (ProgressBar) findViewById(R.id.printerlist_progress);
    printerlist_content = (LinearLayout) findViewById(R.id.printerlist_content);

    printerlist_progress.setVisibility(View.GONE);

    toolbar_left_button.setOnClickListener(this);
    toolbar_refresh.setOnClickListener(this);
    printerlist_list.setOnItemClickListener(this);
}
 
Example 21
Project: TurboChat   File: ProfileActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_root);
    ButterKnife.bind(this);

    String userNick = getIntent().getExtras().getString(ARG_USER);
    inflateFragment(userNick);
    setSupportActionBar(toolbar);
    final ActionBar supportActionBar = getSupportActionBar();
    supportActionBar.setTitle(userNick);
    supportActionBar.setDisplayHomeAsUpEnabled(true);
}
 
Example 22
Project: dkplayer   File: ListFragmentViewPagerActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_fragment_view_pager);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle("LIST FRAGMENT VIEWPAGER");
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    initView();
}
 
Example 23
Project: Customerly-Android-SDK   File: IAct_FullScreenImage.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if(this.getIntent() != null) {
        this._SourceUrl = this.getIntent().getStringExtra(EXTRA_IMAGE_SOURCE);
        if(this._SourceUrl != null) {
            ImageView _ImageView = new TouchImageView(this);
            _ImageView.setBackgroundColor(Color.WHITE);
            _ImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            _ImageView.setAdjustViewBounds(true);
            try {
                Customerly.get()._RemoteImageHandler.request(new IU_RemoteImageHandler.Request()
                        .fitCenter()
                        .load(this._SourceUrl)
                        .into(this, _ImageView)
                        .placeholder(R.drawable.io_customerly__pic_placeholder_fullscreen));
                super.setContentView(_ImageView);

                final ActionBar actionBar = this.getSupportActionBar();
                if (actionBar != null) {
                    String title;
                    if(Customerly.get().__PING__LAST_widget_color != 0) {
                        actionBar.setBackgroundDrawable(new ColorDrawable(Customerly.get().__PING__LAST_widget_color));
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                            this.getWindow().setStatusBarColor(IU_Utils.alterColor(Customerly.get().__PING__LAST_widget_color, 0.8f));
                        }

                        if (IU_Utils.getContrastColor(Customerly.get().__PING__LAST_widget_color) == Color.BLACK) {
                            actionBar.setHomeAsUpIndicator(R.drawable.io_customerly__ic_arrow_back_black_24dp);
                            title = String.format("<font color='#000000'>%1$s</font>", actionBar.getTitle());

                        } else {
                            actionBar.setHomeAsUpIndicator(R.drawable.io_customerly__ic_arrow_back_white_24dp);
                            title = String.format("<font color='#ffffff'>%1$s</font>", actionBar.getTitle());
                        }
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                            actionBar.setTitle(Html.fromHtml(title, 0));
                        } else {
                            //noinspection deprecation
                            actionBar.setTitle(Html.fromHtml(title));
                        }
                    }
                    actionBar.setDisplayHomeAsUpEnabled(true);
                }
                return;
            } catch (Exception glideException) {
                IEr_CustomerlyErrorHandler.sendError(IEr_CustomerlyErrorHandler.ERROR_CODE__GLIDE_ERROR, "Error during Glide loading in FullScreenImage_Activity", glideException);
            }
        }
    }
    this.finish();
}
 
Example 24
Project: MyMap   File: NavigationActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_navigation);
    ActionBar actionBar = getSupportActionBar();
    if(actionBar!=null)actionBar.hide();
    EventBus.getDefault().register(this);
    initView();
    mapview.onCreate(savedInstanceState);// 此方法必须重写
    initMap();
    int screenWidth = getWindowManager().getDefaultDisplay().getWidth(); // 屏幕宽(像素,如:480px)
    int screenHeight = getWindowManager().getDefaultDisplay().getHeight(); // 屏幕高(像素,如:800p)
    Log.d(TAG, "onCreate: "+screenWidth+"  "+screenHeight);
}
 
Example 25
Project: dhbw-timetable-android   File: DayDetailsActivity.java   View source code 5 votes vote down vote up
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 26
Project: dhbw-timetable-android   File: CourseDetailsActivity.java   View source code 5 votes vote down vote up
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 27
Project: aos-Video   File: BrowserCategoryVideo.java   View source code 5 votes vote down vote up
@Override
public void onActivityCreated(Bundle bundle) {
    super.onActivityCreated(bundle);
    if (bundle!=null) {
        int navigationMode = bundle.getInt(KEY_ACTIONBAR_NAVIGATION_MODE, ActionBar.NAVIGATION_MODE_STANDARD);
        if (navigationMode==ActionBar.NAVIGATION_MODE_LIST) {
            setupMovieActionBarNavigation(false); // false because the corresponding fragment is already re-created by the framework after rotation
        } else {
            setNavigationMode(navigationMode);
        }
    }
}
 
Example 28
Project: wzyx-android-user   File: SplashActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    //隐藏actionBar
    ActionBar actionBar = getSupportActionBar();
    if(actionBar != null){
        actionBar.hide();
    }
    //检查定位权限
    startLocateWithCheck();
    //2秒后跳转到登陆界面
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {

            //检查用户是否已登录
            AccountManager.checkAccount(new IUserChecker() {
                @Override
                public void onSignIn() {
                    //已经登录过
                    ActivityUtils.startActivity(SplashActivity.this, MainActivity.class);
                    SplashActivity.this.finish();
                }
                @Override
                public void onNotSignIn() {
                    //还未登录过
                    ActivityUtils.startActivity(SplashActivity.this,LoginActivity.class);
                    SplashActivity.this.finish();
                }
            });
        }
    },2000);
}
 
Example 29
Project: ZeroKit-Android-SDK   File: MainActivity.java   View source code 5 votes vote down vote up
private void whoAmI() {
    zerokit.whoAmI().enqueue(new Action<String>() {
        @Override
        public void call(String userId) {
            MainActivity.this.userId = userId;
            ActionBar supportActionBar = MainActivity.this.getSupportActionBar();
            if (supportActionBar != null) supportActionBar.setSubtitle("User Id: " + userId);
        }
    });
}
 
Example 30
Project: rx-twitter-stream-android   File: StreamActivity.java   View source code 5 votes vote down vote up
private void handleMenuSearch() {
    ActionBar supportActionBar = getSupportActionBar();

    if (isSearchOpened) {
        disableSearch(supportActionBar);
    } else {

        supportActionBar.setDisplayShowCustomEnabled(true);
        supportActionBar.setCustomView(R.layout.search_bar);
        supportActionBar.setDisplayShowTitleEnabled(false);

        termsSearch = (EditText) supportActionBar.getCustomView().findViewById(R.id.terms_search);

        termsSearch.setOnEditorActionListener((view, id, event) -> {
            if (id == EditorInfo.IME_ACTION_SEARCH) {
                doSearch(termsSearch.getText().toString());
                disableSearch(supportActionBar);
                return true;
            }
            return false;
        });

        termsSearch.requestFocus();

        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

        mSearchAction.setIcon(getResources().getDrawable(R.mipmap.ic_clear_white_24dp, null));

        isSearchOpened = true;
    }
}
 
Example 31
Project: OSchina_resources_android   File: BackActivity.java   View source code 5 votes vote down vote up
@Override
protected void initWindow() {
    super.initWindow();
    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    if (mToolBar != null) {
        setSupportActionBar(mToolBar);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeButtonEnabled(false);
        }
    }
}
 
Example 32
Project: Khonsu   File: LaunchingFragment.java   View source code 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }

    CraftARSDK.Instance().init(getActivity().getApplicationContext());
    //Initialize the Collection Manager
    mCollectionManager = CraftAROnDeviceCollectionManager.Instance();

    //Initialize the Offline IR Module
    mCraftAROnDeviceIR = CraftAROnDeviceIR.Instance();

    //Obtain the collection with token.
    //This will lookup for the collection in the internal storage, and return the collection if it's available.
    CraftAROnDeviceCollection col =  mCollectionManager.get(COLLECTION_TOKEN);

    if(col == null){
        //Collection is not available. Add it from the CraftAR using collection bundle.
        mCollectionManager.addCollection("stickers.zip", this);
    }else{
        //Collection is already available in the device.
        col.sync(this);
    }
}
 
Example 33
Project: tumbviewer   File: LikesActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_likes);
    Toolbar toolbar = findViewById(R.id.toolBar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();

    Bundle bundle = getIntent().getBundleExtra("bundle");
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        if (bundle == null) {
            actionBar.setTitle(getString(R.string.page_user_like));
        } else {
            actionBar.setTitle(getString(R.string.likes_title, bundle.getString("blog_name")));
        }
    }
    CollapsingToolbarLayout collapsingToolbarLayout = findViewById(R.id.collapsingToolbar);
    collapsingToolbarLayout.setTitleEnabled(false);

    LikesFragment likesFragment = new LikesFragment();
    likesFragment.setArguments(bundle);

    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.add(R.id.fragment_container, likesFragment);
    ft.commit();

    setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
 
Example 34
Project: CoolCloud-Weather   File: AboutApplicationActivity.java   View source code 5 votes vote down vote up
@Override
public void initView() {

    setContentView(R.layout.activity_about_application);

    Toolbar toolbar = (Toolbar)findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null){
        actionBar.setTitle("关于酷云");
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    github = (Button)findViewById(R.id.github);
    blog = (Button)findViewById(R.id.blog);
}
 
Example 35
Project: crates-io-android   File: LoginActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);

    apiToken = findViewById(R.id.api_token);
    confirmButton = findViewById(R.id.confirm_button);

    confirmButton.setOnClickListener(view -> {
        Thread thread = new Thread() {
            @Override
            public void run() {
                try {
                    Utility.saveData("token", apiToken.getText().toString().trim());
                    User user = Networking.getMe(apiToken.getText().toString().trim());
                    if (user != null) {
                       apiToken.post(() -> finish());
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        };
        thread.start();
    });
}
 
Example 36
Project: android_ui   File: PagerActivity.java   View source code 5 votes vote down vote up
@Override
@SuppressWarnings("ConstantConditions")
protected void onCreate(@Nullable Bundle savedInstanceState) {
	requestFeature(FEATURE_TOOLBAR);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_view_pager);
	this.mViewPager = findViewById(R.id.pager);
	mViewPager.setAdapter(new PagesAdapter(getSupportFragmentManager()));
	final ActionBar actionBar = getSupportActionBar();
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setHomeAsUpIndicator(ResourceUtils.getVectorDrawable(getResources(), R.drawable.samples_vc_arrow_back_24dp, getTheme()));
}
 
Example 37
Project: ChatExchange-old   File: ActionBarHue.java   View source code 5 votes vote down vote up
public static void setActionBarColor(AppCompatActivity activity, int mAppBarColor)
{
    if (mSharedPreferences == null)
    {
        mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    }

    if (activity != null)
    {
        ActionBar actionBar = activity.getSupportActionBar();

        if (actionBar != null)
        {
            actionBar.setBackgroundDrawable(new ColorDrawable(mAppBarColor));

            //Change status bar color too
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            {
                Window window = activity.getWindow();

                // clear FLAG_TRANSLUCENT_STATUS flag:
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

                // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.setStatusBarColor(HueUtils.darkenColor(mAppBarColor, 0.7f));
            }
        }
    }
}
 
Example 38
Project: android-geohash   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.main_container, new ConverterFragment())
            .commit();

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setCheckedItem(R.id.converter);
    navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            if(item.getItemId() == R.id.converter) {
                if (!item.isChecked()) {
                    getSupportFragmentManager().beginTransaction()
                            .replace(R.id.main_container, new ConverterFragment())
                            .commit();
                }
            } else {
                if(!item.isChecked()) {
                    getSupportFragmentManager().beginTransaction()
                            .replace(R.id.main_container, new MapFragment())
                            .commit();
                }
            }
            item.setChecked(true);
            drawerLayout.closeDrawers();
            return false;
        }
    });
}
 
Example 39
Project: OzComicReader   File: SettingsActivity.java   View source code 5 votes vote down vote up
/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 */
private void setupActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        // Show the Up button in the action bar.
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
Example 40
Project: SampleAppArch   File: SettingsActivity.java   View source code 5 votes vote down vote up
/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 */
private void setupActionBar() {
  ActionBar actionBar = getSupportActionBar();
  if (actionBar != null) {
    // Show the Up button in the action bar.
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
}