@Override
 protected void onResume() {
   if (action.equals("new")) {
     if (StringUtil.isEmpty(toText.getText().toString())) {
       toText.requestFocus();
     } else {
       titleText.requestFocus();
     }
   } else {
     bodyText.requestFocus();
   }
   if (uploadTask != null) {
     FileUploadTask temp = uploadTask;
     uploadTask = null;
     if (ActivityUtil.isGreaterThan_2_3_3()) {
       RunParallel(temp);
     } else {
       temp.execute();
     }
   }
   if (PhoneConfiguration.getInstance().fullscreen) {
     ActivityUtil.getInstance().setFullScreen(v);
   }
   super.onResume();
 }
 @Override
 protected void onResume() {
   load();
   if (PhoneConfiguration.getInstance().fullscreen) {
     ActivityUtil.getInstance().setFullScreen(wv);
   }
   super.onResume();
 }
  @Override
  protected void onSaveInstanceState(Bundle outState) {

    super.onSaveInstanceState(outState);
    outState.putInt("pageCount", mTabsAdapter.getCount());
    outState.putInt("tab", mViewPager.getCurrentItem());
    //   outState.putInt("tid",tid);

  }
  @Override
  protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    this.setContentView(R.layout.topiclist_activity);
    PullToRefreshAttacher.Options options = new PullToRefreshAttacher.Options();
    options.refreshScrollDistance = 0.3f;
    options.refreshOnUp = true;
    mPullToRefreshAttacher = PullToRefreshAttacher.get(this, options);

    if (ActivityUtil.isNotLessThan_4_0()) setNfcCallBack();

    if (null == findViewById(R.id.item_detail_container)) {
      dualScreen = false;
    }
    FragmentManager fm = getSupportFragmentManager();
    Fragment f1 = fm.findFragmentById(R.id.item_list);
    if (f1 == null) {
      f1 = new TopiclistContainer();
      Bundle args = new Bundle(); // (getIntent().getExtras());
      if (null != getIntent().getExtras()) {
        args.putAll(getIntent().getExtras());
      }
      args.putString("url", getIntent().getDataString());
      f1.setArguments(args);
      FragmentTransaction ft = fm.beginTransaction().add(R.id.item_list, f1);
      // .add(R.id.item_detail_container, f);
      ft.commit();
    }
    Fragment f2 = fm.findFragmentById(R.id.item_detail_container);
    if (null == f2) {
      f1.setHasOptionsMenu(true);
    } else if (!dualScreen) {
      this.setTitle(R.string.app_name);
      fm.beginTransaction().remove(f2).commit();
      f1.setHasOptionsMenu(true);
    } else {
      f1.setHasOptionsMenu(false);
      f2.setHasOptionsMenu(true);
    }

    int fid = getIntent().getIntExtra("fid", 0);
    if (fid != 0) {
      String boardName = BoardHolder.boardNameMap.get(fid);
      if (null != boardName) {
        strs[0] = boardName;
      }
    }
    int favor = getIntent().getIntExtra("favor", 0);
    int authorid = getIntent().getIntExtra("authorid", 0);
    if (favor == 0 && authorid == 0) {
      setNavigation();
    } else {
      flags = ThemeManager.ACTION_BAR_FLAG;
    }
  }
 @Override
 protected void onResume() {
   int orentation = ThemeManager.getInstance().screenOrentation;
   if (orentation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
       || orentation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
     setRequestedOrientation(orentation);
   } else {
     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
   }
   super.onResume();
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_CANCELED || data == null) return;
   switch (requestCode) {
     case REQUEST_CODE_SELECT_PIC:
       Log.i(LOG_TAG, " select file :" + data.getDataString());
       uploadTask = new FileUploadTask(this, this, data.getData());
       break;
     default:;
   }
   super.onActivityResult(requestCode, resultCode, data);
 }
  // private final String IPHONE_UA = "Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X)
  // AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48.3";
  @Override
  protected void onCreate(Bundle arg0) {
    if (ActivityUtil.isGreaterThan_2_3_3()) requestWindowFeature(Window.FEATURE_PROGRESS);
    super.onCreate(arg0);
    View view = LayoutInflater.from(this).inflate(R.layout.webview_layout, null, false);
    this.setContentView(view);
    wv = (WebView) findViewById(R.id.webview);
    wv.getSettings()
        .setUserAgentString(getString(R.string.clientua) + ((MyApp) getApplication()).version);
    if (ActivityUtil.isGreaterThan_2_3_3())
      wv.setWebChromeClient(
          new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {

              ImageViewerActivity.this.setProgress(progress * 100);
            }
          });
  }
