1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-21 20:02:07 +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
- Updated: README
- Added: Hide statusbar option
- Fixed: Language list
- Added: Sardinian,Malayalam,Turkish translation
### v1.0.3
- Update opoc

View file

@ -68,16 +68,16 @@ public class AboutActivity extends ThemedActivity
implements IntellihideToolbarActivityListener {
@BindView(R.id.about__appbar)
protected AppBarLayout appBarLayout;
protected AppBarLayout _appBarLayout;
@BindView(R.id.main__topbar)
protected Toolbar toolbar;
protected Toolbar _toolbar;
@BindView(R.id.appbar_linear_layout)
protected LinearLayout linearLayout;
protected LinearLayout _linearLayout;
@BindView(R.id.tabs)
protected TabLayout tabLayout;
protected TabLayout _tabLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -85,9 +85,9 @@ public class AboutActivity extends ThemedActivity
setContentView(R.layout.about__activity);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
setSupportActionBar(_toolbar);
_toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24px));
_toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AboutActivity.this.onBackPressed();
@ -101,7 +101,7 @@ public class AboutActivity extends ThemedActivity
ViewPager mViewPager = ButterKnife.findById(this, R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
tabLayout.setupWithViewPager(mViewPager);
_tabLayout.setupWithViewPager(mViewPager);
}
@Override
@ -116,26 +116,26 @@ public class AboutActivity extends ThemedActivity
@Override
protected void applyColorToViews() {
ThemeHelper.updateToolbarColor(toolbar);
ThemeHelper.updateTabLayoutColor(tabLayout);
ThemeHelper.setPrimaryColorAsBackground(linearLayout);
ThemeHelper.updateToolbarColor(_toolbar);
ThemeHelper.updateTabLayoutColor(_tabLayout);
ThemeHelper.setPrimaryColorAsBackground(_linearLayout);
}
@Override
public void enableToolbarHiding() {
AppLog.d(this, "Enable Intellihide");
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) linearLayout.getLayoutParams();
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) _linearLayout.getLayoutParams();
//scroll|enterAlways|snap
params.setScrollFlags(toolbarDefaultScrollFlags);
appBarLayout.setExpanded(true, true);
_appBarLayout.setExpanded(true, true);
}
@Override
public void disableToolbarHiding() {
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
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.util.AppLog;
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.DiasporaUrlHelper;
import java.util.ArrayList;
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.ui.theme.ThemedAlertDialogBuilder;
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.DiasporaUrlHelper;
import com.github.dfa.diaspora_android.web.BrowserFragment;
import com.github.dfa.diaspora_android.web.DiasporaStreamWebChromeClient;
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.AppLog;
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.web.BrowserFragment;
import com.github.dfa.diaspora_android.web.ContextMenuWebView;
@ -171,10 +172,13 @@ public class MainActivity extends ThemedActivity
super.onCreate(savedInstanceState);
AppLog.v(this, "onCreate()");
// Bind UI
// Pre UI
ContextUtils.get().setAppLanguage(AppSettings.get().getLanguage());
if (AppSettings.get().isEditorStatusBarHidden()) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
// Bind UI
setContentView(R.layout.main__activity);
ButterKnife.bind(this);
if (AppSettings.get().isEditorStatusBarHidden()) {
@ -257,7 +261,7 @@ public class MainActivity extends ThemedActivity
private void setupUI() {
AppLog.i(this, "setupUI()");
// Setup toolbar
// Setup _toolbar
setSupportActionBar(toolbarTop);
ActionBar actionBar = getSupportActionBar();
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
*/
@ -654,7 +658,7 @@ public class MainActivity extends ThemedActivity
LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_URL));
invalidateOptionsMenu();
_appSettings = getAppSettings();
if (_appSettings.isRecreateMainActivity()){
if (_appSettings.isRecreateMainActivity()) {
recreate();
}
if (_appSettings.isIntellihideToolbars()) {
@ -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
*
* @param menu top toolbar
* @param menu top _toolbar
* @return boolean
*/
@Override
@ -684,7 +688,7 @@ public class MainActivity extends ThemedActivity
if (top != null) {
//PodSelectionFragment?
if (top.getFragmentTag().equals(PodSelectionFragment.TAG)) {
///Hide bottom toolbar
///Hide bottom _toolbar
toolbarBottom.setVisibility(View.GONE);
} else {
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
* @return boolean
@ -991,7 +995,7 @@ public class MainActivity extends ThemedActivity
public void onNotificationCountChanged(DiasporaUserProfile diasporaUserProfile, int notificationCount) {
AppLog.i(this, "onNotificationCountChanged()");
// 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();
}
@ -1000,7 +1004,7 @@ public class MainActivity extends ThemedActivity
public void onUnreadMessageCountChanged(DiasporaUserProfile diasporaUserProfile, int unreadMessageCount) {
AppLog.i(this, "onUnreadMessageCountChanged()");
// 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();
}

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.ui.PodSelectionDialog;
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.AppSettings;
import com.github.dfa.diaspora_android.util.DiasporaUrlHelper;
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.JSONObject;

View file

@ -188,7 +188,7 @@ public class SettingsActivity extends ThemedActivity implements SharedPreference
return true;
}
/** Usability */
else if (settings.isKeyEqual(key, R.string.pref_key__is_overview_statusbar_hidden)){
else if (settings.isKeyEqual(key, R.string.pref_key__is_overview_statusbar_hidden)) {
AppSettings.get().setRecreateMainActivity(true);
}
/** Network */

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.util.AppLog;
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.DiasporaUrlHelper;
import java.util.ArrayList;
import java.util.Arrays;

View file

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

View file

@ -51,7 +51,7 @@ public abstract class CustomFragment extends Fragment {
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 inflater inflater

View file

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

View file

@ -39,7 +39,7 @@ import java.util.List;
*/
@SuppressWarnings("ConstantConditions")
public class AppSettings extends AppSettingsBase {
private final SharedPreferences prefPod;
private final SharedPreferences _prefPod;
private DiasporaPod currentPod0Cached;
public static AppSettings get() {
@ -48,18 +48,18 @@ public class AppSettings extends AppSettingsBase {
private AppSettings(Context 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
* SettingsActivity.SettingsFragmentDebugging.showWipeSettingsDialog()
* kills the app after the calling this, so we have to block until we are finished.
*/
@SuppressLint("CommitPrefEdits")
public void resetPodSettings() {
super.resetSettings(prefPod);
super.resetSettings(_prefPod);
}
/**
@ -77,11 +77,11 @@ public class AppSettings extends AppSettingsBase {
//## Getter & Setter for settings
//#################################
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) {
setString(R.string.pref_key__podprofile_id, profileId, prefPod);
setString(R.string.pref_key__podprofile_id, profileId, _prefPod);
}
public boolean isLoadImages() {
@ -103,24 +103,24 @@ public class AppSettings extends AppSettingsBase {
}
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) {
setString(R.string.pref_key__podprofile_avatar_url, avatarUrl, prefPod);
setString(R.string.pref_key__podprofile_avatar_url, avatarUrl, _prefPod);
}
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) {
setString(R.string.pref_key__podprofile_name, name, prefPod);
setString(R.string.pref_key__podprofile_name, name, _prefPod);
}
public DiasporaPod getPod() {
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 {
currentPod0Cached = new DiasporaPod().fromJson(new JSONObject(pref));
@ -134,22 +134,22 @@ public class AppSettings extends AppSettingsBase {
public void setPod(DiasporaPod pod) {
try {
setString(R.string.pref_key__current_pod_0,
pod == null ? null : pod.toJson().toString(), prefPod);
pod == null ? null : pod.toJson().toString(), _prefPod);
currentPod0Cached = pod;
} catch (JSONException ignored) {
}
}
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) {
setStringArray(R.string.pref_key__podprofile_aspects, aspects, prefPod);
setStringArray(R.string.pref_key__podprofile_aspects, aspects, _prefPod);
}
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];
for (int i = 0; i < aspects.length; i++) {
aspects[i] = new DiasporaAspect(s[i]);
@ -158,43 +158,43 @@ public class AppSettings extends AppSettingsBase {
}
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) {
setStringArray(R.string.pref_key__podprofile_followed_tags, values, prefPod);
setStringArray(R.string.pref_key__podprofile_followed_tags, values, _prefPod);
}
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) {
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() {
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) {
setStringList(R.string.pref_key__podprofile_aspects_favs, values, prefPod);
setStringList(R.string.pref_key__podprofile_aspects_favs, values, _prefPod);
}
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) {
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() {
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) {
setInt(R.string.pref_key__podprofile_notification_count, notificationCount, prefPod);
setInt(R.string.pref_key__podprofile_notification_count, notificationCount, _prefPod);
}
public boolean isAppendSharedViaApp() {
@ -370,11 +370,11 @@ public class AppSettings extends AppSettingsBase {
}
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) {
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) {