Skip to content

Commit

Permalink
motion emplemented
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-ritik committed Jul 20, 2018
1 parent 246eb81 commit a2fbfc4
Show file tree
Hide file tree
Showing 18 changed files with 558 additions and 10 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation project(path: ':emojireactionlibrary')

}
32 changes: 32 additions & 0 deletions app/src/main/java/com/ritik/emojireactionview/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,44 @@

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.ritik.emojireactionlibrary.ClickInterface;
import com.ritik.emojireactionlibrary.EmojiReactionView;

public class MainActivity extends AppCompatActivity {

EmojiReactionView myImage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

myImage=findViewById(R.id.image);

myImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

}
});
myImage.setOnEmojiClickListener(new ClickInterface() {
@Override
public void onEmoji1Clicked(int x, int y) {
Toast.makeText(MainActivity.this, "em1!", Toast.LENGTH_SHORT).show();

}

@Override
public void onEmoji2Clicked(int x, int y) {
Toast.makeText(MainActivity.this, "em2!", Toast.LENGTH_SHORT).show();

}
});
}

public void test(View view) {
Toast.makeText(this, "tested!", Toast.LENGTH_SHORT).show();
}
}
Binary file added app/src/main/res/drawable/android1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/em1_min.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/em2_min.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 33 additions & 9 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_ph"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="vertical">

<Button
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
android:onClick="test"
/>

<com.ritik.emojireactionlibrary.EmojiReactionView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/android1"
app:emojis="@array/emoji"/>

<!--<ImageView-->
<!--android:id="@+id/image1"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_alignParentTop="true"-->
<!--android:scaleType="fitXY"-->
<!--android:src="@drawable/back" />-->

</LinearLayout>

</android.support.constraint.ConstraintLayout>
5 changes: 5 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<resources>
<string name="app_name">EmojiReactionView</string>

<array name="emoji">
<item>@drawable/em1_min</item>
<item>@drawable/em2_min</item>
</array>
</resources>
1 change: 1 addition & 0 deletions emojireactionlibrary/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
34 changes: 34 additions & 0 deletions emojireactionlibrary/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 27



defaultConfig {
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
21 changes: 21 additions & 0 deletions emojireactionlibrary/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ritik.emojireactionlibrary;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.ritik.emojireactionlibrary.test", appContext.getPackageName());
}
}
2 changes: 2 additions & 0 deletions emojireactionlibrary/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ritik.emojireactionlibrary" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.ritik.emojireactionlibrary;

public interface ClickInterface {

void onEmoji1Clicked(int x, int y);

void onEmoji2Clicked(int x, int y);

}
Loading

0 comments on commit a2fbfc4

Please sign in to comment.