me.imid.swipebacklayout.lib.SwipeBackLayout Java Examples
The following examples show how to use
me.imid.swipebacklayout.lib.SwipeBackLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwipeBackActivityHelper.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("deprecation") public void onActivityCreate() { mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mActivity.getWindow().getDecorView().setBackgroundDrawable(null); mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate( R.layout.swipeback_layout, null); mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() { @Override public void onScrollStateChange(int state, float scrollPercent) { } @Override public void onEdgeTouch(int edgeFlag) { Utils.convertActivityToTranslucent(mActivity); } @Override public void onScrollOverThreshold() { } }); }
Example #2
Source File: SwipeBackActivityHelper.java From MaterialQQLite with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") public void onActivityCreate() { mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mActivity.getWindow().getDecorView().setBackgroundDrawable(null); mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate( me.imid.swipebacklayout.lib.R.layout.swipeback_layout, null); mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() { @Override public void onScrollStateChange(int state, float scrollPercent) { } @Override public void onEdgeTouch(int edgeFlag) { Utils.convertActivityToTranslucent(mActivity); } @Override public void onScrollOverThreshold() { } }); }
Example #3
Source File: SwipeBackActivityHelper.java From ChipHellClient with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") public void onActivityCreate() { mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mActivity.getWindow().getDecorView().setBackgroundDrawable(null); mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate( me.imid.swipebacklayout.lib.R.layout.swipeback_layout, null); mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() { @Override public void onScrollStateChange(int state, float scrollPercent) { } @Override public void onEdgeTouch(int edgeFlag) { Utils.convertActivityToTranslucent(mActivity); } @Override public void onScrollOverThreshold() { } }); }
Example #4
Source File: SwipeBackActivityHelper.java From SimpleNews with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") public void onActivityCreate() { mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mActivity.getWindow().getDecorView().setBackgroundDrawable(null); mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate( me.imid.swipebacklayout.lib.R.layout.swipeback_layout, null); mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() { @Override public void onScrollStateChange(int state, float scrollPercent) { } @Override public void onEdgeTouch(int edgeFlag) { Utils.convertActivityToTranslucent(mActivity); } @Override public void onScrollOverThreshold() { } }); }
Example #5
Source File: DemoActivity.java From SwipeBackLayout with Apache License 2.0 | 6 votes |
private void restoreTrackingMode() { int flag = PreferenceUtils.getPrefInt(getApplicationContext(), mKeyTrackingMode, SwipeBackLayout.EDGE_LEFT); mSwipeBackLayout.setEdgeTrackingEnabled(flag); switch (flag) { case SwipeBackLayout.EDGE_LEFT: mTrackingModeGroup.check(R.id.mode_left); break; case SwipeBackLayout.EDGE_RIGHT: mTrackingModeGroup.check(R.id.mode_right); break; case SwipeBackLayout.EDGE_BOTTOM: mTrackingModeGroup.check(R.id.mode_bottom); break; case SwipeBackLayout.EDGE_ALL: mTrackingModeGroup.check(R.id.mode_all); break; } }
Example #6
Source File: SwipeBackActivityHelper.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("deprecation") public void onActivityCreate() { mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mActivity.getWindow().getDecorView().setBackgroundDrawable(null); mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate( R.layout.swipeback_layout, null); mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() { @Override public void onScrollStateChange(int state, float scrollPercent) { } @Override public void onEdgeTouch(int edgeFlag) { Utils.convertActivityToTranslucent(mActivity); } @Override public void onScrollOverThreshold() { } }); }
Example #7
Source File: SettingFragment.java From ChipHellClient with Apache License 2.0 | 6 votes |
private void setSwipeEdge() { mSwipeEdge = (MultiSelectListPreference) findPreference(GlobalSetting.SWIPE_BACK_EDGE); int edge = GlobalSetting.getSwipeBackEdge(); Set<String> edges = new HashSet<String>(); StringBuilder summary = new StringBuilder(); if ((edge & SwipeBackLayout.EDGE_LEFT) != 0) { edges.add(String.valueOf(SwipeBackLayout.EDGE_LEFT)); summary.append(getResources().getString(R.string.swipe_edge_left)).append(" "); } if ((edge & SwipeBackLayout.EDGE_RIGHT) != 0) { edges.add(String.valueOf(SwipeBackLayout.EDGE_RIGHT)); summary.append(getResources().getString(R.string.swipe_edge_right)).append(" "); } if ((edge & SwipeBackLayout.EDGE_BOTTOM) != 0) { edges.add(String.valueOf(SwipeBackLayout.EDGE_BOTTOM)); summary.append(getResources().getString(R.string.swipe_edge_bottom)).append(" "); } mSwipeEdge.setValues(edges); mSwipeEdge.setSummary(summary.toString()); mSwipeEdge.setOnPreferenceChangeListener(this); }
Example #8
Source File: MySwipeBackHelper.java From SwipeBack with GNU General Public License v3.0 | 6 votes |
@Override public void onActivityCreate() { super.onActivityCreate(); // Set pixel format on start mActivity.getWindow().setFormat(PixelFormat.TRANSLUCENT); // Set background on swiped getSwipeBackLayout().addSwipeListener(new SwipeBackLayout.SwipeListener() { @Override public void onScrollStateChange(int state, float scrollPercent) { } @Override public void onEdgeTouch(int edgeFlag) { setBackground(); } @Override public void onScrollOverThreshold() { } }); }
Example #9
Source File: SettingsFragment.java From SwipeBack with GNU General Public License v3.0 | 6 votes |
private Set<String> parseEdgePref(int pref) { HashSet<String> ret = new HashSet<>(); if ((pref & SwipeBackLayout.EDGE_LEFT) != 0) { ret.add(EDGE_LEFT); } if ((pref & SwipeBackLayout.EDGE_RIGHT) != 0) { ret.add(EDGE_RIGHT); } if ((pref & SwipeBackLayout.EDGE_BOTTOM) != 0) { ret.add(EDGE_BOTTOM); } return ret; }
Example #10
Source File: SettingsFragment.java From SwipeBack with GNU General Public License v3.0 | 6 votes |
private int buildEdgePref(Set<String> values) { int pref = 0; for (String value : values) { switch (value) { case EDGE_LEFT: pref |= SwipeBackLayout.EDGE_LEFT; break; case EDGE_RIGHT: pref |= SwipeBackLayout.EDGE_RIGHT; break; case EDGE_BOTTOM: pref |= SwipeBackLayout.EDGE_BOTTOM; break; } } return pref; }
Example #11
Source File: SettingsFragment.java From SwipeBack with GNU General Public License v3.0 | 6 votes |
private void reload() { mEnable.setChecked(getBoolean(Settings.ENABLE, true)); Set<String> edges = parseEdgePref(getInt(Settings.EDGE, SwipeBackLayout.EDGE_LEFT)); mEdge.setValues(edges); mEdge.setSummary(buildEdgeText(edges)); mSensitivity.setValue(getInt(Settings.SENSITIVITY, 100)); mScrollToReturn.setChecked(getBoolean(Settings.SCROLL_TO_RETURN, false)); // Shortcut only available in global settings above API 16 if (mPackageName.equals("global")) { if (Build.VERSION.SDK_INT >= 16) { mShortcut.setEnabled(true); mShortcut.setChecked(getBoolean(Settings.NOTIFY_SHORTCUT, false)); } } else { getPreferenceScreen().removePreference(mShortcut); } if (Build.VERSION.SDK_INT >= 21) { mLollipop.setEnabled(true); mLollipop.setChecked(getBoolean(Settings.LOLLIPOP_HACK, false)); } }
Example #12
Source File: NovelImageActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_image); mSwipeBackLayout = getSwipeBackLayout(); mSwipeBackLayout.setScrimColor(Color.TRANSPARENT); mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT); imgPath = getIntent().getStringExtra("path"); if (imgPath == null || imgPath.length() == 0) { Toast.makeText(this, "No image path error", Toast.LENGTH_LONG).show(); return; } if (imgPath == null || imgPath.length() == 0) return; // load image file first byte[] imgContent = LightCache.loadFile(imgPath); Bitmap bm = BitmapFactory.decodeByteArray(imgContent, 0, imgContent.length); //BitmapDrawable bd= new BitmapDrawable(getResources(), bm); // show in View PhotoView iv = (PhotoView) this.findViewById(R.id.image_photoview); iv.setImageBitmap(bm); //ImageLoader.getInstance().displayImage("file://" + imgPath, iv); return; }
Example #13
Source File: NewsDetailActivity.java From SimpleNews with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_news_detail); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); mProgressBar = (ProgressBar) findViewById(R.id.progress); mTVNewsContent = (HtmlTextView) findViewById(R.id.htNewsContent); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onBackPressed(); } }); mSwipeBackLayout = getSwipeBackLayout(); mSwipeBackLayout.setEdgeSize(ToolsUtil.getWidthInPx(this)); mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT); mNews = (NewsBean) getIntent().getSerializableExtra("news"); CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); collapsingToolbar.setTitle(mNews.getTitle()); ImageLoaderUtils.display(getApplicationContext(), (ImageView) findViewById(R.id.ivImage), mNews.getImgsrc()); mNewsDetailPresenter = new NewsDetailPresenterImpl(getApplication(), this); mNewsDetailPresenter.loadNewsDetail(mNews.getDocid()); }
Example #14
Source File: SwipeBackHelper.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
public void onCreate(Activity activity) { mHelper = new SwipeBackActivityHelper(activity); mHelper.onActivityCreate(); SwipeBackLayout swipeBackLayout = mHelper.getSwipeBackLayout(); float density = activity.getResources().getDisplayMetrics().density; swipeBackLayout.setEdgeSize((int) (10 * density + 0.5f)); swipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_ALL); }
Example #15
Source File: SwipeBackActivityHelper.java From SwipeBackLayout with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") public void onActivityCreate() { mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); mActivity.getWindow().getDecorView().setBackgroundDrawable(null); mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate( me.imid.swipebacklayout.lib.R.layout.swipeback_layout, null); }
Example #16
Source File: StoryDetailActivity.java From hacker-news-android with Apache License 2.0 | 5 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_story_detail); ButterKnife.inject(this); Intent intent = getIntent(); long storyId = 0; mFromExternal = false; if (intent != null) { Bundle extras = intent.getExtras(); if (extras != null) { storyId = extras.getLong(MainActivity.STORY_ID); mSaved = extras.getBoolean(StoryDetailFragment.LOADING_FROM_SAVED); } final Uri data = intent.getData(); if (data != null) { storyId = Long.parseLong(data.getQueryParameter("id")); mFromExternal = true; } } if (mToolbar != null) { mToolbar.setTitleTextColor(getResources().getColor(android.R.color.white)); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } if(UserPreferenceManager.getInstance().isSwipeBackEnabled()) { getSwipeBackLayout().setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT); } else{ getSwipeBackLayout().setEnableGesture(false); } if (savedInstanceState == null) { mStoryDetailFragment = StoryDetailFragment.newInstance(storyId, mSaved); getSupportFragmentManager().beginTransaction() .add(R.id.container, mStoryDetailFragment) .commit(); } }
Example #17
Source File: BaseSwipeBackActivity.java From LeisureRead with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //设置布局内容 setContentView(getLayoutId()); //初始化黄油刀控件绑定框架 ButterKnife.bind(this); //初始化侧滑返回layout mSwipeBackLayout = getSwipeBackLayout(); mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT); //初始化控件 initViews(savedInstanceState); }
Example #18
Source File: SwipeBackActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
@Override public SwipeBackLayout getSwipeBackLayout() { return mHelper.getSwipeBackLayout(); }
Example #19
Source File: SwipeBackActivityHelper.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
public SwipeBackLayout getSwipeBackLayout() { return mSwipeBackLayout; }
Example #20
Source File: SwipeBackPreferenceActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
@Override public SwipeBackLayout getSwipeBackLayout() { return mHelper.getSwipeBackLayout(); }
Example #21
Source File: NovelListActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_novel_list); mSwipeBackLayout = getSwipeBackLayout(); mSwipeBackLayout.setScrimColor(Color.TRANSPARENT); mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT); // get parentActivity parentActivity = this; currentPage = 1; totalPage = 1; isLoading = false; // set the two button on the title bar ((ImageView) findViewById(R.id.btnMenu)) .setImageResource(R.drawable.ic_back); ((ImageView) findViewById(R.id.btnMenu)).setVisibility(View.VISIBLE); ((ImageView) findViewById(R.id.btnEdit)).setVisibility(View.GONE); // set button actions findViewById(R.id.btnMenu).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { onBackPressed(); // finish(); } }); // Interpret the in-coming "code" and "plus" name = getIntent().getStringExtra("title"); code = getIntent().getStringExtra("code"); Log.v("MewX", "name=" + name + "; code=" + code); if (code.equals("search_novel")) { // From Search Button plus = getIntent().getIntExtra("plus", 1); ((TextView) findViewById(R.id.textTitle)).setText(getResources() .getString(R.string.search) + name); // show search result loadSearchResultList(); } else if (code.equals("list_special")) { // From one click on List Special ((TextView) findViewById(R.id.textTitle)) .setText("something special"); // load the specific list result, and get "plus" from Intent loadSpecialResult(); } else { // Show provided novel list CharSequence fetch_title = name; ((TextView) findViewById(R.id.textTitle)).setText(fetch_title); // switch category // <string name="postdate">最新入库</string> // <string name="goodnum">总收藏榜</string> // <string name="fullflag">完结列表</string> // <string name="lastupdate">最近更新</string> // <string name="allvisit">总排行榜</string> // <string name="allvote">总推荐榜</string> // <string name="monthvisit">月排行榜</string> // <string name="monthvote">月推荐榜</string> // <string name="weekvisit">周排行榜</string> // <string name="weekvote">周推荐榜</string> // <string name="dayvisit">日排行榜</string> // <string name="dayvote">日推荐榜</string> // <string name="size">字数排行</string> loadNovelList(currentPage++); } return; }
Example #22
Source File: SwipeBackPreferenceActivity.java From SwipeBackLayout with Apache License 2.0 | 4 votes |
@Override public SwipeBackLayout getSwipeBackLayout() { return mHelper.getSwipeBackLayout(); }
Example #23
Source File: NovelImageActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_image); mSwipeBackLayout = getSwipeBackLayout(); mSwipeBackLayout.setScrimColor(Color.TRANSPARENT); mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT); imgPath = getIntent().getStringExtra("path"); if (imgPath == null || imgPath.length() == 0) { Toast.makeText(this, "No image path error", Toast.LENGTH_LONG) .show(); return; } if (imgPath == null || imgPath.length() == 0) return; // load image file first imgContent = LightCache.loadFile(imgPath); bm = BitmapFactory.decodeByteArray(imgContent, 0, imgContent.length); // Native memory try // BitmapFactory.Options options = new BitmapFactory.Options(); // options.inPreferredConfig = Config.ARGB_8888; // options.inPurgeable = true;//允许可清除 // options.inInputShareable = true;// 以上options的两个属性必须联合使用才会有效果 // InputStream is = new ByteArrayInputStream(imgContent); // Bitmap bitmap = BitmapFactory.decodeStream(is,null,options); // ((PhotoView) // this.findViewById(R.id.image_photoview)).setImageBitmap(bitmap); // show in View SubsamplingScaleImageView iv = (SubsamplingScaleImageView) this.findViewById(R.id.image_photoview); iv.setImageFile(imgPath); return; }
Example #24
Source File: SwipeBackActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
@Override public SwipeBackLayout getSwipeBackLayout() { return mHelper.getSwipeBackLayout(); }
Example #25
Source File: SwipeBackActivityHelper.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
public SwipeBackLayout getSwipeBackLayout() { return mSwipeBackLayout; }
Example #26
Source File: SwipeBackPreferenceActivity.java From light-novel-library_Wenku8_Android with GNU General Public License v2.0 | 4 votes |
@Override public SwipeBackLayout getSwipeBackLayout() { return mHelper.getSwipeBackLayout(); }
Example #27
Source File: SwipeBackActivity.java From ChipHellClient with Apache License 2.0 | 4 votes |
@Override public SwipeBackLayout getSwipeBackLayout() { return mHelper.getSwipeBackLayout(); }
Example #28
Source File: SwipeBackActivityHelper.java From ChipHellClient with Apache License 2.0 | 4 votes |
public SwipeBackLayout getSwipeBackLayout() { return mSwipeBackLayout; }
Example #29
Source File: SwipeBackPreferenceActivity.java From ChipHellClient with Apache License 2.0 | 4 votes |
@Override public SwipeBackLayout getSwipeBackLayout() { return mHelper.getSwipeBackLayout(); }
Example #30
Source File: SettingFragment.java From ChipHellClient with Apache License 2.0 | 4 votes |
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference == mSwipeEdge) { Set<String> newValues = (Set<String>) newValue; int edge = 0; StringBuilder summary = new StringBuilder(); for (String value : newValues) { switch (Integer.parseInt(value)) { case SwipeBackLayout.EDGE_LEFT: edge |= SwipeBackLayout.EDGE_LEFT; summary.append(getResources().getString(R.string.swipe_edge_left)).append(" "); break; case SwipeBackLayout.EDGE_RIGHT: edge |= SwipeBackLayout.EDGE_RIGHT; summary.append(getResources().getString(R.string.swipe_edge_right)).append(" "); break; case SwipeBackLayout.EDGE_BOTTOM: edge |= SwipeBackLayout.EDGE_BOTTOM; summary.append(getResources().getString(R.string.swipe_edge_bottom)).append(" "); break; } } GlobalSetting.putSwipeBackEdge(edge); mSwipeEdge.setSummary(summary.toString()); return true; } else if (preference == mForumAddress) { String newAddress = (String) newValue; if (TextUtils.isEmpty(newAddress)) { newAddress = GlobalSetting.DEFAULT_FORUM_ADDRESS; } if (!newAddress.startsWith("http")) { newAddress = "http://" + newAddress; } if (!newAddress.endsWith("/")) { newAddress += "/"; } GlobalSetting.setForumAddress(newAddress); mForumAddress.setSummary(newAddress); ToastUtil.show(getActivity(), "需重新启动应用生效"); return true; } return false; }