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();
}
}
Aggregations