示例#1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mostra_feitico);

    android.support.v7.app.ActionBar action = getSupportActionBar();
    action.setDisplayUseLogoEnabled(true);
    action.setDisplayShowHomeEnabled(true);
    action.setLogo(R.drawable.logo);
    action.setBackgroundDrawable(new ColorDrawable(Color.LTGRAY));

    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();

    if (bundle != null) {
      int id = bundle.getInt("ID");
      Controlador crud = new Controlador(getBaseContext());
      Feitico atual = crud.getFeitico(id + 1);
      setTitle(atual.getNome());
      TextView title = (TextView) findViewById(R.id.feitico_title);
      TextView descr = (TextView) findViewById(R.id.feitico_descricao);
      title.setText(atual.getNome());
      descr.setText(atual.getDescricao());
    }
  }
示例#2
0
  public void onCreate(Bundle savedInstanceState) {
    if (Utils.isTablet(this)) {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.firstrun);
    context = this;
    Utils.showWhatNewDialog(context);
    ActionBar actionBar = getSupportActionBar();
    TextView ganjdroid = new TextView(this);
    Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/font3.ttf");
    ganjdroid.setTypeface(typeface);
    ganjdroid.setText("GrowDroid");
    ganjdroid.setTextSize(20);
    ganjdroid.setGravity(Gravity.CENTER);
    ganjdroid.setTextColor(getResources().getColor(R.color.white));
    actionBar.setCustomView(ganjdroid);
    actionBar.setDisplayShowCustomEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setLogo(getResources().getDrawable(R.drawable.ic_launcher));

    TextView textView = (TextView) findViewById(R.id.pressTextView);
    textView.setTypeface(
        Typeface.createFromAsset(context.getAssets(), "fonts/Roboto/Roboto-Thin.ttf"));
    RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.pressLayout);
    relativeLayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent intent = new Intent(context, NewCycle.class);
            startActivity(intent);
          }
        });
  }
    @Override
    public void applySelfActionBar() {
        if (parentActivity == null) {
            return;
        }
        ActionBar actionBar = parentActivity.getSupportActionBar();
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setSubtitle(null);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setDisplayShowCustomEnabled(false);
        actionBar.setCustomView(null);
        actionBar.setTitle(getStringEntry(R.string.NotificationsAndSounds));

        TextView title = (TextView)parentActivity.findViewById(R.id.action_bar_title);
        if (title == null) {
            final int subtitleId = parentActivity.getResources().getIdentifier("action_bar_title", "id", "android");
            title = (TextView)parentActivity.findViewById(subtitleId);
        }
        if (title != null) {
            title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
            title.setCompoundDrawablePadding(0);
        }
    }
