当前位置: 首页 > 软件库 > 手机/移动开发 > >

GoogleNewsStandAnimation-Android

授权协议 Apache-2.0 License
开发语言 Java
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 诸葛煜
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Google-NewsStand-Animation-Android

Navigation pattern like in Google News Stand app with transitions

Screenshots

Getting Started

In your build.gradle

dependencies {
    implementation 'hari.allagi:allagi:0.1.1'
    //or in lower versions:
    //compile 'hari.allagi:allagi:0.1.1'
}

Usage

Choose one of the NoActionBar themes to use in MenuListActivity and override it to define your app color palette.

<style name="AppTheme.MenuListActivity.NoActionBar" parent="Theme.AppCompat.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent" >@color/colorAccent</item>
</style>

Define the colors for ScrollableMenuActivity too.

<style name="AppTheme.ScrollableMenuActivity.NoActionBar" parent="Theme.AppCompat.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

Declare the Allagi activities in AndroidManifest.xml file using your new app themes.

<activity
    android:name="hari.allagi.MenuListActivity"
    android:theme="@style/AppTheme.MenuListActivity.NoActionBar" />
<activity
    android:name="hari.allagi.ScrollableMenuActivity"
    android:theme="@style/AppTheme.ScrollableMenuActivity.NoActionBar" />

Set largeHeap to true in AndroidManifest.xml.

<application
  ...
  android:largeHeap="true"/>

Open Allagi from a activity like so:

ArrayList<String> menuList = new ArrayList<>();     //menu titles
ArrayList<Integer> imagesList = new ArrayList<>();      //menu backgrounds
ArrayList<Fragment> fragmentsList = new ArrayList<>();      //fragments for each menu headers in second activity

menuList.add("UPCOMING");       //add titles
menuList.add("EVENTS");         //limit to 8 items for the animation to work
...

imagesList.add(R.drawable.upcoming);        //add background images
imagesList.add(R.drawable.events);
...

fragmentsList.add(UpcomingFragment.newInstance());      //add fragment instances
fragmentsList.add(EventsFragment.newInstance());
...

Allagi allagi = Allagi.initialize(MainActivity.this, menuList, imagesList, fragmentsList);
allagi.start();         //start the menu list activity

Change the duration of the animation:

allagi.setTransitionDuration(900);      //default value is 1000 milliseconds

Libraries used in the project

Credits

Inspired by and thanks to Aurélien Salomon's Google Newsstand Navigation Pattern

Show your support

Give a if this project helped you!

License

Copyright ©️ 2018 Hariprasanth S

This project is licensed under the Apache License, Version 2.0
You may also obtain a copy of the License at

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

 相关资料
  • 问题内容: 我正在尝试从一个发送客户类的对象,Activity然后在另一个对象中显示它Activity。 客户类的代码: 我想将其对象从一个对象发送Activity到另一个对象,然后在另一个对象上显示数据Activity。 我该如何实现? 问题答案: 一种选择是让你的自定义类实现该接口,然后可以使用该方法的变体在意图中额外传递对象实例。 伪代码:

  • 问题内容: 我很难找到最简单的方法来针对给定的JSON模式字符串验证JSON字符串(作为参考,这是在Java中运行在Android应用程序中)。 理想情况下,我只想传入JSON字符串和JSON模式字符串,并且它返回关于是否通过验证的布尔值。通过搜索,我发现了以下两个有前途的库可以完成此任务: http://jsontools.berlios.de/ https://github.com/fge/j

  • 问题内容: 我想每隔5秒重复调用一次方法,每当我希望停止该方法的重复调用时,我可能会停止或重新启动该方法的重复调用。 这是一些我真正想要实现的示例代码。在这方面请帮助我,我将非常感谢您。 问题答案: 使用以下命令设置重复任务: 如果您想取消任务,只需调用这里就是您的对象 并且您还可以检查答案下方的评论,他们已经提供了有关此内容的简短信息。

  • 问题内容: 我有一个活动,该活动的TabHost包含一组TabSpec,每个TabSpec都有一个listview,其中包含要由该选项卡显示的项目。创建每个TabSpec时,我设置一个图标以显示在选项卡标题中。 TabSpec是通过以下方法创建的,该方法循环创建适当数量的选项卡: 有几个实例,我希望能够更改程序执行过程中每个选项卡中显示的图标。目前,我正在删除所有选项卡,并再次调用上述代码以重新创

  • 问题内容: 如何通过android app向终端发送命令并获取输出?例如,发送“ ls /”并获取输出以在GUI中将其打印出来? 问题答案: 您必须使用反射来调用android.os.Exec.createSubprocess():

  • 问题内容: 我的应用程序显示了许多自定义对话框,例如“是/否”或“接受/取消决定”,并且在编写代码时,我意识到遵循相同的模式重复了太多代码。 我想建立一个通用类,但我不知道该怎么做,或更确切地说,我不知道该怎么做(接口,抽象类,继承,静态类等)。 这是我目前的课程: } 这就是我需要使用此类时要做的事情: 我敢肯定它是可改进的,但是您怎么能做到呢? 谢谢 问题答案: 首先创建一个Base 来保持的