All Projects → MarcinMoskala → Activitystarter

MarcinMoskala / Activitystarter

Licence: apache-2.0
Simple Android Library, that provides easy way to start the Activities with arguments.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Activitystarter

intentanimation
animattion between activities
Stars: ✭ 117 (-71.74%)
Mutual labels:  activity
aw-watcher-jetbrains
This extension allows the open source tracking tool ActivityWatch to keep track of the projects and coding languages you use in jetbrains IDEs.
Stars: ✭ 36 (-91.3%)
Mutual labels:  activity
Nutzmore
让Nutz更好用
Stars: ✭ 328 (-20.77%)
Mutual labels:  activity
ktx
简化Android开发的Kotlin库
Stars: ✭ 39 (-90.58%)
Mutual labels:  activity
Flow
Android wrapper to simplify process for start an Activity
Stars: ✭ 54 (-86.96%)
Mutual labels:  activity
mvp with dagger
How presenters survive Activity recreations on configuration changes with Dagger2
Stars: ✭ 29 (-93%)
Mutual labels:  activity
solid
Solid Android components
Stars: ✭ 33 (-92.03%)
Mutual labels:  activity
Laravel Logger
An out the box activity logger for your Laravel or Lumen application. Laravel logger is an activity event logger for your laravel application. It comes out the box with ready to use with dashboard to view your activity. Laravel logger can be added as a middleware or called through a trait. This package is easily configurable and customizable. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6, and 7+
Stars: ✭ 366 (-11.59%)
Mutual labels:  activity
sigma
LVPP sigma-profile database + COSMO-SAC parametrizations
Stars: ✭ 38 (-90.82%)
Mutual labels:  activity
Hauler
Library with swipe to dismiss Activity gesture implementation
Stars: ✭ 325 (-21.5%)
Mutual labels:  activity
tsioc
AOP, Ioc container, Boot framework, unit testing framework , activities workflow framework.
Stars: ✭ 15 (-96.38%)
Mutual labels:  activity
TestActiviti1.0
该系统是基于Activiti5工作流引擎采用了SSM+Mysql实现的一个学生请假系统
Stars: ✭ 28 (-93.24%)
Mutual labels:  activity
Inlineactivityresult
Receive the activity result directly after the startActivityForResult with InlineActivityResult
Stars: ✭ 264 (-36.23%)
Mutual labels:  activity
wp-user-activity
The best way to log activity in WordPress
Stars: ✭ 40 (-90.34%)
Mutual labels:  activity
Pvm
Build workflows, activities, BPMN like processes, or state machines with PVM.
Stars: ✭ 348 (-15.94%)
Mutual labels:  activity
AppListManager
📱 AppListManager (Android Library) makes managing application and activity lists easy.
Stars: ✭ 59 (-85.75%)
Mutual labels:  activity
ActivityManager
一个管理所有Activity的库,可以任意处关闭任意Activity
Stars: ✭ 17 (-95.89%)
Mutual labels:  activity
Keepalive
Fighting against force-stop kill process on Android with binder ioctl / Android高级保活
Stars: ✭ 376 (-9.18%)
Mutual labels:  activity
Github Activity Readme
Updates README with the recent GitHub activity of a user
Stars: ✭ 354 (-14.49%)
Mutual labels:  activity
Androidcomponentplugin
Android上简单实现四大组件的插件化,供学习使用
Stars: ✭ 316 (-23.67%)
Mutual labels:  activity

Warning: Library is not maintained anymore. If you want to take care of this library, propose it via Pull Request. It needs adjustmensts for newer versions of Android and Gradle.

ActivityStarter

Android Library that provides simpler way to start the Activities with multiple arguments.

codebeat badge Build Status Stories in Ready Join the chat at https://gitter.im/ActivityStarter/Lobby Analytics Analytics

Library bindes fields to Actity, Fragment, Service or Receiver arguments and generates simple starters. Thanks to that you can:

  • Eliminate all putExtra and getXXXExtra methods
  • Forget about all keys that were used to pass arguments (unless you want to define custom onces)
  • Start liking starting flags and intent creation

