|
|
@@ -1,5 +1,6 @@
|
|
|
package kr.co.hanwha.hifive.screen.main;
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.NonNull;
|
|
|
@@ -18,6 +19,7 @@ import kr.co.hanwha.hifive.data.model.NotificationData;
|
|
|
import kr.co.hanwha.hifive.dialog.HFDefaultDialog;
|
|
|
import kr.co.hanwha.hifive.enums.BaseAnimationType;
|
|
|
import kr.co.hanwha.hifive.enums.BaseToolbarType;
|
|
|
+import kr.co.hanwha.hifive.enums.LandingType;
|
|
|
import kr.co.hanwha.hifive.enums.MainTab;
|
|
|
import kr.co.hanwha.hifive.screen.main.dashboard.MainDashboardFragment;
|
|
|
import kr.co.hanwha.hifive.screen.main.home.MainHomeFragment;
|
|
|
@@ -41,11 +43,7 @@ public class MainActivity extends BaseActivity {
|
|
|
private MainProjectFragment mFragmentProject;
|
|
|
private MainDashboardFragment mFragmentDashboard;
|
|
|
|
|
|
- private LinearLayout mLayoutTab;
|
|
|
- private Animation mAnimTabVisible = null;
|
|
|
- private Animation mAnimTabGone = null;
|
|
|
- private boolean isTabAni = false;
|
|
|
- private ArrayList<Boolean> animationStack = new ArrayList<Boolean>();
|
|
|
+ private int mNotificationValue1 = 0;
|
|
|
|
|
|
@Override
|
|
|
protected int getContentViewResource() {
|
|
|
@@ -66,12 +64,6 @@ public class MainActivity extends BaseActivity {
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
- mLayoutTab = (LinearLayout) findViewById(R.id.tab_linearLayout);
|
|
|
-
|
|
|
-
|
|
|
- MainTab tab = HFInfoUtil.getDefaultScreen(this);
|
|
|
- selectTab(tab);
|
|
|
-
|
|
|
findViewById(R.id.tabTask_imageButton).setOnClickListener(onClickListener);
|
|
|
findViewById(R.id.tabProject_imageButton).setOnClickListener(onClickListener);
|
|
|
findViewById(R.id.tabDashboard_imageButton).setOnClickListener(onClickListener);
|
|
|
@@ -84,7 +76,7 @@ public class MainActivity extends BaseActivity {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- initAnimation();
|
|
|
+ selectTab(getDefaultTab());
|
|
|
|
|
|
// Notice
|
|
|
checkNotice();
|
|
|
@@ -96,6 +88,28 @@ public class MainActivity extends BaseActivity {
|
|
|
checkNotification();
|
|
|
}
|
|
|
|
|
|
+ private MainTab getDefaultTab() {
|
|
|
+ MainTab tab = HFInfoUtil.getDefaultScreen(this);
|
|
|
+ NotificationData data = HFInfoUtil.getNotificationData(this);
|
|
|
+ if (data != null) {
|
|
|
+ int type = 0;
|
|
|
+ try {
|
|
|
+ if (TextUtils.isEmpty(data.getType()) == false)
|
|
|
+ type = Integer.parseInt(data.getType());
|
|
|
+
|
|
|
+ if (type == LandingType.MAIN_UNIT.getCode()) {
|
|
|
+ tab = MainTab.PROJECT;
|
|
|
+ mNotificationValue1 = Integer.parseInt(data.getValue1());
|
|
|
+ } else if (type == LandingType.MAIN_DASHBOARD_UNIT.getCode()) {
|
|
|
+ tab = MainTab.DASHBOARD;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tab;
|
|
|
+ }
|
|
|
+
|
|
|
private void checkLanding(Intent intent) {
|
|
|
if (intent == null) return;
|
|
|
|
|
|
@@ -191,12 +205,13 @@ public class MainActivity extends BaseActivity {
|
|
|
mSelectedTab = tab;
|
|
|
if (mFragmentHome == null)
|
|
|
mFragmentHome = new MainHomeFragment();
|
|
|
-// fragment.setOnMainListener(onMainListener);
|
|
|
replaceFragment(mContainerViewId, mFragmentHome);
|
|
|
} else if (tab == MainTab.PROJECT) {
|
|
|
mSelectedTab = tab;
|
|
|
if (mFragmentProject == null)
|
|
|
mFragmentProject = new MainProjectFragment();
|
|
|
+ mFragmentProject.setProjectId(mNotificationValue1);
|
|
|
+ mNotificationValue1 = 0;
|
|
|
replaceFragment(mContainerViewId, mFragmentProject);
|
|
|
} else if (tab == MainTab.DASHBOARD) {
|
|
|
mSelectedTab = tab;
|
|
|
@@ -207,12 +222,6 @@ public class MainActivity extends BaseActivity {
|
|
|
mSelectedTab = MainTab.SETTING;
|
|
|
MainSettingFragment fragment = new MainSettingFragment();
|
|
|
replaceFragment(mContainerViewId, fragment);
|
|
|
- /*
|
|
|
- HFNetworkUtil networkUtil = new HFNetworkUtil();
|
|
|
- MainWebviewFragment fragment = new MainWebviewFragment();
|
|
|
- fragment.setUrl(networkUtil.getWebUrlSetting());
|
|
|
- replaceFragment(mContainerViewId, fragment);
|
|
|
- */
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -238,91 +247,4 @@ public class MainActivity extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
- private void initAnimation() {
|
|
|
- mAnimTabVisible = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.appear_bottom_tab);
|
|
|
- mAnimTabGone = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.disappear_bottom_tab);
|
|
|
-
|
|
|
- mAnimTabVisible.setAnimationListener(tabVisibleListener);
|
|
|
- mAnimTabGone.setAnimationListener(tabGoneListener);
|
|
|
- }
|
|
|
-
|
|
|
- private void showToolbar(boolean show) {
|
|
|
- try {
|
|
|
- animationStack.add(show);
|
|
|
- if (isTabAni)
|
|
|
- return;
|
|
|
-
|
|
|
- if (show && mLayoutTab.getVisibility() != View.VISIBLE) {
|
|
|
- isTabAni = true;
|
|
|
- mLayoutTab.setVisibility(View.VISIBLE);
|
|
|
- mLayoutTab.setAnimation(mAnimTabVisible);
|
|
|
- mLayoutTab.startAnimation(mAnimTabVisible);
|
|
|
-
|
|
|
-// mLayoutToolbar.setVisibility(View.VISIBLE);
|
|
|
-// mLayoutToolbar.startAnimation(mAnimToolbarVisible);
|
|
|
- } else if (show == false && mLayoutTab.getVisibility() == View.VISIBLE) {
|
|
|
- isTabAni = true;
|
|
|
- mLayoutTab.setAnimation(mAnimTabGone);
|
|
|
- mLayoutTab.startAnimation(mAnimTabGone);
|
|
|
-
|
|
|
-// mLayoutToolbar.startAnimation(mAnimToolbarGone);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Animation.AnimationListener tabVisibleListener = new Animation.AnimationListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animation animation) {
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animation animation) {
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationEnd(Animation animation) {
|
|
|
- mLayoutTab.setVisibility(View.VISIBLE);
|
|
|
- isTabAni = false;
|
|
|
-
|
|
|
- if (animationStack.size() > 0)
|
|
|
- animationStack.remove(0);
|
|
|
- if (animationStack.size() > 0) {
|
|
|
- while (animationStack.size() > 1) {
|
|
|
- animationStack.remove(0);
|
|
|
- }
|
|
|
- boolean show = animationStack.get(0);
|
|
|
- animationStack.remove(0);
|
|
|
- showToolbar(show);
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
- Animation.AnimationListener tabGoneListener = new Animation.AnimationListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animation animation) {
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animation animation) {
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationEnd(Animation animation) {
|
|
|
- mLayoutTab.setVisibility(View.INVISIBLE);
|
|
|
- isTabAni = false;
|
|
|
-
|
|
|
- if (animationStack.size() > 0)
|
|
|
- animationStack.remove(0);
|
|
|
- if (animationStack.size() > 0) {
|
|
|
- while (animationStack.size() > 1) {
|
|
|
- animationStack.remove(0);
|
|
|
- }
|
|
|
- boolean show = animationStack.get(0);
|
|
|
- animationStack.remove(0);
|
|
|
- showToolbar(show);
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
}
|