Skip to content

Commit

Permalink
实现天气+新闻+图片+浏览主体功能
Browse files Browse the repository at this point in the history
cc347504377 committed Nov 11, 2016
1 parent 66bf9cf commit d0875ee
Showing 158 changed files with 6,394 additions and 117 deletions.
3 changes: 3 additions & 0 deletions .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

3 changes: 3 additions & 0 deletions .idea/modules.xml

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

9 changes: 9 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -34,4 +34,13 @@ dependencies {
// ButterKnife
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.jakewharton:butterknife:8.2.1'
//netdemo
compile 'org.ligboy:stetho-okhttp3:0.3.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile project(':map')
compile project(':weather')
compile project(':libzxing')
}
22 changes: 18 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -7,18 +7,32 @@
<application
android:name=".Myapplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/cherishball"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="66b5800ef75563077e4253df6f1d0f52" />

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

</activity>
<activity android:name=".news.view.Newcontentactivity" />
<activity android:name=".netdemo.view.PictureActivity" />
<activity android:name=".netdemo.view.Picturepageractivity" />
<activity android:name=".web.Webviewactivity" />
<activity android:name=".news.view.AddTabactivity" />
<activity android:name=".welcome.Welcomeactivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".news.view.Newcontentactivity" />
<activity android:name=".welcome.Pageractivity">

</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import android.widget.Scroller;
import android.widget.Toast;

import com.luoye.demo.mybrowser.Myapplication;
import com.luoye.demo.mybrowser.news.UtilClass.UtilLog;

/**
@@ -49,9 +50,6 @@ public MyScrollview(Context context, AttributeSet attrs) {

public MyScrollview(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
//注册广播
context.registerReceiver(new Canscroll(), new IntentFilter("can"));

WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics metrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(metrics);
@@ -60,13 +58,17 @@ public MyScrollview(Context context, AttributeSet attrs, int defStyleAttr) {
intent = new Intent(RECEIVERACTION);
mScroller = new Scroller(getContext());
mtoughstop = ViewConfiguration.get(context).getScaledTouchSlop();
//注册广播
Canscroll canscroll = new Canscroll();
Myapplication.canscroll = canscroll;//将广播对象赋给Application方便管理
context.registerReceiver(canscroll, new IntentFilter("can"));
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (isfirst) {
getChildAt(1).getLayoutParams().height = heightPixels-getStatusBarHeight();
getChildAt(1).getLayoutParams().height = heightPixels-getStatusBarHeight()-getChildAt(2).getMeasuredHeight();
contentheight = getChildAt(1).getLayoutParams().height;
otherview = (LinearLayout) getChildAt(0);

@@ -136,8 +138,8 @@ public boolean onTouchEvent(MotionEvent event) {
offsety = (int) (lasty - event.getY());
content.scrollTo(0, offsety + start);
otherview.scrollTo(0,offsety/(contentheight/otherviewheight));
Log.i("TAG", "start: " + start);
Log.i("TAG", "offsety:" + offsety);
// Log.i("TAG", "start: " + start);
// Log.i("TAG", "offsety:" + offsety);
if (offsety > otherviewheight) {
content.scrollTo(0, 0);
}
@@ -192,15 +194,15 @@ public void computeScroll() {

if (start == 0) {
otherview.scrollTo(0, (otherviewheight+mScroller.getCurrY())/ (contentheight / otherviewheight));
Log.i("TAG", (otherviewheight+mScroller.getCurrY())/ (contentheight / otherviewheight)+"-------");
// Log.i("TAG", (otherviewheight+mScroller.getCurrY())/ (contentheight / otherviewheight)+"-------");
}else
otherview.scrollTo(0, (mScroller.getCurrY() - start)/ (contentheight / otherviewheight));
invalidate();
}
}
}

class Canscroll extends BroadcastReceiver{
public class Canscroll extends BroadcastReceiver{

@Override
public void onReceive(Context context, Intent intent) {
Loading

0 comments on commit d0875ee

Please sign in to comment.