Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android版本,通过APP操作,可以查看对应项目的实现 #2

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
22 changes: 22 additions & 0 deletions Android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Android/.idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Android/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions Android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Android/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Android/.idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Android/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Android版本的项目框架

### 说明
* 运行模式

> * ListView展示所有项目,点击选择进入对应的项目界面

> * 只需按照下面的步骤操作,即可自动完成耦合


![](http://images2015.cnblogs.com/blog/951171/201609/951171-20160924003428121-1127574073.png)

* 增加项目的方法
* step 1:去values -> string -> Project,在Project中添加名称
* step 2:新建一个独立的package,在该package里新建Activity用来展示功能,并设置隐式启动的action,同时在actionDocument类中添加对应的信息
* step 3:在Activity中实现自己的项目功能

### 实现了的功能展示
* 逆转字符串

![](http://images2015.cnblogs.com/blog/951171/201609/951171-20160924003440481-342957189.png)

* 加密短信

![](http://images2015.cnblogs.com/blog/951171/201609/951171-20160924003435496-1603527109.png)
1 change: 1 addition & 0 deletions Android/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
25 changes: 25 additions & 0 deletions Android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "andrew.com.android_ver"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
17 changes: 17 additions & 0 deletions Android/app/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 C:\Users\Andrew\AppData\Local\Android\sdk/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,27 @@
package andrew.com.android_ver;

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 junit.framework.Assert.assertEquals;
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("andrew.com.android_ver", appContext.getPackageName());
}
}
34 changes: 34 additions & 0 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="andrew.com.android_ver">

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

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TurnDownString.MainActivity">
<intent-filter>
<action android:name="Action_TurnDownString" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".SecretMessage.SecretMessageView">
<intent-filter>
<action android:name="Action_SecretMessage"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package andrew.com.android_ver;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListAdapter;

import static andrew.com.android_ver.actionDocument.project_activity;

/**
* Created by Andrew on 2016/9/22.
*/

public class ListViewAdapter extends BaseAdapter implements ListAdapter {

private Context context;
private Activity activity;
private int attr;
private String[] data;

public ListViewAdapter(Activity context, int attr, String[] data) {
this.context = context;
this.activity = context;
this.attr = attr;
this.data = data;
}

@Override
public int getCount() {
return data.length;
}

@Override
public Object getItem(int i) {
return null;
}

@Override
public long getItemId(int i) {
return i;
}

@Override
public View getView(int i, View view, ViewGroup viewGroup) {
final Button button;
if (view == null) {
LayoutInflater inflater = LayoutInflater.from(context);
view = inflater.inflate(attr, null);
button = (Button) view.findViewById(R.id.btn_Show);

view.setTag(new ViewHolder(button));
} else {
ViewHolder holder = (ViewHolder) view.getTag();
button = holder.getButton();
}

button.setText(data[i]);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CharSequence activity = button.getText();
Intent i = new Intent();
String action = project_activity.get(activity);
i.setAction(action);
context.startActivity(i);
}
});
return view;
}

private class ViewHolder {
Button button;

public ViewHolder(Button button) {
this.button = button;
}

public Button getButton() {
return button;
}
}
}
Loading