示例#4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // 在action bar中显示图标
    ActionBar actionBar = getSupportActionBar();
    actionBar.setLogo(R.mipmap.ic_launcher);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            startActivity(new Intent(MainActivity.this, AddItemActivity.class));
            //                Toast.makeText(MainActivity.this,"test",Toast.LENGTH_LONG).show();
            //                Snackbar.make(view, "Replace with your own action",
            // Snackbar.LENGTH_LONG)
            //                        .setAction("Action", null).show();
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mContext = this;
    setContentView(R.layout.activity_account_book_custom_view);

    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);

    View view = mViewPager.getRootView();
    TextView title = (TextView) view.findViewById(R.id.logo_white);
    title.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    title.setText(SettingManager.getInstance().getAccountBookName());

    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.GetTypeface(), Typeface.NORMAL);
    mViewPager.getPagerTitleStrip().setVisibility(View.INVISIBLE);

    setTitle("");

    toolbar = mViewPager.getToolbar();

    if (toolbar != null) {
      setSupportActionBar(toolbar);

      final ActionBar actionBar = getSupportActionBar();
      if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setHomeButtonEnabled(true);
      }
    }

    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
      logo.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              mViewPager.notifyHeaderChanged();
            }
          });
    }

    customViewFragmentAdapter = new CustomViewFragmentAdapter(getSupportFragmentManager());
    mViewPager.getViewPager().setOffscreenPageLimit(1);
    mViewPager.getViewPager().setAdapter(customViewFragmentAdapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());

    mViewPager.setMaterialViewPagerListener(
        new MaterialViewPager.Listener() {
          @Override
          public HeaderDesign getHeaderDesign(int page) {
            return HeaderDesign.fromColorAndDrawable(
                CoCoinUtil.GetTagColor(-3), CoCoinUtil.GetTagDrawable(-3));
          }
        });
  }
 private void initActionBar() {
   ActionBar actionBar = getSupportActionBar();
   actionBar.setDisplayUseLogoEnabled(true);
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setDisplayShowHomeEnabled(true);
   actionBar.setIcon(R.drawable.icon_reminders);
   actionBar.setTitle("Reminder");
 }
  /** Sets the default configuration for the activity {@link android.support.v7.app.ActionBar}. */
  protected void onConfigureActionBar() {
    final ActionBar actionBar = getSupportActionBar();

    actionBar.setDisplayHomeAsUpEnabled(isHomeAsUpEnabled());
    actionBar.setDisplayShowTitleEnabled(isTitleEnabled());
    actionBar.setDisplayUseLogoEnabled(isLogoEnabled());
    actionBar.setHomeButtonEnabled(isHomeButtonEnabled());
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sync);

    // to add logo to action bar
    ActionBar ac = getSupportActionBar();
    ac.setDisplayShowHomeEnabled(true);
    ac.setLogo(R.drawable.occasus1);
    ac.setDisplayUseLogoEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true); // to hide back button on action bar
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);

    Intent intent = getIntent();
    user = (User) intent.getSerializableExtra("user");
    //        String name = intent.getStringExtra("name");
    //        String screenName = intent.getStringExtra("user_id");
    //        String profileImageUrl = intent.getStringExtra("profile_image_url");
    //        String tagLine = intent.getStringExtra("tag_line");
    //        String followersCount = intent.getStringExtra("followers_count");
    //        String followingCount = intent.getStringExtra("following_count");

    ImageView ivUserIcon = (ImageView) findViewById(R.id.ivUserIcon);
    Picasso.with(getApplicationContext()).load(user.profileImageUrl).fit().into(ivUserIcon);

    TextView tvUserName = (TextView) findViewById(R.id.tvUserName);
    tvUserName.setText(user.name);

    TextView tvTagLine = (TextView) findViewById(R.id.tvTagLine);
    tvTagLine.setText(user.tagLine);

    TextView tvFollowers = (TextView) findViewById(R.id.tvFollowers);
    tvFollowers.setText(user.followers + " " + getString(R.string.followers));

    TextView tvFollowing = (TextView) findViewById(R.id.tvFollowing);
    tvFollowing.setText(user.following + " " + getString(R.string.following));

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(user.getScreeName());
    actionBar.setLogo(R.mipmap.ic_launcher);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setBackgroundDrawable(
        new ColorDrawable(Color.parseColor(getString(R.string.twitter_blue))));

    if (savedInstanceState == null) {
      UserTimeLineFragment userTimeLineFragment = UserTimeLineFragment.getInstance(user.screenName);

      FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
      ft.replace(R.id.flContainer, userTimeLineFragment);
      ft.commit();
    }
  }
示例#10
0
  private void setupActionBar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

    setSupportActionBar(toolbar);

    ActionBar bar = getSupportActionBar();
    bar.setDisplayUseLogoEnabled(false);
    bar.setDisplayShowTitleEnabled(true);
    bar.setDisplayShowHomeEnabled(true);
    bar.setDisplayHomeAsUpEnabled(true);
    bar.setHomeButtonEnabled(true);

    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });
  }
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mainLayout =
        (ViewGroup) getLayoutInflater().inflate(R.layout.activity_current_experiments, null);
    setContentView(mainLayout);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setLogo(R.drawable.ic_launcher);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setBackgroundDrawable(new ColorDrawable(0xff4A53B3));

    // Set up the drawer.
    mNavigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));

    navDrawerList = (ListView) mNavigationDrawerFragment.getView().findViewById(R.id.navDrawerList);
    progressBar = (ProgressBar) findViewById(R.id.findExperimentsProgressBar);

    // TODO would this work if it is in the Systemchangereceiver ?
    new RingtoneUtil(this).installPacoBarkRingtone();

    userPrefs = new UserPreferences(this);

    list = (ListView) findViewById(R.id.find_experiments_list);
    list.setBackgroundColor(333);
    createListHeader();

    invitationLayout = (LinearLayout) findViewById(R.id.announcementLayout);
    invitationExperimentName = (TextView) findViewById(R.id.invitationExperimentNameTextView);
    invitationContactTextView = (TextView) findViewById(R.id.invitationContactTextView);
    invitationCloseButton = (ImageButton) findViewById(R.id.invitationAnnouncementCloseButton);

    experimentProviderUtil = new ExperimentProviderUtil(this);
    registerForContextMenu(list);
  }
