Skip to content

GloryConventionLint is convention lint for IDE Android Studio support java and kotlin

License

Notifications You must be signed in to change notification settings

rollingglory/GloryConventionLint-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RollingGlory is Company or Creative Digital Media studio based in Bandung, Indonesia.

   

GloryConventionLint-android

GloryConventionLint is judgment code for Convention lint in IDE Android Studio support java and kotlin.

Link for Configuration Gradle

Convention

Example

FAQ

Next to do

 

 

Configuration Gradle for Module

Don't forget, configuration gradle your must use lintChecks, don't use implementation, kapt or api.

dependencies {
   lintChecks 'com.rollingglory:gloryconventionlint-android:0.0.3'
}

Configuration Gradle for Project

allprojects {
    repositories {
      maven {
            url  "https://dl.bintray.com/rollingglory/GloryConventionLint-android"
        }
    }
}

Convention

CamelCase Convention

Example phrase : areInject, whatFlavor, loadMore

  LOCAL GLOBAL
variable method class variable method class
not final ✔️ ✔️
not static ✔️ ✔️
not final static ✔️ ✔️
final
static ✔️ ✔️
final static

   

CapitalizationCase Convention

Example phrase : LoginActivity, UserFragment, UserSession

  LOCAL GLOBAL
variable method class variable method class
not final ✔️ ✔️
not static ✔️ ✔️
not final static ✔️ ✔️
final ✔️ ✔️
static ✔️ ✔️
final static ✔️ ✔️

   

ClassCase Convention

Extends Of Package's Naming Convention Example Phrase
PreFix PostFix
Activity
AppCompatActivity
FragmentActivity
android.app.Activity
android.support.v7.app.AppCompatActivity
androidx.appcompat.app.AppCompatActivity
android.support.v4.app.FragmentActivity
androidx.fragment.app.FragmentActivity
Activity YourclassActivity
Fragment
DialogFragment
android.support.v4.app.Fragment
androidx.fragment.app.Fragment
android.support.v4.app.DialogFragment
androidx.fragment.app.DialogFragment
Fragment YourclassFragment
Service
IntentService
JobService
JobIntentService
android.app.Service
android.app.IntentService
android.app.job.JobService
android.support.v4.app.JobIntentService
androidx.core.app.JobIntentService
Service YourclassService
BroadcastReceiver android.content.BroadcastReceiver Receiver YourclassReceiver

   

ConstantCase Convention

Example phrase : SCOPE_USER, SIZE_BLOCK, POSTION_DEFAULT

  LOCAL GLOBAL
variable method class variable method class enum
not final ✔️
not static ✔️
not final static ✔️
final
static
final static ✔️ ✔️

   

MethodCase Convention

If class extends AppCompatActivity, you should override method onCreate(Bundle savedInstanceState) first sequence.

class HomeActivity extends AppCompatActivity{
   //onCreate method should first squence in class
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
   }
   
   @Override
   protected void onPause() {
     super.onPause();
   }

   @Override
   protected void onResume() {
     super.onResume();
   }

   

XmlCase Convention

Resource Naming Convention Example Phrase
PreFix's PostFix's
Layout activity_
fragment_
layout_
item_
dialog_
partial_
fragment_login
Drawable ic_
bg_
ic_notification
Menu menu_
menu_dashboard
Font
-regular
-bold
-semi-bold
-italic
robot-regular

   

XMLIDCase Convention

Class Package's ID Convention Example ID's
PreFix's PostFix's
TextView android.widget.TextView @+id/tv_ @+id/tv_yourid
EditText android.widget.EditText @+id/et_ @+id/et_yourid
Button android.widget.Button @+id/btn_ @+id/btn_yourid
ImageView android.widget.ImageView @+id/iv_ @+id/iv_yourid
LinearLayout
RelativeLayout
ConstraintLayout
CoordinatorLayout
android.widget.LinearLayout
android.widget.RelativeLayout
android.support.constraint.ConstraintLayout
androidx.constraintlayout.widget.ConstraintLayout
android.support.design.widget.CoordinatorLayout
androidx.coordinatorlayout.widget.CoordinatorLayout
@+id/content_ @+id/content_yourid
AppBarLayout android.support.design.widget.AppBarLayout
com.google.android.material.appbar.AppBarLayout
@+id/ab_ @+id/ab_yourid
CollapsingToolbarLayout android.support.design.widget.CollapsingToolbarLayout
com.google.android.material.appbar.CollapsingToolbarLayout
@+id/ctl_ @+id/ctl_yourid
NavigationMenu android.support.design.internal.NavigationMenu
com.google.android.material.internal.NavigationMenu
@+id/nm_ @+id/nm_yourid
NavigationMenu android.support.v7.widget.CardView
androidx.cardview.widget.CardView
@+id/cv_ @+id/cv_yourid
TabLayout android.support.design.widget.TabLayout
com.google.android.material.tabs.TabLayout
@+id/tab_ @+id/tab_yourid
TabItem android.support.design.widget.TabItem
com.google.android.material.tabs.TabItem
@+id/tab_item_ @+id/tab_item_yourid
TextInputLayout android.support.design.widget.TextInputLayout
com.google.android.material.textfield.TextInputLayout
@+id/til_ @+id/til_yourid
DrawerLayout android.support.v4.widget.DrawerLayout
androidx.drawerlayout.widget.DrawerLayout
@+id/dl_ @+id/dl_yourid
FloatingActionButton android.support.design.widget.FloatingActionButton
com.google.android.material.floatingactionbutton.FloatingActionButton
@+id/fab_ @+id/fab_yourid

   

Example

Example Report Issue CamelCase

   

Example Report Issue MethodCase

   

Example Report Issue ClassCase

   

Frequently Asked Questions

Can this work for java and kotlin languages?

GloryConventionLint will automatically create rules for both languages.

Can this be used for projects in my company?

Please this can be used for your company's project, with MIT License.

Does this work for an intellij java IDE?

This might work for the Java Intelij IDE, but it's more recommended to use Intelij Android Studio

Does this work for all versions of IDE Android Studio?

*This works for android studio 3.x.x, if you still use android studio 2.x.x please open Next to do

   

Next to do

Link for android version 2.x.x

XMLValueCase Convention

GradleModuleCase Convention

GradleProjectCase Convention

   

Other Information

You can follow us at https://rollingglory.com/

About

GloryConventionLint is convention lint for IDE Android Studio support java and kotlin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages