Example usage for android.content.pm PackageManager GET_ACTIVITIES

List of usage examples for android.content.pm PackageManager GET_ACTIVITIES

Introduction

In this page you can find the example usage for android.content.pm PackageManager GET_ACTIVITIES.

Prototype

int GET_ACTIVITIES

To view the source code for android.content.pm PackageManager GET_ACTIVITIES.

Click Source Link

Document

PackageInfo flag: return information about activities in the package in PackageInfo#activities .

Usage

From source file:com.filemanager.free.activities.MainActivity.java

private void initialiseFab() {
    String folder_skin = PreferenceUtils.getFolderColorString(Sp);
    int fabSkinPressed = PreferenceUtils.getStatusColor(fabskin);
    int folderskin = Color.parseColor(folder_skin);
    int fabskinpressed = (PreferenceUtils.getStatusColor(folder_skin));
    floatingActionButton = (FloatingActionMenu) findViewById(R.id.menu);
    floatingActionButton.setMenuButtonColorNormal(Color.parseColor(fabskin));
    floatingActionButton.setMenuButtonColorPressed(fabSkinPressed);

    //if (theme1 == 1) floatingActionButton.setMen
    floatingActionButton.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
        @Override/*from  w  w w .ja  va 2 s .c  o  m*/
        public void onMenuToggle(boolean b) {
            View v = findViewById(R.id.fab_bg);
            if (b) {
                if (Build.VERSION.SDK_INT >= 21) {
                    assert v != null;
                    v.setVisibility(View.GONE);
                } else {
                    utils.revealShow(v, true);
                }
            } else {
                utils.revealShow(v, false);
            }
        }
    });
    //menu thm th mc
    FloatingActionButton floatingActionButton1 = (FloatingActionButton) findViewById(R.id.menu_item);
    assert floatingActionButton1 != null;
    floatingActionButton1.setColorNormal(folderskin);
    floatingActionButton1.setColorPressed(fabskinpressed);
    floatingActionButton1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setResult(0, true);
        }
    });
    //menu thm file
    FloatingActionButton floatingActionButton2 = (FloatingActionButton) findViewById(R.id.menu_item1);
    floatingActionButton2.setColorNormal(folderskin);
    floatingActionButton2.setColorPressed(fabskinpressed);
    floatingActionButton2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setResult(1, true);
        }
    });
    //add smb
    FloatingActionButton floatingActionButton3 = (FloatingActionButton) findViewById(R.id.menu_item2);
    floatingActionButton3.setColorNormal(folderskin);
    floatingActionButton3.setColorPressed(fabskinpressed);
    floatingActionButton3.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setResult(2, false);
        }
    });
    final FloatingActionButton floatingActionButton4 = (FloatingActionButton) findViewById(R.id.menu_item3);
    floatingActionButton4.setColorNormal(folderskin);
    floatingActionButton4.setColorPressed(fabskinpressed);
    floatingActionButton4.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mainActivityHelper.add(3);
            utils.revealShow(findViewById(R.id.fab_bg), false);
            floatingActionButton.close(true);
        }
    });

    new Thread(new Runnable() {
        @Override
        public void run() {
            PackageManager pm = getPackageManager();
            boolean app_installed;
            try {
                pm.getPackageInfo("com.amaze.filemanager.driveplugin", PackageManager.GET_ACTIVITIES);
                app_installed = true;
            } catch (PackageManager.NameNotFoundException e) {
                app_installed = false;
            }
            if (!app_installed)
                floatingActionButton4.setVisibility(View.GONE);
        }
    }).run();
}

From source file:com.igniva.filemanager.activities.MainActivity.java

void initialiseFab() {
    String folder_skin = PreferenceUtils.getFolderColorString(Sp);
    int fabSkinPressed = PreferenceUtils.getStatusColor(BaseActivity.accentSkin);
    int folderskin = Color.parseColor(folder_skin);
    int fabskinpressed = (PreferenceUtils.getStatusColor(folder_skin));
    floatingActionButton = (FloatingActionMenu) findViewById(R.id.menu);
    floatingActionButton.setMenuButtonColorNormal(Color.parseColor(BaseActivity.accentSkin));
    floatingActionButton.setMenuButtonColorPressed(fabSkinPressed);

    //if (theme1 == 1) floatingActionButton.setMen
    floatingActionButton.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
        @Override/*from  ww  w  .  ja va 2s.co m*/
        public void onMenuToggle(boolean b) {
            View v = findViewById(R.id.fab_bg);
            if (b)
                utils.revealShow(v, true);
            else
                utils.revealShow(v, false);
        }
    });

    FloatingActionButton floatingActionButton1 = (FloatingActionButton) findViewById(R.id.menu_item);
    floatingActionButton1.setColorNormal(folderskin);
    floatingActionButton1.setColorPressed(fabskinpressed);
    floatingActionButton1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mainActivityHelper.add(0);
            utils.revealShow(findViewById(R.id.fab_bg), false);
            floatingActionButton.close(true);
        }
    });
    FloatingActionButton floatingActionButton2 = (FloatingActionButton) findViewById(R.id.menu_item1);
    floatingActionButton2.setColorNormal(folderskin);
    floatingActionButton2.setColorPressed(fabskinpressed);
    floatingActionButton2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mainActivityHelper.add(1);
            utils.revealShow(findViewById(R.id.fab_bg), false);
            floatingActionButton.close(true);
        }
    });
    FloatingActionButton floatingActionButton3 = (FloatingActionButton) findViewById(R.id.menu_item2);
    floatingActionButton3.setColorNormal(folderskin);
    floatingActionButton3.setColorPressed(fabskinpressed);
    floatingActionButton3.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mainActivityHelper.add(2);
            utils.revealShow(findViewById(R.id.fab_bg), false);
            floatingActionButton.close(true);
        }
    });
    final FloatingActionButton floatingActionButton4 = (FloatingActionButton) findViewById(R.id.menu_item3);
    floatingActionButton4.setColorNormal(folderskin);
    floatingActionButton4.setColorPressed(fabskinpressed);
    floatingActionButton4.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mainActivityHelper.add(3);
            utils.revealShow(findViewById(R.id.fab_bg), false);
            floatingActionButton.close(true);
        }
    });

    new Thread(new Runnable() {
        @Override
        public void run() {
            PackageManager pm = getPackageManager();
            boolean app_installed;
            try {
                pm.getPackageInfo("com.igniva.filemanager.driveplugin", PackageManager.GET_ACTIVITIES);
                app_installed = true;
            } catch (PackageManager.NameNotFoundException e) {
                app_installed = false;
            }
            if (!app_installed)
                floatingActionButton4.setVisibility(View.GONE);
        }
    }).run();
}

From source file:cm.aptoide.pt.MainActivity.java

private boolean isAppInstalled(String uri) {
    PackageManager pm = getPackageManager();
    boolean installed = false;
    try {/*from w w  w  . ja  va  2s .c  o  m*/
        pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
        installed = true;
    } catch (PackageManager.NameNotFoundException e) {
        installed = false;
    }
    return installed;
}