Skip to content

Commit

Permalink
发行第一个版本
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainHuangsh committed May 13, 2017
1 parent a9b9058 commit 4a9e1e7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 24 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "com.example.owenh.alarmo"
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "1.0.09.20170504beta"
versionCode 3
versionName "1.1.01.20170513"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
19 changes: 3 additions & 16 deletions app/src/main/java/com/example/owenh/alarmo/activity/AlarmMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Switch;
import android.widget.Toast;

import com.example.owenh.alarmo.R;
import com.example.owenh.alarmo.services.RingService;
Expand All @@ -29,13 +30,11 @@ public class AlarmMain extends AppCompatActivity implements
private Switch mSwitch;
private int isChecked = 0;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alram_main);
setTitle("Alarmo");
// VibrateUtil.vibrate(AlarmMain.this,100);
init();
findView();
setListener();
Expand Down Expand Up @@ -97,29 +96,17 @@ public void onClick(View view) {
case R.id.on_off_service2:
Intent serviceIntent = new Intent(AlarmMain.this, RingService.class);
if (isChecked == 0) {
Log.i("huangshaohuaSwitch", "on");
startService(serviceIntent);
Toast.makeText(AlarmMain.this,"打开整点报时",Toast.LENGTH_SHORT).show();
isChecked++;
} else {
Log.i("huangshaohuaSwitch", "off");
stopService(serviceIntent);
Toast.makeText(AlarmMain.this,"关闭整点报时",Toast.LENGTH_SHORT).show();
isChecked = 0;
}
break;
default:
break;
}
}


/**
* 获取系统铃声
*/
private Uri getSystemDefultRingtoneUri() {

return RingtoneManager.getActualDefaultRingtoneUri(this,
RingtoneManager.TYPE_NOTIFICATION);
}


}
Binary file added app/src/main/res/drawable/alarm_clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 10 additions & 4 deletions app/src/main/res/layout/activity_alram_main.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?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:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#000000"
android:orientation="vertical">

Expand All @@ -19,18 +21,22 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#00FFFFFF"
android:src="@drawable/alarmo_watch_gray"
android:src="@drawable/alarm_clock"
android:text="@string/to_watch" />

<ToggleButton
android:visibility="gone"
android:id="@+id/on_off_service"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:visibility="gone" />

<Switch
app:theme="@style/SCBSwitch"
android:id="@+id/on_off_service2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
tools:ignore="MissingPrefix" />
</LinearLayout>


Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="blue">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="white">#FFFFFF</color>
<color name="gray">#969696</color>
</resources>
17 changes: 16 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<!-- Customize your theme here. -->
<item name="colorPrimary">#3c3f41</item>
<item name="colorPrimaryDark">#3c3f41</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">#106c99</item>
<item name="colorControlNormal">@color/gray</item>
<item name="colorControlHighlight">@color/gray</item>
<item name="colorControlActivated">#106c99</item>
</style>

<style name="AppTheme2">
Expand Down Expand Up @@ -33,4 +36,16 @@
<item name="android:backgroundDimEnabled">false</item>
</style>

<style name="SCBSwitch" parent="Theme.AppCompat.Light">
<!-- active thumb & track color (30% transparency) -->
<item name="colorControlActivated">#46bdbf</item>

<!-- inactive thumb color -->
<item name="colorSwitchThumbNormal">#ffffff
</item>

<!-- inactive track color (30% transparency) -->
<item name="android:colorForeground">#42221f1f
</item>
</style>
</resources>

0 comments on commit 4a9e1e7

Please sign in to comment.