示例#12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fragment_floatactionbar);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
      actionBar.setDisplayUseLogoEnabled(true);
      actionBar.setDisplayShowTitleEnabled(true);
      actionBar.setDisplayShowHomeEnabled(true);
      actionBar.setDisplayHomeAsUpEnabled(true);
    }
    floatingActionButton = (FloatingActionButton) findViewById(R.id.floatingActionBar);

    Intent intent = getIntent();
    if (intent.hasExtra(Node.NODE)) {
      node = intent.getParcelableExtra(Node.NODE);
      setTitle(node.name);
      TopicsProvider.TopicType topicType =
          TopicsProvider.TopicType.newTopicTypeByNodeId("node_" + node.id, node.id);
      TopicsFragment topicsFragment = TopicsFragment.newInstance(topicType);
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.fragment_content, topicsFragment)
          .commit();
      floatingActionButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (node != null) {
                Intent i = new Intent(NodeActivity.this, NewTopicActivity.class);
                i.putExtra(Node.NODE_NAME, node.name);
                startActivity(i);
              }
            }
          });
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
      ab.setDisplayUseLogoEnabled(true);
      ab.setTitle("");
      ab.show();
    }

    // init and show about libraries :D
    LibsFragment fragment =
        new LibsBuilder()
            .withFields(R.string.class.getFields())
            .withVersionShown(true)
            .withLicenseShown(true)
            .fragment();
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_input_model);

    mModel = getIntent().getIntExtra("model", 0);

    if (savedInstanceState == null) {
      getSupportFragmentManager()
          .beginTransaction()
          .add(R.id.container, getFragmentFromModel(mModel))
          .commit();
    }

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getIntent().getStringExtra("title"));
    actionBar.setSubtitle(R.string.queuing_theory);
    actionBar.setDisplayUseLogoEnabled(false);
  }
