Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aquaflamingo committed Apr 1, 2017
0 parents commit bad6d77
Show file tree
Hide file tree
Showing 32 changed files with 870 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.iml
.gradle/*
.idea/*
.idea/
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
.gradle/
build/*
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
29 changes: 29 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.0'
testCompile 'junit:junit:4.12'
compile project(path: ':shareable')
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/robert/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# 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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.robertsimoes.socialsharing;

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.*;

/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.robertsimoes.socialsharing", appContext.getPackageName());
}
}
20 changes: 20 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.robertsimoes.socialsharing">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
123 changes: 123 additions & 0 deletions app/src/main/java/com/robertsimoes/socialsharing/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package com.robertsimoes.socialsharing;

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

import com.robertsimoes.shareable.Shareable;


public class MainActivity extends AppCompatActivity {

Button fb;
Button twitter;
Button gplus;
Button messages;
Button email;
Button linkedin;
Button tumblr;
Button reddit;
Button defaultb;

String message = "This is my share message!";
String url = "http://example.com";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fb = (Button) findViewById(R.id.button_facebook);
twitter= (Button) findViewById(R.id.button_twitter);
gplus = (Button) findViewById(R.id.button_gplus);
messages= (Button) findViewById(R.id.button_messages);
email= (Button) findViewById(R.id.button_email);
linkedin= (Button) findViewById(R.id.button_linkedin);
tumblr= (Button) findViewById(R.id.button_tumblr);
reddit= (Button) findViewById(R.id.button_reddit);
defaultb = (Button) findViewById(R.id.button_default);



}

public void facebook(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.FACEBOOK)
.url(url)
.build();
shareInstance.share();
}

public void twitter(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.TWITTER)
.url(url)
.build();
shareInstance.share();
}
public void plus(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.GOOGLE_PLUS)
.url(url)
.build();
shareInstance.share();
}

public void messages(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.MESSAGES)
.url(url)
.build();
shareInstance.share();
}

public void linkedin(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.LINKED_IN)
.url(url)
.build();
shareInstance.share();
}

public void email(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.EMAIL)
.url(url)
.build();
shareInstance.share();
}

public void reddit(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.REDDIT)
.url(url)
.build();
shareInstance.share();
}

public void tumblr(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.socialChannel(Shareable.Builder.TUMBLR)
.url(url)
.build();
shareInstance.share();
}

public void defaultAction(View v) {
Shareable shareInstance = new Shareable.Builder(this)
.message(message)
.url(url)
.build();
shareInstance.share();
}

}
80 changes: 80 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.robertsimoes.socialsharing.MainActivity">
<Button
android:onClick="facebook"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Facebook"
android:id="@+id/button_facebook"
android:layout_centerHorizontal="true"/>
<Button
android:onClick="twitter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Twitter"
android:id="@+id/button_twitter"
android:layout_centerHorizontal="true"/>
<Button
android:onClick="reddit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Reddit"
android:id="@+id/button_reddit"
android:layout_centerHorizontal="true"/>
<Button
android:onClick="plus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Google Plus"
android:id="@+id/button_gplus"
android:layout_centerHorizontal="true"/>

<Button
android:onClick="linkedin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Linkedin"
android:id="@+id/button_linkedin"
android:layout_centerHorizontal="true"/>
<Button
android:onClick="messages"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Messages"
android:id="@+id/button_messages"
android:layout_centerHorizontal="true"/>

<Button
android:onClick="email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Email"
android:id="@+id/button_email"
android:layout_centerHorizontal="true"/>

<Button
android:onClick="tumblr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Tumblr"
android:id="@+id/button_tumblr"
android:layout_centerHorizontal="true"/>
<Button
android:onClick="defaultAction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Default"
android:id="@+id/button_default"
android:layout_centerHorizontal="true"/>

</LinearLayout>
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.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/mipmap-mdpi/ic_launcher.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/mipmap-xhdpi/ic_launcher.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/mipmap-xxhdpi/ic_launcher.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/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/src/main/res/values-w820dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
6 changes: 6 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">SocialSharing</string>
</resources>
11 changes: 11 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.robertsimoes.socialsharing;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
Loading

0 comments on commit bad6d77

Please sign in to comment.