Avoids a bad cast
This commit is contained in:
parent
dfb84622bd
commit
4dad2bc4fb
|
@ -33,20 +33,16 @@ import android.support.annotation.RequiresApi;
|
||||||
import android.support.design.widget.AppBarLayout;
|
import android.support.design.widget.AppBarLayout;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.transition.Visibility;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.view.PagerAdapter;
|
import android.support.v4.view.PagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.ActionBar;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.PopupMenu;
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -126,6 +122,9 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
private int maxScrollSize;
|
private int maxScrollSize;
|
||||||
private boolean avatarShown = true;
|
private boolean avatarShown = true;
|
||||||
private DisplayStatusFragment displayStatusFragment;
|
private DisplayStatusFragment displayStatusFragment;
|
||||||
|
private CircleImageView account_pp;
|
||||||
|
private TextView account_dn;
|
||||||
|
private TextView account_un;
|
||||||
|
|
||||||
public enum action{
|
public enum action{
|
||||||
FOLLOW,
|
FOLLOW,
|
||||||
|
@ -152,10 +151,13 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
instanceValue += 1;
|
instanceValue += 1;
|
||||||
pins = new ArrayList<>();
|
pins = new ArrayList<>();
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
account_follow = (FloatingActionButton) findViewById(R.id.account_follow);
|
account_follow = findViewById(R.id.account_follow);
|
||||||
account_follow_request = (TextView) findViewById(R.id.account_follow_request);
|
account_follow_request = findViewById(R.id.account_follow_request);
|
||||||
header_edit_profile = (ImageView) findViewById(R.id.header_edit_profile);
|
header_edit_profile = findViewById(R.id.header_edit_profile);
|
||||||
account_follow.setEnabled(false);
|
account_follow.setEnabled(false);
|
||||||
|
account_pp = findViewById(R.id.account_pp);
|
||||||
|
account_dn = findViewById(R.id.account_dn);
|
||||||
|
account_un = findViewById(R.id.account_un);
|
||||||
if(b != null){
|
if(b != null){
|
||||||
accountId = b.getString("accountId");
|
accountId = b.getString("accountId");
|
||||||
new RetrieveRelationshipAsyncTask(getApplicationContext(), accountId,ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new RetrieveRelationshipAsyncTask(getApplicationContext(), accountId,ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
@ -189,12 +191,12 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tabLayout = (TabLayout) findViewById(R.id.account_tabLayout);
|
tabLayout = findViewById(R.id.account_tabLayout);
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.toots)));
|
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.toots)));
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.following)));
|
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.following)));
|
||||||
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.followers)));
|
tabLayout.addTab(tabLayout.newTab().setText(getString(R.string.followers)));
|
||||||
|
|
||||||
mPager = (ViewPager) findViewById(R.id.account_viewpager);
|
mPager = findViewById(R.id.account_viewpager);
|
||||||
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
|
||||||
mPager.setAdapter(mPagerAdapter);
|
mPager.setAdapter(mPagerAdapter);
|
||||||
|
|
||||||
|
@ -246,7 +248,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
account_note = (TextView) findViewById(R.id.account_note);
|
account_note = findViewById(R.id.account_note);
|
||||||
|
|
||||||
//Follow button
|
//Follow button
|
||||||
account_follow.setOnClickListener(new View.OnClickListener() {
|
account_follow.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -279,7 +281,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final ImageButton account_menu = (ImageButton) findViewById(R.id.account_menu);
|
final ImageButton account_menu = findViewById(R.id.account_menu);
|
||||||
account_menu.setOnClickListener(new View.OnClickListener() {
|
account_menu.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -356,9 +358,6 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
}
|
}
|
||||||
|
|
||||||
accountUrl = account.getUrl();
|
accountUrl = account.getUrl();
|
||||||
final CircleImageView account_pp = (CircleImageView) findViewById(R.id.account_pp);
|
|
||||||
TextView account_dn = (TextView) findViewById(R.id.account_dn);
|
|
||||||
TextView account_un = (TextView) findViewById(R.id.account_un);
|
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||||
if( theme == Helper.THEME_DARK){
|
if( theme == Helper.THEME_DARK){
|
||||||
|
@ -380,7 +379,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||||
super.onLoadingComplete(imageUri, view, loadedImage);
|
super.onLoadingComplete(imageUri, view, loadedImage);
|
||||||
ImageView banner_pp = (ImageView) findViewById(R.id.banner_pp);
|
ImageView banner_pp = findViewById(R.id.banner_pp);
|
||||||
Bitmap workingBitmap = Bitmap.createBitmap(loadedImage);
|
Bitmap workingBitmap = Bitmap.createBitmap(loadedImage);
|
||||||
Bitmap mutableBitmap = workingBitmap.copy(Bitmap.Config.ARGB_8888, true);
|
Bitmap mutableBitmap = workingBitmap.copy(Bitmap.Config.ARGB_8888, true);
|
||||||
Canvas canvas = new Canvas(mutableBitmap);
|
Canvas canvas = new Canvas(mutableBitmap);
|
||||||
|
@ -411,10 +410,10 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
|
|
||||||
|
|
||||||
if( account != null){
|
if( account != null){
|
||||||
TextView actionbar_title = (TextView) findViewById(R.id.show_account_title);
|
TextView actionbar_title = findViewById(R.id.show_account_title);
|
||||||
if( account.getAcct() != null)
|
if( account.getAcct() != null)
|
||||||
actionbar_title.setText(account.getAcct());
|
actionbar_title.setText(account.getAcct());
|
||||||
pp_actionBar = (ImageView) findViewById(R.id.pp_actionBar);
|
pp_actionBar = findViewById(R.id.pp_actionBar);
|
||||||
String url = account.getAvatar();
|
String url = account.getAvatar();
|
||||||
if( url.startsWith("/") ){
|
if( url.startsWith("/") ){
|
||||||
url = "https://" + Helper.getLiveInstance(getApplicationContext()) + account.getAvatar();
|
url = "https://" + Helper.getLiveInstance(getApplicationContext()) + account.getAvatar();
|
||||||
|
@ -434,7 +433,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
public void onLoadingFailed(java.lang.String imageUri, android.view.View view, FailReason failReason){
|
public void onLoadingFailed(java.lang.String imageUri, android.view.View view, FailReason failReason){
|
||||||
|
|
||||||
}});
|
}});
|
||||||
final AppBarLayout appBar = (AppBarLayout) findViewById(R.id.appBar);
|
final AppBarLayout appBar = findViewById(R.id.appBar);
|
||||||
maxScrollSize = appBar.getTotalScrollRange();
|
maxScrollSize = appBar.getTotalScrollRange();
|
||||||
|
|
||||||
|
|
||||||
|
@ -619,7 +618,7 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
||||||
|
|
||||||
//The authenticated account is followed by the account
|
//The authenticated account is followed by the account
|
||||||
if( relationship.isFollowed_by()){
|
if( relationship.isFollowed_by()){
|
||||||
TextView account_followed_by = (TextView) findViewById(R.id.account_followed_by);
|
TextView account_followed_by = findViewById(R.id.account_followed_by);
|
||||||
account_followed_by.setVisibility(View.VISIBLE);
|
account_followed_by.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue