use of android.widget.ListView in project android by cSploit.
the class PortScanner method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
Boolean isDark = themePrefs.getBoolean("isDark", false);
if (isDark)
setTheme(R.style.DarkTheme);
else
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
mPreferences = System.getSettings();
mTextDoc = (TextView) findViewById(R.id.scanDoc);
mTextParameters = (EditText) findViewById(R.id.scanParameters);
mScanFloatingActionButton = (FloatingActionButton) findViewById(R.id.scanToggleButton);
mScanProgress = (ProgressBar) findViewById(R.id.scanActivity);
mShowCustomParameters = mPreferences.getBoolean(CUSTOM_PARAMETERS, false);
if (mShowCustomParameters)
displayParametersField();
else
hideParametersField();
mScanFloatingActionButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mRunning) {
setStoppedState();
} else {
setStartedState();
}
}
});
ListView mScanList = (ListView) findViewById(R.id.scanListView);
createPortList();
final Target target = System.getCurrentTarget();
final String cmdlineRep = target.getCommandLineRepresentation();
mScanReceiver = new Receiver(target);
mListAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mPortList);
mScanList.setAdapter(mListAdapter);
mScanList.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
int portNumber = target.getOpenPorts().get(position).getNumber();
if (!urlFormats.containsKey(portNumber)) {
portNumber = 0;
}
final String url = String.format(urlFormats.get(portNumber), cmdlineRep, portNumber);
new ConfirmDialog("Open", "Open " + url + " ?", PortScanner.this, new ConfirmDialogListener() {
@Override
public void onConfirm() {
try {
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
PortScanner.this.startActivity(browser);
} catch (ActivityNotFoundException e) {
System.errorLogging(e);
new ErrorDialog(getString(R.string.error), getString(R.string.no_activities_for_url), PortScanner.this).show();
}
}
@Override
public void onCancel() {
}
}).show();
return false;
}
});
}
use of android.widget.ListView in project philm by chrisbanes.
the class SideMenuFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
View view = inflater.inflate(R.layout.fragment_drawer, container, false);
mListView = (ListView) view.findViewById(android.R.id.list);
mListView.setOnItemClickListener(this);
mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
mAdapter = new SideMenuItemAdapter();
mListView.setAdapter(mAdapter);
mAddAccountLayout = view.findViewById(R.id.layout_add_account);
mAddAccountLayout.setOnClickListener(this);
mProfileLayout = view.findViewById(R.id.layout_profile);
mUsernameTextView = (TextView) view.findViewById(R.id.textview_username);
mFullnameTextView = (TextView) view.findViewById(R.id.textview_fullname);
mAvatarImageView = (ImageView) view.findViewById(R.id.imageview_account_avatar);
mCheckinLayout = view.findViewById(R.id.layout_checkin);
mCheckinLayout.setOnClickListener(this);
mCheckinImageView = (PhilmImageView) view.findViewById(R.id.imageview_checkin_movie);
mCheckinImageView.setAutoFade(false);
mCheckinTitleTextView = (TextView) mCheckinLayout.findViewById(R.id.textview_title);
final int darkenByte = Math.round(255 * CHECKIN_BACKDROP_DARKEN);
mColorFilter = new LightingColorFilter(Color.rgb(darkenByte, darkenByte, darkenByte), 0);
return view;
}
use of android.widget.ListView in project android by cSploit.
the class Hijacker method onCreate.
public void onCreate(Bundle savedInstanceState) {
SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
Boolean isDark = themePrefs.getBoolean("isDark", false);
if (isDark)
setTheme(R.style.DarkTheme);
else
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
setTitle(System.getCurrentTarget() + " > MITM > " + getString(R.string.session_sniffer));
setContentView(R.layout.plugin_mitm_hijacker);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mHijackToggleButton = (ToggleButton) findViewById(R.id.hijackToggleButton);
mHijackProgress = (ProgressBar) findViewById(R.id.hijackActivity);
ListView mListView = (ListView) findViewById(R.id.listView);
mAdapter = new SessionListAdapter(R.layout.plugin_mitm_hijacker_list_item);
mSpoof = new SpoofSession();
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final Session session = mAdapter.getByPosition(position);
if (session != null) {
new ConfirmDialog(getString(R.string.hijack_session), mRunning ? getString(R.string.start_hijacking) : getString(R.string.start_hijacking2), Hijacker.this, new ConfirmDialogListener() {
@Override
public void onConfirm() {
if (mRunning)
setStoppedState();
System.setCustomData(session);
startActivity(new Intent(Hijacker.this, HijackerWebView.class));
}
@Override
public void onCancel() {
}
}).show();
}
}
});
mListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
final Session session = mAdapter.getByPosition(position);
if (session != null) {
new InputDialog(getString(R.string.save_session), getString(R.string.set_session_filename), session.getFileName(), true, false, Hijacker.this, new InputDialogListener() {
@Override
public void onInputEntered(String name) {
if (!name.isEmpty()) {
try {
String filename = session.save(name);
Toast.makeText(Hijacker.this, getString(R.string.session_saved_to) + filename + " .", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
new ErrorDialog(getString(R.string.error), e.toString(), Hijacker.this).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.invalid_session), Hijacker.this).show();
}
}).show();
}
return true;
}
});
mHijackToggleButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mRunning) {
setStoppedState();
} else {
setStartedState();
}
}
});
mRequestListener = new RequestListener();
}
use of android.widget.ListView in project cw-omnibus by commonsguy.
the class ActionBarDemoActivity method setListAdapter.
private void setListAdapter(ListAdapter adapter) {
ListView lv = (ListView) findViewById(android.R.id.list);
lv.setAdapter(adapter);
}
use of android.widget.ListView in project AnimeTaste by daimajia.
the class StartActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mContext = this;
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
mVideoList = (ListView) findViewById(R.id.videoList);
mDrawerList = (ListView) findViewById(R.id.function_list);
mDrawer = (LinearLayout) findViewById(R.id.drawer);
mLayoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mCategoryList = (ListView) findViewById(R.id.category_list);
mFooterView = mLayoutInflater.inflate(R.layout.load_item, null);
mLoadProgress = (ProgressBar) mFooterView.findViewById(R.id.loading);
mLoadText = (TextView) mFooterView.findViewById(R.id.load_text);
mVideoList.addFooterView(mFooterView);
mVideoList.setOnScrollListener(this);
mDrawer.setOnTouchListener(this);
View headerView = mLayoutInflater.inflate(R.layout.gallery_item, null, false);
mVideoList.addHeaderView(headerView);
mRecommendPager = (ViewPager) headerView.findViewById(R.id.pager);
mRecommendPager.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
PointF downP = new PointF();
PointF curP = new PointF();
int act = event.getAction();
if (act == MotionEvent.ACTION_DOWN || act == MotionEvent.ACTION_MOVE || act == MotionEvent.ACTION_UP) {
((ViewGroup) v).requestDisallowInterceptTouchEvent(true);
if (downP.x == curP.x && downP.y == curP.y) {
return false;
}
}
return false;
}
});
mRecommendIndicator = (UnderlinePageIndicator) headerView.findViewById(R.id.indicator);
if (getIntent().hasExtra("Success")) {
init(getIntent());
} else {
Toast.makeText(mContext, R.string.init_failed, Toast.LENGTH_SHORT).show();
finish();
}
mDrawerAapter = new SimpleAdapter(this, getDrawerItems(), R.layout.drawer_item, new String[] { "img", "title" }, new int[] { R.id.item_icon, R.id.item_name });
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_action_navigation_menu, R.string.app_name, R.string.app_name) {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
if (mPreviousType != mType || mPreviousCategoryId != mCategoryId) {
mCurrentPage = 1;
mIsEnd = false;
mVideoAdapter.removeAllData();
mFooterView.findViewById(R.id.loading).setVisibility(View.VISIBLE);
mFooterView.findViewById(R.id.load_text).setVisibility(View.INVISIBLE);
triggerApiConnector();
}
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
mPreviousType = mType;
mPreviousCategoryId = mCategoryId;
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerList.setAdapter(mDrawerAapter);
mDrawerList.setOnItemClickListener(this);
ViewUtils.setListViewHeightBasedOnChildren(mDrawerList);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
getSupportActionBar().setLogo(R.drawable.rsz_ab_icon);
rateForUsOrCheckUpdate();
showWhatsNew();
}
Aggregations