New launcher icon added.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 69 KiB |
|
@ -28,7 +28,6 @@ import android.support.design.widget.FloatingActionButton;
|
|||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
@ -44,7 +43,6 @@ import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
|
|||
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
|
||||
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
|
||||
import com.mikepenz.materialdrawer.model.interfaces.IProfile;
|
||||
import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader;
|
||||
import com.mikepenz.materialdrawer.util.DrawerImageLoader;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
@ -61,8 +59,7 @@ public class MainActivity extends BaseActivity {
|
|||
private PendingIntent serviceAlarmIntent;
|
||||
private boolean notificationServiceEnabled;
|
||||
private String loggedInAccountId;
|
||||
private String loggedInAccountUsername;
|
||||
Stack<Integer> pageHistory = new Stack<Integer>();
|
||||
Stack<Integer> pageHistory = new Stack<>();
|
||||
private ViewPager viewPager;
|
||||
private AccountHeader headerResult;
|
||||
private Drawer drawer;
|
||||
|
@ -129,9 +126,13 @@ public class MainActivity extends BaseActivity {
|
|||
long drawerItemIdentifier = drawerItem.getIdentifier();
|
||||
|
||||
if (drawerItemIdentifier == 0) {
|
||||
Intent intent = new Intent(MainActivity.this, AccountActivity.class);
|
||||
intent.putExtra("id", loggedInAccountId);
|
||||
startActivity(intent);
|
||||
if (loggedInAccountId != null) {
|
||||
Intent intent = new Intent(MainActivity.this, AccountActivity.class);
|
||||
intent.putExtra("id", loggedInAccountId);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
Log.e(TAG, "Logged-in account id was not obtained yet when profile was opened.");
|
||||
}
|
||||
} else if (drawerItemIdentifier == 1) {
|
||||
Intent intent = new Intent(MainActivity.this, FavouritesActivity.class);
|
||||
startActivity(intent);
|
||||
|
@ -233,13 +234,6 @@ public class MainActivity extends BaseActivity {
|
|||
SharedPreferences preferences = getSharedPreferences(
|
||||
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
||||
final String domain = preferences.getString("domain", null);
|
||||
String id = preferences.getString("loggedInAccountId", null);
|
||||
String username = preferences.getString("loggedInAccountUsername", null);
|
||||
|
||||
if (id != null && username != null) {
|
||||
loggedInAccountId = id;
|
||||
loggedInAccountUsername = username;
|
||||
}
|
||||
|
||||
mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
|
||||
@Override
|
||||
|
@ -261,7 +255,7 @@ public class MainActivity extends BaseActivity {
|
|||
.withIcon(me.avatar)
|
||||
);
|
||||
|
||||
//onFetchUserInfoSuccess(response.body().id, response.body().username);
|
||||
loggedInAccountId = me.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -271,17 +265,6 @@ public class MainActivity extends BaseActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private void onFetchUserInfoSuccess(String id, String username) {
|
||||
loggedInAccountId = id;
|
||||
loggedInAccountUsername = username;
|
||||
SharedPreferences preferences = getSharedPreferences(
|
||||
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putString("loggedInAccountId", loggedInAccountId);
|
||||
editor.putString("loggedInAccountUsername", loggedInAccountUsername);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private void onFetchUserInfoFailure(Exception exception) {
|
||||
Log.e(TAG, "Failed to fetch user info. " + exception.getMessage());
|
||||
}
|
||||
|
|
|
@ -45,8 +45,6 @@ import retrofit2.Callback;
|
|||
* overlap functionality. So, I'm momentarily leaving it and hopefully working on those will clear
|
||||
* up what needs to be where. */
|
||||
public class SFragment extends Fragment {
|
||||
protected String domain;
|
||||
protected String accessToken;
|
||||
protected String loggedInAccountId;
|
||||
protected String loggedInUsername;
|
||||
private MastodonAPI api;
|
||||
|
@ -57,8 +55,6 @@ public class SFragment extends Fragment {
|
|||
|
||||
SharedPreferences preferences = getContext().getSharedPreferences(
|
||||
getString(R.string.preferences_file_key), Context.MODE_PRIVATE);
|
||||
domain = preferences.getString("domain", null);
|
||||
accessToken = preferences.getString("accessToken", null);
|
||||
loggedInAccountId = preferences.getString("loggedInAccountId", null);
|
||||
loggedInUsername = preferences.getString("loggedInAccountUsername", null);
|
||||
api = ((BaseActivity) getActivity()).mastodonAPI;
|
||||
|
@ -128,20 +124,6 @@ public class SFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
protected void follow(String id) {
|
||||
api.followAccount(id).enqueue(new Callback<Relationship>() {
|
||||
@Override
|
||||
public void onResponse(Call<Relationship> call, retrofit2.Response<Relationship> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<Relationship> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void block(String id) {
|
||||
api.blockAccount(id).enqueue(new Callback<Relationship>() {
|
||||
@Override
|
||||
|
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 17 KiB |