Example usage for android.service.quicksettings TileService ACTION_QS_TILE_PREFERENCES

List of usage examples for android.service.quicksettings TileService ACTION_QS_TILE_PREFERENCES

Introduction

In this page you can find the example usage for android.service.quicksettings TileService ACTION_QS_TILE_PREFERENCES.

Prototype

String ACTION_QS_TILE_PREFERENCES

To view the source code for android.service.quicksettings TileService ACTION_QS_TILE_PREFERENCES.

Click Source Link

Document

An activity that provides a user interface for adjusting TileService preferences.

Usage

From source file:com.amaze.carbonfilemanager.activities.MainActivity.java

/**
 * Called when the activity is first created.
 *///from   ww  w. j  a va 2s  .  c  o m
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initialisePreferences();
    initializeInteractiveShell();

    dataUtils = new DataUtils();
    dataUtils.registerOnDataChangedListener(this);

    setContentView(R.layout.main_toolbar);
    initialiseViews();
    tabHandler = new TabHandler(this);
    mImageLoader = AppConfig.getInstance().getImageLoader();
    utils = getFutils();
    mainActivityHelper = new MainActivityHelper(this);
    initialiseFab();

    // TODO: Create proper SQLite database handler class with calls to database from background thread
    history = new HistoryManager(this, "Table2");
    history.initializeTable(DataUtils.HISTORY, 0);
    history.initializeTable(DataUtils.HIDDEN, 0);

    grid = new HistoryManager(this, "listgridmodes");
    grid.initializeTable(DataUtils.LIST, 0);
    grid.initializeTable(DataUtils.GRID, 0);
    grid.initializeTable(DataUtils.BOOKS, 1);
    grid.initializeTable(DataUtils.SMB, 1);

    if (!sharedPref.getBoolean("booksadded", false)) {
        grid.make(DataUtils.BOOKS);
        sharedPref.edit().putBoolean("booksadded", true).commit();
    }
    dataUtils.setHiddenfiles(history.readTable(DataUtils.HIDDEN));
    dataUtils.setGridfiles(grid.readTable(DataUtils.GRID));
    dataUtils.setListfiles(grid.readTable(DataUtils.LIST));

    // initialize g+ api client as per preferences
    if (sharedPref.getBoolean("plus_pic", false)) {
        mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build();
    }

    if (CloudSheetFragment.isCloudProviderAvailable(this)) {

        getSupportLoaderManager().initLoader(REQUEST_CODE_CLOUD_LIST_KEY_CLOUD, null, this);
    }

    util = new IconUtils(sharedPref, this);
    icons = new IconUtils(sharedPref, this);

    timer = new CountDownTimer(5000, 1000) {
        @Override
        public void onTick(long l) {
        }

        @Override
        public void onFinish() {
            utils.crossfadeInverse(buttons, pathbar);
        }
    };
    path = getIntent().getStringExtra("path");
    openProcesses = getIntent().getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false);
    try {
        intent = getIntent();
        if (intent.getStringArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS) != null) {
            ArrayList<BaseFile> failedOps = intent.getParcelableArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS);
            if (failedOps != null) {
                mainActivityHelper.showFailedOperationDialog(failedOps, intent.getBooleanExtra("move", false),
                        this);
            }
        }
        if (intent.getAction() != null) {
            if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) {

                // file picker intent
                mReturnIntent = true;
                Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show();
            } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) {
                // ringtone picker intent
                mReturnIntent = true;
                mRingtonePickerIntent = true;
                Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show();
            } else if (intent.getAction().equals(Intent.ACTION_VIEW)) {

                // zip viewer intent
                Uri uri = intent.getData();
                openzip = true;
                zippath = uri.toString();
            }
        }
    } catch (Exception e) {

        e.printStackTrace();
    }

    if (savedInstanceState != null) {

        selectedStorage = savedInstanceState.getInt("selectitem", SELECT_0);
    }

    refreshDrawer();

    // setting window background color instead of each item, in order to reduce pixel overdraw
    if (getAppTheme().equals(AppTheme.LIGHT)) {
        /*if(Main.IS_LIST)
        getWindow().setBackgroundDrawableResource(android.R.color.white);
        else
        getWindow().setBackgroundDrawableResource(R.color.grid_background_light);
        */
        getWindow().setBackgroundDrawableResource(android.R.color.white);
    } else {
        getWindow().setBackgroundDrawableResource(R.color.holo_dark_background);
    }

    if (savedInstanceState == null) {
        if (openProcesses) {
            android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager()
                    .beginTransaction();
            transaction.replace(R.id.content_frame, new ProcessViewer(), KEY_INTENT_PROCESS_VIEWER);
            //transaction.addToBackStack(null);
            selectedStorage = SELECT_102;
            openProcesses = false;
            //title.setText(utils.getString(con, R.string.process_viewer));
            //Commit the transaction
            transaction.commit();
            supportInvalidateOptionsMenu();
        } else if (intent.getAction() != null
                && intent.getAction().equals(TileService.ACTION_QS_TILE_PREFERENCES)) {
            // tile preferences, open ftp fragment

            android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager()
                    .beginTransaction();
            transaction2.replace(R.id.content_frame, new FTPServerFragment());
            findViewById(R.id.lin).animate().translationY(0).setInterpolator(new DecelerateInterpolator(2))
                    .start();

            selectedStorage = SELECT_MINUS_2;
            adapter.toggleChecked(false);
            transaction2.commit();
        } else {
            if (path != null && path.length() > 0) {
                HFile file = new HFile(OpenMode.UNKNOWN, path);
                file.generateMode(this);
                if (file.isDirectory())
                    goToMain(path);
                else {
                    goToMain("");
                    utils.openFile(new File(path), this);
                }
            } else {
                goToMain("");

            }
        }
    } else {
        COPY_PATH = savedInstanceState.getParcelableArrayList("COPY_PATH");
        MOVE_PATH = savedInstanceState.getParcelableArrayList("MOVE_PATH");
        oppathe = savedInstanceState.getString("oppathe");
        oppathe1 = savedInstanceState.getString("oppathe1");
        oparrayList = savedInstanceState.getParcelableArrayList("oparrayList");
        operation = savedInstanceState.getInt("operation");
        selectedStorage = savedInstanceState.getInt("selectitem", SELECT_0);
        //mainFragment = (Main) savedInstanceState.getParcelable("main_fragment");
        adapter.toggleChecked(selectedStorage);
    }

    if (getAppTheme().equals(AppTheme.DARK)) {
        mDrawerList.setBackgroundColor(ContextCompat.getColor(this, R.color.holo_dark_background));
    }
    mDrawerList.setDivider(null);
    if (!isDrawerLocked) {
        mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
                mDrawerLayout, /* DrawerLayout object */
                R.drawable.ic_drawer_l, /* nav drawer image to replace 'Up' caret */
                R.string.drawer_open, /* "open drawer" description for accessibility */
                R.string.drawer_close /* "close drawer" description for accessibility */
        ) {
            public void onDrawerClosed(View view) {
                mainActivity.onDrawerClosed();
            }

            public void onDrawerOpened(View drawerView) {
                //title.setText("Amaze File Manager");
                // creates call to onPrepareOptionsMenu()
            }
        };
        mDrawerLayout.setDrawerListener(mDrawerToggle);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_drawer_l);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeButtonEnabled(true);
        mDrawerToggle.syncState();
    }
    /*((ImageButton) findViewById(R.id.drawer_buttton)).setOnClickListener(new ImageView.OnClickListener() {
    @Override
    public void onClick(View view) {
        if (mDrawerLayout.isDrawerOpen(mDrawerLinear)) {
            mDrawerLayout.closeDrawer(mDrawerLinear);
        } else mDrawerLayout.openDrawer(mDrawerLinear);
    }
    });*/
    if (mDrawerToggle != null) {
        mDrawerToggle.setDrawerIndicatorEnabled(true);
        mDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_drawer_l);
    }
    //recents header color implementation
    if (SDK_INT >= 21) {
        ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze",
                ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(),
                getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab)));
        setTaskDescription(taskDescription);
    }
}