Skip to content

Commit

Permalink
首次导入
Browse files Browse the repository at this point in the history
  • Loading branch information
will86 committed Sep 18, 2015
1 parent 58d8e73 commit 0365595
Show file tree
Hide file tree
Showing 23 changed files with 2,787 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ColorPicker</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
28 changes: 28 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.jileniao.colorpicker"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />

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

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

</manifest>
Binary file added ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions proguard-project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# 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 *;
#}
14 changes: 14 additions & 0 deletions project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-19
Binary file added res/drawable-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.
27 changes: 27 additions & 0 deletions res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<RelativeLayout 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"
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=".MainActivity" >

<Button
android:id="@+id/color_btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="showColorPicker1"
android:text="Color -- 1" />

<Button
android:id="@+id/color_btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/color_btn1"
android:layout_marginTop="20dp"
android:onClick="showColorPicker2"
android:text="Color -- 2" />

</RelativeLayout>
87 changes: 87 additions & 0 deletions res/layout/dialog_color_picker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 Daniel Nilsson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp" >

<net.jileniao.colorpicker.ver2.ColorPickerView
android:id="@+id/color_picker_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="portrait" />

<LinearLayout
android:id="@+id/text_hex_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="@string/label_press_color"
android:textAppearance="?android:attr/textAppearanceSmall" />

<EditText
android:id="@+id/hex_val"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="HEX"
android:imeOptions="actionDone"
android:inputType="textCapCharacters"
android:maxLength="7"
android:singleLine="true"
android:visibility="gone" >
</EditText>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal" >

<net.jileniao.colorpicker.ver2.ColorPickerPanelView
android:id="@+id/old_color_panel"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5" />

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text=""
android:textSize="20sp" />

<net.jileniao.colorpicker.ver2.ColorPickerPanelView
android:id="@+id/new_color_panel"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
</LinearLayout>

</LinearLayout>
7 changes: 7 additions & 0 deletions res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<resources>

<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>

</resources>
11 changes: 11 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">ColorPicker</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>

<string name="title_test_color">Set Color</string>
<string name="label_press_color">Press on color to apply</string>

</resources>
20 changes: 20 additions & 0 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

</resources>
13 changes: 13 additions & 0 deletions res/xml/colorpicker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

<net.jileniao.colorpicker.ver2.ColorPickerPreference
alphaSlider="true"
enabledByDefault="false"
hexValue="true"
showCheckbox="false"
android:key="ccl"
android:title="Pick a Color" >
</net.jileniao.colorpicker.ver2.ColorPickerPreference>

</PreferenceScreen>
43 changes: 43 additions & 0 deletions src/net/jileniao/colorpicker/ColorPickerV2Activity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.jileniao.colorpicker;

import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.Gravity;
import android.view.WindowManager.LayoutParams;

public class ColorPickerV2Activity extends PreferenceActivity {

@SuppressWarnings("deprecation")
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

this.setWindowLayoutParams();
this.addPreferencesFromResource(R.xml.colorpicker);
}

@Override
protected void onResume() {
super.onResume();
}

@Override
protected void onDestroy() {
super.onDestroy();
}

private void setWindowLayoutParams() {
LayoutParams params = getWindow().getAttributes();
// params.gravity = Gravity.RIGHT;
params.gravity = Gravity.RIGHT | Gravity.BOTTOM;
params.alpha = 1.0f;
params.dimAmount = 0.0f;
// params.width = OkaoCameraView.LAYOUT_DISPLAYW * 45 / 100;
// params.height = OkaoCameraView.LAYOUT_DISPLAYH * 60 / 100;

params.height = LayoutParams.WRAP_CONTENT;
params.width = LayoutParams.MATCH_PARENT;
// params.height = LayoutParams.MATCH_PARENT;
getWindow().setAttributes(params);
}

}
41 changes: 41 additions & 0 deletions src/net/jileniao/colorpicker/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package net.jileniao.colorpicker;

import net.jileniao.colorpicker.ver1.ColorPickerDialog;
import net.jileniao.colorpicker.ver1.ColorPickerDialog.OnColorChangedListener;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {

private Button mColorPickerBtnVer1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mColorPickerBtnVer1 = (Button) findViewById(R.id.color_btn1);
}

public void showColorPicker1(View v) {
OnColorChangedListener listener = new OnColorChangedListener() {

@Override
public void colorChanged(int color) {
Toast.makeText(getApplicationContext(), "color0:" + color,
Toast.LENGTH_LONG).show();
mColorPickerBtnVer1.setBackgroundColor(color);
}
};
ColorPickerDialog dialog = new ColorPickerDialog(this, listener, 0);
dialog.show();
}

public void showColorPicker2(View v) {
Intent intent = new Intent(this, ColorPickerV2Activity.class);
startActivity(intent);
}
}
Loading

0 comments on commit 0365595

Please sign in to comment.