Skip to content

Commit

Permalink
Merge pull request #4 from skydoves/feature/androidx
Browse files Browse the repository at this point in the history
Migrating to AndroidX & Publish v2.0.2
  • Loading branch information
skydoves committed Nov 23, 2018
2 parents 5393bb1 + 612b344 commit d0fe007
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 63 deletions.
7 changes: 2 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ android {
}

dependencies {
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:design:$support_version"

implementation "com.jakewharton:butterknife:8.8.1"
annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation 'com.google.android.material:material:1.1.0-alpha01'

implementation project(":elasticviews")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

import com.google.android.material.snackbar.Snackbar;
import com.skydoves.elasticviews.ElasticCheckButton;

import butterknife.ButterKnife;
import butterknife.OnClick;
import androidx.appcompat.app.AppCompatActivity;

/**
* Developed by skydoves on 2017-01-21.
Expand All @@ -23,35 +21,30 @@ public class ExampleActivity0 extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example0);
ButterKnife.bind(this);
}

@OnClick({R.id.daybtn0, R.id.daybtn1, R.id.daybtn2, R.id.daybtn3, R.id.daybtn4, R.id.daybtn5, R.id.daybtn6})
public void ElasticCheckButtons(View v){
ElasticCheckButton elasticCheckButton = (ElasticCheckButton)v;
Snackbar.make(v, "[Change checked state] " + elasticCheckButton.getText().toString() + " : " + elasticCheckButton.isChecked(), Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
Snackbar.make(v, "[Change checked state] " + elasticCheckButton.getText().toString() + " : " + elasticCheckButton.isChecked(), 200).setActionTextColor(Color.WHITE).show();
}

@OnClick({R.id.layout_starttime, R.id.layout_endtime, R.id.layout_timeinterval})
public void ElasticLayout(View v){
Snackbar.make(v, "Pop-up likes 'TimePickerDialog'", Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
Snackbar.make(v, "Pop-up likes 'TimePickerDialog'", 200).setActionTextColor(Color.WHITE).show();
}

@OnClick({R.id.example0_ibtn_q_timeset01, R.id.example0_ibtn_q_timeset02})
public void ElasticImageViews(View v){
switch (v.getId()) {
case R.id.example0_ibtn_q_timeset01 :
Snackbar.make(v, "Alarm goes off between start-time and end-time", Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
Snackbar.make(v, "Alarm goes off between start-time and end-time", 200).setActionTextColor(Color.WHITE).show();
break;
case R.id.example0_ibtn_q_timeset02 :
Snackbar.make(v, "This is time interval description", Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
Snackbar.make(v, "This is time interval description", 200).setActionTextColor(Color.WHITE).show();
break;
}
}

@OnClick(R.id.elasticbtn_addalarm)
public void addNewAlarm(View v){
Toast.makeText(this, "a new Alarm added!", Toast.LENGTH_SHORT).show();
Toast.makeText(getBaseContext(), "a new Alarm added!", Toast.LENGTH_SHORT).show();
finish();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -17,9 +16,7 @@

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import androidx.appcompat.app.AppCompatActivity;

/**
* Developed by skydoves on 2017-01-21.
Expand All @@ -28,25 +25,21 @@

public class ExampleActivity1 extends AppCompatActivity {

private ArrayList<Listviewitem> data;
private ArrayList<Listviewitem> data = new ArrayList<>();
private ListviewAdapter adapter;

@BindView(R.id.example1_listview)
ListView listView;
private ListView listView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example1);
ButterKnife.bind(this);

data=new ArrayList();
adapter=new ListviewAdapter(this, R.layout.item, data);
adapter = new ListviewAdapter(this, R.layout.item, data);
listView = findViewById(R.id.example1_listview);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new ListViewItemClickListener());
}

@OnClick(R.id.example1_fab)
public void ElasticFloatingButtons(View v){
Listviewitem listviewitem = new Listviewitem(data.size()+"");
data.add(listviewitem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.google.android.material.snackbar.Snackbar;
import com.skydoves.elasticviews.ElasticAnimation;
import com.skydoves.elasticviews.ElasticFinishListener;

import butterknife.ButterKnife;
import butterknife.OnClick;
import androidx.appcompat.app.AppCompatActivity;

/**
* Developed by skydoves on 2017-01-21.
Expand All @@ -23,10 +21,8 @@ public class ExampleActivity2 extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example2);
ButterKnife.bind(this);
}

@OnClick({R.id.example2_view0, R.id.example2_view1, R.id.example2_view2, R.id.example2_view3, R.id.example2_imv, R.id.example2_textView0, R.id.example2_fab})
public void Views(View v) {
if(v.getId() == R.id.example2_view3) {
new ElasticAnimation(v).setScaleX(0.85f).setScaleY(0.85f).setDuration(500).setOnFinishListener(new ElasticFinishListener() {
Expand All @@ -37,10 +33,10 @@ public void onFinished() {
}).doAction();
}
else if(v.getId() == R.id.example2_imv)
Snackbar.make(v, "This is ElasticImageView", Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
Snackbar.make(v, "This is ElasticImageView", 200).setActionTextColor(Color.WHITE).show();
else if(v.getId() == R.id.example2_textView0)
new ElasticAnimation(v).setScaleX(0.75f).setScaleY(0.75f).setDuration(500).doAction();
else if(v.getId() == R.id.example2_fab)
Snackbar.make(v, "This is ElasticFloatActionButton", Snackbar.LENGTH_LONG).setActionTextColor(Color.WHITE).show();
Snackbar.make(v, "This is ElasticFloatActionButton", 200).setActionTextColor(Color.WHITE).show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import butterknife.ButterKnife;
import butterknife.OnClick;
import androidx.appcompat.app.AppCompatActivity;

/**
* Developed by skydoves on 2017-01-21.
Expand All @@ -19,20 +17,18 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
}

@OnClick({R.id.elasticbtn0, R.id.elasticbtn1, R.id.elasticbtn2})
public void ElasticButtons(View v) {
switch (v.getId()){
case R.id.elasticbtn0 :
startActivity(new Intent(this, ExampleActivity0.class));
startActivity(new Intent(getBaseContext(), ExampleActivity0.class));
break;
case R.id.elasticbtn1 :
startActivity(new Intent(this, ExampleActivity1.class));
startActivity(new Intent(getBaseContext(), ExampleActivity1.class));
break;
case R.id.elasticbtn2 :
startActivity(new Intent(this, ExampleActivity2.class));
startActivity(new Intent(getBaseContext(), ExampleActivity2.class));
break;
}
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/layout/activity_example0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="45dp"
android:onClick="ElasticCheckButtons"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand All @@ -70,6 +71,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="45dp"
android:onClick="ElasticCheckButtons"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand All @@ -84,6 +86,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="45dp"
android:onClick="ElasticCheckButtons"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand All @@ -98,6 +101,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="45dp"
android:onClick="ElasticCheckButtons"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand All @@ -112,6 +116,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="45dp"
android:onClick="ElasticCheckButtons"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand All @@ -126,6 +131,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="45dp"
android:onClick="ElasticCheckButtons"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand All @@ -140,6 +146,7 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="45dp"
android:onClick="ElasticCheckButtons"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand Down Expand Up @@ -190,6 +197,7 @@
android:layout_alignParentEnd="true"
android:src="@drawable/ic_question"
android:tint="#3d95c9"
android:onClick="ElasticImageViews"
app:imageview_scale="0.7"/>

</RelativeLayout>
Expand All @@ -200,6 +208,7 @@
android:layout_height="50dp"
android:layout_below="@+id/example0_tv02"
android:layout_marginTop="15dp"
android:onClick="ElasticLayout"
app:layout_round="20"
app:layout_scale="0.9"
app:layout_backgroundColor="#30354b">
Expand Down Expand Up @@ -240,6 +249,7 @@
android:layout_height="50dp"
android:layout_below="@+id/makealram_tv02"
android:layout_marginTop="15dp"
android:onClick="ElasticLayout"
app:layout_round="20"
app:layout_scale="0.9"
app:layout_backgroundColor="#30354b">
Expand Down Expand Up @@ -307,6 +317,7 @@
android:layout_alignParentEnd="true"
android:src="@drawable/ic_question"
android:tint="#3d95c9"
android:onClick="ElasticImageViews"
app:imageview_scale="0.7"/>

<com.skydoves.elasticviews.ElasticLayout
Expand All @@ -315,6 +326,7 @@
android:layout_height="50dp"
android:layout_below="@+id/example0_ibtn_q_timeset02"
android:layout_marginTop="15dp"
android:onClick="ElasticLayout"
app:layout_round="20"
app:layout_scale="0.9"
app:layout_backgroundColor="#30354b">
Expand Down Expand Up @@ -365,6 +377,7 @@
android:layout_centerHorizontal="true"
android:layout_marginLeft="64dp"
android:layout_marginRight="64dp"
android:onClick="addNewAlarm"
app:button_backgroundColor="#3d95c9"
app:button_round="0"
app:button_labelText="Add new alarm"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_example1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_margin="16dp"
android:onClick="ElasticFloatingButtons"
app:fabSize="normal"
app:fabutton_duration="250"
app:fabutton_scale="0.85"/>
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/res/layout/activity_example2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:onClick="Views"
app:button_backgroundColor="#30354b"
app:button_labelText="Elastic Button"
app:button_labelSize="16"
Expand All @@ -50,6 +51,7 @@
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:onClick="Views"
app:checkbutton_backgroundColor="#30354b"
app:checkbutton_duration="400"
app:checkbutton_labelColor="#ffffff"
Expand All @@ -65,6 +67,7 @@
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_margin="10dp"
android:onClick="Views"
app:layout_backgroundColor="#30354b"
app:layout_round="30"
app:layout_duration="500"
Expand Down Expand Up @@ -104,7 +107,8 @@
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_margin="10dp"
android:background="#30354b">
android:background="#30354b"
android:onClick="Views">

<TextView
android:id="@+id/example2_tv2"
Expand Down Expand Up @@ -144,6 +148,7 @@
android:layout_alignParentStart="true"
android:src="@drawable/ic_question"
android:tint="#3d95c9"
android:onClick="Views"
app:imageview_scale="0.7"/>

<TextView
Expand All @@ -154,7 +159,8 @@
android:text="TextView"
android:textColor="#ffffff"
android:textStyle="bold"
android:textSize="25dp"/>
android:textSize="25dp"
android:onClick="Views"/>

<com.skydoves.elasticviews.ElasticFloatingActionButton
android:id="@+id/example2_fab"
Expand All @@ -165,6 +171,7 @@
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:onClick="Views"
app:fabSize="normal"
app:fabutton_duration="400"
app:fabutton_scale="0.85"/>
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
android:layout_height="0dp"
android:layout_margin="20dp"
android:layout_weight="1"
android:onClick="ElasticButtons"
app:button_backgroundColor="#30354b"
app:button_duration="250"
app:button_labelSize="17"
Expand All @@ -70,6 +71,7 @@
android:layout_weight="1"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:onClick="ElasticButtons"
app:button_backgroundColor="#30354b"
app:button_duration="250"
app:button_round="20"
Expand All @@ -84,6 +86,7 @@
android:layout_height="0dp"
android:layout_weight="1"
android:layout_margin="20dp"
android:onClick="ElasticButtons"
app:button_backgroundColor="#30354b"
app:button_duration="250"
app:button_round="20"
Expand Down

0 comments on commit d0fe007

Please sign in to comment.