src\MyApplication\.idea\compiler.xml
This commit is contained in:
parent
eb76f4f0a9
commit
9ffa005b63
|
@ -45,6 +45,7 @@ dependencies {
|
|||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
compile project(':floatwindow')
|
||||
compile 'com.android.support:appcompat-v7:26.+'
|
||||
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
compile 'com.jakewharton:butterknife:8.2.1'
|
||||
|
@ -57,8 +58,7 @@ dependencies {
|
|||
compile 'org.greenrobot:eventbus:3.0.0'
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.2'
|
||||
compile 'com.github.clans:fab:1.6.1'
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile 'com.github.yhaolpz:FloatWindow:1.0.9'
|
||||
testCompile 'junit:junit:4.12'
|
||||
apt 'com.jakewharton:butterknife-compiler:8.2.1'
|
||||
compile project(':floatwindow')
|
||||
}
|
||||
|
|
|
@ -1,44 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.administrator.myapplication"
|
||||
android:versionCode="1"
|
||||
android:versionName="2.1.0">
|
||||
package="com.example.administrator.myapplication"
|
||||
android:versionCode="1"
|
||||
android:versionName="2.1.0">
|
||||
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<!-- 获取悬浮窗的权限 -->
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- 获取GSM(2g)、WCDMA(联通3g)等网络状态的信息 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!-- 获取wifi网络状态的信息 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<!-- 允许读取手机状态 用于创建BmobInstallation -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
|
||||
<!-- 获取sd卡写的权限,用于文件上传和下载 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- UIL框架所需的权限 -->
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
|
||||
<uses-permission android:name="android.permission.READ_LOGS"/>
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<application
|
||||
android:name=".app.BaseApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/app_icon"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:name="com.example.administrator.myapplication.app.BaseApplication">
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".ui.WelcomeActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!--
|
||||
|
@ -47,43 +47,38 @@
|
|||
-->
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version"/>
|
||||
android:value="@integer/google_play_services_version" />
|
||||
|
||||
<activity android:name=".ui.NoteEditActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:mimeType="vnd.android.cursor.item/text_note"/>
|
||||
<data android:mimeType="vnd.android.cursor.item/call_note"/>
|
||||
<data android:mimeType="vnd.android.cursor.item/text_note" />
|
||||
<data android:mimeType="vnd.android.cursor.item/call_note" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".ui.SetLockActivity"/>
|
||||
<activity android:name=".ui.SetLockActivity" />
|
||||
<activity
|
||||
android:name=".ui.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar"/>
|
||||
android:theme="@style/AppTheme.NoActionBar" />
|
||||
<activity
|
||||
android:name=".ui.UnLockActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
</activity>
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
<activity
|
||||
android:name=".ui.LoginActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
</activity>
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
<activity
|
||||
android:name=".ui.UserInfoActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
</activity>
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
<activity
|
||||
android:name=".ui.RegisterActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
</activity>
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
<activity
|
||||
android:name=".ui.AlarmAlertActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
</activity>
|
||||
android:theme="@style/AppTheme.NoActionBar"></activity>
|
||||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
|
@ -92,16 +87,16 @@
|
|||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths"/>
|
||||
android:resource="@xml/provider_paths" />
|
||||
</provider>
|
||||
|
||||
<receiver
|
||||
android:name=".ui.NoteEditFragment$AlarmReceiver"
|
||||
android:process=":remote">
|
||||
</receiver>
|
||||
android:process=":remote"></receiver>
|
||||
|
||||
<activity android:name=".ui.FloatWindowActivity">
|
||||
</activity>
|
||||
<activity android:name=".ui.FloatWindowActivity"></activity>
|
||||
<activity android:name=".ui.NoteSearchActivity"></activity>
|
||||
<activity android:name=".ui.pic_view"></activity>
|
||||
</application>
|
||||
|
||||
</manifest> <!-- android:theme="@style/AppTheme.NoActionBar" -->
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.example.administrator.myapplication.entity.NotebookData;
|
|||
import com.example.administrator.myapplication.entity.OnResponseListener;
|
||||
import com.example.administrator.myapplication.entity.Response;
|
||||
import com.example.administrator.myapplication.ui.MainActivity;
|
||||
import com.example.administrator.myapplication.utils.AccountUtils;
|
||||
import com.example.administrator.myapplication.utils.BmobConstants;
|
||||
import com.example.administrator.myapplication.utils.Constants;
|
||||
import com.example.administrator.myapplication.utils.SPUtils;
|
||||
|
@ -83,17 +84,30 @@ public class BaseApplication extends Application {
|
|||
ClipData.Item item = clipData.getItemAt(0);
|
||||
String text = item.getText().toString();
|
||||
System.out.println(text);
|
||||
//将剪切板内容转化为notebookdata
|
||||
noteDb = new NoteDatabase(getApplicationContext());
|
||||
//将剪切板内容转化为notebookdate
|
||||
editData = new NotebookData();
|
||||
if (editData.getId() == 0) {
|
||||
editData.setId(-1
|
||||
* StringUtils.toInt(
|
||||
StringUtils.getDataTime("dddHHmmss"), 0));
|
||||
}
|
||||
String userId = AccountUtils.getUserId(getApplicationContext());
|
||||
editData.setUserId(userId);
|
||||
editData.setObjectId(editData.getObjectId());
|
||||
editData.setUnixTime(StringUtils.getDataTime("yyyy-MM-dd HH:mm:ss"));
|
||||
editData.setIid(editData.getIid()+1);
|
||||
editData.setContent(text);
|
||||
editData.setDate(editData.getDate());
|
||||
//editData.setUserId("23ee9374c5");
|
||||
//editData.setColor(3);//默认为blue
|
||||
//editData.setColorText("blue");
|
||||
isNewNote = true;
|
||||
if (StringUtils.isEmpty(editData.getDate())) {
|
||||
editData.setDate(StringUtils.getDataTime("yyyy/MM/dd"));
|
||||
}
|
||||
|
||||
mFontSizeId= (int) SPUtils.get(getApplicationContext(),Constants.TEXT_SIZE, Constants.TEXT_MEDIUM);
|
||||
System.out.println(editData.getContent());
|
||||
//System.out.println(editData.getContent());
|
||||
|
||||
editData.postNoteToServer(getApplicationContext(), new OnResponseListener() {
|
||||
@Override
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
//package com.htq.baidu.coolnote.entity;
|
||||
//
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//
|
||||
//import cn.bmob.v3.BmobObject;
|
||||
//
|
||||
//
|
||||
//@SuppressWarnings("serial")
|
||||
//public abstract class Entity extends BmobObject implements Serializable {
|
||||
//
|
||||
//
|
||||
// protected int id;
|
||||
//
|
||||
// protected String cacheKey;
|
||||
//
|
||||
// public int getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(int id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getCacheKey() {
|
||||
// return cacheKey;
|
||||
// }
|
||||
//
|
||||
// public void setCacheKey(String cacheKey) {
|
||||
// this.cacheKey = cacheKey;
|
||||
// }
|
||||
//}
|
|
@ -1,109 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||
* to be used with AppCompat.
|
||||
*/
|
||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getDelegate().installViewFactory();
|
||||
getDelegate().onCreate(savedInstanceState);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
getDelegate().onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public ActionBar getSupportActionBar() {
|
||||
return getDelegate().getSupportActionBar();
|
||||
}
|
||||
|
||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||
getDelegate().setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MenuInflater getMenuInflater() {
|
||||
return getDelegate().getMenuInflater();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
getDelegate().setContentView(layoutResID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
getDelegate().setContentView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().setContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||
getDelegate().addContentView(view, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
getDelegate().onPostResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTitleChanged(CharSequence title, int color) {
|
||||
super.onTitleChanged(title, color);
|
||||
getDelegate().setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
getDelegate().onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getDelegate().onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getDelegate().onDestroy();
|
||||
}
|
||||
|
||||
public void invalidateOptionsMenu() {
|
||||
getDelegate().invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private AppCompatDelegate getDelegate() {
|
||||
if (mDelegate == null) {
|
||||
mDelegate = AppCompatDelegate.create(this, null);
|
||||
}
|
||||
return mDelegate;
|
||||
}
|
||||
}
|
|
@ -11,9 +11,7 @@ import com.example.administrator.myapplication.R;
|
|||
import java.text.DateFormatSymbols;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Created by htq on 2016/9/13.
|
||||
*/
|
||||
|
||||
public class DateTimePicker extends FrameLayout {
|
||||
|
||||
private static final boolean DEFAULT_ENABLE_STATE = true;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
public class EditImages extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_edit_images);
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
public class EditNotes extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_edit_notes);
|
||||
findViewById(R.id.picture_back).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(EditNotes.this, ListActivity.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
public class ImagesDisplay extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_images_display);
|
||||
findViewById(R.id.note_btn).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(ImagesDisplay.this, ListActivity.class));
|
||||
}
|
||||
});
|
||||
findViewById(R.id.search_btn).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(ImagesDisplay.this, SearchActivity.class));
|
||||
}
|
||||
});
|
||||
findViewById(R.id.p5).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(ImagesDisplay.this, ScanImages.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
public class ListActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_list);
|
||||
findViewById(R.id.note_btn).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(ListActivity.this, ImagesDisplay.class));
|
||||
}
|
||||
});
|
||||
findViewById(R.id.search_btn).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(ListActivity.this, SearchActivity.class));
|
||||
}
|
||||
});
|
||||
findViewById(R.id.textView3).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(ListActivity.this, EditNotes.class));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
|
@ -8,17 +8,22 @@ import android.os.SystemClock;
|
|||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.NavigationView;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.design.widget.TabItem;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
import com.example.administrator.myapplication.db.NoteDatabase;
|
||||
|
@ -43,6 +48,7 @@ public class MainActivity extends AppCompatActivity
|
|||
private NoteBookFragment noteBookFragment;
|
||||
private ImageView headIcon;
|
||||
private View baseView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -59,6 +65,23 @@ public class MainActivity extends AppCompatActivity
|
|||
// User.refreshAvatarFromLocal(BmobConstants.MyAvatarDir+"avatarIcon.png",headIcon);
|
||||
//注册EventBus
|
||||
EventBus.getDefault().register(this);
|
||||
// Button picView = findViewById(R.id.app_bar_item2);
|
||||
// picView.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// setContentView(R.layout.pic_view);
|
||||
// }
|
||||
// });
|
||||
|
||||
//
|
||||
// View picView = (View) findViewById(R.id.app_bar_tablayout);
|
||||
// picView.setOnClickListener(new View.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// Intent intent = new Intent(MainActivity.this,pic_view.class);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,10 +92,8 @@ public class MainActivity extends AppCompatActivity
|
|||
public void onEventBackgroundThread(UpdataEvent event) {
|
||||
if (event.getType() == UpdataEvent.UPDATE_USER_INFOS) {
|
||||
User.initDefaultAvatar(this,headIcon);
|
||||
//Snackbar.make(headIcon,"update",Snackbar.LENGTH_LONG).show();
|
||||
// mPresenter.setUserNickName();
|
||||
|
||||
|
||||
Snackbar.make(headIcon,"update",Snackbar.LENGTH_LONG).show();
|
||||
//mPresenter.setUserNickName();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -255,13 +255,13 @@ public void getServerData()
|
|||
getServerData();
|
||||
adapter.refurbishData(datas);
|
||||
noteDb.reset(datas);//将结果重置到数据库
|
||||
// for(int i=0;i<datas.size();i++)
|
||||
// {
|
||||
//
|
||||
// noteDb.save(datas.get(i));
|
||||
// }
|
||||
for(int i=0;i<datas.size();i++)
|
||||
{
|
||||
|
||||
//refurbish();
|
||||
noteDb.save(datas.get(i));
|
||||
}
|
||||
|
||||
refurbish();
|
||||
setSwipeRefreshLoadedState();
|
||||
Snackbar.make(mGrid, "已从服务器端同步数据!", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
|
@ -335,7 +335,18 @@ public void getServerData()
|
|||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
//搜索显示框
|
||||
inflater.inflate(R.menu.main, menu);
|
||||
MenuItem searchViewbtn = (MenuItem) menu.findItem(R.id.action_search);
|
||||
//System.out.println("123456");
|
||||
searchViewbtn.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Intent intent = new Intent(getActivity(),NoteSearchActivity.class);
|
||||
startActivity(intent);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
|
|
@ -179,6 +179,7 @@ public class NoteEditFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
|
||||
public void initData() {
|
||||
//System.out.println("initData!\n");
|
||||
noteDb = new NoteDatabase(getActivity());
|
||||
if (editData == null) {
|
||||
editData = new NotebookData();
|
||||
|
@ -360,6 +361,7 @@ public class NoteEditFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
private void setNoteProperty()
|
||||
{
|
||||
//System.out.println("setNoteProperty!\n");
|
||||
if (editData.getId() == 0) {
|
||||
editData.setId(-1
|
||||
* StringUtils.toInt(
|
||||
|
@ -376,7 +378,7 @@ public class NoteEditFragment extends Fragment implements View.OnClickListener,
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
//System.out.println("onCreate!");
|
||||
Bundle bundle = getActivity().getIntent().getBundleExtra(Constants.BUNDLE_KEY_ARGS);
|
||||
if (bundle != null) {
|
||||
editData = (NotebookData) bundle.getSerializable(NOTE_KEY);
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
public class ScanImages extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_scan_images);
|
||||
findViewById(R.id.picture_show_cut).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(ScanImages.this, EditImages.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
public class SearchActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_search);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
public class SignActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_sign);
|
||||
findViewById(R.id.return_button).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(SignActivity.this, LoginActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.sign_up_button).setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
startActivity(new Intent(SignActivity.this, ListActivity.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package com.example.administrator.myapplication.ui;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/5/15 0015.
|
||||
*/
|
||||
|
||||
public class app_bar_activity extends AppCompatActivity {
|
||||
private TabLayout mTabLayout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.app_bar_main);
|
||||
|
||||
mTabLayout = (TabLayout) findViewById(R.id.app_bar_tablayout);
|
||||
mTabLayout.addTab(mTabLayout.newTab().setText("A"));
|
||||
mTabLayout.addTab(mTabLayout.newTab().setText("B"));
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ import android.net.NetworkInfo;
|
|||
|
||||
public class CommonUtils {
|
||||
|
||||
|
||||
/** */
|
||||
public static boolean isNetworkAvailable(Context context) {
|
||||
NetworkInfo info = getNetworkInfo(context);
|
||||
if (info != null) {
|
||||
|
@ -15,7 +15,7 @@ public class CommonUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** WIFI */
|
||||
public static boolean isWifi(Context context) {
|
||||
NetworkInfo info = getNetworkInfo(context);
|
||||
if (info != null) {
|
||||
|
@ -25,7 +25,7 @@ public class CommonUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/** */
|
||||
public static boolean isMobile(Context context) {
|
||||
NetworkInfo info = getNetworkInfo(context);
|
||||
if (info != null) {
|
||||
|
@ -42,7 +42,7 @@ public class CommonUtils {
|
|||
return cm.getActiveNetworkInfo();
|
||||
}
|
||||
|
||||
|
||||
/** */
|
||||
public static boolean checkSdCard() {
|
||||
if (android.os.Environment.getExternalStorageState().equals(
|
||||
android.os.Environment.MEDIA_MOUNTED))
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.example.administrator.myapplication.utils;
|
||||
|
||||
|
||||
/*
|
||||
常用变量集合到一起的类
|
||||
*/
|
||||
public class Constants {
|
||||
public final static String BUNDLE_KEY_PAGE = "BUNDLE_KEY_PAGE";
|
||||
public final static String BUNDLE_KEY_ARGS = "BUNDLE_KEY_ARGS";
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.text.TextUtils;
|
|||
public class DialogHelp {
|
||||
|
||||
/***
|
||||
* 获取一个dialog
|
||||
* 对话框工具类
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,9 @@ import android.graphics.Bitmap;
|
|||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
|
||||
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||
|
||||
/*
|
||||
图片加载工具类
|
||||
*/
|
||||
public class ImageLoadOptions {
|
||||
|
||||
public static DisplayImageOptions getOptions() {
|
||||
|
|
|
@ -2,7 +2,9 @@ package com.example.administrator.myapplication.utils;
|
|||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
|
||||
/*
|
||||
加密工具类
|
||||
*/
|
||||
public class MD5Util {
|
||||
public static String MD5(String str) {
|
||||
MessageDigest md5 = null;
|
||||
|
|
|
@ -20,26 +20,36 @@ import java.io.IOException;
|
|||
|
||||
public class PhotoUtil {
|
||||
|
||||
|
||||
/**
|
||||
* recycle
|
||||
* 图片选择框架
|
||||
* @throws
|
||||
*/
|
||||
public static void recycle(Bitmap bitmap) {
|
||||
|
||||
if (bitmap != null && !bitmap.isRecycled()) {
|
||||
|
||||
// Ϊnull
|
||||
bitmap.recycle();
|
||||
bitmap = null;
|
||||
}
|
||||
System.gc();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getImageThumbnail
|
||||
*
|
||||
* @return Bitmap
|
||||
* @throws
|
||||
*/
|
||||
public static Bitmap getImageThumbnail(String imagePath, int width,
|
||||
int height) {
|
||||
Bitmap bitmap = null;
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inJustDecodeBounds = true;
|
||||
|
||||
// bitmapΪnull
|
||||
bitmap = BitmapFactory.decodeFile(imagePath, options);
|
||||
options.inJustDecodeBounds = false;
|
||||
options.inJustDecodeBounds = false; // Ϊ false
|
||||
//
|
||||
int h = options.outHeight;
|
||||
int w = options.outWidth;
|
||||
int beWidth = w / width;
|
||||
|
@ -54,9 +64,9 @@ public class PhotoUtil {
|
|||
be = 1;
|
||||
}
|
||||
options.inSampleSize = be;
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD><EFBFBD><EFBFBD>ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD><EFBFBD>bitmap<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>options.inJustDecodeBounds <EFBFBD><EFBFBD>Ϊ false
|
||||
bitmap = BitmapFactory.decodeFile(imagePath, options);
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ThumbnailUtils<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫָ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>Bitmap<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height,
|
||||
ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
|
||||
return bitmap;
|
||||
|
@ -65,9 +75,9 @@ public class PhotoUtil {
|
|||
/**
|
||||
* saveBitmap
|
||||
*
|
||||
* @param @param filename
|
||||
* @param @param filename---<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ-<EFBFBD><EFBFBD>Ŀ¼<EFBFBD>Լ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||
* @param @param bitmap
|
||||
* @param @param isDelete
|
||||
* @param @param isDelete --<EFBFBD>Ƿ<EFBFBD>ֻ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
||||
* @return void
|
||||
* @throws
|
||||
*/
|
||||
|
@ -79,7 +89,7 @@ public class PhotoUtil {
|
|||
}
|
||||
|
||||
File file = new File(dirpath, filename);
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>ɾ<EFBFBD><EFBFBD>-Ĭ<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
||||
if (isDelete) {
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
|
@ -143,7 +153,12 @@ public class PhotoUtil {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <EFBFBD><EFBFBD>ȡͼƬ<EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>ĽǶ<EFBFBD>
|
||||
* @param path ͼƬ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>
|
||||
* @return degree<EFBFBD><EFBFBD>ת<EFBFBD>ĽǶ<EFBFBD>
|
||||
*/
|
||||
|
||||
public static int readPictureDegree(String path) {
|
||||
int degree = 0;
|
||||
|
@ -170,7 +185,11 @@ public class PhotoUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/** <EFBFBD><EFBFBD>תͼƬһ<EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>
|
||||
* rotaingImageView
|
||||
* @return Bitmap
|
||||
* @throws
|
||||
*/
|
||||
public static Bitmap rotaingImageView(int angle, Bitmap bitmap) {
|
||||
|
||||
Matrix matrix = new Matrix();
|
||||
|
@ -182,6 +201,7 @@ public class PhotoUtil {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public static Bitmap toRoundCorner(Bitmap bitmap, int pixels) {
|
||||
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
|
||||
bitmap.getHeight(), Config.ARGB_8888);
|
||||
|
@ -204,7 +224,12 @@ public class PhotoUtil {
|
|||
return output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <EFBFBD><EFBFBD>ͼƬת<EFBFBD><EFBFBD>ΪԲ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>
|
||||
*
|
||||
* @Title: toRoundBitmap
|
||||
* @throws
|
||||
*/
|
||||
public static Bitmap toRoundBitmap(Bitmap bitmap) {
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
|
@ -251,16 +276,16 @@ public class PhotoUtil {
|
|||
(int) dst_right, (int) dst_bottom);
|
||||
final RectF rectF = new RectF(dst);
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
paint.setAntiAlias(true);// <EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
canvas.drawARGB(0, 0, 0, 0);
|
||||
canvas.drawARGB(0, 0, 0, 0); // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Canvas
|
||||
|
||||
|
||||
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ,drawRounRect<EFBFBD><EFBFBD>drawCircle
|
||||
canvas.drawRoundRect(rectF, roundPx, roundPx, paint);// <EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD>ˮƽԲ<EFBFBD>ǰ뾶<EFBFBD>ʹ<EFBFBD>ֱԲ<EFBFBD>ǰ뾶<EFBFBD><EFBFBD>
|
||||
// canvas.drawCircle(roundPx, roundPx, roundPx, paint);
|
||||
|
||||
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
|
||||
canvas.drawBitmap(bitmap, src, dst, paint);
|
||||
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<EFBFBD>ཻʱ<EFBFBD><EFBFBD>ģʽ,<EFBFBD>ο<EFBFBD>http://trylovecatch.iteye.com/blog/1189452
|
||||
canvas.drawBitmap(bitmap, src, dst, paint); // <EFBFBD><EFBFBD>Mode.SRC_INģʽ<EFBFBD>ϲ<EFBFBD>bitmap<EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>draw<EFBFBD>˵<EFBFBD>Circle
|
||||
|
||||
return output;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.example.administrator.myapplication.utils;
|
|||
import com.example.administrator.myapplication.R;
|
||||
|
||||
/**
|
||||
* Created by htq on 2018/5/20.
|
||||
* 资源处理工具类
|
||||
*/
|
||||
public class ResourceParser {
|
||||
public static final int TEXT_SMALL = 0;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by Wentong WANG on 2018/5/29.
|
||||
* Created by Wentong WANG on 2016/6/6.
|
||||
*/
|
||||
public class SPUtils {
|
||||
/**
|
||||
|
|
|
@ -15,9 +15,6 @@ import java.util.regex.Pattern;
|
|||
/**
|
||||
* 字符串操作工具包
|
||||
*
|
||||
* @author znf
|
||||
* @version 1.0
|
||||
* @created 2018-4-21
|
||||
*/
|
||||
public class StringUtils {
|
||||
private final static Pattern emailer = Pattern
|
||||
|
@ -344,7 +341,7 @@ public class StringUtils {
|
|||
* @param dete1
|
||||
* @param date2
|
||||
* @return
|
||||
* @author znf 2018-5-1
|
||||
* @author 火蚁 2015-2-9 下午4:50:06
|
||||
*/
|
||||
public static long calDateDifferent(String dete1, String date2) {
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.io.InputStream;
|
|||
import static android.content.Context.MODE_PRIVATE;
|
||||
|
||||
/**
|
||||
* Created by htq on 2018/4/10.
|
||||
* 系统工具类
|
||||
*/
|
||||
public class SystemUtils {
|
||||
|
||||
|
@ -137,7 +137,6 @@ public boolean isTarn()
|
|||
}
|
||||
|
||||
/**
|
||||
* @author htq_
|
||||
* @param mActivity
|
||||
* bolg:bolg.csdn.net/htq__
|
||||
*/
|
||||
|
|
|
@ -4,9 +4,7 @@ import java.util.Date;
|
|||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* @author znf
|
||||
*
|
||||
* @date 2017年10月9日
|
||||
* 时区
|
||||
*/
|
||||
public class TimeZoneUtil {
|
||||
|
||||
|
@ -24,7 +22,7 @@ public class TimeZoneUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 根据不同时区,转换时间 2017年10月10日
|
||||
* 根据不同时区,转换时间 2014年7月31日
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -1,385 +0,0 @@
|
|||
package com.example.administrator.myapplication.webview;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.DownloadListener;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.JsPromptResult;
|
||||
import android.webkit.JsResult;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebResourceError;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebResourceResponse;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
|
||||
/**
|
||||
* 演示WebView中的Api说明、js交互的方法,还有注意事项
|
||||
* <p>
|
||||
* 1、内存泄漏防备
|
||||
* 2、配置webView
|
||||
* 3、页面加载开始,错误,拦截请求,接受Error等
|
||||
* 4、页面加载进度,title,图标,js弹框等
|
||||
* 5、js交互与安全
|
||||
*/
|
||||
public class APIWebViewActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
FrameLayout mRootLayout;
|
||||
WebView mWebView;
|
||||
Button mButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_api_webview);
|
||||
|
||||
findViewById(R.id.call_js_function).setOnClickListener(this);
|
||||
|
||||
//添加webView到布局中
|
||||
addWebViewToLayout();
|
||||
|
||||
//set webView Setting
|
||||
setWebView();
|
||||
|
||||
//set webView Client
|
||||
setWebClient();
|
||||
|
||||
//set webView chrome
|
||||
setWebViewChromeClient();
|
||||
|
||||
//load web
|
||||
loadUrl();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 主动清空销毁来避免内存泄漏
|
||||
*/
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mWebView != null) {
|
||||
mWebView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
|
||||
mWebView.clearHistory();
|
||||
((ViewGroup) mWebView.getParent()).removeView(mWebView);
|
||||
mWebView.destroy();
|
||||
mWebView = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 1、不在xml中定义Webview,而是在需要的时候在Activity中创建
|
||||
* 使用getApplicationgContext(),避免内存泄漏。
|
||||
* <p>
|
||||
* 2、当然,你也可以配置webView所在Activity,
|
||||
* 在AndroidManifest中的进程为:android:process=":remote"
|
||||
* 避免泄漏影响主进程
|
||||
**/
|
||||
void addWebViewToLayout() {
|
||||
mRootLayout = (FrameLayout) findViewById(R.id.js_root_layout);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
mWebView = new WebView(getApplicationContext());
|
||||
mWebView.setLayoutParams(params);
|
||||
mRootLayout.addView(mWebView);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 配置webView
|
||||
*/
|
||||
void setWebView() {
|
||||
//声明WebSettings子类
|
||||
WebSettings webSettings = mWebView.getSettings();
|
||||
|
||||
//支持Javascript交互
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
|
||||
|
||||
//设置自适应屏幕,两者合用
|
||||
webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小
|
||||
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
|
||||
|
||||
//缩放操作
|
||||
webSettings.setSupportZoom(true); //支持缩放,默认为true。是下面那个的前提。
|
||||
webSettings.setBuiltInZoomControls(true); //设置内置的缩放控件。若为false,则该WebView不可缩放
|
||||
webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件
|
||||
|
||||
//其他细节操作
|
||||
//webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //关闭webview中缓存
|
||||
webSettings.setAllowFileAccess(true); //设置可以访问文件
|
||||
|
||||
//对于不需要使用 file 协议的应用,禁用 file 协议;防止文件泄密,file协议即是file://
|
||||
//webSettings.setAllowFileAccess(false);
|
||||
//webSettings.setAllowFileAccessFromFileURLs(false);
|
||||
//webSettings.setAllowUniversalAccessFromFileURLs(false);
|
||||
|
||||
|
||||
|
||||
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口
|
||||
webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片
|
||||
webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式
|
||||
|
||||
mWebView.setDownloadListener(new DownloadListener() {
|
||||
@Override
|
||||
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
||||
//网页中触发下载动作
|
||||
}
|
||||
});
|
||||
|
||||
//增加js交互接口
|
||||
mWebView.addJavascriptInterface(new JsCallAndroidInterface(), "JSCallBackInterface");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置webView的Client,如页面加载开始,错误,拦截请求,接受Error等
|
||||
*/
|
||||
void setWebClient() {
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
|
||||
//拦截页面中的url加载,21以下的
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (resolveShouldLoadLogic(url)) {
|
||||
return true;
|
||||
}
|
||||
return super.shouldOverrideUrlLoading(view, url);
|
||||
}
|
||||
|
||||
//拦截页面中的url加载,21以上的
|
||||
@TargetApi(21)
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||
if (resolveShouldLoadLogic(request.getUrl().toString())) {
|
||||
return true;
|
||||
}
|
||||
return super.shouldOverrideUrlLoading(view, request);
|
||||
}
|
||||
|
||||
//页面开始加载
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||
super.onPageStarted(view, url, favicon);
|
||||
}
|
||||
|
||||
//页面加载完成
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
super.onPageFinished(view, url);
|
||||
}
|
||||
|
||||
//页面加载每一个资源,如图片
|
||||
@Override
|
||||
public void onLoadResource(WebView view, String url) {
|
||||
super.onLoadResource(view, url);
|
||||
}
|
||||
|
||||
//监听WebView发出的请求并做相应的处理
|
||||
//浏览器的渲染以及资源加载都是在一个线程中,如果在shouldInterceptRequest处理时间过长,WebView界面就会阻塞
|
||||
//21以下的
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
|
||||
return super.shouldInterceptRequest(view, url);
|
||||
}
|
||||
|
||||
//监听WebView发出的请求并做相应的处理
|
||||
//浏览器的渲染以及资源加载都是在一个线程中,如果在shouldInterceptRequest处理时间过长,WebView界面就会阻塞
|
||||
//21以上的
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
|
||||
return super.shouldInterceptRequest(view, request);
|
||||
}
|
||||
|
||||
//页面加载出现错误,23以下的
|
||||
@Override
|
||||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
||||
super.onReceivedError(view, errorCode, description, failingUrl);
|
||||
switch (errorCode) {
|
||||
case 404:
|
||||
//view.loadUrl("加载一个错误页面提示,优化体验");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//页面加载出现错误,23以上的
|
||||
@TargetApi(23)
|
||||
@Override
|
||||
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
||||
super.onReceivedError(view, request, error);
|
||||
switch (error.getErrorCode()) {
|
||||
case 404:
|
||||
//view.loadUrl("加载一个错误页面提示,优化体验");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//https错误
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
super.onReceivedSslError(view, handler, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置webView的辅助功能,如页面加载进度,title,图标,js弹框等
|
||||
*/
|
||||
void setWebViewChromeClient() {
|
||||
mWebView.setWebChromeClient(new WebChromeClient() {
|
||||
|
||||
//页面加载进度
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
super.onProgressChanged(view, newProgress);
|
||||
}
|
||||
|
||||
//获取标题
|
||||
@Override
|
||||
public void onReceivedTitle(WebView view, String title) {
|
||||
super.onReceivedTitle(view, title);
|
||||
}
|
||||
|
||||
//获取图标
|
||||
@Override
|
||||
public void onReceivedIcon(WebView view, Bitmap icon) {
|
||||
super.onReceivedIcon(view, icon);
|
||||
}
|
||||
|
||||
//是否支持页面中的js警告弹出框
|
||||
@Override
|
||||
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
|
||||
|
||||
Toast.makeText(APIWebViewActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||
|
||||
return super.onJsAlert(view, url, message, result);
|
||||
}
|
||||
|
||||
//是否支持页面中的js确定弹出框
|
||||
@Override
|
||||
public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
|
||||
return super.onJsConfirm(view, url, message, result);
|
||||
}
|
||||
|
||||
//是否支持页面中的js输入弹出框
|
||||
@Override
|
||||
public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
|
||||
/**
|
||||
* 有时候,为了安全考虑,js的参数回调,会通过这类地方回调回来,然后不弹出框。
|
||||
*/
|
||||
if(resolveJSPrompt(message)) {
|
||||
return true;
|
||||
}
|
||||
return super.onJsPrompt(view, url, message, defaultValue, result);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载url
|
||||
*/
|
||||
void loadUrl() {
|
||||
// 格式规定为:file:///android_asset/文件名.html
|
||||
mWebView.loadUrl("file:///android_asset/localHtml.html");
|
||||
//方式1. 加载远程网页:
|
||||
//mWebView.loadUrl("http://www.baidu.com/");
|
||||
//方式2:加载asset的html页面
|
||||
//mWebView.loadUrl("file:///android_asset/localHtml.html");
|
||||
//方式3:加载手机SD的html页面
|
||||
//mWebView.loadUrl("file:///mnt/sdcard/database/taobao.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行网页中的js方法
|
||||
*/
|
||||
void callJsFunction() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
mWebView.evaluateJavascript("javascript:callJS()", new ValueCallback<String>() {
|
||||
@Override
|
||||
public void onReceiveValue(String value) {
|
||||
//接受返回值
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mWebView.loadUrl("javascript:callJS()");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* js与web交互1
|
||||
* js 与 原生交互接口
|
||||
*/
|
||||
private class JsCallAndroidInterface {
|
||||
|
||||
//@JavascriptInterface注解方法,js端调用,4.2以后安全
|
||||
//4.2以前,当JS拿到Android这个对象后,就可以调用这个Android对象中所有的方法,包括系统类(java.lang.Runtime 类),从而进行任意代码执行。
|
||||
@JavascriptInterface
|
||||
public void callback(String msg) {
|
||||
Toast.makeText(APIWebViewActivity.this, "JS方法回调到web了 :" + msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* js与web交互2
|
||||
* 通过 shouldOverrideUrlLoading 与 js交互
|
||||
*/
|
||||
private boolean resolveShouldLoadLogic(String url) {
|
||||
Uri uri = Uri.parse(url);
|
||||
//解析协议
|
||||
if (uri.getScheme().equals("js")) {
|
||||
if (uri.getAuthority().equals("Authority")) {
|
||||
//你还可以继续接续参数
|
||||
//Set<String> collection = uri.getQueryParameterNames();
|
||||
Toast.makeText(APIWebViewActivity.this, "JS 2方法回调到web了", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* js与web交互3
|
||||
* 通过 onJsPrompt 与 js交互
|
||||
*/
|
||||
private boolean resolveJSPrompt(String message) {
|
||||
Uri uri = Uri.parse(message);
|
||||
if ( uri.getScheme().equals("js")) {
|
||||
if (uri.getAuthority().equals("Authority")) {
|
||||
|
||||
//Set<String> collection = uri.getQueryParameterNames();
|
||||
//参数result:代表消息框的返回值(输入值)
|
||||
//result.confirm("JS 3方法回调到web");
|
||||
Toast.makeText(APIWebViewActivity.this, "JS 3方法回调到web了", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.call_js_function:
|
||||
callJsFunction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package com.example.administrator.myapplication.webview;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.webkit.WebResourceError;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.administrator.myapplication.R;
|
||||
import com.shuyu.action.web.ActionSelectListener;
|
||||
import com.shuyu.action.web.CustomActionWebView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WebActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
View mLadingView;
|
||||
CustomActionWebView mCustomActionWebView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_web);
|
||||
|
||||
mLadingView = findViewById(R.id.loadingView);
|
||||
mCustomActionWebView = (CustomActionWebView)findViewById(R.id.customActionWebView);
|
||||
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("复制");
|
||||
list.add("粘贴");
|
||||
list.add("一键嗖藏");
|
||||
|
||||
mCustomActionWebView.setWebViewClient(new CustomWebViewClient());
|
||||
|
||||
//设置item
|
||||
mCustomActionWebView.setActionList(list);
|
||||
|
||||
//链接js注入接口,使能选中返回数据
|
||||
mCustomActionWebView.linkJSInterface();
|
||||
|
||||
mCustomActionWebView.getSettings().setBuiltInZoomControls(true);
|
||||
mCustomActionWebView.getSettings().setDisplayZoomControls(false);
|
||||
//使用javascript
|
||||
mCustomActionWebView.getSettings().setJavaScriptEnabled(true);
|
||||
mCustomActionWebView.getSettings().setDomStorageEnabled(true);
|
||||
|
||||
|
||||
//增加点击回调
|
||||
mCustomActionWebView.setActionSelectListener(new ActionSelectListener() {
|
||||
@Override
|
||||
public void onClick(String title, String selectText) {
|
||||
if(title.equals("一键嗖藏")) {
|
||||
Toast.makeText(WebActivity.this, "Click Item: " + title + "。\n\nValue: " + selectText, Toast.LENGTH_LONG).show();
|
||||
|
||||
return;
|
||||
}
|
||||
//System.out.println(title + selectText);
|
||||
Toast.makeText(WebActivity.this, "Click Item: " + title + "。\n\nValue: " + selectText, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
//加载url
|
||||
mCustomActionWebView.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCustomActionWebView.loadUrl("https://www.cnblogs.com/joy99/p/6343237.html");
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if(mCustomActionWebView != null) {
|
||||
mCustomActionWebView.dismissAction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
}
|
||||
|
||||
private class CustomWebViewClient extends WebViewClient {
|
||||
|
||||
private boolean mLastLoadFailed = false;
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView webView, String url) {
|
||||
super.onPageFinished(webView, url);
|
||||
if (!mLastLoadFailed) {
|
||||
CustomActionWebView customActionWebView = (CustomActionWebView) webView;
|
||||
customActionWebView.linkJSInterface();
|
||||
mLadingView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(WebView webView, String url, Bitmap favicon) {
|
||||
super.onPageStarted(webView, url, favicon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
||||
super.onReceivedError(view, request, error);
|
||||
mLastLoadFailed = true;
|
||||
mLadingView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -29,10 +29,7 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 感谢这篇博客的作者,http://blog.csdn.net/xiaanming/article/details/17718579<br>
|
||||
* 在这个基础上解决了原作者的问题:Adapter无法使用ViewHolder优化的问题,优化了手势识别率,并添加了trashView功能,
|
||||
* 优化自定义控件对外扩展性,解决在上下拉环境下手势冲突问题<br>
|
||||
*
|
||||
* 跨屏滑动
|
||||
*
|
||||
*/
|
||||
public class HTQDragGridView extends GridView {
|
||||
|
@ -110,9 +107,7 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/**
|
||||
* 获取状态栏的高度
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
private static int getStatusHeight(Context context) {
|
||||
int statusHeight = 0;
|
||||
|
@ -175,7 +170,6 @@ public class HTQDragGridView extends GridView {
|
|||
/**
|
||||
* 若设置为AUTO_FIT,计算有多少列
|
||||
*/
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
if (mNumColumns == AUTO_FIT) {
|
||||
int numFittedColumns = 1; // 可用列
|
||||
|
@ -202,7 +196,7 @@ public class HTQDragGridView extends GridView {
|
|||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
initRecord();
|
||||
|
@ -226,7 +220,6 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/******************** preference method ********************/
|
||||
|
||||
@Override
|
||||
public void setAdapter(ListAdapter adapter) {
|
||||
super.setAdapter(adapter);
|
||||
|
||||
|
@ -238,20 +231,20 @@ public class HTQDragGridView extends GridView {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setNumColumns(int numColumns) {
|
||||
super.setNumColumns(numColumns);
|
||||
mNumColumnsSet = true;
|
||||
this.mNumColumns = numColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setColumnWidth(int columnWidth) {
|
||||
super.setColumnWidth(columnWidth);
|
||||
mColumnWidth = columnWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setHorizontalSpacing(int horizontalSpacing) {
|
||||
super.setHorizontalSpacing(horizontalSpacing);
|
||||
this.mHorizontalSpacing = horizontalSpacing;
|
||||
|
@ -283,7 +276,7 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/******************** touch method ********************/
|
||||
|
||||
@Override
|
||||
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
if (canDrag) {
|
||||
switch (ev.getAction()) {
|
||||
|
@ -349,7 +342,7 @@ public class HTQDragGridView extends GridView {
|
|||
return super.dispatchTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
if (isDrag && canDrag && mDragImageView != null) {
|
||||
switch (ev.getAction()) {
|
||||
|
@ -445,7 +438,7 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/**
|
||||
* 拖动item,在里面实现了item镜像的位置更新,item的相互交换以及GridView的自行滚动
|
||||
*
|
||||
*
|
||||
* @param moveX
|
||||
* @param moveY
|
||||
*/
|
||||
|
@ -461,7 +454,7 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/**
|
||||
* 手指当前处于垃圾桶图标上
|
||||
*
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return
|
||||
|
@ -519,7 +512,7 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/**
|
||||
* 交换item,并且控制item之间的显示与隐藏效果
|
||||
*
|
||||
*
|
||||
* @param moveX
|
||||
* @param moveY
|
||||
*/
|
||||
|
@ -553,7 +546,7 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/**
|
||||
* 创建移动动画
|
||||
*
|
||||
*
|
||||
* @param view
|
||||
* @param startX
|
||||
* @param endX
|
||||
|
@ -574,7 +567,7 @@ public class HTQDragGridView extends GridView {
|
|||
|
||||
/**
|
||||
* item的交换动画效果
|
||||
*
|
||||
*
|
||||
* @param oldPosition
|
||||
* @param newPosition
|
||||
*/
|
||||
|
|
|
@ -6,8 +6,7 @@ import android.view.MotionEvent;
|
|||
|
||||
/**
|
||||
* 圆形ImageView组件 点击事件不会穿透
|
||||
*
|
||||
* @author kymjs(kymjs123@gmail.com)
|
||||
|
||||
*/
|
||||
public class NoteItemCircleView extends CircleImageView {
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.example.administrator.myapplication.R;
|
|||
|
||||
|
||||
/**
|
||||
* @author Qiujuer
|
||||
* 开关按钮
|
||||
*/
|
||||
public class ToggleButton extends View {
|
||||
/** */
|
||||
|
@ -320,7 +320,6 @@ public class ToggleButton extends View {
|
|||
|
||||
|
||||
/**
|
||||
* @author ThinkPad
|
||||
*/
|
||||
public interface OnToggleChanged {
|
||||
/**
|
||||
|
|
|
@ -122,7 +122,6 @@ public class LockPatternView extends View {
|
|||
|
||||
|
||||
/**
|
||||
* @author htq
|
||||
*/
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button
|
||||
android:id="@+id/call_js_function"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="调用js方法"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/js_root_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -1,134 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
<ImageButton
|
||||
android:id="@+id/picture_back"
|
||||
android:layout_width="35dip"
|
||||
android:layout_height="35dip"
|
||||
android:src="@drawable/ic_arrow_back_48pt"
|
||||
android:background="@color/white"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/picture_watch"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="450dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/p5"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/picture_zoom_out"
|
||||
android:layout_width="25dip"
|
||||
android:layout_height="25dip"
|
||||
android:src="@drawable/ic_zoom_out_18pt"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/picture_watch"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@color/white"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/picture_zoom_in"
|
||||
android:layout_width="25dip"
|
||||
android:layout_height="25dip"
|
||||
android:src="@drawable/ic_zoom_in_18pt"
|
||||
android:layout_alignTop="@id/picture_zoom_out"
|
||||
android:layout_toLeftOf="@id/picture_zoom_out"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@color/white"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/picture_cut"
|
||||
android:layout_width="25dip"
|
||||
android:layout_height="25dip"
|
||||
android:src="@drawable/ic_content_cut_black_18dp"
|
||||
android:layout_alignTop="@id/picture_zoom_out"
|
||||
android:layout_toLeftOf="@id/picture_zoom_in"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@color/white"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/picture_delete"
|
||||
android:layout_width="25dip"
|
||||
android:layout_height="25dip"
|
||||
android:src="@drawable/ic_delete_18pt"
|
||||
android:layout_alignTop="@id/picture_zoom_out"
|
||||
android:layout_toRightOf="@id/picture_zoom_out"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/picture_more"
|
||||
android:layout_width="25dip"
|
||||
android:layout_height="25dip"
|
||||
android:src="@drawable/ic_more_horiz_18pt"
|
||||
android:layout_alignTop="@id/picture_zoom_out"
|
||||
android:layout_toRightOf="@id/picture_delete"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@color/white"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/picture_cut"
|
||||
android:layout_alignLeft="@id/picture_cut"
|
||||
android:text="裁切"
|
||||
android:background="@drawable/background_white"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/picture_zoom_in"
|
||||
android:layout_alignLeft="@id/picture_zoom_in"
|
||||
android:text="放大"
|
||||
android:background="@drawable/background_white"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/picture_zoom_out"
|
||||
android:layout_alignLeft="@id/picture_zoom_out"
|
||||
android:text="缩小"
|
||||
android:background="@drawable/background_white"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/picture_delete"
|
||||
android:layout_alignLeft="@id/picture_delete"
|
||||
android:text="删除"
|
||||
android:background="@drawable/background_white"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/picture_more"
|
||||
android:layout_alignLeft="@id/picture_more"
|
||||
android:text="删除"
|
||||
android:background="@drawable/background_white"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="10sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="迪丽热巴"
|
||||
android:textSize="30sp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toLeftOf="@+id/picture_zoom_out"
|
||||
android:layout_toStartOf="@+id/picture_zoom_out"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,38 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
<ImageButton
|
||||
android:id="@+id/picture_back"
|
||||
android:layout_width="35dip"
|
||||
android:layout_height="35dip"
|
||||
android:src="@drawable/ic_arrow_back_48pt"
|
||||
android:background="@color/white"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:text="长沙美食"
|
||||
android:layout_below="@+id/picture_back"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:ems="10"
|
||||
android:inputType="textPersonName"
|
||||
android:text="太平街、黄兴路步行街......"
|
||||
android:layout_below="@+id/textView4"
|
||||
android:layout_alignLeft="@+id/textView4"
|
||||
android:layout_alignStart="@+id/textView4"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,128 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background1">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/image_menu"
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip"
|
||||
android:background="@drawable/background1"
|
||||
android:src="@drawable/ic_list_black_36dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/note_btn"
|
||||
android:layout_width="100dip"
|
||||
android:layout_height="50dip"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:layout_toRightOf="@id/image_menu"
|
||||
android:text="笔记"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/picture_btn"
|
||||
android:layout_width="100dip"
|
||||
android:layout_height="50dip"
|
||||
android:layout_toRightOf="@id/note_btn"
|
||||
android:background="@color/colorPrimary"
|
||||
android:text="图片"
|
||||
android:textColor="@color/base_color_text_white"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/search_btn"
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip"
|
||||
android:background="@drawable/background1"
|
||||
android:src="@drawable/ic_search_black_48dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="美景"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/base_color_text_black"/>
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageButton
|
||||
android:id="@+id/p1"
|
||||
android:layout_width="120dip"
|
||||
android:layout_height="120dip"
|
||||
android:src="@drawable/p1"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/p2"
|
||||
android:layout_width="120dip"
|
||||
android:layout_height="120dip"
|
||||
android:src="@drawable/p2"
|
||||
android:layout_toRightOf="@id/p1"
|
||||
android:layout_marginLeft="12dp"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/p3"
|
||||
android:layout_width="120dip"
|
||||
android:layout_height="120dip"
|
||||
android:src="@drawable/p3"
|
||||
android:layout_toRightOf="@id/p2"
|
||||
android:layout_marginLeft="12dp"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/p4"
|
||||
android:layout_width="120dip"
|
||||
android:layout_height="120dip"
|
||||
android:src="@drawable/p4"
|
||||
android:layout_below="@id/p1"
|
||||
android:layout_marginBottom="12dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="美女"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/base_color_text_black"/>
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageButton
|
||||
android:id="@+id/p5"
|
||||
android:layout_width="120dip"
|
||||
android:layout_height="120dip"
|
||||
android:src="@drawable/p5"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/p6"
|
||||
android:layout_width="120dip"
|
||||
android:layout_height="120dip"
|
||||
android:src="@drawable/p6"
|
||||
android:layout_toRightOf="@id/p5"
|
||||
android:layout_marginLeft="12dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<AbsoluteLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton2"
|
||||
android:layout_width="72dip"
|
||||
android:layout_height="72dip"
|
||||
android:layout_x="300dp"
|
||||
android:layout_y="30dp"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/ic_add_circle_48pt_2x"
|
||||
/>
|
||||
</AbsoluteLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,115 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background1">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/image_menu"
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip"
|
||||
android:src="@drawable/ic_list_black_36dp"
|
||||
android:background="@drawable/background1"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/note_btn"
|
||||
android:layout_width="100dip"
|
||||
android:layout_height="50dip"
|
||||
android:text="图片"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/picture_btn"
|
||||
android:layout_toEndOf="@+id/picture_btn"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/picture_btn"
|
||||
android:layout_width="100dip"
|
||||
android:layout_height="50dip"
|
||||
android:background="@color/colorPrimary"
|
||||
android:text="笔记"
|
||||
android:textColor="@color/base_color_text_white"
|
||||
android:layout_marginLeft="49dp"
|
||||
android:layout_marginStart="49dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/image_menu"
|
||||
android:layout_toEndOf="@+id/image_menu"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/search_btn"
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip"
|
||||
android:src="@drawable/ic_search_black_48dp"
|
||||
android:background="@drawable/background1"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:text="美景"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/base_color_text_black"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<AbsoluteLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_x="1dp"
|
||||
android:layout_y="238dp"
|
||||
android:text="美女"
|
||||
android:textColor="@color/base_color_text_black"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="368dp"
|
||||
android:layout_height="58dp"
|
||||
android:layout_x="11dp"
|
||||
android:layout_y="86dp"
|
||||
android:text="巴厘岛攻略"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="368dp"
|
||||
android:layout_height="58dp"
|
||||
android:layout_x="9dp"
|
||||
android:layout_y="278dp"
|
||||
android:text="古力娜扎"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/imageButton2"
|
||||
android:layout_width="72dip"
|
||||
android:layout_height="72dip"
|
||||
android:layout_x="303dp"
|
||||
android:layout_y="394dp"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/ic_add_circle_48pt_2x"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="368dp"
|
||||
android:layout_height="58dp"
|
||||
android:layout_x="10dp"
|
||||
android:layout_y="17dp"
|
||||
android:text="长沙美食"/>
|
||||
|
||||
</AbsoluteLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="match_parent">
|
||||
<ImageButton
|
||||
android:id="@+id/picture_show"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="460dip"
|
||||
android:src="@drawable/p5"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/picture_show_cut"
|
||||
android:layout_width="35dip"
|
||||
android:layout_height="35dip"
|
||||
android:src="@drawable/ic_content_cut_18pt_2x"
|
||||
android:layout_below="@id/picture_show"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="120dp"
|
||||
android:background="@color/transparent"
|
||||
/>
|
||||
</RelativeLayout>
|
|
@ -1,91 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background_white">
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/background1"
|
||||
>
|
||||
<ImageButton
|
||||
android:id="@+id/search_btn1"
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="50dip"
|
||||
android:src="@drawable/ic_search_black_48dp"
|
||||
android:background="@drawable/background1"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/search_edit"
|
||||
android:layout_width="250dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_toRightOf="@id/search_btn1"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:text=" 搜索收藏"
|
||||
android:textColor="@color/gray"
|
||||
android:background="@color/white"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/serach_cancle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dip"
|
||||
android:layout_alignTop="@id/search_btn1"
|
||||
android:layout_toRightOf="@id/search_edit"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:text="取消"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="22sp"
|
||||
android:background="@drawable/background1"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/search_note"
|
||||
android:layout_width="100dip"
|
||||
android:layout_height="100dip"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="@drawable/background_white"
|
||||
android:src="@drawable/ic_event_note_36pt_3x" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/search_picture"
|
||||
android:layout_width="100dip"
|
||||
android:layout_height="100dip"
|
||||
android:background="@drawable/background_white"
|
||||
android:src="@drawable/ic_extension_36pt_3x"
|
||||
android:layout_alignTop="@+id/search_note"
|
||||
android:layout_alignLeft="@+id/textView2"
|
||||
android:layout_alignStart="@+id/textView2"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_tv1"
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_below="@id/search_note"
|
||||
android:layout_marginLeft="70dp"
|
||||
android:background="@drawable/background_white"
|
||||
android:text="笔记"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="50dip"
|
||||
android:layout_height="30dip"
|
||||
android:layout_below="@id/search_picture"
|
||||
android:layout_marginLeft="105dp"
|
||||
android:layout_toRightOf="@id/search_tv1"
|
||||
android:background="@drawable/background_white"
|
||||
android:text="图片"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="25sp"
|
||||
android:id="@+id/textView2"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,101 +0,0 @@
|
|||
<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"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
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="com.example.administrator.myapplication.ui.LoginActivity">
|
||||
|
||||
<!-- Login progress -->
|
||||
<ProgressBar
|
||||
android:id="@+id/login_progress"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/login_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sign_form"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="电子邮箱"
|
||||
android:inputType="textEmailAddress"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="密码"
|
||||
android:imeActionId="@+id/sign"
|
||||
android:imeOptions="actionUnspecified"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/passwordensure"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="确认密码"
|
||||
android:imeActionId="@+id/sign"
|
||||
android:imeOptions="actionUnspecified"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true" />
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/sign_up_button"
|
||||
style="?android:textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="注册"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/return_button"
|
||||
style="?android:textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="已经注册过?"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.shuyu.action.web.CustomActionWebView
|
||||
android:id="@+id/customActionWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loadingView"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
|
@ -7,7 +7,7 @@
|
|||
android:id="@+id/beauty_note_icon"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginTop="77dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:src="@mipmap/app_icon"
|
||||
android:contentDescription="@string/app_name"
|
||||
android:scaleType="centerCrop"
|
||||
|
@ -22,17 +22,17 @@
|
|||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/beauty_note_icon"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textColor="#fff"
|
||||
android:textColor="#000"
|
||||
android:text="@string/app_name"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:textColor="#fff"
|
||||
android:textColor="#000"
|
||||
android:text="@string/slogan"
|
||||
android:gravity="center"
|
||||
android:id="@+id/textView4"
|
||||
android:layout_marginBottom="89dp"
|
||||
android:layout_marginBottom="104dp"
|
||||
android:layout_above="@+id/textView5"
|
||||
android:layout_centerHorizontal="true"/>
|
||||
|
||||
|
|
|
@ -7,86 +7,6 @@
|
|||
android:fitsSystemWindows="true"
|
||||
tools:context="com.example.administrator.myapplication.ui.MainActivity">
|
||||
|
||||
<!--<android.support.design.widget.FloatingActionButton-->
|
||||
<!--android:id="@+id/fab"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_gravity="bottom|end"-->
|
||||
<!--android:layout_margin="@dimen/fab_margin"-->
|
||||
<!--app:borderWidth="0dp"-->
|
||||
<!--app:elevation="4dp"-->
|
||||
<!--app:rippleColor="@android:color/transparent"-->
|
||||
<!--android:src="@drawable/actionbar_icon_add" />-->
|
||||
|
||||
<!--<android.support.design.widget.AppBarLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:theme="@style/AppTheme.AppBarOverlay">-->
|
||||
|
||||
<!--<!–<LinearLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:background="@color/black"-->
|
||||
<!-->-->
|
||||
|
||||
<!--<ImageButton-->
|
||||
<!--android:id="@+id/app_bar_menubt"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:src="@drawable/app_bar_menu"-->
|
||||
<!--/>-->
|
||||
|
||||
<!--<android.support.design.widget.TabLayout-->
|
||||
<!--android:id="@+id/app_bar_tablayout"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="30dp"-->
|
||||
<!-->-->
|
||||
<!--</android.support.design.widget.TabLayout>-->
|
||||
|
||||
<!--<ImageButton-->
|
||||
<!--android:id="@+id/app_bar_menu"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginEnd="1dp"-->
|
||||
<!--android:src="@drawable/app_bar_search"/>-->
|
||||
|
||||
|
||||
<!--</LinearLayout>–>-->
|
||||
|
||||
<!--<!–<android.support.v7.widget.Toolbar-->
|
||||
<!--android:id="@+id/toolbar"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="?attr/actionBarSize"-->
|
||||
<!--android:background="?attr/colorPrimary"-->
|
||||
<!--app:popupTheme="@style/AppTheme.PopupOverlay"/>-->
|
||||
<!--–>-->
|
||||
<!--<RelativeLayout-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="40dp"-->
|
||||
<!-->-->
|
||||
|
||||
<!--<ImageButton-->
|
||||
<!--android:id="@+id/app_bar_menu"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--app:srcCompat="@drawable/app_bar_menu"/>-->
|
||||
|
||||
|
||||
|
||||
<!--<ImageButton-->
|
||||
<!--android:id="@+id/app_bar_search"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--app:srcCompat="?android:attr/actionModeWebSearchDrawable"-->
|
||||
<!--android:layout_alignParentTop="true"-->
|
||||
<!--android:layout_alignParentEnd="true"/>-->
|
||||
<!--</RelativeLayout>-->
|
||||
|
||||
<!--</android.support.design.widget.AppBarLayout>-->
|
||||
|
||||
<!--<include layout="@layout/content_main"/>-->
|
||||
|
||||
<!--</android.support.design.widget.CoordinatorLayout>-->
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -129,6 +49,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="图片"/>
|
||||
|
||||
|
||||
</android.support.design.widget.TabLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
android:id="@+id/action_search"
|
||||
android:icon="@drawable/ic_search_black_48dp"
|
||||
android:orderInCategory="80"
|
||||
android:title="search"
|
||||
app:actionViewClass="android.support.v7.widget.SearchView"
|
||||
app:showAsAction="ifRoom" />
|
||||
android:title="搜索" />
|
||||
<!--分享菜单-->
|
||||
<!--item
|
||||
android:id="@+id/action_settings"
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
<string name="change_bg">更换皮肤</string>
|
||||
<string name="share_app">分享应用</string>
|
||||
<string name="about_app">关于应用</string>
|
||||
<string name="about_me">作者:@:天下勇密一家人 </string>
|
||||
<string name="about_me">作者:@:汪子辉、宋杰、张乃夫、陈鹏 </string>
|
||||
<string name="setting">设置</string>
|
||||
<string name="home">主页</string>
|
||||
<string name="author">嗖藏 @天下勇密一家人 All rights reserved </string>
|
||||
<string name="author">嗖藏 @汪子辉、宋杰、张乃夫、陈鹏 All rights reserved </string>
|
||||
<string name="jia_mi">应用加密</string>
|
||||
<string name="slogan">嗖嗖嗖,世界都是你的</string>
|
||||
<string name="exit">退出</string>
|
||||
|
@ -113,7 +113,7 @@
|
|||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="multi_select_list_preference_default_value"/>
|
||||
<string-array name="multi_select_list_preference_default_value" />
|
||||
|
||||
<string name="pref_title_system_sync_settings">System sync settings</string>
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ buildscript {
|
|||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||
classpath 'com.novoda:bintray-release:0.3.4'
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
@ -19,6 +20,10 @@ allprojects {
|
|||
jcenter()
|
||||
maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" }
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven {
|
||||
url "https://maven.google.com"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/build
|
|
@ -1,24 +0,0 @@
|
|||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion "25.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 25
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/guoshuyu/Library/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 *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -1,10 +0,0 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
package="com.shuyu.action.web">
|
||||
|
||||
<application android:allowBackup="true" android:label="@string/app_name"
|
||||
android:supportsRtl="true">
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -1,9 +0,0 @@
|
|||
package com.shuyu.action.web;
|
||||
|
||||
/**
|
||||
* Created by guoshuyu on 2017/6/17.
|
||||
*/
|
||||
|
||||
public interface ActionSelectListener {
|
||||
void onClick(String title, String selectText);
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
package com.shuyu.action.web;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class CustomActionWebView extends WebView {
|
||||
|
||||
static String TAG = "CustomActionWebView";
|
||||
|
||||
ActionMode mActionMode;
|
||||
|
||||
List<String> mActionList = new ArrayList<>();
|
||||
|
||||
ActionSelectListener mActionSelectListener;
|
||||
|
||||
public CustomActionWebView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CustomActionWebView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CustomActionWebView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理item,处理点击
|
||||
* @param actionMode
|
||||
*/
|
||||
private ActionMode resolveActionMode(ActionMode actionMode) {
|
||||
if (actionMode != null) {
|
||||
final Menu menu = actionMode.getMenu();
|
||||
mActionMode = actionMode;
|
||||
menu.clear();
|
||||
for (int i = 0; i < mActionList.size(); i++) {
|
||||
menu.add(mActionList.get(i));
|
||||
}
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
MenuItem menuItem = menu.getItem(i);
|
||||
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
getSelectedData((String) item.getTitle());
|
||||
releaseAction();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
mActionMode = actionMode;
|
||||
return actionMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionMode startActionMode(ActionMode.Callback callback) {
|
||||
ActionMode actionMode = super.startActionMode(callback);
|
||||
return resolveActionMode(actionMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionMode startActionMode(ActionMode.Callback callback, int type) {
|
||||
ActionMode actionMode = super.startActionMode(callback, type);
|
||||
return resolveActionMode(actionMode);
|
||||
}
|
||||
|
||||
private void releaseAction() {
|
||||
if (mActionMode != null) {
|
||||
mActionMode.finish();
|
||||
mActionMode = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击的时候,获取网页中选择的文本,回掉到原生中的js接口
|
||||
* @param title 传入点击的item文本,一起通过js返回给原生接口
|
||||
*/
|
||||
private void getSelectedData(String title) {
|
||||
|
||||
String js = "(function getSelectedText() {" +
|
||||
"var txt;" +
|
||||
"var title = \"" + title + "\";" +
|
||||
"if (window.getSelection) {" +
|
||||
"txt = window.getSelection().toString();" +
|
||||
"} else if (window.document.getSelection) {" +
|
||||
"txt = window.document.getSelection().toString();" +
|
||||
"} else if (window.document.selection) {" +
|
||||
"txt = window.document.selection.createRange().text;" +
|
||||
"}" +
|
||||
"JSInterface.callback(txt,title);" +
|
||||
"})()";
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
evaluateJavascript("javascript:" + js, null);
|
||||
//System.out.println(123);
|
||||
} else {
|
||||
loadUrl("javascript:" + js);
|
||||
//System.out.println(456);
|
||||
}
|
||||
}
|
||||
|
||||
public void linkJSInterface() {
|
||||
addJavascriptInterface(new ActionSelectInterface(this), "JSInterface");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置弹出action列表
|
||||
* @param actionList
|
||||
*/
|
||||
public void setActionList(List<String> actionList) {
|
||||
mActionList = actionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置点击回掉
|
||||
* @param actionSelectListener
|
||||
*/
|
||||
public void setActionSelectListener(ActionSelectListener actionSelectListener) {
|
||||
this.mActionSelectListener = actionSelectListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏消失Action
|
||||
*/
|
||||
public void dismissAction() {
|
||||
releaseAction();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* js选中的回掉接口
|
||||
*/
|
||||
private class ActionSelectInterface {
|
||||
|
||||
CustomActionWebView mContext;
|
||||
|
||||
ActionSelectInterface(CustomActionWebView c) {
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void callback(final String value, final String title) {
|
||||
if(mActionSelectListener != null) {
|
||||
mActionSelectListener.onClick(title, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
<resources>
|
||||
<string name="app_name">library</string>
|
||||
</resources>
|
Loading…
Reference in New Issue