ANDROID_AppStore_Manager_Project
工作以来,一直很少有时间来这里写BLOG,最近觉得时间还是比较充分,所以自己就为此而开始回顾自己之前的做的一些项目,不管大大小小,希望能通过自己的一个简单的管理界面来实现充分的整合管理,并希望通过兼容各APPSTORE来实现APP的浏览机制,好了,废话不多说了,我就以项目的形式一点点的写着走,现在我刚开始完成初始界面的实现,为今天第一步做好往下去的艰写得任务来完成一个完整而又具有实际意义学习与参考的免费项目,主要是为了提供给初学者做更多的参考:
登录界面:
login.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/live_back"
android:background="@drawable/item5"
>
<TextView
android:id="@+id/login_welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/login_welcome"
android:layout_gravity="center_horizontal"
android:textSize="30sp"
android:layout_marginTop="30dp"
android:textColor="#99FF00"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="60dp"
>
<TextView
android:text="@string/login_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:layout_marginLeft="25dp"
android:layout_marginRight="10dp"
android:textColor="#ff9900"
/>
<EditText
android:id="@+id/login_account"
android:text="@string/login_account"
android:layout_width="200sp"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:textColor="#999ff7"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="20dp"
>
<TextView
android:text="@string/login_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:layout_marginLeft="25dp"
android:layout_marginRight="10dp"
android:textColor="#ff9900"
/>
<EditText
android:id="@+id/login_password"
android:text="@string/login_password"
android:layout_width="200sp"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:textColor="#999ff7"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="20dp"
>
<Button
android:id="@+id/login_in"
android:text="@string/login_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:layout_marginRight="80dp"
android:textColor="#ff9900"
/>
<Button
android:id="@+id/login_register"
android:text="@string/login_regist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:textColor="#999ff7"
/>
</LinearLayout>
</LinearLayout>
Java代码:LoginActivity.java:
package com.jsd.app.manager;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* login interface
* @author jiangshide
*
*/
public class LoginActivity extends Activity {
private LinearLayout live_back;
private TextView live_TextView;
private EditText mName;
private EditText mPassword;
private Button login_in;
private Button login_register;
private int[] live = {R.drawable.item1,R.drawable.item2,
R.drawable.item3,R.drawable.item4,
R.drawable.item5};
private Timer mTimer;
private int mCount;
private Intent intent;
Handler mHandler = new Handler(){
public void handleMessage(Message msg) {
getSwitchBackIcon(msg);
}
/**
*
* @param msg
*/
private void getSwitchBackIcon(Message msg) {
switch (msg.what) {
case 0:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item1);
break;
case 1:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item2);
break;
case 2:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item3);
break;
case 3:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item4);
break;
case 4:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item5);
break;
case 5:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item1);
break;
case 6:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item2);
break;
case 7:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item3);
break;
case 8:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item4);
break;
case 9:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item5);
break;
case 10:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item4);
break;
case 11:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item5);
break;
case 12:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item1);
break;
case 13:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item2);
break;
case 14:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item3);
break;
case 15:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item4);
break;
case 16:
live_back = (LinearLayout) findViewById(R.id.live_back);
live_back.setBackgroundResource(R.drawable.item5);
break;
}
};
};
public void setText(){
live_TextView = (TextView) findViewById(R.id.login_welcome);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//设置全屏
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.login);
getComponents();
}
private void getComponents() {
mName = (EditText) this.findViewById(R.id.login_account);
mPassword = (EditText) this.findViewById(R.id.login_password);
login_in = (Button) this.findViewById(R.id.login_in);
login_register = (Button) this.findViewById(R.id.login_register);
login_in.setOnClickListener(login_in_person);//登录
login_register.setOnClickListener(login_register_in);//注册
}
OnClickListener login_register_in = new OnClickListener() {
public void onClick(View v) {
intent = new Intent();
intent.setClass(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
}
};
OnClickListener login_in_person = new OnClickListener() {
public void onClick(View v) {
String name = "jiang";
String password = "jiang";
System.out.println("mName: "+mName.getText().toString());
// if(name.equals(mName.getText().toString()) && password .equals(mPassword.getText().toString())){
intent = new Intent();
intent.putExtra("name", name);
intent.setClass(LoginActivity.this, JsdMainActivity.class);
startActivityForResult(intent, 0);
/*}else{
CustomerToast.getCustomerToast(LoginActivity.this, R.drawable.image5, R.drawable.item1, "账号或密码不匹配!", 1);//使用自定义的Toast
}*/
return ;
}
};
@Override
protected void onStart() {
mTimer = new Timer();
mTimer.schedule(new TimerTask() {
@Override
public void run() {
mCount++;
mHandler.sendEmptyMessage(mCount);
}
}, 5*1000, 5*1000);
super.onStart();
}
}
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jsd.app.manager"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/item1" android:label="@string/app_name">
<uses-library android:name="android.test.runner"/>
<activity android:name=".LoginActivity"
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=".JsdMainActivity"/>
<activity android:name=".RegisterActivity"/>
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.jsd.app.manager" android:label="test"/>
</manifest>
好了,上面是简单的登录界面:主要实现了登录界面动态更新背景图片的效果