Пример #1
0
 private void loadUserRelation(int relation) {
   switch (relation) {
     case User.RELATION_TYPE_BOTH:
       mRelation.setCompoundDrawablesWithIntrinsicBounds(
           R.drawable.widget_bar_relation_del, 0, 0, 0);
       mRelation.setText("取消互粉");
       break;
     case User.RELATION_TYPE_FANS_HIM:
       mRelation.setCompoundDrawablesWithIntrinsicBounds(
           R.drawable.widget_bar_relation_del, 0, 0, 0);
       mRelation.setText("取消关注");
       break;
     case User.RELATION_TYPE_FANS_ME:
       mRelation.setCompoundDrawablesWithIntrinsicBounds(
           R.drawable.widget_bar_relation_add, 0, 0, 0);
       mRelation.setText("加关注");
       break;
     case User.RELATION_TYPE_NULL:
       mRelation.setCompoundDrawablesWithIntrinsicBounds(
           R.drawable.widget_bar_relation_add, 0, 0, 0);
       mRelation.setText("加关注");
       break;
   }
   if (relation > 0) mRelation.setOnClickListener(relationClickListener);
 }
 public void onClikButtonMenu(View v) {
   RadioButton radioButton;
   radioButton = (RadioButton) findViewById(R.id.btnHome2);
   radioButton.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_home_passive, 0, 0);
   radioButton = (RadioButton) findViewById(R.id.btnHistory2);
   radioButton.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_history_passive, 0, 0);
   radioButton = (RadioButton) findViewById(R.id.btnNotif2);
   radioButton.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_notif_passive, 0, 0);
   radioButton = (RadioButton) findViewById(R.id.btnOrder2);
   radioButton.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_request_passive, 0, 0);
   radioButton = (RadioButton) findViewById(R.id.btnMore2);
   radioButton.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_more_passive, 0, 0);
   boolean checked = ((RadioButton) v).isChecked();
   if (v.getId() == R.id.btnHistory2) {
     if (checked) {
       ((RadioButton) v)
           .setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_history_active, 0, 0);
       FragmentTransaction ft = fm.beginTransaction();
       ft.replace(R.id.tourist_home_fragment, new TouristHistoryFragment());
       ft.commit();
     }
   } else if (v.getId() == R.id.btnNotif2) {
     if (checked) {
       ((RadioButton) v)
           .setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_notif_active, 0, 0);
       FragmentTransaction ft = fm.beginTransaction();
       ft.replace(R.id.tourist_home_fragment, new TouristNotifFragment());
       ft.commit();
     }
   } else if (v.getId() == R.id.btnHome2) {
     if (checked) {
       ((RadioButton) v).setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_home_active, 0, 0);
       FragmentTransaction ft = fm.beginTransaction();
       ft.replace(R.id.tourist_home_fragment, new TouristHomeFragment());
       ft.commit();
     }
   } else if (v.getId() == R.id.btnOrder2) {
     if (checked) {
       ((RadioButton) v)
           .setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_request_active, 0, 0);
       FragmentTransaction ft = fm.beginTransaction();
       ft.replace(R.id.tourist_home_fragment, new TouristRequestFragment());
       ft.commit();
     }
   } else if (v.getId() == R.id.btnMore2) {
     if (checked) {
       ((RadioButton) v).setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_more_active, 0, 0);
       FragmentTransaction ft = fm.beginTransaction();
       ft.replace(R.id.tourist_home_fragment, new TouristMoreFragment());
       ft.commit();
     }
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tourist_home);

    fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.add(R.id.tourist_home_fragment, new TouristHomeFragment());
    ft.commit();
    RadioButton radioButton;
    radioButton = (RadioButton) findViewById(R.id.btnHome2);
    radioButton.setCompoundDrawablesWithIntrinsicBounds(0, R.mipmap.ic_home_active, 0, 0);
  }
Пример #4
0
 private void init() {
   homePageRadioButton = (RadioButton) findViewById(R.id.homePageRadioButton);
   homePageRadioButton.setOnClickListener(this);
   homeCommodityRadioButton = (RadioButton) findViewById(R.id.homeCommodityRadioButton);
   homeCommodityRadioButton.setOnClickListener(this);
   homeShoppingCartRadioButton = (RadioButton) findViewById(R.id.homeShoppingCartRadioButton);
   homeShoppingCartRadioButton.setOnClickListener(this);
   homePersonalRadioButton = (RadioButton) findViewById(R.id.homePersonalRadioButton);
   homePersonalRadioButton.setOnClickListener(this);
   homePageFragment = new HomepageFragment();
   commodityFragment = new CommodityFragment();
   shoppingCartFragment = new ShoppingCartFragment();
   personalFragment = new PersonalFragment();
   // 初始化第一个页面
   changeFrament(homePageFragment, null, "homePageFragment");
   homePageRadioButton.setCompoundDrawablesWithIntrinsicBounds(
       0, R.drawable.home_homepage_tab_pressed2, 0, 0);
   homePageRadioButton.setTextColor(getResources().getColor(R.color.common_title_bg));
 }
