Permalink
Browse files

Created activity that mimics dialog to prompt user.

  • Loading branch information...
1 parent a9441d9 commit 9c40544f53b368773e75fa104c1e2b48629ce040 @hdweiss hdweiss committed Mar 22, 2012
View
@@ -9,7 +9,7 @@
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
@@ -39,7 +39,6 @@
<action android:name="com.matburt.mobileorg.Synchronizer.action.SYNC_UPDATE" />
</intent-filter>
</service>
-
<service android:name=".Services.SyncService" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
@@ -49,11 +48,10 @@
</service>
<receiver android:name=".Plugin.Synchronize" >
- <intent-filter>
- <action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING" />
- </intent-filter>
+ <intent-filter>
+ <action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING" />
+ </intent-filter>
</receiver>
-
<receiver android:name=".Services.MobileOrgStartupIntentReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
@@ -64,7 +62,7 @@
<activity
android:name=".Gui.OutlineActivity"
- android:label="MobileOrg"
+ android:label="MobileOrg"
android:theme="@style/Theme.MobileOrgActionbar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -76,7 +74,7 @@
</activity>
<activity
android:name=".Gui.NodeViewActivity"
- android:label="Org View"
+ android:label="Org View"
android:theme="@style/Theme.MobileOrgActionbar" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
@@ -115,12 +113,12 @@
</activity>
<activity
android:name=".Plugin.SyncEditActivity"
- android:label="@string/sync_plugin"
+ android:exported="true"
android:icon="@drawable/icon"
- android:exported="true" >
- <intent-filter>
- <action android:name="com.twofortyfouram.locale.intent.action.EDIT_SETTING" />
- </intent-filter>
+ android:label="@string/sync_plugin" >
+ <intent-filter>
+ <action android:name="com.twofortyfouram.locale.intent.action.EDIT_SETTING" />
+ </intent-filter>
</activity>
<activity
android:name=".Settings.SettingsActivity"
@@ -134,7 +132,9 @@
android:name=".Gui.CertificateConflictActivity"
android:label="MobileOrg Certificate Conflict" >
</activity>
- <activity android:name=".Gui.FileDecryptionActivity"></activity><activity
+ <activity android:name=".Gui.FileDecryptionActivity" >
+ </activity>
+ <activity
android:name=".Synchronizers.DropboxAuthActivity"
android:label="Dropbox Authentication" >
</activity>
@@ -154,8 +154,14 @@
android:name=".Settings.ScpSettingsActivity"
android:label="Scp Settings" >
</activity>
- <service android:name=".Services.TimeclockService"></service>
-
+
+ <service android:name=".Services.TimeclockService" >
+ </service>
+
+ <activity
+ android:name=".Services.TimeclockDialog"
+ android:theme="@android:style/Theme.Dialog" >
+ </activity>
</application>
</manifest>
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <TextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/timeclock_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical|center_horizontal"
+ android:text=""
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:paddingBottom="20dp"
+ />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_below="@id/timeclock_text"
+ android:gravity="center" >
+
+ <Button
+ android:id="@+id/timeclock_save"
+ android:layout_width="70dp"
+ android:layout_height="wrap_content"
+ android:paddingRight="10dp"
+ android:text="Save" />
+
+ <Button
+ android:id="@+id/timeclock_edit"
+ android:layout_width="70dp"
+ android:layout_height="wrap_content"
+ android:paddingRight="10dp"
+ android:text="Edit" />
+
+ <Button
+ android:id="@+id/timeclock_cancel"
+ android:layout_width="70dp"
+ android:layout_height="wrap_content"
+ android:text="Cancel" />
+ </LinearLayout>
+</RelativeLayout>
@@ -0,0 +1,54 @@
+package com.matburt.mobileorg.Services;
+
+import com.matburt.mobileorg.R;
+import com.matburt.mobileorg.Parsing.MobileOrgApplication;
+import com.matburt.mobileorg.Parsing.NodeWrapper;
+import com.matburt.mobileorg.Parsing.OrgDatabase;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.TextView;
+
+public class TimeclockDialog extends Activity {
+
+ private long node_id;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ requestWindowFeature(Window.FEATURE_LEFT_ICON);
+ setContentView(R.layout.timeclock_dialog);
+ getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,
+ android.R.drawable.ic_dialog_alert);
+
+ // TODO Pass proper node id from TimeclockService
+ Intent intent = getIntent();
+ this.node_id = intent.getLongExtra(TimeclockService.NODE_ID, -1);
+
+ MobileOrgApplication appInst = (MobileOrgApplication) getApplication();
+ OrgDatabase db = appInst.getDB();
+ Log.d("MobileOrg", "Node id: " + node_id);
+ NodeWrapper node = new NodeWrapper(db.getNode(node_id));
+
+
+ setTitle("MobileOrg Timeclock");
+ TextView textView = (TextView) findViewById(R.id.timeclock_text);
+ textView.setText(node.getName());
+
+ Button button = (Button) findViewById(R.id.timeclock_cancel);
+ button.setOnClickListener(cancelListener);
+ node.close();
+ }
+
+ private View.OnClickListener cancelListener = new View.OnClickListener() {
+ public void onClick(View v) {
+ finish();
+ }
+ };
+}
@@ -8,7 +8,6 @@
import android.os.IBinder;
import com.matburt.mobileorg.R;
-import com.matburt.mobileorg.Gui.OutlineActivity;
import com.matburt.mobileorg.Parsing.MobileOrgApplication;
import com.matburt.mobileorg.Parsing.NodeWrapper;
import com.matburt.mobileorg.Parsing.OrgDatabase;
@@ -50,15 +49,19 @@ private void showNotification(long node_id) {
Notification notification = new Notification(R.drawable.icon, node.getName(),
System.currentTimeMillis());
+ Intent intent = new Intent(this, TimeclockDialog.class);
+ intent.putExtra(NODE_ID, node_id);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
- new Intent(this, OutlineActivity.class), 0);
+ intent, 0);
notification.setLatestEventInfo(this, getText(R.string.app_name), node.getName(),
contentIntent);
+ node.close();
mNM.notify(notificationID, notification);
}
+ @SuppressWarnings("unused")
private void cancelNotification() {
mNM.cancel(notificationID);
}

0 comments on commit 9c40544

Please sign in to comment.