Example #1
0
  @Override
  public void onCreate(Bundle savedInstance) {

    super.onCreate(savedInstance);
    subreddit = getIntent().getExtras().getString("subreddit", "");

    getTheme().applyStyle(new ColorPreferences(this).getThemeSubreddit(subreddit), true);
    getTheme().applyStyle(new FontPreferences(this).getFontStyle().getResId(), true);
    setContentView(R.layout.activity_slidetabs);

    StyleView.styleActivity(this);

    tabs = (TabLayout) findViewById(R.id.sliding_tabs);
    tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    android.support.v7.widget.Toolbar toolbar =
        (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle("/r/" + subreddit + " wiki");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    pager = (ViewPager) findViewById(R.id.contentView);
    findViewById(R.id.header).setBackgroundColor(Pallete.getColor(subreddit));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = getWindow();
      window.setStatusBarColor(Pallete.getDarkerColor(subreddit));
    }

    new AsyncGetWiki().execute();
  }
Example #2
0
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    getTheme().applyStyle(new ColorPreferences(this).getThemeSubreddit(""), true);

    getTheme().applyStyle(new FontPreferences(this).getFontStyle().getResId(), true);
    setContentView(R.layout.activity_submit);

    final Toolbar b = (Toolbar) findViewById(R.id.toolbar);
    b.setTitle(R.string.title_submit_post);
    b.setBackgroundColor(Pallete.getColor("alksfjalskjf"));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = this.getWindow();
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.setStatusBarColor(Pallete.getDarkerColor(Pallete.getColor("asldkfj")));
    }
    setSupportActionBar(b);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    Intent intent = getIntent();

    final String subreddit = intent.getStringExtra("subreddit");

    self = findViewById(R.id.selftext);
    subredditText = ((EditText) findViewById(R.id.subreddittext));
    image = findViewById(R.id.image);
    link = findViewById(R.id.url);

    image.setVisibility(View.GONE);
    link.setVisibility(View.GONE);

    subredditText.setText(subreddit);

    findViewById(R.id.selftextradio)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                self.setVisibility(View.VISIBLE);

                image.setVisibility(View.GONE);
                link.setVisibility(View.GONE);
              }
            });
    findViewById(R.id.imageradio)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                self.setVisibility(View.GONE);
                image.setVisibility(View.VISIBLE);
                link.setVisibility(View.GONE);
              }
            });
    findViewById(R.id.linkradio)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                self.setVisibility(View.GONE);
                image.setVisibility(View.GONE);
                link.setVisibility(View.VISIBLE);
              }
            });

    findViewById(R.id.selImage)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(
                    Intent.createChooser(intent, getString(R.string.editor_select_img)), 1);
              }
            });

    DoEditorActions.doActions(
        ((EditText) findViewById(R.id.bodytext)),
        findViewById(R.id.innersend2),
        getSupportFragmentManager());

    findViewById(R.id.send)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                ((FloatingActionButton) findViewById(R.id.send)).hide();
                new AsyncDo().execute();
              }
            });
  }