Camposha
  • Home
  • Android
  • Buy Projects
  • My Account
    • Become a Member
    • Log In|Log Out
    • Free Projects
No Result
View All Result
Camposha
  • Home
  • Android
  • Buy Projects
  • My Account
    • Become a Member
    • Log In|Log Out
    • Free Projects
No Result
View All Result
Camposha
No Result
View All Result
Home Android Activity Routing

ActivitySwitcher

2 weeks ago
in Routing
Reading Time: 1min read
40 0
A A
40
SHARES
4k
VIEWS
Share on FacebookShare on Twitter

SimilarPosts

CachePot

2 weeks ago
4k

RxRouter

2 weeks ago
4k

Activity Switcher has the following roles:

  1. Jump between Activity, close any Activity and end applications and other functions.
DescriptionInfoDownload

ActivitySwitcher

Android Arsenal

ActivitySwitcher 是一个基于 Activity 视图操作管理库,可以实现 Activity 之间任意跳转、关闭任意一个 Activity 以及结束应用程序等功能。

本库中的展现 Activity 视图时,附带阴影的卡片效果抽取自 CrazyShadow 有兴趣的朋友可以移步看看。

欢迎大家给 ActivitySwitcher 提 Issues,有问题我会尽快修复

Preview

录制图像有丢帧的情况,所以预览图效果不够流畅,背景图显示的也有问题。

Sample

demo.apk

Import

导入 aslibrary Module 作为依赖库, 或者直接复制 com.hitomi.aslibrary 中所有类文件到自己的项目中即可

Usage

1、Application 中 初始化

ActivitySwitcher.getInstance().init(this);

2、在 Activity 中重写 dispatchTouchEvent 处理事件分发。最好直接在 BaseActivity 中处理。万事大吉

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    activitySwitcher.processTouchEvent(ev);
    return super.dispatchTouchEvent(ev);
}

如果不想通过手势打开 ActivitySwitcher,可以通过以下方式手动打开

   activitySwitcher.showSwitcher();

3、Android 手机默认按下返回键就回 finish 掉当前 Activity,这与本库冲突,所以需要重写 onBackPressed 方法,同样最好在 BaseActivity 中去重写

@Override
public void onBackPressed() {
    activitySwitcher.finishSwitch(this);
}

4、如果希望监听 ActivitySwitcher 当前的行为状态,可以添加以下代码

activitySwitcher.setOnActivitySwitchListener(new ActivitySwitcher.OnActivitySwitchListener() {
    @Override
    public void onSwitchStarted() {}

    @Override
    public void onSwitchFinished(Activity activity) {}
});

  onSwitchStarted :在 ActivitySwitcher 打开后被回调
  onSwitchFinished 在 ActivitySwitcher 关闭后被回调

全部示例代码详情请前往 MainActivity 查看

#Method

方法 说明
getInstance 获取 ActivitySwitcher 实例 (ActivitySwitcher 为单例)
init 全局初始化 ActivitySwitcher, 一般在 Application 的 onCreate 方法中调用
processTouchEvent 用于需要手势打开 ActivitySwitcher 的场景, 一般在 BaseActivity 的 dispatchTouchEvent 方法中调用
showSwitch 打开 ActivitySwitcher,切换到 Activity 卡片式管理界面
finishSwitch 关闭 ActivitySwitcher, 退出 Activity 卡片式管理界面,回到选中或者默认的 Activity 界面
exit 退出当前应用程序
setOnActivitySwitchListener 设置监听器,监听 ActivitySwitcher 的打开和关闭

#Licence

  Copyright 2016 Hitomis, Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
ActivitySwitcher is based on the Activity view operation management library, you can achieve any jump between Activity, close any Activity and end applications and other functions.
Library written By: Hitomis Hitomis

Created: 2016-10-11T05:55:08ZLast Update: 2021-01-29T04:53:47Z

Stars: 1031Language: JavaForks: 129
View in Github

Download
Share16Tweet10Send

Related Posts

Activity

CachePot

February 13, 2021
4k
Activity

RxRouter

February 13, 2021
4k

Categories

  • Android
    • Introduction
    • Activity
      • Activity Basics
      • Lifecycle
      • Routing
    • Fragment
    • UI
      • AppBar and Toolbar
      • TextView
      • Tabs
      • Dialog
      • CardView
      • Chips
      • EditText
      • Navigation Drawer
      • Button
      • Bottom Navigation
    • Animation
    • MediaPlayer
      • VideoPlayer
    • Biometric
    • Jetpack
    • Android Firebase
    • Layouts
    • JSON
    • ContentViews
    • RxJava
    • PinView
    • Utility
    • ScrollView
    • URL
    • Log
    • Intent
    • DateTime
    • DownloadManager
    • Camera
    • SharedPreferences
    • SQLite
    • Retrofit
    • RecyclerView
    • Bluetooth
    • Hardware and Sensors
    • HTTP
    • Android AdapterViews
    • Projects
    • InputViews
    • Navigation
    • Menu
    • System
    • Communication
    • HttpURLConnection
    • Fast Networking Library
    • FileSystem
    • Components
    • Threading
    • Local Database
    • Jetpack
  • Flutter
    • Flutter HTTP
    • Flutter Widgets
    • Flutter Firebase
  • Java
    • Java Threading
    • Java Collections
    • JavaFX
  • Programming
  • Flutter Projects
  • Java DateTime
  • Flutter Listing Views
  • Flutter Image
  • Flutter Local Database
  • Documentary
  • Meditation
  • Flutter Animation and Motion
  • Javascript
    • Framework7
  • Xamarin Android
  • Python
    • CherryPy

Get Free Projects

  • Home
  • Android
  • Buy Projects
  • My Account

© 2021 Camposha

No Result
View All Result
  • Account
  • Activate
  • Activity
  • Become a Teacher
  • Become a Teacher
  • Become a Teacher
  • Become instructor
  • Blog
  • Blog
  • Cancel Payment
  • Cancel Payment
  • Cart
  • Change Password
  • Change Password
  • Checkout
  • Checkout
  • Checkout
  • Contact
  • Contact
  • Contact Us
  • Content restricted
  • Course Checkout
  • Dashboard
  • Edit Profile
  • Edit Profile
  • FAQs
  • Forgot Password
  • Forgot Password
  • Guest
  • Guest
  • Home
  • Home
  • Home Light
  • Instructor Dashboard
  • Instructor Registration
  • IUMP – Account Page
  • IUMP – Default Redirect Page
  • IUMP – Login
  • IUMP – LogOut
  • IUMP – Register
  • IUMP – Reset Password
  • IUMP – TOS Page
  • IUMP – Visitor Inside User Page
  • List courses
  • List wish list
  • Login
  • Login
  • Maintenance
  • Members
  • Membership Account
    • Membership Billing
    • Membership Cancel
    • Membership Checkout
    • Membership Confirmation
    • Membership Invoice
    • Membership Levels
  • Membership Account
    • Membership Billing
    • Membership Cancel
    • Membership Checkout
    • Membership Confirmation
    • Membership Invoice
    • Membership Levels
  • Membership Plans
  • My Account
  • OnePage Documentation
  • Portfolio Grid
  • Portfolio Masonry
  • Portfolio Multigrid
  • Privacy Policy
  • Products
  • Profile
  • Profile
  • Profile
  • Projects
  • Register
  • Register
  • Register
  • Register
  • Sample Page
  • Shop
  • Sign in
  • Sign up
  • Student profile
  • Student Registration
  • Thank You
  • Thank You

© 2021 Camposha

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In