1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12:08 +01:00

Fix profile link

This commit is contained in:
Gregor Santner 2017-09-11 20:32:40 +02:00
parent b4608794ab
commit 58d07f9c6c
No known key found for this signature in database
GPG key ID: 7E83A7834AECB009
12 changed files with 68 additions and 64 deletions

View file

@ -1,5 +1,8 @@
### v1.0.4 ### v1.0.4
- Updated: README - Updated: README
- Added: Hide statusbar option
- Fixed: Language list
- Added: Sardinian,Malayalam,Turkish translation
### v1.0.3 ### v1.0.3
- Update opoc - Update opoc

View file

@ -68,16 +68,16 @@ public class AboutActivity extends ThemedActivity
implements IntellihideToolbarActivityListener { implements IntellihideToolbarActivityListener {
@BindView(R.id.about__appbar) @BindView(R.id.about__appbar)
protected AppBarLayout appBarLayout; protected AppBarLayout _appBarLayout;
@BindView(R.id.main__topbar) @BindView(R.id.main__topbar)
protected Toolbar toolbar; protected Toolbar _toolbar;
@BindView(R.id.appbar_linear_layout) @BindView(R.id.appbar_linear_layout)
protected LinearLayout linearLayout; protected LinearLayout _linearLayout;
@BindView(R.id.tabs) @BindView(R.id.tabs)
protected TabLayout tabLayout; protected TabLayout _tabLayout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -85,9 +85,9 @@ public class AboutActivity extends ThemedActivity
setContentView(R.layout.about__activity); setContentView(R.layout.about__activity);
ButterKnife.bind(this); ButterKnife.bind(this);
setSupportActionBar(toolbar); setSupportActionBar(_toolbar);
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px)); _toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
toolbar.setNavigationOnClickListener(new View.OnClickListener() { _toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
AboutActivity.this.onBackPressed(); AboutActivity.this.onBackPressed();
@ -101,7 +101,7 @@ public class AboutActivity extends ThemedActivity
ViewPager mViewPager = ButterKnife.findById(this, R.id.container); ViewPager mViewPager = ButterKnife.findById(this, R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setAdapter(mSectionsPagerAdapter);
tabLayout.setupWithViewPager(mViewPager); _tabLayout.setupWithViewPager(mViewPager);
} }
@Override @Override
@ -116,26 +116,26 @@ public class AboutActivity extends ThemedActivity
@Override @Override
protected void applyColorToViews() { protected void applyColorToViews() {
ThemeHelper.updateToolbarColor(toolbar); ThemeHelper.updateToolbarColor(_toolbar);
ThemeHelper.updateTabLayoutColor(tabLayout); ThemeHelper.updateTabLayoutColor(_tabLayout);
ThemeHelper.setPrimaryColorAsBackground(linearLayout); ThemeHelper.setPrimaryColorAsBackground(_linearLayout);
} }
@Override @Override
public void enableToolbarHiding() { public void enableToolbarHiding() {
AppLog.d(this, "Enable Intellihide"); AppLog.d(this, "Enable Intellihide");
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams(); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) _linearLayout.getLayoutParams();
//scroll|enterAlways|snap //scroll|enterAlways|snap
params.setScrollFlags(toolbarDefaultScrollFlags); params.setScrollFlags(toolbarDefaultScrollFlags);
appBarLayout.setExpanded(true, true); _appBarLayout.setExpanded(true, true);
} }
@Override @Override
public void disableToolbarHiding() { public void disableToolbarHiding() {
AppLog.d(this, "Disable Intellihide"); AppLog.d(this, "Disable Intellihide");
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams(); AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) _linearLayout.getLayoutParams();
params.setScrollFlags(0); // clear all scroll flags params.setScrollFlags(0); // clear all scroll flags
appBarLayout.setExpanded(true, true); _appBarLayout.setExpanded(true, true);
} }
/** /**

View file

@ -40,8 +40,8 @@ import com.github.dfa.diaspora_android.listener.OnSomethingClickListener;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment; import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.ContextUtils; import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View file

@ -44,8 +44,8 @@ import com.github.dfa.diaspora_android.R;
import com.github.dfa.diaspora_android.data.DiasporaUserProfile; import com.github.dfa.diaspora_android.data.DiasporaUserProfile;
import com.github.dfa.diaspora_android.ui.theme.ThemedAlertDialogBuilder; import com.github.dfa.diaspora_android.ui.theme.ThemedAlertDialogBuilder;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.ContextUtils; import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.web.BrowserFragment; import com.github.dfa.diaspora_android.web.BrowserFragment;
import com.github.dfa.diaspora_android.web.DiasporaStreamWebChromeClient; import com.github.dfa.diaspora_android.web.DiasporaStreamWebChromeClient;
import com.github.dfa.diaspora_android.web.FileUploadWebChromeClient; import com.github.dfa.diaspora_android.web.FileUploadWebChromeClient;

View file

@ -79,6 +79,7 @@ import com.github.dfa.diaspora_android.util.ActivityUtils;
import com.github.dfa.diaspora_android.util.AndroidBug5497Workaround; import com.github.dfa.diaspora_android.util.AndroidBug5497Workaround;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.web.BrowserFragment; import com.github.dfa.diaspora_android.web.BrowserFragment;
import com.github.dfa.diaspora_android.web.ContextMenuWebView; import com.github.dfa.diaspora_android.web.ContextMenuWebView;
@ -171,10 +172,13 @@ public class MainActivity extends ThemedActivity
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
AppLog.v(this, "onCreate()"); AppLog.v(this, "onCreate()");
// Bind UI // Pre UI
ContextUtils.get().setAppLanguage(AppSettings.get().getLanguage());
if (AppSettings.get().isEditorStatusBarHidden()) { if (AppSettings.get().isEditorStatusBarHidden()) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
} }
// Bind UI
setContentView(R.layout.main__activity); setContentView(R.layout.main__activity);
ButterKnife.bind(this); ButterKnife.bind(this);
if (AppSettings.get().isEditorStatusBarHidden()) { if (AppSettings.get().isEditorStatusBarHidden()) {
@ -257,7 +261,7 @@ public class MainActivity extends ThemedActivity
private void setupUI() { private void setupUI() {
AppLog.i(this, "setupUI()"); AppLog.i(this, "setupUI()");
// Setup toolbar // Setup _toolbar
setSupportActionBar(toolbarTop); setSupportActionBar(toolbarTop);
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
if (actionBar != null) { if (actionBar != null) {
@ -466,7 +470,7 @@ public class MainActivity extends ThemedActivity
} }
/** /**
* Open Stream when clicked on top toolbar AND preference stream shortcut is true * Open Stream when clicked on top _toolbar AND preference stream shortcut is true
* *
* @param view selected view * @param view selected view
*/ */
@ -666,10 +670,10 @@ public class MainActivity extends ThemedActivity
} }
/** /**
* Clear and repopulate top and bottom toolbar. * Clear and repopulate top and bottom _toolbar.
* Also add menu items of the displayed fragment * Also add menu items of the displayed fragment
* *
* @param menu top toolbar * @param menu top _toolbar
* @return boolean * @return boolean
*/ */
@Override @Override
@ -684,7 +688,7 @@ public class MainActivity extends ThemedActivity
if (top != null) { if (top != null) {
//PodSelectionFragment? //PodSelectionFragment?
if (top.getFragmentTag().equals(PodSelectionFragment.TAG)) { if (top.getFragmentTag().equals(PodSelectionFragment.TAG)) {
///Hide bottom toolbar ///Hide bottom _toolbar
toolbarBottom.setVisibility(View.GONE); toolbarBottom.setVisibility(View.GONE);
} else { } else {
getMenuInflater().inflate(_appSettings.isExtendedNotificationsActivated() ? getMenuInflater().inflate(_appSettings.isExtendedNotificationsActivated() ?
@ -697,7 +701,7 @@ public class MainActivity extends ThemedActivity
} }
/** /**
* Set the notification and messages counter in the top toolbar * Set the notification and messages counter in the top _toolbar
* *
* @param menu menu * @param menu menu
* @return boolean * @return boolean
@ -991,7 +995,7 @@ public class MainActivity extends ThemedActivity
public void onNotificationCountChanged(DiasporaUserProfile diasporaUserProfile, int notificationCount) { public void onNotificationCountChanged(DiasporaUserProfile diasporaUserProfile, int notificationCount) {
AppLog.i(this, "onNotificationCountChanged()"); AppLog.i(this, "onNotificationCountChanged()");
// Count saved in DiasporaUserProfile // Count saved in DiasporaUserProfile
// Invalidate the top toolbar to update the unread messages counter // Invalidate the top _toolbar to update the unread messages counter
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
@ -1000,7 +1004,7 @@ public class MainActivity extends ThemedActivity
public void onUnreadMessageCountChanged(DiasporaUserProfile diasporaUserProfile, int unreadMessageCount) { public void onUnreadMessageCountChanged(DiasporaUserProfile diasporaUserProfile, int unreadMessageCount) {
AppLog.i(this, "onUnreadMessageCountChanged()"); AppLog.i(this, "onUnreadMessageCountChanged()");
// Count saved in DiasporaUserProfile // Count saved in DiasporaUserProfile
// Invalidate the top toolbar to update the unread messages counter // Invalidate the top _toolbar to update the unread messages counter
invalidateOptionsMenu(); invalidateOptionsMenu();
} }

View file

@ -52,11 +52,11 @@ import com.github.dfa.diaspora_android.data.DiasporaPodList.DiasporaPod;
import com.github.dfa.diaspora_android.service.FetchPodsService; import com.github.dfa.diaspora_android.service.FetchPodsService;
import com.github.dfa.diaspora_android.ui.PodSelectionDialog; import com.github.dfa.diaspora_android.ui.PodSelectionDialog;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment; import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.ActivityUtils;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.ContextUtils; import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.ActivityUtils; import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;

View file

@ -39,8 +39,8 @@ import com.github.dfa.diaspora_android.listener.OnSomethingClickListener;
import com.github.dfa.diaspora_android.ui.theme.ThemedFragment; import com.github.dfa.diaspora_android.ui.theme.ThemedFragment;
import com.github.dfa.diaspora_android.util.AppLog; import com.github.dfa.diaspora_android.util.AppLog;
import com.github.dfa.diaspora_android.util.AppSettings; import com.github.dfa.diaspora_android.util.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.util.ContextUtils; import com.github.dfa.diaspora_android.util.ContextUtils;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View file

@ -103,7 +103,7 @@ public class DiasporaUserProfile {
} }
// GUID (User id) // GUID (User id)
if (json.has("guid") && loadGuid(json.getString("guid"))) { if (json.has("guid") && loadGuid(json.getString("guid")) && !guid.isEmpty()) {
appSettings.setProfileId(guid); appSettings.setProfileId(guid);
} }

View file

@ -51,7 +51,7 @@ public abstract class CustomFragment extends Fragment {
public abstract String getFragmentTag(); public abstract String getFragmentTag();
/** /**
* Add fragment-dependent options to the bottom options toolbar * Add fragment-dependent options to the bottom options _toolbar
* *
* @param menu bottom menu * @param menu bottom menu
* @param inflater inflater * @param inflater inflater

View file

@ -99,9 +99,6 @@ public abstract class ThemedActivity extends AppCompatActivity {
public void updateLanguage() { public void updateLanguage() {
AppSettings appSettings = getAppSettings(); AppSettings appSettings = getAppSettings();
Locale locale = ContextUtils.get().getLocaleByAndroidCode(appSettings.getLanguage()); ContextUtils.get().setAppLanguage(appSettings.getLanguage());
Configuration config = appSettings.getContext().getResources().getConfiguration();
config.locale = locale != null ? locale : Locale.getDefault();
appSettings.getContext().getResources().updateConfiguration(config, null);
} }
} }

View file

@ -39,7 +39,7 @@ import java.util.List;
*/ */
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
public class AppSettings extends AppSettingsBase { public class AppSettings extends AppSettingsBase {
private final SharedPreferences prefPod; private final SharedPreferences _prefPod;
private DiasporaPod currentPod0Cached; private DiasporaPod currentPod0Cached;
public static AppSettings get() { public static AppSettings get() {
@ -48,18 +48,18 @@ public class AppSettings extends AppSettingsBase {
private AppSettings(Context context) { private AppSettings(Context context) {
super(context); super(context);
prefPod = _context.getSharedPreferences("pod0", Context.MODE_PRIVATE); _prefPod = _context.getSharedPreferences("pod0", Context.MODE_PRIVATE);
} }
/** /**
* Clear all settings in prefPod (Settings related to the configured pod) * Clear all settings in _prefPod (Settings related to the configured pod)
* This uses commit instead of apply, since * This uses commit instead of apply, since
* SettingsActivity.SettingsFragmentDebugging.showWipeSettingsDialog() * SettingsActivity.SettingsFragmentDebugging.showWipeSettingsDialog()
* kills the app after the calling this, so we have to block until we are finished. * kills the app after the calling this, so we have to block until we are finished.
*/ */
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
public void resetPodSettings() { public void resetPodSettings() {
super.resetSettings(prefPod); super.resetSettings(_prefPod);
} }
/** /**
@ -77,11 +77,11 @@ public class AppSettings extends AppSettingsBase {
//## Getter & Setter for settings //## Getter & Setter for settings
//################################# //#################################
public String getProfileId() { public String getProfileId() {
return getString(R.string.pref_key__podprofile_id, ""); return getString(R.string.pref_key__podprofile_id, "", _prefPod);
} }
public void setProfileId(String profileId) { public void setProfileId(String profileId) {
setString(R.string.pref_key__podprofile_id, profileId, prefPod); setString(R.string.pref_key__podprofile_id, profileId, _prefPod);
} }
public boolean isLoadImages() { public boolean isLoadImages() {
@ -103,24 +103,24 @@ public class AppSettings extends AppSettingsBase {
} }
public String getAvatarUrl() { public String getAvatarUrl() {
return getString(R.string.pref_key__podprofile_avatar_url, "", prefPod); return getString(R.string.pref_key__podprofile_avatar_url, "", _prefPod);
} }
public void setAvatarUrl(String avatarUrl) { public void setAvatarUrl(String avatarUrl) {
setString(R.string.pref_key__podprofile_avatar_url, avatarUrl, prefPod); setString(R.string.pref_key__podprofile_avatar_url, avatarUrl, _prefPod);
} }
public String getName() { public String getName() {
return getString(R.string.pref_key__podprofile_name, "", prefPod); return getString(R.string.pref_key__podprofile_name, "", _prefPod);
} }
public void setName(String name) { public void setName(String name) {
setString(R.string.pref_key__podprofile_name, name, prefPod); setString(R.string.pref_key__podprofile_name, name, _prefPod);
} }
public DiasporaPod getPod() { public DiasporaPod getPod() {
if (currentPod0Cached == null) { if (currentPod0Cached == null) {
String pref = getString(R.string.pref_key__current_pod_0, "", prefPod); String pref = getString(R.string.pref_key__current_pod_0, "", _prefPod);
try { try {
currentPod0Cached = new DiasporaPod().fromJson(new JSONObject(pref)); currentPod0Cached = new DiasporaPod().fromJson(new JSONObject(pref));
@ -134,22 +134,22 @@ public class AppSettings extends AppSettingsBase {
public void setPod(DiasporaPod pod) { public void setPod(DiasporaPod pod) {
try { try {
setString(R.string.pref_key__current_pod_0, setString(R.string.pref_key__current_pod_0,
pod == null ? null : pod.toJson().toString(), prefPod); pod == null ? null : pod.toJson().toString(), _prefPod);
currentPod0Cached = pod; currentPod0Cached = pod;
} catch (JSONException ignored) { } catch (JSONException ignored) {
} }
} }
public boolean hasPod() { public boolean hasPod() {
return !getString(R.string.pref_key__current_pod_0, "", prefPod).equals(""); return !getString(R.string.pref_key__current_pod_0, "", _prefPod).equals("");
} }
public void setPodAspects(DiasporaAspect[] aspects) { public void setPodAspects(DiasporaAspect[] aspects) {
setStringArray(R.string.pref_key__podprofile_aspects, aspects, prefPod); setStringArray(R.string.pref_key__podprofile_aspects, aspects, _prefPod);
} }
public DiasporaAspect[] getAspects() { public DiasporaAspect[] getAspects() {
String[] s = getStringArray(R.string.pref_key__podprofile_aspects, prefPod); String[] s = getStringArray(R.string.pref_key__podprofile_aspects, _prefPod);
DiasporaAspect[] aspects = new DiasporaAspect[s.length]; DiasporaAspect[] aspects = new DiasporaAspect[s.length];
for (int i = 0; i < aspects.length; i++) { for (int i = 0; i < aspects.length; i++) {
aspects[i] = new DiasporaAspect(s[i]); aspects[i] = new DiasporaAspect(s[i]);
@ -158,43 +158,43 @@ public class AppSettings extends AppSettingsBase {
} }
public String[] getFollowedTags() { public String[] getFollowedTags() {
return getStringArray(R.string.pref_key__podprofile_followed_tags, prefPod); return getStringArray(R.string.pref_key__podprofile_followed_tags, _prefPod);
} }
public void setFollowedTags(String[] values) { public void setFollowedTags(String[] values) {
setStringArray(R.string.pref_key__podprofile_followed_tags, values, prefPod); setStringArray(R.string.pref_key__podprofile_followed_tags, values, _prefPod);
} }
public String[] getFollowedTagsFavs() { public String[] getFollowedTagsFavs() {
return getStringArray(R.string.pref_key__podprofile_followed_tags_favs, prefPod); return getStringArray(R.string.pref_key__podprofile_followed_tags_favs, _prefPod);
} }
public void setFollowedTagsFavs(List<String> values) { public void setFollowedTagsFavs(List<String> values) {
setStringList(R.string.pref_key__podprofile_followed_tags_favs, values, prefPod); setStringList(R.string.pref_key__podprofile_followed_tags_favs, values, _prefPod);
} }
public String[] getAspectFavs() { public String[] getAspectFavs() {
return getStringArray(R.string.pref_key__podprofile_aspects_favs, prefPod); return getStringArray(R.string.pref_key__podprofile_aspects_favs, _prefPod);
} }
public void setAspectFavs(List<String> values) { public void setAspectFavs(List<String> values) {
setStringList(R.string.pref_key__podprofile_aspects_favs, values, prefPod); setStringList(R.string.pref_key__podprofile_aspects_favs, values, _prefPod);
} }
public int getUnreadMessageCount() { public int getUnreadMessageCount() {
return getInt(R.string.pref_key__podprofile_unread_message_count, 0, prefPod); return getInt(R.string.pref_key__podprofile_unread_message_count, 0, _prefPod);
} }
public void setUnreadMessageCount(int unreadMessageCount) { public void setUnreadMessageCount(int unreadMessageCount) {
setInt(R.string.pref_key__podprofile_unread_message_count, unreadMessageCount, prefPod); setInt(R.string.pref_key__podprofile_unread_message_count, unreadMessageCount, _prefPod);
} }
public int getNotificationCount() { public int getNotificationCount() {
return getInt(R.string.pref_key__podprofile_notification_count, 0, prefPod); return getInt(R.string.pref_key__podprofile_notification_count, 0, _prefPod);
} }
public void setNotificationCount(int notificationCount) { public void setNotificationCount(int notificationCount) {
setInt(R.string.pref_key__podprofile_notification_count, notificationCount, prefPod); setInt(R.string.pref_key__podprofile_notification_count, notificationCount, _prefPod);
} }
public boolean isAppendSharedViaApp() { public boolean isAppendSharedViaApp() {
@ -370,11 +370,11 @@ public class AppSettings extends AppSettingsBase {
} }
public long getLastVisitedPositionInStream() { public long getLastVisitedPositionInStream() {
return getLong(R.string.pref_key__podprofile_last_stream_position, -1, prefPod); return getLong(R.string.pref_key__podprofile_last_stream_position, -1, _prefPod);
} }
public void setLastVisitedPositionInStream(long timestamp) { public void setLastVisitedPositionInStream(long timestamp) {
setLong(R.string.pref_key__podprofile_last_stream_position, timestamp, prefPod); setLong(R.string.pref_key__podprofile_last_stream_position, timestamp, _prefPod);
} }
public void setLanguage(String value) { public void setLanguage(String value) {