示例#15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.setting);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setIcon(R.drawable.backblue);

    group = (RadioGroup) findViewById(R.id.radioGroup);
    SharedPreferences appSharedPrefs =
        PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    String select = appSharedPrefs.getString("dict_select", "0");
    RadioButton button_google = (RadioButton) findViewById(R.id.google);
    RadioButton button_mspdict = (RadioButton) findViewById(R.id.mspdict);
    if (select.equals("0")) {
      button_google.setChecked(true);
    } else {
      button_mspdict.setChecked(true);
    }
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (savedInstanceState == null) {
      Date date = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
      sdf.setTimeZone(TimeZone.getTimeZone("EST5EDT"));
      String now = sdf.format(date);

      prefs = getSharedPreferences(prefName, MODE_PRIVATE);
      SharedPreferences.Editor editor = prefs.edit();
      editor.putString(ACTIVE_KEY, now);
      editor.commit();
      db = new TableDbAdapter(getApplicationContext());

      try {
        if (getIntent().getExtras().getString("type").equals("usercheck")) {
          Toast.makeText(
                  getBaseContext(),
                  "Welcome back, " + prefs.getString(KEY_USERNAME, "") + "!",
                  Toast.LENGTH_SHORT)
              .show();
        }
      } catch (NullPointerException e) {
        // TODO: handle exception
        e.printStackTrace();
      }
    }

    setContentView(R.layout.main);

    actionBar = getSupportActionBar();

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    if (metrics.heightPixels < 400 && metrics.widthPixels < 300) {
      actionBar.setDisplayShowTitleEnabled(false);
      actionBar.setDisplayShowHomeEnabled(false);
    } else {
      actionBar.setDisplayUseLogoEnabled(true);
    }

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    ActionBar.Tab tabCalendar = actionBar.newTab().setText("Calendar");
    ActionBar.Tab tabTotals = actionBar.newTab().setText("Totals");
    ActionBar.Tab tabDetails = actionBar.newTab().setText("User Info");

    Fragment fragmentCalendar = new FragmentCalendar();
    Fragment fragmentTotals = new FragmentTotals();
    Fragment fragmentDetails = new FragmentDetails();

    tabCalendar.setTabListener(new MyTabsListener(fragmentCalendar));
    tabTotals.setTabListener(new MyTabsListener(fragmentTotals));
    tabDetails.setTabListener(new MyTabsListener(fragmentDetails));

    actionBar.addTab(tabCalendar);
    actionBar.addTab(tabTotals);
    actionBar.addTab(tabDetails);
  }
  /**
   * Users of this fragment must call this method to set up the navigation drawer interactions.
   *
   * @param fragmentId The android:id of this fragment in its activity's layout.
   * @param drawerLayout The DrawerLayout containing this fragment's UI.
   */
  public void setUp(int fragmentId, DrawerLayout drawerLayout) {
    mFragmentContainerView = getActivity().findViewById(fragmentId);
    mDrawerLayout = drawerLayout;

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    // set up the drawer's list view with items and click listener

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setHomeAsUpIndicator(R.drawable.ic_white_drawer);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the navigation drawer and the action bar app icon.
    mDrawerToggle =
        new ActionBarDrawerToggle(
            getActivity(), /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
            R.string.navigation_drawer_close /* "close drawer" description for accessibility */) {

          @Override
          public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            if (!isAdded()) {
              return;
            }

            getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
          }

          @Override
          public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            if (!isAdded()) {
              return;
            }

            if (!mUserLearnedDrawer) {
              // The user manually opened the drawer; store this flag to prevent auto-showing
              // the navigation drawer automatically in the future.
              mUserLearnedDrawer = true;
              SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
              sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply();
            }

            getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
          }
        };

    // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer,
    // per the navigation drawer design guidelines.
    if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
      mDrawerLayout.openDrawer(mFragmentContainerView);
    }

    // Defer code dependent on restoration of previous instance state.
    mDrawerLayout.post(
        new Runnable() {
          @Override
          public void run() {
            mDrawerToggle.syncState();
          }
        });

    mDrawerLayout.setDrawerListener(mDrawerToggle);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setRetainInstance(true);
    setHasOptionsMenu(false);
    rootView = inflater.inflate(R.layout.activity_page, container, false);
    mViewPager = (MaterialViewPager) rootView.findViewById(R.id.materialViewPager);
    toolbar = mViewPager.getToolbar();
    toolbar.setTitle("Talentspear");
    if (toolbar != null) {
      ((NavActivity) getActivity()).setSupportActionBar(toolbar);

      final ActionBar actionBar = ((NavActivity) getActivity()).getSupportActionBar();
      if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayUseLogoEnabled(false);
        actionBar.setHomeButtonEnabled(true);
      }
    }
    toolbar.setVisibility(View.INVISIBLE);
    mViewPager
        .getViewPager()
        .setAdapter(
            new FragmentStatePagerAdapter(getChildFragmentManager()) {

              @Override
              public Fragment getItem(int position) {
                switch (position % 2) {
                  case 0:
                    return new RecentPosts();
                  case 1:
                    return new FeaturedPosts();
                  default:
                    return RecyclerViewFragment.newInstance(2, 35, 47);
                }
              }

              @Override
              public int getCount() {
                return 2;
              }

              @Override
              public CharSequence getPageTitle(int position) {
                switch (position % 2) {
                  case 0:
                    return "Recent";
                  case 1:
                    return "Favourites";
                }
                return "";
              }
            });

    mViewPager.setMaterialViewPagerListener(
        new MaterialViewPager.Listener() {
          @Override
          public HeaderDesign getHeaderDesign(int page) {
            switch (page) {
              case 0:
                return HeaderDesign.fromColorAndUrl(
                    getResources().getColor(R.color.primaryColor),
                    "http://ts.icias2015.org/university/images/college_2.jpg");
              case 1:
                return HeaderDesign.fromColorAndUrl(
                    getResources().getColor(R.color.primaryColorMedium),
                    "http://ts.icias2015.org/university/images/college_1.jpg");
            }

            // execute others actions if needed (ex : modify your header logo)

            return null;
          }
        });

    mViewPager
        .getViewPager()
        .setOffscreenPageLimit(mViewPager.getViewPager().getAdapter().getCount());
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
    mViewPager.getViewPager().setCurrentItem(1);
    mViewPager.getViewPager().setCurrentItem(0);
    return rootView;
  }
