Skip to content

Commit

Permalink
Add a single UI page that starts the service for convinience
Browse files Browse the repository at this point in the history
  • Loading branch information
majido committed Jan 31, 2015
1 parent ff84950 commit 6b4d80d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ca.zgrs.clipper" android:versionCode="1" android:versionName="1.0-SNAPSHOT" android:enabled="true">
package="ca.zgrs.clipper" android:versionCode="1" android:versionName="1.1" android:enabled="true">

<application android:icon="@drawable/icon" android:label="@string/app_name">
<service android:name=".ClipboardService"
<activity android:name=".Main" android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".ClipboardService"
android:exported="true"
android:enabled="true">
</service>
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/ca/zgrs/clipper/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ca.zgrs.clipper;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;


public class Main extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

//start clipboard service
Intent serviceIntent = new Intent(this, ClipboardService.class);
startService(serviceIntent);
}
}
16 changes: 13 additions & 3 deletions src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:weightSum="1">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
android:text="@string/started"
android:singleLine="false"
android:enabled="true"
android:textStyle="bold"
android:id="@+id/head" />

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/usage"
android:enabled="true"
android:id="@+id/sub" />
</LinearLayout>
10 changes: 8 additions & 2 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello clipboard-service!</string>
<string name="app_name">clipboard-service</string>
<string name="started">Clipper service is started!</string>
<string name="usage">
Usage: You can copy to or paste from clipboard from adb shell using the
following commands:\n
* am broadcast -a clipper.set -e text \'This may be pasted now\' \n
* am broadcast -a clipper.get
</string>
<string name="app_name">Clipper</string>
</resources>

0 comments on commit 6b4d80d

Please sign in to comment.