Search in sources :

Example 1 with ReportAdapter

use of com.keylesspalace.tusky.adapter.ReportAdapter in project Tusky by Vavassor.

the class ReportActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_report);
    Intent intent = getIntent();
    accountId = intent.getStringExtra("account_id");
    String accountUsername = intent.getStringExtra("account_username");
    String statusId = intent.getStringExtra("status_id");
    String statusContent = intent.getStringExtra("status_content");
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        String title = String.format(getString(R.string.report_username_format), accountUsername);
        bar.setTitle(title);
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
    }
    anyView = toolbar;
    final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.report_recycler_view);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    adapter = new ReportAdapter();
    recyclerView.setAdapter(adapter);
    DividerItemDecoration divider = new DividerItemDecoration(this, layoutManager.getOrientation());
    Drawable drawable = ThemeUtils.getDrawable(this, R.attr.report_status_divider_drawable, R.drawable.report_status_divider_dark);
    divider.setDrawable(drawable);
    recyclerView.addItemDecoration(divider);
    ReportAdapter.ReportStatus reportStatus = new ReportAdapter.ReportStatus(statusId, HtmlUtils.fromHtml(statusContent), true);
    adapter.addItem(reportStatus);
    comment = (EditText) findViewById(R.id.report_comment);
    reportAlreadyInFlight = false;
    fetchRecentStatuses(accountId);
}
Also used : ReportAdapter(com.keylesspalace.tusky.adapter.ReportAdapter) Drawable(android.graphics.drawable.Drawable) Intent(android.content.Intent) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Intent (android.content.Intent)1 Drawable (android.graphics.drawable.Drawable)1 ActionBar (android.support.v7.app.ActionBar)1 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toolbar (android.support.v7.widget.Toolbar)1 ReportAdapter (com.keylesspalace.tusky.adapter.ReportAdapter)1