| | |
| | | import android.graphics.Color; |
| | | import android.graphics.drawable.ColorDrawable; |
| | | import android.os.Bundle; |
| | | import android.util.TypedValue; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.ImageView; |
| | |
| | | import com.application.zhangshi_app_android.ui.function.PrivacyActivity; |
| | | import com.application.zhangshi_app_android.ui.function.PropertyActivity; |
| | | import com.application.zhangshi_app_android.ui.function.TourismActivity; |
| | | import com.application.zhangshi_app_android.ui.home.HomeFragment; |
| | | import com.application.zhangshi_app_android.ui.home.TreeFragment; |
| | | import com.application.zhangshi_app_android.ui.main.MainActivity; |
| | | import com.github.gzuliyujiang.wheelpicker.DatePicker; |
| | | import com.github.gzuliyujiang.wheelpicker.OptionPicker; |
| | |
| | | return R.layout.layout_drawer; |
| | | }; |
| | | |
| | | |
| | | @Override |
| | | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| | | |
| | | //设置主题 |
| | | if (UserManager.getInstance().getNightModeState()) { |
| | | setTheme(R.style.AppTheme_Night); |
| | | } else { |
| | | setTheme(R.style.AppTheme_Normal); |
| | | } |
| | | |
| | | super.onCreate(savedInstanceState); |
| | | |
| | | if (mDrawerLayout != null) { |
| | | classMap.put(HomeFragment.class,(LinearLayout) findViewById(R.id.dl_home_root_net)); |
| | | classMap.put(TreeFragment.class,(LinearLayout) findViewById(R.id.dl_home_root_net)); |
| | | classMap.put(FamilyMemorabiliaActivity.class,(LinearLayout) findViewById(R.id.dl_family_memorabilia)); |
| | | classMap.put(FamilyAssetsActivity.class,(LinearLayout) findViewById(R.id.dl_family_assets)); |
| | | classMap.put(HomeDevicesActivity.class,(LinearLayout) findViewById(R.id.dl_home_devices)); |
| | |
| | | if (linearLayout != null) { |
| | | linearLayout.setOnClickListener(v -> { |
| | | if (set.getKey() != null){ |
| | | if (set.getKey() == HomeFragment.class) { |
| | | MainActivity.start(this, HomeFragment.class); |
| | | if (set.getKey() == TreeFragment.class) { |
| | | MainActivity.start(this, TreeFragment.class); |
| | | }else{ |
| | | if(this.getClass() != set.getKey()){ |
| | | AppManager.getAppManager().startActivity(set.getKey()); |
| | |
| | | } |
| | | TextView textView = (TextView) linearLayout.getChildAt(1); |
| | | ImageView imageView = (ImageView) linearLayout.getChildAt(2); |
| | | textView.setTextColor(Color.parseColor("#FFF6739F")); |
| | | imageView.setBackgroundResource(R.drawable.ic_vector_pink); |
| | | TypedValue textColor = new TypedValue(); |
| | | getTheme().resolveAttribute(R.attr.drawerTextColor, textColor, true); |
| | | textView.setTextColor(textColor.data); |
| | | TypedValue icon = new TypedValue(); |
| | | getTheme().resolveAttribute(R.attr.drawerSelectIcon, icon, true); |
| | | imageView.setBackgroundResource(icon.resourceId); |
| | | } |
| | | |
| | | |