Skip to content

Commit 0680a34

Browse files
sickmartianscbtest
sickmartian
authored andcommitted
Initial Commit
0 parents  commit 0680a34

26 files changed

+573
-0
lines changed

.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#built application files
2+
*.apk
3+
*.ap_
4+
5+
# files for the dex VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
10+
11+
# generated files
12+
bin/
13+
gen/
14+
15+
# Local configuration file (sdk path, etc)
16+
local.properties
17+
18+
# Windows thumbnail db
19+
Thumbs.db
20+
21+
# OSX files
22+
.DS_Store
23+
24+
# Eclipse project files
25+
.classpath
26+
.project
27+
28+
# Android Studio
29+
*.iml
30+
.idea
31+
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
32+
.gradle
33+
build/

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 24
5+
buildToolsVersion "24.0.1"
6+
7+
defaultConfig {
8+
applicationId "com.sickmartian.quickalarmwidget"
9+
minSdkVersion 15
10+
targetSdkVersion 24
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
compile 'com.android.support:appcompat-v7:24.1.1'
25+
}

app/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/***REMOVED***/Library/Android/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}

app/src/main/AndroidManifest.xml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.sickmartian.quickalarmwidget">
3+
4+
<application
5+
android:allowBackup="true"
6+
android:icon="@mipmap/ic_launcher"
7+
android:label="@string/app_name"
8+
android:supportsRtl="true"
9+
android:theme="@style/AppTheme">
10+
11+
<receiver android:name="QuickAlarmWidgetProvider">
12+
<intent-filter>
13+
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
14+
</intent-filter>
15+
<meta-data android:name="android.appwidget.provider"
16+
android:resource="@xml/widget_info" />
17+
</receiver>
18+
19+
<service android:name="QuickAlarmWidgetService"
20+
android:permission="android.permission.BIND_REMOTEVIEWS" />
21+
22+
</application>
23+
24+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.sickmartian.quickalarmwidget;
2+
3+
import android.appwidget.AppWidgetManager;
4+
import android.appwidget.AppWidgetProvider;
5+
import android.content.Context;
6+
import android.content.Intent;
7+
import android.content.SharedPreferences;
8+
import android.net.Uri;
9+
import android.os.Bundle;
10+
import android.preference.PreferenceManager;
11+
import android.util.Log;
12+
import android.widget.RemoteViews;
13+
14+
/**
15+
* Created by ***REMOVED*** on 8/9/16.
16+
*/
17+
public class QuickAlarmWidgetProvider extends AppWidgetProvider {
18+
@Override
19+
public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) {
20+
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
21+
Log.d("QAWP", "onAppWidgetOptionsChanged");
22+
}
23+
24+
@Override
25+
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
26+
Log.d("QAWP", "onUpdate");
27+
for (int i=0; i<appWidgetIds.length; i++) {
28+
29+
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
30+
31+
Intent svcIntent = new Intent(context, QuickAlarmWidgetService.class);
32+
svcIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
33+
svcIntent.setData(Uri.parse(svcIntent.toUri(Intent.URI_INTENT_SCHEME)));
34+
35+
RemoteViews widget = new RemoteViews(context.getPackageName(), R.layout.quick_widget_layout);
36+
37+
widget.setRemoteAdapter(appWidgetIds[i], R.id.quick_widget_list, svcIntent);
38+
appWidgetManager.updateAppWidget(appWidgetIds[i], widget);
39+
}
40+
41+
super.onUpdate(context, appWidgetManager, appWidgetIds);
42+
}
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.sickmartian.quickalarmwidget;
2+
3+
import android.content.Context;
4+
import android.content.Intent;
5+
import android.widget.RemoteViews;
6+
import android.widget.RemoteViewsService;
7+
8+
/**
9+
* Created by ***REMOVED*** on 8/9/16.
10+
*/
11+
public class QuickAlarmWidgetService extends RemoteViewsService {
12+
@Override
13+
public RemoteViewsFactory onGetViewFactory(Intent intent) {
14+
return new QuickAlarmWidgetViewFactory(getApplicationContext());
15+
}
16+
17+
public final class QuickAlarmWidgetViewFactory implements RemoteViewsFactory {
18+
private final Context mAppContext;
19+
20+
public QuickAlarmWidgetViewFactory(Context applicationContext) {
21+
mAppContext = applicationContext;
22+
}
23+
24+
@Override
25+
public void onCreate() {
26+
27+
}
28+
29+
@Override
30+
public void onDataSetChanged() {
31+
32+
}
33+
34+
@Override
35+
public void onDestroy() {
36+
37+
}
38+
39+
@Override
40+
public int getCount() {
41+
return 10;
42+
}
43+
44+
@Override
45+
public RemoteViews getViewAt(int i) {
46+
return new RemoteViews(mAppContext.getPackageName(),
47+
R.layout.quick_widget_item_layout);
48+
}
49+
50+
@Override
51+
public RemoteViews getLoadingView() {
52+
return null;
53+
}
54+
55+
@Override
56+
public int getViewTypeCount() {
57+
return 1;
58+
}
59+
60+
@Override
61+
public long getItemId(int i) {
62+
return i;
63+
}
64+
65+
@Override
66+
public boolean hasStableIds() {
67+
return true;
68+
}
69+
}
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
android:orientation="horizontal"
4+
android:layout_height="wrap_content"
5+
android:layout_width="match_parent"
6+
android:gravity="center_horizontal"
7+
xmlns:android="http://schemas.android.com/apk/res/android">
8+
<ImageView
9+
android:id="@+id/one"
10+
android:background="@android:color/holo_blue_bright"
11+
android:layout_width="match_parent"
12+
android:layout_height="40dp" />
13+
</LinearLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:background="@android:color/holo_blue_bright"
4+
android:layout_width="@dimen/widget_width"
5+
android:layout_height="@dimen/widget_height"
6+
android:layout_margin="@dimen/widget_margin">
7+
<ListView
8+
xmlns:android="http://schemas.android.com/apk/res/android"
9+
android:id="@+id/quick_widget_list"
10+
android:divider="@null"
11+
android:dividerHeight="0dp"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent" />
14+
</FrameLayout>
3.34 KB
Loading
2.15 KB
Loading
4.73 KB
Loading
7.54 KB
Loading
10.2 KB
Loading

app/src/main/res/values/colors.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#3F51B5</color>
4+
<color name="colorPrimaryDark">#303F9F</color>
5+
<color name="colorAccent">#FF4081</color>
6+
</resources>

app/src/main/res/values/dimens.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<dimen name="widget_margin">8dp</dimen>
4+
<dimen name="widget_width">80dp</dimen>
5+
<dimen name="widget_height">300dp</dimen>
6+
</resources>

app/src/main/res/values/strings.xml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">Quick Alarm Widget</string>
3+
</resources>

app/src/main/res/values/styles.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5+
<!-- Customize your theme here. -->
6+
<item name="colorPrimary">@color/colorPrimary</item>
7+
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8+
<item name="colorAccent">@color/colorAccent</item>
9+
</style>
10+
11+
</resources>

app/src/main/res/xml/widget_info.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<appwidget-provider
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:minWidth="@dimen/widget_width"
5+
android:minHeight="@dimen/widget_height"
6+
android:updatePeriodMillis="0"
7+
android:autoAdvanceViewId="@+id/quick_widget_list"
8+
android:initialLayout="@layout/quick_widget_layout"
9+
android:resizeMode="none" />

build.gradle

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
jcenter()
6+
}
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:2.1.2'
9+
10+
// NOTE: Do not place your application dependencies here; they belong
11+
// in the individual module build.gradle files
12+
}
13+
}
14+
15+
allprojects {
16+
repositories {
17+
jcenter()
18+
}
19+
}
20+
21+
task clean(type: Delete) {
22+
delete rootProject.buildDir
23+
}

gradle.properties

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Project-wide Gradle settings.
2+
3+
# IDE (e.g. Android Studio) users:
4+
# Gradle settings configured through the IDE *will override*
5+
# any settings specified in this file.
6+
7+
# For more details on how to configure your build environment visit
8+
# http://www.gradle.org/docs/current/userguide/build_environment.html
9+
10+
# Specifies the JVM arguments used for the daemon process.
11+
# The setting is particularly useful for tweaking memory settings.
12+
# Default value: -Xmx10248m -XX:MaxPermSize=256m
13+
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14+
15+
# When configured, Gradle will run in incubating parallel mode.
16+
# This option should only be used with decoupled projects. More details, visit
17+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18+
# org.gradle.parallel=true

gradle/wrapper/gradle-wrapper.jar

52.4 KB
Binary file not shown.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Dec 28 10:00:20 PST 2015
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

0 commit comments

Comments
 (0)