Esempio n. 1
0
 public static String getFragmentTag(Board b, int threadId) {
   if (threadId == -1) {
     return String.format("/%s/", b.getId());
   } else {
     return String.format("/%s/%d", b.getId(), threadId);
   }
 }
Esempio n. 2
0
 @Override
 protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   if (intent.getAction() == null) {
     return;
   } else if (intent.getAction().equals("co.wakarimasen.chanexplorer.ACTION_VIEW")) {
     Board b = Board.getBoardById(intent.getStringExtra("Board"));
     int threadId = intent.getIntExtra("Thread", -1);
     int postId = intent.getIntExtra("Post", -1);
     getHomeFragment().selectOrAddThread(b, threadId, postId);
   } else if (intent.getAction().equals("co.wakarimasen.chanexplorer.FIX_POST")) {
     Board b = Board.getBoardById(intent.getStringExtra("Board"));
     int threadId = intent.getIntExtra("Thread", -1);
     NewPost np = intent.getParcelableExtra("NewPostInfo");
     getHomeFragment().selectOrAddThread(b, threadId, -1);
     ChanPage cp = getHomeFragment().getCurrentChanPage();
     mNewPostView.setNewPost(cp.getBoard(), cp.getThreadId(), np);
     cp.setNewPost(np);
     mNewPostView.refreshCaptcha();
     getSlidingMenu().showContent();
   } else if (intent.getAction().equals(Intent.ACTION_VIEW)) {
     Uri data = getIntent().getData();
     if (data == null) {
       return;
     }
     String host = data.getHost(); // "twitter.com"
     if (host.equals("boards.4chan.org")) {
       List<String> params = data.getPathSegments();
       if (params.size() == 1) {
         Board b = Board.getBoardById(params.get(0));
         if (b != null) {
           getHomeFragment().selectOrAddThread(b, -1, -1);
         }
       }
       if (params.size() == 3) {
         Board b = Board.getBoardById(params.get(0));
         if (b != null) {
           int threadId = Integer.parseInt(params.get(2));
           int postId = -1;
           if (data.getFragment() != null) {
             postId = Integer.parseInt(data.getFragment());
           }
           getHomeFragment().selectOrAddThread(b, threadId, postId);
         }
       }
     }
   }
 }