Пример #5
0
  // 初始化信息
  public void init() {
    mainRadioButton = (RadioButton) findViewById(R.id.mainRadioButton);
    mainRadioButton.setOnClickListener(this);
    robRadioButton = (RadioButton) findViewById(R.id.robRadioButton);
    robRadioButton.setOnClickListener(this);
    myinfoRadioButton = (RadioButton) findViewById(R.id.myinfoRadioButton);
    myinfoRadioButton.setOnClickListener(this);
    mainFragment = new MainFragment();
    robFragment = new RobFragment();
    myinfoFragment = new MyinfoFragment();
    // 初始化第一个页面
    changeFrament(mainFragment, null, "mainFragment");
    mainRadioButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tab_main_pressed, 0, 0);
    mainRadioButton.setTextColor(getResources().getColor(R.color.common_title_bg));

    // 注册接收消息广播
    receiver = new NewMessageBroadcastReceiver();
    IntentFilter intentFilter =
        new IntentFilter(EMChatManager.getInstance().getNewMessageBroadcastAction());
    // 设置广播的优先级别大于Mainacitivity,这样如果消息来的时候正好在chat页面,直接显示消息,而不是提示消息未读
    intentFilter.setPriority(5);
    registerReceiver(receiver, intentFilter);

    // 注册一个ack回执消息的BroadcastReceiver
    IntentFilter ackMessageIntentFilter =
        new IntentFilter(EMChatManager.getInstance().getAckMessageBroadcastAction());
    ackMessageIntentFilter.setPriority(5);
    registerReceiver(ackMessageReceiver, ackMessageIntentFilter);

    // 注册一个透传消息的BroadcastReceiver
    IntentFilter cmdMessageIntentFilter =
        new IntentFilter(EMChatManager.getInstance().getCmdMessageBroadcastAction());
    cmdMessageIntentFilter.setPriority(5);
    registerReceiver(cmdMessageReceiver, cmdMessageIntentFilter);

    // 通知sdk,UI 已经初始化完毕,注册了相应的receiver和listener, 可以接受broadcast了
    EMChat.getInstance().setAppInited();
  }
  private void sendPreferredLanguage(final int paramInt) {
    ICartApplication localICartApplication = getApplication();
    Object localObject4 =
        localICartApplication.getLocaleByCountryCode(localICartApplication.getCountryCode());
    Object localObject1 = "en";
    final Object localObject2 = Locale.ENGLISH;
    final Object localObject3 = this.mRbEnglish;
    if (paramInt == 2131558789) {
      RadioButton localRadioButton = this.mRbLocalLanguage;
      String str = ((Locale) localObject4).getLanguage();
      localObject1 = str;
      localObject2 = localObject4;
      localObject3 = localRadioButton;
      if ("in".equalsIgnoreCase(str)) {
        localObject1 = "id";
        localObject3 = localRadioButton;
        localObject2 = localObject4;
      }
    }
    localObject4 = new CircularProgressDrawable(2131493005, 4.0F);
    ((RadioButton) localObject3)
        .setCompoundDrawablesWithIntrinsicBounds(null, null, (Drawable) localObject4, null);
    ((CircularProgressDrawable) localObject4).setBounds(-30, -30, 30, 30);
    ((CircularProgressDrawable) localObject4)
        .setColorFilter(getResources().getColor(2131493005), PorterDuff.Mode.LIGHTEN);
    ((CircularProgressDrawable) localObject4).start();
    try {
      localICartApplication
          .getUserManager()
          .sendPreferredLanguage(
              (String) localObject1,
              new ICartCallback(TAG) {
                public void onFailure(Throwable paramAnonymousThrowable) {
                  localObject3.setCompoundDrawables(null, null, null, null);
                  if (paramInt == 2131558788) {
                    MyAccountFragment.this.mRbEnglish.setChecked(false);
                    MyAccountFragment.this.mRbLocalLanguage.setChecked(true);
                    return;
                  }
                  MyAccountFragment.this.mRbEnglish.setChecked(true);
                  MyAccountFragment.this.mRbLocalLanguage.setChecked(false);
                }

                public void onSuccess(User paramAnonymousUser) {
                  MyAccountFragment.this
                      .getApplication()
                      .getSharedPreferencesManager()
                      .saveLocale(localObject2);
                  if (MyAccountFragment.this.getActivity() != null) {
                    localObject3.setCompoundDrawables(null, null, null, null);
                    MyAccountFragment.this.restartApp();
                  }
                }
              });
      return;
    } catch (Exception localException) {
      ((RadioButton) localObject3).setCompoundDrawables(null, null, null, null);
      if (paramInt == 2131558788) {
        this.mRbEnglish.setChecked(false);
        this.mRbLocalLanguage.setChecked(true);
        return;
      }
      this.mRbEnglish.setChecked(true);
      this.mRbLocalLanguage.setChecked(false);
    }
  }