Search in sources :

Example 21 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project Shuttle by timusus.

the class SearchActivity method onCreate.

@SuppressLint("InlinedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    ThemeUtils.setTheme(this);
    if (!ShuttleUtils.hasLollipop() && ShuttleUtils.hasKitKat()) {
        getWindow().setFlags(FLAG_TRANSLUCENT_STATUS, FLAG_TRANSLUCENT_STATUS);
        mTintManager = new SystemBarTintManager(this);
    }
    if (!ShuttleUtils.hasKitKat()) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    if (SettingsManager.getInstance().canTintNavBar()) {
        getWindow().setNavigationBarColor(ColorUtils.getPrimaryColorDark(this));
    }
    super.onCreate(savedInstanceState);
    final String query = getIntent().getStringExtra(SearchManager.QUERY);
    filterString = !TextUtils.isEmpty(query) ? query.toLowerCase().trim() : "";
    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    setContentView(R.layout.activity_search);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Get the ActionBar
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(null);
    ThemeUtils.themeActionBar(this);
    ThemeUtils.themeStatusBar(this, mTintManager);
    adapter = new SearchAdapter();
    adapter.setListener(this);
    recyclerView = (FastScrollRecyclerView) findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    ThemeUtils.themeRecyclerView(recyclerView);
    recyclerView.setThumbColor(ColorUtils.getAccentColor());
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            ThemeUtils.themeRecyclerView(recyclerView);
            super.onScrollStateChanged(recyclerView, newState);
        }
    });
    if (requestManager == null) {
        requestManager = Glide.with(this);
    }
    dummySelector = new MultiSelector();
    songsHeader = new SearchHeaderView(new Header(getString(R.string.tracks_title)));
    albumsHeader = new SearchHeaderView(new Header(getString(R.string.albums_title)));
    artistsHeader = new SearchHeaderView(new Header(getString(R.string.artists_title)));
    prefixHighlighter = new PrefixHighlighter(this);
}
Also used : SearchAdapter(com.simplecity.amp_library.ui.adapters.SearchAdapter) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SuppressLint(android.annotation.SuppressLint) SearchHeaderView(com.simplecity.amp_library.ui.modelviews.SearchHeaderView) Header(com.simplecity.amp_library.model.Header) PrefixHighlighter(com.simplecity.amp_library.format.PrefixHighlighter) MultiSelector(com.bignerdranch.android.multiselector.MultiSelector) FastScrollRecyclerView(com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) SuppressLint(android.annotation.SuppressLint)

Example 22 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project Shuttle by timusus.

the class SettingsActivity method onCreate.

@SuppressLint("InlinedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    if (!ShuttleUtils.isUpgraded() && !ShuttleUtils.isAmazonBuild()) {
        IabManager.getInstance();
    }
    ThemeUtils.setTheme(this);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    if (!ShuttleUtils.hasLollipop() && ShuttleUtils.hasKitKat()) {
        getWindow().setFlags(FLAG_TRANSLUCENT_STATUS, FLAG_TRANSLUCENT_STATUS);
        mTintManager = new SystemBarTintManager(this);
    }
    if (!ShuttleUtils.hasKitKat()) {
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    if (SettingsManager.getInstance().canTintNavBar()) {
        getWindow().setNavigationBarColor(ColorUtils.getPrimaryColorDark(this));
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ThemeUtils.themeActionBar(this);
    ThemeUtils.themeStatusBar(this, mTintManager);
    if (savedInstanceState == null) {
        if (!getIntent().getBooleanExtra(EXTRA_SUPPORT, false)) {
            getSupportActionBar().setTitle(getString(R.string.settings));
            getSupportFragmentManager().beginTransaction().replace(R.id.main_container, new SettingsFragment()).commit();
        } else {
            getSupportActionBar().setTitle(getString(R.string.pref_title_support));
            getSupportFragmentManager().beginTransaction().replace(R.id.main_container, SettingsFragment.newInstance(R.xml.settings_support)).commit();
        }
    }
}
Also used : SettingsFragment(com.simplecity.amp_library.ui.fragments.SettingsFragment) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) SuppressLint(android.annotation.SuppressLint)

Example 23 with SystemBarTintManager

use of com.readystatesoftware.systembartint.SystemBarTintManager in project discreet-app-rate by PomepuyN.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window win = getWindow();
        WindowManager.LayoutParams winParams = win.getAttributes();
        int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
        winParams.flags |= bits;
        bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
        winParams.flags |= bits;
        win.setAttributes(winParams);
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        // enable status bar tint
        tintManager.setStatusBarTintEnabled(true);
        // enable navigation bar tint
        tintManager.setNavigationBarTintEnabled(true);
        tintManager.setTintColor(Color.parseColor("#DDDDDD"));
    }
    manageViews();
    settings = getSharedPreferences(PreferencesConstants.PREFS_NAME, 0);
    editor = settings.edit();
    updateValueDisplay();
    okButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            switch(actionSpinner.getSelectedItemPosition()) {
                case 0:
                    getAppRate().checkAndShow();
                    break;
                case 1:
                    getAppRate().reset();
                    break;
                case 2:
                    getAppRate().forceShow();
                    break;
                case 3:
                    getAppRate().neverShowAgain();
                    break;
                case 4:
                    editor.putLong(PreferencesConstants.KEY_LAST_CRASH, System.currentTimeMillis());
                    editor.commit();
                    Toast.makeText(MainActivity.this, "App has crashed just now", Toast.LENGTH_LONG).show();
                    break;
            }
            updateValueDisplay();
        }
    });
}
Also used : Window(android.view.Window) SystemBarTintManager(com.readystatesoftware.systembartint.SystemBarTintManager) View(android.view.View) TextView(android.widget.TextView) WindowManager(android.view.WindowManager)

Aggregations

SystemBarTintManager (com.readystatesoftware.systembartint.SystemBarTintManager)23 TargetApi (android.annotation.TargetApi)5 View (android.view.View)5 SuppressLint (android.annotation.SuppressLint)4 ActionBar (android.support.v7.app.ActionBar)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 RecyclerView (android.support.v7.widget.RecyclerView)2 Toolbar (android.support.v7.widget.Toolbar)2 ViewGroup (android.view.ViewGroup)2 LinearLayout (android.widget.LinearLayout)2 TextView (android.widget.TextView)2 Dialog (android.app.Dialog)1 ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Drawable (android.graphics.drawable.Drawable)1 InsetDrawable (android.graphics.drawable.InsetDrawable)1 AudioEffect (android.media.audiofx.AudioEffect)1 Uri (android.net.Uri)1 AsyncTask (android.os.AsyncTask)1