Media:

Full documentation is located here. Here is TOC:

To stay up-to-date with news about library Twitter URL

Example

With ActivityStarter, to pass arguments to Activity, Fragment, Service or BroadcastReceiver, all you need is @Arg annotation before parameters that needs to be passed:

public class MainActivity extends BaseActivity {

    @Arg String name;
    @Arg int id;
    @Arg char grade;
    @Arg boolean passing;
}

And ActivityStarter.fill(this, savedInstanceState); in BaseActivity:

class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ActivityStarter.fill(this, savedInstanceState);
    }

    @Override // This is optional, only when we want to keep arguments changes in case of rotation etc.
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        ActivityStarter.save(this, outState);
    }
}

Then, you can start Activity using generated starter:

MainActivityStarter.start(context, name, id, grade, passing);

Similar way, you can take Intent or start activity with flags:

MainActivityStarter.getIntent(context, name, id, grade, passing);
MainActivityStarter.startWithFlags(context, name, id, grade, passing, FLAG_ACTIVITY_SINGLE_TOP);

Arguments can be passed to Activities, Fragments, Services or BroadcastReceiver. Arguments can also be Optional.

Optional

You can make optional arguments:

public class MainActivity extends BaseActivity {

    @Arg(optional = true) String name;
    @Arg(optional = true) long id = -1;
}

Then additional generators with not all arguments will be created

MainActivityStarter.start(context);
MainActivityStarter.start(context, name);
MainActivityStarter.start(context, id);
MainActivityStarter.start(context, name, id);

Further reading here.

Kotlin

ActivityStarter is supporting Kotlin to allow properties that are not-null and both read-write or read-only:

class StudentDataActivity : BaseActivity() {

    @get:Arg(optional = true) var name: String by argExtra(defaultName)
    @get:Arg(optional = true) val id: Int by argExtra(defaultId)
    @get:Arg var grade: Char  by argExtra()
    @get:Arg val passing: Boolean by argExtra()
}

Values are taken lazily and kept as fields, but there are still saved if ActivityStarter.save(this) is called inonSaveInstanceState. When all properties are provided by delegate, then there is no need to call ActivityStarter.fill(this, savedInstanceState) in onCreate.

Parceler

Since version 0.70, there is native support for Parceler library. To wrap and unwrap parameter using Parceler, use Arg annotation with parceler property set to true:

@Arg(parceler = true) StudentParcel studentParceler;

See example here.

Installation

For Java project add in build.gradle file:

dependencies {
    compile 'com.marcinmoskala.activitystarter:activitystarter:1.10'
    apt 'com.marcinmoskala.activitystarter:activitystarter-compiler:1.10'
}

For Kotlin project add in build.gradle file:

apply plugin: 'kotlin-kapt'

dependencies {
    compile 'com.marcinmoskala.activitystarter:activitystarter:1.10'
    kapt 'com.marcinmoskala.activitystarter:activitystarter-compiler:1.10'
}

If you want to use Kotlin-specific elements (property delegate argExtra), then add in build.gradle file:

apply plugin: 'kotlin-kapt'

dependencies {
    compile 'com.marcinmoskala.activitystarter:activitystarter:1.10'
    compile 'com.marcinmoskala.activitystarter:activitystarter-kotlin:1.10'
    kapt 'com.marcinmoskala.activitystarter:activitystarter-compiler:1.10'
}

And while library is located on JitPack, remember to add on module build.gradle (unless you already have it):

repositories {
    maven { url 'https://jitpack.io' }
}

More information on Installation page.

Other libraries

If you like it, remember to leave the star and check out my other libraries:

  • PreferenceHolder - Library for simple SharedPreference management in Kotlin
  • ArcSeekBar - Good looking curved Android SeekBar
  • VideoPlayView - Custom Android view with video player, loader and placeholder image
  • KotlinAndroidViewBindings - Bindings for properties with simple Kotlin types (Boolean, String) to layout traits (visibility, text).

License

Copyright 2017 Marcin Moskała

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].