use of android.support.v7.widget.helper.ItemTouchHelper.START in project Gladys-Android-App by LeptitGeek.
the class MainActivity method initialdeclarations.
public void initialdeclarations() {
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
View header = navigationView.getHeaderView(0);
user = header.findViewById(R.id.user);
FloatingActionButton fab_scroll_up = findViewById(R.id.fab_scroll_up);
fab_scroll_up.animate().translationY(fab_scroll_up.getHeight() + 400).setInterpolator(new LinearInterpolator()).start();
}
use of android.support.v7.widget.helper.ItemTouchHelper.START in project AboutLibraries by mikepenz.
the class FragmentActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment);
// Remove line to test RTL support
// getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
new DrawerBuilder(this).withToolbar(toolbar).addDrawerItems(new PrimaryDrawerItem().withName("Home"), new PrimaryDrawerItem().withName(R.string.action_manifestactivity).withIdentifier(R.id.action_manifestactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_extendactivity).withIdentifier(R.id.action_extendactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_customsortactivity).withIdentifier(R.id.action_customsortactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_opensource).withIdentifier(R.id.action_opensource).withSelectable(false)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int i, IDrawerItem drawerItem) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
long id = drawerItem.getIdentifier();
if (id == R.id.action_opensource) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/mikepenz/AboutLibraries"));
startActivity(browserIntent);
} else if (id == R.id.action_extendactivity) {
Intent intent = new Intent(getApplicationContext(), ExtendActivity.class);
startActivity(intent);
} else if (id == R.id.action_customsortactivity) {
Intent intent = new Intent(getApplicationContext(), CustomSortActivity.class);
startActivity(intent);
} else if (id == R.id.action_manifestactivity) {
new LibsBuilder().withLibraries("crouton", "actionbarsherlock", "showcaseview", "android_job").withAutoDetect(false).withLicenseShown(true).withVersionShown(true).withActivityTitle("Open Source").withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).withListener(libsListener).withLibTaskCallback(libTaskCallback).withUiListener(libsUIListener).start(FragmentActivity.this);
}
return false;
}
}).build();
/*
//NOTE: This is how you can modify a specific library definition during runtime
HashMap<String, HashMap<String, String>> libsModification = new HashMap<String, HashMap<String, String>>();
HashMap<String, String> modifyAboutLibraries = new HashMap<String, String>();
modifyAboutLibraries.put("name", "_AboutLibraries");
libsModification.put("aboutlibraries", modifyAboutLibraries);
.withLibraryModification(libsModification);
*/
LibsSupportFragment fragment = new LibsBuilder().withVersionShown(false).withLicenseShown(true).withLibraryModification("aboutlibraries", Libs.LibraryFields.LIBRARY_NAME, "_AboutLibraries").supportFragment();
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
}
use of android.support.v7.widget.helper.ItemTouchHelper.START in project LollipopShowcase by mikepenz.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final SharedPreferences pref = getSharedPreferences("com.mikepenz.applicationreader", 0);
drawer = new DrawerBuilder(this).withToolbar(toolbar).addDrawerItems(new SwitchDrawerItem().withOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton compoundButton, boolean b) {
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean("autouploadenabled", b);
editor.apply();
}
}).withName(R.string.drawer_switch).withChecked(pref.getBoolean("autouploadenabled", false))).addStickyDrawerItems(new SecondaryDrawerItem().withName(R.string.drawer_opensource).withIdentifier(DRAWER_ITEM_OPEN_SOURCE).withIcon(FontAwesome.Icon.faw_github).withSelectable(false)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int i, IDrawerItem drawerItem) {
if (drawerItem.getIdentifier() == DRAWER_ITEM_OPEN_SOURCE) {
new LibsBuilder().withFields(R.string.class.getFields()).withVersionShown(true).withLicenseShown(true).withActivityTitle(getString(R.string.drawer_opensource)).withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).start(MainActivity.this);
}
return false;
}
}).withSelectedItem(-1).withSavedInstance(savedInstanceState).build();
// Handle ProgressBar
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
// Fab Button
mFabButton = (FloatingActionButton) findViewById(R.id.fab_normal);
mFabButton.setImageDrawable(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_file_upload).color(Color.WHITE).actionBar());
mFabButton.setOnClickListener(fabClickListener);
mRecyclerView = (RecyclerView) findViewById(R.id.list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setItemAnimator(new CustomItemAnimator());
// mRecyclerView.setItemAnimator(new ReboundItemAnimator());
mAdapter = new ApplicationAdapter(new ArrayList<AppInfo>(), R.layout.row_application, MainActivity.this);
mRecyclerView.setAdapter(mAdapter);
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.theme_accent));
mSwipeRefreshLayout.setRefreshing(true);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
new InitializeApplicationsTask().execute();
}
});
new InitializeApplicationsTask().execute();
if (savedInstanceState != null) {
if (uploadComponentInfoTask != null) {
if (uploadComponentInfoTask.isRunning) {
uploadComponentInfoTask.showProgress(this);
}
}
}
// show progress
mRecyclerView.setVisibility(View.GONE);
mProgressBar.setVisibility(View.VISIBLE);
}
use of android.support.v7.widget.helper.ItemTouchHelper.START in project NewPipe by TeamNewPipe.
the class SearchFragment method initSearchListeners.
private void initSearchListeners() {
if (DEBUG)
Log.d(TAG, "initSearchListeners() called");
searchClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (DEBUG)
Log.d(TAG, "onClick() called with: v = [" + v + "]");
if (TextUtils.isEmpty(searchEditText.getText())) {
NavigationHelper.gotoMainFragment(getFragmentManager());
return;
}
searchEditText.setText("");
suggestionListAdapter.setItems(new ArrayList<SuggestionItem>());
showKeyboardSearch();
}
});
TooltipCompat.setTooltipText(searchClear, getString(R.string.clear));
searchEditText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (DEBUG)
Log.d(TAG, "onClick() called with: v = [" + v + "]");
if (isSuggestionsEnabled && errorPanelRoot.getVisibility() != View.VISIBLE) {
showSuggestionsPanel();
}
}
});
searchEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (DEBUG)
Log.d(TAG, "onFocusChange() called with: v = [" + v + "], hasFocus = [" + hasFocus + "]");
if (isSuggestionsEnabled && hasFocus && errorPanelRoot.getVisibility() != View.VISIBLE) {
showSuggestionsPanel();
}
}
});
suggestionListAdapter.setListener(new SuggestionListAdapter.OnSuggestionItemSelected() {
@Override
public void onSuggestionItemSelected(SuggestionItem item) {
search(item.query);
searchEditText.setText(item.query);
}
@Override
public void onSuggestionItemInserted(SuggestionItem item) {
searchEditText.setText(item.query);
searchEditText.setSelection(searchEditText.getText().length());
}
@Override
public void onSuggestionItemLongClick(SuggestionItem item) {
if (item.fromHistory)
showDeleteSuggestionDialog(item);
}
});
if (textWatcher != null)
searchEditText.removeTextChangedListener(textWatcher);
textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
String newText = searchEditText.getText().toString();
suggestionPublisher.onNext(newText);
}
};
searchEditText.addTextChangedListener(textWatcher);
searchEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (DEBUG) {
Log.d(TAG, "onEditorAction() called with: v = [" + v + "], actionId = [" + actionId + "], event = [" + event + "]");
}
if (event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER || event.getAction() == EditorInfo.IME_ACTION_SEARCH)) {
search(searchEditText.getText().toString());
return true;
}
return false;
}
});
if (suggestionDisposable == null || suggestionDisposable.isDisposed())
initSuggestionObserver();
}
use of android.support.v7.widget.helper.ItemTouchHelper.START in project Collar by CodeZsx.
the class StatusDetailActivity method initView.
@Override
public void initView() {
setToolbarTitle(mBinding.toolbar, "微博正文");
// 获取intent传递过来的bean
mBean = (StatusBean) getIntent().getSerializableExtra(StatusBean.INTENT_SERIALIZABLE);
isFromComment = getIntent().getBooleanExtra(INTENT_FROM_COMMENT, false);
if (isFromComment) {
mBinding.appbar.setExpanded(false);
}
mBinding.setStatus(mBean);
// 微博正文
mBinding.tvContent.setText(StatusContentTextUtil.getWeiBoContent(mBean.getText(), this, mBinding.tvContent));
// 微博图片,根据无图片、多张图片进行不同的显示方式
setStatusImage(mBinding.recyclerView, mBean.getPic_urls());
// 转发微博体
if (mBean.getRetweeted_status() == null) {
mBinding.llRetweeted.setVisibility(View.GONE);
} else {
// 转发微博体的正文
mBinding.retweetedContent.setText(StatusContentTextUtil.getWeiBoContent("@" + mBean.getRetweeted_status().getUser().getScreen_name() + ":" + mBean.getRetweeted_status().getText(), this, mBinding.retweetedContent));
// 转发微博体的图片
setStatusImage(mBinding.retweetedRecyclerView, mBean.getRetweeted_status().getPic_urls());
mBinding.llRetweeted.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle mBundle = new Bundle();
mBundle.putSerializable(StatusBean.INTENT_SERIALIZABLE, mBean);
StatusDetailActivity.this.startActivity(new Intent(StatusDetailActivity.this, StatusDetailActivity.class).putExtras(mBundle));
}
});
}
// 设置评论和转发列表
mBinding.viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
String[] titles = { "评论 " + mBean.getComments_count(), "转发 " + mBean.getReposts_count() };
@Override
public Fragment getItem(int position) {
if (position == 0) {
return new CommentListFragment().newInstance(mBean.getId(), CommentListFragment.TYPE_COMMENT_STATUS_DETAIL);
} else {
return new RepostListFragment().newInstance(mBean.getId());
}
}
@Override
public int getCount() {
return titles.length;
}
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
});
mBinding.tabLayout.setupWithViewPager(mBinding.viewPager);
// 设置edittext
mBinding.etContent.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if ("".equals(s.toString())) {
mBinding.ivCommit.setSelected(false);
} else {
mBinding.ivCommit.setSelected(true);
}
mBinding.tvStatusLength.setText((COMMENT_MAX_LENGTH - s.length()) + "");
}
@Override
public void afterTextChanged(Editable s) {
}
});
mBinding.etContent.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
mBinding.rlAdditional.setVisibility(View.VISIBLE);
} else {
mBinding.rlAdditional.setVisibility(View.GONE);
}
}
});
mBinding.ivCommit.setOnClickListener(this);
reloadData();
}
Aggregations