Skip to content

Commit

Permalink
加入三星分屏sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
wenmingvs committed Sep 4, 2016
1 parent 1aec98d commit e71c348
Show file tree
Hide file tree
Showing 19 changed files with 253 additions and 31 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.1.3'
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Apr 14 22:30:47 CST 2016
#Mon Sep 05 00:51:36 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6 changes: 5 additions & 1 deletion weiSwift/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
compileSdkVersion 24
buildToolsVersion '23.0.3'

defaultConfig {
Expand All @@ -28,6 +28,8 @@ dependencies {
compile project(':weiboSDK')
compile project(path: ':swipebacklayout')
compile files('libs/universal-image-loader-1.9.5.jar')
compile files('libs/sdk-v1.0.0.jar')
compile files('libs/multiwindow-v1.3.2.jar')

compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
Expand All @@ -41,4 +43,6 @@ dependencies {
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'

compile 'org.greenrobot:eventbus:3.0.0'
}
Binary file added weiSwift/libs/multiwindow-v1.3.2.jar
Binary file not shown.
Binary file added weiSwift/libs/sdk-v1.0.0.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion weiSwift/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.VIBRATE" />

<application
android:name=".MyApplication"
Expand Down Expand Up @@ -124,6 +124,10 @@
<activity
android:name=".ui.login.fragment.profile.myphoto.MyPhotoActivity"
android:theme="@style/WeiBoHoloWindowTranslucent" />
<activity
android:name=".ui.login.activity.BackgroundActivity"
android:theme="@style/noAnimationTheme"/>

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.wenming.library.LogReport;
import com.wenming.library.save.imp.CrashWriter;
import com.wenming.library.upload.email.EmailReporter;
import com.wenming.weiswift.ui.login.activity.BackgroundActivity;
import com.wenming.weiswift.utils.LogUtil;
import com.wenming.weiswift.utils.SharedPreferencesUtil;

Expand Down Expand Up @@ -89,8 +90,11 @@ public void finishAll() {
}
}

public void recreateAll() {
public void recreateForNightMode() {
for (Activity activity : mActivityList) {
if (activity instanceof BackgroundActivity) {
return;
}
if (!activity.isFinishing()) {
activity.recreate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void refreshUserName(Context context) {
mUserModel.show(Long.valueOf(AccessTokenKeeper.readAccessToken(context).getUid()), context, new UserModel.OnUserDetailRequestFinish() {
@Override
public void onComplete(User user) {
mHomeFragmentView.setCurrentUser(user);
mHomeFragmentView.setGroupName(user.name);
mHomeFragmentView.setUserName(user.name);
mHomeFragmentView.popWindowsDestory();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.wenming.weiswift.mvp.view;

import com.wenming.weiswift.entity.Status;
import com.wenming.weiswift.entity.User;

import java.util.ArrayList;

Expand Down Expand Up @@ -62,6 +63,12 @@ public interface HomeFragmentView {
*/
public void scrollToTop(boolean refreshData);

/**
* 设置当前的用户
* @param user
*/
public void setCurrentUser(User user);


public void showRecyclerView();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package com.wenming.weiswift.ui.login.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.CircleBitmapDisplayer;
import com.wenming.weiswift.R;
import com.wenming.weiswift.entity.User;
import com.wenming.weiswift.utils.SharedPreferencesUtil;

import org.greenrobot.eventbus.EventBus;

/**
* Created by wenmingvs on 2016/9/4.
*/
public class BackgroundActivity extends Activity {
private Context mContext;
private ImageView mProfile_myimg;
private TextView mProfile_mydescribe;
private TextView mProfile_myname;
private TextView mStatuses_count;
private TextView mFriends_count;
private TextView mFollowers_count;
private CheckBox mCheckBox;
private User mUser;
private DisplayImageOptions options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.avator_default)
.showImageForEmptyUri(R.drawable.avator_default)
.showImageOnFail(R.drawable.avator_default)
.cacheInMemory(true)
.cacheOnDisk(true)
.considerExifParams(true)
.displayer(new CircleBitmapDisplayer(14671839, 1))
.build();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bgactivity_layout);
mContext = this;
mUser = getIntent().getParcelableExtra("user");
if (mUser != null){
initContent();
}
runOnUiThread(new Runnable() {
@Override
public void run() {
EventBus.getDefault().post("yes");
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mHandler.sendEmptyMessage(0x11);
}
}, 500);
}
});

}

private void initContent() {
mProfile_myimg = (ImageView) findViewById(R.id.profile_myimg);
mProfile_myname = (TextView) findViewById(R.id.profile_myname);
mProfile_mydescribe = (TextView) findViewById(R.id.profile_mydescribe);
mStatuses_count = (TextView) findViewById(R.id.profile_statuses_count);
mFollowers_count = (TextView) findViewById(R.id.profile_followers_count);
mFriends_count = (TextView) findViewById(R.id.profile_friends_count);
mCheckBox = (CheckBox) findViewById(R.id.nightMode_cb);

boolean isNightMode = (boolean) SharedPreferencesUtil.get(mContext, "setNightMode", false);
mCheckBox.setChecked(isNightMode);
ImageLoader.getInstance().displayImage(mUser.avatar_hd, mProfile_myimg, options);
mProfile_myname.setText(mUser.name);
mProfile_mydescribe.setText("简介:" + mUser.description);
mStatuses_count.setText(mUser.statuses_count + "");
mFriends_count.setText(mUser.friends_count + "");
mFollowers_count.setText(mUser.followers_count + "");
}

@Override
protected void onDestroy() {
mHandler.removeCallbacksAndMessages(null);
super.onDestroy();
}

@Override
public void finish() {
super.finish();
overridePendingTransition(0,R.anim.bg_activity_out);
}

private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
finish();
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,11 @@ private void showDiscoveryFragment() {
private void showProfileFragment() {
mProfile.setSelected(true);
if (mProfileFragment == null) {
mProfileFragment = new ProfileFragment();
if (mHomeFragment != null && mHomeFragment.getCurrentUser() != null){
mProfileFragment = ProfileFragment.newInstance(mHomeFragment.getCurrentUser());
}else {
mProfileFragment =ProfileFragment.newInstance();
}
mTransaction.add(R.id.contentLayout, mProfileFragment, PROFILE_FRAGMENT);
} else {
mTransaction.show(mProfileFragment);
Expand Down Expand Up @@ -501,6 +505,7 @@ private void changeTheme() {

/**
* ImageView的动画
*
* @param view
*/
private void startAnimation(final View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.wenming.weiswift.R;
import com.wenming.weiswift.entity.Status;
import com.wenming.weiswift.entity.User;
import com.wenming.weiswift.mvp.presenter.HomeFragmentPresent;
import com.wenming.weiswift.mvp.presenter.WeiBoArrowPresent2;
import com.wenming.weiswift.mvp.presenter.imp.HomeFragmentPresentImp;
Expand Down Expand Up @@ -61,7 +62,7 @@ public class HomeFragment extends Fragment implements HomeFragmentView, ArrowDia
private long mCurrentGroup = Constants.GROUP_TYPE_ALL;
private LinearLayout mEmptyLayout;
private GroupPopWindow mPopWindow;

private User mCurrentUser;
private boolean mComeFromAccoutActivity;
private String mUserName;

Expand All @@ -74,7 +75,7 @@ public class HomeFragment extends Fragment implements HomeFragmentView, ArrowDia
/**
* 手指滑动距离多少个像素点的距离,才隐藏bar
*/
private static int sHideThreshold ;
private static int sHideThreshold;
/**
* 记录手指滑动的距离
*/
Expand All @@ -91,7 +92,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
mContext = getContext();
mHomePresent = new HomeFragmentPresentImp(this);
mComeFromAccoutActivity = getArguments().getBoolean("comeFromAccoutActivity");
sHideThreshold = DensityUtil.dp2px(mContext,20);
sHideThreshold = DensityUtil.dp2px(mContext, 20);
mView = inflater.inflate(R.layout.mainfragment_layout, container, false);
mRecyclerView = (RecyclerView) mView.findViewById(R.id.weiboRecyclerView);
mTopBar = (RelativeLayout) mView.findViewById(R.id.toolbar_home);
Expand Down Expand Up @@ -225,6 +226,11 @@ public void run() {
}
}

@Override
public void setCurrentUser(User user) {
mCurrentUser = user;
}

@Override
public void showRecyclerView() {
if (mSwipeRefreshLayout.getVisibility() != View.VISIBLE) {
Expand Down Expand Up @@ -447,5 +453,7 @@ public interface onButtonBarListener {
void hideButtonBar();
}


public User getCurrentUser() {
return mCurrentUser;
}
}
Loading

0 comments on commit e71c348

Please sign in to comment.