Search in sources :

Example 1 with Plugin

use of org.csploit.android.core.Plugin in project android by cSploit.

the class ActionFragment method onViewCreated.

@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
    SharedPreferences themePrefs = getActivity().getSharedPreferences("THEME", 0);
    Boolean isDark = themePrefs.getBoolean("isDark", false);
    if (isDark) {
        getActivity().setTheme(R.style.DarkTheme);
        v.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.background_window_dark));
    } else {
        getActivity().setTheme(R.style.AppTheme);
        v.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.background_window));
    }
    mTarget = org.csploit.android.core.System.getCurrentTarget();
    if (mTarget != null) {
        getActivity().setTitle("cSploit > " + mTarget);
        ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        theList = (ListView) getActivity().findViewById(R.id.android_list);
        mAvailable = System.getPluginsForTarget();
        ActionsAdapter mActionsAdapter = new ActionsAdapter();
        theList.setAdapter(mActionsAdapter);
        theList.setOnItemClickListener(new ListView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (System.checkNetworking(getActivity())) {
                    Plugin plugin = mAvailable.get(position);
                    System.setCurrentPlugin(plugin);
                    if (plugin.hasLayoutToShow()) {
                        Toast.makeText(getActivity(), getString(R.string.selected) + getString(plugin.getName()), Toast.LENGTH_SHORT).show();
                        startActivity(new Intent(getActivity(), plugin.getClass()));
                        getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
                    } else
                        plugin.onActionClick(getActivity().getApplicationContext());
                }
            }
        });
    } else {
        new FinishDialog(getString(R.string.warning), getString(R.string.something_went_wrong), getActivity()).show();
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) Intent(android.content.Intent) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) ListView(android.widget.ListView) FinishDialog(org.csploit.android.gui.dialogs.FinishDialog) Plugin(org.csploit.android.core.Plugin)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 Plugin (org.csploit.android.core.Plugin)1 FinishDialog (org.csploit.android.gui.dialogs.FinishDialog)1