Example #8
0
 @Override
 protected void onCreate(@Nullable Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.web_activity);
   ButterKnife.bind(this);
   setSupportActionBar(toolBar);
   ActionBar actionBar = getSupportActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
   setTranslucentStatus(ContextCompat.getColor(this, R.color.colorPrimary));
   webview.setWebViewClient(new ComWebViewClient(webview));
   ComWebViewChromeClient chromeClient = new ComWebViewChromeClient();
   chromeClient.setListener(progressListener);
   webview.setWebChromeClient(chromeClient);
   Intent intent = getIntent();
   String url = intent.getExtras().getString("url");
   webview.loadUrl(url);
   progressBar.setProgressTintList(
       ColorStateList.valueOf(ContextCompat.getColor(this, R.color.colorPrimary)));
 }
  @Override
  protected void onResume() {
    int orentation = ThemeManager.getInstance().screenOrentation;
    if (orentation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        || orentation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
      setRequestedOrientation(orentation);
    } else {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }

    if (asynTask != null) {
      asynTask.cancel(true);
      asynTask = null;
    }
    long now = System.currentTimeMillis();
    PhoneConfiguration config = PhoneConfiguration.getInstance();
    if (now - config.lastMessageCheck > 60 * 1000 && config.notification) {
      Log.d(TAG, "start to check Reply Notification");
      asynTask = new CheckReplyNotificationTask(this);
      asynTask.execute(config.getCookie());
    }
    super.onResume();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(getViewId());

    if (PhoneConfiguration.getInstance().uploadLocation
        && PhoneConfiguration.getInstance().location == null) {
      ActivityUtil.reflushLocation(this);
    }

    /*PullToRefreshViewPager
    refreshPager = (PullToRefreshViewPager) findViewById(R.id.pull_refresh_viewpager);
    refreshPager.setMode(Mode.PULL_FROM_START);
    refreshPager.setOnRefreshListener(new OnRefreshListener<ViewPager>(){

    	@Override
    	public void onRefresh(PullToRefreshBase<ViewPager> refreshView) {
    		finish();

    	}

    });

    mViewPager = refreshPager.getRefreshableView();
    */

    mViewPager = (ViewPager) findViewById(R.id.pager);
    if (ActivityUtil.isNotLessThan_4_0()) {
      setNfcCallBack();
    }

    tid = 7;
    int pageFromUrl = 0;
    String url = this.getIntent().getDataString();
    if (null != url) {
      tid = this.getUrlParameter(url, "tid");
      pid = this.getUrlParameter(url, "pid");
      authorid = this.getUrlParameter(url, "authorid");
      pageFromUrl = this.getUrlParameter(url, "page");
    } else {
      tid = this.getIntent().getIntExtra("tid", 0);
      pid = this.getIntent().getIntExtra("pid", 0);
      authorid = this.getIntent().getIntExtra("authorid", 0);
    }

    View v = findViewById(android.R.id.content); // .getChildAt(0);
    tabhost = (TabHost) findViewById(android.R.id.tabhost);

    if (tabhost != null) {
      tabhost.setup();
      mTabsAdapter = new TabsAdapter(this, tabhost, mViewPager, ArticleListFragment.class);
    } else {
      mTabsAdapter =
          new ThreadFragmentAdapter(
              this, getSupportFragmentManager(), mViewPager, ArticleListFragment.class);
    }

    mTabsAdapter.setArgument("id", tid);
    mTabsAdapter.setArgument("pid", pid);
    mTabsAdapter.setArgument("authorid", authorid);
    ActivityUtil.getInstance().noticeSaying(this);

    if (savedInstanceState != null) {
      int pageCount = savedInstanceState.getInt("pageCount");
      if (pageCount != 0) {
        mTabsAdapter.setCount(pageCount);
        mViewPager.setCurrentItem(savedInstanceState.getInt("tab"));
      }

    } else if (0 != getUrlParameter(url, "page")) {

      mTabsAdapter.setCount(pageFromUrl);
      mViewPager.setCurrentItem(pageFromUrl);
    }
  }
 @Override
 protected void onPause() {
   wv.stopLoading();
   wv.loadUrl("about:blank");
   super.onPause();
 }
 @Override
 protected void onStop() {
   wv.stopLoading();
   super.onStop();
 }
  /*
   * (non-Javadoc)
   *
   * @see android.app.Activity#onCreate(android.os.Bundle)
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    int orentation = ThemeManager.getInstance().screenOrentation;
    if (orentation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
        || orentation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
      setRequestedOrientation(orentation);
    } else {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }

    super.onCreate(savedInstanceState);
    v = this.getLayoutInflater().inflate(R.layout.messagereply, null);
    v.setBackgroundColor(getResources().getColor(ThemeManager.getInstance().getBackgroundColor()));
    this.setContentView(v);

    if (PhoneConfiguration.getInstance().uploadLocation
        && PhoneConfiguration.getInstance().location == null) {
      ActivityUtil.reflushLocation(this);
    }

    Intent intent = this.getIntent();
    prefix = intent.getStringExtra("prefix");
    // if(prefix!=null){
    // prefix=prefix.replaceAll("\\n\\n", "\n");
    // }
    tousername = intent.getStringExtra("to");
    action = intent.getStringExtra("action");
    mid = intent.getIntExtra("mid", 0);
    String title = intent.getStringExtra("title");

    titleText = (EditText) findViewById(R.id.reply_titile_edittext);
    toText = (EditText) findViewById(R.id.reply_titile_edittext_to);
    bodyText = (EditText) findViewById(R.id.reply_body_edittext);

    if (action.equals("new")) {
      getSupportActionBar().setTitle(R.string.new_message);
    } else if (action.equals("reply")) {
      getSupportActionBar().setTitle(R.string.reply_message);
    }
    titleText.setSelected(true);

    act = new MessagePostAction(mid, "", "");
    act.setAction_(action);
    this.act.set__ngaClientChecksum(FunctionUtil.getngaClientChecksum(this));
    loading = false;

    if (!StringUtil.isEmpty(tousername)) {
      toText.setText(tousername);
      if (!StringUtil.isEmpty(title)) {
        titleText.setText(title);
      }
    } else {
      if (!StringUtil.isEmpty(title)) {
        titleText.setText(title);
      }
    }
    if (prefix != null) {
      if (prefix.startsWith("[quote][pid=") && prefix.endsWith("[/quote]\n")) {
        SpannableString spanString = new SpannableString(prefix);
        spanString.setSpan(
            new BackgroundColorSpan(-1513240),
            0,
            prefix.length(),
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        spanString.setSpan(
            new StyleSpan(android.graphics.Typeface.BOLD),
            prefix.indexOf("[b]Post by"),
            prefix.indexOf("):[/b]") + 5,
            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        bodyText.append(spanString);
      } else {
        bodyText.append(prefix);
      }
      bodyText.setSelection(prefix.length());
    }
    ThemeManager tm = ThemeManager.getInstance();
    if (tm.getMode() == ThemeManager.MODE_NIGHT) {
      bodyText.setBackgroundResource(tm.getBackgroundColor());
      toText.setBackgroundResource(tm.getBackgroundColor());
      titleText.setBackgroundResource(tm.getBackgroundColor());
      int textColor = this.getResources().getColor(tm.getForegroundColor());
      bodyText.setTextColor(textColor);
      titleText.setTextColor(textColor);
      toText.setTextColor(textColor);
    }
  }