Skip to content

Commit

Permalink
Merge pull request #1 from amirisback/CustomView
Browse files Browse the repository at this point in the history
create: Frogo Recycler View
  • Loading branch information
amirisback authored Dec 29, 2019
2 parents a90b831 + 4de3409 commit 5d924db
Show file tree
Hide file tree
Showing 24 changed files with 85 additions and 40 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

implementation project(':frogoviewadapter')
implementation project(':frogo')

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogorecyclerviewadapter
package com.frogobox.recycler

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.frogobox.frogorecyclerviewadapter">
package="com.frogobox.recycler">

<application
android:allowBackup="true"
Expand All @@ -9,8 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".javasample.DetailActivity"></activity>
<activity android:name=".kotlinsample.MainActivity">
<activity android:name="com.frogobox.recycler.javasample.DetailActivity"></activity>
<activity android:name="com.frogobox.recycler.kotlinsample.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.frogobox.frogorecyclerviewadapter.javasample;
package com.frogobox.recycler.javasample;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.widget.Toast;

import com.frogobox.frogorecyclerviewadapter.R;
import com.frogobox.frogorecyclerviewadapter.mdoel.ExampleModel;
import com.frogobox.frogoviewadapter.FrogoRecyclerViewListener;
import com.frogobox.recycler.R;
import com.frogobox.recycler.model.ExampleModel;
import com.frogobox.recycler.adapter.FrogoRecyclerViewListener;
import com.frogobox.recycler.view.FrogoRecyclerView;

import java.util.ArrayList;

Expand All @@ -34,9 +33,9 @@ private ArrayList<ExampleModel> listData(){
private void setupAdapter(){
DetailViewAdapter adapter = new DetailViewAdapter();
adapter.setupRequirement(this, listData(), R.layout.example_list_item);
RecyclerView recyclerView = findViewById(R.id.recycler_view);
FrogoRecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.isViewLinear();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.frogobox.frogorecyclerviewadapter.javasample;
package com.frogobox.recycler.javasample;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.frogobox.frogorecyclerviewadapter.R;
import com.frogobox.frogorecyclerviewadapter.mdoel.ExampleModel;
import com.frogobox.frogoviewadapter.FrogoRecyclerViewAdapter;
import com.frogobox.frogoviewadapter.FrogoRecyclerViewHolder;
import com.frogobox.recycler.R;
import com.frogobox.recycler.adapter.FrogoRecyclerViewAdapter;
import com.frogobox.recycler.adapter.FrogoRecyclerViewHolder;
import com.frogobox.recycler.model.ExampleModel;

import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.frogobox.frogorecyclerviewadapter.kotlinsample
package com.frogobox.recycler.kotlinsample

import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.frogobox.frogorecyclerviewadapter.R
import com.frogobox.frogorecyclerviewadapter.mdoel.ExampleModel
import com.frogobox.frogoviewadapter.FrogoRecyclerViewListener
import com.frogobox.recycler.R
import com.frogobox.recycler.model.ExampleModel
import com.frogobox.recycler.adapter.FrogoRecyclerViewListener
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity(), FrogoRecyclerViewListener<ExampleModel> {
class MainActivity : AppCompatActivity(),
FrogoRecyclerViewListener<ExampleModel> {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -34,7 +34,7 @@ class MainActivity : AppCompatActivity(), FrogoRecyclerViewListener<ExampleModel
R.layout.example_list_item
)
recycler_view.adapter = adapter
recycler_view.layoutManager = LinearLayoutManager(this)
recycler_view.isViewLinear()
}

override fun onItemClicked(data: ExampleModel) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.frogobox.frogorecyclerviewadapter.kotlinsample
package com.frogobox.recycler.kotlinsample

import android.view.View
import android.view.ViewGroup
import com.frogobox.frogorecyclerviewadapter.mdoel.ExampleModel
import com.frogobox.frogoviewadapter.FrogoRecyclerViewAdapter
import com.frogobox.frogoviewadapter.FrogoRecyclerViewHolder
import com.frogobox.recycler.model.ExampleModel
import com.frogobox.recycler.adapter.FrogoRecyclerViewAdapter
import com.frogobox.recycler.adapter.FrogoRecyclerViewHolder
import kotlinx.android.synthetic.main.example_list_item.view.*

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogorecyclerviewadapter.mdoel
package com.frogobox.recycler.model

/**
* Created by Faisal Amir
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_detail.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
<com.frogobox.recycler.view.FrogoRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
<com.frogobox.recycler.view.FrogoRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogoviewadapter
package com.frogobox.recycler

import org.junit.Test

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogoviewadapter
package com.frogobox.recycler

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.frogobox.frogoviewadapter" />
package="com.frogobox.recycler" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogoviewadapter
package com.frogobox.recycler.adapter

import android.view.LayoutInflater
import android.view.View
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogoviewadapter
package com.frogobox.recycler.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogoviewadapter
package com.frogobox.recycler.adapter

/**
* Created by Faisal Amir
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.frogobox.recycler.view

import android.content.Context
import android.util.AttributeSet
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager

/**
* Created by Faisal Amir
* FrogoBox Inc License
* =========================================
* frogo-recycler-view-adapter
* Copyright (C) 30/12/2019.
* All rights reserved
* -----------------------------------------
* Name : Muhammad Faisal Amir
* E-mail : [email protected]
* Github : github.com/amirisback
* LinkedIn : linkedin.com/in/faisalamircs
* -----------------------------------------
* FrogoBox Software Industries
* com.frogobox.frogoviewadapter.view
*
*/
class FrogoRecyclerView : RecyclerView {

constructor(context: Context) : super(context)

constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)

constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)

fun isViewLinear() {
layoutManager = LinearLayoutManager(context)
}

fun isViewStaggeredGrid(spanCount : Int) {
layoutManager = StaggeredGridLayoutManager(spanCount, StaggeredGridLayoutManager.VERTICAL)
}

}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.frogobox.frogorecyclerviewadapter
package com.frogobox.recycler

import org.junit.Test

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include ':app', ':frogoviewadapter'
include ':app', ':frogo'
rootProject.name='FrogoRecyclerViewAdapter'

0 comments on commit 5d924db

Please sign in to comment.