示例#19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    final String ID = intent.getStringExtra("ID");
    final String name = intent.getStringExtra("Name");
    final ActionBar actionBar = getSupportActionBar();

    setContentView(R.layout.individual_colour_change_layout);

    SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    ColH = settings.getInt("houCol" + ID, getResources().getColor(R.color.clokH));
    ColM = settings.getInt("minCol" + ID, getResources().getColor(R.color.clokM));
    ColS = settings.getInt("secCol" + ID, getResources().getColor(R.color.clokS));
    String currentTitle = name + ": " + getString(R.string.chsColour);
    if (actionBar != null) {
      actionBar.setTitle(currentTitle);
      actionBar.setDisplayUseLogoEnabled(false);
    }

    draw();

    Button reset = (Button) findViewById(R.id.reset);
    reset.setOnClickListener(
        v -> {
          Editor editor = settings.edit();
          ColH = IndividualColourChange.this.getResources().getColor(R.color.clokH);
          ColM = IndividualColourChange.this.getResources().getColor(R.color.clokM);
          ColS = IndividualColourChange.this.getResources().getColor(R.color.clokS);
          editor.putInt("houCol" + ID, ColH);
          editor.putInt("minCol" + ID, ColM);
          editor.putInt("secCol" + ID, ColS);
          editor.apply();
          IndividualColourChange.this.draw();
        });

    ImageView colPickH = (ImageView) findViewById(R.id.colorHou);
    colPickH.setClickable(true);
    colPickH.setOnClickListener(
        v -> {
          ColorSelectorDialog dlg =
              new ColorSelectorDialog(
                  context,
                  color -> {
                    ColH = color;
                    Editor editor = settings.edit();
                    editor.putInt("houCol" + ID, ColH);
                    editor.apply();
                    draw();
                  },
                  ColH);
          dlg.setTitle(IndividualColourChange.this.getString(R.string.hHandCol));
          dlg.show();
        });

    ImageView colPickM = (ImageView) findViewById(R.id.colorMin);
    colPickM.setClickable(true);
    colPickM.setOnClickListener(
        v -> {
          ColorSelectorDialog dlg =
              new ColorSelectorDialog(
                  context,
                  color -> {
                    ColM = color;
                    Editor editor = settings.edit();
                    editor.putInt("minCol" + ID, ColM);
                    editor.apply();
                    draw();
                  },
                  ColM);
          dlg.setTitle(IndividualColourChange.this.getString(R.string.mHandCol));
          dlg.show();
        });

    ImageView colPickS = (ImageView) findViewById(R.id.colorSec);
    colPickS.setClickable(true);
    colPickS.setOnClickListener(
        v -> {
          ColorSelectorDialog dlg =
              new ColorSelectorDialog(
                  context,
                  color -> {
                    ColS = color;
                    Editor editor = settings.edit();
                    editor.putInt("minCol" + ID, ColS);
                    editor.apply();
                    draw();
                  },
                  ColS);
          dlg.setTitle(IndividualColourChange.this.getString(R.string.sHandCol));
          dlg.show();
        });
  }
示例#20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.info);

    // Set up the action bar.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayShowHomeEnabled(true);
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setLogo(R.drawable.tv_icon);
    actionBar.setDisplayShowTitleEnabled(true); // optional
    actionBar.setDisplayHomeAsUpEnabled(true);

    final TextView textViewAppVersion = (TextView) findViewById(R.id.textViewAppVersion);
    textViewAppVersion.setText("Version " + Utils.getAppVersionName(this, InfoActivity.class));

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    AnalyticsUtil.sendScreen("Info Screen");

    setTitle(getString(R.string.info));

    final TextView website = (TextView) findViewById(R.id.textViewWebsite);
    website.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            v.setBackgroundColor(getResources().getColor(R.color.orange));
            Utils.startBrowserActivity(getApplicationContext(), Constants.ANDROIDER_WOLKE_HOME);
          }
        });

    final Button zurueckButton = (Button) findViewById(R.id.buttonZurueck);
    zurueckButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            finish();
          }
        });

    final TextView zattoo = (TextView) findViewById(R.id.textViewZattoo);
    zattoo.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            v.setBackgroundColor(getResources().getColor(R.color.orange));
            Utils.startBrowserActivity(getApplicationContext(), "http://www.zattoo.com");
          }
        });

    final TextView wilmaa = (TextView) findViewById(R.id.textViewWilmaa);
    wilmaa.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            v.setBackgroundColor(getResources().getColor(R.color.orange));
            Utils.startBrowserActivity(getApplicationContext(), "http://www.wilmaa.com");
          }
        });

    final TextView teleboy = (TextView) findViewById(R.id.textViewTeleboy);
    teleboy.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            v.setBackgroundColor(getResources().getColor(R.color.orange));
            Utils.startBrowserActivity(getApplicationContext(), "http://www.teleboy.ch");
          }
        });

    // Load ads
    new Ads(this);
  }
 private void setHomeUpEnabled(boolean homeUpEnabled) {
   ActionBar actionBar = getSupportActionBar();
   actionBar.setDisplayShowHomeEnabled(true);
   actionBar.setDisplayUseLogoEnabled(false);
 }