Skip to content

Commit

Permalink
first ci
Browse files Browse the repository at this point in the history
  • Loading branch information
loopeer-wanggang committed Dec 13, 2016
0 parents commit 97d8fad
Show file tree
Hide file tree
Showing 54 changed files with 1,779 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
.idea
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
37 changes: 37 additions & 0 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.1"

defaultConfig {
applicationId "com.loopeer.android.demo"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dataBinding {
enabled true
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
compile project(':library')
}
17 changes: 17 additions & 0 deletions demo/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in E:\program\AndroidSDk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# 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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.loopeer.android.demo;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.loopeer.android.demo", appContext.getPackageName());
}
}
20 changes: 20 additions & 0 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.loopeer.android.demo"
xmlns:android="http://schemas.android.com/apk/res/android">

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

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

</manifest>
145 changes: 145 additions & 0 deletions demo/src/main/java/com/loopeer/android/demo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
package com.loopeer.android.demo;

import android.databinding.DataBindingUtil;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Toast;

import com.loopeer.android.demo.databinding.ActivityMainBinding;
import com.loopeer.android.popuputils.RecyclerAdapter;
import com.loopeer.android.popuputils.SimpleThreeLayersPopup;
import com.loopeer.android.popuputils.SimpleTwoLayersPopup;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class MainActivity extends AppCompatActivity {

private List<String> mPrimaryData;
private HashMap<String, List<String>> mMapDatas;

private List<Model> mPrimary;
private List<Model> mSecondary;
private List<Model> mTertiary;

private SimpleTwoLayersPopup<String, String> mSimpleTwoLayersPopup;
private SimpleThreeLayersPopup<Model, Model, Model> mThreeLayersPopup;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ActivityMainBinding bind = DataBindingUtil.setContentView(this, R.layout.activity_main);
setSupportActionBar(bind.anchor);

mPrimaryData = new ArrayList<>();
mMapDatas = new HashMap<>();

mPrimary = new ArrayList<>();
mSecondary = new ArrayList<>();
mTertiary = new ArrayList<>();

// buildTwoLayersPopup();

buildThreeLayersPopup();

bind.btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// mSimpleTwoLayersPopup.show(bind.anchor, 0, 0);
mThreeLayersPopup.show(bind.anchor, 0, 0);
}
});
}


private void buildTwoLayersPopup() {

for (int i = 0; i < 15; i++) {
String primaryItem = "primaryItem: " + i;
mPrimaryData.add(primaryItem);
List<String> strings = new ArrayList<>();
for (int j = 0; j < 50; j++) {
strings.add(i + "-secondaryData: " + j);
}

mMapDatas.put(primaryItem, strings);
}

mSimpleTwoLayersPopup = new SimpleTwoLayersPopup<>(this);
mSimpleTwoLayersPopup.setTwoLayersAdapter(new SimpleTwoLayersPopup.SimpleTwoLayersAdapter<String, String>() {
@Override
public List<String> setPrimaryData() {
return mPrimaryData;
}

@Override
public List<String> setSecondaryData(String s) {
return mMapDatas.get(s);
}
});

mSimpleTwoLayersPopup.setSecondaryItemClickListener(new RecyclerAdapter.OnItemClickListener<String>() {

@Override
public void onItemClick(String data, int position) {
Toast.makeText(MainActivity.this, data, Toast.LENGTH_SHORT).show();
mSimpleTwoLayersPopup.dismiss();
}

@Override
public void setItemStyle(RecyclerView.ViewHolder preItemViewHolder, RecyclerView.ViewHolder curItemViewHolder) {
if (preItemViewHolder != null)
preItemViewHolder.itemView.setBackgroundColor(getResources().getColor(R.color.bg_layers));
if (curItemViewHolder != null)
curItemViewHolder.itemView.setBackgroundColor(Color.LTGRAY);
}
});

mSimpleTwoLayersPopup.setPrimaryItemClickListener(null);
}

private void buildThreeLayersPopup() {


for (int i = 0; i < 5; i++) {
Model model1 = new Model("primary--" + i);
List<Model> data1 = new ArrayList<>();
for (int j = 0; j < 40; j++) {
Model model2 = new Model(i + "secondary--" + i);
List<Model> data2 = new ArrayList<>();
for (int k = 0; k < 50; k++) {
data2.add(new Model(j + "tertiary--" + k));
}
model2.setData(data2);
data1.add(model2);
}
model1.setData(data1);
mPrimary.add(model1);
}

mThreeLayersPopup = new SimpleThreeLayersPopup<>(this);
mThreeLayersPopup.setThreeLayersAdapter(new SimpleThreeLayersPopup.SimpleThreeLayersAdapter<Model, Model, Model>() {
@Override
public List<Model> setTertiaryData(Model model) {
return model.getData();
}

@Override
public List<Model> setPrimaryData() {
return mPrimary;
}

@Override
public List<Model> setSecondaryData(Model model) {
return model.getData();
}
});

/*mThreeLayersPopup.setPrimaryItemClickListener(null);
mThreeLayersPopup.setSecondaryItemClickListener(null);*/
}
}
38 changes: 38 additions & 0 deletions demo/src/main/java/com/loopeer/android/demo/Model.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.loopeer.android.demo;

import java.util.List;

public class Model {
String name;
List<Model> data;

public Model(String name) {
this.name = name;
}

public Model(List<Model> data, String name) {
this.data = data;
this.name = name;
}

public List<Model> getData() {
return data;
}

public void setData(List<Model> data) {
this.data = data;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Override
public String toString() {
return name;
}
}
32 changes: 32 additions & 0 deletions demo/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<RelativeLayout
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.loopeer.android.demo.MainActivity">

<android.support.v7.widget.Toolbar
android:id="@+id/anchor"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:titleTextColor="@android:color/white"/>

<android.support.v7.widget.AppCompatButton
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@color/colorPrimary"
android:text="Hello World!"
android:textAllCaps="false"
android:textColor="@android:color/white"/>
</RelativeLayout>
</layout>

Binary file added demo/src/main/res/mipmap-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.
Binary file added demo/src/main/res/mipmap-mdpi/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.
Binary file added demo/src/main/res/mipmap-xhdpi/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.
Binary file added demo/src/main/res/mipmap-xxhdpi/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.
Binary file added demo/src/main/res/mipmap-xxxhdpi/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.
6 changes: 6 additions & 0 deletions demo/src/main/res/values-w820dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
6 changes: 6 additions & 0 deletions demo/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
5 changes: 5 additions & 0 deletions demo/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
3 changes: 3 additions & 0 deletions demo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">Demo</string>
</resources>
11 changes: 11 additions & 0 deletions demo/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
Loading

0 comments on commit 97d8fad

Please sign in to comment.