Convert Figma logo to code with AI

ribot logoandroid-guidelines

Architecture and code guidelines we use at ribot when developing for Android

5,047
1,398
5,047
12

Top Related Projects

Do's and Don'ts for Android development, by Futurice developers

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

A curated list of awesome Android UI/UX libraries

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.

:fire: Android developers should collect the following utils(updating).

Extensive Open-Source Guides for Android Developers

Quick Overview

The ribot/android-guidelines repository is a comprehensive set of guidelines and best practices for Android development. It covers various aspects of Android app development, including project structure, code style, architecture, and testing. These guidelines are designed to help developers create high-quality, maintainable Android applications.

Pros

  • Provides a well-structured and detailed guide for Android development
  • Covers a wide range of topics, from basic coding style to advanced architectural patterns
  • Regularly updated to reflect the latest Android development practices
  • Includes practical examples and explanations for better understanding

Cons

  • May be overwhelming for beginners due to the extensive amount of information
  • Some guidelines might be opinionated and may not fit all project requirements
  • Requires frequent updates to keep up with the rapidly evolving Android ecosystem
  • Lacks interactive examples or code snippets for immediate implementation

Getting Started

To get started with the ribot/android-guidelines:

  1. Visit the GitHub repository: https://github.com/ribot/android-guidelines
  2. Read through the main README.md file for an overview of the guidelines
  3. Explore the different sections, such as project_and_code_guidelines.md and architecture_guidelines.md
  4. Implement the guidelines in your Android projects as needed
  5. Refer back to the repository for updates and new best practices

Competitor Comparisons

Do's and Don'ts for Android development, by Futurice developers

Pros of android-best-practices

  • More comprehensive coverage of Android development topics
  • Regularly updated with contributions from the community
  • Includes practical examples and code snippets for better understanding

Cons of android-best-practices

  • Less structured organization compared to android-guidelines
  • May be overwhelming for beginners due to the breadth of information
  • Some sections lack in-depth explanations

Code Comparison

android-best-practices:

class MyActivity : AppCompatActivity() {
    private lateinit var viewModel: MyViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        viewModel = ViewModelProvider(this).get(MyViewModel::class.java)
    }
}

android-guidelines:

public class MyActivity extends AppCompatActivity {
    private MyViewModel mViewModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mViewModel = new ViewModelProvider(this).get(MyViewModel.class);
    }
}

The code comparison shows that android-best-practices uses Kotlin, while android-guidelines uses Java. The android-best-practices example demonstrates more modern Android development practices with concise Kotlin syntax.

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Pros of AndroidSlidingUpPanel

  • Provides a specific UI component for sliding panels
  • Includes a demo app for easy visualization and testing
  • Offers customizable animation and drag behavior

Cons of AndroidSlidingUpPanel

  • Limited scope, focusing only on sliding panels
  • May require more frequent updates to maintain compatibility
  • Less comprehensive in terms of overall Android development guidelines

Code Comparison

AndroidSlidingUpPanel:

mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
mLayout.addPanelSlideListener(new PanelSlideListener() {
    @Override
    public void onPanelSlide(View panel, float slideOffset) {
        Log.i(TAG, "onPanelSlide, offset " + slideOffset);
    }
});

android-guidelines:

class MyViewModel @Inject constructor(
    private val myRepository: MyRepository
) : ViewModel() {
    fun doSomething() {
        // ViewModel logic
    }
}

Summary

AndroidSlidingUpPanel is a specialized library for implementing sliding panels in Android apps, offering a specific UI component with customizable behavior. In contrast, android-guidelines provides a comprehensive set of best practices and coding standards for Android development. While AndroidSlidingUpPanel excels in its niche, android-guidelines offers broader guidance for overall project structure, architecture, and coding conventions.

A curated list of awesome Android UI/UX libraries

Pros of awesome-android-ui

  • Extensive collection of UI libraries and components
  • Regularly updated with new and trending UI resources
  • Categorized for easy navigation and discovery

Cons of awesome-android-ui

  • Lacks detailed guidelines for implementation
  • May overwhelm developers with too many options
  • Doesn't provide best practices for UI/UX design

Code comparison

android-guidelines:

public class MyActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my);
    }
}

awesome-android-ui (example from a listed library):

MaterialCalendarView calendarView = (MaterialCalendarView) findViewById(R.id.calendarView);
calendarView.setOnDateChangedListener(new OnDateSelectedListener() {
    @Override
    public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
        // Handle date selection
    }
});

Summary

android-guidelines focuses on providing comprehensive coding standards and best practices for Android development, while awesome-android-ui serves as a curated list of UI libraries and components. android-guidelines offers more in-depth guidance for overall project structure and coding conventions, whereas awesome-android-ui excels in showcasing a wide variety of UI options for developers to enhance their app's visual appeal and user experience.

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.

Pros of architecture-samples

  • Provides multiple architecture examples (MVI, MVVM, etc.)
  • Regularly updated with the latest Android development practices
  • Includes Jetpack Compose examples

Cons of architecture-samples

  • More complex and potentially overwhelming for beginners
  • Focuses primarily on architecture, less on general coding guidelines
  • May require more time to understand and implement in projects

Code Comparison

architecture-samples (MVVM example):

@HiltViewModel
class TasksViewModel @Inject constructor(
    private val tasksRepository: TasksRepository
) : ViewModel() {
    private val _forceUpdate = MutableLiveData(false)
    val tasks: LiveData<Result<List<Task>>> = _forceUpdate.switchMap { forceUpdate ->
        if (forceUpdate) {
            _dataLoading.value = true
            viewModelScope.launch {
                tasksRepository.refreshTasks()
                _dataLoading.value = false
            }
        }
        tasksRepository.observeTasks().switchMap { filterTasks(it) }
    }
}

android-guidelines:

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

The architecture-samples repository provides more advanced and modern code examples, while android-guidelines focuses on basic structure and naming conventions.

:fire: Android developers should collect the following utils(updating).

Pros of AndroidUtilCode

  • Extensive collection of ready-to-use utility functions and classes
  • Actively maintained with frequent updates and contributions
  • Comprehensive documentation and examples for each utility

Cons of AndroidUtilCode

  • Large codebase may increase app size if not properly optimized
  • Some utilities may be overkill for simpler projects
  • Potential dependency on third-party code for core functionality

Code Comparison

AndroidUtilCode:

// Check if the network is connected
boolean isNetworkConnected = NetworkUtils.isConnected();

// Get device screen width in pixels
int screenWidth = ScreenUtils.getScreenWidth();

// Toast a message
ToastUtils.showShort("Hello, World!");

android-guidelines:

// No direct code examples provided
// Focuses on architectural guidelines and best practices
// Encourages custom implementations based on project needs

Summary

AndroidUtilCode offers a vast array of utility functions, making it ideal for rapid development and projects requiring extensive Android utilities. It's regularly updated and well-documented. However, it may introduce unnecessary code for simpler apps.

android-guidelines, on the other hand, provides architectural guidance and best practices without offering specific code implementations. It encourages developers to create custom solutions tailored to their project's needs, potentially resulting in a more optimized and lean codebase.

The choice between the two depends on the project's requirements, team expertise, and development approach.

Extensive Open-Source Guides for Android Developers

Pros of android_guides

  • More comprehensive coverage of Android development topics
  • Regularly updated with new content and examples
  • Includes interactive tutorials and step-by-step guides

Cons of android_guides

  • Less focused on specific coding style guidelines
  • May be overwhelming for beginners due to the breadth of content
  • Lacks a concise, easy-to-reference format for quick checks

Code Comparison

android_guides example (Activity lifecycle):

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // Initialize components here
}

android-guidelines example (Naming conventions):

public class SomeClass {
    public static final int SOME_CONSTANT = 42;
    public int publicField;
    private static MyClass singleton;
    int packagePrivate;
    private int mPrivate;
}

The android_guides repository provides more in-depth explanations and examples of Android concepts, while android-guidelines focuses on specific coding practices and conventions. android_guides is better suited for learning and reference, whereas android-guidelines serves as a quick reference for maintaining consistent code style within a team or project.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Thank you for your interest in ribot’s development work. Unfortunately there are no current plans to make any changes to this project in the near future, and it is not being maintained or updated. We hope you still find this a useful resource and you can check out the newest recommendations in Android Jetpack for more ideas!

Android Guidelines

List of guidelines that we use at ribot when developing for the Android platform.

License

Copyright 2015 Ribot Ltd.

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.